:root {
  color-scheme: light;
  --paper: #f7f5ef;
  --surface: #fffdf8;
  --ink: #17212b;
  --muted: #61707a;
  --line: #d9ddd9;
  --navy: #15334a;
  --navy-soft: #e9eff1;
  --orange: #df6038;
  --orange-soft: #f9e8df;
  --green: #2d745f;
  --code: #112530;
  --code-ink: #eaf1ef;
  --shadow: 0 14px 38px rgb(23 33 43 / 10%);
  --header-height: 68px;
  --sidebar-width: 276px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0e171d;
  --surface: #142129;
  --ink: #eaf0ee;
  --muted: #9eaeaf;
  --line: #2b3b43;
  --navy: #d6e9ee;
  --navy-soft: #1d3039;
  --orange: #f27d57;
  --orange-soft: #3c2924;
  --green: #67b99e;
  --code: #091218;
  --code-ink: #eaf1ef;
  --shadow: 0 18px 45px rgb(0 0 0 / 28%);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
}

button, input { font: inherit; }

a { color: var(--green); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--orange); }

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  transform: translateY(-160%);
}
.skip-link:focus { transform: none; }

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

.header-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 100%;
  padding: 0 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-weight: 760;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 9px;
  background: var(--navy);
  color: var(--paper);
  font: 700 15px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  box-shadow: 4px 4px 0 var(--orange);
}

.brand-version {
  color: var(--muted);
  font: 500 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.top-nav { display: flex; gap: 22px; margin-left: auto; }
.top-nav a { color: var(--muted); font-size: 14px; font-weight: 650; text-decoration: none; }
.top-nav a:hover { color: var(--ink); }

.header-actions { display: flex; align-items: center; gap: 8px; }

.icon-button, .search-button, .menu-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.search-button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 156px;
  padding: 0 10px 0 12px;
  color: var(--muted);
  font-size: 13px;
  text-align: left;
}

.search-button kbd {
  margin-left: auto;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--paper);
  font-size: 11px;
}

.icon-button, .menu-button { width: 40px; padding: 0; font-size: 17px; }
.menu-button { display: none; }

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: calc(100vh - var(--header-height));
}

.sidebar {
  position: sticky;
  top: var(--header-height);
  align-self: start;
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  border-right: 1px solid var(--line);
  padding: 30px 22px 42px 28px;
}

.sidebar-section { margin-bottom: 25px; }
.sidebar-label {
  margin: 0 0 8px 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
  text-decoration: none;
}
.sidebar a:hover { background: var(--navy-soft); color: var(--ink); }
.sidebar a.active { background: var(--navy-soft); color: var(--ink); font-weight: 700; }
.sidebar a.active::before { width: 5px; height: 5px; border-radius: 50%; background: var(--orange); content: ""; }

.sidebar-meta {
  margin: 34px 10px 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.content { min-width: 0; padding: 0 34px 90px; }

.doc-page {
  width: min(100%, 870px);
  margin: 0 auto;
  padding-top: 62px;
}
.doc-page[hidden] { display: none; }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 13px;
  color: var(--orange);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.eyebrow::before { width: 24px; height: 2px; background: currentColor; content: ""; }

h1, h2, h3 { color: var(--ink); line-height: 1.15; text-wrap: balance; }
h1 { margin: 0 0 18px; font-size: clamp(2.35rem, 5vw, 4.7rem); font-weight: 760; letter-spacing: -.055em; }
h2 { margin: 58px 0 16px; font-size: clamp(1.65rem, 3vw, 2.2rem); letter-spacing: -.035em; }
h3 { margin: 34px 0 10px; font-size: 1.22rem; letter-spacing: -.018em; }
p { margin: 0 0 18px; }
.lede { max-width: 700px; color: var(--muted); font-size: 1.18rem; line-height: 1.65; }

.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1.04fr .96fr;
  gap: 38px;
  align-items: center;
  width: min(100%, 1120px);
  padding-top: 74px;
}
.hero h1 { font-size: clamp(3rem, 6.4vw, 6.15rem); }
.hero-copy { position: relative; z-index: 1; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 11px; margin-top: 30px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
  text-decoration: none;
}
.button.primary { border-color: var(--navy); background: var(--navy); color: var(--paper); }
.button:hover { border-color: var(--orange); color: var(--orange); }
.button.primary:hover { background: var(--orange); color: #fff; }

.terminal {
  position: relative;
  overflow: hidden;
  border: 1px solid #28414e;
  border-radius: 17px;
  background: var(--code);
  color: var(--code-ink);
  box-shadow: var(--shadow);
  transform: rotate(.45deg);
}
.terminal-bar { display: flex; align-items: center; gap: 6px; height: 42px; padding: 0 15px; border-bottom: 1px solid #28414e; }
.terminal-dot { width: 8px; height: 8px; border-radius: 50%; background: #536e78; }
.terminal-dot:first-child { background: #e36c48; }
.terminal-title { margin-left: 7px; color: #8fa5aa; font: 500 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.terminal pre { margin: 0; padding: 23px 24px 28px; font-size: 13px; line-height: 1.75; }
.code-key { color: #82d1b5; }
.code-value { color: #ffc384; }
.code-comment { color: #799098; }

.feature-grid, .path-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 54px;
}
.feature-card, .path-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
}
.feature-card h2, .path-card h3 { margin: 0 0 8px; font-size: 1.08rem; }
.feature-card p, .path-card p { margin: 0; color: var(--muted); font-size: 14px; }
.card-kicker { display: block; margin-bottom: 9px; color: var(--orange); font: 700 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; text-transform: uppercase; }
.path-card { color: inherit; text-decoration: none; transition: border-color .15s, transform .15s; }
.path-card:hover { border-color: var(--orange); color: inherit; transform: translateY(-2px); }

.rule { height: 1px; margin: 48px 0; border: 0; background: var(--line); }

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 28px 0 42px;
  padding: 14px 0;
  border-block: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}
.doc-meta strong { color: var(--ink); }

.steps { margin: 30px 0; padding: 0; counter-reset: steps; list-style: none; }
.steps > li { position: relative; padding: 0 0 28px 52px; counter-increment: steps; }
.steps > li::before {
  position: absolute;
  top: -2px;
  left: 0;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--orange);
  font: 750 13px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  content: counter(steps);
}
.steps > li:not(:last-child)::after { position: absolute; top: 33px; bottom: 0; left: 16px; width: 1px; background: var(--line); content: ""; }
.steps h2, .steps h3 { margin-top: 0; }

.code-block { position: relative; margin: 20px 0 26px; }
pre {
  overflow-x: auto;
  margin: 0;
  border-radius: 12px;
  background: var(--code);
  color: var(--code-ink);
  font: 13px/1.7 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  tab-size: 2;
}
.code-block pre { padding: 20px 52px 20px 21px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
:not(pre) > code { padding: .13em .38em; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--ink); font-size: .88em; }
.copy-button {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 5px 8px;
  border: 1px solid #38515d;
  border-radius: 7px;
  background: #1b3440;
  color: #b9c7c7;
  cursor: pointer;
  font-size: 11px;
}

.callout {
  margin: 27px 0;
  padding: 18px 20px 18px 22px;
  border-left: 3px solid var(--orange);
  border-radius: 0 10px 10px 0;
  background: var(--orange-soft);
}
.callout strong { display: block; margin-bottom: 3px; }
.callout p:last-child { margin-bottom: 0; }
.callout.security { border-left-color: var(--green); background: var(--navy-soft); }

.checklist { padding-left: 1.2rem; }
.checklist li { margin-bottom: 8px; padding-left: 4px; }
.checklist li::marker { color: var(--orange); }

.reference-table { width: 100%; margin: 25px 0; border-collapse: collapse; font-size: 14px; }
.reference-table th, .reference-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.reference-table th { color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.reference-table td:first-child { width: 31%; color: var(--ink); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.signature { margin: 30px 0 12px; padding-top: 25px; border-top: 1px solid var(--line); }
.signature h3 { margin: 0 0 8px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1rem; }
.signature p { color: var(--muted); }

.next-page {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.next-page a { color: var(--ink); font-weight: 700; text-decoration: none; }
.next-page a:hover { color: var(--orange); }

.search-dialog {
  width: min(620px, calc(100vw - 28px));
  margin-top: 12vh;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.search-dialog::backdrop { background: rgb(10 20 26 / 50%); backdrop-filter: blur(3px); }
.search-input-wrap { display: flex; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.search-input-wrap input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 17px; }
.search-results { max-height: 430px; overflow-y: auto; padding: 8px; }
.search-result { display: block; padding: 11px 13px; border-radius: 9px; color: var(--ink); text-decoration: none; }
.search-result:hover, .search-result:focus { background: var(--navy-soft); color: var(--ink); outline: none; }
.search-result strong { display: block; }
.search-result span { color: var(--muted); font-size: 13px; }
.search-empty { padding: 28px; color: var(--muted); text-align: center; }
.search-help { padding: 9px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }

.page-footer { margin-top: 80px; color: var(--muted); font-size: 13px; }

@media (max-width: 980px) {
  .top-nav { display: none; }
  .header-actions { margin-left: auto; }
  .layout { display: block; }
  .sidebar { position: fixed; inset: var(--header-height) auto 0 0; z-index: 25; width: min(320px, 88vw); height: auto; background: var(--paper); transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .menu-button { display: inline-block; }
  .hero { grid-template-columns: 1fr; width: min(100%, 870px); }
  .terminal { transform: none; }
}

@media (max-width: 680px) {
  :root { --header-height: 60px; }
  .header-inner { gap: 10px; padding: 0 14px; }
  .brand-version, .search-button span, .search-button kbd { display: none; }
  .search-button { min-width: 40px; width: 40px; padding: 0; justify-content: center; }
  .content { padding: 0 18px 70px; }
  .doc-page { padding-top: 40px; }
  .hero { padding-top: 45px; }
  .hero h1 { font-size: clamp(2.8rem, 15vw, 4.3rem); }
  .feature-grid, .path-grid { grid-template-columns: 1fr; }
  .reference-table { display: block; overflow-x: auto; }
  .doc-meta { display: block; }
  .doc-meta span { display: block; margin: 4px 0; }
}

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