:root {
  --teal-deep: #0e1a18;
  --teal-mid: #152724;
  --teal-card: #1b312d;
  --parchment: #f4ede0;
  --parchment-2: #ebe1ce;
  --ink: #1d1a14;
  --ink-muted: #52493b;
  --cream: #f5efe2;
  --cream-muted: #c8beaa;
  --brass: #c9a255;
  --brass-bright: #e4c178;
  --brass-line: rgba(201, 162, 85, 0.36);
  --wax: #9e3529;
  --radius: 10px;
  --font-serif: "Iowan Old Style", "Palatino Linotype", "Noto Serif TC", "Yu Mincho", "Batang", Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "Hiragino Sans", "Malgun Gothic", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--cream);
  background: var(--teal-deep);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-serif); line-height: 1.25; margin-top: 0; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }

.container { width: min(1160px, 92vw); margin-inline: auto; }
.skip-link {
  position: absolute; left: -9999px; top: 8px;
  background: var(--brass); color: var(--ink); padding: 8px 14px; border-radius: 6px; font-weight: 700;
}
.skip-link:focus { left: 12px; z-index: 100; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(14, 26, 24, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--brass-line);
}
.header-inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 14px; padding: 12px 0;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-seal {
  width: 36px; height: 36px; border-radius: 6px;
  background: var(--wax); color: var(--cream);
  border: 1.5px solid var(--brass);
  display: grid; place-items: center;
  font-family: var(--font-serif); font-size: 1.15rem; font-weight: 700;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-family: var(--font-serif); font-size: 1.12rem; color: var(--cream); }
.brand-text small { font-size: 0.68rem; letter-spacing: 0.14em; color: var(--brass-bright); }

.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; font-size: 0.92rem; }
.site-nav a { text-decoration: none; color: var(--cream-muted); transition: color 0.18s ease; }
.site-nav a:hover, .site-nav a:focus-visible { color: var(--brass-bright); }
.nav-cta {
  background: transparent; color: var(--brass-bright);
  border: 1px solid var(--brass); border-radius: 999px;
  padding: 5px 13px; font: inherit; font-size: 0.85rem; cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease;
}
.nav-cta:hover, .nav-cta:focus-visible { background: var(--brass); color: var(--ink); }

.lang-switch { display: flex; gap: 4px; background: rgba(255,255,255,0.05); padding: 3px; border-radius: 8px; border: 1px solid var(--brass-line); }
.lang-switch button {
  background: transparent; border: 0; color: var(--cream-muted);
  padding: 4px 8px; border-radius: 6px; font-size: 0.78rem; cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease;
}
.lang-switch button[aria-pressed="true"] { background: var(--brass); color: var(--ink); font-weight: 700; }

/* Hero */
.hero { position: relative; padding: clamp(56px, 8vw, 96px) 0; overflow: clip; }
.hero-backdrop { position: absolute; inset: 0; z-index: 0; }
.hero-backdrop img { width: 100%; height: 100%; object-fit: cover; opacity: 0.24; filter: saturate(0.75) contrast(1.04); }
.hero-scrim {
  position: absolute; inset: 0;
  background: radial-gradient(circle at 74% 35%, rgba(201,162,85,0.12), transparent 55%),
              linear-gradient(105deg, rgba(14,26,24,0.96) 24%, rgba(14,26,24,0.78) 70%, rgba(14,26,24,0.92));
}
.hero-grid {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.95fr);
  gap: clamp(28px, 4vw, 52px); align-items: center;
}
.eyebrow {
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--brass-bright); margin: 0 0 10px;
}
.section-parchment .eyebrow { color: var(--wax); }
.hero h1 { font-size: clamp(2rem, 4.2vw, 3.35rem); margin-bottom: 18px; color: var(--cream); }
.hero-lead { font-size: 1.05rem; color: var(--cream-muted); max-width: 60ch; margin: 0 0 26px; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 28px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 11px 22px; border-radius: 8px; font: inherit; font-weight: 600; font-size: 0.95rem;
  text-decoration: none; cursor: pointer; border: 1.5px solid transparent;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.btn-primary { background: var(--brass); color: var(--ink); border-color: var(--brass-bright); }
.btn-primary:hover, .btn-primary:focus-visible { background: var(--brass-bright); }
.btn-secondary { background: rgba(255,255,255,0.06); color: var(--cream); border-color: var(--brass-line); }
.btn-secondary:hover, .btn-secondary:focus-visible { border-color: var(--brass-bright); background: rgba(201,162,85,0.14); }

.hero-facts {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px;
  border-top: 1px solid var(--brass-line); padding-top: 18px;
}
.hero-facts li { display: flex; flex-direction: column; }
.hero-facts strong { font-family: var(--font-serif); font-size: 1.35rem; color: var(--brass-bright); }
.hero-facts span { font-size: 0.8rem; color: var(--cream-muted); }

/* Hero museum collage plaque */
.plaque-frame {
  background: linear-gradient(160deg, rgba(244,237,224,0.97), rgba(235,225,206,0.94));
  color: var(--ink);
  border: 2px solid var(--brass);
  outline: 1px solid rgba(201, 162, 85, 0.45);
  outline-offset: -7px;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.42);
}
.plaque-label {
  font-size: 0.7rem; letter-spacing: 0.14em; font-weight: 700; color: var(--wax);
  text-align: center; margin-bottom: 14px;
}
.depiction-collage { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.sticker {
  margin: 0; background: #fbf7ef; border: 1px solid rgba(90, 72, 46, 0.25);
  border-radius: 8px; padding: 10px 10px 8px; text-align: center;
  box-shadow: 0 6px 16px rgba(28, 22, 14, 0.14);
}
.sticker img { width: 100%; aspect-ratio: 1 / 1; object-fit: contain; }
.sticker figcaption { font-family: var(--font-serif); font-size: 0.84rem; font-weight: 700; color: var(--ink); margin-top: 6px; }
@media (prefers-reduced-motion: no-preference) {
  .sticker-a { transform: rotate(-1.5deg); }
  .sticker-b { transform: rotate(1.4deg); }
  .sticker-c { transform: rotate(1.2deg); }
  .sticker-d { transform: rotate(-1.3deg); }
}
.plaque-disclaimer { font-size: 0.76rem; color: var(--ink-muted); text-align: center; margin: 14px 0 0; }

/* Sections */
.section { padding: clamp(54px, 7vw, 88px) 0; }
.section-parchment { background: var(--parchment); color: var(--ink); }
.section-teal { background: var(--teal-mid); color: var(--cream); border-block: 1px solid var(--brass-line); }
.section-head { margin-bottom: 32px; }
.section-head h2 { font-size: clamp(1.6rem, 3vw, 2.35rem); margin-bottom: 10px; }
.section-sub { color: var(--ink-muted); max-width: 68ch; margin: 0; }
.section-head-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }

/* Pillars */
.pillars-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.card {
  background: #fbf7ef; color: var(--ink);
  border: 1px solid rgba(145, 114, 58, 0.34);
  border-radius: var(--radius); padding: 22px;
  box-shadow: 0 6px 20px rgba(32, 24, 14, 0.06);
}
.card-num { font-family: var(--font-serif); font-size: 0.88rem; font-weight: 700; color: var(--wax); letter-spacing: 0.1em; }
.card h3 { font-size: 1.2rem; margin: 6px 0 8px; }
.card p { margin: 0; color: var(--ink-muted); font-size: 0.94rem; }

.museum-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem 2rem;
  margin-bottom: 1.5rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  color: var(--cream);
  background: var(--teal-card);
  border: 1px solid var(--brass);
  border-radius: var(--radius);
}
.museum-strip h3 { margin-bottom: 0.5rem; color: var(--brass-bright); }
.museum-strip p { margin: 0; }
.museum-strip .collection-scope {
  grid-column: 1 / -1;
  border-top: 1px solid var(--brass-line);
  padding-top: 1rem;
  font-size: 0.92rem;
  color: var(--cream-muted);
}
.gallery-scope { max-width: 65ch; margin: 0; color: var(--cream-muted); }
@media (max-width: 640px) {
  .museum-strip { grid-template-columns: minmax(0, 1fr); }
}

/* Filter tabs & Chapter Grid */
.filter-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-tabs button {
  background: rgba(255,255,255,0.06); color: var(--cream-muted);
  border: 1px solid var(--brass-line); border-radius: 999px;
  padding: 7px 14px; font: inherit; font-size: 0.86rem; cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.filter-tabs button[aria-selected="true"] { background: var(--brass); color: var(--ink); border-color: var(--brass-bright); font-weight: 700; }

.chapter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: 18px; }
.chapter-card {
  background: var(--teal-card); border: 1px solid var(--brass-line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  transition: border-color 0.2s ease;
}
.chapter-card:hover { border-color: var(--brass-bright); }
.chapter-thumb { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #0b1513; }
.chapter-thumb img { width: 100%; height: 100%; object-fit: cover; }
.chapter-kind {
  position: absolute; top: 10px; left: 10px;
  background: rgba(14, 26, 24, 0.86); color: var(--brass-bright);
  border: 1px solid var(--brass); border-radius: 999px;
  padding: 2px 10px; font-size: 0.72rem; font-weight: 700;
}
.chapter-body { padding: 16px 18px 18px; display: flex; flex-direction: column; flex: 1; }
.chapter-meta { font-size: 0.78rem; color: var(--brass-bright); margin-bottom: 4px; }
.chapter-body h3 { font-size: 1.15rem; margin-bottom: 8px; color: var(--cream); }
.chapter-body p { font-size: 0.88rem; color: var(--cream-muted); margin: 0 0 14px; flex: 1; }
.chapter-btn {
  align-self: flex-start; background: transparent; color: var(--brass-bright);
  border: 1px solid var(--brass-line); border-radius: 6px; padding: 6px 12px;
  font: inherit; font-size: 0.82rem; cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease;
}
.chapter-btn:hover, .chapter-btn:focus-visible { background: var(--brass); color: var(--ink); }

/* Subplays */
.subplay-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr)); gap: 20px; }
.subplay-card {
  background: #fbf7ef; border: 1px solid rgba(145, 114, 58, 0.34);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 8px 24px rgba(32, 24, 14, 0.08);
}
.subplay-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.subplay-body { padding: 18px 20px 22px; }
.badge {
  display: inline-block; font-size: 0.73rem; font-weight: 700; letter-spacing: 0.04em;
  color: var(--wax); background: rgba(158, 53, 41, 0.1);
  border: 1px solid rgba(158, 53, 41, 0.25); border-radius: 999px;
  padding: 2px 10px; margin-bottom: 8px;
}
.subplay-body h3 { font-size: 1.18rem; margin-bottom: 8px; color: var(--ink); }
.subplay-body p { margin: 0; font-size: 0.91rem; color: var(--ink-muted); }

/* Dual-Track Ledger */
.ledger-split { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 36px; align-items: center; }
.ledger-copy p { color: var(--cream-muted); }
.ledger-diagram { display: flex; flex-direction: column; gap: 12px; }
.track {
  background: var(--teal-card); border: 1.5px solid var(--brass-line);
  border-radius: var(--radius); padding: 18px 20px;
}
.track-sim { border-color: var(--brass); }
.track-head { font-family: var(--font-serif); font-weight: 700; color: var(--brass-bright); margin-bottom: 8px; }
.track ul { margin: 0; padding-left: 18px; color: var(--cream-muted); font-size: 0.9rem; }
.track-connector { text-align: center; font-size: 1.4rem; color: var(--brass-bright); }

/* Footer */
.site-footer { padding: 34px 0; background: var(--teal-deep); border-top: 1px solid var(--brass-line); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 20px; }
.footer-note { font-size: 0.82rem; color: var(--cream-muted); max-width: 66ch; margin: 6px 0 0; }
.footer-meta { display: flex; flex-direction: column; gap: 4px; font-size: 0.82rem; color: var(--brass-bright); text-align: right; }

/* Native Modal Dialog + Discrete Top-Layer Transition */
.museum-dialog {
  padding: 0; border: 2px solid var(--brass); border-radius: 12px;
  background: var(--parchment); color: var(--ink);
  width: min(720px, 92vw); max-height: 85vh;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}
.museum-dialog::backdrop {
  background: rgba(10, 18, 16, 0.72);
  backdrop-filter: blur(3px);
}
@media (prefers-reduced-motion: no-preference) {
  .museum-dialog {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s ease-out, transform 0.2s ease-out, display 0.2s, overlay 0.2s;
    transition-behavior: allow-discrete;
  }
  .museum-dialog[open] {
    opacity: 1;
    transform: translateY(0);
    @starting-style {
      opacity: 0;
      transform: translateY(10px);
    }
  }
}
.dialog-shell { display: flex; flex-direction: column; max-height: 85vh; }
.dialog-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  padding: 20px 24px 14px; border-bottom: 1px solid rgba(145, 114, 58, 0.28);
}
.dialog-head .eyebrow { color: var(--wax); margin-bottom: 4px; }
.dialog-head h2 { margin: 0; font-size: 1.45rem; }
.dialog-close {
  background: transparent; border: 1px solid rgba(90, 72, 46, 0.35); border-radius: 6px;
  width: 34px; height: 34px; font-size: 1rem; color: var(--ink); cursor: pointer;
}
.dialog-close:hover { background: rgba(158, 53, 41, 0.12); }
.dialog-body { padding: 18px 24px; overflow-y: auto; font-size: 0.95rem; color: var(--ink); }
.dialog-body h3 { font-size: 1.05rem; margin: 16px 0 6px; color: var(--wax); }
.dialog-body ul { margin: 6px 0 12px; padding-left: 20px; }
.dialog-foot {
  padding: 12px 24px 18px; border-top: 1px solid rgba(145, 114, 58, 0.28);
  display: flex; justify-content: flex-end;
}

/* Collection objects keep their original proportions inside the gallery mounts. */
.chapter-thumb.collection-mount,
.subplay-card img.collection-mount {
  background: var(--parchment-2);
}
.chapter-thumb.collection-mount img,
.subplay-card img.collection-mount {
  object-fit: contain;
}
.dialog-body figure {
  margin: 0 0 1rem;
}
.dialog-body figure img {
  width: 100%;
  height: auto;
  max-height: 45vh;
  border: 1px solid rgba(145, 114, 58, 0.35);
  border-radius: 8px;
  object-fit: contain;
  background: var(--parchment-2);
}
.dialog-body figcaption {
  margin-top: 0.75rem;
  color: var(--ink-muted);
  overflow-wrap: anywhere;
}
.collection-credits dt {
  margin-top: 1rem;
  font-weight: 700;
}
.collection-credits dd {
  margin: 0.25rem 0 0;
  color: var(--ink-muted);
}

/* Decorative Scroll-Driven Card Entry (Progressive Enhancement) */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) and (animation-range: entry) {
    @keyframes atlas-reveal {
      from { opacity: 0.35; transform: translateY(18px); }
      to { opacity: 1; transform: translateY(0); }
    }
    .reveal {
      animation: atlas-reveal auto ease-out backwards;
      animation-timeline: view();
      animation-range: entry 0% entry 65%;
    }
  }
}

@media (max-width: 860px) {
  .hero-grid, .ledger-split { grid-template-columns: 1fr; }
  .hero-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-meta { text-align: left; }
}
