/* ==========================================================================
   KEYCAP: a flat 2D cartoon UI kit
   --------------------------------------------------------------------------
   The look in one paragraph:
   Flat fills, one thick ink stroke (3px) around everything, and hard offset
   shadows that fall DOWN and to the RIGHT. Interactive things are raised keys:
   they sit up-and-left of their resting spot with a colored side wall joined by
   a diagonal edge. Pressing one slides it down-right into its spot (the wall
   disappears); letting go springs it back out. Never use gradients, blur
   shadows or rounded corners. Orange is the only accent.

   Files:  kit.css (this)  ·  kit.js (behavior)  ·  starter.html (template)
   Docs:   index.html
   ========================================================================== */

/* Self-hosted Latin subsets (kit/fonts/*.woff2). System fallbacks in --f-* apply if these fail. */
@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url("fonts/bricolage-latin-0.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/instrument-latin-0.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "DM Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/dmmono-latin-0.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "DM Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/dmmono-latin-1.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* The press animation animates this one number: 1 = raised, 0 = pressed. */
@property --p { syntax: "<number>"; inherits: true; initial-value: 1; }

/* ---------- 1. Tokens ---------------------------------------------------- */
:root {
  /* type */
  --f-display: "Bricolage Grotesque", "Helvetica Neue", system-ui, sans-serif;
  --f-body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "DM Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* surfaces + text (these flip in dark mode) */
  --c-bg: #ECEEF1;
  --c-surface: #FFFFFF;
  --c-surface-2: #F4F5F7;
  --c-ink: #0C0F14;        /* text AND every stroke */
  --c-ink-2: #3A414C;      /* secondary text */
  --c-ink-3: #566070;      /* placeholders, quiet text */
  --c-line: #C9CED6;       /* thin dividers inside surfaces */
  --c-grid: rgba(12, 15, 20, .13);   /* the dot grid on the page */
  --c-inset: rgba(12, 15, 20, .12);  /* recessed-field shading */
  --c-shadow: #0C0F14;     /* hard offset shadows */
  --c-focus: #2F5BFF;
  --c-stroke: #0C0F14;     /* every 3px edge (= ink in light, softer chalk in dark) */
  --c-band: #0C0F14;       /* inverted bars: panel header, table head, ticker, toast */
  --c-on-band: #ECEEF1;
  --c-hi: rgba(255, 255, 255, .45);  /* top-left face highlight on keys */

  /* accent (does not flip) */
  --c-accent: #FF5B2E;
  --c-accent-side: #B8340F;  /* the key's side wall */
  --c-accent-text: #C23A12;  /* orange text on light surfaces */
  --c-on-accent: #0C0F14;    /* text on orange */

  /* secondary key colors */
  --c-dark: #343B46;
  --c-dark-side: #1A1F26;
  --c-on-dark: #ECEEF1;
  --c-paper: #FFFFFF;
  --c-paper-side: #B4BBC7;
  --c-key2: #343B46;        /* the strong secondary key (btn--ink) */
  --c-key2-side: #1A1F26;
  --c-on-key2: #ECEEF1;
  --c-dark-bar: #343B46;    /* dark bars in charts */

  /* status (bright fills; text on them is always --c-on-status) */
  --c-good: #4ADE9A;
  --c-warn: #F5B700;
  --c-bad: #FF7A7A;
  --c-bad-side: #A62B2B;
  --c-info: #8EC5FF;
  --c-on-status: #0C0F14;
  --c-error-text: #B3261E;

  /* shape + space */
  --stroke: 3px;
  --lift: 10px;          /* how far a raised key sits up-and-left */
  --gutter: 16px;
  --max: 1200px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --c-bg: #161A21; --c-surface: #1F252E; --c-surface-2: #282F3A;
    --c-ink: #EDEFF3; --c-ink-2: #B9C0CC; --c-ink-3: #9AA3B0; --c-line: #364050;
    --c-stroke: #BCC4D0; --c-band: #0B0E13; --c-on-band: #EDEFF3; --c-hi: rgba(255, 255, 255, .16);
    --c-grid: rgba(237, 239, 243, .07); --c-inset: rgba(0, 0, 0, .38);
    --c-shadow: #040507; --c-focus: #8FB0FF;
    --c-accent-text: #FF8A66; --c-error-text: #FF9A9A;
    --c-dark: #262D38; --c-dark-side: #05070A; --c-on-dark: #E3E7EE; --c-dark-bar: #48515F;
    --c-paper: #424B5A; --c-paper-side: #262D37;
    --c-key2: #E6E9EF; --c-key2-side: #8B95A5; --c-on-key2: #0C0F14;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --c-bg: #161A21; --c-surface: #1F252E; --c-surface-2: #282F3A;
  --c-ink: #EDEFF3; --c-ink-2: #B9C0CC; --c-ink-3: #9AA3B0; --c-line: #364050;
  --c-stroke: #BCC4D0; --c-band: #0B0E13; --c-on-band: #EDEFF3; --c-hi: rgba(255, 255, 255, .16);
  --c-grid: rgba(237, 239, 243, .07); --c-inset: rgba(0, 0, 0, .38);
  --c-shadow: #040507; --c-focus: #8FB0FF;
  --c-accent-text: #FF8A66; --c-error-text: #FF9A9A;
  --c-dark: #262D38; --c-dark-side: #05070A; --c-on-dark: #E3E7EE; --c-dark-bar: #48515F;
  --c-paper: #424B5A; --c-paper-side: #262D37;
  --c-key2: #E6E9EF; --c-key2-side: #8B95A5; --c-on-key2: #0C0F14;
  color-scheme: dark;
}

/* ---------- 2. Base ------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html {
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--c-bg);
  background-image: radial-gradient(var(--c-grid) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--c-ink);
  font: 400 16px/1.55 var(--f-body);
  overflow-x: clip;
}
h1, h2, h3, h4 { margin: 0; font-family: var(--f-display); text-wrap: balance; }
p { margin: 0; }
a:not([class]) { color: var(--c-accent-text); text-underline-offset: 3px; text-decoration-thickness: 2px; }
a:not([class]):hover { color: var(--c-ink); }
img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 3px; }
::selection { background: var(--c-accent); color: var(--c-on-accent); }
[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- 3. Type ------------------------------------------------------ */
.t-display { font: 800 clamp(48px, 8vw, 104px)/.94 var(--f-display); letter-spacing: -.045em; }
.t-h1 { font: 800 clamp(36px, 5vw, 64px)/.98 var(--f-display); letter-spacing: -.04em; }
.t-h2 { font: 800 clamp(28px, 3.6vw, 44px)/1.02 var(--f-display); letter-spacing: -.035em; }
.t-h3 { font: 700 24px/1.15 var(--f-display); letter-spacing: -.02em; }
.t-lead { font-size: 20px; line-height: 1.5; color: var(--c-ink-2); max-width: 60ch; }
.t-small { font-size: 14px; line-height: 1.5; }
.t-label {
  font: 500 12px/1.3 var(--f-mono); letter-spacing: .1em; text-transform: uppercase;
  color: var(--c-ink-2);
}
.t-mono { font-family: var(--f-mono); }
.muted { color: var(--c-ink-2); }
.accent-text { color: var(--c-accent-text); }
.num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; text-align: right; }
.nowrap { white-space: nowrap; }
/* A highlighted word, like the headline on the landing page. */
.mark {
  display: inline-block; padding: 0 .14em .04em; transform: rotate(-2deg);
  background: var(--c-accent); color: var(--c-on-accent);
  box-shadow: .06em .06em 0 var(--c-shadow);
}
.kbd {
  display: inline-block; padding: 1px 7px; border: 2px solid var(--c-stroke);
  background: var(--c-surface); box-shadow: 2px 2px 0 var(--c-shadow);
  font: 500 13px/1.4 var(--f-mono);
}
.rule { border: 0; border-top: var(--stroke) solid var(--c-stroke); margin: 0; }
.rule--dashed { border-top-style: dashed; }

/* ---------- 4. Layout ---------------------------------------------------- */
.wrap {
  width: 100%; max-width: var(--max); margin-inline: auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}
.section { padding-block: clamp(40px, 7vw, 96px); }
.section--ink { background: var(--c-band); color: var(--c-on-band); }
.stack { display: flex; flex-direction: column; gap: var(--gap, 16px); min-width: 0; }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, 12px); }
.cluster--between { justify-content: space-between; }
.cluster--start { align-items: flex-start; }
.grid {
  display: grid; gap: var(--gap, 24px);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--min, 260px)), 1fr));
}
.split { display: flex; flex-wrap: wrap; gap: var(--gap, 32px); align-items: flex-start; }
.split > * { flex: 1 1 var(--basis, 320px); min-width: 0; }
.split--stretch { align-items: stretch; }   /* equal-height columns */

/* ---------- 5. Button: the raised key ------------------------------------
   <button class="btn">Label</button>
   Variants: btn--ink  btn--paper  btn--danger     Sizes: btn--sm  btn--lg
   Shapes:   btn--icon  btn--block                  Latch: aria-pressed="true"
   The element reserves room up-and-left for its raised position (margin).   */
.btn {
  --u: 1px;                       /* one unit of lift; btn--sm halves it */
  --face: var(--c-accent); --side: var(--c-accent-side);
  --txt: var(--c-on-accent);  --ring: var(--c-stroke);
  --p: 1;                         /* 1 = raised, 0 = pressed in */
  --o: calc(var(--p) * var(--u));
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .55em;
  min-height: 48px; padding: 0 24px; margin: 10px 3px 3px 10px;
  border: 0; border-radius: 0; background: var(--face); color: var(--txt);
  font: 700 17px/1 var(--f-body); text-decoration: none; white-space: nowrap; cursor: pointer;
  -webkit-tap-highlight-color: transparent; user-select: none; touch-action: manipulation;
  transform: translate(calc(var(--o) * -10), calc(var(--o) * -10));
  box-shadow:
    0 0 0 3px var(--ring),
    calc(var(--o) * 1) calc(var(--o) * 1) 0 0 var(--side),
    calc(var(--o) * 2) calc(var(--o) * 2) 0 0 var(--side),
    calc(var(--o) * 3) calc(var(--o) * 3) 0 0 var(--side),
    calc(var(--o) * 4) calc(var(--o) * 4) 0 0 var(--side),
    calc(var(--o) * 5) calc(var(--o) * 5) 0 0 var(--side),
    calc(var(--o) * 6) calc(var(--o) * 6) 0 0 var(--side),
    calc(var(--o) * 7) calc(var(--o) * 7) 0 0 var(--side),
    calc(var(--o) * 8) calc(var(--o) * 8) 0 0 var(--side),
    calc(var(--o) * 9) calc(var(--o) * 9) 0 0 var(--side),
    calc(var(--o) * 10) calc(var(--o) * 10) 0 0 var(--side),
    calc(var(--o) * 1) calc(var(--o) * 1) 0 3px var(--ring),
    calc(var(--o) * 2) calc(var(--o) * 2) 0 3px var(--ring),
    calc(var(--o) * 3) calc(var(--o) * 3) 0 3px var(--ring),
    calc(var(--o) * 4) calc(var(--o) * 4) 0 3px var(--ring),
    calc(var(--o) * 5) calc(var(--o) * 5) 0 3px var(--ring),
    calc(var(--o) * 6) calc(var(--o) * 6) 0 3px var(--ring),
    calc(var(--o) * 7) calc(var(--o) * 7) 0 3px var(--ring),
    calc(var(--o) * 8) calc(var(--o) * 8) 0 3px var(--ring),
    calc(var(--o) * 9) calc(var(--o) * 9) 0 3px var(--ring),
    calc(var(--o) * 10) calc(var(--o) * 10) 0 3px var(--ring),
    inset calc(var(--p) * 3px) calc(var(--p) * 3px) 0 var(--c-hi),
    inset calc((1 - min(var(--p), 1)) * -4px) calc((1 - min(var(--p), 1)) * -4px) 0 rgba(0, 0, 0, .22);
  transition: --p .26s cubic-bezier(.3, 1.8, .5, 1);
}
/* the diagonal edge joining the front bottom-right corner to the back corner */
.btn::after {
  content: ""; position: absolute; left: calc(100% + 1.5px); top: calc(100% + 1.5px);
  height: 3px; margin-top: -1.5px; width: calc(var(--o) * 14.142);
  background: var(--ring); transform-origin: 0 50%; transform: rotate(45deg); pointer-events: none;
}
.btn:hover { --p: 1.35; }
.btn:active,
.btn[aria-pressed="true"],
.btn[aria-selected="true"] { --p: 0; transition-duration: .06s; }
.btn[aria-pressed="true"],
.btn[aria-selected="true"] { --face: var(--c-accent); --side: var(--c-accent-side); --txt: var(--c-on-accent); }
.btn:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 7px; }

.btn--ink   { --face: var(--c-key2);  --side: var(--c-key2-side);  --txt: var(--c-on-key2); }
.btn--paper { --face: var(--c-paper); --side: var(--c-paper-side); --txt: var(--c-ink); }
.btn--danger { --face: var(--c-bad); --side: var(--c-bad-side); --txt: var(--c-on-status); }
.btn--sm { --u: .5px; min-height: 44px; padding: 0 14px; margin: 5px 3px 3px 5px; font-size: 15px; }
.btn--lg { min-height: 58px; padding: 0 32px; font-size: 19px; }
.btn--icon { padding: 0; width: 48px; }
.btn--icon.btn--sm { width: 44px; }
.btn--block { display: flex; width: calc(100% - 13px); }
.btn--block.btn--sm { width: calc(100% - 8px); }
.btn:disabled,
.btn[aria-disabled="true"] {
  --p: 0; --face: var(--c-line); --side: var(--c-line); --txt: var(--c-ink-2);
  cursor: not-allowed; opacity: .75;
}
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } }

/* ---------- 6. Surfaces -------------------------------------------------- */
.panel {
  position: relative; min-width: 0; background: var(--c-surface); color: var(--c-ink);
  border: var(--stroke) solid var(--c-stroke); box-shadow: 8px 8px 0 var(--c-shadow);
}
.panel--accent { background: var(--c-accent); color: var(--c-on-accent); }
.panel--dark { background: var(--c-dark); color: var(--c-on-dark); }
.panel--flat { box-shadow: none; }
.panel--big { box-shadow: 12px 12px 0 var(--c-shadow); }
.panel__bar {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px;
  padding: 10px 20px; background: var(--c-band); color: var(--c-on-band);
  font: 500 12px/1.3 var(--f-mono); letter-spacing: .1em; text-transform: uppercase;
}
.panel__body { padding: 20px; }
.panel--tight > .panel__body { padding: 14px; }
/* a whole card that is a link: lifts on hover, drops in on press */
.panel--link { display: block; color: inherit; text-decoration: none; transition: transform .12s ease-out, box-shadow .12s ease-out; }
.panel--link:hover { transform: translate(-3px, -3px); box-shadow: 11px 11px 0 var(--c-shadow); }
.panel--link:active { transform: translate(5px, 5px); box-shadow: 3px 3px 0 var(--c-shadow); transition-duration: .05s; }

.stat { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 18px 20px; }

/* checklist: <ul class="ticks"><li>Included</li><li class="is-off">Not included</li></ul>
   Included and not-included differ by glyph as well as color. */
.ticks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ticks li { display: flex; gap: 12px; align-items: flex-start; }
.ticks li::before {
  content: ""; flex: none; width: 12px; height: 6px; margin: 5px 2px 0;
  border-left: 4px solid currentColor; border-bottom: 4px solid currentColor; transform: rotate(-45deg);
}
.ticks li.is-off { color: var(--c-ink-3); }
.ticks li.is-off::before { height: 0; margin-top: 10px; border-left: 0; transform: none; }
.stat__value { font: 800 44px/1 var(--f-display); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }

.note {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px;
  border: var(--stroke) solid var(--c-stroke); background: var(--c-info); color: var(--c-on-status);
  box-shadow: 5px 5px 0 var(--c-shadow);
}
.note--good { background: var(--c-good); }
.note--warn { background: var(--c-warn); }
.note--bad  { background: var(--c-bad); }

.avatar {
  display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px;
  border: var(--stroke) solid var(--c-stroke); background: var(--c-accent); color: var(--c-on-accent);
  box-shadow: 3px 3px 0 var(--c-shadow); font: 800 15px/1 var(--f-display);
}

/* ---------- 7. Status: tags, stamps, meters ------------------------------
   Status never relies on color alone: each tag has its own little shape.    */
.tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px;
  border: 2px solid var(--c-stroke); background: var(--c-surface-2); color: var(--c-ink);
  font: 500 12px/1.3 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap;
}
.tag--good { background: var(--c-good); color: var(--c-on-status); }
.tag--warn { background: var(--c-warn); color: var(--c-on-status); }
.tag--bad  { background: var(--c-bad);  color: var(--c-on-status); }
.tag--info { background: var(--c-info); color: var(--c-on-status); }
.tag--accent { background: var(--c-accent); color: var(--c-on-accent); }
.tag--good::before, .tag--warn::before, .tag--bad::before, .tag--info::before {
  content: ""; width: 8px; height: 8px; background: currentColor; flex: none;
}
.tag--good::before { border-radius: 50%; }
.tag--warn::before { width: 10px; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.tag--bad::before  { transform: rotate(45deg); }
.tag--info::before { background: none; border: 2px solid currentColor; border-radius: 50%; }

.stamp {
  display: inline-block; padding: 4px 16px; transform: rotate(-4deg);
  border: var(--stroke) solid var(--c-stroke); background: var(--c-warn); color: var(--c-on-status);
  font: 800 26px/1.1 var(--f-display); letter-spacing: .06em; text-transform: uppercase;
  box-shadow: 4px 4px 0 var(--c-shadow);
}
.stamp--good { background: var(--c-good); }
.stamp--bad  { background: var(--c-bad); }

.meter {
  height: 20px; border: var(--stroke) solid var(--c-stroke); background: var(--c-surface-2);
  box-shadow: inset 3px 3px 0 var(--c-inset);
}
.meter__fill {
  display: block; height: 100%; width: var(--v, 50%); background: var(--fill, var(--c-accent));
  border-right: var(--stroke) solid var(--c-stroke);
}
.meter--good { --fill: var(--c-good); }
.meter--warn { --fill: var(--c-warn); }
.meter--bad  { --fill: var(--c-bad); }

/* ---------- 8. Forms ----------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field__label { font: 500 12px/1.3 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--c-ink-2); }
.field__hint { font-size: 14px; color: var(--c-ink-2); }
.field--error .field__hint { color: var(--c-error-text); font-weight: 600; }
.field--error .input, .field--error .select, .field--error .textarea { border-color: var(--c-bad); }

.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 11px 14px; border: var(--stroke) solid var(--c-stroke); border-radius: 0;
  background: var(--c-surface-2); color: var(--c-ink); font: 500 16px/1.4 var(--f-body);
  box-shadow: inset 3px 3px 0 var(--c-inset);
}
.input::placeholder, .textarea::placeholder { color: var(--c-ink-3); opacity: 1; }
.textarea { min-height: 110px; resize: vertical; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 3px; }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 44px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--c-ink) 50%), linear-gradient(135deg, var(--c-ink) 50%, transparent 50%);
  background-position: calc(100% - 23px) 52%, calc(100% - 17px) 52%;
  background-size: 6px 6px, 6px 6px; background-repeat: no-repeat;
}

/* checkbox + radio: a recessed square that fills orange when checked.
   <label class="check"><input type="checkbox"><span class="check__box"></span><span>Label</span></label> */
.check, .switch { position: relative; display: inline-flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; font-weight: 600; }
.check input, .switch input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.check__box {
  flex: none; display: grid; place-items: center; width: 28px; height: 28px;
  border: var(--stroke) solid var(--c-stroke); background: var(--c-surface-2); box-shadow: inset 3px 3px 0 var(--c-inset);
}
.check input:checked + .check__box { background: var(--c-accent); box-shadow: inset 3px 3px 0 rgba(0, 0, 0, .25); }
.check input:checked + .check__box::after {
  content: ""; width: 12px; height: 6px; margin-top: -2px;
  border-left: 4px solid var(--c-on-accent); border-bottom: 4px solid var(--c-on-accent); transform: rotate(-45deg);
}
.check--radio .check__box { border-radius: 50%; }
.check--radio input:checked + .check__box::after {
  width: 10px; height: 10px; margin: 0; border: 0; border-radius: 50%; background: var(--c-on-accent); transform: none;
}
.check input:focus-visible + .check__box,
.switch input:focus-visible + .switch__track { outline: 3px solid var(--c-focus); outline-offset: 3px; }
.check input:disabled + .check__box,
.switch input:disabled + .switch__track { opacity: .5; }

/* switch: a little key that slides in a recessed slot
   <label class="switch"><input type="checkbox" role="switch"><span class="switch__track"><span class="switch__key"></span></span><span>Label</span></label> */
.switch__track {
  position: relative; flex: none; width: 62px; height: 34px;
  border: var(--stroke) solid var(--c-stroke); background: var(--c-surface-2); box-shadow: inset 3px 3px 0 var(--c-inset);
}
.switch__key {
  position: absolute; top: 3px; left: 3px; width: 22px; height: 22px;
  background: var(--c-paper); border: var(--stroke) solid var(--c-stroke); box-shadow: 3px 3px 0 var(--c-paper-side);
  transition: transform .2s cubic-bezier(.3, 1.6, .5, 1);
}
.switch input:checked + .switch__track { background: var(--c-accent); }
.switch input:checked + .switch__track .switch__key { transform: translateX(28px); box-shadow: 3px 3px 0 var(--c-accent-side); }

.range { -webkit-appearance: none; appearance: none; width: 100%; height: 36px; background: transparent; cursor: pointer; margin: 0; }
.range::-webkit-slider-runnable-track { height: 14px; border: var(--stroke) solid var(--c-stroke); background: var(--c-surface-2); box-shadow: inset 3px 3px 0 var(--c-inset); }
.range::-moz-range-track { height: 8px; border: var(--stroke) solid var(--c-stroke); background: var(--c-surface-2); }
.range::-webkit-slider-thumb {
  -webkit-appearance: none; box-sizing: border-box; width: 26px; height: 30px; margin-top: -10px;
  border: var(--stroke) solid var(--c-stroke); border-radius: 0; background: var(--c-accent); box-shadow: 4px 4px 0 var(--c-accent-side);
}
.range::-moz-range-thumb {
  box-sizing: border-box; width: 26px; height: 30px; border: var(--stroke) solid var(--c-stroke); border-radius: 0;
  background: var(--c-accent); box-shadow: 4px 4px 0 var(--c-accent-side);
}

/* ---------- 9. Navigation ------------------------------------------------ */
.nav { background: var(--c-surface); border-bottom: var(--stroke) solid var(--c-stroke); }
.nav__in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 24px; padding-block: 8px; }
.nav__links { display: flex; flex-wrap: wrap; gap: 0 6px; }
.nav__link {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px;
  border-bottom: 4px solid transparent; color: inherit; font-weight: 600; text-decoration: none;
}
.nav__link:hover { border-color: var(--c-ink); }
@media (max-width: 640px) {
  /* brand + theme key on one row, links scroll sideways on their own row */
  .nav__in > .nav__links { order: 3; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .nav__in > .nav__links::-webkit-scrollbar { display: none; }
  .nav__in > .nav__links .nav__link { white-space: nowrap; }
}
.nav__link[aria-current="page"] { border-color: var(--c-accent); }
.brand {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px; color: inherit; text-decoration: none;
  font: 800 24px/1 var(--f-display); letter-spacing: -.03em;
}
.brand__light { font-weight: 500; }
.logo { display: inline-block; width: 35px; height: 46px; flex: none; }
.logo svg { display: block; width: 100%; height: 100%; }
.logo .ink { stroke: var(--c-stroke); }
.logo .hot { stroke: var(--c-accent); }

.tabs { display: flex; flex-wrap: wrap; gap: 6px 10px; }

.acc { border-top: var(--stroke) solid var(--c-stroke); }
.acc:last-of-type { border-bottom: var(--stroke) solid var(--c-stroke); }
.acc summary {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 44px;
  padding: 20px 0; list-style: none; cursor: pointer; font: 700 22px/1.2 var(--f-display); letter-spacing: -.02em;
}
.acc summary::-webkit-details-marker { display: none; }
.acc summary::after { content: "+"; flex: none; font: 500 30px/1 var(--f-mono); }
.acc[open] summary::after { content: "\2013"; }
.acc__body { padding: 0 0 20px; max-width: 62ch; color: var(--c-ink-2); font-size: 18px; }

/* ---------- 10. Data ----------------------------------------------------- */
.table-wrap { overflow-x: auto; background: var(--c-surface); color: var(--c-ink); border: var(--stroke) solid var(--c-stroke); box-shadow: 8px 8px 0 var(--c-shadow); }
.table { width: 100%; min-width: 560px; border-collapse: collapse; }
.table th {
  padding: 12px 16px; background: var(--c-band); color: var(--c-on-band); text-align: left; white-space: nowrap;
  font: 500 12px/1.3 var(--f-mono); letter-spacing: .1em; text-transform: uppercase;
}
.table td { padding: 12px 16px; border-top: 2px solid var(--c-line); vertical-align: middle; }
.table tbody tr:first-child td { border-top: 0; }
.table tbody tr:hover td { background: var(--c-surface-2); }

/* SVG chart parts: draw charts with these so they follow the theme */
.viz-bar { fill: var(--c-accent); stroke: var(--c-stroke); stroke-width: 3; }
.viz-bar--dark { fill: var(--c-dark-bar); }
.viz-line { fill: none; stroke: var(--c-stroke); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.viz-axis { stroke: var(--c-stroke); stroke-width: 3; }
.viz-grid { stroke: var(--c-line); stroke-width: 2; stroke-dasharray: 4 6; }
.viz-dot { fill: var(--c-surface); stroke: var(--c-stroke); stroke-width: 3; }
.viz-label { fill: var(--c-ink-2); font: 500 12px var(--f-mono); }

.ticker { overflow: hidden; background: var(--c-band); color: var(--c-on-band); border-block: var(--stroke) solid var(--c-stroke); }
.ticker__track { display: flex; width: max-content; animation: kit-ticker 40s linear infinite; }
.ticker__track > span { padding: 16px 14px; white-space: nowrap; font: 500 15px/1 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; }
@keyframes kit-ticker { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .ticker__track { animation: none; } }

/* ---------- 11. Overlays ------------------------------------------------- */
.dialog {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; overflow: auto;
  border: var(--stroke) solid var(--c-stroke); background: var(--c-surface); color: var(--c-ink); box-shadow: 10px 10px 0 var(--c-shadow);
}
.dialog::backdrop { background: rgba(12, 15, 20, .6); }

.toasts {
  position: fixed; left: 0; right: 0; bottom: max(16px, env(safe-area-inset-bottom, 0px)); z-index: 50;
  display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 0 16px; pointer-events: none;
}
.toast {
  pointer-events: auto; max-width: 420px; padding: 12px 18px; font-weight: 600;
  background: var(--c-band); color: var(--c-on-band); border: var(--stroke) solid var(--c-stroke);
  box-shadow: 6px 6px 0 var(--c-accent); animation: kit-pop .28s cubic-bezier(.3, 1.6, .5, 1);
}
.toast[data-tone="good"] { box-shadow: 6px 6px 0 var(--c-good); }
.toast[data-tone="bad"] { box-shadow: 6px 6px 0 var(--c-bad); }
@keyframes kit-pop { from { transform: translateY(14px) scale(.96); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* ---------- 12. Docs helpers (used by index.html) ------------------------ */
.code {
  margin: 0; padding: 16px 18px; overflow-x: auto; background: var(--c-dark); color: var(--c-on-dark);
  border: var(--stroke) solid var(--c-stroke); font: 400 13px/1.65 var(--f-mono); tab-size: 2; white-space: pre;
}
