/* =========================================================
   力场 · 初中物理可视化课堂
   明亮扁平 / 纸张网格 / 粗描边 / 硬阴影
   ========================================================= */

@font-face {
  font-family: "Fraunces";
  src: url("fonts/fraunces-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/ibm-plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/ibm-plex-mono-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f4f0e6;
  --paper-2: #fbf8f0;
  --white: #ffffff;
  --ink: #14213d;
  --ink-2: #223258;
  --muted: #5b6472;
  --line: #d8d0bf;
  --yellow: #f5c518;

  --blue: #1d4ed8;
  --blue-soft: #dbeafe;
  --blue-ink: #1e40af;

  --orange: #ea580c;
  --orange-soft: #ffedd5;
  --orange-ink: #9a3412;

  --teal: #0f766e;
  --teal-soft: #ccfbf1;
  --teal-ink: #115e59;

  --violet: #6d28d9;
  --violet-soft: #ede9fe;
  --violet-ink: #5b21b6;

  --radius: 18px;
  --shadow: 6px 6px 0 var(--ink);
  --font-body: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  --font-display: "Fraunces", "Songti SC", "Noto Serif SC", serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --maxw: 1320px;
  --gutter: clamp(18px, 4vw, 40px);
  --chapter: var(--blue);
  --chapter-soft: var(--blue-soft);
  --chapter-ink: var(--blue-ink);
}

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

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

body {
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image: linear-gradient(rgba(20, 33, 61, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 33, 61, 0.045) 1px, transparent 1px);
  background-size: 32px 32px;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--yellow);
  color: var(--ink);
}

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

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

.wrap {
  width: min(calc(100% - var(--gutter) * 2), var(--maxw));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: -80px;
  z-index: 100;
  background: var(--yellow);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 700;
  text-decoration: none;
  transition: top 0.15s;
}

.skip-link:focus {
  top: 12px;
}

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

.mono {
  font-family: var(--font-mono);
}

.display {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.tone-blue {
  --chapter: var(--blue);
  --chapter-soft: var(--blue-soft);
  --chapter-ink: var(--blue-ink);
}
.tone-orange {
  --chapter: var(--orange);
  --chapter-soft: var(--orange-soft);
  --chapter-ink: var(--orange-ink);
}
.tone-teal {
  --chapter: var(--teal);
  --chapter-soft: var(--teal-soft);
  --chapter-ink: var(--teal-ink);
}
.tone-violet {
  --chapter: var(--violet);
  --chapter-soft: var(--violet-soft);
  --chapter-ink: var(--violet-ink);
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 20px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink);
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
  text-decoration: none;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform 0.16s ease, box-shadow 0.16s ease,
    background-color 0.16s ease;
}

.btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--ink);
}

.btn:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--ink);
}

.btn--primary {
  background: var(--blue);
  color: #fff;
}

.btn--yellow {
  background: var(--yellow);
}

.btn--small {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  box-shadow: 3px 3px 0 var(--ink);
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--paper);
  border-bottom: 2px solid var(--ink);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 76px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--yellow);
  box-shadow: 3px 3px 0 var(--ink);
}

.brand-mark svg {
  width: 28px;
  height: 28px;
}

.brand-cn {
  display: block;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.05;
}

.brand-en {
  display: block;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--muted);
  line-height: 1.4;
}

.nav {
  display: flex;
  align-items: center;
  gap: 26px;
  margin-left: auto;
}

.nav a {
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  padding: 4px 0;
}

.nav a:hover {
  border-bottom-color: var(--ink);
}

.header-cta {
  flex: none;
}

/* 没有导航的页面（如 404），让 CTA 靠右 */
.header-inner .brand + .header-cta {
  margin-left: auto;
}

/* ---------- hero ---------- */

.hero {
  padding: clamp(46px, 6.5vw, 84px) 0 52px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.kicker::before {
  content: "";
  width: 10px;
  height: 10px;
  background: var(--orange);
  border: 2px solid var(--ink);
}

.hero h1 {
  margin: 20px 0 20px;
  font-size: clamp(40px, 5.2vw, 76px);
  line-height: 1.06;
  letter-spacing: -0.04em;
  font-weight: 800;
  text-wrap: balance;
}

.hero h1 .hl {
  background: linear-gradient(transparent 64%, var(--yellow) 64%);
  padding: 0 0.06em;
}

.hero-lede {
  max-width: 54ch;
  margin: 0;
  color: var(--muted);
  font-size: clamp(15px, 1.4vw, 17.5px);
  line-height: 1.75;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 13px;
  margin-top: 30px;
}

.hero-stats {
  display: flex;
  max-width: 470px;
  margin-top: 42px;
  border-top: 2px solid var(--ink);
}

.stat {
  flex: 1;
  padding: 14px 16px 0 0;
  border-right: 1px dashed var(--line);
}

.stat + .stat {
  padding-left: 16px;
}

.stat:last-child {
  border-right: 0;
  padding-right: 0;
}

.stat-num {
  font-family: var(--font-display);
  font-size: clamp(28px, 3.4vw, 40px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
}

.stat-label {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.4;
}

.hero-art {
  position: relative;
  padding: 0 0 18px 0;
}

.art-card {
  position: relative;
  background: var(--paper-2);
  border: 2px solid var(--ink);
  border-radius: 22px;
  box-shadow: 10px 10px 0 var(--ink);
  overflow: hidden;
  transform: rotate(0.7deg);
}

.art-card svg {
  display: block;
  width: 100%;
  height: auto;
}

.art-sticker {
  position: absolute;
  left: clamp(8px, 2vw, 20px);
  bottom: -2px;
  transform: rotate(-2deg);
  background: var(--yellow);
  border: 2px solid var(--ink);
  border-radius: 4px;
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  box-shadow: 3px 3px 0 var(--ink);
}

/* hero illustration */

.hero-svg .g-line {
  stroke: #ded5c3;
  stroke-width: 1;
}

.hero-svg .orbit {
  fill: none;
  stroke: #9aa4b8;
  stroke-width: 1.4;
  stroke-dasharray: 4 9;
}

.hero-svg .planet {
  fill: var(--yellow);
  stroke: var(--ink);
  stroke-width: 2;
}

.hero-svg .planet-ring {
  fill: none;
  stroke: var(--orange);
  stroke-width: 2;
}

.hero-svg .beam {
  stroke: var(--ink);
  stroke-width: 15;
  stroke-linecap: round;
}

.hero-svg .fulcrum {
  fill: var(--ink);
}

.hero-svg .rope {
  stroke: #64748b;
  stroke-width: 2.4;
  stroke-dasharray: 2 5;
}

.hero-svg .load-a {
  fill: var(--blue);
  stroke: var(--ink);
  stroke-width: 2.4;
}

.hero-svg .load-b {
  fill: var(--orange);
  stroke: var(--ink);
  stroke-width: 2.4;
}

.hero-svg .arrow-a {
  stroke: var(--blue);
}

.hero-svg .arrow-b {
  stroke: var(--orange);
}

.hero-svg .arrow {
  fill: none;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hero-svg .arrow-head-a {
  fill: var(--blue);
}

.hero-svg .arrow-head-b {
  fill: var(--orange);
}

.hero-svg .hlabel {
  fill: var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.hero-svg .hlabel--muted {
  fill: var(--muted);
  font-weight: 400;
  font-size: 9px;
  letter-spacing: 0.12em;
}

.hero-svg .measure {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.2;
}

.hero-svg .dim {
  fill: var(--muted);
}

.hero-svg .sticker-a {
  fill: var(--blue-soft);
  stroke: var(--ink);
  stroke-width: 1.8;
}

.hero-svg .sticker-b {
  fill: var(--orange-soft);
  stroke: var(--ink);
  stroke-width: 1.8;
}

.hero-svg .sticker-c {
  fill: var(--yellow);
  stroke: var(--ink);
  stroke-width: 1.8;
}

.hero-svg .load-label {
  fill: #fff;
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
}

.hero-svg .formula {
  fill: var(--ink);
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
}

.hero-svg .formula--sm {
  font-size: 12px;
}

.hero-svg .pulse {
  animation: softPulse 3.4s ease-in-out infinite;
}

@keyframes softPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

/* ---------- formula band ---------- */

.formula-band {
  background: var(--ink);
  color: var(--paper);
  border-block: 2px solid var(--ink);
}

.formula-inner {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 15px 0;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}

.formula-inner::-webkit-scrollbar {
  display: none;
}

.formula-tag {
  flex: none;
  border: 1px solid rgba(244, 240, 230, 0.35);
  padding: 4px 8px;
  color: var(--yellow);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.16em;
}

.formula-item {
  flex: none;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.01em;
}

.formula-item b {
  color: var(--yellow);
  font-weight: 600;
}

.formula-sep {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
}

/* ---------- section shell ---------- */

.section {
  padding: clamp(52px, 6.5vw, 84px) 0;
}

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  border-top: 2px solid var(--ink);
  padding-top: 20px;
}

.eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-head h2 {
  margin: 8px 0 0;
  font-size: clamp(28px, 3.6vw, 46px);
  line-height: 1.12;
  letter-spacing: -0.03em;
  font-weight: 800;
}

.section-desc {
  max-width: 62ch;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.section-mark {
  font-family: var(--font-display);
  font-size: clamp(48px, 6vw, 76px);
  line-height: 0.82;
  color: var(--orange);
  letter-spacing: -0.03em;
}

.section-mark small {
  display: block;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--muted);
}

/* ---------- filter ---------- */

.filterbar {
  position: sticky;
  top: 76px;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 26px;
  padding: 12px 0;
  background: var(--paper);
  border-block: 1px solid var(--line);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  appearance: none;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  padding: 7px 14px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1;
  transition: background-color 0.15s ease, color 0.15s ease,
    transform 0.15s ease;
}

.chip:hover {
  transform: translateY(-1px);
}

.chip[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}

.chip .n {
  display: inline-block;
  margin-left: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  opacity: 0.7;
}

.search {
  position: relative;
  margin-left: auto;
  min-width: 260px;
  flex: 1 1 260px;
  max-width: 360px;
}

.search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 15px;
  height: 15px;
  transform: translateY(-50%);
  stroke: var(--muted);
  pointer-events: none;
}

.search input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  border: 2px solid var(--ink);
  border-radius: 9px;
  background: var(--white);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.4;
  outline: none;
}

.search input::placeholder {
  color: #8a8f99;
}

.search input:focus {
  box-shadow: 0 0 0 3px var(--blue-soft);
}

.result-count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------- chapters & cards ---------- */

.chapter {
  padding: 46px 0 8px;
}

.chapter-head {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) auto;
  gap: 20px;
  align-items: end;
  padding-top: 16px;
  border-top: 2px solid var(--ink);
  margin-bottom: 22px;
}

.chapter-num {
  font-family: var(--font-display);
  font-size: clamp(46px, 5vw, 64px);
  font-weight: 600;
  line-height: 0.8;
  color: var(--chapter);
  letter-spacing: -0.04em;
}

.chapter-title {
  margin: 0;
  font-size: clamp(24px, 2.6vw, 34px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 800;
}

.chapter-en {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.chapter-desc {
  max-width: 64ch;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}

.chapter-meta {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}

.chapter-meta strong {
  display: block;
  margin-bottom: 2px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink);
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.exp-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 20px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: 6px 6px 0 var(--chapter);
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.exp-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 7px;
  background: var(--chapter);
  border-radius: 14px 14px 0 0;
}

.exp-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 9px 9px 0 var(--chapter);
}

.exp-card:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 4px;
}

.exp-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 14px;
}

.exp-no {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  line-height: 1;
  color: var(--chapter);
  letter-spacing: -0.02em;
}

.exp-mode {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
}

.exp-card h3 {
  margin: 0 0 4px;
  font-size: 21px;
  line-height: 1.25;
  letter-spacing: -0.02em;
  font-weight: 800;
}

.exp-sub {
  margin: 0 0 10px;
  color: var(--chapter-ink);
  font-size: 12.5px;
  font-weight: 700;
}

.exp-summary {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.exp-formula {
  margin: auto 0 14px;
  padding: 9px 10px;
  border: 1px dashed var(--chapter);
  border-radius: 8px;
  background: var(--chapter-soft);
  color: var(--chapter-ink);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
}

.exp-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.tag {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tag--ext {
  border-color: var(--ink);
  background: var(--yellow);
  color: var(--ink);
}

.exp-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.exp-link span {
  transition: transform 0.16s ease;
}

.exp-card:hover .exp-link span {
  transform: translateX(4px);
}

.empty {
  padding: 36px 24px;
  border: 2px dashed var(--ink);
  border-radius: var(--radius);
  background: var(--white);
  text-align: center;
}

.empty strong {
  display: block;
  margin-bottom: 6px;
  font-size: 18px;
}

.empty p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.noscript-list {
  margin: 24px 0 0;
  padding: 20px 24px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--white);
}

.noscript-list ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

/* ---------- how it works ---------- */

.how-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 28px;
}

.how-step {
  padding: 22px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: var(--white);
  box-shadow: 5px 5px 0 var(--ink);
}

.how-num {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 14px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
}

.how-step:nth-child(2) .how-num {
  background: var(--blue-soft);
}

.how-step:nth-child(3) .how-num {
  background: var(--orange-soft);
}

.how-step h3 {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 800;
}

.how-step p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- about ---------- */

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
  gap: 30px;
  align-items: start;
  margin-top: 26px;
}

.about-copy p {
  max-width: 64ch;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
}

.about-note {
  padding: 24px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: var(--yellow);
  box-shadow: 6px 6px 0 var(--ink);
}

.about-note h3 {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 800;
}

.about-note ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.about-note li {
  position: relative;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.55;
}

.about-note li::before {
  content: "→";
  position: absolute;
  left: 0;
  top: 0;
  font-family: var(--font-mono);
  font-weight: 600;
}

/* ---------- footer ---------- */

.site-footer {
  padding: 48px 0 26px;
  background: var(--ink);
  color: var(--paper);
  border-top: 2px solid var(--ink);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 0.8fr 0.8fr;
  gap: 38px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.footer-brand .brand-mark {
  box-shadow: 3px 3px 0 rgba(244, 240, 230, 0.35);
}

.footer-brand .brand-cn {
  color: var(--paper);
}

.footer-brand .brand-en {
  color: #9aa4b8;
}

.footer-note {
  max-width: 42ch;
  margin: 0;
  color: #b9c0cf;
  font-size: 12.5px;
}

.footer-h {
  margin: 0 0 12px;
  color: var(--yellow);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.18em;
}

.footer-links a {
  display: block;
  padding: 4px 0;
  color: var(--paper);
  font-size: 13px;
  text-decoration: none;
  opacity: 0.82;
}

.footer-links a:hover {
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 36px;
  padding-top: 18px;
  border-top: 1px solid rgba(244, 240, 230, 0.2);
  color: #9aa4b8;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
}

/* =========================================================
   LAB PAGE
   ========================================================= */

.lab-main {
  padding: 22px 0 70px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 8px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.breadcrumb a {
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.breadcrumb a:hover {
  border-bottom-color: var(--ink);
}

.breadcrumb .sep {
  color: #a8a294;
}

.lab-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: end;
  margin-top: 20px;
  padding-bottom: 22px;
  border-bottom: 2px solid var(--ink);
}

.lab-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.lab-chapter-tag:hover {
  background: var(--chapter);
  color: #fff;
}

.lab-chapter-tag {
  display: inline-flex;
  text-decoration: none;
  align-items: center;
  gap: 7px;
  padding: 4px 9px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: var(--chapter-soft);
  color: var(--chapter-ink);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.lab-head h1 {
  margin: 0;
  font-size: clamp(32px, 4.5vw, 58px);
  line-height: 1.05;
  letter-spacing: -0.035em;
  font-weight: 800;
}

.lab-sub {
  margin: 6px 0 0;
  color: var(--chapter-ink);
  font-size: clamp(15px, 1.5vw, 19px);
  font-weight: 700;
}

.lab-summary {
  max-width: 64ch;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}

.lab-meta {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  text-decoration: none;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.pill--level {
  background: var(--yellow);
}

.pill--ext {
  background: var(--orange-soft);
  border-color: var(--orange);
  color: var(--orange-ink);
}

.pill--chapter {
  background: var(--chapter-soft);
  color: var(--chapter-ink);
  border-color: var(--chapter);
}

.lab-primary {
  min-width: 0;
}

.lab-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 26px;
  align-items: start;
  margin-top: 28px;
}

/* viewer */

.viewer {
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: 8px 8px 0 var(--chapter);
}

.viewer-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 13px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
}

.viewer-dots {
  display: flex;
  gap: 5px;
  flex: none;
}

.viewer-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--paper);
  opacity: 0.35;
}

.viewer-dots i:nth-child(1) {
  background: var(--orange);
  opacity: 1;
}

.viewer-dots i:nth-child(2) {
  background: var(--yellow);
  opacity: 1;
}

.viewer-dots i:nth-child(3) {
  background: #22c55e;
  opacity: 1;
}

.viewer-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  flex: none;
}

.viewer-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border: 1px solid rgba(244, 240, 230, 0.45);
  border-radius: 6px;
  background: transparent;
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 9.5px;
  line-height: 1.2;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.viewer-btn:hover {
  background: rgba(244, 240, 230, 0.14);
}

.viewer-screen {
  position: relative;
  aspect-ratio: 12 / 7;
  background: #0b1221;
}

.viewer-screen iframe {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.viewer-foot {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 15px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.viewer-hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 70ch;
}

.viewer-hint svg {
  flex: none;
  margin-top: 2px;
}

.viewer-hint b {
  color: var(--ink);
}

.viewer-ratio {
  flex: none;
  font-family: var(--font-mono);
  font-size: 9px;
  color: #8a8f99;
  white-space: nowrap;
}

.rotate-hint {
  display: none;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  padding: 11px 13px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--yellow);
  font-size: 12px;
  line-height: 1.5;
}

/* aside */

.lab-aside {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.aside-card {
  padding: 17px 18px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--white);
}

.aside-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.aside-label .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--chapter);
}

.points {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.points li {
  position: relative;
  padding-left: 17px;
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.6;
}

.points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 7px;
  height: 7px;
  border: 1px solid var(--ink);
  background: var(--chapter);
}

.formula-card {
  padding: 17px 18px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--ink);
  color: var(--paper);
  box-shadow: 4px 4px 0 var(--chapter);
}

.formula-card .aside-label {
  color: var(--yellow);
}

.formula-big {
  margin: 0;
  color: var(--white);
  font-family: var(--font-mono);
  font-size: clamp(16px, 1.8vw, 21px);
  line-height: 1.4;
  letter-spacing: 0.01em;
}

.formula-note {
  margin: 8px 0 0;
  color: #b9c0cf;
  font-size: 10.5px;
  line-height: 1.5;
}

.task {
  padding: 10px 0;
  border-top: 1px dashed var(--line);
}

.task:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.task summary {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  list-style: none;
  cursor: pointer;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.55;
}

.task summary::-webkit-details-marker {
  display: none;
}

.task summary::before {
  content: "?";
  display: grid;
  place-items: center;
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
}

.task[open] summary::before {
  content: "!";
  background: var(--chapter);
  color: #fff;
}

.task p {
  margin: 7px 0 0 27px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.pitfall {
  padding: 15px 17px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--yellow);
  box-shadow: 4px 4px 0 var(--ink);
}

.pitfall .aside-label {
  color: var(--ink);
}

.pitfall p {
  margin: 0;
  color: var(--ink);
  font-size: 12.5px;
  line-height: 1.6;
}

.related-list {
  display: grid;
  gap: 2px;
}

.related-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 12.5px;
  text-decoration: none;
}

.related-list a:last-child {
  border-bottom: 0;
}

.related-list a:hover {
  color: var(--chapter-ink);
}

.related-list a span:last-child {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-top: 26px;
}

.pager a {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 15px 18px;
  border: 2px solid var(--ink);
  border-radius: 13px;
  background: var(--white);
  box-shadow: 4px 4px 0 var(--ink);
  text-decoration: none;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.pager a:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--ink);
}

.pager a[hidden] {
  display: none;
}

.pager.pager--single {
  grid-template-columns: 1fr;
}

.pager.pager--single a {
  align-items: flex-start;
  text-align: left;
}

.pager .dir {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
}

.pager .name {
  font-size: 14px;
  font-weight: 700;
}

.pager .next {
  align-items: flex-end;
  text-align: right;
}

.lab-error {
  margin-top: 40px;
  padding: 36px 28px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: 8px 8px 0 var(--ink);
  text-align: center;
}

.lab-error h1 {
  margin: 0 0 8px;
  font-size: 32px;
}

.lab-error p {
  margin: 0 auto 20px;
  max-width: 50ch;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- entrance motion ---------- */

@media (prefers-reduced-motion: no-preference) {
  .hero-copy > * {
    animation: riseIn 0.65s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }

  .hero-copy > *:nth-child(2) {
    animation-delay: 0.05s;
  }

  .hero-copy > *:nth-child(3) {
    animation-delay: 0.1s;
  }

  .hero-copy > *:nth-child(4) {
    animation-delay: 0.15s;
  }

  .hero-copy > *:nth-child(5) {
    animation-delay: 0.2s;
  }

  .hero-art {
    animation: riseIn 0.8s 0.1s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }

  .exp-card.enter {
    animation: riseIn 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
    animation-delay: calc(var(--i, 0) * 35ms);
  }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
  }

  .hero-art {
    width: min(100%, 620px);
    margin-inline: auto;
  }

  .chapter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lab-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .lab-aside {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .lab-aside .formula-card,
  .lab-aside .pitfall {
    grid-column: span 2;
  }

  .footer-grid {
    grid-template-columns: 1.2fr 0.7fr 0.7fr;
  }
}

@media (max-width: 900px) {
  .filterbar {
    position: static;
  }

  .about-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .nav {
    display: none;
  }

  .header-cta {
    margin-left: auto;
  }

  html {
    scroll-padding-top: 76px;
  }

  .header-inner {
    min-height: 64px;
    gap: 16px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .brand-mark svg {
    width: 24px;
    height: 24px;
  }

  .brand-cn {
    font-size: 19px;
  }

  .brand-en {
    font-size: 8px;
  }

  .header-cta {
    padding: 8px 12px;
    font-size: 12px;
  }

  .hero {
    padding-top: 36px;
  }

  .hero h1 {
    font-size: clamp(38px, 10vw, 52px);
  }

  .hero-actions .btn {
    flex: 1 1 180px;
  }

  .stat {
    padding-right: 10px;
  }

  .stat + .stat {
    padding-left: 10px;
  }

  .stat-num {
    font-size: 28px;
  }

  .stat-label {
    font-size: 10.5px;
  }

  .section-head {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .section-mark {
    font-size: 52px;
  }

  .filterbar {
    gap: 10px;
    padding: 10px 0;
  }

  .search {
    min-width: 100%;
    max-width: none;
    margin-left: 0;
    order: 3;
  }

  .result-count {
    display: none;
  }

  .chapter-head {
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 12px;
  }

  .chapter-num {
    font-size: 42px;
  }

  .chapter-meta {
    grid-column: 2;
    text-align: left;
    font-size: 9.5px;
  }

  .chapter-grid {
    grid-template-columns: 1fr;
  }

  .how-grid {
    grid-template-columns: 1fr;
  }

  .lab-head {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .lab-meta {
    justify-content: flex-start;
  }

  .lab-title-row {
    gap: 8px;
  }

  .lab-aside {
    grid-template-columns: 1fr;
  }

  .lab-aside .formula-card,
  .lab-aside .pitfall {
    grid-column: auto;
  }

  .viewer-bar {
    flex-wrap: wrap;
  }

  .viewer-title {
    display: none;
  }

  .viewer-actions {
    margin-left: auto;
  }

  .viewer-foot {
    flex-direction: column;
  }

  .rotate-hint {
    display: flex;
  }

  .pager {
    grid-template-columns: 1fr;
  }

  .pager .next {
    align-items: flex-end;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .brand-en {
    display: none;
  }

  .header-cta {
    font-size: 11px;
    padding: 7px 10px;
  }

  .hero h1 {
    font-size: clamp(32px, 9.6vw, 38px);
  }

  .hero-actions {
    gap: 10px;
  }

  .hero-actions .btn {
    flex: 1 1 100%;
  }

  .hero-stats {
    margin-top: 32px;
  }

  .stat-num {
    font-size: 25px;
  }

  .stat-label {
    font-size: 10px;
  }

  .exp-card {
    padding: 17px;
  }

  .exp-card h3 {
    font-size: 19px;
  }

  .formula-inner {
    gap: 16px;
  }

  .lab-head h1 {
    font-size: 30px;
  }

  .viewer-ratio {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}


/* ---------- 404 ---------- */

.notfound {
  margin-top: 56px;
}

.notfound-eyebrow {
  margin-bottom: 10px;
  text-align: center;
}

.notfound-footer {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
