@font-face {
  font-family: Montserrat;
  src: url("./fonts/montserrat.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --canvas: light-dark(#f5f3ee, #18171c);
  --surface: light-dark(#fffefa, #222128);
  --subtle: light-dark(#eeebe3, #2b2932);
  --text: light-dark(#24212b, #f1eef8);
  --muted: light-dark(#5c5669, #bcb5cc);
  --line: light-dark(#d6d0df, #433e50);
  --strong-line: light-dark(#ada4ba, #7e748f);
  --accent: light-dark(#5e439c, #d0bbfd);
  --on-accent: light-dark(#fff, #241638);
  --accent-soft: light-dark(#ebe2fa, #3b2d52);
  --success: light-dark(#18543c, #a2e5c2);
  --success-bg: light-dark(#e6f1e6, #263930);
  --warning: light-dark(#684713, #f5ce88);
  --warning-bg: light-dark(#f7ecd6, #403321);
  --error: light-dark(#8a324e, #ffb4c7);
  --error-bg: light-dark(#f8e5eb, #432a36);
  --code-bg: #24222d;
  --code-line: #474353;
  --code-text: #f3ecff;
  --radius: 12px;
  --measure: 1120px;
  --gutter: clamp(16px, 4vw, 44px);
  --mono: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-family: Montserrat, system-ui, sans-serif;
  background: var(--canvas);
  color: var(--text);
  accent-color: var(--accent);
  caret-color: var(--accent);
  scrollbar-color: var(--strong-line) var(--canvas);
}

:root:has(#theme-light:checked) { color-scheme: light; }
:root:has(#theme-dark:checked) { color-scheme: dark; }
*, *::before, *::after { box-sizing: border-box; }
body { min-height: 100dvh; margin: 0; display: flex; flex-direction: column; }
a { color: var(--accent); text-underline-offset: .18em; }
button, input, select, textarea { font: inherit; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
h1, h2, p, figure, dl, dd { margin: 0; }
h1, h2 { letter-spacing: -.032em; text-wrap: balance; }
h2 { font-size: 1.35rem; }
code, pre { font-family: var(--mono); font-size: .93em; }
pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

.visually-hidden, .theme-control input {
  position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip-link { position: fixed; z-index: 3; inset: 8px auto auto 8px; padding: 12px; background: var(--surface); transform: translateY(-150%); }
.skip-link:focus { transform: none; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner, .site-main, .site-footer { width: min(100% - var(--gutter) * 2, var(--measure)); margin-inline: auto; }
.topbar-inner { min-height: 71px; display: flex; gap: clamp(12px, 3vw, 36px); align-items: center; }
.brand { display: inline-flex; align-items: center; gap: 10px; flex: none; color: var(--text); text-decoration: none; font-weight: 700; }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; color: var(--on-accent); background: var(--accent); }
.topnav { align-self: stretch; display: flex; align-items: center; gap: 4px; flex: 1; }
.topnav a, .site-footer a { color: var(--muted); text-decoration: none; }
.topnav a { min-height: 44px; display: inline-flex; align-items: center; border-radius: 8px; padding: 0 11px; font-size: .82rem; font-weight: 600; white-space: nowrap; }
.topnav a:hover { background: var(--subtle); color: var(--text); }
.topnav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.theme-control { border: 1px solid var(--line); border-radius: 8px; padding: 3px; margin: 0; display: flex; gap: 2px; flex: none; }
.theme-control label { position: relative; cursor: pointer; }
.theme-control span { display: grid; place-items: center; min-height: 36px; padding: 0 8px; border-radius: 5px; color: var(--muted); font-size: .75rem; font-weight: 600; }
.theme-control input:checked + span { background: var(--subtle); color: var(--text); }
.theme-control input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.site-main { padding-block: clamp(32px, 6vw, 76px) clamp(48px, 8vw, 100px); flex: 1; }
.site-footer { display: flex; justify-content: space-between; padding-block: 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }
.site-footer a:hover { color: var(--accent); }

.start-intro { display: grid; align-items: center; grid-template-columns: 1.2fr minmax(0, 1fr); gap: clamp(26px, 7vw, 90px); padding-block: 20px 40px; }
.start-intro h1 { font-size: clamp(3rem, 7vw, 5.7rem); line-height: .99; font-weight: 700; }
.lede { max-width: 67ch; font-size: clamp(.98rem, 1.7vw, 1.15rem); color: var(--muted); line-height: 1.65; }
.start-copy .lede { max-width: 46ch; margin-block: 24px 26px; }
.action-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.command-panel { min-width: 0; border: 1px solid var(--code-line); border-radius: var(--radius); background: var(--code-bg); color: var(--code-text); }
.command-panel figcaption { padding: 17px 22px; border-bottom: 1px solid var(--code-line); font-size: .86rem; font-weight: 600; }
.command-panel pre { padding: clamp(26px, 4vw, 46px) 22px; color: #e0cfff; font-size: clamp(.91rem, 1.55vw, 1.03rem); line-height: 1.65; }
.command-result { display: flex; gap: 10px; padding: 15px 22px; align-items: center; border-top: 1px solid var(--code-line); color: #d7cde3; font-size: .88rem; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #9ad9b9; flex: none; }
.start-path { border-top: 1px solid var(--line); padding-top: 25px; }
.flow-list { margin-top: 19px; }
.flow-list > div, .request-values > div { display: grid; grid-template-columns: minmax(132px, .35fr) 1.65fr; gap: 16px; border-top: 1px solid var(--line); padding-block: 15px; }
.flow-list dd, .request-values dt { color: var(--muted); }

.kit-layout { display: grid; grid-template-columns: 178px minmax(0, 1fr); gap: clamp(20px, 4vw, 54px); }
.kit-index { align-self: start; position: sticky; top: 24px; }
.kit-index nav { display: flex; flex-direction: column; gap: 5px; border-inline-end: 1px solid var(--line); padding-inline-end: 15px; }
.kit-index a { display: flex; align-items: center; min-height: 42px; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--muted); white-space: nowrap; font-size: .85rem; font-weight: 600; }
.kit-index a:hover { background: var(--accent-soft); color: var(--accent); }
.kit-heading { margin-bottom: clamp(25px, 5vw, 52px); }
.kit-heading h1, .reading h1 { font-size: clamp(2.35rem, 5.5vw, 4.25rem); line-height: 1.04; }
.kit-heading .lede, .reading .lede { margin-top: 15px; }
.kit-section { margin-top: clamp(26px, 5vw, 55px); scroll-margin: 22px; }
.section-heading { margin-bottom: 12px; }
.section-heading p, .reading-section p { margin-top: 6px; color: var(--muted); line-height: 1.55; font-size: .91rem; }
.sample { padding: clamp(16px, 3vw, 23px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.source { margin-top: 17px; border-top: 1px solid var(--line); padding-top: 12px; }
summary { cursor: pointer; font-weight: 600; }
.source summary { color: var(--accent); font-size: .85rem; }
.source pre { margin-top: 12px; padding: 12px; color: var(--code-text); background: var(--code-bg); border-radius: 8px; line-height: 1.6; }
.demo-form { display: grid; gap: 18px; max-width: 680px; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 12px; }
.check-group { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 0; font-size: .88rem; }
.check-group legend { padding-inline: 4px; color: var(--muted); }
.check-group label { display: flex; align-items: center; gap: 8px; min-height: 32px; }
.check-group input { width: 16px; height: 16px; }
.state-sample { display: grid; gap: 19px; }
.worker-plan { display: flex; align-items: stretch; flex-wrap: wrap; gap: 20px 28px; }
.worker-controls { display: flex; align-items: end; flex-wrap: wrap; gap: 12px 20px; flex: 1 1 260px; min-width: 0; }
.stepper { display: flex; align-items: center; gap: 8px; min-width: 0; margin: 0; padding: 0; border: 0; }
.stepper legend { margin-bottom: 6px; padding: 0; font-size: .88rem; font-weight: 600; }
.stepper button { width: 44px; padding: 0; font-size: 1.1rem; }
.stepper output { min-width: 3ch; text-align: center; font-variant-numeric: tabular-nums; }
.worker-estimate { flex: 1 0 140px; display: grid; align-content: center; gap: 4px; padding: 11px 14px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); }
.worker-estimate span { font-size: .84rem; font-weight: 600; }
.worker-estimate output { font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.detail-list { padding-block: 8px; }
.detail-list details + details { border-top: 1px solid var(--line); }
.detail-list summary { min-height: 44px; padding-block: 11px; }
.detail-list p { padding-bottom: 12px; color: var(--muted); }
.animated-detail { border-top: 1px solid var(--line); }
.detail-toggle { display: flex; align-items: center; gap: .47em; width: 100%; min-height: 44px; padding: 8px 0; border: 0; border-radius: 4px; background: transparent; color: var(--text); text-align: start; font-weight: 600; cursor: pointer; }
.detail-toggle:hover { color: var(--accent); }
.detail-toggle:disabled { color: var(--muted); cursor: default; }
.detail-toggle::before { content: ""; width: 0; height: 0; flex: none; border-block: .24em solid transparent; border-inline-start: .34em solid currentColor; }
.detail-toggle[aria-expanded="true"]::before { transform: rotate(90deg); }
.table-sample { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: start; font-size: .88rem; }
caption { font-weight: 600; text-align: start; padding-bottom: 12px; }
th, td { padding: 12px 8px; border-top: 1px solid var(--line); text-align: start; }
thead th { color: var(--muted); }
th code { font-weight: 400; }

.dr-button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; border-radius: 8px; padding: 8px 14px; border: 1px solid var(--strong-line); background: var(--surface); color: var(--text); text-decoration: none; font-size: .88rem; font-weight: 600; cursor: pointer; transition: background-color 130ms ease; }
.dr-button:hover { background: var(--subtle); }
.dr-button.primary { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.dr-button.primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--text)); }
.dr-button:disabled { color: var(--muted); background: var(--subtle); border-color: var(--line); cursor: default; }
.dr-field { display: grid; gap: 6px; font-size: .88rem; font-weight: 600; }
.dr-field input, .dr-field select { width: 100%; min-height: 44px; padding: 9px 11px; border: 1px solid var(--strong-line); border-radius: 8px; color: var(--text); background: var(--surface); font-weight: 400; }
.dr-field input::placeholder { color: var(--muted); }
.dr-badge { display: inline-flex; align-items: center; border-radius: 999px; font-size: .75rem; font-weight: 600; padding: 5px 9px; color: var(--text); background: var(--subtle); white-space: nowrap; }
.dr-notice { display: grid; gap: 5px; padding: 13px 14px; border-radius: 8px; color: var(--text); background: var(--subtle); }
.dr-notice div { font-size: .9rem; }
.dr-badge.success, .dr-notice.success { color: var(--success); background: var(--success-bg); }
.dr-badge.warning, .dr-notice.warning { color: var(--warning); background: var(--warning-bg); }
.dr-badge.error, .dr-notice.error { color: var(--error); background: var(--error-bg); }

.reading { max-width: 760px; }
.reading > .dr-button { margin-top: 24px; }
.reading-section { margin-top: 30px; border-top: 1px solid var(--line); padding-top: 20px; }
.reading-section form, .request-values { margin-top: 18px; }
.request-values dd { overflow-wrap: anywhere; }

@media (max-width: 780px) {
  .topbar-inner { min-height: auto; padding-block: 10px 7px; flex-wrap: wrap; justify-content: space-between; column-gap: 10px; row-gap: 3px; }
  .topnav { order: 3; flex: 0 1 100%; }
  .topnav a { padding-inline: 9px; }
  .kit-layout { grid-template-columns: minmax(0, 1fr); gap: 26px; }
  .kit-index { position: static; min-width: 0; overflow-x: auto; }
  .kit-index nav { flex-direction: row; width: max-content; min-width: 100%; border-inline: 0; border-bottom: 1px solid var(--line); padding: 0 1px 5px; }
  .kit-index a { padding-inline: 8px; }
  .start-intro { grid-template-columns: minmax(0, 1fr); padding-top: 0; }
}
@media (max-width: 490px) {
  .form-grid, .flow-list > div, .request-values > div { grid-template-columns: minmax(0, 1fr); gap: 5px; }
  .table-sample { padding-inline: 12px; }
  th, td { padding-inline: 4px; }
}
@media (prefers-reduced-motion: reduce) { .dr-button { transition: none; } }
