/*
 * RTE360 site styles. Colors come only from tokens.css (Console, light and dark); sizes are rem.
 * Rules followed: the owner's uiux skill (motion.md "Interactive by default", the variants
 * defaults: filled primary and outlined secondary buttons, underlined links, raised cards,
 * scroll-solid header, sunken code blocks, glow-grid background, ring focus with a wide offset).
 */

:root {
  --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem; --space-4: 1rem; --space-6: 1.5rem;
  --space-8: 2rem; --space-12: 3rem; --space-16: 4rem; --space-24: 6rem;
  --gutter: 1rem;
  --container-max: 90rem;
  --header-height: 4rem;
  --measure: 58ch;
  --control-sm: 2rem; --control-md: 2.5rem; --control-lg: 3rem;
  --text-xs: 0.75rem; --text-sm: 0.875rem; --text-md: 1rem; --text-lg: 1.25rem; --text-xl: 1.5rem;
  --text-2xl: 2rem; --text-display: clamp(2.25rem, 1.6rem + 2.6vw, 3.5rem);
  --font-mono: ui-monospace, 'Cascadia Code', 'Cascadia Mono', Consolas, 'SFMono-Regular', Menlo, monospace;
  --dur-fast: 120ms; --dur-base: 200ms; --dur-slow: 280ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in: cubic-bezier(0.55, 0, 1, 0.45);
  --ease-in-out: cubic-bezier(0.45, 0, 0.55, 1);
  --hairline-line: color-mix(in srgb, var(--border-subtle) 70%, transparent);
}
@media (min-width: 48em) { :root { --gutter: 1.5rem; } }
@media (min-width: 62em) { :root { --gutter: 2rem; } }
@media (pointer: coarse) { :root { --control-sm: 2.75rem; --control-md: 2.75rem; } }

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

html { scroll-padding-top: calc(var(--header-height) + var(--space-4)); -webkit-text-size-adjust: 100%; }
/* The page keeps its scrollbar, thin and in the theme: a thumb in the control border color on a clear track. */
html { scrollbar-width: thin; scrollbar-color: var(--border-control) transparent; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--text-primary);
  font: var(--font-size-body)/1.5 var(--font-sans);
  overflow-wrap: break-word;
}
html[data-ready] body { transition: background-color 300ms var(--ease-in-out), color 300ms var(--ease-in-out); }

/* Page background: glow-grid, static, behind everything. */
body::before, body::after { content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none; }
body::after {
  background:
    radial-gradient(circle at 10% 12%, color-mix(in srgb, var(--accent-solid) 14%, transparent), transparent 26rem),
    radial-gradient(circle at 88% 8%, color-mix(in srgb, var(--accent-solid) 10%, transparent), transparent 22rem),
    radial-gradient(circle at 80% 90%, color-mix(in srgb, var(--accent-ring) 10%, transparent), transparent 28rem);
}
body::before {
  background-image: linear-gradient(var(--hairline-line) 1px, transparent 1px), linear-gradient(90deg, var(--hairline-line) 1px, transparent 1px);
  background-size: 2.75rem 2.75rem;
  opacity: 0.6;
  mask-image: linear-gradient(to bottom, black, transparent 70%);
}
.shell { position: relative; z-index: 1; display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: 2px; }

.skip-link {
  position: absolute; inset-inline-start: var(--space-4); top: var(--space-2); z-index: 30;
  padding: var(--space-2) var(--space-4); border-radius: var(--radius-sm);
  background: var(--raised); color: var(--accent-text); border: 1px solid var(--border-control);
  translate: 0 -200%;
}
.skip-link:focus-visible { translate: 0 0; }

/*
 * Header, main and footer content sits in one centred container, at most --container-max wide and
 * at least one gutter from each edge, so both sides keep the same space. The header bar's own
 * background still spans the window.
 */
.container {
  width: 100%;
  padding-inline:
    max(calc(var(--gutter) + env(safe-area-inset-left, 0px)), calc((100% - var(--container-max)) / 2))
    max(calc(var(--gutter) + env(safe-area-inset-right, 0px)), calc((100% - var(--container-max)) / 2));
}
/* A 404 page is a short column of at most --measure in the middle of the window. */
.not-found {
  padding-inline:
    max(calc(var(--gutter) + env(safe-area-inset-left, 0px)), calc((100% - var(--measure)) / 2))
    max(calc(var(--gutter) + env(safe-area-inset-right, 0px)), calc((100% - var(--measure)) / 2));
}

/* ------------------------------------------------------------------ type */

h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 700; line-height: 1.2; text-wrap: balance; }
h1 { font-size: var(--text-display); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.375rem, 1.1rem + 1.2vw, var(--text-2xl)); letter-spacing: -0.01em; }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-md); }
p, li, dd, blockquote { max-inline-size: var(--measure); line-height: 1.6; text-align: start; }
p { margin: 0; text-wrap: pretty; }
code { font-family: var(--font-mono); font-size: 0.9em; }
:not(pre) > code {
  padding: 0.125rem var(--space-1); border-radius: var(--radius-sm);
  background: var(--sunken); border: 1px solid var(--border-subtle);
  overflow-wrap: anywhere;
}
.lead { font-size: var(--text-lg); color: var(--text-secondary); }
.muted { color: var(--text-muted); }

/* Links: underlined at rest, color and thickness change on hover. */
a { color: var(--accent-text); text-decoration-line: underline; text-underline-offset: 0.18em; text-decoration-thickness: max(1px, 0.07em); transition: color var(--dur-fast) var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  a:hover { color: color-mix(in oklab, var(--accent-text), var(--text-primary) 30%); text-decoration-thickness: max(2px, 0.12em); }
}
a:focus-visible { border-radius: 0.125rem; }

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

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-block-size: var(--control-md); padding: var(--space-2) var(--space-4);
  border: 1px solid var(--border-control); border-radius: var(--radius-md);
  background: transparent; color: var(--text-primary);
  font: 500 var(--text-sm)/1.25 var(--font-sans); text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out), background-color var(--dur-base) var(--ease-out),
    border-color var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.btn svg { width: 1rem; height: 1rem; flex: none; }
.btn-lg { min-block-size: var(--control-lg); padding-inline: var(--space-6); font-size: var(--text-md); }
.btn-sm { min-block-size: var(--control-sm); padding: var(--space-1) var(--space-3); }
.btn-primary { background: var(--accent-solid); border-color: var(--accent-solid); color: var(--accent-on-solid); }
@media (hover: hover) and (pointer: fine) {
  .btn:not(:disabled, [aria-disabled="true"]):hover { background: var(--accent-soft); border-color: var(--accent-ring); color: var(--accent-text); }
  .btn-primary:not(:disabled, [aria-disabled="true"]):hover {
    background: var(--accent-solid-hover); border-color: var(--accent-solid-hover); color: var(--accent-on-solid);
    transform: translateY(-0.125rem); box-shadow: var(--shadow-2);
  }
}
.btn:not(:disabled, [aria-disabled="true"]):active { transform: scale(0.97); }
.btn-primary:not(:disabled, [aria-disabled="true"]):active { transform: translateY(0) scale(0.97); }
.btn:is(:disabled, [aria-disabled="true"]) { color: var(--text-disabled); border-color: var(--border-subtle); background: transparent; cursor: not-allowed; }
.btn-primary:is(:disabled, [aria-disabled="true"]) { background: var(--sunken); }
.btn[data-done] { color: var(--success-text); border-color: var(--success-text); background: var(--success-soft); }

.actions { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }

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

.site-header {
  position: sticky; top: 0; z-index: 20;
  border-bottom: 1px solid transparent;
  transition: background-color var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out);
}
.site-header[data-scrolled], .site-header[data-open] { background: var(--page); border-bottom-color: var(--border-subtle); }
.header-row { display: flex; align-items: center; gap: var(--space-4); min-height: var(--header-height); }
.brand {
  display: inline-flex; align-items: center; gap: var(--space-2); margin-inline-end: auto;
  color: var(--text-primary); text-decoration: none; font: 700 var(--text-lg)/1 var(--font-display);
  border-radius: var(--radius-sm); padding: var(--space-1);
  transition: color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.brand svg { width: 1.75rem; height: 1.75rem; }
.brand small { font: 500 var(--text-xs)/1 var(--font-sans); color: var(--text-muted); }
@media (hover: hover) and (pointer: fine) { .brand:hover { color: var(--accent-text); } }
.brand:active { transform: scale(0.97); }

.nav-list { display: flex; gap: var(--space-1); margin: 0; padding: 0; list-style: none; }
.nav-link {
  position: relative; display: inline-flex; align-items: center; min-block-size: var(--control-md);
  padding-inline: var(--space-3); border-radius: var(--radius-md);
  color: var(--text-secondary); text-decoration: none; font: 500 var(--text-sm)/1 var(--font-sans);
  transition: background-color var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.nav-link::after {
  content: ""; position: absolute; inset-inline: var(--space-3); bottom: 0.375rem; height: 2px; border-radius: 2px;
  background: var(--accent-solid); scale: 0 1; transition: scale var(--dur-base) var(--ease-out);
}
.nav-link[aria-current="page"] { color: var(--text-primary); }
.nav-link[aria-current="page"]::after { scale: 1 1; }
@media (hover: hover) and (pointer: fine) { .nav-link:hover { background: var(--accent-soft); color: var(--accent-text); } }
.nav-link:active { transform: scale(0.97); }

.desktop-nav { display: none; }
.menu-toggle { display: inline-flex; }
@media (min-width: 62em) {
  .desktop-nav { display: flex; align-items: center; gap: var(--space-4); }
  .menu-toggle { display: none; }
  .menu-panel { display: none !important; }
}


/* Segmented controls built on radios: the playground's options. */
.segmented { display: inline-flex; gap: var(--space-1); margin: 0; padding: 0.1875rem; border: 1px solid var(--border-control); border-radius: var(--radius-md); background: var(--sunken); }
.segmented label { position: relative; display: inline-flex; }
.segmented input { position: absolute; inset: 0; z-index: 1; margin: 0; opacity: 0; cursor: pointer; }
/* The input stays on top: the pressed span scales, and a transformed span would otherwise paint over it and swallow the click. */
.segmented span {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-1);
  min-block-size: calc(var(--control-md) - 0.5rem); padding-inline: var(--space-3); border-radius: calc(var(--radius-md) - 0.1875rem);
  color: var(--text-secondary); font: 500 var(--text-sm)/1 var(--font-sans); white-space: nowrap;
  transition: background-color var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.segmented svg { width: 1rem; height: 1rem; }
@media (hover: hover) and (pointer: fine) { .segmented input:not(:checked, :disabled):hover + span { background: var(--accent-soft); color: var(--accent-text); } }
.segmented input:not(:disabled):active + span { transform: scale(0.97); }
.segmented input:disabled { cursor: not-allowed; }
.segmented input:disabled + span { color: var(--text-disabled); }
.segmented input:disabled:checked + span { background: transparent; box-shadow: inset 0 0 0 1px var(--border-subtle); }
.segmented input:checked + span { background: var(--raised); color: var(--text-primary); box-shadow: inset 0 0 0 1px var(--border-control), var(--shadow-1); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent-ring); outline-offset: 2px; }
@media (pointer: coarse) { .segmented span { min-block-size: 2.75rem; } }

/* Menu panel for phones and tablets: slides down under the header. */
.menu-panel {
  position: absolute; inset-inline: 0; top: 100%;
  background: var(--page); border-bottom: 1px solid var(--border-subtle); box-shadow: var(--shadow-3);
  padding-block: var(--space-4) var(--space-6);
  max-height: calc(100vh - var(--header-height)); overflow-y: auto; overscroll-behavior: contain;
  opacity: 0; translate: 0 -0.5rem;
  transition: opacity var(--dur-base) var(--ease-out), translate var(--dur-base) var(--ease-out), display var(--dur-base) allow-discrete;
}
.menu-panel[hidden] { display: none; }
.menu-panel[data-shown] { opacity: 1; translate: 0 0; }
.menu-panel[data-closing] { transition-duration: var(--dur-fast); transition-timing-function: var(--ease-in); }
.menu-panel .nav-list { flex-direction: column; gap: var(--space-1); }
.menu-panel .nav-link { display: flex; min-block-size: 2.75rem; font-size: var(--text-md); }
.menu-panel .nav-link::after { inset-inline: auto; left: 0; top: 0.625rem; bottom: 0.625rem; width: 3px; height: auto; scale: 1 0; }
.menu-panel .nav-link[aria-current="page"]::after { scale: 1 1; }
.menu-panel .segmented { display: flex; }
.menu-panel .segmented label { flex: 1 1 0; }
.menu-panel .segmented span { width: 100%; }

/* Without JavaScript: the menu links show as a plain list. */
html:not(.js) .menu-toggle { display: none; }
html:not(.js) .menu-panel[hidden] { display: block; position: static; opacity: 1; translate: none; box-shadow: none; padding-block: 0 var(--space-4); }
html:not(.js) .header-row { flex-wrap: wrap; }
@media (min-width: 62em) { html:not(.js) .menu-panel[hidden] { display: none; } }

/* ------------------------------------------------------------------ sections, cards */

.section { padding-block: var(--space-12); }
.section-head { display: flex; flex-direction: column; gap: var(--space-3); margin-bottom: var(--space-8); }
.section-head p { color: var(--text-secondary); }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack-lg { display: flex; flex-direction: column; gap: var(--space-8); }
.stack-lg > .section-head { margin-bottom: 0; }

.hero { padding-block: var(--space-12) var(--space-8); }
.hero-inner { display: flex; flex-direction: column; gap: var(--space-6); align-items: flex-start; }
.hero .eyebrow { font: 600 var(--text-sm)/1.2 var(--font-sans); color: var(--accent-text); }
.hero h1 { max-inline-size: 34ch; font-size: clamp(1.5rem, 0.9rem + 2.6vw, 3.25rem); }
.hero .lead { max-inline-size: 42rem; }
@media (min-width: 62em) {
  .hero { padding-block: var(--space-16) var(--space-12); }
  /* From 62em the opening block sits in the middle. Centred text must stay within three lines, so check it when the text changes. A reading page's opening block (.hero-start) stays on the start edge. */
  .hero > .container.hero-inner:not(.hero-start) { align-items: center; }
  .hero > .container.hero-inner:not(.hero-start) > * { text-align: center; }
}

.card {
  background: var(--raised); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1); padding: var(--space-6);
}
.card h3 { margin-bottom: var(--space-2); }
.card p { color: var(--text-secondary); }
.card-icon { display: inline-flex; width: 2.5rem; height: 2.5rem; align-items: center; justify-content: center; margin-bottom: var(--space-4); border-radius: var(--radius-md); background: var(--accent-soft); color: var(--accent-text); }
.card-icon svg { width: 1.25rem; height: 1.25rem; }
.grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); }
/* Six cards: three to a row from 62em and all six in one row from 140em, so no row is left half empty. */
@media (min-width: 62em) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 140em) { .grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

/* ------------------------------------------------------------------ editor frames */

.editor-frame { position: relative; min-height: 18rem; }
.editor-status {
  display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-3);
  min-height: 18rem; padding: var(--space-6);
  border: 1px dashed var(--border-control); border-radius: var(--radius-lg); background: var(--raised);
  color: var(--text-secondary);
}
.editor-status[data-kind="error"] { border-style: solid; border-color: var(--danger-text); background: var(--danger-soft); color: var(--danger-text); }
.editor-status[data-kind="error"] p { color: var(--text-primary); }
.skeleton-line { display: block; height: 0.75rem; border-radius: var(--radius-pill); background: var(--sunken); }
.skeleton-line:nth-child(2) { width: 90%; } .skeleton-line:nth-child(3) { width: 70%; } .skeleton-line:nth-child(4) { width: 80%; }

/* ------------------------------------------------------------------ code blocks */

.code-block { position: relative; }
pre.code {
  margin: 0; padding: var(--space-4); padding-inline-end: 6rem;
  background: var(--sunken); color: var(--text-primary);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  font: var(--text-sm)/1.6 var(--font-mono);
  white-space: pre; overflow-x: auto; tab-size: 2;
}
pre.code code { font-size: inherit; }
.copy-btn { position: absolute; top: var(--space-2); inset-inline-end: var(--space-2); background: var(--raised); }
.copy-btn .icon-check { display: none; }
.copy-btn[data-done] .icon-copy { display: none; }
.copy-btn[data-done] .icon-check { display: inline; }
code.hash { font-size: var(--text-xs); overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ tables */

.table-scroll { overflow-x: auto; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--raised); }
.table-scroll:focus-visible { outline-offset: 2px; }
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
th, td { padding: var(--space-2) var(--space-3); text-align: start; vertical-align: top; border-bottom: 1px solid var(--border-subtle); }
thead th { background: var(--sunken); color: var(--text-secondary); font-weight: 600; white-space: nowrap; }
tbody tr:last-child > * { border-bottom: 0; }
td.num, th.num { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
td code { white-space: nowrap; }
td code.hash { white-space: normal; }

/* ------------------------------------------------------------------ prose (docs, changelog) */

.doc-layout { display: grid; gap: var(--space-8); padding-block: var(--space-8) var(--space-16); }
@media (min-width: 62em) { .doc-layout { grid-template-columns: 15rem minmax(0, 1fr); align-items: start; } }
.toc { font-size: var(--text-sm); }
.toc details { border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--raised); }
.toc summary {
  display: flex; align-items: center; gap: var(--space-2); min-block-size: var(--control-md); padding-inline: var(--space-4);
  cursor: pointer; font-weight: 600; border-radius: var(--radius-md); list-style: none;
  transition: background-color var(--dur-base) var(--ease-out);
}
.toc summary::-webkit-details-marker { display: none; }
.toc summary svg { width: 1rem; height: 1rem; transition: rotate var(--dur-base) var(--ease-out); }
.toc details[open] summary svg { rotate: 90deg; }
@media (hover: hover) and (pointer: fine) { .toc summary:hover { background: var(--accent-soft); color: var(--accent-text); } }
.toc-list { margin: 0; padding: var(--space-2) var(--space-2) var(--space-4); list-style: none; display: flex; flex-direction: column; gap: 0.125rem; }
.toc-list a {
  display: block; padding: var(--space-1) var(--space-3); border-radius: var(--radius-sm);
  color: var(--text-secondary); text-decoration: none; border-inline-start: 2px solid transparent;
  transition: background-color var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .toc-list a:hover { background: var(--accent-soft); color: var(--accent-text); } }
.toc-list a[aria-current="true"] { color: var(--accent-text); border-inline-start-color: var(--accent-solid); }
@media (min-width: 62em) {
  .toc { position: sticky; top: calc(var(--header-height) + var(--space-4)); max-height: calc(100vh - var(--header-height) - var(--space-8)); overflow-y: auto; scrollbar-gutter: stable; }
  .toc details { border: 0; background: transparent; }
  .toc summary { pointer-events: none; padding-inline: var(--space-3); }
  .toc summary svg { display: none; }
}

/* Every block of the prose starts on one edge, beside the contents list, and runs to the column's end: text, code blocks, tables and test frames alike, so the column has one width. On a narrow window the column itself keeps lines short. */
.prose { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; row-gap: var(--space-4); }
.prose > h1 { margin-bottom: var(--space-2); }
.prose :is(p, li, dd, blockquote) { max-inline-size: none; }
.prose h2 { margin-top: var(--space-8); padding-top: var(--space-4); border-top: 1px solid var(--border-subtle); }
.prose h3 { margin-top: var(--space-4); }
.prose ul, .prose ol { margin: 0; padding-inline-start: var(--space-6); display: flex; flex-direction: column; gap: var(--space-2); }
.prose li::marker { color: var(--text-muted); }
.prose .table-scroll { margin-block: var(--space-1); }

/* ------------------------------------------------------------------ forms (playground) */

.field { display: flex; flex-direction: column; gap: var(--space-2); margin: 0; padding: 0; border: 0; min-width: 0; }
.field > label, .field > legend { font: 600 var(--text-sm)/1.3 var(--font-sans); color: var(--text-primary); padding: 0; }
/* A fieldset's legend is not one of its flex items, so the .field gap never reaches it: it takes the same gap as its own margin. */
.field > legend { margin-block-end: var(--space-2); }
.field .hint { font-size: var(--text-xs); color: var(--text-muted); }
.select-wrap { position: relative; display: block; }
.select-wrap::after {
  content: ""; position: absolute; inset-inline-end: 0.625rem; top: 50%; width: 1.125rem; height: 1.125rem; translate: 0 -50%;
  background: var(--text-secondary); pointer-events: none;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 8 4 4 4-4'/%3E%3C/svg%3E") center / contain no-repeat;
}
.select {
  appearance: none; min-block-size: var(--control-md); width: 100%; padding: var(--space-2) 2.25rem var(--space-2) var(--space-3);
  border: 1px solid var(--border-control); border-radius: var(--radius-sm); background: var(--raised);
  color: var(--text-primary); font: var(--text-sm)/1.4 var(--font-sans); cursor: pointer;
  transition: border-color var(--dur-base) var(--ease-out), background-color var(--dur-base) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .select:not(:disabled):hover { border-color: var(--accent-ring); } }
.select:disabled { color: var(--text-disabled); border-color: var(--border-subtle); cursor: not-allowed; }

.check { display: inline-flex; align-items: center; gap: var(--space-2); min-block-size: var(--control-sm); cursor: pointer; font-size: var(--text-sm); border-radius: var(--radius-sm); }
.check input {
  appearance: none; flex: none; width: 1.125rem; height: 1.125rem; margin: 0;
  border: 1px solid var(--border-control); border-radius: min(var(--radius-sm), .25rem); background: var(--raised);
  display: grid; place-items: center; cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.check input::after { content: ""; width: 0.625rem; height: 0.375rem; border: solid var(--accent-on-solid); border-width: 0 0 2px 2px; rotate: -45deg; translate: 0 -0.0625rem; scale: 0; transition: scale var(--dur-fast) var(--ease-out); }
.check input:checked { background: var(--accent-solid); border-color: var(--accent-solid); }
.check input:checked::after { scale: 1; }
.check input:active { transform: scale(0.94); }
@media (hover: hover) and (pointer: fine) { .check:hover input:not(:disabled) { border-color: var(--accent-ring); } }
.check input:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: 2px; }
.check input:disabled { border-color: var(--border-subtle); background: var(--sunken); cursor: not-allowed; }
.check:has(input:disabled) { color: var(--text-disabled); cursor: not-allowed; }
@media (pointer: coarse) { .check { min-block-size: 2.75rem; } }

.playground { display: grid; gap: var(--space-6); padding-block: var(--space-6) var(--space-16); }
@media (min-width: 62em) { .playground { grid-template-columns: 20rem minmax(0, 1fr); align-items: start; } }
.controls { display: flex; flex-direction: column; gap: var(--space-6); }
@media (min-width: 62em) { .controls { position: sticky; top: calc(var(--header-height) + var(--space-4)); } }
.controls .segmented { display: flex; flex-wrap: wrap; }
.controls .segmented label { flex: 1 1 auto; }
.controls .segmented span { width: 100%; }
.control-group { display: flex; flex-direction: column; gap: var(--space-1); }
.output { display: flex; flex-direction: column; gap: var(--space-6); min-width: 0; }

/* ------------------------------------------------------------------ status, notices */

.notice {
  display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-4);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--raised);
}
.notice svg { width: 1.25rem; height: 1.25rem; flex: none; margin-top: 0.125rem; }
.notice-info { background: var(--info-soft); border-color: transparent; }
.notice-info svg { color: var(--info-text); }
.result-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: var(--space-2); }
.result-list li { display: flex; gap: var(--space-2); align-items: flex-start; font-size: var(--text-sm); }
.result-list svg { width: 1.125rem; height: 1.125rem; flex: none; margin-top: 0.125rem; }
.result-list [data-state="pass"] { color: var(--success-text); }
.result-list [data-state="fail"] { color: var(--danger-text); }
.result-list [data-state="wait"] { color: var(--text-secondary); }
.result-list li span { color: var(--text-primary); }

.test-frames { display: grid; gap: var(--space-4); }
@media (min-width: 75em) { .test-frames { grid-template-columns: 1fr 1fr; } }
.test-frame { width: 100%; height: 22rem; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--raised); }

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

.site-footer { border-top: 1px solid var(--border-subtle); padding-block: var(--space-6); font-size: var(--text-sm); color: var(--text-secondary); }
.footer-row { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-6); align-items: center; justify-content: space-between; }
.footer-row p { max-inline-size: none; }
.footer-links { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); margin: 0; padding: 0; list-style: none; }

/* ------------------------------------------------------------------ 404 */

.not-found { padding-block: var(--space-16); }

/* ------------------------------------------------------------------ reduced motion, forced colors */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  :is(body, .menu-panel) {
    transition-property: opacity, color, background-color !important;
    transition-duration: var(--dur-base) !important;
  }
  .menu-panel { translate: none !important; }
}

@media (forced-colors: active) {
  .segmented input:checked + span { background: Highlight; color: HighlightText; forced-color-adjust: none; }
  .select-wrap::after { background: CanvasText; }
  .nav-link[aria-current="page"]::after, .toc-list a[aria-current="true"] { background: Highlight; forced-color-adjust: none; }
  .check input:checked { background: Highlight; border-color: Highlight; forced-color-adjust: none; }
  .check input:checked::after { border-color: HighlightText; }
  .btn { border-color: ButtonText; }
}
