/* essay.css — Rauno-inspired long-scroll essay */

@font-face { font-family: 'JFJinXuan'; src: url('uploads/jf-jinxuan-bold.otf') format('opentype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'JFJinXuan'; src: url('uploads/jf-jinxuan-fresh2.2-book.otf') format('opentype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Jost'; src: url('uploads/jost-light.woff2') format('woff2'); font-weight: 300; font-display: swap; }

:root {
  --paper: #f0e3c4;
  --paper2: #e6d6b0;
  --ink: #1f1810;
  --ink2: #3a2e1c;
  --muted: rgba(31,24,16,0.55);
  --faint: rgba(31,24,16,0.32);
  --hair: rgba(31,24,16,0.22);
  --rule: rgba(31,24,16,0.12);
  --gold: #a87a30;
  --goldHi: #c4923a;
  --display: 'JFJinXuan', 'Noto Sans TC', serif;
  --body: 'JFJinXuan', 'Noto Sans TC', sans-serif;
  --en: 'Jost', 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-feature-settings: "palt";
  -webkit-font-smoothing: antialiased;
  line-height: 1.7;
  background-image:
    radial-gradient(circle at 50% 50%, rgba(31,24,16,0.04) 1px, transparent 1.5px);
  background-size: 26px 26px;
}

/* warm glow patches */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse 1400px 800px at 20% 10%, rgba(212,156,58,0.10) 0%, transparent 55%),
    radial-gradient(ellipse 1200px 800px at 80% 90%, rgba(31,24,16,0.06) 0%, transparent 60%);
}

/* ── Fixed chrome ─────────────────────────── */
.chrome { position: fixed; z-index: 50; font-family: var(--en);
  font-size: 12px; letter-spacing: 0.3em; color: var(--muted); text-transform: uppercase; }
.chrome.tl { top: 28px; left: 36px; }
.chrome.tr { top: 28px; right: 36px; display: flex; gap: 18px; align-items: center; }
.chrome.br { bottom: 28px; right: 36px; }

.chip {
  padding: 6px 12px; border: 1px solid var(--hair);
  background: rgba(240,227,196,0.6); backdrop-filter: blur(8px);
  border-radius: 2px; font-family: var(--en); font-size: 11px;
  letter-spacing: 0.3em; color: var(--ink2);
  transition: all 0.2s ease;
}
.chip:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); cursor: pointer; }

/* ── Progress rail ─────────────────────────── */
.rail { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 60;
  background: var(--rule); }
.rail-bar { height: 100%; background: var(--gold); width: 0%;
  transition: width 0.1s linear; }

/* ── Side nav (mini TOC) ─────────────────────── */
.toc { position: fixed; right: 36px; top: 50%; transform: translateY(-50%);
  z-index: 50; display: flex; flex-direction: column; gap: 12px;
  font-family: var(--en); font-size: 10px; letter-spacing: 0.24em; }
.toc a { display: flex; align-items: center; gap: 10px;
  color: var(--muted); text-decoration: none; text-transform: uppercase;
  transition: color 0.2s ease; }
.toc a::before {
  content: ""; display: block; width: 18px; height: 1px; background: var(--hair);
  transition: all 0.25s ease;
}
.toc a:hover, .toc a.active { color: var(--ink); }
.toc a:hover::before, .toc a.active::before { width: 32px; background: var(--gold); height: 2px; }
@media (max-width: 1100px) { .toc { display: none; } }

/* ── Page container ─────────────────────────── */
main {
  position: relative; z-index: 2;
  max-width: 760px; margin: 0 auto; padding: 180px 36px 200px;
}

/* ── Section header ─────────────────────────── */
.sec {
  display: flex; align-items: baseline; gap: 18px;
  margin: 120px 0 36px;
  padding-bottom: 12px; border-bottom: 1px solid var(--ink);
}
.sec-num {
  font-family: var(--en); font-size: 12px; letter-spacing: 0.4em;
  color: var(--gold); text-transform: uppercase;
}
.sec-title { font-family: var(--display); font-size: 26px; font-weight: 700;
  letter-spacing: 0.04em; flex: 1; }
.sec-time { font-family: var(--en); font-size: 11px; letter-spacing: 0.24em;
  color: var(--muted); text-transform: uppercase; }

/* ── Hero ─────────────────────────────────────── */
.hero { margin-bottom: 140px; }
.hero-meta {
  font-family: var(--en); font-size: 12px; letter-spacing: 0.4em;
  color: var(--muted); text-transform: uppercase; margin-bottom: 28px;
}
.hero h1 {
  font-family: var(--display); font-size: clamp(52px, 7.5vw, 120px);
  font-weight: 700; letter-spacing: 0.02em; line-height: 1.05;
  margin: 0 0 36px;
  word-break: keep-all;
}
.hero-sub {
  font-size: 26px; color: var(--ink2); font-weight: 400;
  letter-spacing: 0.04em; line-height: 1.5; max-width: 580px;
}
.hero-sub .gold { color: var(--gold); font-weight: 700; }
.hero-hair {
  width: 80px; height: 2px; background: var(--gold); margin: 56px 0;
}
.hero-byline {
  font-family: var(--en); font-size: 13px; letter-spacing: 0.3em;
  color: var(--muted); text-transform: uppercase;
}

/* ── Body type ─────────────────────────────── */
.p {
  font-size: 19px; line-height: 1.85; color: var(--ink);
  margin: 0 0 24px; letter-spacing: 0.02em;
}
.p.lead { font-size: 22px; color: var(--ink); font-weight: 400; }
.p.note { font-size: 16px; color: var(--ink2); font-style: italic; }
.p .em { color: var(--gold); font-weight: 700; font-style: normal; }
.p .u { border-bottom: 1.5px solid var(--gold); padding-bottom: 1px; }

.pull {
  margin: 56px 0; padding: 0 0 0 24px;
  border-left: 3px solid var(--gold);
  font-family: var(--display); font-weight: 700;
  font-size: 36px; line-height: 1.4; letter-spacing: 0.03em;
  color: var(--ink);
}

/* ── Interactive: 6 mechanisms ─────────────── */
.mech {
  margin: 56px 0;
  border-top: 1px solid var(--rule);
}
.mech-row {
  display: grid; grid-template-columns: 80px 1fr 200px 32px;
  align-items: baseline; padding: 22px 0;
  border-bottom: 1px solid var(--rule);
  cursor: pointer; transition: all 0.25s ease;
  position: relative;
}
.mech-row::before {
  content: ""; position: absolute; left: -16px; right: -16px; top: 0; bottom: 0;
  background: transparent; transition: background 0.2s ease;
  z-index: -1;
}
.mech-row:hover::before { background: rgba(168,122,48,0.08); }
.mech-row.current .mech-name { color: var(--gold); }
.mech-row.current .mech-dot { background: var(--gold); }
.mech-row.current .mech-num { color: var(--gold); }

.mech-num { font-family: var(--en); font-size: 28px; font-weight: 300;
  letter-spacing: 0.1em; color: var(--ink); }
.mech-name { font-family: var(--display); font-size: 30px; font-weight: 500;
  letter-spacing: 0.04em; transition: color 0.2s ease; }
.mech-en { font-family: var(--en); font-size: 13px; letter-spacing: 0.22em;
  color: var(--muted); text-transform: uppercase; text-align: right; }
.mech-dot { width: 8px; height: 8px; border-radius: 50%;
  background: transparent; border: 1px solid var(--faint);
  margin-left: auto; transition: all 0.2s ease; }
.mech-row.current .mech-dot { border-color: var(--gold); }

.mech-stats { display: flex; gap: 36px; margin-top: 32px;
  font-family: var(--body); font-size: 14px; color: var(--ink2); }
.mech-stats b { display: block; font-family: var(--en); font-size: 36px;
  font-weight: 300; color: var(--ink); margin-bottom: 4px; letter-spacing: 0.04em; }
.mech-stats span { color: var(--muted); letter-spacing: 0.08em; }

/* ── Interactive formula ──────────────────── */
.formula-box {
  margin: 56px 0; padding: 56px 24px;
  background: rgba(255,250,232,0.5);
  border: 1px solid var(--hair);
  border-radius: 2px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.formula-box::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse 600px 300px at 50% 50%, rgba(168,122,48,0.18) 0%, transparent 70%);
  pointer-events: none;
}
.formula-row {
  position: relative; z-index: 2;
  display: flex; justify-content: center; align-items: baseline;
  gap: 14px; font-family: var(--display); flex-wrap: wrap;
}
.f-term {
  font-size: 64px; font-weight: 700; letter-spacing: 0.06em;
  color: var(--ink);
  padding: 8px 10px;
  cursor: pointer; position: relative;
  transition: color 0.2s ease;
}
.f-term[data-hint]:hover { color: var(--gold); }
.f-term[data-hint]::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: 4px;
  height: 3px; background: var(--gold); opacity: 0;
  transition: opacity 0.2s ease;
}
.f-term[data-hint]:hover::after { opacity: 1; }
.f-op { font-size: 44px; font-weight: 300; color: var(--faint); padding: 0 8px; }
.f-target { color: var(--gold); }

.f-hint {
  position: relative; z-index: 2;
  margin-top: 32px; min-height: 60px;
  font-family: var(--body); font-size: 17px;
  color: var(--ink2); letter-spacing: 0.04em;
  transition: opacity 0.25s ease;
  opacity: 0;
}
.f-hint.visible { opacity: 1; }
.f-hint .label {
  font-family: var(--en); font-size: 11px; letter-spacing: 0.3em;
  color: var(--gold); text-transform: uppercase; margin-bottom: 6px; display: block;
}

/* ── Three questions reveal ──────────────── */
.qs { margin: 56px 0; }
.q {
  padding: 28px 0; border-bottom: 1px solid var(--rule);
  opacity: 0; transform: translateY(20px);
  transition: all 0.6s ease;
}
.q.in { opacity: 1; transform: translateY(0); }
.q:nth-child(1) { transition-delay: 0.05s; }
.q:nth-child(2) { transition-delay: 0.15s; }
.q:nth-child(3) { transition-delay: 0.25s; }
.q-num { font-family: var(--en); font-size: 14px; letter-spacing: 0.24em;
  color: var(--gold); text-transform: uppercase; margin-bottom: 8px; }
.q-text { font-family: var(--display); font-size: 32px; font-weight: 500;
  letter-spacing: 0.04em; color: var(--ink); }

/* ── Case cards ───────────────────────────── */
.cases { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 36px 0; }
@media (max-width: 720px) { .cases { grid-template-columns: 1fr; } }
.case {
  padding: 28px; border: 1px solid var(--hair);
  background: rgba(255,250,232,0.4);
  border-radius: 2px;
  transition: all 0.2s ease;
}
.case:hover { background: rgba(255,250,232,0.8); border-color: var(--ink2); }
.case-label {
  font-family: var(--en); font-size: 11px; letter-spacing: 0.3em;
  color: var(--muted); text-transform: uppercase; margin-bottom: 12px;
}
.case-title { font-family: var(--display); font-size: 26px; font-weight: 700;
  letter-spacing: 0.04em; margin-bottom: 12px; }
.case-desc { font-size: 15px; color: var(--ink2); line-height: 1.6;
  margin-bottom: 20px; }
.case-readings { display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  padding-top: 16px; border-top: 1px dashed var(--rule); }
.case-readings .r-label { font-family: var(--en); font-size: 10px;
  letter-spacing: 0.3em; color: var(--muted); text-transform: uppercase;
  margin-bottom: 4px; }
.case-readings .r-val { font-family: var(--display); font-size: 20px;
  font-weight: 700; letter-spacing: 0.04em; }

/* ── Eye roll reveal ──────────────────────── */
.eyeroll {
  margin: 80px 0;
  text-align: center;
  cursor: pointer;
  user-select: none;
}
.eyeroll-setup {
  font-size: 18px; color: var(--muted); letter-spacing: 0.04em;
  margin-bottom: 36px;
}
.eyeroll-quotes {
  font-family: var(--body); font-size: 22px; color: var(--muted);
  letter-spacing: 0.04em; line-height: 2.1; margin: 36px 0;
}
.eyeroll-quotes span { display: block; opacity: 0.5;
  transition: all 0.3s ease; }
.eyeroll-quotes span:hover { opacity: 1; color: var(--ink); }
.eyeroll-punchline {
  font-family: var(--display); font-size: clamp(56px, 10vw, 140px);
  font-weight: 700; letter-spacing: 0.06em;
  color: var(--gold);
  margin: 48px 0 24px; line-height: 1.05;
  word-break: keep-all;
  transition: all 0.4s ease;
  cursor: pointer;
}
.eyeroll-punchline:hover { transform: scale(1.02); letter-spacing: 0.1em; }
.eyeroll-caption {
  font-size: 16px; color: var(--ink2); letter-spacing: 0.16em;
}

/* ── Final CTA ────────────────────────────── */
.cta {
  margin: 140px 0 80px;
  text-align: center;
  padding: 80px 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}
.cta-eyebrow { font-family: var(--en); font-size: 13px; letter-spacing: 0.4em;
  color: var(--gold); text-transform: uppercase; margin-bottom: 28px; }
.cta-text { font-family: var(--display); font-size: clamp(48px, 7vw, 96px);
  font-weight: 700; letter-spacing: 0.04em; line-height: 1; margin-bottom: 28px; }
.cta-check {
  display: inline-block; font-size: 64px; color: var(--gold); margin: 24px 0;
}

/* ── Next episode ─────────────────────────── */
.next {
  margin: 80px 0; text-align: center;
}
.next-label { font-family: var(--en); font-size: 12px; letter-spacing: 0.4em;
  color: var(--muted); text-transform: uppercase; margin-bottom: 24px; }
.next-title {
  font-family: var(--display); font-size: clamp(48px, 7vw, 96px);
  font-weight: 700; letter-spacing: 0.04em; line-height: 1;
  color: var(--ink); margin-bottom: 36px;
}
.next-progress {
  display: flex; gap: 4px; max-width: 460px; margin: 0 auto;
}
.next-progress > div { flex: 1; height: 3px; background: var(--rule); }
.next-progress > div.done { background: var(--ink); }
.next-progress > div.curr { background: var(--gold); }

/* ── Footer ──────────────────────────────── */
.foot {
  margin-top: 120px; padding-top: 36px;
  border-top: 1px solid var(--rule);
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: var(--en); font-size: 11px; letter-spacing: 0.3em;
  color: var(--muted); text-transform: uppercase;
}

/* ── Reveal on scroll ─────────────────────── */
.r { opacity: 0; transform: translateY(24px); transition: all 0.7s ease; }
.r.in { opacity: 1; transform: translateY(0); }

@media (max-width: 720px) {
  main { padding: 130px 24px 120px; }
  .toc, .chrome.tr { display: none; }
  .chrome.tl { top: 18px; left: 18px; font-size: 10px; }
  .formula-row { gap: 6px; }
  .f-term { font-size: 44px; padding: 4px 6px; }
  .f-op { font-size: 28px; }
}

/* ── ec-list as navigation ─────────────────
   .ec-row 變可點擊跳對應 EP。當前集禁用點擊並以 READING marker 標記。
   next row 是「設定的讀者下一步」，加 nudging 動畫 + hover lift 邀請點擊。
*/

/* ec-list padding / line-height / border 還原成原本 inline CSS 值
   (找到 .next class collision 真正根因後，這些補償性縮放不再需要)
   - padding 18px、line-height inherit 1.7、border-bottom 1px var(--rule) 全部走 inline 預設

   只保留唯一必要的 fix：
   .ec-row.next margin: 0 (修 .next class collision bug — 必須留)
*/
.ending-checklist .ec-row.next {
  margin: 0;
}

/* 未讀 row（無 .done 也無 .next）color 從 --faint (32%) 升到 --muted (55%)
   原本 32% 對比太低（~1.8:1）低於 WCAG AA 4.5:1
*/
.ending-checklist .ec-row:not(.done):not(.next) .ec-name,
.ending-checklist .ec-row:not(.done):not(.next) .ec-num,
.ending-checklist .ec-row:not(.done):not(.next) .ec-en,
.ending-checklist .ec-row:not(.done):not(.next) .ec-check {
  color: var(--muted);
}

a.ec-row {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background 0.2s ease, padding-left 0.2s ease;
}
a.ec-row:hover {
  background: rgba(168,122,48,0.06);
  padding-left: 6px;
}
a.ec-row:hover .ec-name { color: var(--ink); }
a.ec-row:hover .ec-check { color: var(--gold); }
.ec-row.current { cursor: default; }
/* current row：紙色 bg + 4px 金色 left bar（語意分明：你在這裡 vs 下一步）
   - α: bg 改 paper2（淡紙色），跟 next row 的金色 bg 區分
   - β: box-shadow inset 模擬左邊 4px 金色 vertical bar，不破 grid layout
*/
.ec-row.current {
  background: var(--paper2);
  box-shadow: inset 4px 0 0 var(--gold);
}
.ec-row.current .ec-en::after {
  content: none;
}

/* next row：邀請性動效（Plan X） */
a.ec-row.next {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              background 0.25s ease,
              box-shadow 0.35s ease;
}
a.ec-row.next:hover {
  transform: translateX(8px);
  background: rgba(168,122,48,0.18);
  box-shadow: 0 10px 28px rgba(168,122,48,0.18);
  padding-left: 0;  /* override default a.ec-row:hover padding shift */
}
/* override inline ecPulse → 用 horizontal nudging 暗示「往前走」 */
a.ec-row.next .ec-check {
  display: inline-block;
  animation: nextArrowNudge 2.4s ease-in-out infinite;
}
a.ec-row.next:hover .ec-check {
  animation-play-state: paused;
  transform: translateX(8px);
}
@keyframes nextArrowNudge {
  0%, 100% { transform: translateX(0); }
  50%      { transform: translateX(5px); }
}

/* ── EP5 finale block：div → a，沿用 next row 動效語彙 */
a.ec-finale-next {
  display: block;
  position: relative;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1),
              background 0.25s ease,
              box-shadow 0.35s ease;
}
a.ec-finale-next:hover {
  background: rgba(168,122,48,0.16) !important;
  transform: translateY(-3px);
  box-shadow: 0 14px 36px rgba(168,122,48,0.20);
}
a.ec-finale-next::after {
  content: "→";
  position: absolute;
  right: 28px;
  bottom: 24px;
  font-family: var(--en);
  font-size: 24px;
  font-weight: 300;
  color: var(--gold);
  animation: finaleArrowNudge 2.4s ease-in-out infinite;
}
a.ec-finale-next:hover::after {
  animation-play-state: paused;
  transform: translateX(8px);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}
@keyframes finaleArrowNudge {
  0%, 100% { transform: translateX(0); }
  50%      { transform: translateX(5px); }
}

/* ── Workshop chip：P1 深色反白 inset card（NYT magazine 風）
   ink2 深棕 bg + paper 淺色文字 + goldHi accent + 金色 4px left bar
   視覺強 distinct，跟主體 cream paper 切開
*/
.workshop-chip {
  background: var(--ink2) !important;
  border: none !important;
  border-left: 4px solid var(--gold) !important;
  color: var(--paper) !important;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1),
              background 0.25s ease,
              box-shadow 0.35s ease !important;
}
.workshop-chip:hover {
  background: var(--ink) !important;   /* 略加深一點 hover 反饋 */
  border-color: var(--goldHi) !important;
  color: var(--paper) !important;
  transform: translateY(-3px);
  box-shadow: 0 16px 40px rgba(31,24,16,0.32);
}
.workshop-chip .wc-title {
  color: var(--paper) !important;
}
.workshop-chip .wc-sub {
  color: rgba(240, 227, 196, 0.65) !important;   /* paper @ 65% opacity */
}
.workshop-chip .wc-arrow {
  color: var(--goldHi) !important;
}
.workshop-chip:hover .wc-arrow {
  color: var(--paper) !important;   /* hover arrow 變更亮（從金到 paper） */
}
.wc-eyebrow {
  font-family: var(--en);
  font-size: 10px; letter-spacing: 0.32em;
  color: var(--goldHi); text-transform: uppercase;
  display: block; margin-bottom: 8px;
}
