:root {
  color-scheme: light;
  --ink: #14211d;
  --muted: #60706a;
  --paper: #f7f9f7;
  --surface: #ffffff;
  --surface-soft: #edf4f0;
  --line: #d9e2dd;
  --brand: #176b4d;
  --brand-strong: #0d4d38;
  --brand-soft: #dff2e9;
  --accent: #d76a3a;
  --warning: #9a5a0a;
  --shadow: 0 18px 48px rgba(25, 60, 47, 0.09);
  --radius: 18px;
  --content: 1160px;
  --reading: 780px;
  --step--1: clamp(0.82rem, 0.8rem + 0.1vw, 0.9rem);
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.08rem);
  --step-1: clamp(1.25rem, 1.12rem + 0.55vw, 1.55rem);
  --step-2: clamp(1.65rem, 1.35rem + 1vw, 2.15rem);
  --step-3: clamp(2.25rem, 1.7rem + 2vw, 3.4rem);
  --step-4: clamp(3rem, 2.25rem + 3vw, 5rem);
}

[data-theme="dark"] {
  color-scheme: dark;
  --ink: #ecf5f0;
  --muted: #a9bbb2;
  --paper: #0c1512;
  --surface: #13201b;
  --surface-soft: #172b23;
  --line: #2a3c34;
  --brand: #75d7ae;
  --brand-strong: #a3e8cb;
  --brand-soft: #17392c;
  --accent: #f09a73;
  --warning: #f0bb67;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: var(--step-0);
  line-height: 1.78;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; }
img, svg { display: block; max-width: 100%; }

.reading-progress {
  position: fixed;
  inset: 0 auto auto 0;
  z-index: 100;
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--accent));
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(18px);
}

.header-inner {
  width: min(calc(100% - 40px), var(--content));
  min-height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 26px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 760;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border: 1px solid color-mix(in srgb, var(--brand) 55%, var(--line));
  border-radius: 9px;
  background:
    linear-gradient(145deg, transparent 42%, var(--brand) 43% 51%, transparent 52%),
    radial-gradient(circle at 35% 35%, var(--accent) 0 10%, transparent 11%),
    var(--brand-soft);
}

.site-nav { margin-left: auto; }
.site-nav ul {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: block;
  padding: 8px 11px;
  border-radius: 9px;
  color: var(--muted);
  font-size: var(--step--1);
  font-weight: 620;
}
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--brand-strong); background: var(--brand-soft); }

.header-actions { display: flex; gap: 8px; }
.icon-button, .nav-toggle {
  min-width: 40px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
}
.nav-toggle { display: none; }

.hero, .page-hero {
  width: min(calc(100% - 40px), var(--content));
  margin: 0 auto;
}
.hero {
  min-height: min(760px, calc(100vh - 72px));
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
  align-items: center;
  gap: clamp(44px, 7vw, 100px);
  padding: 80px 0;
}
.page-hero { padding: 86px 0 46px; }
.hero h1, .page-hero h1 {
  max-width: 900px;
  margin: 0;
  font-size: var(--step-4);
  line-height: 1.04;
  letter-spacing: -0.055em;
}
.page-hero h1 { font-size: var(--step-3); max-width: 820px; }
.hero .lead, .page-hero .lead {
  max-width: 720px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: var(--step-1);
  line-height: 1.58;
}
.hero-learning { margin-top: 28px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 16px; background: color-mix(in srgb, var(--surface) 68%, var(--brand-soft)); }
.hero-learning h2 { margin: 0 0 12px; color: var(--brand-strong); font-size: var(--step--1); letter-spacing: 0.06em; }
.hero-learning ul { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; }
.hero-learning li { min-width: 0; padding-left: 13px; border-left: 2px solid var(--brand); }
.hero-learning strong, .hero-learning span { display: block; }
.hero-learning strong { color: var(--ink); font-size: var(--step--1); line-height: 1.4; }
.hero-learning span { margin-top: 4px; color: var(--muted); font-size: 0.78rem; line-height: 1.48; }
.hero-outcome { margin: 16px 0 0; color: var(--muted); font-size: var(--step--1); line-height: 1.55; }
.hero-outcome strong { color: var(--ink); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid var(--brand-strong);
  border-radius: 12px;
  color: var(--paper);
  background: var(--brand-strong);
  font-weight: 700;
}
.button.secondary { color: var(--brand-strong); background: transparent; border-color: var(--line); }

.hero-visual {
  position: relative;
  min-height: 470px;
  border: 1px solid var(--line);
  border-radius: 32px;
  overflow: hidden;
  background: var(--surface-soft);
  box-shadow: var(--shadow);
}
.hero-visual-image { width: 100%; height: 100%; min-height: 470px; object-fit: cover; object-position: center; }
.visual-question { position: absolute; left: 24px; right: 24px; bottom: 24px; padding: 17px 20px; border: 1px solid var(--line); border-radius: 16px; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); }
.visual-question p { margin: 0 0 4px; color: var(--brand); font-size: var(--step--1); font-weight: 760; letter-spacing: 0.06em; }
.visual-question strong, .visual-question span { display: block; }
.visual-question strong { color: var(--ink); font-size: 1rem; line-height: 1.42; }
.visual-question span { margin-top: 6px; color: var(--muted); font-size: var(--step--1); line-height: 1.48; }

.section {
  width: min(calc(100% - 40px), var(--content));
  margin: 0 auto;
  padding: 84px 0;
}
.section.compact { padding: 48px 0; }
.section-header { max-width: 760px; margin-bottom: 38px; }
.section-header h2, .reading h2 { margin: 0 0 16px; font-size: var(--step-2); line-height: 1.2; letter-spacing: -0.035em; }
.section-header p { margin: 0; color: var(--muted); }
.section-kicker { margin: 0 0 10px; color: var(--brand); font-size: var(--step--1); font-weight: 760; letter-spacing: 0.08em; text-transform: uppercase; }

.learning-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.learning-card {
  display: flex;
  min-height: 250px;
  flex-direction: column;
  padding: 26px;
  border-top: 2px solid var(--brand);
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(25, 60, 47, 0.06);
}
.learning-card .number { color: var(--brand); font-weight: 760; }
.learning-card h3 { margin: auto 0 8px; font-size: var(--step-1); line-height: 1.25; }
.learning-card p { margin: 0; color: var(--muted); }

.system-flow {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.flow-node { position: relative; min-height: 118px; padding: 16px; border-radius: 12px; background: var(--surface-soft); }
.flow-node:not(:last-child)::after { content: "→"; position: absolute; right: -11px; top: 42%; z-index: 2; color: var(--accent); font-weight: 800; }
.flow-node strong { display: block; margin-bottom: 5px; color: var(--brand-strong); }
.flow-node span { color: var(--muted); font-size: var(--step--1); line-height: 1.45; }

.content-layout {
  width: min(calc(100% - 40px), var(--content));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 220px minmax(0, var(--reading));
  gap: 70px;
  align-items: start;
  padding-bottom: 90px;
}
.toc { position: sticky; top: 104px; padding: 18px 0; border-top: 1px solid var(--line); }
.toc strong { display: block; margin-bottom: 10px; font-size: var(--step--1); }
.toc a { display: block; padding: 6px 0; color: var(--muted); font-size: var(--step--1); line-height: 1.35; }
.toc a:hover { color: var(--brand); }
.reading > section { scroll-margin-top: 100px; padding: 28px 0 64px; border-top: 1px solid var(--line); }
.reading > section:first-child { border-top: 0; }
.reading h3 { margin: 34px 0 10px; font-size: var(--step-1); line-height: 1.35; }
.reading p { margin: 0 0 20px; }
.reading ul, .reading ol { padding-left: 1.25em; }
.reading li + li { margin-top: 8px; }
.reading .intro { color: var(--muted); font-size: var(--step-1); }

.objective-box, .task-box, .note-box {
  margin: 26px 0;
  padding: 22px 24px;
  border-left: 4px solid var(--brand);
  background: var(--surface-soft);
}
.task-box { border-left-color: var(--accent); }
.note-box { border-left-color: var(--warning); }
.objective-box h3, .task-box h3, .note-box h3 { margin-top: 0; }

.visual-brief {
  margin: 34px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.visual-stage {
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--surface-soft);
  overflow: hidden;
}
.visual-stage img {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(68vh, 760px);
  object-fit: contain;
  background: var(--surface-soft);
}
.visual-brief.is-portrait .visual-stage {
  min-height: 0;
  padding: 0;
  background:
    linear-gradient(135deg, transparent 25%, color-mix(in srgb, var(--brand) 4%, transparent) 25% 50%, transparent 50% 75%, color-mix(in srgb, var(--brand) 4%, transparent) 75%),
    var(--surface-soft);
  background-size: 34px 34px;
}
.visual-brief.is-portrait .visual-stage img {
  width: 100%;
  max-width: none;
  max-height: none;
}
.visual-brief.is-dashboard .visual-stage img { max-height: min(70vh, 820px); }
}
.visual-brief figcaption { padding: 20px 22px; color: var(--muted); font-size: var(--step--1); }
.visual-brief figcaption strong { color: var(--ink); }

.data-table { width: 100%; margin: 28px 0; border-collapse: collapse; font-size: var(--step--1); }
.data-table th, .data-table td { padding: 12px 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.data-table th { color: var(--brand-strong); background: var(--surface-soft); }
.data-table tr:hover td { background: color-mix(in srgb, var(--brand-soft) 45%, transparent); }

.comparison { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 28px 0; }
.comparison > div { padding: 22px; border: 1px solid var(--line); background: var(--surface); }
.comparison h3 { margin-top: 0; }
.metric-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin: 30px 0; border: 1px solid var(--line); background: var(--line); }
.metric { padding: 18px; background: var(--surface); }
.metric strong { display: block; color: var(--brand-strong); font-size: var(--step-1); }
.metric span { color: var(--muted); font-size: var(--step--1); }

.chapter-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 50px; }
.chapter-link { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.chapter-link.next { text-align: right; }
.chapter-link span { display: block; color: var(--muted); font-size: var(--step--1); }
.chapter-link strong { color: var(--brand-strong); }

.site-footer { border-top: 1px solid var(--line); }
.footer-inner { width: min(calc(100% - 40px), var(--content)); margin: 0 auto; padding: 34px 0 44px; display: flex; justify-content: space-between; gap: 20px; color: var(--muted); font-size: var(--step--1); }

@media (max-width: 960px) {
  .nav-toggle { display: inline-grid; place-items: center; }
  .site-nav { display: none; position: absolute; top: 72px; left: 20px; right: 20px; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
  .site-nav[data-open="true"] { display: block; }
  .site-nav ul { align-items: stretch; flex-direction: column; }
  .site-nav a { padding: 11px 12px; }
  .hero { grid-template-columns: 1fr; }
  .hero-visual, .hero-visual-image { min-height: 390px; }
  .hero-learning ul { grid-template-columns: 1fr; gap: 11px; }
  .learning-grid { grid-template-columns: 1fr 1fr; }
  .system-flow { grid-template-columns: repeat(3, 1fr); }
  .flow-node:nth-child(3)::after { display: none; }
  .content-layout { grid-template-columns: 1fr; gap: 0; }
  .toc { position: static; columns: 2; margin-bottom: 24px; }
}

@media (max-width: 620px) {
  .header-inner, .hero, .page-hero, .section, .content-layout, .footer-inner { width: min(calc(100% - 28px), var(--content)); }
  .brand span:last-child { display: none; }
  .hero { min-height: auto; padding: 60px 0; }
  .hero h1 { font-size: clamp(2.7rem, 14vw, 4rem); }
  .hero-learning { padding: 17px; }
  .hero-visual, .hero-visual-image { min-height: 330px; }
  .hero-visual { border-radius: 22px; }
  .visual-question { left: 16px; right: 16px; bottom: 16px; padding: 15px 16px; }
  .page-hero { padding-top: 60px; }
  .learning-grid, .comparison, .chapter-nav { grid-template-columns: 1fr; }
  .system-flow { grid-template-columns: 1fr; }
  .flow-node:not(:last-child)::after { content: "↓"; top: auto; right: 50%; bottom: -17px; }
  .flow-node:nth-child(3)::after { display: block; }
  .metric-strip { grid-template-columns: 1fr 1fr; }
  .toc { columns: 1; }
  .visual-stage img { max-height: 62vh; }
  .visual-brief.is-portrait .visual-stage img { max-height: none; }
  .data-table { display: block; overflow-x: auto; white-space: nowrap; }
  .footer-inner { flex-direction: column; }
}

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

@media print {
  :root { --paper: #fff; --surface: #fff; --ink: #000; --muted: #333; --line: #bbb; }
  .site-header, .toc, .chapter-nav, .reading-progress, .site-footer { display: none !important; }
  .page-hero, .content-layout { width: 100%; }
  .page-hero { padding: 20px 0; }
  .content-layout { display: block; }
  .reading > section { break-inside: avoid; padding-bottom: 28px; }
  .visual-brief, .objective-box, .task-box { break-inside: avoid; box-shadow: none; }
}
