/* ---------- Fonts ---------- */

@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/fonts/newsreader.latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/fonts/newsreader.latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Newsreader";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/newsreader-italic.latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Newsreader";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/newsreader-italic.latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/jetbrains-mono.latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/jetbrains-mono.latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/jetbrains-mono-italic.latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/jetbrains-mono-italic.latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Tokens ---------- */

:root {
  /* Dark theme (default — see spec §6.2) */
  --bg: #0f0f0e;
  --bg-elev: #161614;
  --fg: #e8e6e1;
  --fg-muted: #8a8884;
  --accent: #ff7a3d;
  --border: rgba(255, 255, 255, 0.12);
  --code-bg: rgba(255, 255, 255, 0.04);

  --font-display: "Newsreader", Georgia, "Times New Roman", serif;
  --font-body: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --measure: 72ch;
  --measure-hero: 80ch;

  /* Spacing scale */
  --s-1: 0.5rem;
  --s-2: 1rem;
  --s-3: 1.5rem;
  --s-4: 2rem;
  --s-5: 3rem;
  --s-6: 4rem;
  --s-7: 6rem;
}

[data-theme="light"] {
  --bg: #f8f5f0;
  --bg-elev: #ffffff;
  --fg: #1a1a1a;
  --fg-muted: #6b6b6b;
  --accent: #c84a1a;
  --border: rgba(0, 0, 0, 0.12);
  --code-bg: rgba(0, 0, 0, 0.04);
}

/* ---------- Reset ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body, h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; }

/* ---------- Base ---------- */

html {
  background: var(--bg);
  color: var(--fg);
}

body {
  font-family: var(--font-body);
  font-size: clamp(0.95rem, 0.85rem + 0.3vw, 1.05rem);
  line-height: 1.65;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding: clamp(var(--s-3), 4vw, var(--s-5)) clamp(var(--s-2), 5vw, var(--s-5));
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

main, footer { width: 100%; max-width: var(--measure); }
header.hero    { width: 100%; max-width: var(--measure-hero); }

/* ---------- Typography ---------- */

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--fg);
}

h1 {
  font-size: clamp(2.5rem, 1.8rem + 3.5vw, 4rem);
  margin-block: var(--s-3) var(--s-2);
}

h2 {
  font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.1rem);
  margin-block: var(--s-5) var(--s-3);
}

h2::before {
  content: "";
  display: block;
  width: 3rem;
  height: 1px;
  background: var(--accent);
  margin-block-end: var(--s-2);
}

h3 {
  font-size: clamp(1.15rem, 1rem + 0.4vw, 1.3rem);
  margin-block: var(--s-4) var(--s-2);
}

p { margin-block-end: var(--s-2); }
p:last-child { margin-block-end: 0; }

em { font-style: italic; }
strong { font-weight: 600; color: var(--fg); }

/* ---------- Hero ---------- */

.hero {
  padding-block: var(--s-2) var(--s-3);
}

/* Hero → first section transition: tight, intentional. The 6rem h2 margin is
   meant for between-section breathing room, not for the hero hand-off. */
main > section:first-of-type > h2 {
  margin-block-start: var(--s-3);
}

.eyebrow {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-block: 0 var(--s-3);
}

.lede {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 1rem + 1vw, 1.6rem);
  line-height: 1.35;
  margin-block: var(--s-3) var(--s-3);
}

.lede strong {
  font-weight: 600;
  color: var(--fg);
}

.hero-body {
  color: var(--fg-muted);
  max-width: 68ch;
  margin-block-end: var(--s-4);
}

.hero-body em { color: var(--fg); }

/* ---------- Links & CTAs ---------- */

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}

a:hover { text-decoration-thickness: 2px; }
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.cta {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  display: inline-flex;
  align-items: baseline;
  gap: 0.35em;
  border-bottom: 1px solid transparent;
  transition: border-color 120ms ease, color 120ms ease;
}

.cta:hover {
  text-decoration: none;
  border-bottom-color: var(--accent);
}

.cta .arrow {
  display: inline-block;
  transition: transform 150ms ease;
}

.cta:hover .arrow { transform: translateX(2px); }

.cta.inline { white-space: normal; }

/* Primary CTA — visually weighted heavier than .cta. Discovery call is the
   primary conversion (paid filter test, refundable on engagement). */
.cta.primary {
  font-weight: 600;
  border-bottom: 1px solid var(--accent);
  padding-block-end: 2px;
}

.cta.primary:hover {
  border-bottom-width: 2px;
  padding-block-end: 1px;
}

/* Muted CTA — visually de-emphasized secondary option. */
.cta.muted {
  color: var(--fg-muted);
  font-weight: 400;
}

.cta.muted:hover { color: var(--fg); border-bottom-color: var(--fg); }

.cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  margin-block-start: var(--s-3);
}

.cta-sep {
  color: var(--fg-muted);
  user-select: none;
}

/* ---------- Sections ---------- */

section { margin-block-end: var(--s-5); }
section:last-child { margin-block-end: 0; }

section article { margin-block-end: var(--s-4); }
section article:last-child { margin-block-end: 0; }

.meta {
  color: var(--fg-muted);
  font-weight: 400;
  font-size: 0.85em;
  font-family: var(--font-body);
  letter-spacing: 0;
}

.callout {
  border-inline-start: 2px solid var(--accent);
  padding-inline-start: var(--s-2);
  color: var(--fg);
}

.callout-cta { margin-block-start: var(--s-1); font-size: 0.95em; }

.project-link {
  font-size: 0.95em;
  margin-block-start: var(--s-1);
}

.project-link a { color: var(--accent); text-decoration: none; }
.project-link a:hover { text-decoration: underline; }

.links {
  margin-block-start: var(--s-3);
}

.availability {
  color: var(--fg-muted);
  margin-block-start: var(--s-3);
  font-size: 0.9em;
}

/* ---------- Footer ---------- */

footer {
  margin-block-start: var(--s-7);
  padding-block-start: var(--s-3);
  border-block-start: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 0.85em;
}

/* ---------- A11y ---------- */

.skip-link {
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  padding: var(--s-1) var(--s-2);
  background: var(--bg-elev);
  color: var(--fg);
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform 120ms ease;
  z-index: 100;
}

.skip-link:focus {
  transform: translateY(0);
  outline: 2px solid var(--accent);
}

/* ---------- Theme toggle (JS-injected) ---------- */

.theme-toggle {
  position: fixed;
  inset-block-start: var(--s-2);
  inset-inline-end: var(--s-2);
  background: transparent;
  color: var(--fg-muted);
  border: none;
  padding: 0.4em 0.6em;
  font-family: var(--font-body);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: color 120ms ease;
}

.theme-toggle:hover { color: var(--accent); }

.theme-toggle:focus-visible {
  outline: 1px dashed var(--accent);
  outline-offset: 2px;
}

/* ---------- Toast (JS-injected) ---------- */

#toast {
  position: fixed;
  inset-block-end: var(--s-3);
  inset-inline-start: 50%;
  transform: translateX(-50%) translateY(1rem);
  background: var(--bg-elev);
  color: var(--fg);
  border: 1px solid var(--border);
  padding: var(--s-1) var(--s-2);
  font-size: 0.85rem;
  border-radius: 2px;
  opacity: 0;
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
  z-index: 50;
}

#toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
  html { scroll-behavior: auto; }
}

/* ---------- Print ---------- */

@media print {
  :root {
    --bg: #ffffff;
    --fg: #000000;
    --fg-muted: #333333;
    --accent: #000000;
    --border: #cccccc;
  }
  html, body { background: #fff; color: #000; }
  body {
    padding: 0;
    font-size: 11pt;
    line-height: 1.45;
    max-width: none;
  }
  .skip-link, .theme-toggle, #toast, footer { display: none; }
  .cta, a { color: #000; text-decoration: underline; }
  .cta .arrow { display: none; }
  h1 { font-size: 24pt; }
  h2 { font-size: 16pt; margin-block-start: 1.5rem; }
  h3 { font-size: 12pt; }
  section { page-break-inside: avoid; }
}
