/*!
 * Sumi.css v1.0.0
 * A minimalist, classless-first CSS framework.
 * Write semantic HTML; reach for a class only when you need one.
 * MIT License
 */

/* ==========================================================================
   1. Design tokens
   Override any of these on :root (or on any element) to theme Sumi.
   ========================================================================== */

:root,
[data-theme="light"] {
  --s-font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --s-font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --s-font-serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, "Iowan Old Style", Georgia, serif;
  --s-font-body: var(--s-font-sans);
  --s-font-heading: var(--s-font-body);
  --s-font-size: 100%;         /* base size; scales fluidly up to 106.25% on wide screens */
  --s-line-height: 1.6;
  --s-heading-weight: 700;
  --s-measure: 68ch;           /* comfortable line length for .prose */
  --s-flow: 1.25rem;           /* space after paragraphs, lists, quotes */

  /* Fluid type scale: ratio 1.2 on phones, 1.28 on desktop */
  --s-text-display: clamp(2.986rem, 2.433rem + 2.456vw, 4.398rem);
  --s-text-h1: clamp(2.074rem, 1.835rem + 1.061vw, 2.684rem);
  --s-text-h2: clamp(1.728rem, 1.584rem + .6417vw, 2.097rem);
  --s-text-h3: clamp(1.44rem, 1.363rem + .3443vw, 1.638rem);
  --s-text-h4: clamp(1.2rem, 1.169rem + .1391vw, 1.28rem);
  --s-text-lead: clamp(1.125rem, 1.076rem + .2174vw, 1.25rem);

  --s-space: 1rem;
  --s-gutter: clamp(1rem, 4vw, 2rem);
  --s-container: 72rem;
  --s-narrow: 44rem;
  --s-radius: .5rem;
  --s-transition: .15s ease;

  --s-bg: #ffffff;
  --s-surface: #f6f7f9;
  --s-card: #ffffff;
  --s-card-section: #f8f9fb;
  --s-text: #1b1f24;
  --s-muted: #5d6673;
  --s-border: #e2e5ea;
  --s-border-strong: #c9ced6;

  --s-primary: #2f5bea;
  --s-on-primary: #ffffff;
  --s-secondary: #5d6673;
  --s-on-secondary: #ffffff;
  --s-contrast: #1b1f24;
  --s-on-contrast: #ffffff;
  --s-success: #1a7f4b;
  --s-warning: #a35f00;
  --s-danger: #c62b39;

  --s-code-bg: #f1f3f6;
  --s-mark-bg: #fff1a6;
  --s-mark-text: #1b1f24;
  --s-mix: #000000; /* what hover states mix toward */
  --s-focus: color-mix(in srgb, var(--s-primary) 30%, transparent);
  --s-shadow: 0 1px 2px rgb(16 24 40 / .04), 0 4px 16px rgb(16 24 40 / .06);
  --s-shadow-lg: 0 12px 40px rgb(16 24 40 / .18);

  color-scheme: light;
}

:root[data-theme="dark"],
[data-theme="dark"] {
  --s-bg: #0f1216;
  --s-surface: #161a20;
  --s-card: #161a20;
  --s-card-section: #1b2027;
  --s-text: #e5e8ec;
  --s-muted: #9aa3af;
  --s-border: #272d36;
  --s-border-strong: #39414c;

  --s-primary: #7593f8;
  --s-on-primary: #0b0e13;
  --s-secondary: #9aa3af;
  --s-on-secondary: #0b0e13;
  --s-contrast: #e5e8ec;
  --s-on-contrast: #0f1216;
  --s-success: #45c085;
  --s-warning: #e3a43c;
  --s-danger: #f0707b;

  --s-code-bg: #1c2128;
  --s-mark-bg: #5c4d00;
  --s-mark-text: #fff6c8;
  --s-mix: #ffffff;
  --s-focus: color-mix(in srgb, var(--s-primary) 35%, transparent);
  --s-shadow: 0 1px 2px rgb(0 0 0 / .3), 0 4px 16px rgb(0 0 0 / .25);
  --s-shadow-lg: 0 12px 40px rgb(0 0 0 / .55);

  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --s-bg: #0f1216;
    --s-surface: #161a20;
    --s-card: #161a20;
    --s-card-section: #1b2027;
    --s-text: #e5e8ec;
    --s-muted: #9aa3af;
    --s-border: #272d36;
    --s-border-strong: #39414c;

    --s-primary: #7593f8;
    --s-on-primary: #0b0e13;
    --s-secondary: #9aa3af;
    --s-on-secondary: #0b0e13;
    --s-contrast: #e5e8ec;
    --s-on-contrast: #0f1216;
    --s-success: #45c085;
    --s-warning: #e3a43c;
    --s-danger: #f0707b;

    --s-code-bg: #1c2128;
    --s-mark-bg: #5c4d00;
    --s-mark-text: #fff6c8;
    --s-mix: #ffffff;
    --s-focus: color-mix(in srgb, var(--s-primary) 35%, transparent);
  --s-focus: color-mix(in srgb, var(--s-primary) 35%, transparent);
    --s-shadow: 0 1px 2px rgb(0 0 0 / .3), 0 4px 16px rgb(0 0 0 / .25);
    --s-shadow-lg: 0 12px 40px rgb(0 0 0 / .55);

    color-scheme: dark;
  }
}

/* ==========================================================================
   2. Base & reset
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  tab-size: 4;
  font-family: var(--s-font-body);
  /* 16px on phones, easing up to 17px on wide screens; respects user zoom */
  font-size: clamp(var(--s-font-size), calc(var(--s-font-size) * .925 + .2vw), calc(var(--s-font-size) * 1.0625));
  line-height: var(--s-line-height);
  color: var(--s-text);
  background: var(--s-bg);
  font-kerning: normal;
  font-optical-sizing: auto;
  font-variant-ligatures: common-ligatures contextual;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection { background: color-mix(in srgb, var(--s-primary) 28%, transparent); }

body { margin: 0; min-height: 100vh; background: var(--s-bg); color: var(--s-text); }

[data-theme]:not(:root) { color: var(--s-text); background-color: var(--s-bg); }

:focus-visible { outline: 2px solid var(--s-primary); outline-offset: 2px; }

[hidden] { display: none !important; }

/* ==========================================================================
   3. Page layout (classless)
   body > header / main / footer are centred automatically.
   ========================================================================== */

:where(body > header, body > main, body > footer, .container) {
  width: min(100% - 2 * var(--s-gutter), var(--s-container));
  margin-inline: auto;
}

.container-fluid { width: auto; padding-inline: var(--s-gutter); }
.narrow { max-width: var(--s-narrow); margin-inline: auto; }
body > .narrow { width: min(100% - 2 * var(--s-gutter), var(--s-narrow)); }

:where(body > header) { padding-block: 1.25rem; }
:where(body > main) { padding-block: 2rem 3rem; }
:where(body > footer) {
  padding-block: 2rem;
  border-top: 1px solid var(--s-border);
  color: var(--s-muted);
  font-size: .9rem;
}

:where(section) { margin-bottom: 3rem; }

/* ==========================================================================
   4. Typography
   ========================================================================== */

/* Vertical rhythm: text blocks share one spacing value (--s-flow) */
:where(p, ul, ol, dl, blockquote, pre, figure, address) { margin: 0 0 var(--s-flow); }
:where(table, form, fieldset, details, hr) { margin: 0 0 var(--s-space); }

/* Headings: tighter leading and tracking as size grows,
   more space above than below so each heading binds to its own text */
:where(h1, h2, h3, h4, h5, h6) {
  margin: 0 0 .5em;
  font-family: var(--s-font-heading);
  font-weight: var(--s-heading-weight);
  color: var(--s-text);
  text-wrap: balance;
  font-variant-numeric: lining-nums;
}
:where(h1) { font-size: var(--s-text-h1); line-height: 1.1;  letter-spacing: -.028em; }
:where(h2) { font-size: var(--s-text-h2); line-height: 1.15; letter-spacing: -.022em; margin-top: 2.4em; margin-bottom: .45em; }
:where(h3) { font-size: var(--s-text-h3); line-height: 1.25; letter-spacing: -.016em; margin-top: 2em; }
:where(h4) { font-size: var(--s-text-h4); line-height: 1.3;  letter-spacing: -.01em;  margin-top: 1.9em; }
:where(h5) { font-size: 1rem;  line-height: 1.4; letter-spacing: -.005em; margin-top: 1.75em; }
:where(h6) {
  font-size: .8125rem;
  line-height: 1.4;
  font-weight: 650;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--s-muted);
  margin-top: 2em;
}
:where(h1, h2, h3, h4, h5, h6):first-child,
:where(h1, h2, h3, h4, h5, h6) + :where(h1, h2, h3, h4, h5, h6) { margin-top: 0; }
:where(h1, h2, h3, h4, h5, h6) :where(a) { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 30%, transparent); }
:where(h1, h2, h3, h4, h5, h6)[id], :target { scroll-margin-top: 1.5rem; }

/* Display headline for heroes: <h1 class="display"> */
.display { font-size: var(--s-text-display); line-height: 1.02; letter-spacing: -.04em; font-weight: 800; }

/* Lead paragraph: <p class="lead"> */
.lead { font-size: var(--s-text-lead); line-height: 1.5; letter-spacing: -.005em; }

:where(p) { text-wrap: pretty; }

/* hgroup: heading + subtitle */
:where(hgroup) { margin-bottom: var(--s-flow); }
:where(hgroup) > * { margin-block: 0; }
:where(hgroup) > :where(p) { margin-top: .4rem; color: var(--s-muted); font-size: 1.0625em; line-height: 1.45; }
:where(hgroup) > :where(h6) + * { margin-top: .5rem; }

:where(a) {
  color: var(--s-primary);
  text-decoration: underline;
  text-decoration-thickness: from-font;
  text-underline-offset: .18em;
  text-decoration-skip-ink: auto;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  transition: color var(--s-transition), text-decoration-color var(--s-transition);
}
:where(a):hover { text-decoration-color: currentColor; }

:where(b, strong) { font-weight: 650; }
:where(h1, h2, h3, h4, h5, h6) :where(b, strong) { font-weight: inherit; }
:where(em, i, cite) { font-style: italic; }
:where(small) { font-size: .875em; }
:where(mark) { padding: .05em .2em; border-radius: .2em; background: var(--s-mark-bg); color: var(--s-mark-text); -webkit-box-decoration-break: clone; box-decoration-break: clone; }
:where(abbr[title]) { text-decoration: underline dotted color-mix(in srgb, currentColor 50%, transparent); text-underline-offset: .2em; cursor: help; }
:where(ins) { color: var(--s-success); text-decoration: none; }
:where(del) { color: var(--s-danger); }
:where(sub, sup) { font-size: .72em; line-height: 0; position: relative; vertical-align: baseline; }
:where(sub) { bottom: -.25em; }
:where(sup) { top: -.5em; }
:where(table, time, data, output) { font-variant-numeric: tabular-nums; }

/* Lists */
:where(ul, ol) { padding-left: 1.5em; }
:where(li) + :where(li) { margin-top: .35em; }
:where(li) > :where(ul, ol) { margin: .35em 0 0; }
:where(li)::marker { color: var(--s-muted); }
:where(ol) > :where(li)::marker { font-variant-numeric: tabular-nums; font-weight: 600; }
:where(dl) > :where(dt) { font-weight: 650; }
:where(dl) > :where(dt):not(:first-child) { margin-top: .75em; }
:where(dd) { margin: .15em 0 0; color: var(--s-muted); }

/* Quotes */
:where(blockquote) {
  margin-inline: 0;
  padding: .1rem 0 .1rem 1.25rem;
  border-left: 3px solid var(--s-primary);
  font-size: 1.125rem;
  line-height: 1.55;
  letter-spacing: -.005em;
  hanging-punctuation: first last;
}
:where(blockquote) > :last-child { margin-bottom: 0; }
:where(blockquote) :where(footer, cite) { display: block; margin-top: .6rem; color: var(--s-muted); font-size: .875rem; font-style: normal; letter-spacing: 0; }
:where(blockquote) :where(footer)::before { content: "\2014\2009"; }
:where(q) { hanging-punctuation: first last; }

:where(hr) { height: 0; border: 0; border-top: 1px solid var(--s-border); margin-block: 2.5rem; color: inherit; }

/* Code */
:where(code, kbd, samp, pre) { font-family: var(--s-font-mono); font-size: .875em; font-variant-ligatures: none; }
:where(code, samp) { padding: .12em .38em; border-radius: .3em; background: var(--s-code-bg); -webkit-box-decoration-break: clone; box-decoration-break: clone; }
:where(kbd) {
  padding: .1em .45em;
  border: 1px solid var(--s-border-strong);
  border-bottom-width: 2px;
  border-radius: .3em;
  background: var(--s-surface);
  font-size: .8em;
}
:where(pre) {
  overflow-x: auto;
  padding: 1rem 1.25rem;
  border-radius: var(--s-radius);
  background: var(--s-code-bg);
  line-height: 1.6;
  tab-size: 2;
}
:where(pre) > :where(code) { padding: 0; background: none; font-size: 1em; }

:where(img, svg, video, canvas, audio, iframe) { vertical-align: middle; }
:where(img, video) { max-width: 100%; height: auto; }
:where(figure) { margin-inline: 0; }
:where(figcaption) { margin-top: .6rem; color: var(--s-muted); font-size: .875rem; line-height: 1.45; }

/* Serif reading mode: <body class="serif"> or on any element */
.serif {
  --s-font-body: var(--s-font-serif);
  --s-font-heading: var(--s-font-serif);
  font-family: var(--s-font-serif);
}
.serif :where(h1, h2, h3) { letter-spacing: -.012em; }
.serif :where(blockquote) { font-style: italic; }

/* Long-form text: <article class="prose"> or <div class="prose"> */
.prose { max-width: var(--s-measure); font-size: 1.0625rem; line-height: 1.7; }
.prose :where(p, li, dd, blockquote) { hyphens: auto; -webkit-hyphens: auto; hyphenate-limit-chars: 6 3 3; }
.prose :where(h2) { margin-top: 2em; }
.prose :where(figure, pre, table) { margin-block: 1.75rem; }
.prose :where(img) { border-radius: var(--s-radius); }
article.prose { padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none; } /* a long-form article is not a card */

/* ==========================================================================
   5. Tables
   ========================================================================== */

:where(table) { width: 100%; border-collapse: collapse; border-spacing: 0; font-variant-numeric: tabular-nums; }
:where(th, td) { padding: .625rem .75rem; border-bottom: 1px solid var(--s-border); text-align: start; vertical-align: top; }
:where(thead th, thead td) { font-weight: 600; border-bottom: 2px solid var(--s-border-strong); }
:where(tfoot th, tfoot td) { font-weight: 600; border-top: 2px solid var(--s-border-strong); border-bottom: 0; }
:where(caption) { padding-bottom: .5rem; color: var(--s-muted); font-size: .875rem; text-align: start; }
table.striped tbody tr:nth-child(odd) { background: var(--s-surface); }

/* ==========================================================================
   6. Buttons
   Variants: .secondary .contrast .outline   Sizes: .small .large
   ========================================================================== */

:where(button, [type="button"], [type="submit"], [type="reset"], [role="button"]) {
  --s-btn: var(--s-primary);
  --s-btn-on: var(--s-on-primary);
  --s-btn-hover: color-mix(in srgb, var(--s-btn) 85%, var(--s-mix));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  margin: 0;
  padding: .625rem 1.125rem;
  font: inherit;
  font-weight: 600;
  line-height: 1.25;
  color: var(--s-btn-on);
  background: var(--s-btn);
  border: 1px solid var(--s-btn);
  border-radius: var(--s-radius);
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  -webkit-appearance: none;
  appearance: none;
  transition: background-color var(--s-transition), border-color var(--s-transition), color var(--s-transition), box-shadow var(--s-transition);
}
:where(button, [type="button"], [type="submit"], [type="reset"], [role="button"]):hover {
  background: var(--s-btn-hover);
  border-color: var(--s-btn-hover);
}
:where(button, [type="button"], [type="submit"], [type="reset"], [role="button"]):active { transform: translateY(1px); }

.secondary { --s-btn: var(--s-secondary); --s-btn-on: var(--s-on-secondary); }
.contrast { --s-btn: var(--s-contrast); --s-btn-on: var(--s-on-contrast); --s-btn-hover: color-mix(in srgb, var(--s-contrast) 82%, var(--s-bg)); }
:is(button, [type="button"], [type="submit"], [type="reset"], [role="button"]).outline {
  color: var(--s-btn);
  background: transparent;
  border-color: color-mix(in srgb, var(--s-btn) 55%, transparent);
}
:is(button, [type="button"], [type="submit"], [type="reset"], [role="button"]).outline:hover {
  background: color-mix(in srgb, var(--s-btn) 10%, transparent);
  border-color: var(--s-btn);
}
:is(button, [role="button"]).small { padding: .4rem .8rem; font-size: .875rem; }
:is(button, [role="button"]).large { padding: .8rem 1.5rem; font-size: 1.1rem; }

:where(button, [type="button"], [type="submit"], [type="reset"], [role="button"]):is(:disabled, [aria-disabled="true"]) {
  opacity: .5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Button / input group */
[role="group"] { display: inline-flex; vertical-align: middle; margin-bottom: var(--s-space); }
[role="group"] > * { margin: 0 !important; border-radius: 0; }
[role="group"] > * + * { margin-left: -1px !important; }
[role="group"] > :first-child { border-radius: var(--s-radius) 0 0 var(--s-radius); }
[role="group"] > :last-child { border-radius: 0 var(--s-radius) var(--s-radius) 0; }
[role="group"] > :focus-visible { position: relative; z-index: 1; }
[role="group"]:has(input, select) { display: flex; }
[role="group"] > :is(input, select) { flex: 1; min-width: 0; }

/* ==========================================================================
   7. Forms
   ========================================================================== */

:where(label, legend) { display: block; margin-bottom: .375rem; font-weight: 500; }

:where(input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="color"], [type="submit"], [type="button"], [type="reset"], [type="image"], [type="hidden"]), select, textarea) {
  display: block;
  width: 100%;
  margin: 0 0 var(--s-space);
  padding: .625rem .875rem;
  font: inherit;
  font-weight: 400;
  line-height: 1.25;
  color: var(--s-text);
  background-color: var(--s-bg);
  border: 1px solid var(--s-border-strong);
  border-radius: var(--s-radius);
  outline: 2px solid transparent;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color var(--s-transition), box-shadow var(--s-transition);
}
:where(label) > :where(input, select, textarea) { margin-top: .375rem; }
:where(textarea) { min-height: 6.5rem; line-height: 1.5; resize: vertical; }
::placeholder { color: var(--s-muted); opacity: .8; }

:where(input, select, textarea):focus {
  border-color: var(--s-primary);
  box-shadow: 0 0 0 3px var(--s-focus);
  outline: 2px solid transparent;
}
:where(input, select, textarea):disabled { opacity: .55; cursor: not-allowed; background-color: var(--s-surface); }
:where(input, textarea)[readonly] { background-color: var(--s-surface); }

[type="search"] { border-radius: 999px; padding-inline: 1.125rem; }

/* select chevron drawn with gradients so it follows the theme */
:where(select:not([multiple], [size])) {
  padding-right: 2.5rem;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--s-muted) 50%),
    linear-gradient(135deg, var(--s-muted) 50%, transparent 50%);
  background-position: calc(100% - 1.15rem) 52%, calc(100% - .8rem) 52%;
  background-size: .35rem .35rem;
  background-repeat: no-repeat;
  cursor: pointer;
}
:where(select[multiple], select[size]) { padding: .375rem; }
:where(select) option { padding: .25rem .5rem; }

/* validation */
[aria-invalid="true"] { border-color: var(--s-danger); }
[aria-invalid="false"] { border-color: var(--s-success); }
[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--s-danger) 25%, transparent); }
[aria-invalid="false"]:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--s-success) 25%, transparent); }

/* helper text directly under a field */
:where(input, select, textarea) + :where(small) {
  display: block;
  margin: calc(var(--s-space) * -.65) 0 var(--s-space);
  color: var(--s-muted);
}
[aria-invalid="true"] + small { color: var(--s-danger); }
[aria-invalid="false"] + small { color: var(--s-success); }

:where(fieldset) { margin: 0 0 var(--s-space); padding: 0; border: 0; min-width: 0; }
:where(legend) { padding: 0; font-weight: 600; }

/* checkbox / radio rows */
:where(label):has(> [type="checkbox"], > [type="radio"]) {
  display: flex;
  align-items: center;
  gap: .55rem;
  width: fit-content;
  margin-bottom: .5rem;
  font-weight: 400;
  cursor: pointer;
}
:where(fieldset) > :where(label):has(> [type="checkbox"], > [type="radio"]):last-child { margin-bottom: 0; }

:where([type="checkbox"], [type="radio"]) {
  -webkit-appearance: none;
  appearance: none;
  display: inline-grid;
  place-content: center;
  flex-shrink: 0;
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
  border: 1.5px solid var(--s-border-strong);
  border-radius: .3rem;
  background: var(--s-bg);
  cursor: pointer;
  vertical-align: middle;
  transition: background-color var(--s-transition), border-color var(--s-transition), box-shadow var(--s-transition);
}
:where([type="radio"]) { border-radius: 50%; }
:where([type="checkbox"], [type="radio"])::before {
  content: "";
  width: .65rem;
  height: .65rem;
  background: var(--s-on-primary);
  transform: scale(0);
  transition: transform .12s ease;
}
:where([type="checkbox"])::before { clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%); }
:where([type="radio"])::before { width: .45rem; height: .45rem; border-radius: 50%; }
:where([type="checkbox"], [type="radio"]):is(:checked, :indeterminate) { background: var(--s-primary); border-color: var(--s-primary); }
:where([type="checkbox"], [type="radio"]):is(:checked, :indeterminate)::before { transform: scale(1); }
:where([type="checkbox"]):indeterminate::before { height: .15rem; clip-path: none; border-radius: 1px; }
:where([type="checkbox"], [type="radio"]):focus-visible { outline: none; box-shadow: 0 0 0 3px var(--s-focus); }
:where([type="checkbox"], [type="radio"]):disabled { opacity: .5; cursor: not-allowed; }
:where([type="checkbox"], [type="radio"])[aria-invalid="true"] { border-color: var(--s-danger); }

/* switch: <input type="checkbox" role="switch"> */
[type="checkbox"][role="switch"] {
  width: 2.25rem;
  height: 1.3rem;
  padding: 0 .15rem;
  place-content: center start;
  border: 0;
  border-radius: 999px;
  background: var(--s-border-strong);
}
[type="checkbox"][role="switch"]::before {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  clip-path: none;
  background: #fff;
  transform: none;
  box-shadow: 0 1px 2px rgb(0 0 0 / .25);
  transition: translate .18s ease;
}
[type="checkbox"][role="switch"]:checked { background: var(--s-primary); }
[type="checkbox"][role="switch"]:checked::before { translate: .95rem 0; }

/* range */
:where([type="range"]) {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 1.25rem;
  margin: .25rem 0 var(--s-space);
  background: transparent;
  cursor: pointer;
}
:where([type="range"])::-webkit-slider-runnable-track { height: .375rem; border-radius: 999px; background: var(--s-border); }
:where([type="range"])::-moz-range-track { height: .375rem; border-radius: 999px; background: var(--s-border); }
:where([type="range"])::-moz-range-progress { height: .375rem; border-radius: 999px; background: var(--s-primary); }
:where([type="range"])::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 1.15rem;
  height: 1.15rem;
  margin-top: -.39rem;
  border: 2px solid var(--s-bg);
  border-radius: 50%;
  background: var(--s-primary);
  box-shadow: 0 0 0 1px var(--s-primary);
  transition: box-shadow var(--s-transition);
}
:where([type="range"])::-moz-range-thumb {
  width: 1.15rem;
  height: 1.15rem;
  border: 2px solid var(--s-bg);
  border-radius: 50%;
  background: var(--s-primary);
  box-shadow: 0 0 0 1px var(--s-primary);
}
:where([type="range"]):focus-visible { outline: none; }
:where([type="range"]):focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 1px var(--s-primary), 0 0 0 5px var(--s-focus); }
:where([type="range"]):focus-visible::-moz-range-thumb { box-shadow: 0 0 0 1px var(--s-primary), 0 0 0 5px var(--s-focus); }

/* file */
:where([type="file"]) { display: block; width: 100%; margin: 0 0 var(--s-space); font: inherit; color: var(--s-muted); }
:where(label) > :where([type="file"], [type="color"]) { margin-top: .375rem; }
::file-selector-button {
  margin-right: .875rem;
  padding: .5rem .9rem;
  font: inherit;
  font-weight: 600;
  color: var(--s-text);
  background: var(--s-surface);
  border: 1px solid var(--s-border-strong);
  border-radius: var(--s-radius);
  cursor: pointer;
  transition: background-color var(--s-transition);
}
::file-selector-button:hover { background: var(--s-border); }

/* color */
:where([type="color"]) {
  display: block;
  width: 3rem;
  margin: 0 0 var(--s-space);
  height: 2.5rem;
  padding: .2rem;
  border: 1px solid var(--s-border-strong);
  border-radius: var(--s-radius);
  background: var(--s-bg);
  cursor: pointer;
}
:where([type="color"])::-webkit-color-swatch-wrapper { padding: 0; }
:where([type="color"])::-webkit-color-swatch { border: 0; border-radius: calc(var(--s-radius) - .2rem); }
:where([type="color"])::-moz-color-swatch { border: 0; border-radius: calc(var(--s-radius) - .2rem); }

::-webkit-calendar-picker-indicator { opacity: .6; cursor: pointer; }

/* progress */
:where(progress) {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: .5rem;
  margin: 0 0 var(--s-space);
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: var(--s-border);
  color: var(--s-primary);
}
:where(progress)::-webkit-progress-bar { background: var(--s-border); }
:where(progress)::-webkit-progress-value { background: var(--s-primary); border-radius: 999px; transition: width .3s ease; }
:where(progress)::-moz-progress-bar { background: var(--s-primary); border-radius: 999px; }
:where(progress):indeterminate {
  background: var(--s-border) linear-gradient(90deg, transparent, var(--s-primary) 30%, var(--s-primary) 70%, transparent) no-repeat;
  background-size: 35% 100%;
  animation: s-indeterminate 1.2s ease-in-out infinite;
}
:where(progress):indeterminate::-webkit-progress-bar { background: transparent; }
:where(progress):indeterminate::-moz-progress-bar { background: transparent; }

:where(meter) { width: 100%; height: .75rem; }

/* ==========================================================================
   8. Components
   ========================================================================== */

/* --- Navigation --- */
:where(nav) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem 1.5rem;
}
:where(nav) :where(ul) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
:where(nav) :where(li) { margin: 0; }
:where(nav) :where(a):not([role="button"]) { color: var(--s-text); text-decoration: none; }
:where(nav) :where(a):not([role="button"]):hover,
:where(nav) [aria-current]:not([aria-current="false"]) { color: var(--s-primary); }
:where(nav) [aria-current]:not([aria-current="false"]) { font-weight: 600; }

nav[aria-label="breadcrumb"] ul { gap: .5rem; }
nav[aria-label="breadcrumb"] li:not(:last-child)::after { content: "/"; margin-left: .5rem; color: var(--s-muted); }
nav[aria-label="breadcrumb"] li:last-child { color: var(--s-muted); }

:where(aside) :where(nav) { display: block; }
:where(aside) :where(nav ul) { flex-direction: column; align-items: stretch; gap: .125rem; }
:where(aside) :where(nav a) { display: block; padding: .375rem .75rem; border-radius: var(--s-radius); }
:where(aside) :where(nav) [aria-current]:not([aria-current="false"]) { background: color-mix(in srgb, var(--s-primary) 10%, transparent); }

/* --- Card: <article> --- */
:where(article) {
  margin: 0 0 calc(var(--s-space) * 1.5);
  padding: 1.5rem;
  background: var(--s-card);
  border: 1px solid var(--s-border);
  border-radius: calc(var(--s-radius) * 1.5);
  box-shadow: var(--s-shadow);
}
:where(article) > :where(header, footer) {
  margin-inline: -1.5rem;
  padding: 1rem 1.5rem;
  background: var(--s-card-section);
}
:where(article) > :where(header) {
  margin-top: -1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--s-border);
  border-radius: calc(var(--s-radius) * 1.5) calc(var(--s-radius) * 1.5) 0 0;
}
:where(article) > :where(footer) {
  margin-top: 1.5rem;
  margin-bottom: -1.5rem;
  border-top: 1px solid var(--s-border);
  border-radius: 0 0 calc(var(--s-radius) * 1.5) calc(var(--s-radius) * 1.5);
}
:where(article) > :where(header, footer) > :last-child,
:where(article) > :last-child { margin-bottom: 0; }
:where(article) > :where(footer):last-child { margin-bottom: -1.5rem; }
/* cards in a grid: equal heights, footers aligned at the bottom */
:where(.grid) > :where(article) { display: flex; flex-direction: column; }
:where(.grid) > :where(article) > :where(footer) { margin-top: auto; }
:where(.grid) > :where(article) > :not(header):has(+ footer:last-child) { margin-bottom: 1.5rem; }

/* --- Accordion: <details> --- */
:where(details) { border-bottom: 1px solid var(--s-border); }
:where(details) > :where(summary) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .875rem 0;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}
:where(details) > :where(summary)::-webkit-details-marker { display: none; }
:where(details) > :where(summary)::after {
  content: "";
  flex-shrink: 0;
  width: .5rem;
  height: .5rem;
  margin-right: .25rem;
  border-right: 2px solid var(--s-muted);
  border-bottom: 2px solid var(--s-muted);
  transform: translateY(-25%) rotate(45deg);
  transition: transform .2s ease;
}
:where(details[open]) > :where(summary)::after { transform: translateY(25%) rotate(-135deg); }
:where(details[open]) > :where(summary) { margin-bottom: .25rem; }
:where(details[open]) { padding-bottom: .5rem; }
:where(details) > :where(summary):focus-visible { outline-offset: 4px; border-radius: .25rem; }

/* --- Dropdown: <details class="dropdown"> --- */
details.dropdown { position: relative; display: inline-block; border: 0; padding: 0; margin-bottom: var(--s-space); }
details.dropdown > summary {
  padding: .625rem .875rem;
  margin: 0;
  font-weight: 500;
  border: 1px solid var(--s-border-strong);
  border-radius: var(--s-radius);
  background: var(--s-bg);
}
details.dropdown > summary::after { width: .4rem; height: .4rem; }
details.dropdown[open] > summary { border-color: var(--s-primary); box-shadow: 0 0 0 3px var(--s-focus); }
details.dropdown > :is(ul, div) {
  position: absolute;
  z-index: 50;
  top: calc(100% + .375rem);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: 18rem;
  margin: 0;
  padding: .3rem;
  list-style: none;
  background: var(--s-card);
  border: 1px solid var(--s-border);
  border-radius: var(--s-radius);
  box-shadow: var(--s-shadow-lg);
  animation: s-pop .14s ease;
}
details.dropdown > ul > li { margin: 0; }
details.dropdown > ul a {
  display: block;
  padding: .45rem .75rem;
  border-radius: calc(var(--s-radius) - .15rem);
  color: var(--s-text);
  text-decoration: none;
}
details.dropdown > ul a:hover { background: var(--s-surface); }
details.dropdown > ul hr { margin: .3rem 0; }
:where(nav) details.dropdown { margin: 0; }
:where(nav) details.dropdown > summary { border: 0; padding: .25rem 0; background: none; box-shadow: none; }
details.dropdown.right > :is(ul, div) { left: auto; right: 0; }

/* --- Modal: <dialog> --- */
:where(dialog) {
  width: min(100% - 2rem, 34rem);
  max-height: calc(100vh - 4rem);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--s-text);
  overflow: visible;
}
:where(dialog) > :where(article) { margin: 0; box-shadow: var(--s-shadow-lg); max-height: calc(100vh - 4rem); overflow: auto; }
:where(dialog)[open] { animation: s-pop .2s ease; }
:where(dialog)::backdrop { background: rgb(10 12 16 / .5); backdrop-filter: blur(3px); }
:where(dialog) :where(header) :where(h1, h2, h3, h4) { margin: 0; }
:where(dialog) :where(footer) { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; }

/* --- Callout --- */
.callout {
  --s-callout: var(--s-primary);
  margin: 0 0 var(--s-space);
  padding: .875rem 1.125rem;
  border: 1px solid color-mix(in srgb, var(--s-callout) 30%, transparent);
  border-left: 4px solid var(--s-callout);
  border-radius: var(--s-radius);
  background: color-mix(in srgb, var(--s-callout) 8%, var(--s-bg));
}
.callout > :last-child { margin-bottom: 0; }
.callout.success { --s-callout: var(--s-success); }
.callout.warning { --s-callout: var(--s-warning); }
.callout.danger { --s-callout: var(--s-danger); }

/* --- Tooltip: data-tooltip="..." --- */
[data-tooltip] { position: relative; }
[data-tooltip]:not(button, [role="button"]) { border-bottom: 1px dotted var(--s-muted); cursor: help; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  z-index: 60;
  bottom: 100%;
  left: 50%;
  width: max-content;
  max-width: 16rem;
  padding: .35rem .6rem;
  border-radius: calc(var(--s-radius) - .1rem);
  background: var(--s-contrast);
  color: var(--s-on-contrast);
  font-size: .8rem;
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -.25rem);
  transition: opacity .15s ease, transform .15s ease;
}
[data-tooltip][data-placement="bottom"]::after { bottom: auto; top: 100%; transform: translate(-50%, .25rem); }
[data-tooltip]:is(:hover, :focus-visible)::after { opacity: 1; transform: translate(-50%, -.5rem); }
[data-tooltip][data-placement="bottom"]:is(:hover, :focus-visible)::after { transform: translate(-50%, .5rem); }

/* --- Loading: aria-busy="true" --- */
[aria-busy="true"]:not(input, select, textarea)::before {
  content: "";
  display: inline-block;
  flex-shrink: 0;
  width: 1em;
  height: 1em;
  border: .15em solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -.15em;
  animation: s-spin .7s linear infinite;
}
[aria-busy="true"]:not(button, [role="button"], input, select, textarea):not(:empty)::before { margin-right: .5em; }
:is(button, [role="button"])[aria-busy="true"] { pointer-events: none; }

/* ==========================================================================
   9. Layout helpers
   ========================================================================== */

/* Auto-fitting grid: columns wrap below --s-grid-min */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(var(--s-grid-min, 14rem), 100%), 1fr));
  gap: var(--s-grid-gap, var(--s-space));
  margin-bottom: var(--s-space);
}
.grid > * { min-width: 0; }
.grid > :where(article, input, select, textarea, label, fieldset) { margin-bottom: 0; }

/* Fixed column counts from 48rem up, single column below */
@media (min-width: 48rem) {
  .grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid.cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .grid.cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .span-2 { grid-column: span 2; }
  .span-3 { grid-column: span 3; }
  .span-4 { grid-column: span 4; }
  .span-6 { grid-column: span 6; }
  .span-8 { grid-column: span 8; }
  .span-9 { grid-column: span 9; }
}
@media (max-width: 47.99rem) {
  .grid:is(.cols-2, .cols-3, .cols-4, .cols-6, .cols-12) { grid-template-columns: 1fr; }
}
.span-full { grid-column: 1 / -1; }

/* Flex helpers */
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-row-gap, .75rem); }
.row > * { margin-bottom: 0; }
.spread { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: var(--s-stack-gap, var(--s-space)); }
.stack > * { margin: 0; }

/* ==========================================================================
   10. Utilities (kept deliberately small)
   ========================================================================== */

.muted { color: var(--s-muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.full { width: 100%; }
.overflow-auto { overflow: auto; }
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   11. Motion
   ========================================================================== */

@keyframes s-spin { to { transform: rotate(360deg); } }
@keyframes s-pop { from { opacity: 0; transform: translateY(.375rem) scale(.98); } }
@keyframes s-indeterminate { from { background-position: -50% 0; } to { background-position: 150% 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   12. Print
   ========================================================================== */

@media print {
  :root { --s-bg: #fff; --s-text: #000; --s-card: #fff; color-scheme: light; }
  :where(article) { box-shadow: none; break-inside: avoid; }
  :where(a[href^="http"])::after { content: " (" attr(href) ")"; font-size: .8em; color: #555; }
  :where(nav, dialog, button) { display: none !important; }
}
