/* ============================================================
   Inverting the Pyramid — 編輯雜誌風 scrollytelling
   ============================================================ */

:root {
  --ink:        #16140f;   /* 近黑墨色 */
  --ink-soft:   #4a4640;
  --paper:      #f4f0e8;   /* 舊紙色 */
  --paper-2:    #ebe5d8;
  --line:       #d8d0bf;
  --pitch:      #1f3d2b;   /* 球場深綠 */
  --pitch-line: #cfe3d4;
  --accent:     #c0392b;   /* 戰術紅，重點色 */
  --gold:       #b08945;

  --serif: "Iowan Old Style", "Palatino Linotype", "Palatino", "Georgia", "Songti TC", "Noto Serif TC", serif;
  --sans:  "Helvetica Neue", "Inter", "PingFang TC", "Noto Sans TC", system-ui, sans-serif;

  --maxw: 1200px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--serif);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent); color: var(--paper); }

/* ---------- 進度條 ---------- */
#progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: var(--accent); z-index: 100;
  transition: width .1s linear;
}

/* ---------- 頂部標頭 ---------- */
.masthead {
  border-bottom: 2px solid var(--ink);
  position: sticky; top: 0; z-index: 50;
  background: var(--paper);
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 10px clamp(16px, 4vw, 48px);
  font-family: var(--sans);
}
.masthead .brand {
  font-family: var(--serif); font-weight: 700; font-size: 18px;
  letter-spacing: .02em;
}
.masthead .brand span { color: var(--accent); }
.masthead nav { display: flex; gap: 22px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
.masthead nav a { color: var(--ink-soft); text-decoration: none; transition: color .2s; }
.masthead nav a:hover { color: var(--accent); }
@media (max-width: 720px) { .masthead nav { display: none; } }

/* ---------- HERO ---------- */
.hero {
  min-height: 92vh;
  display: grid; grid-template-columns: 1.1fr 1fr;
  gap: clamp(20px, 4vw, 60px);
  align-items: center;
  padding: clamp(40px, 7vw, 90px) clamp(16px, 5vw, 64px);
  max-width: var(--maxw); margin: 0 auto;
}
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; text-align: left; } }

.hero .kicker {
  font-family: var(--sans); font-size: 12px; letter-spacing: .24em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 22px;
}
.hero h1 {
  font-size: clamp(48px, 8vw, 104px);
  line-height: .96; font-weight: 800; letter-spacing: -.02em;
  margin-bottom: 8px;
}
.hero h1 .inv { display: block; color: var(--accent); font-style: italic; }
.hero .sub {
  font-size: clamp(17px, 2vw, 21px); color: var(--ink-soft);
  max-width: 46ch; margin: 26px 0 14px;
}
.hero .byline {
  font-family: var(--sans); font-size: 13px; letter-spacing: .08em;
  color: var(--ink-soft); border-top: 1px solid var(--line);
  padding-top: 16px; margin-top: 24px; max-width: 46ch;
}
.hero .scrollcue {
  margin-top: 34px; font-family: var(--sans); font-size: 12px;
  letter-spacing: .2em; text-transform: uppercase; color: var(--ink-soft);
  display: inline-flex; align-items: center; gap: 10px;
}
.hero .scrollcue::after {
  content: "↓"; display: inline-block; animation: bob 1.6s ease-in-out infinite;
}
@keyframes bob { 0%,100%{ transform: translateY(0);} 50%{ transform: translateY(5px);} }

/* hero 球場 */
.hero-pitch { display: flex; justify-content: center; }
.hero-pitch svg { width: 100%; max-width: 380px; }

/* ---------- 區段：核心隱喻說明 ---------- */
.thesis {
  max-width: 760px; margin: 0 auto; padding: clamp(50px,8vw,110px) clamp(20px,5vw,24px);
  border-top: 1px solid var(--line);
}
.thesis .lead::first-letter {
  font-size: 4.6em; float: left; line-height: .72; padding: 6px 12px 0 0;
  font-weight: 700; color: var(--accent);
}
.thesis p { font-size: clamp(18px,2.1vw,22px); margin-bottom: 1.2em; }
.thesis .small { font-family: var(--sans); font-size: 14px; color: var(--ink-soft); letter-spacing:.02em; }

/* ---------- SCROLLY 主體 ---------- */
.scrolly {
  position: relative;
  display: grid; grid-template-columns: 0.95fr 1.05fr;
  max-width: var(--maxw); margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 48px);
}
@media (max-width: 860px) { .scrolly { grid-template-columns: 1fr; } }

/* 左：黏住的球場 */
.scrolly-graphic {
  position: sticky; top: 64px; height: calc(100vh - 64px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px;
}
@media (max-width: 860px) {
  .scrolly {
    /* 手機改成單欄，球場固定在上、文字在下流動 */
    display: block;
  }
  .scrolly-graphic {
    top: 52px; height: auto; min-height: 0;
    background: var(--paper); z-index: 10;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 10px 18px -8px rgba(0,0,0,.22);
    padding: 12px 0 14px; gap: 8px;
    flex-direction: row; justify-content: center; align-items: center;
  }
  .scrolly-graphic .pitch-wrap { max-width: 150px; }
  .scrolly-graphic .formation-caption { text-align: left; max-width: 180px; }
}
.pitch-wrap { width: 100%; max-width: 340px; }
.pitch-wrap svg { width: 100%; display: block; filter: drop-shadow(0 12px 26px rgba(0,0,0,.18)); }
.formation-caption {
  text-align: center; font-family: var(--sans); max-width: 320px;
}
.formation-caption .fc-code {
  font-size: 13px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--accent); font-weight: 700;
}
.formation-caption .fc-note { font-size: 13px; color: var(--ink-soft); margin-top: 4px; line-height: 1.5; }

/* 右：捲動的章節 */
.scrolly-steps { padding: 8vh 0; }
.step {
  min-height: 86vh; display: flex; flex-direction: column; justify-content: center;
  padding: 4vh 0; max-width: 60ch;
}
@media (max-width: 860px) {
  .scrolly-steps { padding: 2vh 0; }
  .step {
    min-height: auto; padding: 3vh 0; max-width: 100%;
    /* 錨點跳轉時，讓章節標頭停在 sticky 球場條（約 200px）下方 */
    scroll-margin-top: 210px;
  }
  .step .ch-num { padding-top: 6px; }
}

.step .ch-num {
  font-family: var(--sans); font-size: 13px; letter-spacing: .22em;
  text-transform: uppercase; color: var(--ink-soft); display: flex; gap: 14px; align-items: center;
}
.step .ch-num::before {
  content: ""; width: 34px; height: 2px; background: var(--accent); display: inline-block;
}
.step .era {
  font-family: var(--sans); font-size: 12px; letter-spacing: .12em;
  color: var(--gold); margin-top: 10px;
}
.step h2 {
  font-size: clamp(30px, 4.4vw, 48px); line-height: 1.04; font-weight: 800;
  margin: 8px 0 4px; letter-spacing: -.01em;
}
.step h2 .en {
  display: block; font-size: .42em; font-style: italic; font-weight: 500;
  color: var(--ink-soft); letter-spacing: .01em; margin-top: 8px;
}
.step .summary { font-size: clamp(16px,1.9vw,19px); margin: 18px 0; color: var(--ink); }

.step .pullquote {
  border-left: 3px solid var(--accent); padding: 4px 0 4px 20px;
  font-style: italic; font-size: clamp(17px,2.1vw,21px); color: var(--ink);
  margin: 22px 0;
}

.step .insight {
  background: var(--paper-2); border: 1px solid var(--line);
  padding: 16px 18px; margin: 20px 0; border-radius: 2px;
}
.step .insight .lab {
  font-family: var(--sans); font-size: 11px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--accent); display: block; margin-bottom: 6px;
}
.step .insight p { font-size: 15px; color: var(--ink-soft); line-height: 1.6; }

/* 人物 / 球隊 */
.meta-grid { display: grid; grid-template-columns: 1fr; gap: 18px; margin-top: 22px; }
.people { display: flex; flex-direction: column; gap: 10px; }
.person {
  display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: baseline;
  border-top: 1px solid var(--line); padding-top: 10px;
}
.person .nm { font-weight: 700; font-size: 15px; white-space: nowrap; }
.person .nt { font-family: var(--sans); font-size: 13px; color: var(--ink-soft); line-height: 1.5; }
.teams {
  font-family: var(--sans); font-size: 12px; letter-spacing: .04em;
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px;
}
.teams span {
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 11px; color: var(--ink-soft);
}

/* 步驟啟用態：未啟用降透明 */
.step { opacity: .35; transition: opacity .5s ease; }
.step.is-active { opacity: 1; }
@media (max-width: 860px) { .step { opacity: 1; } }

/* SVG 球員點 */
.pl-dot { transition: cx .8s cubic-bezier(.22,.61,.36,1), cy .8s cubic-bezier(.22,.61,.36,1), fill .6s; }
.pl-lbl { transition: x .8s cubic-bezier(.22,.61,.36,1), y .8s cubic-bezier(.22,.61,.36,1); }

/* ---------- 結語 ---------- */
.coda {
  border-top: 2px solid var(--ink); margin-top: 40px;
  padding: clamp(60px,9vw,130px) clamp(20px,5vw,24px);
  max-width: 820px; margin-left: auto; margin-right: auto; text-align: center;
}
.coda .kicker { font-family: var(--sans); font-size: 12px; letter-spacing: .24em; text-transform: uppercase; color: var(--accent); }
.coda h2 { font-size: clamp(32px,5vw,58px); line-height: 1.05; font-weight: 800; margin: 14px 0 22px; }
.coda p { font-size: clamp(17px,2vw,20px); color: var(--ink-soft); margin-bottom: 1.1em; }
.coda .compare {
  display: flex; gap: clamp(20px,6vw,80px); justify-content: center; align-items: flex-end;
  margin: 40px 0 10px; flex-wrap: wrap;
}
.coda .compare figure { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.coda .compare svg { width: 150px; }
.coda .compare figcaption { font-family: var(--sans); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }
.coda .arrow { font-size: 42px; color: var(--accent); align-self: center; line-height: 1; }
/* 窄螢幕：兩球場改直向堆疊，箭頭向下，方向才一致 */
@media (max-width: 560px){
  .coda .compare{ flex-direction: column; align-items: center; gap: 18px; }
  .coda .compare svg{ width: 190px; }
  .coda .arrow{ transform: rotate(90deg); }
}

/* ---------- 頁尾 ---------- */
footer {
  border-top: 1px solid var(--line); background: var(--ink); color: var(--paper);
  font-family: var(--sans); padding: 40px clamp(20px,5vw,48px);
  display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap;
}
footer .bk { font-family: var(--serif); font-size: 16px; max-width: 50ch; line-height: 1.5; }
footer .bk em { color: var(--gold); }
footer .meta { font-size: 12px; color: #b9b3a6; letter-spacing: .04em; text-align: right; }

/* ---------- 章節快速導覽（右側點點） ---------- */
#dots {
  position: fixed; right: 16px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 9px; z-index: 40;
}
@media (max-width: 1000px){ #dots{ display: none; } }
#dots button {
  width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--ink-soft);
  background: transparent; cursor: pointer; padding: 0; transition: all .25s;
}
#dots button:hover { background: var(--ink-soft); }
#dots button.on { background: var(--accent); border-color: var(--accent); transform: scale(1.35); }

/* ---------- 手機版浮動目錄 ---------- */
#tocToggle {
  display: none;
  position: fixed; right: 16px; bottom: 18px; z-index: 60;
  font-family: var(--sans); font-size: 13px; letter-spacing: .14em;
  background: var(--ink); color: var(--paper); border: none;
  padding: 12px 18px; border-radius: 999px; cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,.28);
}
#tocToggle::before { content: "☰  "; }
#tocDrawer {
  display: none;
  position: fixed; right: 0; top: 0; bottom: 0; width: min(82vw, 320px);
  background: var(--paper); z-index: 70; box-shadow: -8px 0 30px rgba(0,0,0,.25);
  transform: translateX(100%); transition: transform .3s ease;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 0 0 30px;
}
#tocDrawer.open { transform: translateX(0); }
#tocDrawer .toc-head {
  position: sticky; top: 0; background: var(--paper);
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--line);
  font-family: var(--sans); font-size: 12px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-soft);
}
#tocDrawer .toc-head button { background: none; border: none; font-size: 18px; color: var(--ink); cursor: pointer; padding: 4px; }
#tocDrawer .toc-link {
  display: block; padding: 13px 20px; text-decoration: none;
  font-family: var(--sans); font-size: 13px; letter-spacing: .1em;
  color: var(--accent); text-transform: uppercase; border-bottom: 1px solid var(--line);
}
#tocDrawer .toc-list a {
  display: flex; gap: 12px; align-items: baseline;
  padding: 12px 20px; text-decoration: none; color: var(--ink);
  border-bottom: 1px solid var(--line);
}
#tocDrawer .toc-list a .n { font-family: var(--sans); font-size: 12px; color: var(--ink-soft); min-width: 22px; }
#tocDrawer .toc-list a .t { font-size: 15px; line-height: 1.35; }
#tocDrawer .toc-list a:active { background: var(--paper-2); }
#tocBackdrop {
  display: none; position: fixed; inset: 0; background: rgba(20,18,14,.45);
  z-index: 65; opacity: 0; transition: opacity .3s;
}
#tocBackdrop.show { opacity: 1; }

@media (max-width: 1000px){
  #tocToggle { display: block; }
  #tocDrawer { display: block; }
  #tocBackdrop.show { display: block; }
}
