/* ============================================================
   base — reset、排版、版面骨架
   ============================================================ */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--ink-deep);
}

body {
  margin: 0;
  font-family: var(--f-body);
  font-size: var(--t-md);
  line-height: 1.78;
  color: var(--fg);
  background: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  /* 底噪：細顆粒，讓大面積深色不死板 */
  background-image:
    radial-gradient(1200px 800px at 82% -10%, rgba(27,107,128,.22), transparent 62%),
    radial-gradient(900px 700px at 8% 108%, rgba(217,119,66,.08), transparent 58%);
  background-attachment: fixed;
}

/* 顆粒疊層 */
body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

img, svg, canvas { display: block; max-width: 100%; }

h1, h2, h3, h4 {
  font-family: var(--f-display);
  font-weight: 600;
  line-height: 1.24;
  letter-spacing: -.012em;
  margin: 0;
  text-wrap: balance;
}

p { margin: 0 0 1em; max-width: var(--measure); }
p:last-child { margin-bottom: 0; }

a { color: var(--water-lit); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--clay-lit); }

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

textarea { resize: vertical; }

::selection { background: var(--clay); color: #fff; }

:focus-visible {
  outline: 2px solid var(--clay-lit);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

/* 捲軸 */
* { scrollbar-width: thin; scrollbar-color: var(--water-dim) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--water-dim); border-radius: 99px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- 無障礙 ---------- */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--s4); top: -100px; z-index: 10000;
  background: var(--clay); color: #fff; padding: var(--s3) var(--s5);
  font-weight: 700; transition: top var(--dur) var(--ease);
}
.skip-link:focus { top: var(--s4); }

/* ============================================================
   版面骨架
   ============================================================ */

.shell {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.wrap  { width: min(100% - var(--rail) * 2, var(--page)); margin-inline: auto; }
.wrap--wide { width: min(100% - var(--rail) * 2, var(--page-wide)); margin-inline: auto; }
.wrap--narrow { width: min(100% - var(--rail) * 2, 780px); margin-inline: auto; }

.stack > * + * { margin-top: var(--s5); }
.stack-sm > * + * { margin-top: var(--s3); }
.stack-lg > * + * { margin-top: var(--s7); }

.row { display: flex; gap: var(--s4); align-items: center; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.row--tight { gap: var(--s2); }

.section { padding-block: clamp(var(--s7), 7vw, var(--s9)); }
.section--tight { padding-block: var(--s7); }

/* ============================================================
   頁首：水流帶
   ============================================================ */

.topbar {
  position: sticky; top: 0; z-index: 80;
  background: color-mix(in srgb, var(--ink-deep) 88%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--rule);
}

.topbar__inner {
  display: flex; align-items: center; gap: var(--s5);
  padding-block: var(--s3);
  min-height: 60px;
}

.brand {
  display: flex; align-items: baseline; gap: var(--s3);
  text-decoration: none; color: var(--fg); flex-shrink: 0;
}
.brand__mark {
  font-family: var(--f-mono);
  font-size: var(--t-micro);
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--water-lit);
}
.brand__name {
  font-family: var(--f-display);
  font-size: var(--t-sm);
  font-weight: 600;
  letter-spacing: .02em;
}
.brand:hover .brand__name { color: var(--clay-lit); }

.topbar__spacer { flex: 1; }

/* 水流進度帶：目前上到第幾節，水已經流到哪 */
.streambar {
  position: relative;
  height: 3px;
  background: var(--ink-deep);
  overflow: hidden;
}
.streambar__fill {
  position: absolute; inset-block: 0; left: 0;
  background: linear-gradient(90deg, var(--water-dim), var(--water-lit));
  transition: width var(--dur-slow) var(--ease-out);
}
.streambar__fill::after {
  content: "";
  position: absolute; inset-block: 0; right: 0; width: 90px;
  background: linear-gradient(90deg, transparent, var(--clay-lit));
  animation: streamPulse 2.6s var(--ease) infinite;
}
@keyframes streamPulse { 0%,100% { opacity: .35 } 50% { opacity: 1 } }

/* ============================================================
   頁尾
   ============================================================ */
.footer {
  border-top: 1px solid var(--rule);
  padding-block: var(--s7) var(--s8);
  color: var(--fg-3);
  font-size: var(--t-xs);
}
.footer a { color: var(--fg-2); }

/* ============================================================
   共用排版件
   ============================================================ */

/* 眉標：SESSION 03 / 查資料 */
.eyebrow {
  font-family: var(--f-mono);
  font-size: var(--t-micro);
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--water-lit);
  display: flex; align-items: center; gap: var(--s3);
}
.eyebrow::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--rule-strong), transparent);
}
.eyebrow--clay { color: var(--clay-lit); }

/* 大提問：課堂上投影的那一句 */
.ask {
  font-family: var(--f-display);
  font-size: var(--t-xxl);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -.02em;
  max-width: 18ch;
  text-wrap: balance;
}
.ask--wide { max-width: 26ch; }
.ask em {
  font-style: normal;
  color: var(--clay-lit);
  /* 水面下劃線 */
  background-image: linear-gradient(transparent 66%, var(--clay-film) 66%);
}

.lede {
  font-size: var(--t-lg);
  line-height: 1.6;
  color: var(--fg-2);
  max-width: 44ch;
}

.note-line {
  font-size: var(--t-sm);
  color: var(--fg-3);
  font-style: italic;
  max-width: 50ch;
}

/* 數據：157 公頃 / 105 億 */
.datum { display: flex; flex-direction: column; gap: var(--s1); }
.datum__n {
  font-family: var(--f-mono);
  font-size: var(--t-xl);
  font-weight: 500;
  line-height: 1;
  color: var(--clay-lit);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.datum__l {
  font-size: var(--t-xs);
  color: var(--fg-3);
  line-height: 1.5;
  max-width: 24ch;
}
.datum--water .datum__n { color: var(--water-lit); }

.datum-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--s5) var(--s6);
  border-top: 1px solid var(--rule);
  padding-top: var(--s5);
}

/* 引文 / 強調段 */
.pull {
  border-left: 2px solid var(--clay);
  padding-left: var(--s5);
  font-family: var(--f-display);
  font-size: var(--t-lg);
  line-height: 1.5;
  color: var(--fg);
  max-width: 34ch;
}

/* ============================================================
   工具類
   ============================================================ */
.muted   { color: var(--fg-3); }
.mono    { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.clay    { color: var(--clay-lit); }
.water   { color: var(--water-lit); }
.center  { text-align: center; }
.hide    { display: none !important; }
.nowrap  { white-space: nowrap; }
.grow    { flex: 1; }
.full    { width: 100%; }

/* 只在中文 / 只在英文顯示 */
:root[data-lang="zh"] [lang="en"].alt,
:root[data-lang="en"] [lang="zh"].alt { display: none; }

/* 進場：整頁載入一次的錯落浮現 */
.enter > * {
  opacity: 0;
  transform: translateY(14px);
  animation: rise .62s var(--ease-out) forwards;
}
.enter > *:nth-child(1) { animation-delay: .02s }
.enter > *:nth-child(2) { animation-delay: .08s }
.enter > *:nth-child(3) { animation-delay: .14s }
.enter > *:nth-child(4) { animation-delay: .20s }
.enter > *:nth-child(5) { animation-delay: .26s }
.enter > *:nth-child(6) { animation-delay: .32s }
.enter > *:nth-child(n+7) { animation-delay: .38s }
@keyframes rise { to { opacity: 1; transform: none } }

@media print {
  body::after, .topbar, .footer, .toolbar { display: none !important; }
  body { background: #fff; color: #000; }
  .paper { box-shadow: none; border: 1px solid #999; }
}
