/* ==========================================================================
   CSE_CMS v2 — Structural Base Stylesheet
   Visual tokens (--bg, --surface, --text, --accent, etc.) are supplied by
   themes/<name>/theme.css so templates and themes remain fully independent.
   ========================================================================== */

:root {
  --bg: #f6f7fb;
  --bg-accent: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.1);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-heading: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --sidebar-width: 280px;
  --max-width: 1280px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body[data-fx-page-fade="1"] {
  animation: csePageFade 0.35s ease-out;
}
@keyframes csePageFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

img { max-width: 100%; height: auto; }

/* Reading progress bar */
.cse-reading-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--accent);
  z-index: 1000;
  transition: width 0.08s linear;
}

/* ==========================================================================
   Headers (Classic Topbar, Magazine Hero, Minimalist Bar)
   ========================================================================== */
.cse-topbar, .cse-hero {
  background: var(--bg-accent);
  color: #f8fafc;
  position: relative;
  overflow: hidden;
}

.cse-topbar {
  min-height: 112px;
  display: flex;
  align-items: center;
}

.cse-hero__stage {
  position: relative;
  overflow: hidden;
}

.cse-banner-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: var(--banner-opacity, 0.9);
}

.cse-banner-controls {
  position: absolute;
  right: 0.75rem;
  bottom: 0.45rem;
  z-index: 3;
  display: flex;
  gap: 0.3rem;
}

.cse-banner-btn {
  background: rgba(15, 23, 42, 0.45);
  color: rgba(248, 250, 252, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 0.14rem 0.55rem;
  font-size: 0.7rem;
  line-height: 1.4;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.15s ease, color 0.15s ease;
}

.cse-banner-btn:hover {
  background: rgba(15, 23, 42, 0.75);
  color: #ffffff;
}

.cse-topbar__inner,
.cse-hero__inner,
.cse-topnav__inner,
.cse-minibar__inner {
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 0.9rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: relative;
  z-index: 2;
}

.cse-topbar .cse-brand__title,
.cse-hero .cse-brand__title,
.cse-hero__heading {
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
}

.cse-brand { display: flex; flex-direction: column; }
.cse-brand__title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: inherit;
  text-decoration: none;
  letter-spacing: -0.02em;
}
.cse-brand__title:hover { text-decoration: none; opacity: 0.9; }
.cse-brand__tagline {
  font-size: 0.82rem;
  opacity: 0.8;
}

/* Pulsating "dot" <-> "·" morph without shifting surrounding words */
.cse-dot-morph {
  display: inline-grid;
  place-items: center;
  vertical-align: baseline;
}
.cse-dot-word,
.cse-dot-sym {
  grid-area: 1 / 1;
}
.cse-dot-word {
  animation: cseDotWord 6.5s ease-in-out infinite;
}
.cse-dot-sym {
  font-size: 1.45em;
  line-height: 1;
  color: var(--banner-accent, var(--accent));
  opacity: 0;
  animation: cseDotSym 6.5s ease-in-out infinite;
}
@keyframes cseDotWord {
  0%, 34%, 100% { opacity: 1; transform: scale(1); }
  46%, 72% { opacity: 0; transform: scale(0.72); }
  84% { opacity: 1; transform: scale(1); }
}
@keyframes cseDotSym {
  0%, 34%, 100% { opacity: 0; transform: scale(0.5); }
  46%, 72% { opacity: 1; transform: scale(1.15); }
  84% { opacity: 0; transform: scale(0.5); }
}

/* Magazine Hero */
.cse-hero__inner {
  flex-direction: column;
  align-items: stretch;
  padding: 1.4rem 1.25rem 2.2rem;
  gap: 0.5rem;
}
.cse-hero__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.cse-hero__controls { display: flex; align-items: center; gap: 0.75rem; }
.cse-hero__heading {
  margin: 1rem 0 0.25rem;
  font-family: var(--font-heading);
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  line-height: 1.2;
}
.cse-hero__sub { margin: 0; opacity: 0.85; font-size: 0.95rem; }

.cse-topnav {
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.cse-topnav__inner {
  justify-content: flex-start;
  overflow-x: auto;
  padding: 0.5rem 1.25rem;
  gap: 0.4rem;
}
.cse-topnav__link {
  color: rgba(255, 255, 255, 0.88);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.9rem;
  white-space: nowrap;
}
.cse-topnav__link:hover,
.cse-topnav__link.is-active {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  text-decoration: none;
}

/* Magazine secondary category bar */
.cse-subnav {
  background: rgba(0, 0, 0, 0.34);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.cse-subnav__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.38rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  overflow-x: auto;
}
.cse-subnav__link {
  color: rgba(255, 255, 255, 0.78);
  padding: 0.22rem 0.65rem;
  border-radius: 6px;
  font-size: 0.82rem;
  white-space: nowrap;
}
.cse-subnav__link.is-folder { font-weight: 600; }
.cse-subnav__link:hover,
.cse-subnav__link.is-active {
  background: var(--banner-accent, var(--accent));
  color: #fff;
  text-decoration: none;
}

/* Minimalist & Exbed Bar */
.cse-minibar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.cse-minibar__inner { padding: 0.65rem 1.25rem; }
.cse-minibar .cse-brand__title { color: var(--text); font-size: 1.15rem; }

/* Language switcher */
.cse-lang-switch { display: flex; align-items: center; gap: 0.4rem; }
.cse-lang-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.45rem;
  border-radius: 6px;
  color: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  opacity: 0.75;
}
.cse-lang-link:hover, .cse-lang-link.is-active {
  opacity: 1;
  background: rgba(128, 128, 128, 0.2);
  text-decoration: none;
}
.cse-lang-link img, .cse-lang-badge {
  width: 18px;
  height: 12px;
  object-fit: cover;
  border-radius: 2px;
  vertical-align: middle;
}

/* Drawer toggle button */
.cse-drawer-toggle {
  display: none;
  background: rgba(128, 128, 128, 0.18);
  color: inherit;
  border: 1px solid rgba(128, 128, 128, 0.28);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.65rem;
  font-size: 1.1rem;
  cursor: pointer;
}
.cse-drawer-toggle--always { display: inline-flex; align-items: center; }

/* ==========================================================================
   Main Shell & Responsive Sidebar
   ========================================================================== */
.cse-shell {
  max-width: var(--max-width);
  width: 100%;
  margin: 1.5rem auto;
  padding: 0 1.25rem;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: 1.75rem;
  flex: 1;
  align-items: start;
}

.cse-shell--magazine {
  grid-template-columns: minmax(0, 1fr);
}

.cse-main {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.cse-main--narrow {
  max-width: 860px;
  width: calc(100% - 2.5rem);
  margin: 1.75rem auto;
  flex: 1;
}

.cse-exbed-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0.5rem;
}
.tpl-exbed .cse-embed-frame {
  min-height: calc(100vh - 70px);
}

/* ==========================================================================
   Vintage CSE Template (Framed 2008 Layout: Content Left, Sidebar Right)
   ========================================================================== */
.cse-vintage-frame {
  max-width: 1320px;
  width: calc(100% - 1.5rem);
  margin: 0.85rem auto 1rem;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  box-shadow: var(--shadow-md);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.cse-vintage-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 265px;
  border-bottom: 1px solid var(--border);
}

.cse-vintage-banner {
  background: var(--bg-accent);
  color: #f8fafc;
  position: relative;
  overflow: hidden;
  min-height: 98px;
  display: flex;
  align-items: center;
}
.cse-vintage-banner__inner {
  position: relative;
  z-index: 2;
  padding: 0.8rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.cse-vintage-banner .cse-brand__title {
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.cse-vintage-search {
  border-left: 1px solid var(--border);
  padding: 0.6rem 0.8rem;
  display: flex;
  align-items: center;
  background: var(--surface);
}
.cse-vintage-search .cse-search-form { width: 100%; }
.cse-vintage-search .cse-search-form__scope { margin-top: 0; margin-bottom: 0.35rem; }

.cse-vintage-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 265px;
  flex: 1;
}

.cse-vintage-left {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cse-vintage-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.42rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
  font-size: 0.85rem;
}

.cse-vintage-main {
  border: none;
  border-radius: 0;
  box-shadow: none;
  flex: 1;
}

.cse-vintage-sidebar {
  border-left: 1px solid var(--border);
  padding: 0.85rem;
  position: static;
}
.cse-vintage-sidebar .cse-widget--search { display: none; }

@media (max-width: 900px) {
  .cse-vintage-frame { width: 100%; margin: 0; border-left: none; border-right: none; }
  .cse-vintage-head { grid-template-columns: minmax(0, 1fr); }
  .cse-vintage-search { display: none; }
  .cse-vintage-grid { grid-template-columns: minmax(0, 1fr); }
  .cse-vintage-sidebar { position: fixed; border-left: none; }
  .cse-vintage-sidebar .cse-widget--search { display: block; }
}

.cse-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: 1.25rem;
}

.cse-sidebar__mobile-head {
  display: none;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.cse-drawer-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  color: var(--text);
  cursor: pointer;
}

/* Slide-out drawer mode (magazine, minimalist, exbed, and mobile classic) */
.cse-sidebar--drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(320px, 86vw);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.25rem;
  z-index: 200;
  overflow-y: auto;
  transform: translateX(-105%);
  transition: transform 0.25s ease;
  box-shadow: var(--shadow-md);
}
.cse-sidebar--drawer .cse-sidebar__mobile-head { display: flex; }
.cse-sidebar.is-open { transform: translateX(0); }

.cse-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.cse-drawer-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 900px) {
  .cse-drawer-toggle { display: inline-flex; align-items: center; }
  .cse-shell { grid-template-columns: minmax(0, 1fr); margin: 1rem auto; }
  .cse-main { padding: 1.25rem; }
  .cse-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(320px, 86vw);
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 1.25rem;
    z-index: 200;
    overflow-y: auto;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow-md);
  }
  .cse-sidebar__mobile-head { display: flex; }
}

/* ==========================================================================
   Sidebar Widgets & TOC
   ========================================================================== */
.cse-widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sm);
}

.cse-widget__title {
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: default;
}
details > summary.cse-widget__title { cursor: pointer; margin-bottom: 0; }
details[open] > summary.cse-widget__title { margin-bottom: 0.65rem; }
.cse-widget__more { font-size: 0.78rem; text-transform: none; letter-spacing: 0; }
.cse-widget__list { list-style: none; margin: 0; padding: 0; }
.cse-widget__list li { padding: 0.22rem 0; font-size: 0.92rem; }
.cse-widget__hint { font-size: 0.78rem; color: var(--text-muted); margin: 0.5rem 0 0; }

/* TOC */
.cse-toc, .cse-toc__sub {
  list-style: none;
  margin: 0;
  padding: 0;
}
.cse-toc__sub {
  margin-left: 0.85rem;
  padding-left: 0.65rem;
  border-left: 2px solid var(--border);
  margin-top: 0.2rem;
}
.cse-toc li { margin: 0.18rem 0; font-size: 0.92rem; }
.cse-toc__home > a { font-weight: 700; }
.cse-toc__folder > a { font-weight: 600; }
.cse-toc__folder.is-active > a { color: var(--accent); }
.cse-toc__file.is-link > a,
.cse-toc__file.is-embed > a { font-style: italic; }

/* Search form */
.cse-search-form__input-row { display: flex; gap: 0.4rem; }
.cse-search-form input[type="search"] {
  flex: 1;
  min-width: 0;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  color: var(--text);
  font-size: 0.9rem;
}
.cse-search-form__scope {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Switcher pills */
.cse-switcher { margin-bottom: 0.65rem; }
.cse-switcher:last-child { margin-bottom: 0; }
.cse-switcher__label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}
.cse-switcher__pills { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.cse-pill {
  font-size: 0.78rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
}
.cse-pill:hover { text-decoration: none; border-color: var(--accent); }
.cse-pill.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Mini stats */
.cse-stats-mini { list-style: none; margin: 0; padding: 0; font-size: 0.86rem; }
.cse-stats-mini li {
  display: flex;
  justify-content: space-between;
  padding: 0.2rem 0;
  border-bottom: 1px dashed var(--border);
}
.cse-stats-mini li:last-child { border-bottom: none; }

/* Login form */
.cse-login-form { display: flex; flex-direction: column; gap: 0.45rem; }
.cse-login-form input {
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  color: var(--text);
}
.cse-user-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ==========================================================================
   Breadcrumbs, Page Header & Content Typography
   ========================================================================== */
.cse-breadcrumbs {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.cse-breadcrumbs--inline { margin-bottom: 0; }
.cse-breadcrumbs__sep { opacity: 0.5; }

.cse-page-header {
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.cse-page-title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: clamp(1.45rem, 2.5vw, 2rem);
  line-height: 1.25;
}

.cse-content { overflow-wrap: break-word; }

/* Markdown typography */
.cse-markdown h1, .cse-markdown h2, .cse-markdown h3 {
  font-family: var(--font-heading);
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}
.cse-markdown pre {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.88rem;
}
.cse-markdown code {
  font-family: var(--font-mono);
  background: var(--surface-alt);
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
  font-size: 0.9em;
}
.cse-markdown pre code { background: none; padding: 0; }
.cse-markdown blockquote {
  margin: 1rem 0;
  padding: 0.6rem 1rem;
  border-left: 4px solid var(--accent);
  background: var(--surface-alt);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.md-table-wrap { overflow-x: auto; margin: 1rem 0; }
.cse-markdown table, .cse-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.cse-markdown th, .cse-markdown td, .cse-table th, .cse-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.cse-table td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* ==========================================================================
   Blog / Folder Card Grid & Visual Effects
   ========================================================================== */
.cse-news-box {
  background: var(--surface-alt);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}
.cse-news-box--footer { margin-top: 1.25rem; margin-bottom: 0; }

.cse-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.15rem;
}
@media (max-width: 680px) {
  .cse-card-grid { grid-template-columns: 1fr; }
}

.cse-card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.cse-card--wide { grid-column: 1 / -1; }
body[data-fx-card-hover="1"] .cse-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}
.cse-card__title {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.3;
}
.cse-card__meta { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.2rem; }
.cse-card__body { font-size: 0.94rem; flex: 1; }
.cse-card__footer { margin-top: 0.4rem; }
.cse-card__more { font-size: 0.86rem; font-weight: 600; }

.cse-folder-preview {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.9rem;
}
.cse-folder-preview li { padding: 0.16rem 0; }
.cse-preview-folder a { font-weight: 600; }
.cse-folder-thumbs { display: flex; gap: 0.4rem; margin-top: 0.4rem; }
.cse-folder-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; }

/* Scroll-reveal animation */
body[data-fx-scroll-reveal="1"] .cse-reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}
body[data-fx-scroll-reveal="1"] .cse-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   Gallery & Lightbox
   ========================================================================== */
.cse-gallery__nav { margin-bottom: 1rem; }
.cse-gallery__intro { margin-bottom: 1.25rem; }
.cse-gallery__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}
.cse-gallery__item {
  display: flex;
  flex-direction: column;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.cse-gallery__item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.cse-gallery__thumb {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.05);
}
.cse-gallery__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.cse-gallery__item:hover .cse-gallery__thumb img { transform: scale(1.05); }
.cse-gallery__thumb--empty { font-size: 2.5rem; }
.cse-gallery__caption {
  padding: 0.5rem 0.65rem;
  font-size: 0.82rem;
  color: var(--text);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Lightbox overlay */
.cse-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 24, 0.92);
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.cse-lightbox.is-open { opacity: 1; pointer-events: auto; }
.cse-lightbox__img {
  max-width: 90vw;
  max-height: 78vh;
  border-radius: var(--radius-sm);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.cse-lightbox__bar {
  margin-top: 0.85rem;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.92rem;
}
.cse-lightbox__btn {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border: none;
  border-radius: 999px;
  width: 42px;
  height: 42px;
  font-size: 1.3rem;
  cursor: pointer;
}
.cse-lightbox__btn:hover { background: rgba(255, 255, 255, 0.28); }
.cse-lightbox__close {
  position: fixed;
  top: 1rem;
  right: 1.25rem;
}

/* ==========================================================================
   Embeds, Museum Banner, Comments, Forms, Buttons & Stats Charts
   ========================================================================== */
.cse-embed-frame {
  width: 100%;
  min-height: 75vh;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
}

.cse-museum-banner {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-left: 4px solid #d97706;
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}

.cse-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.cse-btn:hover { text-decoration: none; opacity: 0.92; }
.cse-btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.cse-btn--subtle { background: transparent; }

.cse-notice, .cse-alert {
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  font-size: 0.92rem;
}
.cse-alert--error { background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.35); color: #b91c1c; }
.cse-alert--success { background: rgba(34, 197, 94, 0.12); border-color: rgba(34, 197, 94, 0.35); color: #15803d; }

/* Comments */
.cse-comments {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--border);
}
.cse-comments__list .comment, .cse-comments__list span.comment {
  display: block;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}
.cse-hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.cse-form { display: flex; flex-direction: column; gap: 0.75rem; }
.cse-form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
@media (max-width: 600px) { .cse-form__row { grid-template-columns: 1fr; } }
.cse-form label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.88rem; }
.cse-form input, .cse-form textarea {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  color: var(--text);
  font-family: inherit;
}
.cse-form__hint { font-size: 0.8rem; color: var(--text-muted); margin: 0; }

/* Stats Detail Dashboard */
.cse-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.25rem;
}
.cse-kpi-card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.cse-kpi-card__label { font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.cse-kpi-card__value { font-size: 1.45rem; line-height: 1.2; }
.cse-kpi-card__sub { font-size: 0.78rem; color: var(--text-muted); }

.cse-chart-card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.cse-chart-card h3 { margin: 0 0 0.75rem; font-size: 1rem; }
.cse-chart-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 720px) { .cse-chart-row { grid-template-columns: 1fr; } }
.cse-chart-box { width: 100%; min-height: 220px; position: relative; }
.cse-chart-legend { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 0.65rem; font-size: 0.82rem; }
.cse-chart-legend__item { display: inline-flex; align-items: center; gap: 0.35rem; }
.cse-chart-legend__dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* Search results */
.cse-search-list { list-style: none; padding: 0; margin: 0 0 1.25rem; }
.cse-search-list li {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}
.cse-search-path { font-size: 0.78rem; color: var(--text-muted); }
.cse-search-snippet { margin: 0.25rem 0 0; font-size: 0.88rem; color: var(--text-muted); }
.cse-search-snippet mark { background: var(--accent-soft); color: var(--text); padding: 0 0.2rem; border-radius: 3px; }

/* Footer */
.cse-footer {
  text-align: center;
  padding: 1.25rem;
  font-size: 0.84rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  margin-top: auto;
}

/* Respect user motion preferences */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  body[data-fx-scroll-reveal="1"] .cse-reveal {
    opacity: 1 !important;
    transform: none !important;
  }
}
