:root {
  color-scheme: light;
  --bg: #f3f0e8;
  --bg-elevated: #fbf8f1;
  --bg-muted: #ece7dc;
  --surface: #fffdf9;
  --surface-strong: #f8f4eb;
  --text: #172026;
  --text-soft: #53606a;
  --text-faint: #74818a;
  --border: rgba(23, 32, 38, 0.1);
  --border-strong: rgba(23, 32, 38, 0.18);
  --accent: #0d8a83;
  --accent-soft: rgba(13, 138, 131, 0.12);
  --accent-strong: #0b6c66;
  --signal: #eb6b2d;
  --signal-soft: rgba(235, 107, 45, 0.12);
  --shadow: 0 18px 40px rgba(23, 32, 38, 0.08);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --content-width: 1200px;
  --sidebar-width: 280px;
  --font-sans: "IBM Plex Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-display: "Space Grotesk", "IBM Plex Sans", "PingFang SC", sans-serif;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #11181f;
  --bg-elevated: #172129;
  --bg-muted: #1b2830;
  --surface: #18232b;
  --surface-strong: #101920;
  --text: #ecf1f4;
  --text-soft: #a5b2bb;
  --text-faint: #7a8993;
  --border: rgba(236, 241, 244, 0.12);
  --border-strong: rgba(236, 241, 244, 0.22);
  --accent: #4fd5ca;
  --accent-soft: rgba(79, 213, 202, 0.14);
  --accent-strong: #7ef2e8;
  --signal: #ff9751;
  --signal-soft: rgba(255, 151, 81, 0.14);
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background:
    radial-gradient(circle at top left, rgba(13, 138, 131, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(235, 107, 45, 0.08), transparent 24%),
    var(--bg);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.page-shell {
  width: min(calc(100% - 40px), calc(var(--content-width) + 40px));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.topbar {
  position: sticky;
  top: 18px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--signal));
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-copy strong {
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.brand-copy span {
  color: var(--text-soft);
  font-size: 0.85rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.searchbox {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: min(36vw, 360px);
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
}

.searchbox span {
  color: var(--text-soft);
  font-size: 0.88rem;
}

.searchbox input {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
}

.theme-toggle-track {
  position: relative;
  width: 52px;
  height: 28px;
  border-radius: 999px;
  background: var(--bg-muted);
  border: 1px solid var(--border);
}

.theme-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--signal));
  transition: transform 0.22s ease;
}

html[data-theme="dark"] .theme-toggle-thumb {
  transform: translateX(24px);
}

.page-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: 26px;
  margin-top: 28px;
}

.sidebar {
  position: sticky;
  top: 108px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-card,
.hero-panel,
.callout,
.plan-card,
.topic-card,
.timeline-item,
.source-group,
.footer {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.sidebar-card {
  padding: 18px;
}

.sidebar-card.compact p {
  margin: 0 0 10px;
  color: var(--text-soft);
  line-height: 1.65;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.section-nav {
  display: grid;
  gap: 8px;
}

.section-nav a {
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--text-soft);
  transition: background-color 0.18s ease, color 0.18s ease;
}

.section-nav a.active,
.section-nav a:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.content {
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 22px;
}

.hero-copy,
.hero-panel,
.doc-section {
  padding: 28px;
}

.hero-copy {
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent),
    linear-gradient(135deg, var(--surface), var(--surface-strong));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.hero-copy h1,
.section-heading h2,
.hero-panel h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.hero-copy h1 {
  font-size: clamp(2.3rem, 4vw, 4.5rem);
  line-height: 0.96;
}

.hero-lead {
  margin: 18px 0 0;
  max-width: 760px;
  color: var(--text-soft);
  font-size: 1.04rem;
  line-height: 1.8;
}

.hero-lead span {
  color: var(--text);
  font-weight: 700;
}

.hero-callouts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 26px;
}

.callout {
  padding: 16px;
  background: color-mix(in srgb, var(--surface) 86%, var(--bg-muted));
}

.callout-label {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--text-faint);
  font-size: 0.82rem;
}

.callout strong {
  display: block;
  font-size: 1rem;
  line-height: 1.5;
}

.callout small {
  display: block;
  margin-top: 6px;
  color: var(--text-soft);
  line-height: 1.55;
}

.hero-panel-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.hero-panel h2 {
  font-size: 1.4rem;
}

.stats-grid,
.plan-grid,
.card-grid,
.source-groups {
  display: grid;
  gap: 16px;
}

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

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

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

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

.stat-card {
  padding: 16px;
  border-radius: 16px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
}

.stat-card span {
  display: block;
  color: var(--text-faint);
  font-size: 0.82rem;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: 1.6rem;
}

.stat-card small {
  display: block;
  margin-top: 6px;
  color: var(--text-soft);
  line-height: 1.55;
}

.doc-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent),
    var(--bg-elevated);
}

.section-heading {
  max-width: 820px;
  margin-bottom: 22px;
}

.section-heading h2 {
  font-size: clamp(1.7rem, 2.5vw, 2.6rem);
}

.section-heading p {
  margin: 14px 0 0;
  color: var(--text-soft);
  line-height: 1.8;
}

.plan-card,
.topic-card {
  position: relative;
  overflow: hidden;
}

.plan-card {
  padding: 18px;
}

.plan-card::before,
.topic-card::before,
.timeline-item::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--signal));
}

.plan-step {
  color: var(--text-faint);
  font-size: 0.82rem;
}

.plan-card h3,
.topic-card h3,
.timeline-item h3,
.source-group h3 {
  margin: 10px 0 0;
  font-size: 1.05rem;
  line-height: 1.5;
}

.plan-card p,
.topic-card p,
.timeline-item p {
  margin: 12px 0 0;
  color: var(--text-soft);
  line-height: 1.75;
}

.plan-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 700;
}

.topic-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.topic-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

.topic-card-body {
  color: var(--text-soft);
  line-height: 1.72;
}

.chip-row,
.source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip,
.source-link,
.timeline-meta span {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
}

.chip {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.chip.signal {
  background: var(--signal-soft);
  color: var(--signal);
}

.source-link {
  border: 1px solid var(--border);
  color: var(--text-soft);
}

.source-link:hover,
.source-list a:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.note-block,
.code-block {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
}

.note-block strong,
.code-block strong {
  display: block;
  margin-bottom: 6px;
}

.code-block {
  font-family: "IBM Plex Mono", "Cascadia Code", Consolas, monospace;
  font-size: 0.88rem;
  white-space: pre-wrap;
  color: var(--text);
}

.timeline {
  display: grid;
  gap: 16px;
}

.timeline-item {
  position: relative;
  padding: 20px 20px 18px;
}

.timeline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.timeline-meta span {
  background: var(--surface-strong);
  border: 1px solid var(--border);
  color: var(--text-soft);
}

.source-group {
  padding: 20px;
}

.source-group p {
  margin: 10px 0 16px;
  color: var(--text-soft);
  line-height: 1.7;
}

.source-list {
  display: grid;
  gap: 10px;
}

.source-list a {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text-soft);
  background: var(--surface-strong);
}

.footer {
  padding: 18px 20px;
}

.footer p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.7;
}

.is-hidden {
  display: none !important;
}

@media (max-width: 1180px) {
  .page-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    order: 2;
  }

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

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

@media (max-width: 900px) {
  .topbar {
    border-radius: 28px;
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .searchbox {
    min-width: 0;
  }

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

  .hero-callouts,
  .stats-grid,
  .plan-grid,
  .card-grid,
  .source-groups {
    grid-template-columns: 1fr;
  }

  .hero-copy,
  .hero-panel,
  .doc-section {
    padding: 22px;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(calc(100% - 24px), calc(var(--content-width) + 24px));
    padding-top: 16px;
  }

  .hero-copy h1 {
    font-size: 2.1rem;
  }
}
