:root {
  --paper: #f3f0e7;
  --surface: #fffdf8;
  --surface-2: #ece8dd;
  --ink: #102b3f;
  --muted: #526575;
  --line: #c9c4b8;
  --mw: #bd682d;
  --mw-soft: #f3dfcf;
  --m31: #385a9e;
  --m31-soft: #dfe6f5;
  --obs: #177184;
  --obs-soft: #d8ebed;
  --warning: #8c3f35;
  --max: 72rem;
  --shadow: 0 18px 48px rgba(16, 43, 63, 0.10);
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(16, 43, 63, 0.025) 1px, transparent 1px),
    var(--paper);
  background-size: 100% 2rem;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.72;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; }
a { color: var(--m31); text-underline-offset: 0.18em; }
a:hover { color: var(--mw); }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(23, 113, 132, 0.42);
  outline-offset: 3px;
}

.skip-link {
  position: fixed; left: 1rem; top: -6rem; z-index: 200;
  padding: .7rem 1rem; background: var(--ink); color: white;
}
.skip-link:focus { top: 1rem; }

.site-nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 1rem;
  min-height: 3.75rem; padding: .55rem max(1rem, calc((100vw - var(--max))/2));
  border-bottom: 1px solid rgba(16,43,63,.18);
  background: rgba(243,240,231,.94);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: baseline; gap: .55rem; white-space: nowrap; }
.brand strong { font-family: Georgia, "Noto Serif SC", serif; font-size: 1.08rem; }
.brand span { color: var(--muted); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; }
.nav-links { display: flex; gap: .9rem; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a { display: inline-flex; align-items: center; min-height: 2.75rem; padding-inline: .15rem; color: var(--ink); font-size: .84rem; text-decoration: none; white-space: nowrap; }
.nav-links a:hover { color: var(--mw); }
.lang-switch { display: flex; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 999px; padding: .16rem; }
.lang-switch :is(button, a) {
  display: grid; place-items: center; text-decoration: none;
  min-width: 2.75rem; min-height: 2.75rem; border: 0; border-radius: 999px;
  background: transparent; color: var(--muted); font-weight: 700; cursor: pointer;
}
.lang-switch :is(button, a)[aria-pressed="true"] { background: var(--ink); color: white; }

.hero {
  position: relative; overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.hero::after {
  content: ""; position: absolute; right: -8rem; top: -11rem; width: 31rem; height: 31rem;
  border: 1px solid rgba(189,104,45,.22); border-radius: 50%;
  box-shadow: 0 0 0 5rem rgba(56,90,158,.045), 0 0 0 10rem rgba(23,113,132,.025);
  pointer-events: none;
}
.hero-inner {
  position: relative; z-index: 1;
  max-width: var(--max); margin: 0 auto; padding: clamp(4.5rem, 9vw, 8rem) 1.2rem 4rem;
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(18rem, .75fr); gap: 3rem;
}
.eyebrow { margin: 0 0 1rem; color: var(--mw); font-size: .78rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, h3 { font-family: Georgia, "Noto Serif SC", "Songti SC", serif; line-height: 1.18; text-wrap: balance; }
h1 { margin: 0; max-width: 15ch; font-size: clamp(2.7rem, 6.2vw, 5.7rem); letter-spacing: -.045em; }
.hero-deck { max-width: 42rem; margin: 1.6rem 0 0; color: var(--muted); font-size: clamp(1.05rem, 1.5vw, 1.27rem); }
.hero-actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.8rem; }
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 2.85rem; padding: .6rem 1rem; border: 1px solid var(--ink);
  color: var(--ink); background: transparent; text-decoration: none; font-weight: 750;
}
.button.primary { color: white; background: var(--ink); }
.button:hover { color: white; background: var(--mw); border-color: var(--mw); }
.hero-equation {
  align-self: end; padding: 1.6rem; border-top: 4px solid var(--obs); background: var(--surface); box-shadow: var(--shadow);
}
.hero-equation .math { margin: .5rem 0; font: 600 1.32rem/1.5 Georgia, serif; }
.hero-stat { padding-top: .75rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .78rem; line-height: 1.5; }
.hero-stat strong { color: var(--mw); font-family: Georgia, serif; font-size: 1.25rem; }
.hero-equation p:last-child { margin-bottom: 0; }

main { display: block; }
.section { max-width: var(--max); margin: 0 auto; padding: clamp(4rem, 7vw, 7rem) 1.2rem; }
.section + .section { border-top: 1px solid var(--line); }
.section-kicker { margin: 0 0 .7rem; color: var(--mw); font-size: .8rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h2 { margin: 0 0 1.2rem; font-size: clamp(2rem, 4vw, 3.7rem); letter-spacing: -.025em; }
h3 { margin: 2rem 0 .7rem; font-size: clamp(1.25rem, 2vw, 1.65rem); }
.lead { max-width: 52rem; color: var(--muted); font-size: 1.14rem; }
.prose { max-width: 50rem; }

.truth-strip {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0;
  margin: 2.4rem 0 0; border-block: 1px solid var(--line);
}
.truth-strip > div { padding: 1.5rem; border-right: 1px solid var(--line); }
.truth-strip > div:last-child { border-right: 0; }
.truth-strip strong { display: block; margin-bottom: .35rem; color: var(--obs); font-size: 1.05rem; }
.truth-strip p { margin: 0; color: var(--muted); font-size: .92rem; }

.warning {
  max-width: 54rem; margin: 2rem 0; padding: 1.25rem 1.4rem;
  border: 1px solid rgba(140,63,53,.35); border-left: 5px solid var(--warning); background: #f7e8e2;
}
.warning strong { color: var(--warning); }
.note {
  max-width: 54rem; margin: 1.5rem 0; padding: 1.1rem 1.3rem;
  border-left: 4px solid var(--obs); background: var(--obs-soft);
}

.coordinate-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; margin-top: 2rem;
}
.coordinate {
  position: relative; padding: 1.3rem 1.3rem 1.5rem; border-top: 3px solid var(--line); background: rgba(255,253,248,.54);
}
.coordinate:nth-child(1) { border-color: var(--mw); }
.coordinate:nth-child(2) { border-color: var(--obs); }
.coordinate:nth-child(3) { border-color: var(--m31); }
.coordinate .symbol { display: block; margin-bottom: .65rem; font: 700 1.5rem Georgia, serif; }
.coordinate p { margin: .4rem 0 0; color: var(--muted); font-size: .92rem; }

.concept-figure { margin: 2rem 0; padding: 1rem; border: 1px solid var(--line); background: var(--surface); overflow-x: auto; }
.concept-figure svg { display: block; width: 100%; min-width: 840px; height: auto; }
.concept-figure .svg-title { fill: var(--ink); font: 700 16px Georgia, serif; }
.concept-figure .svg-label { fill: var(--muted); font: 12px ui-sans-serif, system-ui, sans-serif; }
.concept-figure .svg-caption { fill: var(--muted); font: 12px ui-sans-serif, system-ui, sans-serif; }
.concept-figure .svg-emphasis { fill: var(--ink); font-weight: 750; }
.concept-figure .svg-halo { fill: var(--m31-soft); stroke: var(--m31); stroke-width: 1.2; stroke-dasharray: 5 5; }
.concept-figure .svg-disk { fill: var(--mw-soft); stroke: var(--mw); stroke-width: 1.5; }
.concept-figure .svg-gc { fill: var(--mw); }
.concept-figure .svg-sun { fill: var(--obs); }
.concept-figure .svg-los, .concept-figure .svg-axis, .concept-figure .svg-radius {
  fill: none; stroke: var(--ink); stroke-width: 2; color: var(--ink);
}
.concept-figure .svg-axis { stroke: var(--mw); color: var(--mw); }
.concept-figure .svg-radius { stroke: var(--m31); color: var(--m31); }
.concept-figure .svg-angle { fill: none; stroke: var(--obs); stroke-width: 1.5; }
.concept-figure .svg-divider { stroke: var(--line); stroke-width: 1; }
.concept-figure .svg-ring { fill: none; stroke: var(--m31); stroke-width: 1; stroke-dasharray: 4 4; opacity: .58; }
.concept-figure .svg-m31 { fill: var(--m31); }
.concept-figure .svg-fields circle { fill: var(--obs); stroke: white; stroke-width: 1; }

.derivation { counter-reset: step; margin-top: 2.8rem; }
.derive-step {
  counter-increment: step; display: grid; grid-template-columns: 4.5rem minmax(0,1fr); gap: 1rem;
  padding: 2rem 0; border-top: 1px solid var(--line);
}
.derive-step::before {
  content: counter(step, decimal-leading-zero); color: var(--mw);
  font: 700 1.05rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em;
}
.derive-step h3 { margin-top: 0; }
.equation {
  overflow-x: auto; margin: 1rem 0; padding: 1rem 1.2rem;
  border-left: 3px solid var(--m31); background: var(--surface);
  font: 500 clamp(1rem, 2vw, 1.24rem)/1.7 Georgia, "Times New Roman", serif;
  white-space: nowrap;
}
.table-scroll { max-width: 100%; overflow-x: auto; }
.symbol-table { width: 100%; min-width: 38rem; border-collapse: collapse; font-size: .92rem; }
.symbol-table th, .symbol-table td { padding: .55rem .7rem; border-bottom: 1px solid var(--line); text-align: left; }
.symbol-table th { color: var(--muted); font-size: .75rem; letter-spacing: .07em; text-transform: uppercase; }

.pipeline {
  display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); align-items: stretch;
  gap: 1.8rem; margin: 2.4rem 0;
}
.pipe-node { position: relative; min-width: 0; min-height: 8.2rem; padding: 1rem; border: 1px solid var(--line); background: var(--surface); overflow-wrap: anywhere; }
.pipe-node:not(:last-child)::after {
  content: "→"; position: absolute; right: -1.35rem; top: 43%; color: var(--mw); font-size: 1.35rem; font-weight: 800;
}
.pipe-node strong { display: block; color: var(--ink); }
.pipe-node span { display: block; margin-top: .35rem; color: var(--muted); font-size: .82rem; }

.reading-steps { display: grid; gap: .65rem; margin: 1.6rem 0 2rem; padding: 0; list-style: none; }
.reading-steps li { display: grid; grid-template-columns: 5.2rem minmax(0, 1fr); gap: .8rem; padding: .8rem 0; border-top: 1px solid var(--line); }
.reading-steps li:last-child { border-bottom: 1px solid var(--line); }
.reading-steps strong { color: var(--mw); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; letter-spacing: .04em; }

.figure-block { margin: 2.5rem 0 4rem; }
.figure-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; border-top: 1px solid var(--ink); padding-top: .9rem; }
.figure-heading h3 { margin: 0; }
.figure-number { color: var(--mw); font: 700 .82rem ui-monospace, monospace; letter-spacing: .08em; }
.figure-frame { margin-top: 1.2rem; padding: clamp(.5rem, 2vw, 1.4rem); background: white; border: 1px solid var(--line); }
.figure-frame img { display: block; width: 100%; cursor: zoom-in; }
figcaption { max-width: 60rem; margin-top: .8rem; color: var(--muted); font-size: .91rem; }
.fig-actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .85rem; }
.fig-actions a { display: inline-flex; align-items: center; min-height: 2.75rem; font-size: .82rem; font-weight: 750; }

.metric-row {
  display: grid; grid-template-columns: repeat(4, 1fr); border-block: 1px solid var(--line); margin: 2rem 0;
}
.metric { padding: 1.25rem; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric .value { display: block; color: var(--mw); font: 700 clamp(1.4rem, 2.6vw, 2.2rem) Georgia, serif; }
.metric .label { display: block; margin-top: .25rem; color: var(--muted); font-size: .78rem; }

.table-wrap { width: 100%; overflow-x: auto; margin: 1.5rem 0 2rem; border: 1px solid var(--line); background: var(--surface); }
table.data { width: 100%; min-width: 44rem; border-collapse: collapse; font-size: .84rem; font-variant-numeric: tabular-nums; }
table.data caption { padding: .9rem 1rem; text-align: left; color: var(--muted); font-size: .82rem; }
table.data th, table.data td { padding: .62rem .75rem; border-bottom: 1px solid #ded9cf; text-align: right; white-space: nowrap; }
table.data th:first-child, table.data td:first-child, table.data th:nth-child(2), table.data td:nth-child(2) { text-align: left; }
table.data thead th { position: sticky; top: 0; z-index: 1; background: var(--ink); color: white; font-size: .72rem; letter-spacing: .035em; }
table.data tbody tr:hover { background: var(--obs-soft); }

details { max-width: 56rem; margin: 1rem 0; border-top: 1px solid var(--line); }
summary { min-height: 3.2rem; display: flex; align-items: center; cursor: pointer; font-weight: 800; }
details[open] summary { color: var(--mw); }
.detail-body { padding: 0 0 1rem; color: var(--muted); }

.downloads { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0 2rem; min-width: 0; margin-top: 2rem; }
.download { display: flex; min-width: 0; justify-content: space-between; gap: 1rem; padding: .9rem 0; border-top: 1px solid var(--line); text-decoration: none; }
.download span:first-child { min-width: 0; overflow-wrap: anywhere; }
.download span:last-child { color: var(--muted); font-size: .78rem; white-space: nowrap; }

.site-footer { border-top: 1px solid var(--line); background: var(--ink); color: #dce5ea; }
.footer-inner { max-width: var(--max); margin: 0 auto; padding: 2.7rem 1.2rem; display: flex; justify-content: space-between; gap: 2rem; }
.site-footer a { color: #fff; }
.site-footer p { max-width: 46rem; margin: 0; color: #bfcbd2; }

.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 1rem; background: rgba(5,19,29,.92); }
.modal img { max-width: min(96vw, 92rem); max-height: 90vh; object-fit: contain; background: white; }
.modal-close { position: fixed; right: 1.2rem; top: 1.2rem; width: 3rem; height: 3rem; border: 1px solid white; border-radius: 50%; background: #102b3f; color: white; font-size: 1.4rem; cursor: pointer; }

[data-en] { display: none !important; }
html[data-lang="en"] [data-zh] { display: none !important; }
html[data-lang="en"] [data-en] { display: revert !important; }

@media (max-width: 880px) {
  .site-nav { flex-wrap: wrap; }
  .nav-links { order: 3; width: 100%; margin-left: 0; }
  .hero-inner { grid-template-columns: 1fr; }
  .hero-equation { max-width: 36rem; }
  .truth-strip, .coordinate-grid { grid-template-columns: 1fr; }
  .truth-strip > div, .metric { border-right: 0; border-bottom: 1px solid var(--line); }
  .truth-strip > div:last-child, .metric:last-child { border-bottom: 0; }
  .pipeline { grid-template-columns: 1fr; gap: 1.5rem; }
  .pipe-node { min-height: auto; }
  .pipe-node:not(:last-child)::after { content: "↓"; right: auto; left: 50%; top: auto; bottom: -1.45rem; }
  .metric-row { grid-template-columns: repeat(2,1fr); }
  .metric:nth-child(2) { border-right: 0; }
  .downloads { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  body { background-size: 100% 1.75rem; }
  .site-nav { gap: .5rem; }
  .brand span { display: none; }
  h1 { font-size: clamp(2.5rem, 15vw, 4rem); }
  .hero-inner { padding-top: 3.8rem; gap: 2rem; }
  .section { padding-block: 3.7rem; }
  .derive-step { grid-template-columns: 2.8rem minmax(0,1fr); }
  .reading-steps li { grid-template-columns: 1fr; gap: .35rem; }
  .metric-row { grid-template-columns: 1fr; }
  .metric { border-right: 0; border-bottom: 1px solid var(--line); }
  .figure-heading { display: block; }
  .footer-inner { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media print {
  .site-nav, .hero-actions, .fig-actions, .modal { display: none !important; }
  body { background: white; font-size: 11pt; }
  .section { max-width: none; padding: 1.2rem 0; break-inside: avoid; }
  .figure-frame { border: 0; }
}
