/*
 * Palette Forge - stylesheet.
 *
 * Two layers of custom properties, deliberately kept apart:
 *   --ui-*  is written by app.js from the visitor's own palette (live recoloring)
 *   --fx-*  is fixed chrome that must never move, so the page stays legible even
 *           if a palette is pathological.
 * Every --ui-* text color is passed through ensureContrast() before it lands
 * here, so 4.5:1 holds no matter what palette is loaded.
 */

:root {
  color-scheme: dark;

  /* Live palette. These are the defaults; app.js overwrites them on every change. */
  --ui-bg: #14161c;
  --ui-surface: #1b1e27;
  --ui-surface-2: #232733;
  --ui-border: #2f3441;
  --ui-text: #e8eaf0;
  --ui-muted: #a3aab9;
  --ui-accent: #7c8cff;
  --ui-accent-ink: #0b0d12;
  --ui-focus: #ffd166;

  /* Fixed chrome. */
  --fx-pass: #3fb984;
  --fx-pass-2: #86d3b1;
  --fx-warn: #e0a33d;
  --fx-fail: #e0605e;
  --fx-ink: #10131a;
  --fx-ink-inv: #ffffff;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --wrap: 1200px;
  --ctrl-h: 38px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  font: 16px/1.65 var(--font);
  background: var(--ui-bg);
  color: var(--ui-text);
  transition: background-color .25s ease, color .25s ease;
}

/* The color-vision simulation repaints values rather than filtering pixels, so
   text stays crisp; only this hook marks that a simulation is active. */
body[data-cvd]:not([data-cvd="none"]) .sw__face,
body[data-cvd]:not([data-cvd="none"]) .ramp__chip { outline-offset: -2px; }

img, svg { max-width: 100%; }

a { color: var(--ui-accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

kbd {
  font: 600 .78em/1 var(--mono);
  padding: .22em .42em;
  border: 1px solid var(--ui-border);
  border-bottom-width: 2px;
  border-radius: var(--r-sm);
  background: var(--ui-surface-2);
  color: var(--ui-text);
  white-space: nowrap;
}

code { font-family: var(--mono); font-size: .92em; }

:focus-visible {
  outline: 3px solid var(--ui-focus);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--sp-3); top: -100px;
  z-index: 50;
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-md);
  background: var(--ui-accent);
  color: var(--ui-accent-ink);
  font-weight: 650;
  text-decoration: none;
}
.skip-link:focus { top: var(--sp-3); }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--sp-4);
}

/* ------------------------------------------------------------------ head - */

.site-head {
  border-bottom: 1px solid var(--ui-border);
  background: var(--ui-surface);
}
.site-head__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  min-height: 60px;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  color: inherit;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.brand__mark {
  width: 26px; height: 26px;
  border-radius: 8px;
  background:
    conic-gradient(from 210deg, var(--ui-accent), #ffffff 30%, var(--ui-accent) 60%, #000000 85%, var(--ui-accent));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
  flex: none;
}
.brand__name { font-size: 1.05rem; }
.site-head__tag { margin: 0; color: var(--ui-muted); font-size: .9rem; }

/* ------------------------------------------------------------------ text - */

h1 {
  font-size: clamp(1.6rem, 1.1rem + 2.1vw, 2.35rem);
  line-height: 1.18;
  letter-spacing: -0.02em;
  margin: var(--sp-6) 0 var(--sp-4);
  max-width: 22ch;
}
main.wrap > h1 { max-width: 26ch; }

.lede {
  max-width: 74ch;
  margin: 0 0 var(--sp-5);
  font-size: 1.02rem;
  color: var(--ui-muted);
}
.lede kbd { color: var(--ui-text); }

.notice {
  max-width: 74ch;
  margin: 0 0 var(--sp-5);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--ui-border);
  border-left-width: 4px;
  border-radius: var(--r-md);
  background: var(--ui-surface);
}
.notice--warn { border-left-color: var(--fx-warn); }

.mono { font-family: var(--mono); font-size: .86rem; }
.muted { color: var(--ui-muted); }

/* ------------------------------------------------------------------ tool - */

.forge {
  margin: 0 0 var(--sp-7);
  border: 1px solid var(--ui-border);
  border-radius: var(--r-lg);
  background: var(--ui-surface);
  overflow: clip;
}

.forge__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--ui-border);
  background: var(--ui-surface-2);
}
.forge__bar-right {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.tabs { display: flex; gap: var(--sp-1); flex-wrap: wrap; }
.tab {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: var(--ctrl-h);
  padding: 0 var(--sp-4);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--ui-muted);
  font: 600 .95rem/1 var(--font);
  cursor: pointer;
}
.tab:hover { color: var(--ui-text); }
.tab[aria-selected="true"] {
  background: var(--ui-accent);
  color: var(--ui-accent-ink);
  border-color: transparent;
}
.tab__num {
  display: inline-grid;
  place-items: center;
  width: 18px; height: 18px;
  border-radius: 5px;
  background: rgba(127, 127, 127, .28);
  font: 700 .72rem/1 var(--mono);
}

.forge__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 0;
  align-items: start;
}
.forge__main { padding: var(--sp-5); min-width: 0; }
.forge__side {
  border-left: 1px solid var(--ui-border);
  padding: var(--sp-5);
  display: grid;
  gap: var(--sp-5);
  align-content: start;
  min-width: 0;
  background: color-mix(in srgb, var(--ui-surface) 70%, var(--ui-bg));
}

.panel { min-height: 480px; }
.panel:focus-visible { outline-offset: -3px; }
.panel__h {
  margin: var(--sp-6) 0 var(--sp-2);
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ui-muted);
}
.panel > .panel__h:first-child { margin-top: 0; }
.panel__h-note { font-weight: 500; letter-spacing: 0; text-transform: none; opacity: .75; }
.hint { margin: 0 0 var(--sp-3); font-size: .87rem; color: var(--ui-muted); max-width: 68ch; }

/* ---------------------------------------------------------------- fields - */

.field { display: block; min-width: 0; }
.field--inline { display: inline-flex; align-items: center; gap: var(--sp-2); }
.field--inline .field__label { margin: 0; }
.field__label {
  display: block;
  margin-bottom: var(--sp-1);
  font-size: .78rem;
  font-weight: 650;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ui-muted);
}

.input, .select {
  width: 100%;
  max-width: 320px;
  min-height: var(--ctrl-h);
  padding: 0 var(--sp-3);
  border: 1px solid var(--ui-border);
  border-radius: var(--r-md);
  background: var(--ui-bg);
  color: var(--ui-text);
  font: 400 .95rem/1.2 var(--font);
}
.input--mono { font-family: var(--mono); letter-spacing: .02em; }
.select { max-width: 200px; cursor: pointer; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: var(--ctrl-h);
  padding: 0 var(--sp-4);
  border: 1px solid var(--ui-border);
  border-radius: var(--r-md);
  background: var(--ui-surface-2);
  color: var(--ui-text);
  font: 650 .92rem/1 var(--font);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--ui-accent); }
.btn--primary {
  background: var(--ui-accent);
  border-color: transparent;
  color: var(--ui-accent-ink);
}
.btn--ghost { background: transparent; }
.btn kbd { border-color: currentColor; opacity: .7; background: transparent; }
.btn-row { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

.switch {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  cursor: pointer;
  font-size: .88rem;
  color: var(--ui-muted);
  user-select: none;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 34px; height: 20px;
  margin: 0;
  cursor: pointer;
}
.switch__track {
  width: 34px; height: 20px;
  border-radius: 999px;
  background: var(--ui-border);
  display: inline-flex;
  align-items: center;
  padding: 2px;
  transition: background-color .18s ease;
  flex: none;
}
.switch__dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--ui-text);
  transition: transform .18s ease;
}
.switch input:checked + .switch__track { background: var(--ui-accent); }
.switch input:checked + .switch__track .switch__dot {
  transform: translateX(14px);
  background: var(--ui-accent-ink);
}
.switch input:focus-visible + .switch__track {
  outline: 3px solid var(--ui-focus);
  outline-offset: 2px;
}
.switch input:checked ~ .switch__text { color: var(--ui-text); }

.segmented { border: 0; margin: 0 0 var(--sp-5); padding: 0; min-width: 0; }
.segmented__row { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.seg { position: relative; }
.seg input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%; height: 100%;
  margin: 0;
  cursor: pointer;
}
.seg span {
  display: inline-flex;
  align-items: center;
  min-height: var(--ctrl-h);
  padding: 0 var(--sp-4);
  border: 1px solid var(--ui-border);
  border-radius: var(--r-md);
  font-size: .9rem;
  color: var(--ui-muted);
}
.seg input:checked + span {
  border-color: var(--ui-accent);
  background: color-mix(in srgb, var(--ui-accent) 18%, transparent);
  color: var(--ui-text);
  font-weight: 650;
}
.seg input:focus-visible + span { outline: 3px solid var(--ui-focus); outline-offset: 2px; }
.segmented--tight .seg span { padding: 0 var(--sp-3); }

/* --------------------------------------------------------------- palette - */

.base-row {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-4);
  flex-wrap: wrap;
  margin-bottom: var(--sp-5);
}
.swatch-input {
  display: block;
  width: 64px; height: 64px;
  border-radius: var(--r-md);
  border: 1px solid var(--ui-border);
  overflow: hidden;
  flex: none;
  cursor: pointer;
}
.swatch-input input[type="color"] {
  width: 200%; height: 200%;
  margin: -25%;
  border: 0; padding: 0;
  background: none;
  cursor: pointer;
}
.base-row__fields { min-width: 200px; }
.base-row__fields .input { max-width: 190px; }
#base-oklch { margin: var(--sp-1) 0 0; }
.base-row__actions { display: flex; gap: var(--sp-2); }

.swatches {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-2);
  min-height: 132px;
}
.sw {
  border: 1px solid var(--ui-border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--ui-surface-2);
}
.sw__face {
  display: block;
  width: 100%;
  height: 86px;
  border: 0;
  padding: var(--sp-2) var(--sp-3);
  background: var(--sw);
  color: var(--sw-ink);
  font: 650 .8rem/1.3 var(--font);
  text-align: left;
  cursor: pointer;
}
.sw__face:hover { filter: brightness(1.06); }
.sw__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-3);
}
.sw__hex { font-family: var(--mono); font-size: .8rem; color: var(--ui-muted); }
.sw__lock {
  width: 30px; height: 30px;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ui-muted);
  cursor: pointer;
  font-size: .95rem;
  line-height: 1;
}
.sw__lock:hover { border-color: var(--ui-border); color: var(--ui-text); }
.sw__lock[aria-pressed="true"] { color: var(--ui-accent); }
.sw--locked { border-color: var(--ui-accent); }

.ramp {
  display: grid;
  grid-template-columns: repeat(11, minmax(0, 1fr));
  gap: 2px;
  min-height: 96px;
}
.ramp__chip {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 96px;
  padding: var(--sp-2) var(--sp-1);
  border: 0;
  border-radius: var(--r-sm);
  background: var(--c);
  color: var(--ink);
  font: 650 .74rem/1 var(--mono);
  cursor: pointer;
  text-align: center;
  min-width: 0;
}
.ramp__chip:hover { filter: brightness(1.08); }
.ramp__hex { font-weight: 400; font-size: .62rem; opacity: .82; overflow: hidden; }
.ramp__chip[data-base="true"] { box-shadow: inset 0 0 0 2px var(--ink); }

/* -------------------------------------------------------------- gradient - */

.grad-preview {
  height: 190px;
  border-radius: var(--r-md);
  border: 1px solid var(--ui-border);
  margin-bottom: var(--sp-4);
  background-image: var(--grad, linear-gradient(135deg, #4f46e5, #f59e0b));
}

.grad-controls {
  display: flex;
  gap: var(--sp-5);
  flex-wrap: wrap;
  align-items: flex-start;
  margin-bottom: var(--sp-5);
}

.dial-row { display: flex; align-items: center; gap: var(--sp-3); }
.dial {
  position: relative;
  width: 62px; height: 62px;
  border-radius: 50%;
  border: 1px solid var(--ui-border);
  background:
    radial-gradient(circle at center, var(--ui-surface-2) 46%, transparent 47%),
    conic-gradient(from 180deg, var(--ui-border), var(--ui-accent), var(--ui-border));
  cursor: grab;
  touch-action: none;
  flex: none;
}
.dial:active { cursor: grabbing; }
.dial__needle {
  position: absolute;
  left: 50%; top: 50%;
  width: 2px; height: 24px;
  margin-left: -1px;
  border-radius: 2px;
  background: var(--ui-text);
  transform-origin: 50% 100%;
  transform: translateY(-100%) rotate(var(--angle, 135deg));
}
.dial[aria-disabled="true"] { opacity: .4; cursor: not-allowed; }

.track {
  position: relative;
  height: 46px;
  border-radius: var(--r-md);
  border: 1px solid var(--ui-border);
  background-image: var(--grad-flat, linear-gradient(90deg, #4f46e5, #f59e0b));
  margin-bottom: var(--sp-4);
  cursor: copy;
}
.handle {
  position: absolute;
  top: 50%;
  left: var(--pos, 0%);
  width: 20px; height: 20px;
  margin: -10px 0 0 -10px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--fx-ink-inv);
  background: var(--c, #000);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .45);
  cursor: grab;
  touch-action: none;
}
.handle:active { cursor: grabbing; }
.handle[data-active="true"] { transform: scale(1.25); }

.stop-list { list-style: none; margin: 0 0 var(--sp-4); padding: 0; display: grid; gap: var(--sp-2); }
.stop {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2);
  border: 1px solid var(--ui-border);
  border-radius: var(--r-md);
  background: var(--ui-surface-2);
}
.stop__color {
  width: 34px; height: 30px;
  padding: 0;
  border: 1px solid var(--ui-border);
  border-radius: var(--r-sm);
  background: none;
  cursor: pointer;
  flex: none;
}
.stop__hex { font-family: var(--mono); font-size: .84rem; flex: 1 1 auto; min-width: 0; }
.stop__pos {
  width: 74px;
  min-height: 30px;
  padding: 0 var(--sp-2);
  border: 1px solid var(--ui-border);
  border-radius: var(--r-sm);
  background: var(--ui-bg);
  color: var(--ui-text);
  font: 400 .85rem/1 var(--mono);
  flex: none;
}
.stop__del {
  width: 30px; height: 30px;
  border: 1px solid var(--ui-border);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ui-muted);
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  flex: none;
}
.stop__del:hover { color: var(--fx-fail); border-color: var(--fx-fail); }
.stop__del[disabled] { opacity: .35; cursor: not-allowed; }

/* -------------------------------------------------------------- contrast - */

.matrix-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
  margin-bottom: var(--sp-4);
}
.legend { margin: 0; font-size: .8rem; color: var(--ui-muted); display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.legend__chip {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  font: 700 .68rem/1.5 var(--mono);
  color: var(--fx-ink);
}
.legend__chip--aaa { background: var(--fx-pass); }
.legend__chip--aa { background: var(--fx-pass-2); }
.legend__chip--lg { background: var(--fx-warn); }
.legend__chip--no { background: var(--fx-fail); color: var(--fx-ink-inv); }

/* layout-check: allow -- the matrix is genuinely wider than the viewport at 15
   colors; this is the one place a nested scroller is the right answer. */
.matrix-scroll {
  overflow-x: auto;
  border: 1px solid var(--ui-border);
  border-radius: var(--r-md);
  min-height: 220px;
}
.matrix { border-collapse: separate; border-spacing: 0; font-size: .78rem; }
.matrix th, .matrix td { padding: 0; border-bottom: 1px solid var(--ui-border); border-right: 1px solid var(--ui-border); }
.matrix tr:last-child th, .matrix tr:last-child td { border-bottom: 0; }
.matrix th:last-child, .matrix td:last-child { border-right: 0; }
.matrix thead th, .matrix tbody th {
  position: sticky;
  background: var(--ui-surface-2);
  z-index: 1;
}
.matrix thead th { top: 0; }
.matrix tbody th { left: 0; text-align: left; }
.matrix thead th:first-child { left: 0; z-index: 2; }
.m-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2);
  min-width: 84px;
  font-family: var(--mono);
  font-weight: 500;
  color: var(--ui-muted);
  white-space: nowrap;
}
.m-dot { width: 14px; height: 14px; border-radius: 4px; background: var(--c); flex: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); }
.cell__btn {
  display: block;
  width: 100%;
  min-width: 84px;
  min-height: 46px;
  padding: var(--sp-2) var(--sp-1);
  border: 0;
  background: var(--bg);
  color: var(--fg);
  font: 650 .82rem/1.25 var(--mono);
  cursor: pointer;
  text-align: center;
}
.cell__btn[aria-pressed="true"] { box-shadow: inset 0 0 0 3px var(--ui-focus); }
.cell__grade { display: block; font-size: .62rem; font-weight: 700; letter-spacing: .05em; opacity: .92; }
.cell--self .cell__btn { opacity: .35; }

.matrix-detail { margin-top: var(--sp-4); min-height: 96px; }
.detail {
  display: flex;
  gap: var(--sp-4);
  flex-wrap: wrap;
  align-items: center;
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--ui-border);
  border-radius: var(--r-md);
  background: var(--ui-surface-2);
}
.detail__demo {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-sm);
  background: var(--bg);
  color: var(--fg);
  min-width: 190px;
}
.detail__demo b { display: block; font-size: 1.35rem; line-height: 1.2; }
.detail__ratio { font: 700 1.5rem/1 var(--mono); }
.detail__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: .84rem; }
.detail__list b { font-family: var(--mono); }
.pass { color: var(--fx-pass); }
.fail { color: var(--fx-fail); }

/* ------------------------------------------------------------------ side - */

.card {
  border: 1px solid var(--ui-border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  background: var(--ui-surface);
  min-width: 0;
}
.card__h {
  margin: 0 0 var(--sp-3);
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ui-muted);
}
.card__note { margin: 0 0 var(--sp-3); font-size: .82rem; color: var(--ui-muted); }
.card .input { max-width: none; margin-bottom: var(--sp-3); }

.chips { display: flex; flex-wrap: wrap; gap: var(--sp-1); margin-bottom: var(--sp-3); }
.chip {
  min-height: 30px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--ui-border);
  border-radius: 999px;
  background: transparent;
  color: var(--ui-muted);
  font: 600 .8rem/1 var(--font);
  cursor: pointer;
}
.chip[aria-selected="true"] {
  background: var(--ui-accent);
  border-color: transparent;
  color: var(--ui-accent-ink);
}

/* layout-check: allow -- the SVG export is long by nature; a bounded code box
   beats pushing the whole side rail off screen. */
.code {
  margin: 0 0 var(--sp-3);
  padding: var(--sp-3);
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--ui-border);
  border-radius: var(--r-sm);
  background: var(--ui-bg);
  font: 400 .74rem/1.55 var(--mono);
  white-space: pre;
  tab-size: 2;
}

.drop {
  display: grid;
  place-content: center;
  gap: var(--sp-1);
  min-height: 110px;
  padding: var(--sp-4);
  border: 2px dashed var(--ui-border);
  border-radius: var(--r-md);
  text-align: center;
  cursor: pointer;
  background: transparent;
}
.drop:hover, .drop[data-over="true"] { border-color: var(--ui-accent); }
.drop__title { margin: 0; font-weight: 650; font-size: .92rem; }
.drop__note { margin: 0; font-size: .76rem; color: var(--ui-muted); }

.extracted { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-3); }
.ext-sw {
  width: 38px; height: 38px;
  border: 1px solid var(--ui-border);
  border-radius: var(--r-sm);
  background: var(--c);
  cursor: pointer;
  padding: 0;
}
.ext-sw:hover { transform: translateY(-2px); }

.recents { display: grid; gap: var(--sp-2); }
.recent {
  display: grid;
  gap: var(--sp-1);
  width: 100%;
  padding: var(--sp-2);
  border: 1px solid var(--ui-border);
  border-radius: var(--r-sm);
  background: transparent;
  cursor: pointer;
  text-align: left;
}
.recent:hover { border-color: var(--ui-accent); }
.recent__strip { display: flex; height: 20px; border-radius: 4px; overflow: hidden; }
.recent__strip i { flex: 1 1 0; }
.recent__meta { font-size: .74rem; color: var(--ui-muted); }
.recents__empty { margin: 0; font-size: .82rem; color: var(--ui-muted); }

/* ----------------------------------------------------------------- prose - */

.prose { margin-bottom: var(--sp-7); }
.prose h2 {
  font-size: 1.35rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: var(--sp-6) 0 var(--sp-3);
  max-width: 32ch;
}
.prose h3 {
  font-size: 1.05rem;
  line-height: 1.35;
  margin: var(--sp-5) 0 var(--sp-2);
  max-width: 46ch;
}
.prose p, .prose li { max-width: 78ch; }
.prose p { margin: 0 0 var(--sp-3); }
.prose ol, .prose ul { margin: 0 0 var(--sp-4); padding-left: 1.35em; }
.prose li { margin-bottom: var(--sp-2); }
.prose li::marker { color: var(--ui-muted); }

.doc-table {
  width: 100%;
  max-width: 78ch;
  border-collapse: collapse;
  margin: 0 0 var(--sp-4);
  font-size: .92rem;
}
.doc-table th, .doc-table td {
  border: 1px solid var(--ui-border);
  padding: var(--sp-2) var(--sp-3);
  text-align: left;
  vertical-align: top;
}
.doc-table thead th { background: var(--ui-surface-2); font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; color: var(--ui-muted); }

.back { margin-top: var(--sp-6); }
.page-doc .lede { margin-bottom: var(--sp-6); }

/* ------------------------------------------------------------------ foot - */

.site-foot {
  border-top: 1px solid var(--ui-border);
  background: var(--ui-surface);
  padding: var(--sp-5) 0;
  font-size: .9rem;
}
.site-foot p { margin: 0 0 var(--sp-2); max-width: 78ch; }
.site-foot__meta { color: var(--ui-muted); font-size: .82rem; margin-bottom: 0; }

/* --------------------------------------------------------------- responsive */

@media (max-width: 1020px) {
  .forge__grid { grid-template-columns: minmax(0, 1fr); }
  .forge__side { border-left: 0; border-top: 1px solid var(--ui-border); }
  .panel { min-height: 0; }
}

@media (max-width: 640px) {
  :root { --sp-5: 18px; --sp-6: 26px; --sp-7: 36px; }
  .forge__main, .forge__side { padding: var(--sp-4); }
  .ramp { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .ramp__chip { height: 74px; }
  .swatches { grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); }
  .grad-preview { height: 150px; }
  .tab { padding: 0 var(--sp-3); font-size: .88rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .ext-sw:hover, .handle[data-active="true"] { transform: none; }
}

@media print {
  .forge__bar, .forge__side, .skip-link, .site-foot { display: none; }
  body { background: #fff; color: #000; }
}
