/* 烽火虎门 · 全站样式。顺序:基础 → 通用组件 → 各章节。新章节在末尾追加一段。 */

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--lime);
  color: var(--ink);
  font: 400 16px/1.75 var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* 宣纸粒:5–12% 噪点,不抢线 */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 100; opacity: .09;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .1 0 0 0 0 .12 0 0 0 0 .14 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
h1, h2, h3, h4 { font-family: var(--font-title); font-weight: 600; letter-spacing: .08em; line-height: 1.3; margin: 0; }
p { margin: 0 0 1em; }
img, video, canvas, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--seal); outline-offset: 3px; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.chapter { position: relative; min-height: 100vh; padding: 120px 0 96px; border-top: var(--line); }

/* ---------- 章节标题(壹 贰 叁…) ---------- */
.chapter-head { display: grid; grid-template-columns: auto 1fr; gap: 0 24px; align-items: end; margin-bottom: 48px; }
.chapter-num { grid-row: span 2; font: 700 clamp(56px, 9vw, 104px)/1 var(--font-display); color: var(--stone); }
.chapter-kicker { font: 400 clamp(22px, 2.4vw, 30px)/1.1 var(--font-script); color: var(--seal); }
.chapter-title { font-size: clamp(28px, 4vw, 44px); }
.chapter-lead { max-width: 40em; color: var(--ink-soft); margin-bottom: 40px; }

/* ---------- 通用组件 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5em;
  padding: .7em 1.4em; border: var(--line); border-radius: var(--radius);
  background: transparent; letter-spacing: .12em; transition: background .2s, color .2s;
}
.btn:hover:not(:disabled) { background: var(--ink); color: var(--lime); }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn--solid { background: var(--stone); border-color: var(--stone); color: var(--lime); }
.btn--solid:hover:not(:disabled) { background: var(--ink); border-color: var(--ink); }
.btn--seal { background: var(--seal); border-color: var(--seal); color: var(--lime); }

.tabs { display: flex; flex-wrap: wrap; gap: 0; border-bottom: var(--line); margin-bottom: 24px; }
.tab {
  padding: .6em 1.2em; border: 0; border-bottom: 3px solid transparent; background: none;
  font-family: var(--font-title); letter-spacing: .1em; color: var(--ink-soft); margin-bottom: -1px;
}
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--seal); }

.card { background: rgba(232, 217, 196, .45); border: var(--line); padding: 24px; }
.tag { display: inline-block; font: 600 12px/1 var(--font-latin); letter-spacing: .14em; padding: .35em .7em; border: 1px solid currentColor; color: var(--sea-text); }
.note { font-size: 13px; color: var(--sea-text); }
.seal-mark { display: inline-grid; place-items: center; width: 1.6em; height: 1.6em; background: var(--seal); color: var(--lime); font-family: var(--font-title); font-size: .8em; }

/* 滚动浮现:core.js 给 .reveal 加 .is-in */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- 导航:右侧章节栏 + 水道进度 ---------- */
.rail {
  position: fixed; right: 20px; top: 50%; transform: translateY(-50%); z-index: 50;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.rail-track { position: absolute; top: 0; bottom: 48px; width: 1px; background: var(--rule); z-index: -1; }
.rail-progress { width: 100%; height: 0; background: var(--stone); }
.rail a {
  display: grid; place-items: center; width: 36px; height: 36px; text-decoration: none;
  font-family: var(--font-title); color: var(--ink-soft); background: var(--lime); border: 1px solid var(--rule);
  transition: all .25s;
}
.rail a:hover { color: var(--ink); border-color: var(--ink); }
.rail a.is-active { background: var(--stone); color: var(--lime); border-color: var(--stone); }
.rail a span { position: absolute; right: 48px; white-space: nowrap; font-size: 13px; letter-spacing: .1em; opacity: 0; pointer-events: none; transition: opacity .2s; }
.rail a:hover span { opacity: 1; color: var(--ink); }
.sound-toggle { margin-top: 12px; width: 36px; height: 36px; border: 1px solid var(--rule); background: var(--lime); font-size: 13px; }
.sound-toggle[aria-pressed="true"] { color: var(--seal); border-color: var(--seal); }

@media (max-width: 720px) {
  .rail { top: auto; bottom: 0; left: 0; right: 0; transform: none; flex-direction: row; justify-content: center; gap: 6px; padding: 8px; background: rgba(242, 237, 228, .94); border-top: var(--line); }
  .rail-track, .rail a span { display: none; }
  .sound-toggle { margin: 0 0 0 8px; }
  .chapter { padding: 88px 0 120px; }
}

/* ---------- 01 序幕 ---------- */
.hero { position: relative; min-height: 100vh; display: grid; align-items: end; color: var(--lime); background: var(--ink); overflow: hidden; border-top: 0; padding: 0; }
.hero-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; max-width: none; opacity: .45; filter: grayscale(.4) blur(3px); transform: scale(1.04); }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(26, 31, 36, .3) 0%, rgba(26, 31, 36, .72) 82%, var(--lime) 100%); }
.hero-inner { position: relative; z-index: 1; padding-bottom: 20vh; padding-top: 15vh; }
.hero-title { font: 700 clamp(56px, 12vw, 160px)/1.05 var(--font-display); letter-spacing: .08em; }
.hero-sub { font: 500 clamp(14px, 1.6vw, 18px)/1.6 var(--font-latin); letter-spacing: .3em; margin: 16px 0 32px; }
.hero-acts { display: flex; flex-wrap: wrap; gap: 8px 28px; font-family: var(--font-title); letter-spacing: .12em; margin-bottom: 40px; }
.hero-acts b { color: var(--gold); font-weight: 600; margin-right: .4em; }
.hero-quote { max-width: 34em; border-left: 3px solid var(--seal); padding-left: 16px; font-family: var(--font-quote); margin: 0 0 40px; }
.hero-quote cite { display: block; font: normal 13px var(--font-body); opacity: .75; margin-top: 6px; }
.hero .btn { border-color: var(--lime); color: var(--lime); }
.hero .btn:hover { background: var(--lime); color: var(--ink); }

/* ---------- 02 海防沙盘 ---------- */
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; }
.map-stage { position: relative; border: var(--line); background: var(--sea-tint); overflow: hidden; }
.map-stage svg { width: 100%; height: 100%; }
.map-land { fill: var(--lime); stroke: var(--ink); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.map-water-label { font: 500 14px var(--font-title); fill: var(--sea-text); letter-spacing: .4em; }
.map-gate { stroke: var(--sea); stroke-dasharray: 4 4; stroke-width: 1; fill: none; vector-effect: non-scaling-stroke; }
.map-gate-label { font: 600 12px var(--font-title); fill: var(--sea-text); letter-spacing: .2em; }
.map-chain { stroke: var(--ink); stroke-width: 2.5; stroke-dasharray: 2 3; vector-effect: non-scaling-stroke; }
.map-route { stroke: var(--seal); stroke-width: 2.5; fill: none; vector-effect: non-scaling-stroke; stroke-dasharray: 1000; animation: draw 2.4s var(--ease) forwards; }
.map-route-head { fill: var(--seal); }
@keyframes draw { from { stroke-dashoffset: 1000; } to { stroke-dashoffset: 0; } }
.map-node { cursor: pointer; }
.map-node circle { fill: var(--stone); stroke: var(--lime); stroke-width: 2; transition: r .2s; }
.map-node.is-fallen circle { fill: var(--seal); }
.map-node.is-site circle { fill: var(--gold); }
.map-node text { font: 600 13px var(--font-title); fill: var(--ink); paint-order: stroke; stroke: var(--lime); stroke-width: 4px; letter-spacing: .06em; }
.map-node:hover circle, .map-node.is-active circle { r: 9; }
.map-node.is-dim { opacity: .3; }
.map-panel h3 { font-size: 24px; margin: 8px 0 4px; }
.map-panel .phase-text { border-top: var(--line); padding-top: 16px; margin-top: 16px; }
.map-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--ink-soft); margin-top: 12px; }
.map-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.map-credit { position: absolute; right: 8px; bottom: 6px; font: 11px var(--font-latin); color: var(--sea-text); }
@media (max-width: 900px) { .map-layout { grid-template-columns: 1fr; } }

/* ---------- 03 实验台 ---------- */
.lab-panel[hidden] { display: none; }
.lab-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; }
.lab-canvas { width: 100%; aspect-ratio: 16 / 9; border: var(--line); background: var(--lime); }
.lab-controls { display: flex; flex-direction: column; gap: 16px; }
.lab-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.lab-steps .btn { width: 100%; justify-content: flex-start; text-align: left; }
.lab-steps .btn.is-done { background: var(--stone); color: var(--lime); border-color: var(--stone); opacity: 1; }
.lab-readout { font: 600 28px/1.2 var(--font-num); color: var(--stone); }
.lab-readout small { font: 13px var(--font-body); color: var(--sea-text); display: block; }
.lab-msg { min-height: 3.5em; font-size: 14px; border-left: 3px solid var(--gold); padding-left: 12px; }
.lab-msg.is-warn { border-left-color: var(--seal); }
.formula { font: 500 15px var(--font-num); background: var(--paper); padding: 8px 12px; }
.field label { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; }
.field input[type="range"] { width: 100%; accent-color: var(--stone); }
.seg { display: flex; border: var(--line); }
.seg button { flex: 1; padding: .5em; border: 0; background: none; border-right: var(--line); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--stone); color: var(--lime); }
.shake { animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@media (max-width: 900px) { .lab-grid { grid-template-columns: 1fr; } }

/* ---------- 04 文创展厅 ---------- */
.gallery-posters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-bottom: 64px; }
.poster { margin: 0; cursor: zoom-in; }
.poster-frame { aspect-ratio: 3 / 4; border: var(--line); background: var(--paper); display: grid; place-items: center; overflow: hidden; }
.poster-frame img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.poster:hover img { transform: scale(1.04); }
.poster-empty { font: 600 15px var(--font-title); color: var(--sea-text); writing-mode: vertical-rl; letter-spacing: .4em; }
.poster figcaption { margin-top: 12px; font-family: var(--font-title); letter-spacing: .1em; }
.poster figcaption small { display: block; font: 13px var(--font-body); color: var(--sea-text); letter-spacing: 0; }
.fold { perspective: 1600px; margin-bottom: 16px; }
.fold-card { position: relative; aspect-ratio: 400 / 210; transform-style: preserve-3d; transition: transform 1s var(--ease); }
.fold-card.is-flipped { transform: rotateY(180deg); }
.fold-face { position: absolute; inset: 0; backface-visibility: hidden; border: var(--line); background: var(--paper); }
.fold-face img { width: 100%; height: 100%; object-fit: contain; }
.fold-face--back { transform: rotateY(180deg); }
.kit { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 64px; }
.kit .card h4 { font-size: 18px; margin: 12px 0 8px; }
.lightbox[open] { display: grid; }
.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(26, 31, 36, .92); cursor: zoom-out; place-items: center; padding: 24px; border: 0; width: 100%; height: 100%; max-width: none; max-height: none; }
.lightbox img { max-height: 90vh; width: auto; }
@media (max-width: 720px) { .gallery-posters, .kit { grid-template-columns: 1fr; } }

/* ---------- 05 通关文牒 ---------- */
.quiz { display: grid; gap: 24px; max-width: 760px; }
.quiz-q h4 { font-size: 19px; margin-bottom: 12px; }
.quiz-q h4 b { color: var(--seal); margin-right: .5em; }
.quiz-opts { display: grid; gap: 8px; }
.quiz-opts button { text-align: left; padding: .7em 1em; border: 1px solid var(--rule); background: var(--lime); transition: border-color .2s; }
.quiz-opts button:hover:not(:disabled) { border-color: var(--ink); }
.quiz-opts button.is-right { border-color: var(--stone); background: var(--stone); color: var(--lime); }
.quiz-opts button.is-wrong { border-color: var(--seal); color: var(--seal); text-decoration: line-through; }
.quiz-why { margin-top: 12px; font-size: 14px; color: var(--ink-soft); border-left: 3px solid var(--gold); padding-left: 12px; }
.pass-out { margin-top: 48px; display: grid; gap: 16px; justify-items: start; }
.pass-out[hidden] { display: none; }
.pass-out canvas { width: min(100%, 560px); height: auto; border: var(--line); box-shadow: 0 12px 40px rgba(26, 31, 36, .18); }
.pass-name { display: flex; gap: 8px; align-items: center; }
.pass-name input { font: inherit; padding: .5em .8em; border: var(--line); background: var(--lime); width: 12em; }

.footer { border-top: var(--line); padding: 32px 0 96px; font-size: 13px; color: var(--sea-text); }
