/* halyx.dev — site styles. Light and dark themes; the dark one follows the system unless the toggle chose. */

:root {
  --bg: #fafaf7;
  --bg-soft: #f1f0ea;
  --bg-elev: #ffffff;
  --bg-code: #f1f0ea;
  --border: #dcdad1;
  --border-strong: #b9b6aa;
  --text: #111111;
  --text-soft: #45443f;
  --text-faint: #6f6d65;
  --brand: #d4420a;
  --brand-strong: #a83405;
  --brand-soft: #fbe6dc;
  --accent: #111111;
  --ok: #15803d;
  --no: #b45309;
  --note: #2563eb;
  --tip: #15803d;
  --important: #7c3aed;
  --warning: #dc2626;
  --shadow: none;
  --shadow-lg: none;
  --radius: 2px;
  --header-h: 64px;
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* syntax */
  --hl-keyword: #a83405;
  --hl-string: #2f6b3a;
  --hl-comment: #8b897f;
  --hl-number: #7a4bb0;
  --hl-title: #111111;
  --hl-attr: #2c5c8a;
  --hl-meta: #8a6a00;
  --hl-tag: #a83405;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0e0d; --bg-soft: #161614; --bg-elev: #161614; --bg-code: #131312;
    --border: #2a2926; --border-strong: #46443e; --text: #f0efe9; --text-soft: #b5b3aa; --text-faint: #85837b;
    --brand: #ff6a2b; --brand-strong: #ff9061; --brand-soft: rgba(255, 106, 43, .12); --accent: #f0efe9;
    --ok: #4ade80; --no: #fbbf24; --note: #60a5fa; --tip: #4ade80; --important: #a78bfa; --warning: #f87171;
    --hl-keyword: #ff8a50; --hl-string: #9fd49a; --hl-comment: #7d7b73; --hl-number: #c4a5ff; --hl-title: #f0efe9;
    --hl-attr: #8fb8de; --hl-meta: #e0c068; --hl-tag: #ff8a50;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0e0d; --bg-soft: #161614; --bg-elev: #161614; --bg-code: #131312;
  --border: #2a2926; --border-strong: #46443e; --text: #f0efe9; --text-soft: #b5b3aa; --text-faint: #85837b;
  --brand: #ff6a2b; --brand-strong: #ff9061; --brand-soft: rgba(255, 106, 43, .12); --accent: #f0efe9;
  --ok: #4ade80; --no: #fbbf24; --note: #60a5fa; --tip: #4ade80; --important: #a78bfa; --warning: #f87171;
  --hl-keyword: #ff8a50; --hl-string: #9fd49a; --hl-comment: #7d7b73; --hl-number: #c4a5ff; --hl-title: #f0efe9;
  --hl-attr: #8fb8de; --hl-meta: #e0c068; --hl-tag: #ff8a50;
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 16px/1.65 var(--font);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img, svg { max-width: 100%; }
code, kbd, pre { font-family: var(--mono); font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
::selection { background: color-mix(in srgb, var(--brand) 30%, transparent); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--bg-elev); padding: 8px 14px; border-radius: 8px; }
.skip-link:focus { left: 16px; }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px; }
kbd {
  font-size: 11px; padding: 1px 6px; border-radius: var(--radius); border: 1px solid var(--border-strong);
  background: var(--bg-soft); color: var(--text-faint); font-weight: 500;
}

/* ------------------------------------------------------------------ header */

.site-header {
  position: sticky; top: 0; z-index: 50; height: var(--header-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.header-inner { height: 100%; max-width: 1440px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 28px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 650; font-size: 19px; letter-spacing: -.03em; }
.brand:hover { text-decoration: none; }
.logo-mark { flex: none; }
.header-nav { display: flex; gap: 4px; }
.header-nav a { color: var(--text-soft); font-size: 14.5px; font-weight: 500; padding: 6px 12px; border-radius: var(--radius); }
.header-nav a:hover { color: var(--text); background: var(--bg-soft); text-decoration: none; }
.header-nav a.active { color: var(--text); background: var(--bg-soft); box-shadow: inset 0 -2px var(--brand); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: var(--radius); border: 0;
  background: transparent; color: var(--text-soft); cursor: pointer;
}
.icon-btn:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.search-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 8px 0 12px; min-width: 220px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-soft); color: var(--text-faint);
  font: 14px var(--font); cursor: pointer; margin-right: 6px;
}
.search-btn:hover { border-color: var(--border-strong); color: var(--text-soft); }
.search-btn kbd { margin-left: auto; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
}
.nav-toggle { display: none; margin-left: -8px; }

@media (max-width: 1020px) {
  .header-nav { display: none; }
  .search-btn { min-width: 0; }
  .search-btn span, .search-btn kbd { display: none; }
  .search-btn { width: 38px; padding: 0; justify-content: center; border-color: transparent; background: transparent; margin: 0; }
  .page-docs .nav-toggle { display: inline-grid; }
}
@media (max-width: 640px) { .header-inner { gap: 12px; padding: 0 16px; } }

/* ------------------------------------------------------------------ buttons */

.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px;
  border-radius: var(--radius); font-weight: 500; font-size: 15px; border: 1px solid transparent; transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { text-decoration: none; }
.btn-lg { height: 50px; padding: 0 24px; font-size: 16px; }
.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { background: var(--brand); color: #fff; }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { border-color: var(--text-faint); color: var(--text); }

/* ------------------------------------------------------------------ front page */

.page-home main { overflow: hidden; }
.hero { position: relative; padding: 88px 0 56px; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 32px 32px; opacity: .6;
  mask-image: linear-gradient(#000 40%, transparent);
  -webkit-mask-image: linear-gradient(#000 40%, transparent);
}
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr); gap: 56px; align-items: center; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: var(--radius); font-size: 13.5px; font-weight: 500;
  color: var(--text-soft); border: 1px solid var(--border-strong); background: color-mix(in srgb, var(--bg-elev) 70%, transparent);
}
.pill:hover { text-decoration: none; color: var(--text); border-color: var(--brand); }
.pill-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px rgba(34, 197, 94, .18); }
.hero h1 { font-size: clamp(40px, 5.6vw, 68px); line-height: 1.02; letter-spacing: -.045em; margin: 22px 0 18px; font-weight: 600; }
.gradient-text { color: var(--brand); }
.lead { font-size: 18.5px; color: var(--text-soft); max-width: 600px; margin: 0; }
.lead strong { color: var(--text); font-weight: 600; }
.hero-facts { display: flex; flex-wrap: wrap; gap: 8px 22px; list-style: none; padding: 0; margin: 4px 0 0; color: var(--text-faint); font-size: 14px; }
.hero-facts li { display: flex; align-items: center; gap: 8px; }
.hero-facts li::before { content: ""; width: 16px; height: 16px; border-radius: 50%; background: var(--brand-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 8.2l2.2 2.2 4.8-4.8' fill='none' stroke='%23d4420a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/12px no-repeat; }
.hero-facts strong { color: var(--text-soft); font-weight: 600; }

.hero-code {
  min-width: 0; border-radius: var(--radius); background: #131312; border: 1px solid #2a2926;
  overflow: hidden;
  --hl-keyword: #ff8a50; --hl-string: #9fd49a; --hl-comment: #7d7b73; --hl-number: #c4a5ff; --hl-title: #f0efe9;
  --hl-attr: #8fb8de; --hl-meta: #e0c068; --hl-tag: #ff8a50;
}
.window-bar { display: flex; align-items: center; gap: 14px; padding: 0 14px; height: 46px; background: #0c0c0b; border-bottom: 1px solid #2a2926; }
.dots { display: none; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs button {
  font: 500 12.5px var(--mono); color: #85837b; background: none; border: 0; padding: 7px 11px; border-radius: var(--radius); cursor: pointer; white-space: nowrap;
}
.tabs button:hover { color: #d6d4cc; }
.tabs button[aria-selected="true"] { color: #f0efe9; background: #2a2926; box-shadow: inset 0 -2px #ff6a2b; }
.tab-panel pre, .code-card pre { margin: 0; padding: 20px 22px; overflow-x: auto; font-size: 12.6px; line-height: 1.7; color: #e4e2da; }
.tab-panel { height: 470px; overflow-y: auto; }
.panel-label { padding: 9px 22px; font: 500 12.5px var(--mono); color: #85837b; background: #0c0c0b; border-top: 1px solid #2a2926; border-bottom: 1px solid #2a2926; }
.tab-panel code, .code-card code { background: none; padding: 0; }

.stats { padding: 0; width: calc(100% - 48px); max-width: 1152px; display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 72px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); box-shadow: var(--shadow); }
.stats > div { padding: 22px 26px; display: flex; flex-direction: column; }
.stats > div + div { border-left: 1px solid var(--border); }
.stats strong { font: 500 34px/1.2 var(--mono); letter-spacing: -.03em; color: var(--text); }
.stats span { color: var(--text-soft); font-size: 14.5px; }

.section { padding: 96px 0; }
.section-alt { background: var(--bg-soft); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head { max-width: 760px; margin: 0 auto 48px; text-align: center; }
.section h2 { font-size: clamp(30px, 3.6vw, 42px); line-height: 1.12; letter-spacing: -.035em; margin: 8px 0 16px; font-weight: 600; }
.section-head p:not(.eyebrow), .split p { color: var(--text-soft); font-size: 17px; }
.eyebrow { margin: 0; color: var(--brand); font: 500 13.5px var(--mono); }
.eyebrow::before { content: "// "; }

.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.feature, .card {
  padding: 28px; border-radius: var(--radius); background: var(--bg-elev); border: 1px solid var(--border);
  transition: border-color .15s, background .15s;
}
.feature { border-width: 0 1px 1px 0; border-radius: 0; }
.feature:hover { background: var(--bg-soft); }
.card:hover { border-color: var(--text); }
.feature h3, .card h3 { margin: 16px 0 8px; font-size: 18px; letter-spacing: -.01em; }
.feature p, .card p { margin: 0; color: var(--text-soft); font-size: 15px; }
.feature-icon { width: 44px; height: 44px; border-radius: var(--radius); display: grid; place-items: center; border: 1px solid var(--border-strong); }
.feature-icon svg { width: 22px; height: 22px; fill: none; stroke: var(--brand); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.feature code, .split p code, .section-head code { font-size: .88em; background: var(--bg-code); border: 1px solid var(--border); padding: 1px 5px; border-radius: var(--radius); }

.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card { color: inherit; display: block; }
.card:hover { text-decoration: none; }
.card-tag { font: 500 12.5px var(--mono); color: var(--brand); background: var(--brand-soft); padding: 4px 9px; border-radius: var(--radius); }

.services-table table, .compare-table table { background: var(--bg-elev); }
.services-table td:first-child a { font-weight: 600; }
.note-line { text-align: center; color: var(--text-faint); font-size: 14.5px; margin-top: 18px; }
.cloud { display: inline-flex; align-items: center; gap: 7px; }
.cloud::before { content: ""; width: 9px; height: 9px; border-radius: 3px; }
.cloud.aws::before, .cloud-chip.aws::before { background: #ff9900; }
.cloud.azure::before, .cloud-chip.azure::before { background: #0078d4; }
.cloud.gcp::before, .cloud-chip.gcp::before { background: #34a853; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 64px; align-items: center; }
.split h2 { margin-top: 8px; }
.split-reverse > :first-child { order: 2; }
.checks { list-style: none; padding: 0; margin: 22px 0; display: grid; gap: 10px; }
.checks li { position: relative; padding-left: 30px; color: var(--text-soft); }
.checks li::before { content: "✓"; position: absolute; left: 0; top: 1px; width: 20px; height: 20px; border-radius: var(--radius); background: var(--brand-soft); color: var(--brand); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.text-link { font-weight: 600; }

.diagram { padding: 32px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-elev); box-shadow: var(--shadow); text-align: center; }
.diagram-app { display: inline-block; padding: 10px 22px; border-radius: var(--radius); border: 1px dashed var(--border-strong); font: 500 14px var(--mono); color: var(--text-soft); }
.diagram-line { width: 2px; height: 28px; margin: 0 auto; background: var(--border-strong); }
.diagram-api { padding: 20px; border-radius: var(--radius); background: var(--text); color: var(--bg); display: grid; gap: 8px; border-bottom: 3px solid var(--brand); }
.diagram-api strong { font-size: 20px; letter-spacing: -.01em; }
.diagram-api span { font: 12.5px/1.6 var(--mono); opacity: .92; }
.diagram-api em { font-style: normal; font-size: 13px; opacity: .85; }
.diagram-fan { display: grid; grid-template-columns: repeat(3, 1fr); height: 30px; }
.diagram-fan i { border-left: 2px solid var(--border-strong); margin-left: 50%; }
.diagram-clouds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.cloud-chip { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 8px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-soft); font-weight: 600; font-size: 14.5px; }
.cloud-chip::before { content: ""; width: 10px; height: 10px; border-radius: 3px; }
.diagram-extra { margin-top: 14px; color: var(--text-faint); font-size: 13.5px; }

.code-card { min-width: 0; border-radius: var(--radius); overflow: hidden; background: #131312; border: 1px solid #2a2926;
  --hl-keyword: #ff8a50; --hl-string: #9fd49a; --hl-comment: #7d7b73; --hl-number: #c4a5ff; --hl-title: #f0efe9; --hl-attr: #8fb8de; --hl-meta: #e0c068; --hl-tag: #ff8a50; }
.code-card-title { padding: 11px 18px; font: 500 12.5px var(--mono); color: #85837b; border-bottom: 1px solid #2a2926; background: #0c0c0b; }

.compare-table th[scope], .compare-table tbody th { text-align: left; font-weight: 600; color: var(--text); white-space: normal; min-width: 200px; }
.compare-table .hl { background: var(--brand-soft); font-weight: 600; }
.compare-table thead .hl { color: var(--brand); }
.compare-table .yes { color: var(--ok); }
.compare-table .no { color: var(--text-faint); }

.cta { text-align: center; position: relative; }
.cta-inner { max-width: 760px; }
.cta p { color: var(--text-soft); font-size: 17px; }
.cta .btn-row { justify-content: center; }
.cta-cmd { display: inline-block; margin: 12px auto 0; padding: 12px 20px; border-radius: var(--radius); background: var(--bg-code); border: 1px solid var(--border); font-size: 13.5px; max-width: 100%; overflow-x: auto; text-align: left; }
.cta-cmd .prompt { color: var(--brand); user-select: none; margin-right: 8px; }

.not-found { max-width: 640px; margin: 0 auto; padding: 120px 24px; text-align: center; }
.not-found h1 { font-size: 40px; letter-spacing: -.03em; margin: 8px 0 12px; }
.not-found p { color: var(--text-soft); }
.not-found .btn-row { justify-content: center; }

@media (max-width: 1020px) {
  .hero { padding-top: 56px; }
  .hero-grid, .split { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .split-reverse > :first-child { order: 0; }
  .feature-grid, .card-grid { grid-template-columns: 1fr 1fr; }
  .tab-panel { height: auto; max-height: 520px; }
}
@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .section { padding: 64px 0; }
  .feature-grid, .card-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 48px; width: calc(100% - 32px); padding: 0; }
  .stats strong { font-size: 28px; }
  .hero h1 { font-size: 38px; }
  .stats > div { padding: 16px 18px; }
  .stats > div:nth-child(3) { border-left: 0; }
  .stats > div:nth-child(n+3) { border-top: 1px solid var(--border); }
  .diagram { padding: 20px; }
  .lead { font-size: 17px; }
}

/* ------------------------------------------------------------------ docs layout */

.docs-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr) 240px; max-width: 1440px; margin: 0 auto; }
.sidebar { position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); border-right: 1px solid var(--border); }
.sidebar-inner { height: 100%; overflow-y: auto; padding: 28px 18px 40px 24px; scrollbar-width: thin; }
.sidebar-section + .sidebar-section { margin-top: 26px; }
.sidebar h5, .toc h5 { margin: 0 0 8px; font: 500 12px var(--mono); letter-spacing: .04em; text-transform: uppercase; color: var(--text-faint); }
.sidebar ul, .toc ul { list-style: none; margin: 0; padding: 0; }
.sidebar li a { display: block; padding: 6px 12px; border-radius: var(--radius); color: var(--text-soft); font-size: 14.5px; line-height: 1.4; }
.sidebar li a:hover { color: var(--text); background: var(--bg-soft); text-decoration: none; }
.sidebar li a.active { color: var(--brand); background: none; font-weight: 600; box-shadow: inset 2px 0 var(--brand); border-radius: 0; }
.sidebar li.nested a { margin-left: 12px; padding-left: 14px; border-left: 1px solid var(--border); border-radius: 0; font-size: 14px; }
.sidebar-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 20px; border-top: 1px solid var(--border); font-size: 13px; }
.sidebar-meta a { display: inline-flex; align-items: center; gap: 7px; color: var(--text-soft); }
.version { font: 500 11.5px var(--mono); color: var(--text-faint); background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 2px 7px; }
.sidebar-scrim { display: none; }

.doc-main { min-width: 0; padding: 32px 56px 64px; }
.breadcrumbs { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0 0 18px; font-size: 13.5px; color: var(--text-faint); }
.breadcrumbs li + li::before { content: "/"; margin-right: 6px; color: var(--border-strong); }
.breadcrumbs a { color: var(--text-faint); }
.breadcrumbs a:hover { color: var(--brand); }

.toc { position: sticky; top: var(--header-h); align-self: start; max-height: calc(100vh - var(--header-h)); overflow-y: auto; padding: 32px 24px 32px 8px; font-size: 13.5px; scrollbar-width: thin; }
.toc li a { display: block; padding: 4px 0 4px 12px; color: var(--text-faint); border-left: 1px solid var(--border); line-height: 1.45; }
.toc li.toc-h3 a { padding-left: 24px; font-size: 13px; }
.toc li a:hover { color: var(--text); text-decoration: none; }
.toc li a.active { color: var(--brand); border-left-color: var(--brand); font-weight: 500; }
.toc code { font-size: .92em; }
.toc-links { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); display: grid; gap: 8px; }
.toc-links a { color: var(--text-faint); display: inline-flex; align-items: center; gap: 6px; }
.toc-links a:hover { color: var(--brand); }

@media (max-width: 1240px) {
  .docs-layout { grid-template-columns: 260px minmax(0, 1fr); }
  .toc { display: none; }
  .doc-main { padding: 32px 40px 64px; }
}
@media (max-width: 1020px) {
  .docs-layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; top: var(--header-h); left: 0; bottom: 0; height: auto; width: min(320px, 86vw); z-index: 45;
    background: var(--bg); transform: translateX(-100%); transition: transform .22s ease; border-right: 1px solid var(--border);
  }
  .nav-open .sidebar { transform: none; }
  .nav-open .sidebar-scrim { display: block; position: fixed; inset: var(--header-h) 0 0; z-index: 44; background: rgba(10, 10, 9, .45); }
  .doc-main { padding: 24px 20px 56px; }
}
@media (max-width: 640px) { .doc-main { padding: 20px 16px 48px; } }

/* ------------------------------------------------------------------ doc content */

.doc-content { max-width: 820px; font-size: 16px; }
.doc-content > :first-child { margin-top: 0; }
.doc-content h1 { font-size: clamp(30px, 3.4vw, 42px); line-height: 1.12; letter-spacing: -.04em; margin: 0 0 16px; font-weight: 600; }
.doc-content h1 + p { font-size: 18px; color: var(--text-soft); }
.doc-content h2 { font-size: 26px; letter-spacing: -.02em; line-height: 1.25; margin: 56px 0 14px; padding-top: 24px; border-top: 1px solid var(--border); font-weight: 600; }
.doc-content h3 { font-size: 20px; letter-spacing: -.012em; margin: 36px 0 10px; font-weight: 650; }
.doc-content h4 { font-size: 16.5px; margin: 28px 0 8px; font-weight: 650; }
.doc-content h1, .doc-content h2, .doc-content h3, .doc-content h4 { position: relative; }
.anchor { margin-left: 8px; color: var(--text-faint); opacity: 0; font-weight: 400; transition: opacity .12s; }
:is(h2, h3, h4):hover > .anchor, .anchor:focus { opacity: 1; text-decoration: none; }
.doc-content p, .doc-content li { color: var(--text); }
.doc-content p { margin: 0 0 16px; }
.doc-content ul, .doc-content ol { padding-left: 24px; margin: 0 0 16px; }
.doc-content li { margin: 4px 0; }
.doc-content li > ul, .doc-content li > ol { margin: 4px 0; }
.doc-content li::marker { color: var(--text-faint); }
.doc-content strong { font-weight: 650; }
.doc-content hr { border: 0; border-top: 1px solid var(--border); margin: 40px 0; }
.doc-content a.external::after { content: "↗"; font-size: .78em; margin-left: 2px; vertical-align: 1px; opacity: .7; }
.doc-content blockquote { margin: 0 0 16px; padding: 4px 18px; border-left: 3px solid var(--border-strong); color: var(--text-soft); }
.doc-content :not(pre) > code {
  font-size: .86em; padding: .15em .4em; border-radius: var(--radius); background: var(--bg-code); border: 1px solid var(--border);
  color: var(--text); overflow-wrap: anywhere;
}
.doc-content a code { color: var(--brand); }
.doc-content :is(h1, h2, h3, h4) > code { font-size: .86em; background: none; border: 0; padding: 0; color: var(--brand); }
.doc-content dl { margin: 0 0 20px; display: grid; gap: 4px; }
.doc-content dt { font-weight: 650; margin-top: 12px; }
.doc-content dd { margin: 0; padding-left: 16px; border-left: 2px solid var(--brand-soft); color: var(--text-soft); }
.doc-content dd p { margin: 0; color: inherit; }
.doc-content .btn-row { margin: 8px 0 28px; }

.code-block { position: relative; margin: 0 0 20px; border-radius: var(--radius); background: var(--bg-code); border: 1px solid var(--border); }
.code-block pre { margin: 0; padding: 16px 18px; overflow-x: auto; font-size: 13.5px; line-height: 1.65; tab-size: 4; }
.code-block code { background: none; padding: 0; border: 0; }
.code-plain pre { line-height: 1.45; }
.code-lang { position: absolute; top: 8px; right: 12px; font: 500 11px var(--mono); color: var(--text-faint); letter-spacing: .03em; pointer-events: none; transition: opacity .12s; }
.copy-btn {
  position: absolute; top: 7px; right: 8px; padding: 4px 9px; border-radius: var(--radius); border: 1px solid var(--border-strong);
  background: var(--bg-elev); color: var(--text-soft); font: 500 12px var(--font); cursor: pointer; opacity: 0; transition: opacity .12s;
}
.code-block:hover .copy-btn, .copy-btn:focus { opacity: 1; }
.code-block:hover .code-lang { opacity: 0; }
.copy-btn.copied { color: var(--ok); border-color: var(--ok); }
@media (hover: none) { .copy-btn { opacity: 1; } .code-lang { display: none; } }

.table-wrap { overflow-x: auto; margin: 0 0 22px; border: 1px solid var(--border); border-radius: var(--radius); }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 14.5px; line-height: 1.5; }
.table-wrap th, .table-wrap td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.table-wrap thead th { background: var(--bg-soft); font-weight: 650; font-size: 13.5px; color: var(--text); white-space: nowrap; }
.table-wrap tbody tr:last-child > * { border-bottom: 0; }
.table-wrap tbody tr:hover { background: color-mix(in srgb, var(--bg-soft) 70%, transparent); }
.table-wrap thead th:empty { padding: 0; }

.doc-content details { margin: 0 0 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); }
.doc-content details > summary { cursor: pointer; padding: 11px 16px; font-weight: 600; font-size: 14.5px; list-style: none; display: flex; align-items: center; gap: 10px; }
.doc-content details > summary::-webkit-details-marker { display: none; }
.doc-content details > summary::before { content: "›"; font-size: 18px; line-height: 1; color: var(--text-faint); transition: transform .15s; }
.doc-content details[open] > summary::before { transform: rotate(90deg); }
.doc-content details[open] > summary { border-bottom: 1px solid var(--border); }
.doc-content details > :not(summary) { margin: 14px 16px; }
.doc-content details > .table-wrap { margin: 0; border: 0; border-radius: 0; }

.callout { margin: 0 0 20px; padding: 14px 18px; border-radius: var(--radius); border: 1px solid; border-left-width: 4px; }
.callout > :last-child { margin-bottom: 0; }
.callout-title { font: 500 12.5px var(--mono); letter-spacing: .04em; text-transform: uppercase; margin: 0 0 6px !important; }
.callout-note { border-color: color-mix(in srgb, var(--note) 35%, transparent); border-left-color: var(--note); background: color-mix(in srgb, var(--note) 7%, transparent); }
.callout-note .callout-title { color: var(--note); }
.callout-tip { border-color: color-mix(in srgb, var(--tip) 35%, transparent); border-left-color: var(--tip); background: color-mix(in srgb, var(--tip) 7%, transparent); }
.callout-tip .callout-title { color: var(--tip); }
.callout-important { border-color: color-mix(in srgb, var(--important) 35%, transparent); border-left-color: var(--important); background: color-mix(in srgb, var(--important) 7%, transparent); }
.callout-important .callout-title { color: var(--important); }
.callout-warning { border-color: color-mix(in srgb, var(--warning) 35%, transparent); border-left-color: var(--warning); background: color-mix(in srgb, var(--warning) 7%, transparent); }
.callout-warning .callout-title { color: var(--warning); }

.doc-meta { max-width: 820px; display: flex; flex-wrap: wrap; gap: 20px; margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--border); font-size: 14px; }
.doc-meta a { display: inline-flex; align-items: center; gap: 6px; color: var(--text-faint); }
.doc-meta a:hover { color: var(--brand); }
.pager { max-width: 820px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 28px; }
.pager a { display: flex; flex-direction: column; gap: 2px; padding: 16px 20px; border-radius: var(--radius); border: 1px solid var(--border); color: var(--text); transition: border-color .15s; }
.pager a:hover { border-color: var(--brand); text-decoration: none; }
.pager span { font-size: 13px; color: var(--text-faint); }
.pager strong { font-weight: 600; color: var(--brand); }
.pager-prev strong::before { content: "← "; }
.pager-next { text-align: right; grid-column: 2; }
.pager-next strong::after { content: " →"; }
@media (max-width: 640px) { .pager { grid-template-columns: 1fr; } .pager-next { grid-column: auto; } }

/* ------------------------------------------------------------------ blog */

/* Short blog pages (an empty or one-post index) keep the footer at the bottom of the window. */
body.page-blog { display: flex; flex-direction: column; min-height: 100vh; }
.blog-main { flex: 1 0 auto; width: 100%; max-width: 820px; margin: 0 auto; padding: 40px 24px 72px; }
.blog-head { margin-bottom: 40px; }
.blog-head h1 { font-size: clamp(32px, 4vw, 44px); line-height: 1.1; letter-spacing: -.04em; margin: 8px 0 12px; font-weight: 600; }
.blog-head p:not(.eyebrow) { color: var(--text-soft); font-size: 17px; margin: 0; }
.post-meta { margin: 0; font-size: 14px; color: var(--text-faint); }
.post-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.post-list a { display: block; padding: 22px 24px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-elev); color: var(--text); transition: border-color .15s; }
.post-list a:hover { border-color: var(--brand); text-decoration: none; }
.post-list h2 { margin: 6px 0 8px; font-size: 22px; line-height: 1.3; letter-spacing: -.025em; font-weight: 600; }
.post-list p:not(.post-meta) { margin: 0; color: var(--text-soft); font-size: 15px; }
.post-empty { color: var(--text-faint); }
.post-head { margin-bottom: 28px; }
.post-head h1 { margin-bottom: 10px; }
.blog-post img { display: block; height: auto; margin: 0 auto 20px; border-radius: var(--radius); }
@media (max-width: 640px) { .blog-main { padding: 28px 16px 56px; } .post-list a { padding: 18px; } }

/* ------------------------------------------------------------------ syntax highlighting */

.hljs { color: inherit; }
.hljs-keyword, .hljs-built_in, .hljs-type, .hljs-literal, .hljs-selector-tag { color: var(--hl-keyword); }
.hljs-string, .hljs-regexp, .hljs-addition, .hljs-symbol { color: var(--hl-string); }
.hljs-comment, .hljs-quote { color: var(--hl-comment); font-style: italic; }
.hljs-number, .hljs-variable, .hljs-template-variable { color: var(--hl-number); }
.hljs-title, .hljs-title.function_, .hljs-title.class_, .hljs-section { color: var(--hl-title); }
.hljs-attr, .hljs-attribute, .hljs-property, .hljs-params { color: var(--hl-attr); }
.hljs-meta, .hljs-meta .hljs-keyword { color: var(--hl-meta); }
.hljs-name, .hljs-tag, .hljs-bullet, .hljs-deletion { color: var(--hl-tag); }
.hljs-tag .hljs-attr { color: var(--hl-attr); }
.hljs-emphasis { font-style: italic; } .hljs-strong { font-weight: 700; }

/* ------------------------------------------------------------------ search */

.search-dialog { position: fixed; inset: 0; z-index: 100; }
.search-backdrop { position: absolute; inset: 0; background: rgba(10, 10, 9, .55); }
.search-panel {
  position: relative; max-width: 640px; margin: 10vh auto 0; background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 24px 64px rgba(0, 0, 0, .25); overflow: hidden; width: calc(100% - 32px);
}
.search-field { display: flex; align-items: center; gap: 12px; padding: 0 16px; border-bottom: 1px solid var(--border); color: var(--text-faint); }
.search-field input { flex: 1; height: 56px; border: 0; outline: 0; background: transparent; color: var(--text); font: 16px var(--font); }
.search-field input::-webkit-search-cancel-button { display: none; }
.search-field kbd { cursor: pointer; }
.search-results { list-style: none; margin: 0; padding: 8px; max-height: min(60vh, 520px); overflow-y: auto; }
.search-results:empty { display: none; }
.search-results li a { display: block; padding: 10px 12px; border-radius: var(--radius); color: var(--text); }
.search-results li a:hover { text-decoration: none; }
.search-results li.selected a { background: var(--brand-soft); }
.search-results .r-path { font-size: 12px; color: var(--text-faint); }
.search-results .r-title { font-weight: 600; font-size: 15px; }
.search-results .r-text { font-size: 13.5px; color: var(--text-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.search-results mark { background: color-mix(in srgb, var(--brand) 22%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.search-empty { padding: 28px; text-align: center; color: var(--text-faint); }
.search-foot { display: flex; gap: 18px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-faint); background: var(--bg-soft); }
.search-foot kbd { margin-right: 3px; }
@media (max-width: 640px) { .search-panel { margin-top: 12px; } .search-foot { display: none; } }

/* ------------------------------------------------------------------ footer */

.site-footer { border-top: 1px solid var(--border); background: var(--bg-soft); font-size: 14px; }
.footer-inner { max-width: 1200px; margin: 0 auto; padding: 56px 24px 40px; display: grid; grid-template-columns: 1.2fr 2fr; gap: 48px; }
.footer-brand p { color: var(--text-faint); max-width: 320px; margin: 14px 0 0; }
.footer-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.footer-cols h4 { margin: 0 0 12px; font: 500 12.5px var(--mono); text-transform: uppercase; letter-spacing: .04em; color: var(--text); }
.footer-cols a { display: block; color: var(--text-soft); padding: 4px 0; }
.footer-cols a:hover { color: var(--brand); }
.footer-bottom { max-width: 1200px; margin: 0 auto; padding: 20px 24px 32px; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; color: var(--text-faint); font-size: 13px; }
.footer-bottom a { color: var(--text-soft); }
@media (max-width: 820px) { .footer-inner { grid-template-columns: 1fr; gap: 32px; } }
@media (max-width: 520px) { .footer-cols { grid-template-columns: 1fr 1fr; } .footer-inner, .footer-bottom { padding-left: 16px; padding-right: 16px; } }

@media print {
  .site-header, .sidebar, .toc, .pager, .doc-meta, .site-footer, .copy-btn { display: none !important; }
  .docs-layout { display: block; }
  .doc-main { padding: 0; }
}

/* identifiers in tables wrap between words, never inside one */
.table-wrap :not(pre) > code { overflow-wrap: normal; white-space: nowrap; }
.doc-content hr + h2 { border-top: 0; padding-top: 0; margin-top: 0; }
