/* ============================================================
   POTATO HEAD — BRAND DOCUMENTARY (Magazine B 方法论致敬)
   设计令牌实测自 seminyak.potatohead.co
   ============================================================ */

:root {
  --bg: #101010;          /* 深炭底 */
  --cream: #F9F7F3;       /* 主文字，暖奶油白 */
  --sand: #ECE6DA;        /* 次级文字 / 卡片 */
  --accent: #ED7127;      /* 落日橙 */
  --surface: #1B1B1B;     /* 卡片表面 */
  --surface-2: #242424;
  --paper: #FBFAF5;       /* 奶油浅块，节奏用 */
  --ink: #16140F;         /* 浅块上的深墨色文字 */
  --line: rgba(249, 247, 243, 0.14);
  --line-soft: rgba(249, 247, 243, 0.08);

  --font-sans: "Helvetica Neue", Helvetica, Arial, "Microsoft YaHei", "PingFang SC", sans-serif;
  --font-mono: "SF Mono", SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;

  --nav-h: 56px;
  --pad: clamp(20px, 5vw, 72px);
  --maxw: 1240px;
}

/* ---------- reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--cream);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

img { display: block; max-width: 100%; height: auto; }

a { color: inherit; }

h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.en-upper { text-transform: uppercase; letter-spacing: -0.02em; }

/* ---------- 顶部阅读进度条 ---------- */
#progress {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 3px;
  background: transparent;
  z-index: 120;
}
#progress span {
  display: block; height: 100%;
  width: 0;
  background: var(--accent);
}

/* ---------- sticky 章节导航 ---------- */
.toc {
  position: sticky; top: 0; z-index: 110;
  background: rgba(16, 16, 16, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.toc-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  height: var(--nav-h);
  padding: 0 var(--pad);
}
.toc-brand {
  flex: none;
  display: flex;
  align-items: center;
  text-decoration: none;
  white-space: nowrap;
}
.toc-brand img {
  height: 20px;
  width: auto;
  display: block;
}
.toc-list {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.toc-list::-webkit-scrollbar { display: none; }
.toc-list a {
  flex: none;
  display: inline-block;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sand);
  text-decoration: none;
  border: 1px solid transparent;
  transition: color .25s, background-color .25s, border-color .25s;
  white-space: nowrap;
}
.toc-list a:hover { color: var(--cream); border-color: var(--line); }
.toc-list a.active {
  background: var(--accent);
  color: #101010;
  font-weight: 700;
}
.toc-list a .n { font-family: var(--font-mono); margin-right: 4px; opacity: .7; }

/* ---------- 布局通用 ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding-left: var(--pad); padding-right: var(--pad); }

section.chapter { padding: clamp(72px, 10vw, 130px) 0; position: relative; }

section[id] { scroll-margin-top: calc(var(--nav-h) + 8px); }

.chapter-head {
  display: flex;
  align-items: baseline;
  gap: 18px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding-top: 22px;
  margin-bottom: clamp(36px, 6vw, 64px);
}
.chapter-no {
  font-family: var(--font-mono);
  font-size: clamp(13px, 1.4vw, 15px);
  color: var(--accent);
  letter-spacing: 0.12em;
}
.chapter-title {
  font-size: clamp(30px, 5.2vw, 62px);
  text-transform: uppercase;
}
.chapter-sub {
  width: 100%;
  color: var(--sand);
  opacity: .82;
  max-width: 62ch;
  font-size: 15px;
}

.lede { font-size: clamp(17px, 2vw, 21px); max-width: 34em; color: var(--sand); }

p.body { max-width: 68ch; margin-bottom: 1.1em; color: rgba(249,247,243,.86); }
p.body strong, li strong { color: var(--cream); }
.accent { color: var(--accent); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(24px, 4vw, 56px); align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(16px, 2.5vw, 28px); }

/* ---------- 第 00 章 封面刊头 ---------- */
.cover {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  border-bottom: 1px solid var(--line-soft);
}
.cover-bg {
  position: absolute; inset: 0;
}
.cover-bg img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.05) brightness(.8);
}
.cover-bg::after {
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(16,16,16,.55) 0%, rgba(16,16,16,.15) 38%, rgba(16,16,16,.92) 100%);
}
.cover-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--pad) clamp(48px, 7vw, 90px);
}
/* 封面官方 logo（提取自官网内联 SVG） */
.cover-logo {
  width: clamp(200px, 22vw, 280px);
  height: auto;
  margin-bottom: clamp(22px, 3vw, 34px);
}
.cover-kicker {
  display: flex; align-items: center; gap: 14px;
  font-family: var(--font-mono);
  font-size: 12px; letter-spacing: 0.22em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 22px;
}
.cover-kicker::before { content: ""; width: 44px; height: 1px; background: var(--accent); }
.cover-title {
  font-size: clamp(56px, 12.5vw, 168px);
  line-height: 0.92;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  color: var(--cream);
}
.cover-sub {
  margin-top: 18px;
  font-family: var(--font-mono);
  font-size: clamp(11px, 1.4vw, 14px);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--sand);
}
.cover-quote {
  margin-top: clamp(26px, 4vw, 44px);
  max-width: 30em;
  font-size: clamp(16px, 2.2vw, 22px);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--cream);
  border-left: 3px solid var(--accent);
  padding-left: 18px;
}
.cover-meta {
  display: flex; flex-wrap: wrap; gap: 10px 28px;
  margin-top: clamp(28px, 4vw, 46px);
  font-size: 12px;
  color: rgba(236,230,218,.72);
}
.cover-meta b { color: var(--cream); font-weight: 700; }
.pill {
  display: inline-block;
  padding: 9px 22px;
  border-radius: 9999px;
  border: 1px solid var(--line);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cream);
  text-decoration: none;
  transition: background-color .25s, color .25s, border-color .25s;
}
.pill:hover { background: var(--cream); color: #101010; border-color: var(--cream); }
.pill--accent { background: var(--accent); color: #101010; border-color: var(--accent); font-weight: 700; }
.pill--accent:hover { background: var(--cream); border-color: var(--cream); color: #101010; }

/* ---------- marquee 跑马灯 ---------- */
.marquee {
  overflow: hidden;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  background: var(--bg);
  padding: 14px 0;
  white-space: nowrap;
}
.marquee-track {
  display: inline-flex;
  gap: 0;
  animation: marquee 32s linear infinite;
}
.marquee-track span {
  flex: none;
  padding: 0 34px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--sand);
}
.marquee-track span i { font-style: normal; color: var(--accent); padding-left: 34px; }
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ---------- 图片与占位回退 ---------- */
.fig {
  position: relative;
  overflow: hidden;
  background: var(--surface);
}
.fig img { width: 100%; height: auto; }
.fig figcaption {
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: rgba(236,230,218,.66);
  border-top: 1px solid var(--line-soft);
  background: var(--surface);
}
.fig figcaption b { color: var(--accent); font-weight: 400; margin-right: 8px; }
.fig.is-fallback img { display: none; }
.fig.is-fallback::before {
  content: "";
  display: block;
  aspect-ratio: 16 / 9;
  background:
    radial-gradient(120% 120% at 20% 10%, rgba(237,113,39,.34) 0%, rgba(237,113,39,0) 55%),
    linear-gradient(160deg, #2a2622 0%, #1b1b1b 55%, #101010 100%);
}

.fig--btn { cursor: zoom-in; }
.fig--btn img { transition: transform .8s cubic-bezier(.2,.6,.2,1), filter .5s; }
.fig--btn:hover img { transform: scale(1.03); }
.fig--gray img { filter: grayscale(1) contrast(1.05); }
.fig--gray:hover img { filter: grayscale(0) contrast(1); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  padding: clamp(22px, 3vw, 34px);
}
.card h3 {
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}
.card h3 .tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  margin-right: 10px;
  font-weight: 400;
}
.card p { font-size: 14px; color: rgba(236,230,218,.82); }
.card--hover { transition: background-color .3s, border-color .3s, transform .3s; }
.card--hover:hover { background: var(--surface-2); border-color: var(--line); transform: translateY(-3px); }

/* ---------- 奶油浅块（节奏） ---------- */
.chapter--paper {
  background: var(--paper);
  color: var(--ink);
}
.chapter--paper .chapter-head { border-top-color: rgba(22,20,15,.2); }
.chapter--paper .chapter-sub,
.chapter--paper p.body { color: rgba(22,20,15,.78); }
.chapter--paper p.body strong { color: var(--ink); }
.chapter--paper .fig figcaption { background: transparent; border-top-color: rgba(22,20,15,.15); color: rgba(22,20,15,.6); }
.chapter--paper .fig { background: #efeadf; }
.chapter--paper .fig.is-fallback::before {
  background:
    radial-gradient(120% 120% at 20% 10%, rgba(237,113,39,.28) 0%, rgba(237,113,39,0) 55%),
    linear-gradient(160deg, #efe7d8 0%, #e6ddcb 60%, #ded2bd 100%);
}

/* ---------- 时间线 ---------- */
.tline { list-style: none; border-left: 1px solid var(--line); }
.tline li {
  position: relative;
  padding: 0 0 26px 28px;
}
.tline li::before {
  content: "";
  position: absolute; left: -5px; top: 8px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent);
}
.tline .yr {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 0.1em;
}
.tline p { font-size: 14.5px; color: rgba(249,247,243,.85); max-width: 60ch; }

/* ---------- 引文 ---------- */
.quote-block {
  border-left: 3px solid var(--accent);
  padding: 6px 0 6px clamp(18px, 3vw, 30px);
  margin: clamp(30px, 5vw, 56px) 0;
}
.quote-block p.en {
  font-size: clamp(18px, 2.6vw, 28px);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.35;
  color: var(--cream);
}
.quote-block p.cn {
  margin-top: 12px;
  font-size: 15px;
  color: var(--sand);
  max-width: 46em;
}
.quote-block cite {
  display: block;
  margin-top: 14px;
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--accent);
}

/* ---------- 数据页（大号橙色数字） ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
}
.stat {
  background: var(--bg);
  padding: clamp(22px, 3vw, 36px) clamp(18px, 2.5vw, 30px);
}
.stat .num {
  font-size: clamp(30px, 4.2vw, 54px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent);
  line-height: 1;
}
.stat .num small { font-size: .45em; font-weight: 400; }
.stat .lbl {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--sand);
  opacity: .8;
  letter-spacing: 0.04em;
}
.stat .lbl-en {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(236,230,218,.45);
  margin-top: 4px;
}

/* ---------- 评分卡 ---------- */
.score-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.score {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  padding: 24px 22px;
  text-align: left;
  transition: border-color .3s;
}
.score:hover { border-color: var(--accent); }
.score .v { font-size: clamp(30px, 3.4vw, 44px); font-weight: 700; color: var(--cream); letter-spacing: -0.02em; }
.score .v em { font-style: normal; font-size: .42em; color: var(--sand); }
.score .src { font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent); margin-top: 6px; font-weight: 700; }
.score .note { font-size: 12.5px; color: rgba(236,230,218,.7); margin-top: 8px; }

/* ---------- 奖项 ---------- */
.awards { list-style: none; }
.awards li {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 20px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line-soft);
  align-items: baseline;
}
.awards .yr { font-family: var(--font-mono); color: var(--accent); font-size: 14px; }
.awards p { font-size: 15px; color: rgba(249,247,243,.88); }
.awards p b { color: var(--cream); }

/* ---------- 评价：正负对照 ---------- */
.voices { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.voice {
  border: 1px solid var(--line-soft);
  padding: clamp(20px, 3vw, 30px);
}
.voice--good { background: var(--surface); }
.voice--bad { background: transparent; border-style: dashed; }
.voice h3 {
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.12em;
  margin-bottom: 14px;
}
.voice--good h3 { color: var(--accent); }
.voice--bad h3 { color: var(--sand); }
.voice ul { list-style: none; }
.voice li {
  position: relative;
  padding: 7px 0 7px 20px;
  font-size: 14px;
  color: rgba(236,230,218,.85);
  border-bottom: 1px solid var(--line-soft);
}
.voice li:last-child { border-bottom: 0; }
.voice li::before {
  content: "—";
  position: absolute; left: 0; top: 7px;
  color: var(--accent);
}
.voice--bad li::before { color: rgba(236,230,218,.4); }

/* ---------- 灯箱 dialog ---------- */
dialog.lightbox {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: min(92vw, 1200px);
  max-height: 88vh;
  margin: auto;
}
dialog.lightbox::backdrop { background: rgba(10,10,10,.9); }
.lightbox figure { background: var(--bg); }
.lightbox img { max-height: 78vh; width: auto; max-width: 100%; margin: 0 auto; }
.lightbox figcaption {
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--sand);
  display: flex; justify-content: space-between; gap: 16px;
}
.lightbox .lb-close {
  background: none; border: 0;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  cursor: pointer;
  text-transform: uppercase;
}
.lightbox .lb-close:hover { color: var(--cream); }

/* ---------- 来源清单 ---------- */
.sources ol { list-style: none; counter-reset: src; }
.sources li {
  counter-increment: src;
  display: flex; gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13.5px;
  align-items: baseline;
}
.sources li::before {
  content: counter(src, decimal-leading-zero);
  font-family: var(--font-mono);
  color: var(--accent);
  flex: none;
}
.sources a {
  color: var(--sand);
  word-break: break-all;
  text-decoration: none;
  border-bottom: 1px dotted rgba(236,230,218,.35);
  transition: color .25s, border-color .25s;
}
.sources a:hover { color: var(--accent); border-color: var(--accent); }
.sources .s-name { flex: none; min-width: 150px; color: var(--cream); font-weight: 700; }

/* ---------- 页脚 ---------- */
.footer {
  border-top: 1px solid var(--line-soft);
  padding: clamp(48px, 7vw, 80px) 0 60px;
  text-align: left;
}
/* 页脚底部留白：确保最后一个 data-reveal 行与视口底部有充分空间，
   配合 main.js 的触底兜底，保证滚到底时必然可见 */
.footer .wrap { padding-bottom: 48px; }
.footer-big {
  font-size: clamp(34px, 6vw, 72px);
  text-transform: uppercase;
  letter-spacing: -0.02em;
  font-weight: 700;
  color: var(--surface-2);
  line-height: 1;
  -webkit-text-stroke: 1px rgba(249,247,243,.25);
}
.footer p { font-size: 12.5px; color: rgba(236,230,218,.55); margin-top: 18px; max-width: 74ch; }
/* 页脚作者头像：容器内靠左，透明背景原图展示，链接至个人网站 */
.footer-avatar { margin-top: 32px; display: flex; justify-content: flex-start; }
.footer-avatar a { display: inline-block; flex: none; line-height: 0; }
.footer-avatar img {
  width: 88px;
  height: 88px;
  object-fit: contain;
  display: block;
}

/* ---------- reveal 动画 ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity .8s cubic-bezier(.2,.6,.2,1), transform .8s cubic-bezier(.2,.6,.2,1);
  transition-delay: var(--d, 0s);
}
[data-reveal].is-in { opacity: 1; transform: none; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .score-grid { grid-template-columns: repeat(2, 1fr); }
  .voices { grid-template-columns: 1fr; }
  .awards li { grid-template-columns: 64px 1fr; gap: 12px; }
}
@media (max-width: 560px) {
  .score-grid { grid-template-columns: 1fr; }
  .toc-brand img { height: 16px; }
  .sources li { flex-wrap: wrap; }
}

/* ---------- 无障碍：关闭全部动画 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
  .marquee-track { animation: none; }
}
