/*
 * styles.css — the demo's whole look, in the article's visual language:
 * cream paper, the red person, the blue system, Montserrat for UI and
 * IBM Plex Mono for labels.
 *
 * Structure: 1 tokens · 2 base · 3 layout · 4 viewer · 5 panel · 6 controls
 *            7 code · 8 notes & footer · 9 states & motion
 */

/* ---------------------------------------------------------------- 1 tokens */

@font-face { font-family: "Montserrat"; font-weight: 400; font-display: swap; src: url("/fonts/montserrat-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 500; font-display: swap; src: url("/fonts/montserrat-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 600; font-display: swap; src: url("/fonts/montserrat-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 700; font-display: swap; src: url("/fonts/montserrat-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Plex Mono"; font-weight: 400; font-display: swap; src: url("/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Plex Mono"; font-weight: 500; font-display: swap; src: url("/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }

:root {
  --paper: #f3eee4;
  --surface: #fffdf9;
  --sunken: #f1ebe1;
  --line: #e4dccf;
  --ink: #1a1a1a;
  --ink-2: #4a453e;
  --ink-3: #69635a;          /* 5.1:1 on paper, AA for small text */
  --person: #e0412a;
  --system: #2a6cb4;
  --system-strong: #1f5592;
  --system-soft: #e7eff9;
  --warn: #b13a26;
  --warn-soft: #fbe7e2;

  --radius-l: 24px;
  --radius-m: 14px;
  --radius-s: 10px;
  --shadow: 0 1px 0 rgba(60, 40, 10, .04), 0 12px 32px -18px rgba(60, 40, 10, .28);
  --ring: 0 0 0 2px var(--surface), 0 0 0 4px var(--system);
  --ease: cubic-bezier(.22, .8, .24, 1);
  --fast: 160ms;
  --slow: 320ms;

  --mono: "Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --sans: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ------------------------------------------------------------------ 2 base */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 500 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
a { color: var(--system); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--system-strong); }
button, input { font: inherit; color: inherit; }
code { font-family: var(--mono); font-size: .9em; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }

.mono { font-family: var(--mono); font-weight: 500; letter-spacing: .14em; text-transform: uppercase; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip {
  position: absolute; left: 16px; top: -48px; z-index: 10;
  padding: 10px 14px; border-radius: 10px; background: var(--ink); color: #fff;
  transition: top var(--fast) var(--ease);
}
.skip:focus { top: 12px; color: #fff; }

/* Smoother, squircle-like corners where the browser supports them. */
@supports (corner-shape: squircle) {
  .viewer, .panel, .notes article, .code-block, .sample, .button, .segmented, .status, .chip {
    corner-shape: superellipse(1.4);
  }
}

/* ---------------------------------------------------------------- 3 layout */

.top, main, .foot {
  width: min(1180px, 100% - 2 * clamp(16px, 4vw, 40px));
  margin-inline: auto;
}
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding-block: 20px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; letter-spacing: -.01em; }
.brand-mark { position: relative; width: 28px; height: 22px; }
.brand-mark i { position: absolute; left: 0; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--person); }
.brand-mark b {
  position: absolute; right: 0; top: 0; width: 16px; height: 16px; background: var(--system);
  background-image: linear-gradient(rgba(255,255,255,.4) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.4) 1px, transparent 1px);
  background-size: 5.33px 5.33px; mix-blend-mode: multiply;
}
.top-link { font-size: 14px; font-weight: 600; text-decoration: none; }

.intro { max-width: 760px; padding: clamp(28px, 6vw, 72px) 0 clamp(24px, 4vw, 40px); }
.kicker { font-size: 12px; color: var(--ink-3); margin-bottom: 16px; }
h1 { font-size: clamp(34px, 5.2vw, 60px); line-height: 1.04; letter-spacing: -.035em; font-weight: 700; }
.lede { margin-top: 20px; font-size: clamp(17px, 1.6vw, 19px); color: var(--ink-2); max-width: 640px; }
.lede strong { color: var(--ink); font-weight: 600; }

.bench {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr);
  gap: 20px;
  align-items: start;
}
@media (max-width: 960px) {
  .bench { grid-template-columns: minmax(0, 1fr); }
}

/* ---------------------------------------------------------------- 4 viewer */

.viewer {
  margin: 0;
  background: var(--surface);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow);
  padding: 12px;
  position: sticky; top: 16px;
}
@media (max-width: 960px) { .viewer { position: static; } }

.stage {
  position: relative;
  aspect-ratio: 4 / 3.4;
  border-radius: 16px;
  overflow: hidden;
  background-color: var(--sunken);
  background-image: radial-gradient(rgba(42, 108, 180, .14) 1px, transparent 1.2px);
  background-size: 16px 16px;
  isolation: isolate;
}
@media (max-width: 600px) { .stage { aspect-ratio: 3 / 3.6; } }

.frame { position: absolute; inset: 0; --pos: 50%; }
.canvas { position: absolute; inset: 14px; }
.layer {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain;
  user-select: none; -webkit-user-drag: none;
}
.layer.copy { clip-path: inset(0 0 0 var(--pos)); }

.divider {
  position: absolute; top: 0; bottom: 0; left: var(--pos);
  width: 2px; margin-left: -1px;
  background: #fff;
  box-shadow: 0 0 0 .5px rgba(0,0,0,.18), 0 0 18px rgba(0,0,0,.18);
  pointer-events: none;
}
.knob {
  position: absolute; top: 50%; left: 50%;
  width: 44px; height: 44px; margin: -22px 0 0 -22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.12), 0 8px 20px -6px rgba(0,0,0,.3);
  transition: scale var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.knob::before, .knob::after {
  content: ""; position: absolute; top: 50%; width: 7px; height: 7px; margin-top: -3.5px;
  border: solid var(--ink); border-width: 0 0 1.8px 1.8px; border-radius: 1px;
}
.knob::before { left: 12px; rotate: 45deg; }
.knob::after { right: 12px; rotate: -135deg; }
.frame:has(.compare:focus-visible) .knob { box-shadow: var(--ring), 0 8px 20px -6px rgba(0,0,0,.3); }
.frame:has(.compare:active) .knob { scale: .92; }

.compare {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0;
  opacity: 0; cursor: ew-resize;
  -webkit-appearance: none; appearance: none;
  touch-action: pan-y;
}

.chip {
  position: absolute; top: 12px;
  padding: 7px 10px; border-radius: 999px;
  font-size: 11px; line-height: 1;
  background: rgba(26, 26, 26, .78); color: #fff;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  pointer-events: none;
  transition: opacity var(--fast) var(--ease);
}
.chip-left { left: 12px; }
.chip-right { right: 12px; background: rgba(42, 108, 180, .9); }

/* 100% views: one layer at its real pixel size, panned inside the stage. */
.stage[data-view="copy"] .frame, .stage[data-view="original"] .frame { overflow: auto; cursor: grab; overscroll-behavior: contain; }
.stage[data-view="copy"] .frame.panning, .stage[data-view="original"] .frame.panning { cursor: grabbing; }
.stage:is([data-view="copy"], [data-view="original"]) .canvas { position: relative; inset: auto; width: var(--w); height: var(--h); }
.stage:is([data-view="copy"], [data-view="original"]) .layer { object-fit: fill; clip-path: none; }
.stage:is([data-view="copy"], [data-view="original"]) :is(.divider, .compare) { display: none; }
.stage[data-view="copy"] .layer.original, .stage[data-view="original"] .layer.copy { visibility: hidden; }
.stage[data-view="copy"] .chip-left, .stage[data-view="original"] .chip-right { opacity: 0; }
.stage[data-view="original"] .chip-left { left: 12px; }
.stage[data-view="copy"] .chip-right { right: 12px; }

/* Single-image results (original kept, or no copy): no compare line. */
.stage[data-single] :is(.divider, .compare, .chip-right) { display: none; }
.stage[data-single] .layer.copy { visibility: hidden; }

.placeholder {
  position: absolute; inset: 0;
  display: grid; place-content: center; justify-items: center; gap: 14px;
  text-align: center; padding: 24px;
  color: var(--ink-2); font-size: 15px; font-weight: 600;
  background: inherit;
  transition: opacity var(--slow) var(--ease), visibility var(--slow);
}
.stage:not([data-state="empty"], [data-state="loading"], [data-state="working"]) .placeholder { opacity: 0; visibility: hidden; }
.stage[data-state="working"] .placeholder { background: rgba(241, 235, 225, .72); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2.5px solid rgba(42,108,180,.18); border-top-color: var(--system);
  animation: spin 800ms linear infinite;
  display: none;
}
.stage:is([data-state="loading"], [data-state="working"]) .spinner { display: block; }
.placeholder .progress { width: 180px; height: 4px; border-radius: 2px; background: rgba(42,108,180,.15); overflow: hidden; }
.placeholder .progress span { display: block; height: 100%; width: var(--p, 0%); background: var(--system); border-radius: 2px; transition: width 120ms linear; }

.viewer-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px 16px; padding: 12px 4px 2px;
}
.hint { font-size: 13px; color: var(--ink-3); }

/* ----------------------------------------------------------------- 5 panel */

.rail { display: grid; gap: 12px; align-content: start; }

/* Native unit (sponsor or house): same quiet card as Carbon's. */
.ad-slot { position: relative; }
.ad-native {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; border-radius: var(--radius-m);
  background: rgba(255, 253, 249, .6); box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink-2); text-decoration: none; font-size: 13.5px; line-height: 1.45;
  transition: box-shadow var(--fast) var(--ease), background var(--fast) var(--ease);
}
.ad-native:hover { color: var(--ink-2); background: var(--surface); box-shadow: inset 0 0 0 1px #cfc5b5; }
.ad-native:focus-visible { box-shadow: var(--ring); }
.ad-logo { width: 48px; height: 48px; border-radius: 10px; flex: none; object-fit: cover; }
.ad-body { display: grid; gap: 4px; padding-right: 64px; }
.ad-title { color: var(--ink); font-weight: 700; }
.ad-cta { color: var(--system); font-weight: 600; }
.ad-label { position: absolute; top: 14px; right: 14px; font-size: 9.5px; color: var(--ink-3); pointer-events: none; }

/* Carbon ad: one small, clearly labelled unit in the page's own style. */
.ad-slot #carbonads {
  display: block; position: relative;
  padding: 14px; border-radius: var(--radius-m);
  background: rgba(255, 253, 249, .6); box-shadow: inset 0 0 0 1px var(--line);
  font-size: 13px; line-height: 1.45; color: var(--ink-2);
}
.ad-slot #carbonads a { color: inherit; text-decoration: none; }
.ad-slot #carbonads .carbon-wrap { display: flex; gap: 12px; align-items: flex-start; }
.ad-slot #carbonads .carbon-img img { width: 100px; height: auto; border-radius: 8px; }
.ad-slot #carbonads .carbon-text { display: block; padding-right: 24px; }
.ad-slot #carbonads .carbon-poweredby {
  position: absolute; right: 12px; bottom: 10px;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3);
}

.panel {
  background: var(--surface);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow);
  padding: 8px 24px 24px;
}
.group { border: 0; margin: 0; padding: 20px 0; min-width: 0; }
.group + .group { border-top: 1px solid var(--line); }
/* Float the legend so it sits inside the fieldset, not on its border. */
legend { float: left; width: 100%; }
legend + * { clear: both; }
legend, .legend {
  display: flex; align-items: center; gap: 10px;
  padding: 0; margin-bottom: 14px;
  font-size: 16px; font-weight: 700; letter-spacing: -.01em;
}
.num {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--ink); color: #fff;
  font-size: 11px; letter-spacing: 0;
}
.fine { margin-top: 12px; font-size: 13px; color: var(--ink-3); }

.samples { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sample { position: relative; display: block; cursor: pointer; border-radius: var(--radius-m); }
.sample input { position: absolute; opacity: 0; pointer-events: none; }
.sample .card {
  display: grid; grid-template-columns: 48px 1fr; align-items: center; gap: 10px;
  padding: 8px; border-radius: var(--radius-m);
  background: var(--sunken);
  box-shadow: inset 0 0 0 1px transparent;
  transition: background var(--fast) var(--ease), box-shadow var(--fast) var(--ease), translate var(--fast) var(--ease);
}
.sample img { width: 48px; height: 48px; border-radius: 9px; object-fit: cover; background: var(--line); }
.sample .name { font-size: 13px; font-weight: 600; line-height: 1.25; }
.sample .meta { display: block; font-size: 12px; color: var(--ink-3); font-weight: 500; margin-top: 2px; font-variant-numeric: tabular-nums; }
.sample:hover .card { background: #ece4d7; }
.sample input:checked + .card { background: var(--system-soft); box-shadow: inset 0 0 0 1.5px var(--system); }
.sample input:focus-visible + .card { box-shadow: var(--ring); }
.sample input:checked + .card .name { color: var(--system-strong); }

.own { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.own .button { flex: 1 1 160px; }
.touch-only { display: none !important; }
@media (pointer: coarse) { .touch-only { display: inline-flex !important; } }

/* -------------------------------------------------------------- 6 controls */

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px;
  border: 0; border-radius: 999px;
  font-size: 14.5px; font-weight: 600; text-decoration: none;
  cursor: pointer; user-select: none;
  transition: background var(--fast) var(--ease), box-shadow var(--fast) var(--ease), scale var(--fast) var(--ease), opacity var(--fast);
}
.button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.button:active { scale: .98; }
.button.primary { width: 100%; background: var(--system); color: #fff; }
.button.primary:hover { background: var(--system-strong); color: #fff; }
.button.secondary { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.button.secondary:hover { box-shadow: inset 0 0 0 1.5px #cfc5b5; }
.button.ghost { min-height: 38px; padding: 0 14px; background: rgba(255,255,255,.08); color: #f3eee4; box-shadow: inset 0 0 0 1px rgba(243,238,228,.2); }
.button.ghost:hover { background: rgba(255,255,255,.14); }
.button[aria-disabled="true"] { opacity: .4; pointer-events: none; }
label.button:has(+ input:focus-visible) { box-shadow: var(--ring); }

.segmented {
  display: inline-flex; padding: 4px; gap: 2px;
  border-radius: 12px; background: var(--sunken);
}
.segmented.wide { display: flex; }
.segmented label { position: relative; flex: 1; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: grid; place-items: center;
  min-height: 36px; padding: 0 12px; border-radius: 9px;
  font-size: 13.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.segmented label:hover span { color: var(--ink); }
.segmented input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(60,40,10,.12), 0 2px 8px -4px rgba(60,40,10,.2); }
.segmented input:focus-visible + span { box-shadow: var(--ring); }
.segmented input:disabled + span { opacity: .4; cursor: not-allowed; }
@media (max-width: 420px) { .viewer-bar .segmented { display: flex; width: 100%; } .viewer-bar .segmented span { padding: 0 6px; font-size: 12.5px; } }

/* Size meter: echoes the animations in the article. */
.meter { position: relative; display: grid; gap: 10px; padding: 4px 0 26px; }
.meter-row { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 10px; }
.meter-row .mono { font-size: 10.5px; color: var(--ink-3); }
.track { position: relative; height: 10px; border-radius: 5px; background: var(--sunken); overflow: hidden; }
.bar {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0;
  border-radius: 5px; background: var(--system);
  transition: width 700ms var(--ease), background var(--slow) var(--ease);
}
.bar.over { background: var(--person); }
.limit {
  position: absolute; top: -2px; bottom: 18px; width: 2px; margin-left: -1px;
  left: calc(80px + (100% - 80px) * var(--at, .5));
  background: var(--ink); border-radius: 1px;
  transition: left 500ms var(--ease);
}
.limit span { position: absolute; top: calc(100% + 6px); left: 50%; translate: -50% 0; font-size: 10px; white-space: nowrap; color: var(--ink); }

.stats {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px; margin: 0 0 14px;
  background: var(--line); border-radius: var(--radius-m); overflow: hidden;
}
.stats div { background: var(--surface); padding: 12px 14px; }
.stats dt { font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.stats dd { margin: 4px 0 0; font-size: 18px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.stats dd small { display: block; font-size: 12px; font-weight: 500; color: var(--ink-3); letter-spacing: 0; }

.status {
  position: relative; margin-bottom: 14px;
  padding: 14px 16px 14px 46px; border-radius: var(--radius-m);
  background: var(--sunken); color: var(--ink-2);
  font-size: 14px; line-height: 1.5;
  transition: background var(--slow) var(--ease), color var(--slow) var(--ease);
}
.status::before {
  content: ""; position: absolute; left: 16px; top: 16px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--ink-3);
  -webkit-mask: var(--icon) center / 18px no-repeat; mask: var(--icon) center / 18px no-repeat;
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Ccircle cx='9' cy='9' r='8' fill='black'/%3E%3C/svg%3E");
}
.status strong { color: var(--ink); font-weight: 700; }
.status[data-tone="ok"] { background: var(--system-soft); }
.status[data-tone="ok"]::before { background: var(--system); --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath fill='black' d='M9 0a9 9 0 1 1 0 18A9 9 0 0 1 9 0zm3.8 5.6-4.9 5L5.2 8 4 9.2l3.9 3.8 6.1-6.2z'/%3E%3C/svg%3E"); }
.status[data-tone="warn"] { background: var(--warn-soft); color: #6d2a1d; }
.status[data-tone="warn"] strong { color: var(--warn); }
.status[data-tone="warn"]::before { background: var(--warn); --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath fill='black' d='M9 0a9 9 0 1 1 0 18A9 9 0 0 1 9 0zm1 12H8v2h2zm0-8H8v6h2z'/%3E%3C/svg%3E"); }
.status[data-tone="info"]::before { background: var(--ink-2); --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath fill='black' d='M9 0a9 9 0 1 1 0 18A9 9 0 0 1 9 0zm1 7H8v7h2zm0-3H8v2h2z'/%3E%3C/svg%3E"); }

/* ------------------------------------------------------------------ 7 code */

.code {
  margin-top: 20px;
  background: #171614; color: #ece6da;
  border-radius: var(--radius-l);
  padding: clamp(20px, 3vw, 32px);
}
.code-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.code h2 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.code .fine { color: #b5ad9f; }
.code .fine code { color: #ece6da; }
.code-block {
  margin: 18px 0 0; padding: 20px 22px;
  background: #0f0e0d; border-radius: var(--radius-m);
  overflow-x: auto;
  font: 400 13.5px/1.7 var(--mono);
  tab-size: 2;
}
.code-block:focus-visible { box-shadow: 0 0 0 2px #171614, 0 0 0 4px #7fb0ec; }
.tok-k { color: #8fb8ea; }
.tok-s { color: #f0ab93; }
.tok-n { color: #e9c983; }
.tok-c { color: #8c857a; font-style: italic; }
.tok-f { color: #f3eee4; font-weight: 500; }

/* ------------------------------------------------------- 8 notes & footer */

.notes {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px;
  margin: 20px 0 0;
}
@media (max-width: 860px) { .notes { grid-template-columns: minmax(0, 1fr); } }
.notes article {
  padding: 22px 22px 24px; border-radius: var(--radius-l);
  background: rgba(255, 253, 249, .55); box-shadow: inset 0 0 0 1px var(--line);
}
.notes h3 { font-size: 16px; font-weight: 700; letter-spacing: -.01em; margin-bottom: 8px; }
.notes p { font-size: 14.5px; color: var(--ink-2); }

.foot {
  display: grid; gap: 6px;
  padding: 40px 0 calc(48px + env(safe-area-inset-bottom));
  font-size: 13px; color: var(--ink-3);
}

/* Origin: where the demo comes from. Quiet, warm, no sales. */
.origin { margin: clamp(56px, 8vw, 96px) 0 0; }
.origin h2 { max-width: 760px; font-size: clamp(26px, 3.2vw, 36px); line-height: 1.12; letter-spacing: -.025em; font-weight: 700; }
.origin-lede { max-width: 680px; margin-top: 16px; font-size: 17px; color: var(--ink-2); }
.origin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 28px; }
@media (max-width: 760px) { .origin-grid { grid-template-columns: minmax(0, 1fr); } }
.origin-card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 24px; border-radius: var(--radius-l);
  background: var(--surface); box-shadow: var(--shadow);
}
.origin-card h3 { font-size: 18px; font-weight: 700; letter-spacing: -.015em; }
.origin-card p { font-size: 15px; color: var(--ink-2); }
.origin-card code { color: var(--ink); }
.origin-links { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: auto 0 0; padding: 6px 0 0; list-style: none; }
.origin-links a { font-size: 14.5px; font-weight: 600; text-decoration: none; }
.origin-links a:hover { text-decoration: underline; }
.origin-logo { display: block; margin-bottom: 6px; }
.logo-compresso { width: 44px; height: 44px; filter: drop-shadow(0 4px 10px rgba(0,0,0,.18)); }
.logo-book {
  width: 44px; height: 66px; object-fit: cover; border-radius: 2px 4px 4px 2px;
  box-shadow: inset 3px 0 4px -2px rgba(0,0,0,.25), 0 1px 1px rgba(60,40,10,.12), 0 8px 16px -8px rgba(60,40,10,.45);
}
.origin-coda { margin-top: 24px; font-size: 15px; color: var(--ink-3); font-style: italic; }

/* -------------------------------------------------------- 9 states & motion */

.dropzone {
  position: fixed; inset: 12px; z-index: 20;
  display: grid; place-items: center;
  border-radius: 28px; border: 2px dashed var(--system);
  background: rgba(231, 239, 249, .86);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  font-size: 20px; font-weight: 700; color: var(--system-strong);
  opacity: 0; visibility: hidden; transition: opacity var(--fast) var(--ease), visibility var(--fast);
}
body.dragging .dropzone { opacity: 1; visibility: visible; }

.layer { transition: opacity var(--slow) var(--ease); }
.stage[data-state="loading"] .layer { opacity: 0; }

@keyframes spin { to { rotate: 360deg; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; scroll-behavior: auto !important; }
  .spinner { animation: none; border-top-color: var(--system); }
}

@media (forced-colors: active) {
  .divider { background: CanvasText; }
  .knob, .chip, .num { forced-color-adjust: none; }
  .sample input:checked + .card, .segmented input:checked + span { outline: 2px solid Highlight; }
}
