/*
  Kip Jordan — site stylesheet (entry / manifest)
  ------------------------------------------------
  Authored as small partials under styles/ and concatenated into a single
  served file by build.mjs. Edit the partials, not the built output.

  Two hard ordering rules live here, which is why the font setup sits in
  the entry rather than a partial:
    1. @import must precede every other rule, so all imports come first.
    2. @font-face url()s resolve relative to THIS file. The entry sits at
       the spa root (dev) and is concatenated into a file at the spa root
       (prod), so 'fonts/…' resolves to the sibling fonts/ folder in both.
*/

/* Remote: Fira Code (mono). Must be the first import. */
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500&display=swap');

/* Base */

/* ===== styles/base/tokens.css ===== */
/*
  Design tokens — the single source of truth for the site.
  Colours flip with [data-theme="dark|light"] on <html>; everything else
  (type families, spacing, type-size ladder, radii, layout) is theme-agnostic.
*/

:root {
  --grade: 1;          /* 1 = full chrome opacity, lowers over the hero */

  /* Type families. Inter for UI/headings, EB Garamond for prose, Fira for code. */
  --font-serif: 'EB Garamond', 'Iowan Old Style', Georgia, serif;
  --font-sans:  'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:  'Fira Code', ui-monospace, 'Cascadia Code', monospace;

  /* Spacing ladder (px). */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sp-8: 64px;
  --sp-9: 96px;
  --sp-10: 144px;

  /* Type-size ladder — rem (not px) so it honours the reader's browser/OS
     font-size. Covers the small UI/label band; large display headings use
     clamp() inline at their call sites. */
  --fs-label:   0.75rem;    /* 12px — eyebrows, meta lines, footer, badges, tool/idx tags */
  --fs-meta:    0.8125rem;  /* 13px — inline nav, TOC, code blocks, form labels */
  --fs-ui:      0.875rem;   /* 14px — buttons, kbd, skip link, back link */
  --fs-body-s:  0.9375rem;  /* 15px — secondary body: card descriptions, wordmark */
  --fs-body:    1rem;       /* 16px — body copy, form inputs */

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --container: 1180px;
  --measure:  64ch;
}

/* Dark theme (default) */
:root, [data-theme="dark"] {
  --bg:          #050a14;
  --bg-2:        #0a1422;
  --bg-card:     rgba(10, 20, 34, 0.78);
  --bg-card-2:   rgba(10, 20, 34, 0.92);

  --ink:         #e7f0f6;
  --ink-1:       #c5d4de;
  --ink-muted:   #7a8d9c;
  --ink-faint:   #4a5b6b;

  --line:        rgba(186, 215, 230, 0.10);
  --line-strong: rgba(186, 215, 230, 0.20);

  --accent:      #4a9fbf;
  --accent-soft: #6bb8d4;
  --accent-deep: #1f6d8f;
  --amber:       #f4b860;
  --amber-soft:  #f9d089;

  /* Canvas-specific. Full colour strings so the canvas can apply them
     directly without knowing which theme is in play. */
  --canvas-bg:        #050a14;
  --canvas-trail:     rgba(5, 10, 20, 0.14);
  --particle-base:    hsla(196, 65%, 60%, 0.40);   /* cyan streamlines */
  --particle-hot:     hsla(36, 80%, 60%, 0.55);    /* amber when close + fast */
  --cluster-core:     #f4b860;
  --cluster-glow:     rgba(244, 184, 96, 0.18);

  /* Photo tint duotone (blog cards) — dark cyan deep + amber dot */
  --photo-wash-a:     rgba(31, 109, 143, 0.55);
  --photo-wash-b:     rgba(244, 184, 96, 0.16);

  --chrome-bg:    rgba(5, 10, 20, 0.55);
  --chrome-blur:  8px;
}

[data-theme="light"] {
  --bg:          #f6f5f0;        /* warm paper */
  --bg-2:        #ffffff;
  --bg-card:     rgba(255, 254, 250, 0.85);
  --bg-card-2:   rgba(255, 254, 250, 0.97);

  --ink:         #111111;
  --ink-1:       #2a2a2a;
  --ink-muted:   #5e6e7a;
  --ink-faint:   #aab4bc;

  --line:        rgba(17, 17, 17, 0.08);
  --line-strong: rgba(17, 17, 17, 0.16);

  --accent:      #1f6d8f;
  --accent-soft: #3183A7;
  --accent-deep: #154e6b;
  --amber:       #b86a14;
  --amber-soft:  #d28b3c;

  /* Light mode inverts the canvas roles: particles → dark grey,
     cluster → cyan (the "finding" is cyan against paper). */
  --canvas-bg:        #f6f5f0;
  --canvas-trail:     rgba(246, 245, 240, 0.18);
  --particle-base:    hsla(214, 14%, 30%, 0.32);   /* dark grey streamlines */
  --particle-hot:     hsla(196, 70%, 38%, 0.55);   /* cyan when close + fast */
  --cluster-core:     #1f6d8f;                     /* deep cyan as the finding */
  --cluster-glow:     rgba(31, 109, 143, 0.18);

  --photo-wash-a:     rgba(246, 245, 240, 0.20);
  --photo-wash-b:     rgba(31, 109, 143, 0.10);

  --chrome-bg:    rgba(246, 245, 240, 0.65);
  --chrome-blur:  10px;
}

/* ===== styles/base/reset.css ===== */
/* Base reset + global element defaults. */

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

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-serif);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body { min-height: 100vh; transition: background 280ms ease, color 280ms ease; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* Suppress the grey tap-flash iOS Safari paints on every link/button.
 * overflow-x: hidden prevents the off-screen mobile nav panel (transformed
 * with translateX(100%)) from extending the document's scrollWidth — Chrome
 * counts transformed-but-fixed elements in scroll overflow, which would
 * otherwise inflate the viewport and break the canvas sizing. */
html, body { overflow-x: hidden; }
body { -webkit-tap-highlight-color: transparent; }
button { font: inherit; background: none; border: none; cursor: pointer; color: inherit; }

/* ===== styles/base/a11y.css ===== */
/* Accessibility: focus ring + skip-to-content link. */

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

.skip-link {
  position: fixed;
  top: -100px; left: 16px;
  z-index: 200;
  background: var(--bg-2);
  color: var(--ink);
  padding: 10px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: var(--fs-ui);
  text-decoration: none;
  transition: top 200ms ease;
}
.skip-link:focus-visible { top: 16px; }
main:focus { outline: none; }

/* ===== styles/base/motion.css ===== */
/* Scroll-reveal animation + the global reduced-motion opt-out. */

.fade-up {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 700ms cubic-bezier(0, 0, 0.2, 1),
              transform 700ms cubic-bezier(0, 0, 0.2, 1);
  will-change: opacity, transform;
}
.fade-up.in-view { opacity: 1; transform: none; }
.fade-up.delay-1 { transition-delay: 80ms; }
.fade-up.delay-2 { transition-delay: 160ms; }
.fade-up.delay-3 { transition-delay: 240ms; }

/* Respect users who don't want motion: kill animation/transition everywhere
   and show fade-up content in its resting state. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .fade-up { opacity: 1 !important; transform: none !important; }
  .burger-bar { transition: none; }
  .chrome-scrim { animation: none; }
}

/* Layout */

/* ===== styles/layout/chrome.css ===== */
/* Top chrome: fixed header bar, inline nav, burger, theme toggle, and the
   mobile slide-over panel. */

.chrome {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) clamp(20px, 4vw, 56px);
  background: var(--chrome-bg);
  backdrop-filter: blur(var(--chrome-blur));
  -webkit-backdrop-filter: blur(var(--chrome-blur));
  border-bottom: 1px solid var(--line);
  z-index: 10;
  transition: background 280ms ease, border-color 280ms ease;
}
.chrome .wordmark {
  font-family: var(--font-sans);
  font-weight: 400;
  /* Negative margin + padding gives a 44px hit area without changing visual size,
     so the touch target meets WCAG 2.5.5 (AAA) on mobile. */
  padding: 12px 8px;
  margin: -12px -8px;
  min-height: 44px;
  align-items: center;
  display: inline-flex;
  gap: 10px;
  font-size: var(--fs-body-s);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  display: flex; align-items: center; gap: 12px;
  white-space: nowrap;
}
.chrome .wordmark span:last-child { white-space: nowrap; }
.chrome .wordmark .dot {
  width: 6px; height: 6px;
  background: var(--amber);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--amber);
}
.chrome-nav-inline {
  display: flex; gap: clamp(16px, 2.4vw, 36px);
  align-items: center;
  font-family: var(--font-sans);
  font-size: var(--fs-meta);
  letter-spacing: 0.08em;
}
.chrome-nav-inline a, .chrome-panel a {
  color: var(--ink-muted);
  padding: 6px 0;
  border-bottom: 1px solid transparent;
  transition: color 200ms ease, border-color 200ms ease;
}
.chrome-nav-inline a:hover, .chrome-panel a:hover { color: var(--ink); }
.chrome-nav-inline a.active, .chrome-panel a.active {
  color: var(--ink);
  border-bottom-color: var(--amber);
}

/* Burger button (mobile nav trigger). Hidden on desktop, surfaced by the
 * mobile block below. Three bars animate into an X when .is-open is set. */
.burger {
  display: none;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  width: 44px;
  height: 44px;
  padding: 0;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
.burger:hover { border-color: var(--ink-muted); }
.burger:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.burger-bar {
  display: block;
  width: 22px;
  height: 1.5px;
  background: currentColor;
  transition: transform 220ms ease, opacity 160ms ease;
}
.burger.is-open .burger-bar:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.burger.is-open .burger-bar:nth-child(2) { opacity: 0; }
.burger.is-open .burger-bar:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* Dim background behind the open panel, click to close. */
.chrome-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 80;
  animation: scrimIn 220ms ease forwards;
}
@keyframes scrimIn { from { opacity: 0; } to { opacity: 1; } }

.theme-toggle {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--ink-muted);
  transition: color 200ms ease, background 200ms ease;
}
.theme-toggle:hover { color: var(--ink); background: var(--line); }
.theme-toggle svg { width: 16px; height: 16px; }

/* Slide-over panel (mobile nav). Hidden until the mobile block shows it.
 * Lives as a sibling of .chrome so position:fixed anchors to the viewport.
 * The panel snaps open/closed (right: 0) and the scrim fade carries the
 * perceived motion — an earlier transform/right transition got stuck mid-
 * animation when the background canvas's rAF loop forced React re-renders. */
.chrome-panel {
  display: none;
  position: fixed;
  top: 0;
  right: -320px;
  width: 80%;
  max-width: 320px;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  border-left: 1px solid var(--line);
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 88px 28px 28px;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  box-shadow: -20px 0 40px rgba(0, 0, 0, 0.25);
  z-index: 90;
  overflow-y: auto;
}
.chrome-panel.is-open { right: 0; }

@media (max-width: 720px) {
  .chrome { padding: 12px 20px; }
  .chrome .wordmark { font-size: var(--fs-meta); letter-spacing: 0.14em; }

  /* Surface the burger, hide the inline desktop nav, show the panel. */
  .burger { display: inline-flex; }
  .chrome-nav-inline { display: none; }
  .chrome-panel { display: flex; }

  /* In-panel link sizing — bigger tap targets, full-width rows. */
  .chrome-panel a {
    font-size: 1.125rem;  /* 18px */
    letter-spacing: 0.04em;
    text-transform: none;
    padding: 14px 0;
    min-height: 44px;
    width: 100%;
    border-bottom: 1px solid var(--line);
    border-top: none;
  }
  .chrome-panel a.active {
    color: var(--ink);
    border-bottom-color: var(--amber);
  }
}

/* ===== styles/layout/page.css ===== */
/* App shell: the persistent background canvas, page padding, the centred
   content container, and section scaffolding. */

/* The persistent canvas — pinned behind everything. */
#field-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
  pointer-events: none;
}

/* All UI sits above the canvas. */
.app { position: relative; z-index: 1; }

.page { padding-top: 64px; min-height: 100vh; }
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 56px);
}

section.block {
  position: relative;
  padding: clamp(64px, 10vh, 128px) 0;
}
section.block + section.block { border-top: 1px solid var(--line); }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: var(--sp-6);
  flex-wrap: wrap;
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-soft);
  margin: 0;
}
.section-head h2 {
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: clamp(28px, 3.4vw, 44px);
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin: 0;
  max-width: 22ch;
  color: var(--ink);
}
.lede {
  font-family: var(--font-serif);
  font-size: clamp(17px, 1.3vw, 19px);
  line-height: 1.7;
  color: var(--ink-1);
  max-width: var(--measure);
  margin: 0 0 1em;
}

/* ===== styles/layout/footer.css ===== */
/* Site footer — copyright line + social links. */

footer.foot {
  position: relative;
  padding: var(--sp-6) 0;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
footer.foot .socials { display: flex; gap: 18px; }
footer.foot .socials a { color: var(--ink-muted); transition: color 200ms ease; }
footer.foot .socials a:hover { color: var(--ink); }

/* Components */

/* ===== styles/components/cards.css ===== */
/* Project / writing cards, laid out in a hairline-separated grid. */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1px;
  background: var(--line-strong);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.card {
  background: var(--bg-card);
  padding: 22px 22px 20px;
  display: flex; flex-direction: column;
  min-height: 280px;
  position: relative;
  text-decoration: none;
  color: var(--ink);
  transition: background 240ms ease;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.card:hover { background: var(--bg-card-2); }
.card .idx {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.14em;
  color: var(--amber);
  margin-bottom: 12px;
}
.card h3 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.3125rem;  /* 21px */
  line-height: 1.25;
  margin: 0 0 12px;
  color: var(--ink);
  /* clamp to 2 lines for consistent geometry */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(1.25em * 2);
}
.card p {
  font-family: var(--font-sans);
  font-size: var(--fs-body-s);
  line-height: 1.55;
  color: var(--ink-muted);
  margin: 0;
  max-width: 32ch;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(1.55em * 3);
}
.card .tools {
  margin-top: auto;
  padding-top: 16px;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.12em;
  color: var(--accent-soft);
  text-transform: uppercase;
}

/* Live-tool badge on cards. Visual signal only; the card link still
   takes you to the detail page where the "Open the tool" link lives. */
.card .live-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber);
  background: rgba(244, 184, 96, 0.10);
  border: 1px solid rgba(244, 184, 96, 0.35);
  padding: 3px 8px;
  border-radius: 999px;
  pointer-events: none;
}

@media (max-width: 720px) {
  .card-grid { grid-template-columns: 1fr; }
}

/* ===== styles/components/buttons.css ===== */
/* Buttons — solid primary + ghost variant. */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: var(--fs-ui);
  letter-spacing: 0.04em;
  background: var(--ink);
  color: var(--bg);
  text-decoration: none;
  transition: transform 200ms ease, background 200ms ease;
}
.btn:hover { transform: translateY(-1px); background: var(--amber); color: var(--bg); }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-strong);
}
.btn.ghost:hover { border-color: var(--amber); color: var(--amber); transform: translateY(-1px); }

/* ===== styles/components/keyboard.css ===== */
/* Keyboard-shortcuts hint button + overlay panel (desktop power-user aid). */

.kbd-hint {
  position: fixed;
  right: 18px; bottom: 18px;
  width: 32px; height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--bg-card);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: var(--fs-ui);
  z-index: 12;
  transition: color 200ms ease, border-color 200ms ease, background 200ms ease;
}
.kbd-hint:hover { color: var(--ink); border-color: var(--amber); }
.kbd-hint-open { color: var(--amber); border-color: var(--amber); }
.kbd-overlay {
  position: fixed; inset: 0;
  z-index: 13;
  display: grid; place-items: center;
  background: rgba(5, 10, 20, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
[data-theme="light"] .kbd-overlay { background: rgba(246, 245, 240, 0.55); }
.kbd-panel {
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 28px 32px;
  min-width: 340px;
  max-width: 440px;
}
.kbd-panel dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 10px 18px;
  margin: 0;
  align-items: center;
}
.kbd-panel dt {
  display: flex; gap: 6px; align-items: center;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  color: var(--ink-muted);
}
.kbd-panel dt span { font-family: var(--font-sans); }
.kbd-panel kbd {
  display: inline-block;
  padding: 3px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--bg-card);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  color: var(--ink);
  line-height: 1;
}
.kbd-panel dd {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-ui);
  color: var(--ink);
}

/* ===== styles/components/forms.css ===== */
/* Contact form fields + the big "get in touch" contact strip. */

.form { display: flex; flex-direction: column; gap: var(--sp-5); max-width: 540px; }
.form .field { display: flex; flex-direction: column; gap: var(--sp-2); }
.form label {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: var(--fs-meta);
  letter-spacing: 0.04em;
  color: var(--ink);
}
.form input, .form textarea {
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  background: var(--bg-card);
  color: var(--ink);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  /* 1rem (16px) minimum prevents iOS Safari from auto-zooming on focus. */
  font-size: var(--fs-body);
  transition: border-color 200ms ease, background 200ms ease;
  outline: none;
}
.form input:focus, .form textarea:focus { border-color: var(--amber); background: var(--bg-card-2); }
/* Keyboard focus needs a visible ring; mouse focus keeps the cleaner border-only style. */
.form input:focus-visible, .form textarea:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}
.form textarea { min-height: 140px; resize: vertical; }

.contact-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-5);
  padding-top: var(--sp-6);
  border-top: 1px solid var(--line);
}
.contact-strip a.big {
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: clamp(22px, 3vw, 36px);
  letter-spacing: -0.01em;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 16px;
}
.contact-strip a.big::after {
  content: "↗";
  color: var(--amber);
  transition: transform 220ms ease;
}
.contact-strip a.big:hover::after { transform: translate(4px, -4px); }
.contact-strip .meta {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* Pages */

/* ===== styles/pages/hero.css ===== */
/* Landing hero: oversized headline, sub/lede, and the footer rail. */

.hero {
  position: relative;
  min-height: calc(100vh - 64px);
  display: grid;
  grid-template-rows: 1fr auto;
  padding: clamp(48px, 8vh, 96px) clamp(20px, 4vw, 56px) clamp(32px, 5vh, 48px);
  max-width: var(--container);
  margin: 0 auto;
}
.hero-copy {
  align-self: start;
  max-width: 42ch;
}
.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-soft);
  margin: 0 0 22px;
  display: flex; align-items: center; gap: 12px;
  white-space: nowrap;
}
.hero-eyebrow::before {
  content: "";
  width: 28px; height: 1px;
  background: var(--accent-soft);
}
.hero-copy h1 {
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: clamp(48px, 6.5vw, 88px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--ink);
  white-space: nowrap;
}
.hero-sub {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: clamp(15px, 1.1vw, 17px);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 22px 0 0;
  white-space: nowrap;
}
.hero-lede {
  font-family: var(--font-serif);
  font-size: clamp(17px, 1.35vw, 20px);
  line-height: 1.6;
  color: var(--ink-1);
  max-width: 38ch;
  margin: 28px 0 0;
}

.hero-foot {
  align-self: end;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.hero-poetic {
  margin: 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(15px, 1.25vw, 19px);
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-1);
  max-width: 32ch;
  line-height: 1.45;
}
.hero-foot .scroll {
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
}
.hero-foot .scroll::after {
  content: "";
  display: block;
  width: 1px; height: 56px;
  background: linear-gradient(to bottom, var(--ink-muted), transparent);
}

@media (max-width: 720px) {
  .hero { padding-top: 24px; padding-bottom: 32px; }
  .hero-copy { max-width: 14ch; }
  .hero-foot .scroll::after { height: 32px; }
}

/* ===== styles/pages/about.css ===== */
/* About page: intro + portrait, the "arc" timeline, principles, the
   "beyond" grid, and the formal-study list. */

.about-intro {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: clamp(32px, 5vw, 72px);
  align-items: start;
}
.about-portrait {
  position: relative;
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  transition: border-color 240ms ease, transform 240ms ease;
}
.about-portrait:hover { border-color: var(--amber); }
.about-portrait img {
  width: 100%;
  height: auto;
  display: block;
  filter: saturate(0.85) contrast(1.02);
}
.about-portrait::after {
  /* Subtle theme-aware wash so the headshot sits in the palette */
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(135deg, var(--photo-wash-a), var(--photo-wash-b));
  mix-blend-mode: soft-light;
  pointer-events: none;
}
@media (max-width: 720px) {
  .about-intro { grid-template-columns: 1fr; }
  .about-portrait { max-width: 280px; }
}

/* The arc — vertical timeline */
.arc-list {
  list-style: none;
  padding: 0;
  margin: 32px 0 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}
.arc-list::before {
  content: "";
  position: absolute;
  left: 92px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--line);
}
.arc-item {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 28px;
  padding: 16px 0;
  position: relative;
}
.arc-item::before {
  content: "";
  position: absolute;
  left: 88px;
  top: 26px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent-soft);
  box-shadow: 0 0 0 4px var(--bg);
}
.arc-item-aside::before {
  border-color: var(--amber);
}
.arc-era {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.12em;
  color: var(--ink-muted);
  text-transform: uppercase;
  padding-top: 4px;
}
.arc-body { padding-left: 24px; }
.arc-title {
  font-family: var(--font-sans);
  font-size: 1.125rem;  /* 18px */
  font-weight: 500;
  color: var(--ink);
  margin: 0 0 4px;
}
.arc-item-aside .arc-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
}
.arc-note {
  font-family: var(--font-serif);
  font-size: var(--fs-body);
  line-height: 1.6;
  color: var(--ink-1);
  margin: 0;
  max-width: var(--measure);
}
@media (max-width: 720px) {
  .arc-list::before { left: 8px; }
  .arc-item { grid-template-columns: 64px 1fr; gap: 16px; }
  .arc-item::before { left: 4px; top: 22px; }
  .arc-body { padding-left: 12px; }
}

/* Principles */
.principles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: clamp(20px, 3vw, 40px);
  margin-top: 24px;
}
.principles h3 {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 1.0625rem;  /* 17px */
  letter-spacing: -0.005em;
  margin: 0 0 10px;
  color: var(--ink);
}
.principles p {
  font-family: var(--font-serif);
  font-size: var(--fs-body);
  line-height: 1.6;
  color: var(--ink-1);
  margin: 0;
}

/* Beyond */
.beyond-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: clamp(20px, 3vw, 40px);
  margin-top: 16px;
}
.beyond-grid h3 {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: var(--fs-label);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-soft);
  margin: 0 0 12px;
}
.beyond-grid p {
  font-family: var(--font-serif);
  font-size: var(--fs-body);
  line-height: 1.6;
  color: var(--ink-1);
  margin: 0;
}

/* Formal study list */
.study-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}
.study-list > div {
  display: grid;
  grid-template-columns: 84px 1fr 1fr;
  gap: 28px;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.study-year {
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
  letter-spacing: 0.1em;
  color: var(--amber);
  margin: 0;
}
.study-name {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  font-weight: 500;
  color: var(--ink);
  margin: 0;
}
.study-org {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--fs-body-s);
  color: var(--ink-muted);
  margin: 0;
}
@media (max-width: 720px) {
  .study-list > div { grid-template-columns: 1fr; gap: 4px; }
}

/* ===== styles/pages/longform.css ===== */
/* Long-form pages (project detail + blog post): the article/TOC layout,
   sticky table of contents, the article prose itself, and the markdown
   body rendered from the API. */

.post-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: clamp(32px, 5vw, 80px);
  align-items: start;
}
.post-layout .longform { max-width: 46rem; }
@media (max-width: 900px) {
  .post-layout { grid-template-columns: 1fr; }
  .post-layout .toc { display: none; }
}

/* Sticky table of contents */
.toc {
  position: sticky;
  top: 88px;
  align-self: start;
  padding-top: clamp(48px, 8vh, 96px);
  font-family: var(--font-sans);
  font-size: var(--fs-meta);
  line-height: 1.5;
}
.toc .toc-label {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-soft);
  margin: 0 0 12px;
}
.toc ol {
  list-style: none;
  padding: 0; margin: 0;
  border-left: 1px solid var(--line);
}
.toc li {
  margin: 0;
  border-left: 2px solid transparent;
  margin-left: -1px;
}
.toc li.active { border-left-color: var(--amber); }
.toc a {
  display: block;
  padding: 6px 14px;
  color: var(--ink-muted);
  text-decoration: none;
  transition: color 200ms ease;
}
.toc li.active a { color: var(--ink); }
.toc a:hover { color: var(--ink); }

/* Article shell + prose */
.longform { max-width: 52rem; padding: clamp(48px, 8vh, 96px) 0; }
.longform .meta {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 var(--sp-4);
}
.longform h1 {
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: clamp(32px, 4vw, 52px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 var(--sp-6);
  color: var(--ink);
}
.longform h2 {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: clamp(22px, 2.5vw, 28px);
  line-height: 1.2;
  margin: var(--sp-8) 0 var(--sp-4);
  color: var(--ink);
}
/* h3/h4 for rendered markdown subheadings (deeper than the article's own h2). */
.longform h3 {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 1.375rem;  /* 22px */
  line-height: 1.3;
  margin: var(--sp-6) 0 var(--sp-3);
  color: var(--ink);
}
.longform h4 {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 1.125rem;  /* 18px */
  line-height: 1.35;
  margin: var(--sp-5) 0 var(--sp-2);
  color: var(--ink);
}
.longform p {
  font-family: var(--font-serif);
  font-size: 1.125rem;  /* 18px */
  line-height: 1.7;
  color: var(--ink-1);
  margin: 0 0 1.2em;
  max-width: var(--measure);
}
.longform blockquote {
  margin: var(--sp-8) 0;
  padding: 0 0 0 var(--sp-5);
  border-left: 2px solid var(--amber);
  font-style: italic;
  font-size: clamp(20px, 2.2vw, 26px);
  line-height: 1.45;
  color: var(--ink);
  max-width: 38ch;
}
.longform pre {
  background: var(--bg-card-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: var(--sp-5);
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
  line-height: 1.55;
  color: var(--ink);
  overflow: auto;
  margin: var(--sp-6) 0;
}
.longform code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  padding: 2px 5px;
  background: var(--bg-card);
  border-radius: 3px;
}
.longform a.back {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: var(--sp-8);
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--amber);
  font-size: var(--fs-ui);
}
.longform a.back:hover { color: var(--amber-soft); }

/* "Open the tool" CTA on a ProjectDetailPage with a liveUrl. Sits directly
   under the meta line and above the rendered body. */
.longform .open-tool {
  margin: 0 0 var(--sp-5);
}
.longform .open-tool a {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: var(--fs-ui);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--amber);
  background: rgba(244, 184, 96, 0.10);
  border: 1px solid var(--amber);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: background 200ms ease, color 200ms ease;
}
.longform .open-tool a:hover {
  background: rgba(244, 184, 96, 0.20);
  color: var(--amber-soft);
}

/* ----------------------------------------------------------
   Markdown body — content rendered from the JSON API into
   ProjectDetailPage / PostPage via dangerouslySetInnerHTML.
   Prose elements inherit .longform p/h2/etc. The rules below
   add layout for photo galleries, embedded maps, and bare
   inline images so image-heavy posts breathe.
   ---------------------------------------------------------- */
.markdown-body {
  /* Long URLs and code-y tokens should wrap rather than push horizontal scroll. */
  overflow-wrap: anywhere;
  /* Lets photo galleries span the full longform width while
     paragraphs above still wrap at --measure. */
  width: 100%;
}

.markdown-body img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-sm);
}

.markdown-body .photo-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-4);
  margin: var(--sp-7) 0;
}

.markdown-body .gallery-column {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.markdown-body .photo-item {
  margin: 0;
  overflow: hidden;
  border-radius: var(--radius-sm);
}

.markdown-body .photo-item img {
  width: 100%;
  height: auto;
  display: block;
}

.markdown-body .map-embed {
  margin: var(--sp-7) 0;
}

.markdown-body .map-embed img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-sm);
}

@media (max-width: 720px) {
  .markdown-body .photo-gallery {
    grid-template-columns: 1fr;
    gap: var(--sp-3);
  }
}

/* Self-hosted variable fonts. Declared after all imports (see header). */
@font-face {
  font-family: 'Inter';
  src: url('fonts/Inter-VariableFont_opsz_wght.ttf') format('truetype-variations'),
       url('fonts/Inter-VariableFont_opsz_wght.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('fonts/Inter-Italic-VariableFont_opsz_wght.ttf') format('truetype-variations'),
       url('fonts/Inter-Italic-VariableFont_opsz_wght.ttf') format('truetype');
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'EB Garamond';
  src: url('fonts/EBGaramond-VariableFont_wght.ttf') format('truetype-variations'),
       url('fonts/EBGaramond-VariableFont_wght.ttf') format('truetype');
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'EB Garamond';
  src: url('fonts/EBGaramond-Italic-VariableFont_wght.ttf') format('truetype-variations'),
       url('fonts/EBGaramond-Italic-VariableFont_wght.ttf') format('truetype');
  font-weight: 400 800;
  font-style: italic;
  font-display: swap;
}
