/* Polymorphic demo kit: the nemradar.com / polymorphic.codes grammar, re-colourable per app.
 * Type: Space Grotesk to read, Share Tech Mono for the instrument furniture (HUD), JetBrains Mono for numbers.
 * Marks: plates with corner ticks, bracketed readouts, dot-matrix numerals, kick rules, a star chart.
 * Each app sets its own palette by overriding the tokens below in its own stylesheet (both themes). The values here
 * are the house defaults, and in this copy (the one that ships beside polymorphic.codes) they follow the site's
 * "signal" look: bone on black (dark) and ink on beige (light); the furniture stays neutral and colour is spent by meaning:
 *   cool (--ice, --deep)  what a model is looking at, and the labels that name a part of an instrument
 *   heat                  what it flags, a failed check, and the one primary action (so --sig is heat)
 *   mint                  what it has confirmed or put right: a check that passed
 *   amber                 a caveat
 * No tinted grounds, no gradient type, no colour-filled buttons: a selected control is bone, never a hue.
 * Readability: running text is never uppercase or tracked; nothing under 11px; reading measure under ~68ch. */

@font-face { font-family: "Space Grotesk"; src: url("./fonts/SpaceGrotesk-Variable.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("./fonts/JetBrainsMono-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Share Tech Mono"; src: url("./fonts/ShareTechMono.woff2") format("woff2"); font-weight: 400; font-display: swap; }

*, *::before, *::after { box-sizing: border-box; }
:root {
  color-scheme: dark;
  --bg: #000; --plate: #080807; --plate-2: #0e0d0c; --glass: rgba(8, 8, 7, .72);
  --hi: #fff; --ink: #ece8e0; --ink-2: #c3beb4; --mut: #8f8a80; --faint: #5c5851;
  --rule: #2c2a26; --rule-2: #1c1b18; --tick: #a39d92;
  --heat: #ff6a2b; --heat-ink: #ff9a6b; --mint: #3fd49a; --mint-ink: #84e9c2;
  --deep: #8f89ff; --deep-ink: #b9b4ff; --ice: #a8dcff; --amber: #ffb14a;
  --sig: var(--heat); --sig-ink: var(--heat-ink);   /* the one signal tone: spend it only on what the eye should go to */
  --good: var(--mint); --warn: var(--amber); --bad: var(--heat); --seal: var(--deep);
  --sans: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --hud: "Share Tech Mono", "JetBrains Mono", ui-monospace, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --halo: 0 0 3px var(--bg), 0 0 8px var(--bg), 0 0 14px var(--bg);   /* HUD text over a live scene */
  --gut: clamp(14px, 2.2vw, 28px);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f1ebdf; --plate: #ebe4d6; --plate-2: #e4dccd; --glass: rgba(241, 235, 223, .78);
  --hi: #000; --ink: #15130f; --ink-2: #36322b; --mut: #6a6458; --faint: #a39b8c;
  --rule: #cdc4b2; --rule-2: #dcd4c4; --tick: #4c473e;
  --heat: #d9480f; --heat-ink: #b53d0d; --mint: #0b8a5c; --mint-ink: #0a6e4a;
  --deep: #4a43d6; --deep-ink: #3a34a8; --ice: #2f66c4; --amber: #b46a00;
}

html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16.5px/1.6 var(--sans); font-feature-settings: "ss01";
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: clip; }
a { color: inherit; }
img, svg, canvas, video { display: block; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
::selection { background: color-mix(in srgb, var(--sig) 42%, transparent); color: var(--hi); }
:focus-visible { outline: 1px solid var(--sig); outline-offset: 3px; }
.pm-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------------ type */
.pm-display { margin: 0; font: 600 clamp(2.3rem, 4.2vw, 4.1rem)/1 var(--sans); letter-spacing: -.037em; color: var(--hi); text-wrap: balance; }
.pm-title { margin: 0; font: 600 clamp(1.6rem, 2.6vw, 2.5rem)/1.06 var(--sans); letter-spacing: -.03em; color: var(--hi); text-wrap: balance; }
.pm-display em, .pm-title em { font-style: normal; font-weight: 300; }
.pm-lede { margin: 0; max-width: 36em; font-size: clamp(1.05rem, 1.3vw, 1.2rem); line-height: 1.6; color: var(--ink-2); text-wrap: pretty; }
.pm-hud { font: 400 11.5px/1.4 var(--hud); letter-spacing: .18em; text-transform: uppercase; color: var(--mut); }
.pm-num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.pm-kick { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; font: 400 12px/1.4 var(--hud); letter-spacing: .22em;
  text-transform: uppercase; color: var(--ink-2); }
.pm-kick::before { content: ""; flex: none; width: 18px; height: 1px; background: var(--sig); }
.pm-cap { font: 400 12.5px/1.6 var(--mono); color: var(--mut); }
.pm-cap b { font-weight: 400; color: var(--ink-2); }

/* ------------------------------------------------------------------ plates: corner ticks are the mark */
.pm-plate { position: relative; background: var(--plate); border: 1px solid var(--rule-2); padding: clamp(14px, 1.8vw, 22px); }
.pm-plate::before, .pm-plate::after { content: ""; position: absolute; width: 14px; height: 14px; border: 1px solid var(--tick); pointer-events: none; }
.pm-plate::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.pm-plate::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }
.pm-plate--sig::before, .pm-plate--sig::after { border-color: var(--sig); }
.pm-plate__head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 18px; flex-wrap: wrap; margin-bottom: 12px; }
.pm-plate__no { font: 400 12px/1 var(--hud); letter-spacing: .22em; text-transform: uppercase; color: var(--deep-ink); }
.pm-plate__title { margin: 0; font: 600 1.12rem/1.28 var(--sans); letter-spacing: -.01em; color: var(--hi); }

/* a glass panel floating over a live scene */
.pm-panel { position: relative; background: var(--glass); border: 1px solid color-mix(in srgb, var(--rule) 80%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2); padding: 12px 14px; }
.pm-panel.pm-ticks::before, .pm-panel.pm-ticks::after { content: ""; position: absolute; width: 12px; height: 12px; border: 1px solid var(--tick); pointer-events: none; }
.pm-panel.pm-ticks::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.pm-panel.pm-ticks::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

/* ------------------------------------------------------------------ bracketed readouts: [ LABEL  value ] */
.pm-brk { position: relative; display: inline-block; padding: 7px 13px 8px 14px; font: 400 12px/1.5 var(--hud); letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-2); text-shadow: var(--halo); }
.pm-brk::before, .pm-brk::after { content: ""; position: absolute; top: 0; bottom: 0; width: 7px; border: 1px solid var(--tick); }
.pm-brk::before { left: 0; border-right: 0; }
.pm-brk::after { right: 0; border-left: 0; }
.pm-brk--sig::before, .pm-brk--sig::after { border-color: var(--sig); }
.pm-brk b { font: 400 13px/1.3 var(--mono); letter-spacing: 0; color: var(--hi); font-variant-numeric: tabular-nums; text-transform: none; }
.pm-brk .pm-row { display: flex; justify-content: space-between; gap: 18px; }
.pm-brk .pm-row:first-child { color: var(--deep-ink); letter-spacing: .16em; }
/* a state word follows its run: cool while the model looks, then whatever --tone the app sets (heat when it finds, mint when it has fixed) */
.pm-state strong { display: block; font: 400 clamp(20px, 2.1vw, 28px)/1.05 var(--hud); letter-spacing: .12em; color: var(--tone, var(--ice)); }

/* ------------------------------------------------------------------ dot-matrix numerals (kit.js renders the SVG) */
.pm-led { display: inline-block; line-height: 1; color: var(--tone, var(--ice)); }
.pm-led .pm-dots { display: inline-block; vertical-align: -.06em; }
.pm-led .pm-dots svg { display: block; height: .8em; width: auto; overflow: visible; }

/* ------------------------------------------------------------------ controls */
.pm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 38px; padding: 0 13px; cursor: pointer;
  font: 400 11.5px/1 var(--hud); letter-spacing: .18em; text-transform: uppercase; white-space: nowrap; color: var(--ink);
  background: transparent; border: 1px solid var(--rule); transition: color .2s, border-color .2s, background-color .2s; }
.pm-btn:hover { color: var(--hi); border-color: var(--ink-2); }
.pm-btn[aria-pressed="true"] { color: var(--hi); border-color: var(--tick); }      /* a switched-on control is bone */
.pm-btn--sig { color: var(--hi); border-color: var(--sig); }                         /* the one primary action is heat, outlined */
.pm-btn--sig:hover { color: var(--bg); background: var(--sig); border-color: var(--sig); }
.pm-btn:disabled { opacity: .45; cursor: default; }
.pm-seg { display: inline-flex; border: 1px solid var(--rule); padding: 2px; gap: 2px; }
.pm-seg button { min-height: 30px; padding: 0 10px; border: 0; background: transparent; cursor: pointer; color: var(--mut);
  font: 400 11px/1 var(--hud); letter-spacing: .16em; text-transform: uppercase; }
.pm-seg button:hover { color: var(--ink); }
.pm-seg button[aria-pressed="true"] { color: var(--hi); background: color-mix(in srgb, var(--ink) 14%, transparent); box-shadow: inset 0 0 0 1px var(--tick); }
.pm-chip { display: inline-flex; align-items: center; gap: 7px; padding: 4px 8px; border: 1px solid var(--rule); font: 400 11px/1.2 var(--hud);
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); }
.pm-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--sig)); flex: none; }
.pm-range { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; cursor: pointer; }
.pm-range::-webkit-slider-runnable-track { height: 2px; background: var(--rule); }
.pm-range::-moz-range-track { height: 2px; background: var(--rule); }
.pm-range::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -6px; border-radius: 50%; background: var(--ink);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ink) 20%, transparent); }
.pm-range::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--ink); }
.pm-live::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 8px; border-radius: 50%; background: var(--sig);
  vertical-align: 1px; animation: pm-pulse 2.4s ease-in-out infinite; }
@keyframes pm-pulse { 50% { opacity: .25; } }

/* ------------------------------------------------------------------ uncertainty band: low [-----|=====|-----] high */
.pm-band { display: inline-grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; min-width: 160px;
  font: 400 11.5px/1 var(--mono); color: var(--mut); font-variant-numeric: tabular-nums; }
.pm-band svg { width: 100%; height: 10px; overflow: visible; }

/* ------------------------------------------------------------------ check-it rows */
.pm-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.pm-check { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 4px 16px; align-items: baseline; padding: 13px 0;
  border-top: 1px solid var(--rule-2); }
.pm-check:first-child { border-top: 0; }
.pm-check__state { justify-self: start; padding: 3px 7px 2px; border: 1px solid currentColor; font: 400 11px/1.3 var(--hud); letter-spacing: .16em;
  text-transform: uppercase; }
.pm-check[data-state="pass"] .pm-check__state { color: var(--good); }
.pm-check[data-state="caveat"] .pm-check__state { color: var(--warn); }
.pm-check[data-state="fail"] .pm-check__state { color: var(--bad); }
.pm-check[data-state="sealed"] .pm-check__state, .pm-check[data-state="pending"] .pm-check__state { color: var(--seal); }
.pm-check__title { margin: 0; font: 500 1rem/1.4 var(--sans); color: var(--hi); }
.pm-check__metric { font: 400 14px/1.3 var(--mono); color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pm-check__detail { grid-column: 2 / -1; margin: 2px 0 0; max-width: 70ch; font-size: .94rem; line-height: 1.55; color: var(--ink-2); }
.pm-check__method { grid-column: 2 / -1; margin: 4px 0 0; font: 400 12px/1.55 var(--mono); color: var(--mut); }

/* ------------------------------------------------------------------ drawer (Sources, Check it, About) */
.pm-drawer { position: fixed; z-index: 60; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); overflow: auto; overscroll-behavior: contain;
  background: var(--bg); border-left: 1px solid var(--rule); padding: 22px clamp(16px, 2.4vw, 28px) 40px; transform: translateX(102%);
  transition: transform .38s var(--ease); }
.pm-drawer[data-open="true"] { transform: none; }
.pm-drawer__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.pm-scrim { position: fixed; inset: 0; z-index: 59; background: color-mix(in srgb, var(--bg) 55%, transparent); opacity: 0; pointer-events: none; transition: opacity .3s; }
.pm-scrim[data-open="true"] { opacity: 1; pointer-events: auto; }
.pm-sources { list-style: none; margin: 0; padding: 0; }
.pm-sources li { padding: 12px 0; border-top: 1px solid var(--rule-2); }
.pm-sources .pm-src__name { margin: 0; font: 500 .98rem/1.4 var(--sans); color: var(--hi); }
.pm-sources .pm-src__meta { margin: 3px 0 0; font: 400 12px/1.55 var(--mono); color: var(--mut); }
.pm-sources .pm-src__meta a { color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; }
.pm-sources .pm-src__use { margin: 4px 0 0; font-size: .92rem; line-height: 1.5; color: var(--ink-2); }

/* ------------------------------------------------------------------ tooltip, loader, attribution, signature, made-for */
.pm-tip { position: fixed; z-index: 50; left: 0; top: 0; pointer-events: none; max-width: 300px; padding: 8px 11px; background: var(--glass);
  border: 1px solid var(--rule); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); font: 400 12.5px/1.5 var(--mono); color: var(--ink);
  opacity: 0; transform: translate(14px, 14px); transition: opacity .12s; }
.pm-tip[data-on="true"] { opacity: 1; }
.pm-tip .pm-hud { display: block; margin-bottom: 3px; color: var(--deep-ink); }
.pm-loader { position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; background: var(--bg); transition: opacity .6s var(--ease); }
.pm-loader[data-done="true"] { opacity: 0; pointer-events: none; }
.pm-loader__inner { display: grid; gap: 12px; width: min(320px, 70vw); }
.pm-loader__bar { height: 1px; background: var(--rule); overflow: hidden; }
.pm-loader__bar i { display: block; height: 100%; width: 0; background: var(--ice); transition: width .25s; }
.pm-attrib { font: 400 11px/1.4 var(--mono); color: var(--mut); text-shadow: var(--halo); }
.pm-attrib a { color: var(--ink-2); }
.pm-sig { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; font: 400 11px/1 var(--hud); letter-spacing: .24em;
  text-transform: uppercase; color: var(--ink-2); }
.pm-sig img { width: 22px; height: 22px; }
:root[data-theme="light"] .pm-sig img { filter: invert(1) brightness(.4); }
.pm-sig:hover { color: var(--hi); }
.pm-madefor { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding: 8px var(--gut); border-bottom: 1px solid var(--rule-2);
  background: var(--plate); font: 400 11.5px/1.5 var(--hud); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); }
.pm-madefor b { font-weight: 400; color: var(--hi); }
.pm-madefor span:last-child { font: 400 12px/1.5 var(--mono); letter-spacing: 0; text-transform: none; color: var(--mut); }

/* ------------------------------------------------------------------ the story below the instrument */
.pm-wrap { width: min(1240px, 100% - 2 * var(--gut)); margin-inline: auto; }
.pm-section { padding: clamp(56px, 8vw, 110px) 0 0; }
.pm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: clamp(16px, 2vw, 26px); }
.pm-foot { margin-top: clamp(72px, 10vw, 130px); padding: 22px 0 44px; border-top: 1px solid var(--rule); display: flex; flex-wrap: wrap;
  justify-content: space-between; gap: 10px 24px; font: 400 11.5px/1.7 var(--hud); letter-spacing: .16em; text-transform: uppercase; color: var(--faint); }
.pm-foot a { color: var(--ink-2); }
.pm-stars { position: fixed; inset: 0; z-index: -1; width: 100%; height: 100%; pointer-events: none; }

@media (max-width: 760px) {
  body { font-size: 16px; }
  .pm-check { grid-template-columns: minmax(0, 1fr) auto; }
  .pm-check__state { grid-column: 1 / -1; }
  .pm-check__detail, .pm-check__method { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
