/*
 * taleseal design tokens — source of truth is brand/GUIDE.md.
 * Eight hues only; everything else is one of these at an opacity.
 * Light is default (paper is the product); dark follows system, and an explicit
 * [data-theme] on <html> wins in both directions.
 */
:root {
  --paper: #f4f1ea;
  --card: #fffdf7;
  --line: #dad5c8;
  --ink: #1c1b18;
  --fog: #b9b4a6;
  --wax: #c13521;
  --wax-base: #8f2415;
  --wax-edge: #7a1f12;
  --sea: #17667a;
  --gold: #c99b2e;

  --text: rgb(from var(--ink) r g b / 0.9);
  --text-2: rgb(from var(--ink) r g b / 0.6);

  /* type */
  --display: "Open Runde", ui-rounded, system-ui, sans-serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  /* readability floor: labels never below 12.5px, body never below 15.5px */
  --text-body: 15.5px;
  --text-label: 12.5px;
  --track-display: -0.02em;
  --track-label: 0.04em;

  /* shape — 4px default, 6px buttons, 2px chips; pills are marketing-hero only */
  --r-chip: 2px;
  --r: 4px;
  --r-btn: 6px;

  /* spacing — 4px base */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-6: 24px;
  --s-8: 32px;
  --s-11: 44px;

  /* paper noise — ground only, never on cards */
  --paper-noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.028'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1b1a17;
    --card: #242320;
    --line: #3a3833;
    --ink: #f2efe6;
    --fog: #6e6a5e;
    --wax: #e8593c;
    --wax-base: #a83c26;
    --wax-edge: #8f2f1c;
    --sea: #4fa3b8;
    --gold: #e3b84a;
  }
}

:root[data-theme="dark"] {
  --paper: #1b1a17;
  --card: #242320;
  --line: #3a3833;
  --ink: #f2efe6;
  --fog: #6e6a5e;
  --wax: #e8593c;
  --wax-base: #a83c26;
  --wax-edge: #8f2f1c;
  --sea: #4fa3b8;
  --gold: #e3b84a;
}

:root[data-theme="light"] {
  --paper: #f4f1ea;
  --card: #fffdf7;
  --line: #dad5c8;
  --ink: #1c1b18;
  --fog: #b9b4a6;
  --wax: #c13521;
  --wax-base: #8f2415;
  --wax-edge: #7a1f12;
  --sea: #17667a;
  --gold: #c99b2e;
}

/* Self-hosted faces per brand/GUIDE.md — served by the app at /fonts/*. */
@font-face {
  font-family: "Open Runde";
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url("/fonts/open-runde-500.woff2") format("woff2");
}
@font-face {
  font-family: "Open Runde";
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url("/fonts/open-runde-700.woff2") format("woff2");
}
/* variable file (latin subset) — covers body 400 and semibold 600 */
@font-face {
  font-family: "IBM Plex Sans";
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
  src: url("/fonts/ibm-plex-sans-var.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("/fonts/ibm-plex-mono-400.woff2") format("woff2");
}

/* Base + component styles for @taleseal/ui. Class prefix: ts- */
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
}
body {
  background: var(--paper);
  background-image: var(--paper-noise);
  color: var(--text);
  font-family: var(--sans);
  font-size: var(--text-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: var(--track-display);
  line-height: 1.05;
  color: var(--ink);
  text-wrap: balance;
  margin: 0 0 var(--s-4);
}
a {
  color: var(--sea);
}
/* buttons are links too — the global hover colour must not repaint them */
a:not(.ts-btn):hover {
  color: var(--wax);
}
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--sea);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  * {
    /* biome-ignore lint/complexity/noImportantStyles: reduced-motion must beat component transitions */
    transition: none !important;
    /* biome-ignore lint/complexity/noImportantStyles: reduced-motion must beat component transitions */
    animation: none !important;
  }
}

.ts-site {
  max-width: 680px;
  margin: 0 auto;
  padding: var(--s-6);
}
.ts-topbar {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) 0 var(--s-8);
}
.ts-wordmark {
  display: inline-flex;
  align-items: center;
}

.ts-lede {
  font-size: 16px;
  color: var(--text-2);
  max-width: 62ch;
}

/* error pages (404, retracted, legacy) — a centred figure like a stamped notice */
.ts-err {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--s-6) 0 var(--s-10);
}
.ts-err h2 {
  font-size: 32px;
}
.ts-err .ts-lede {
  max-width: 46ch;
  margin: 0 0 var(--s-4);
}
.ts-err-art {
  margin-bottom: var(--s-4);
}
.ts-err pre {
  text-align: left;
}

.ts-code {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text);
  margin: 0;
  overflow-x: auto;
}

.ts-eyebrow {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgb(from var(--ink) r g b / 0.78);
  margin: 0 0 var(--s-3);
}

/* the tick anchors the label against the noisy paper ground */
.ts-eyebrow::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 2px;
  border-radius: 1px;
  background: var(--sea);
  vertical-align: 0.28em;
  margin-right: 10px;
}

.ts-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: var(--s-4) var(--s-4);
  margin: var(--s-4) 0;
}

.ts-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  font-family: var(--mono);
  font-size: var(--text-label);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.ts-meta > span + span::before {
  content: "·";
  margin-right: var(--s-2);
  color: var(--fog);
}

/* Primary: the pressed-3D wax stack. Secondary: flat card face. */
.ts-btn {
  display: inline-block;
  font: 600 13.5px var(--sans);
  border-radius: var(--r-btn);
  padding: 9px 18px;
  cursor: pointer;
  text-decoration: none;
}
.ts-btn-primary {
  color: #fffdf7;
  background: var(--wax);
  border: 1px solid var(--wax-edge);
  box-shadow: 0 2px 0 var(--wax-base);
  transform: translateY(0);
  transition:
    transform 0.06s,
    box-shadow 0.06s;
}
.ts-btn-primary:hover {
  filter: brightness(1.05);
}
.ts-btn-primary:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 var(--wax-base);
}
.ts-btn-secondary {
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
}
.ts-btn-secondary:hover {
  border-color: var(--fog);
}

/* Solid status pill — verdict marker. Text colours picked so both themes pass 4.5:1. */
.ts-pill {
  display: inline-block;
  font: 600 var(--text-label) var(--mono);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  border-radius: var(--r-chip);
  padding: 3px 10px;
  white-space: nowrap;
}
.ts-pill-good {
  background: var(--sea);
  color: var(--paper);
}
.ts-pill-warn {
  background: var(--gold);
  color: #1c1b18;
}
.ts-pill-bad {
  background: var(--wax);
  color: var(--paper);
}
.ts-pill-neutral {
  background: var(--card);
  color: var(--text-2);
  border: 1px solid var(--line);
}

.ts-stamp {
  display: inline-grid;
  place-items: center;
  font-family: var(--mono);
  color: var(--card);
}
.ts-stamp svg {
  display: block;
}
