:root {
  --canvas: #f3f3ef;
  --paper: #fafaf8;
  --surface: #ffffff;
  --sidebar: #f1f1ed;
  --line: #e9e9e3;
  --line-strong: #d8d8ce;
  --ink: #1b1b19;
  --ink-muted: #67675f;
  --ink-subtle: #62625b;
  --accent: #1b52bf;
  --accent-strong: #2a6be6;
  --accent-soft: #e6edfc;
  --warning: #8a5a13;
  --warning-soft: #f8edcf;
  --danger: #9f2d24;
  --danger-soft: #fbe9e6;
  --success: #2f6d4e;
  --success-soft: #e3f2e9;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Fraunces", Georgia, Cambria, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #131313;
    --paper: #222222;
    --surface: #292929;
    --sidebar: #1c1c1c;
    --line: #2e2e2e;
    --line-strong: #3d3d3d;
    --ink: #f4f4ef;
    --ink-muted: #c3c4ba;
    --ink-subtle: #adb0a7;
    --accent: #84aeff;
    --accent-strong: #2a6be6;
    --accent-soft: rgb(42 107 230 / 18%);
    --warning: #f6d06f;
    --warning-soft: rgb(183 121 31 / 18%);
    --danger: #ffb4ab;
    --danger-soft: rgb(180 35 24 / 18%);
    --success: #93d4ad;
    --success-soft: rgb(47 109 78 / 22%);
  }
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
}

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

::selection {
  background: rgb(42 107 230 / 24%);
}

.wrap {
  width: min(1160px, calc(100% - 48px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--canvas) 90%, transparent);
  backdrop-filter: saturate(1.15) blur(12px);
}

.site-header .bar {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand,
.top-nav {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  text-decoration: none;
}

.brand img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.brand strong {
  font-size: 15px;
  font-weight: 650;
}

.brand span {
  color: var(--ink-subtle);
  font-size: 12px;
}

.top-nav {
  gap: 8px;
}

.top-nav a {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  padding: 0 13px;
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.top-nav a:hover {
  background: var(--paper);
  color: var(--ink);
}

.top-nav .language {
  border: 1px solid var(--line-strong);
  color: var(--accent);
}

.hero {
  padding: 76px 0 54px;
  border-bottom: 1px solid var(--line);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 72px;
  align-items: end;
}

.eyebrow,
.status-badge,
.label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.045em;
}

.eyebrow {
  color: var(--ink-muted);
}

.eyebrow::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-strong);
  box-shadow: 0 0 0 4px var(--accent-soft);
  content: "";
}

h1,
h2,
h3 {
  text-wrap: balance;
}

h1 {
  max-width: 760px;
  margin: 18px 0 0;
  font-family: var(--serif);
  font-size: clamp(42px, 6vw, 68px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.04;
}

.hero .lead {
  max-width: 700px;
  margin: 24px 0 0;
  color: var(--ink-muted);
  font-size: 18px;
  line-height: 1.7;
}

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

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}

.button-primary {
  background: var(--accent-strong);
  color: #fff;
}

.button-primary:hover {
  background: var(--accent);
  color: #fff;
}

.button-secondary {
  border-color: var(--line-strong);
  background: var(--paper);
  color: var(--ink);
}

.status-card {
  border: 1px solid color-mix(in srgb, var(--warning) 38%, var(--line));
  border-radius: 16px;
  background: var(--paper);
  overflow: hidden;
}

.status-card .status-head {
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--warning-soft);
}

.status-badge {
  color: var(--warning);
}

.status-card h2 {
  margin: 8px 0 0;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.25;
}

.status-card .status-body {
  padding: 18px 22px 22px;
}

.status-card p {
  margin: 0;
  color: var(--ink-muted);
}

.status-card strong {
  color: var(--ink);
}

.guide-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 760px);
  justify-content: center;
  gap: 64px;
  padding: 58px 0 80px;
}

.toc {
  position: sticky;
  top: 94px;
  align-self: start;
}

.toc p {
  margin: 0 0 12px;
  color: var(--ink-subtle);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

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

.toc a {
  display: block;
  border-left: 1px solid var(--line-strong);
  padding: 7px 0 7px 14px;
  color: var(--ink-muted);
  font-size: 13px;
  text-decoration: none;
}

.toc a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.article section {
  padding: 0 0 56px;
}

.article,
.toc {
  min-width: 0;
}

.article section + section {
  padding-top: 56px;
  border-top: 1px solid var(--line);
}

.section-number {
  display: block;
  margin-bottom: 8px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
}

.article h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(29px, 4vw, 38px);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.17;
}

.section-intro {
  margin: 14px 0 26px;
  color: var(--ink-muted);
  font-size: 16px;
}

.article h3 {
  margin: 30px 0 10px;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.3;
}

.article p {
  margin: 10px 0;
}

.article ul,
.article ol {
  padding-left: 22px;
}

.article li + li {
  margin-top: 7px;
}

.article code,
.endpoint {
  font-family: var(--mono);
}

.article :not(pre) > code {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--sidebar);
  padding: 1px 5px;
  font-size: 0.88em;
  overflow-wrap: anywhere;
}

.compare-grid,
.flow,
.cards {
  display: grid;
  gap: 14px;
}

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

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

.card,
.step,
.state {
  border: 1px solid var(--line);
  background: var(--paper);
}

.card {
  border-radius: 14px;
  padding: 20px;
}

.card h3 {
  margin: 7px 0 8px;
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 700;
}

.card p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 14px;
}

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

.label-now {
  color: var(--success);
}

.label-future {
  color: var(--warning);
}

.callout {
  margin: 22px 0;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: var(--paper);
  padding: 16px 18px;
}

.callout strong {
  display: block;
  margin-bottom: 3px;
}

.callout p {
  margin: 0;
  color: var(--ink-muted);
}

.callout-warning {
  border-left-color: var(--warning);
  background: color-mix(in srgb, var(--warning-soft) 48%, var(--paper));
}

.callout-danger {
  border-left-color: var(--danger);
  background: color-mix(in srgb, var(--danger-soft) 42%, var(--paper));
}

.table-wrap {
  margin: 22px 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th,
td {
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--sidebar);
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 700;
}

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

.steps,
.states {
  display: grid;
  gap: 12px;
  margin: 24px 0;
}

.step {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 16px;
  border-radius: 12px;
  padding: 18px;
}

.step-number {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
}

.step h3 {
  margin: 0 0 5px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 700;
}

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

.flow {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
  margin: 24px 0;
}

.flow-node {
  position: relative;
  min-height: 106px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  padding: 14px;
  text-align: center;
}

.flow-node:not(:last-child)::after {
  position: absolute;
  top: 50%;
  right: -13px;
  z-index: 2;
  color: var(--accent);
  content: "→";
  transform: translateY(-50%);
}

.flow-node strong {
  font-size: 13px;
}

.flow-node span {
  margin-top: 4px;
  color: var(--ink-subtle);
  font-family: var(--mono);
  font-size: 11px;
}

.state {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 18px;
  border-radius: 10px;
  padding: 15px 17px;
}

.state strong {
  font-size: 13px;
}

.state p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 13.5px;
}

.state-ready {
  border-color: color-mix(in srgb, var(--success) 35%, var(--line));
  background: color-mix(in srgb, var(--success-soft) 35%, var(--paper));
}

.state-fallback {
  border-color: color-mix(in srgb, var(--warning) 35%, var(--line));
}

.code-block {
  position: relative;
  margin: 16px 0 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--sidebar);
  overflow: hidden;
}

.code-label {
  display: block;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-subtle);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
}

.checklist {
  margin: 20px 0;
  padding: 0;
  list-style: none;
}

.checklist li {
  position: relative;
  padding-left: 30px;
}

.checklist li::before {
  position: absolute;
  top: 4px;
  left: 0;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--accent);
  content: "✓";
  font-size: 11px;
  font-weight: 800;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 32px 0 48px;
  color: var(--ink-subtle);
}

.site-footer .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.site-footer p {
  margin: 0;
  font-size: 12px;
}

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

@media (max-width: 920px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 36px;
  }

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

  .toc {
    position: static;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--line);
  }

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

@media (max-width: 660px) {
  .wrap {
    width: min(100% - 32px, 1160px);
  }

  .site-header .bar {
    min-height: 58px;
  }

  .brand span,
  .top-nav .home-link {
    display: none;
  }

  .top-nav a {
    min-height: 42px;
    padding: 0 11px;
  }

  .hero {
    padding: 46px 0 38px;
  }

  h1 {
    font-size: 40px;
  }

  .hero .lead {
    font-size: 16px;
  }

  .guide-layout {
    gap: 42px;
    padding: 38px 0 56px;
  }

  .toc ol,
  .compare-grid,
  .cards {
    grid-template-columns: 1fr;
  }

  .toc a {
    min-height: 42px;
    display: flex;
    align-items: center;
  }

  .article section {
    padding-bottom: 44px;
  }

  .article section + section {
    padding-top: 44px;
  }

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

  .flow-node {
    min-height: 82px;
  }

  .flow-node:not(:last-child)::after {
    top: auto;
    right: 50%;
    bottom: -19px;
    content: "↓";
    transform: translateX(50%);
  }

  .state {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .site-footer .row {
    align-items: flex-start;
    flex-direction: column;
  }
}

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

@media print {
  .site-header,
  .toc,
  .hero-actions {
    display: none;
  }

  .guide-layout {
    display: block;
  }
}
