/* ============================================================
   terminalvelocity.me - design tokens and shared chrome
   Loaded by every page except /cv, which is a standalone
   print-oriented document with its own tokens.
   Page-specific layout stays inline in each page's <style>.
   ============================================================ */

@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/jetbrains-mono-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/jetbrains-mono-700.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/inter-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/inter-600.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}

:root {
  /* color - warm paper + ink + one purple, light() then dark().
     No choice made means color-scheme follows the OS; the switch in the
     header pins it by setting data-theme on <html>. */
  color-scheme: light dark;
  --bg:         light-dark(#fcfbf7, #15141a);
  --bg-raised:  light-dark(#f4f3ee, #1d1c24);
  --ink:        light-dark(#1c1c1c, #e9e7e1);
  --ink-soft:   light-dark(#45474a, #a8a6b0);
  --line:       light-dark(#d9d8d1, #2e2d38);
  --accent:     light-dark(#5b4fae, #a89ae8);
  --accent-ink: light-dark(#ffffff, #15141a);
  --hot:        light-dark(#a85b07, #df8e1d);
  --ok:         light-dark(#2e7d4f, #5fbd84);
  --no:         light-dark(#b3261e, #e57373);

  /* type */
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --text-xs: 0.75rem;
  --text-s: 0.875rem;
  --text-m: 1.0625rem;
  --text-l: clamp(1.15rem, 1.02rem + 0.6vw, 1.35rem);
  --text-xl: clamp(1.45rem, 1.2rem + 1.1vw, 1.9rem);
  --text-2xl: clamp(1.8rem, 1.4rem + 1.8vw, 2.5rem);
  --text-hero: clamp(2.1rem, 1.2rem + 4vw, 4.75rem);

  /* rhythm - sub-pages are narrow, the homepage widens --wrap itself */
  --space-section: clamp(4rem, 10vh, 7rem);
  --wrap: 52rem;
  --measure: 62ch;
}

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

/* ---- reset-lite ---- */
*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, h3, p, ol, ul, dl, dd, figure { margin: 0; }
ol[class], ul[class] { padding: 0; list-style: none; }
img, picture, svg { display: block; max-width: 100%; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  font-family: var(--sans);
  font-size: var(--text-m);
  line-height: 1.65;
  color: var(--ink);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
}

::selection { background: color-mix(in srgb, var(--accent) 25%, transparent); }

/* ---- shared ---- */
.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: clamp(1.25rem, 4vw, 2.5rem); }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--hot); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.skip-link {
  position: absolute; left: -200vw; top: 0;
  background: var(--accent); color: var(--accent-ink);
  padding: 0.5rem 1rem; font-family: var(--mono); font-size: var(--text-s);
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; z-index: 99; }

/* the one allowed animation: a blinking cursor */
.cursor { display: inline-block; color: var(--accent); }
@media (prefers-reduced-motion: no-preference) {
  .cursor { animation: blink 1.1s steps(1) infinite; }
  @keyframes blink { 50% { opacity: 0; } }
}

/* ---- header ---- */
header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
header .wrap {
  display: flex; align-items: baseline;
  gap: clamp(0.9rem, 3vw, 2rem);
  padding-block: 0.9rem;
}
.logo {
  font-family: var(--mono); font-size: 1.15rem; color: var(--ink);
  text-decoration: none; white-space: nowrap;
}
.logo .slashes { color: var(--accent); }
.logo .name-short { display: none; }
/* collapse the full name to "ml" once it would crowd the nav */
@media (max-width: 40rem) {
  .logo .name-full { display: none; }
  .logo .name-short { display: inline; }
}
header nav { display: flex; gap: clamp(0.9rem, 3vw, 2rem); }
header nav a {
  font-family: var(--mono); font-size: var(--text-s); text-transform: lowercase;
  color: var(--ink-soft); text-decoration: none;
}
header nav a:hover { color: var(--hot); }
header nav a[aria-current] { color: var(--ink); }

/* ---- theme toggle ---- */
.theme-toggle {
  display: none; flex: none; align-self: center; margin-left: auto;
  background: none; border: 0; padding: 6px; line-height: 0;
  color: var(--ink-soft); cursor: pointer; transition: color 150ms;
}
:root.has-js .theme-toggle { display: block; }
.theme-toggle:hover { color: var(--hot); }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .sun { display: none; }
.theme-toggle .moon { display: block; }
@media (prefers-color-scheme: dark) {
  .theme-toggle .sun { display: block; }
  .theme-toggle .moon { display: none; }
}
:root[data-theme="light"] .theme-toggle .sun { display: none; }
:root[data-theme="light"] .theme-toggle .moon { display: block; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }

/* ---- footer ---- */
footer { border-top: 1px solid var(--line); padding-block: 2rem 3rem; }
footer .wrap {
  display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem;
  justify-content: space-between; align-items: center;
  font-family: var(--mono); font-size: var(--text-s); color: var(--ink-soft);
}
footer a { color: var(--ink-soft); }
footer a:hover { color: var(--hot); }
footer .legal { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }
