/* embeddedTR — design tokens & base
   Aesthetic: engineering grid + developer-clean + warm community
   Type: Space Grotesk (display) / IBM Plex Sans (body) / JetBrains Mono (labels,code)
*/

:root {
  /* accent is injected at runtime via --accent (tweakable) */
  --accent: #E11D48;
  --accent-2: color-mix(in oklab, var(--accent) 78%, #ff7a45 22%);
  --accent-soft: color-mix(in oklab, var(--accent) 12%, var(--surface));
  --accent-ink: #ffffff;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 22px;

  --maxw: 1200px;
  --gutter: clamp(20px, 4vw, 56px);

  /* density (data-density) */
  --sp: 1;
  --section-y: calc(96px * var(--sp));

  --shadow-sm: 0 1px 2px rgba(26,23,20,.06), 0 1px 1px rgba(26,23,20,.04);
  --shadow-md: 0 8px 24px -12px rgba(26,23,20,.22), 0 2px 6px rgba(26,23,20,.06);
  --shadow-lg: 0 30px 60px -24px rgba(26,23,20,.30);

  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;
}

/* ---- LIGHT (default) ---- */
:root, [data-theme="light"] {
  --paper: #FAF8F4;
  --surface: #FFFFFF;
  --surface-2: #F3EFE8;
  --surface-3: #ECE6DB;
  --ink: #1A1714;
  --ink-2: #5C554C;
  --ink-3: #8A8377;
  --line: #E6DFD3;
  --line-strong: #D8CFBF;
  --grid: rgba(26,23,20,.045);
  --code-bg: #1c1916;
  --code-ink: #ece4d6;
}

/* ---- DARK ---- */
[data-theme="dark"] {
  --paper: #0D0C0B;
  --surface: #161310;
  --surface-2: #1E1A15;
  --surface-3: #262019;
  --ink: #F4EFE6;
  --ink-2: #ABA293;
  --ink-3: #756E62;
  --line: rgba(255,255,255,.09);
  --line-strong: rgba(255,255,255,.16);
  --grid: rgba(255,255,255,.04);
  --code-bg: #0a0908;
  --code-ink: #ece4d6;
  --accent-soft: color-mix(in oklab, var(--accent) 22%, var(--surface));
  --shadow-md: 0 8px 30px -14px rgba(0,0,0,.7), 0 2px 6px rgba(0,0,0,.4);
  --shadow-lg: 0 40px 80px -30px rgba(0,0,0,.8);
}

[data-density="compact"] { --sp: .72; }
[data-density="comfy"]   { --sp: 1.18; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.6;
  overflow-x: hidden;
}

::selection { background: var(--accent); color: var(--accent-ink); }

h1,h2,h3,h4 { font-family: var(--font-display); margin: 0; line-height: 1.05; letter-spacing: -.02em; font-weight: 600; color: var(--ink); }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }

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

/* monospace eyebrow / kicker */
.kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.kicker::before {
  content: "";
  width: 22px; height: 1px;
  background: var(--accent);
  opacity: .7;
}

.section { padding-block: var(--section-y); position: relative; }

.section-head { max-width: 640px; margin-bottom: calc(48px * var(--sp)); }
.section-head h2 { font-size: clamp(28px, 3.6vw, 46px); margin-top: 16px; }
.section-head p { color: var(--ink-2); font-size: clamp(16px, 1.3vw, 18px); margin-top: 14px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-mono);
  font-weight: 500; font-size: 14px; letter-spacing: .01em;
  padding: 13px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: transform .15s ease, background .2s ease, box-shadow .2s ease, border-color .2s ease, color .2s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 18px -8px var(--accent); }
.btn-primary:hover { background: color-mix(in oklab, var(--accent) 88%, #000); box-shadow: 0 10px 26px -10px var(--accent); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--ink-3); }
.btn-sm { padding: 9px 15px; font-size: 13px; }

/* chips / tags */
.tag {
  font-family: var(--font-mono);
  font-size: 11.5px; font-weight: 500; letter-spacing: .03em;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.tag-accent { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in oklab, var(--accent) 30%, transparent); }

/* card */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

/* engineering grid backdrop helper */
.gridlines {
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 34px 34px;
}

/* small focus ring for a11y */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* reveal-on-scroll — base state is ALWAYS visible (safe for print/PDF and
   non-compositing contexts). Entrance is a pure enhancement: it only hides +
   animates when JS marks the page ready AND motion is allowed. */
.reveal { opacity: 1; transform: none; }
@media (prefers-reduced-motion: no-preference) {
  html[data-anim="on"] .reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s cubic-bezier(.2,.7,.2,1), transform .6s cubic-bezier(.2,.7,.2,1); }
  html[data-anim="on"] .reveal.in { opacity: 1; transform: none; }
}

/* divider with mono coordinate */
.rule { height: 1px; background: var(--line); width: 100%; }

#app { min-height: 100vh; }
