/* ==========================================================================
   base.css — reset, design tokens, typography
   ========================================================================== */

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

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  min-height: 100vh;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
picture,
svg,
canvas {
  display: block;
  max-width: 100%;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

p,
li,
h1,
h2,
h3,
h4 {
  overflow-wrap: break-word;
}

ul[class],
ol[class] {
  list-style: none;
  padding: 0;
}

a {
  color: inherit;
}

/* --------------------------------------------------------------------------
   Design tokens — dark is the default
   -------------------------------------------------------------------------- */

:root {
  color-scheme: dark;

  /* Surface */
  --bg: #0b0f0c;
  --bg-elev: #11170f;
  --bg-sunken: #070a08;

  /* Ink. Deliberately not #00ff00 — pure phosphor green fails contrast at
     body size and is genuinely painful to read for more than a paragraph. */
  --fg: #d5e8d0;
  --fg-dim: #8ba384;
  /* Carries real content (dates, locations, contact labels), so it has to
     clear 4.5:1 against --bg — not just look decoratively quiet. */
  --fg-faint: #7a9074;

  /* Accent */
  --accent: #7ee787;
  --accent-dim: #3fb950;
  --accent-glow: rgb(126 231 135 / 18%);
  /* Text drawn ON the accent colour. A token rather than a themed override,
     so it cannot leak onto ghost buttons that keep a transparent background. */
  --on-accent: #06120a;
  --amber: #e3b341;
  --danger: #f0776c;

  --border: #22301f;
  --border-bright: #35492f;
  --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 8px 24px -12px rgb(0 0 0 / 60%);

  --selection-bg: var(--accent-dim);
  --selection-fg: #06120a;

  /* Type — one monospace stack for the whole site, all system-local so the
     page renders instantly and pulls nothing from a font CDN. */
  --font-mono: ui-monospace, "SF Mono", "SFMono-Regular", "JetBrains Mono",
    "Cascadia Mono", "Fira Code", Menlo, Consolas, "Liberation Mono", monospace;

  /* Fluid type scale */
  --step--1: clamp(0.78rem, 0.75rem + 0.15vw, 0.86rem);
  --step-0: clamp(0.92rem, 0.88rem + 0.2vw, 1rem);
  --step-1: clamp(1.05rem, 0.99rem + 0.3vw, 1.2rem);
  --step-2: clamp(1.25rem, 1.13rem + 0.6vw, 1.6rem);
  --step-3: clamp(1.55rem, 1.32rem + 1.15vw, 2.3rem);
  --step-4: clamp(1.9rem, 1.45rem + 2.25vw, 3.4rem);

  /* Space */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;

  --measure: 68ch;
  --wrap: 62rem;
  --radius: 6px;
  --radius-lg: 10px;
  --radius-pill: 999px;

  --header-h: 3.5rem;
}

[data-theme="light"] {
  color-scheme: light;

  --bg: #f4f2e9;
  --bg-elev: #fbfaf4;
  --bg-sunken: #e8e5d8;

  --fg: #1d241c;
  --fg-dim: #4a5647;
  --fg-faint: #5f6d5c;

  --accent: #1a7f37;
  /* Darker than --accent so it still clears 4.5:1 when drawn on the tinted
     --accent-glow backgrounds (badges, chips) rather than on plain --bg. */
  --accent-dim: #14682c;
  --accent-glow: rgb(26 127 55 / 12%);
  --on-accent: #f4f2e9;
  --amber: #8a6100;
  --danger: #b62324;

  --border: #d5d1bf;
  --border-bright: #b9b4a0;
  --shadow: 0 1px 2px rgb(60 55 30 / 8%), 0 8px 24px -14px rgb(60 55 30 / 22%);

  --selection-bg: #1a7f37;
  --selection-fg: #f4f2e9;
}

/* --------------------------------------------------------------------------
   Element defaults
   -------------------------------------------------------------------------- */

body {
  background-color: var(--bg);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: var(--step-0);
}

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

h1,
h2,
h3,
h4 {
  line-height: 1.25;
  font-weight: 700;
  text-wrap: balance;
}

h1 {
  font-size: var(--step-4);
}
h2 {
  font-size: var(--step-2);
}
h3 {
  font-size: var(--step-1);
}

p {
  text-wrap: pretty;
}

/* --------------------------------------------------------------------------
   Focus — visible, never removed
   -------------------------------------------------------------------------- */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: 0;
  left: var(--space-4);
  z-index: 200;
  padding: var(--space-2) var(--space-4);
  background: var(--accent);
  color: var(--bg);
  font-weight: 700;
  border-radius: 0 0 var(--radius) var(--radius);
  transform: translateY(-110%);
}

.skip-link:focus {
  transform: translateY(0);
}

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