@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;700&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
  --bg: #faf7f2;
  --bg-alt: #f3ebe2;
  --surface: #fffdf9;
  --surface-2: #f9f2ea;
  --card: #fffaf3;
  --card-hover: #fff5ea;
  --border: #e8dccb;
  --border-strong: #dbc3a9;
  --ink: #1f1a14;
  --ink-dim: #463b30;
  --muted: #726251;
  --brand: #d97745;
  --brand-strong: #bf5f32;
  --brand-soft: rgba(217, 119, 69, 0.14);
  --accent: #efab72;
  --accent-soft: rgba(239, 171, 114, 0.16);
  --success: #2f7d57;
  --warning: #aa6119;
  --danger: #b8493d;
  --free: #2f7d57;
  --pro: #c5662f;
  --max: #8f4d2d;
  --shadow-sm: 0 8px 22px rgba(84, 52, 23, 0.08);
  --shadow: 0 16px 38px rgba(84, 52, 23, 0.12);
  --shadow-lg: 0 24px 56px rgba(84, 52, 23, 0.16);
  --ring: 0 0 0 3px rgba(217, 119, 69, 0.28);
  --radius: 18px;
  --radius-sm: 12px;
  --max-w: 1180px;
  --sidebar-width: 296px;
  --topbar-height: 70px;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  --heading: "Space Grotesk", "Noto Sans SC", "Segoe UI", sans-serif;
  --body: "Noto Sans SC", "Segoe UI", "PingFang SC", "Microsoft YaHei UI", sans-serif;
}

html.dark {
  --bg: #16110c;
  --bg-alt: #1e1711;
  --surface: #1f1711;
  --surface-2: #281e15;
  --card: #251b14;
  --card-hover: #2d2118;
  --border: #3b2a1d;
  --border-strong: #6d4427;
  --ink: #f6ece1;
  --ink-dim: #ead7bf;
  --muted: #b39c84;
  --brand: #f29a5d;
  --brand-strong: #f6b27a;
  --brand-soft: rgba(242, 154, 93, 0.2);
  --accent: #f1bc86;
  --accent-soft: rgba(241, 188, 134, 0.22);
  --success: #61bd87;
  --warning: #f1b06a;
  --danger: #e08f80;
  --free: #68c48f;
  --pro: #ef9b63;
  --max: #e5b18a;
  --shadow-sm: 0 10px 28px rgba(0, 0, 0, 0.32);
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 28px 68px rgba(0, 0, 0, 0.48);
  --ring: 0 0 0 3px rgba(242, 154, 93, 0.34);
}

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

html {
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) var(--surface-2);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--surface-2);
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--brand);
}

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

body {
  margin: 0;
  font-family: var(--body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 12% 2%, rgba(239, 171, 114, 0.18), transparent 46%),
    radial-gradient(circle at 86% 4%, rgba(217, 119, 69, 0.12), transparent 40%),
    linear-gradient(var(--bg), var(--bg));
  z-index: -2;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(to right, transparent 0%, rgba(217, 119, 69, 0.04) 50%, transparent 100%);
  z-index: -1;
  pointer-events: none;
}

a {
  color: var(--brand-strong);
  text-decoration: none;
  transition: color 0.2s ease, opacity 0.2s ease;
}

a:hover {
  color: var(--brand);
}

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: 8px;
}

.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  z-index: 1100;
  transition: width 0.1s linear;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--brand), transparent);
  opacity: 0.42;
}

.topbar-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  min-height: var(--topbar-height);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  flex-shrink: 0;
  font-family: var(--heading);
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nav a {
  min-height: 38px;
  padding: 8px 13px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.nav a:hover {
  color: var(--ink);
  border-color: var(--border);
  background: var(--surface-2);
}

.nav a.active {
  color: var(--brand-strong);
  border-color: color-mix(in srgb, var(--brand) 40%, var(--border));
  background: var(--brand-soft);
}

.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--brand-strong);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.theme-toggle:hover {
  border-color: color-mix(in srgb, var(--brand) 45%, var(--border));
  background: color-mix(in srgb, var(--surface-2) 64%, var(--brand-soft));
}

.theme-toggle svg,
.sidebar-toggle svg,
.back-to-top svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.9;
}

.search-box {
  position: relative;
  width: min(360px, 100%);
  margin-left: auto;
  margin-right: 2px;
}

.search-box::before {
  content: "⌕";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  font-size: 0.96rem;
}

.search-box input {
  width: 100%;
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 0.9rem;
  font-family: var(--body);
  padding: 9px 12px 9px 34px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.search-box input::placeholder {
  color: var(--muted);
}

.search-box input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--brand) 50%, var(--border));
  background: var(--surface);
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  max-height: 380px;
  overflow-y: auto;
  z-index: 220;
  display: none;
}

.search-results.active {
  display: block;
}

.search-result-item {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s ease;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: var(--brand-soft);
}

.search-result-item .title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 3px;
}

.search-result-item .excerpt {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.55;
}

.search-result-item mark {
  color: var(--brand-strong);
  background: var(--accent-soft);
  padding: 0 3px;
  border-radius: 4px;
}

.shell {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 30px 24px 78px;
  position: relative;
  z-index: 1;
  transition: margin-left 0.3s ease;
}

body.sidebar-open .shell {
  margin-left: var(--sidebar-width);
}

.hero {
  position: relative;
  border-radius: 26px;
  padding: 44px 42px;
  background:
    radial-gradient(circle at 85% 20%, rgba(217, 119, 69, 0.2), transparent 48%),
    linear-gradient(160deg, color-mix(in srgb, var(--surface) 82%, var(--accent-soft)) 0%, var(--surface) 100%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(217, 119, 69, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(217, 119, 69, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  pointer-events: none;
}

.hero .scanline {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--brand), transparent);
  opacity: 0.24;
  pointer-events: none;
  animation: scanline 7.2s linear infinite;
}

@keyframes scanline {
  0% {
    top: -2px;
  }
  100% {
    top: 100%;
  }
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--brand-soft);
  border: 1px solid color-mix(in srgb, var(--brand) 36%, var(--border));
  color: var(--brand-strong);
  font-family: var(--heading);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.hero h1 {
  margin: 18px 0 14px;
  font-family: var(--heading);
  font-size: clamp(2.05rem, 4.5vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.hero p {
  margin: 0;
  max-width: 860px;
  color: var(--ink-dim);
  font-size: 1rem;
}

.badge-row {
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--brand) 30%, var(--border));
  background: color-mix(in srgb, var(--surface) 72%, var(--brand-soft));
  color: var(--brand-strong);
  font-size: 0.79rem;
  font-weight: 600;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.badge:hover {
  border-color: color-mix(in srgb, var(--brand) 50%, var(--border));
  transform: translateY(-1px);
}

.section {
  margin-top: 26px;
  padding: 30px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.section::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--brand), transparent);
  opacity: 0.28;
}

.section h2 {
  margin: 0 0 14px;
  color: var(--ink);
  font-family: var(--heading);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.2;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section h2::before {
  content: "";
  width: 4px;
  height: 22px;
  border-radius: 6px;
  background: var(--brand);
  flex-shrink: 0;
}

.section h3 {
  margin: 18px 0 9px;
  color: var(--ink);
  font-family: var(--heading);
  font-size: 1.06rem;
  font-weight: 650;
}

.lead {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.96rem;
}

.grid {
  display: grid;
  gap: 14px;
}

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

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

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

.card {
  position: relative;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  padding: 20px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.card::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  opacity: 0;
  transition: opacity 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--brand) 32%, var(--border));
  background: var(--card-hover);
}

.card:hover::before {
  opacity: 1;
}

.card h3,
.card h4 {
  margin: 0 0 8px;
  color: var(--ink);
}

.card p,
.card li,
.section li,
.section td,
.section th {
  color: var(--muted);
}

.card h3 a,
.card h4 a {
  color: var(--brand-strong);
}

.card h3 a:hover,
.card h4 a:hover {
  color: var(--brand);
}

.metric {
  font-family: var(--heading);
  font-size: 2.1rem;
  line-height: 1;
  font-weight: 700;
  color: var(--brand-strong);
}

.metric-label {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.pill.free {
  color: var(--free);
  background: color-mix(in srgb, var(--surface) 60%, rgba(47, 125, 87, 0.2));
  border-color: rgba(47, 125, 87, 0.3);
}

.pill.pro {
  color: var(--pro);
  background: color-mix(in srgb, var(--surface) 55%, rgba(197, 102, 47, 0.2));
  border-color: rgba(197, 102, 47, 0.3);
}

.pill.max {
  color: var(--max);
  background: color-mix(in srgb, var(--surface) 50%, rgba(143, 77, 45, 0.22));
  border-color: rgba(143, 77, 45, 0.32);
}

.callout {
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--brand) 34%, var(--border));
  background: color-mix(in srgb, var(--surface) 80%, var(--brand-soft));
  padding: 16px 20px;
  color: var(--ink-dim);
}

.callout strong {
  color: var(--brand-strong);
}

.download-tip {
  margin: 10px 0 0;
  color: var(--warning);
  font-size: 0.88rem;
}

.download-tip strong {
  color: var(--brand-strong);
}

.table-wrap {
  margin-top: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow-x: auto;
  background: var(--surface);
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 12px 13px;
  font-size: 0.91rem;
  line-height: 1.6;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--ink);
  background: color-mix(in srgb, var(--surface-2) 80%, var(--brand-soft));
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

tr:nth-child(even) td {
  background: color-mix(in srgb, var(--surface-2) 80%, transparent);
}

tr:hover td {
  background: color-mix(in srgb, var(--brand-soft) 50%, var(--surface));
}

tr:last-child td {
  border-bottom: none;
}

.path {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--brand-strong);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--brand) 35%, var(--border));
  background: color-mix(in srgb, var(--surface) 66%, var(--brand-soft));
}

.step-list,
.feature-list {
  margin: 0;
  padding-left: 18px;
}

.step-list li,
.feature-list li {
  margin-bottom: 7px;
  line-height: 1.62;
}

.step-list li::marker {
  color: var(--brand-strong);
  font-weight: 700;
}

.feature-list li::marker {
  color: color-mix(in srgb, var(--brand) 55%, var(--muted));
}

details {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  padding: 0 18px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

details + details {
  margin-top: 10px;
}

details[open] {
  border-color: color-mix(in srgb, var(--brand) 38%, var(--border));
  box-shadow: var(--shadow-sm);
}

summary {
  min-height: 52px;
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
  color: var(--ink);
  font-family: var(--heading);
  font-size: 0.98rem;
  font-weight: 650;
}

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

summary::before {
  content: "▸";
  color: var(--brand-strong);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

details[open] summary::before {
  transform: rotate(90deg);
}

.summary-note {
  margin-left: 2px;
  color: var(--muted);
  font-weight: 450;
  font-size: 0.88rem;
}

.details-body {
  border-top: 1px solid var(--border);
  padding: 15px 0 17px;
  animation: slideDown 0.24s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.diagram {
  margin: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-dim);
  padding: 20px;
  white-space: pre-wrap;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.88rem;
  line-height: 1.58;
}

.diagram::before {
  content: "SYSTEM ARCHITECTURE";
  display: block;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--heading);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
}

.sidebar {
  position: fixed;
  top: var(--topbar-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-right: 1px solid var(--border);
  transform: translateX(-100%);
  transition: transform 0.28s ease;
  overflow-y: auto;
  padding: 18px 0 22px;
  z-index: 50;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-header {
  padding: 0 18px 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}

.sidebar-header h3 {
  margin: 0;
  color: var(--muted);
  font-family: var(--heading);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sidebar-toc {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sidebar-toc li {
  margin: 0;
}

.sidebar-toc a {
  display: block;
  padding: 8px 18px;
  color: var(--muted);
  font-size: 0.86rem;
  border-left: 2px solid transparent;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.sidebar-toc a:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.sidebar-toc a.active {
  color: var(--brand-strong);
  border-left-color: var(--brand);
  background: var(--brand-soft);
}

.sidebar-toc .toc-h3 {
  padding-left: 30px;
  font-size: 0.82rem;
}

.sidebar-toggle,
.back-to-top {
  position: fixed;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--brand) 36%, var(--border));
  background: color-mix(in srgb, var(--surface) 76%, var(--brand-soft));
  color: var(--brand-strong);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
  z-index: 65;
}

.sidebar-toggle {
  left: 16px;
  bottom: 82px;
}

.back-to-top {
  right: 22px;
  bottom: 22px;
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.sidebar-toggle:hover,
.back-to-top:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--brand) 56%, var(--border));
}

.footer {
  margin-top: 28px;
  padding: 22px 28px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.9rem;
}

.footer a {
  color: var(--brand-strong);
}

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

.plan-card {
  border-radius: 16px;
  padding: 24px;
  color: #fff8f1;
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.plan-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
}

.plan-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.plan-card.free {
  background: linear-gradient(145deg, #244f3d 0%, #356b52 100%);
  border-color: rgba(142, 225, 183, 0.28);
}

.plan-card.pro {
  background: linear-gradient(145deg, #8d4c2a 0%, #b46036 100%);
  border-color: rgba(255, 214, 170, 0.26);
}

.plan-card.max {
  background: linear-gradient(145deg, #684536 0%, #86583f 100%);
  border-color: rgba(255, 227, 201, 0.25);
}

.plan-price {
  margin: 12px 0;
  font-family: var(--heading);
  font-size: 2rem;
  line-height: 1;
  font-weight: 700;
}

.plan-card p {
  margin: 0 0 10px;
  color: rgba(255, 245, 236, 0.82);
}

.plan-card .feature-list li {
  color: rgba(255, 245, 236, 0.88);
}

.plan-card .feature-list li::marker {
  color: rgba(255, 245, 236, 0.72);
}

.source-note {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  color: var(--muted);
  font-size: 0.87rem;
}

.caption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

pre code {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--brand-strong);
  font-family: var(--mono);
  font-size: 0.86rem;
}

@media print {
  .topbar,
  .sidebar,
  .sidebar-toggle,
  .back-to-top,
  .progress-bar,
  .search-box,
  .theme-toggle {
    display: none !important;
  }

  body {
    background: #fff !important;
    color: #000 !important;
  }

  .shell {
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
  }

  .hero,
  .section,
  .card,
  .footer {
    background: #fff !important;
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    page-break-inside: avoid;
  }

  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
}

@media (max-width: 1100px) {
  .grid.three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 980px) {
  .topbar-inner {
    gap: 12px;
    padding: 10px 16px;
    min-height: 64px;
  }

  .search-box {
    order: 3;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

  .shell {
    padding: 22px 16px 54px;
  }

  .hero {
    padding: 34px 24px;
    border-radius: 20px;
  }

  .section {
    padding: 24px;
  }

  .grid.two,
  .grid.three,
  .grid.four,
  .plan-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    width: min(88vw, 360px);
  }

  body.sidebar-open .shell {
    margin-left: 0;
  }
}

@media (max-width: 720px) {
  .topbar-inner {
    flex-wrap: wrap;
  }

  .nav {
    width: 100%;
    order: 2;
  }

  .nav a {
    flex: 1 1 auto;
    min-width: 96px;
  }

  .theme-toggle {
    margin-left: auto;
    order: 1;
  }

  .hero h1 {
    font-size: clamp(1.7rem, 8vw, 2.5rem);
  }

  .section h2 {
    font-size: 1.3rem;
  }

  .summary-note {
    display: block;
    margin-left: 0;
    margin-top: 4px;
  }
}

@media (max-width: 520px) {
  .hero {
    padding: 24px 18px;
  }

  .section {
    padding: 18px;
  }

  .badge {
    font-size: 0.75rem;
  }

  .back-to-top {
    right: 12px;
    bottom: 14px;
    width: 40px;
    height: 40px;
  }

  .sidebar-toggle {
    left: 12px;
    bottom: 68px;
    width: 40px;
    height: 40px;
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
