/* ---------------------------------------------------------------------------
 * Eigen Hitchens — v2 stylesheet (design-engine rewrite, 2026-07-01)
 *
 * Rules honored (rubrics/web.json + rubrics/typography.json):
 *   1.1 measure 45–75ch    1.2 leading 1.4–1.6 body / 1.1–1.3 heading
 *   1.3 body ≥ 16px        1.4 modular scale (1.25)
 *   1.5 font-display swap  1.6 ≥3-fallback system stack
 *   1.7 clamp() fluid type, vw unit, max ≥ 2× min
 *   1.8 never justify without hyphens (we don't justify)
 *   2.1 no px container widths  2.2 em/rem media queries
 *   2.4 text max-width in ch    2.6 img w+h/aspect-ratio + max-width:100%
 *   4.1 contrast ≥ 4.5:1  4.5 targets ≥ 44px  4.6 semantic  4.7 no positive tabindex
 *   5.3 CLS-safe images   5.5 lazy+srcset+WebP  5.7 all JS deferred/module
 * ------------------------------------------------------------------------- */

/* ── Font loading (rubric 1.5 — font-display: swap) ─────────────────── */
/* Inter / Lora / JetBrains Mono are loaded with <link rel="preconnect">
 * + <link rel="stylesheet"> (Google Fonts, display=swap) in every page's
 * <head>. Do NOT re-add an @import here: @import is only valid before
 * all other rules, so an @import at this position is ignored per spec
 * (which is exactly the bug that made the whole site render in fallback
 * fonts). The old src:local() @font-face stubs were removed too - they
 * shadowed the downloaded faces on machines without the fonts installed. */

/* ── Reset (Bahunya-lite) ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body, h1, h2, h3, h4, h5, h6, p, ul, ol, dl, figure, blockquote { margin: 0; }
ul, ol { padding: 0; }
img, svg, video { display: block; max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; padding: 0; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }

/* ── Body / typography base ───────────────────────────────────────── */
html { font-size: 100%; } /* rubric 1.3 — 16px minimum */
body {
  font-family: var(--font-serif);
  font-size: var(--step-0);
  line-height: var(--lh-body);
  color: var(--text-body);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
}

/* Headings — Inter, tight leading, modular scale.                     */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 700;
  line-height: var(--lh-tight);
  color: var(--eh-ink);
  letter-spacing: -0.01em;
  text-wrap: balance;
}
h1 { font-size: var(--step-5); line-height: var(--lh-display); letter-spacing: -0.02em; }
h2 { font-size: var(--step-4); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }
h5 { font-size: var(--step-0); font-weight: 600; text-transform: uppercase;
     letter-spacing: 0.08em; }

p { max-width: var(--measure); text-wrap: pretty; hyphens: auto; }
p + p { margin-top: var(--sp-4); }

/* Focus — always visible, respects target-size (rubric 4.5) */
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }

/* Skip-link — a11y courtesy. */
.skip-link {
  position: absolute; left: -9999px; top: 0.5rem;
  background: var(--eh-ink); color: var(--text-on-ink);
  padding: 0.5rem 0.75rem; border-radius: var(--radius-sm);
  font-family: var(--font-sans); font-weight: 600;
}
.skip-link:focus { left: 0.5rem; z-index: 200; }

/* ── Layout primitives ────────────────────────────────────────────── */
.container { width: var(--container); margin-inline: auto; }
.container--narrow { width: var(--container-narrow); margin-inline: auto; }
.stack > * + * { margin-top: var(--sp-5); }
.stack--sm > * + * { margin-top: var(--sp-3); }
.stack--lg > * + * { margin-top: var(--sp-7); }

/* Section rhythm */
.section { padding-block: var(--section-y); }
.section--tight { padding-block: clamp(2.5rem, 4vw + 1rem, 4rem); }
.section--alt { background: var(--bg-secondary); }
.section--ink { background: var(--bg-ink); color: var(--text-on-ink); }
.section--ink h1, .section--ink h2, .section--ink h3 { color: var(--text-on-ink); }
.section--ink p { color: var(--text-on-ink-muted); }
.section--plate {
  background-color: var(--bg-primary);
  background-image: image-set(
    url('/img/brand/eh-plate-cool-1280w.webp') 1x,
    url('/img/brand/eh-plate-cool-1920w.webp') 2x
  );
  background-image: -webkit-image-set(
    url('/img/brand/eh-plate-cool-1280w.webp') 1x,
    url('/img/brand/eh-plate-cool-1920w.webp') 2x
  );
  background-size: cover;
  background-position: center right;
  background-repeat: no-repeat;
  background-attachment: scroll;
}

/* Kicker — technical mono cue. */
.kicker {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.08em;
  color: var(--accent);
  text-transform: none;
}
.kicker::before {
  content: '//'; opacity: 0.75; font-weight: 500;
}

/* Eyebrow — small caps label above H2. */
.eyebrow {
  font-family: var(--font-sans);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-quiet);
}

/* Signal-tick — the resonance-wave accent underline. */
.tick {
  display: inline-block; height: 3px; width: clamp(48px, 4vw, 72px);
  background: var(--accent); border-radius: 2px;
}

/* Hairline divider. */
.hr {
  border: 0; border-top: 1px solid var(--hairline);
  margin-block: var(--sp-6);
}

/* ── Header / nav ─────────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(244, 246, 248, 0.86);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--hairline);
}
.site-header__inner {
  width: var(--container); margin-inline: auto;
  display: flex; align-items: center; gap: var(--sp-5);
  padding-block: var(--sp-4);
  min-height: 3.5rem;
}
.brand-link { display: inline-flex; align-items: center; text-decoration: none; }
.brand-link img { width: auto; height: 22px; }
.primary-nav { margin-left: auto; }
.primary-nav__list {
  list-style: none; display: flex; flex-wrap: wrap; align-items: center;
  gap: clamp(0.75rem, 1.6vw, 1.75rem);
}
.primary-nav__link {
  display: inline-flex; align-items: center; min-height: 44px;
  padding: 0.375rem 0.25rem;
  font-family: var(--font-sans); font-weight: 500;
  font-size: var(--step-0);
  color: var(--text-body); text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}
.primary-nav__link:hover { color: var(--accent); }
.primary-nav__link[aria-current="page"] { color: var(--accent); }
.primary-nav__link[aria-current="page"]::after {
  content: ''; position: relative; top: 0.55rem; margin-left: -0.25rem;
  display: block; height: 2px; width: 100%; background: var(--accent);
}

/* Nav collapse on small viewports (content-driven em breakpoint — rubric 2.2).
   The four text links sit on one compact row spread edge to edge; the
   "Book a call" CTA pins to the wordmark row (top right) instead of forcing a
   third row. Keeps the mobile header tight — it was ~22% of the first screen
   when the whole nav wrapped full-width beneath the brand. */
@media (max-width: 46em) {
  .site-header__inner {
    flex-wrap: wrap;
    padding-block: var(--sp-3);
    row-gap: var(--sp-2);
    position: relative;                           /* anchor the pinned CTA */
  }
  .primary-nav { width: 100%; margin-left: 0; }
  .primary-nav__list {
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: var(--sp-2);
  }
  /* CTA floats onto the wordmark row, pinned to the right edge. */
  .primary-nav__list > li:last-child {
    position: absolute;
    top: 0;
    right: 0;
  }
  .primary-nav__list > li:last-child .btn {
    padding-block: 0.5rem;
    min-height: 40px;
  }
  .primary-nav__link { min-height: 40px; }
}

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.85rem 1.35rem;
  min-height: 44px;                                   /* rubric 4.5 AAA */
  font-family: var(--font-sans); font-weight: 600;
  font-size: var(--step-0);
  border-radius: var(--radius);
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease);
  border: 1px solid transparent;
  cursor: pointer;
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--eh-ink); color: var(--text-on-ink);
}
.btn--primary:hover { background: var(--eh-ink-hover); }
.btn--accent {
  background: var(--accent); color: var(--eh-white);
}
.btn--accent:hover { background: var(--accent-hover); }
.btn--ghost {
  background: transparent; color: var(--eh-ink);
  border-color: var(--eh-ink);
}
.btn--ghost:hover { background: var(--eh-ink); color: var(--text-on-ink); }
.btn--link {
  padding: 0; min-height: 44px; align-items: center;
  color: var(--accent); background: none; border: 0;
  font-weight: 600;
}
.btn--link:hover { color: var(--accent-hover); text-decoration: underline; }
.btn--lg { padding: 1rem 1.75rem; font-size: var(--step-1); }

.cta-row {
  display: flex; flex-wrap: wrap; gap: var(--sp-4);
  align-items: center;
}

/* ── Hero ─────────────────────────────────────────────────────────── */
.hero {
  position: relative; overflow: hidden;
  background: var(--bg-primary);
  padding-block: clamp(3.5rem, 6vw + 2rem, 8rem) clamp(3rem, 4vw + 1rem, 6rem);
}
.hero__grid {
  width: var(--container); margin-inline: auto;
  display: grid; gap: clamp(1.5rem, 4vw, 4rem);
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
}
@media (min-width: 60em) {
  .hero__grid { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); }
}
.hero__copy { max-width: 52ch; }
.hero__h1 {
  margin-top: var(--sp-4);
  /* Slightly smaller ceiling than --step-5 so the 7-word headline settles
     into ~3 lines in the hero column instead of breaking one word per line
     (kept fully fluid; min unchanged). */
  font-size: clamp(2.75rem, 2.4rem + 1.6vw, 4.5rem);
  line-height: var(--lh-display);
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.hero__h1 em {
  font-style: normal; color: var(--accent);
}
.hero__lead {
  margin-top: var(--sp-5);
  font-size: var(--step-1);
  color: var(--text-muted);
  max-width: 42ch;
  line-height: 1.55;
}
.hero__ctas { margin-top: var(--sp-6); }
.hero__meta {
  margin-top: var(--sp-6);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--text-quiet);
  display: flex; gap: 1.25rem; flex-wrap: wrap;
}
.hero__meta a { color: var(--accent); text-decoration: none; }
.hero__meta a:hover { text-decoration: underline; }
.hero__figure {
  position: relative; aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-secondary);
  box-shadow: var(--shadow-2);
}
.hero__figure img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}

/* ── Section head (eyebrow + H2 + sub) ────────────────────────────── */
.section-head {
  max-width: 62ch;
  margin-bottom: var(--sp-7);
}
.section-head__eyebrow { display: block; }
.section-head__h2 {
  margin-top: var(--sp-3);
  font-size: var(--step-4);
}
.section-head__sub {
  margin-top: var(--sp-4);
  font-size: var(--step-1);
  color: var(--text-muted);
  max-width: 58ch;
  line-height: 1.55;
}

/* ── Grid + card ──────────────────────────────────────────────────── */
.grid {
  display: grid; gap: var(--sp-6);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
}
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); }

.card {
  background: var(--eh-white);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 1.5vw + 0.75rem, 2rem);
  display: flex; flex-direction: column; gap: var(--sp-4);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--eh-graphite-25); }
.card__tag {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.06em;
  color: var(--accent);
}
.card__title {
  font-size: var(--step-2);
  color: var(--eh-ink);
}
.card__body {
  color: var(--text-muted);
  max-width: 44ch;
  font-size: var(--step-0);
}
.card__meta {
  display: flex; align-items: baseline; gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--text-quiet);
  margin-top: auto;
}
.card__price {
  font-family: var(--font-mono);
  font-size: var(--step-0);
  color: var(--eh-ink);
}
.card__price small { color: var(--text-quiet); font-size: 0.75em; margin-left: 0.25rem; }
.card__cta {
  margin-top: auto; align-self: flex-start;
  color: var(--accent); font-family: var(--font-sans); font-weight: 600;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 0.4rem;
  min-height: 44px;
}
.card__cta:hover { color: var(--accent-hover); }
.card__cta::after { content: '→'; transition: transform var(--dur-fast) var(--ease); }
.card__cta:hover::after { transform: translateX(3px); }

.card--dark {
  background: var(--eh-ink); color: var(--text-on-ink);
  border-color: transparent;
}
.card--dark .card__title { color: var(--text-on-ink); }
.card--dark .card__body  { color: var(--text-on-ink-muted); }
.card--dark .card__cta   { color: var(--accent); }

.badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.05em;
}
.badge--muted { background: var(--hairline); color: var(--text-muted); }

/* ── Brand family strip ───────────────────────────────────────────── */
.family {
  display: grid; gap: var(--sp-5);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
}
.family__cell {
  padding: var(--sp-5);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--bg-primary);
}
.family__cell--parent {
  border-color: var(--accent);
  background:
    linear-gradient(180deg, var(--accent-tint), transparent 40%),
    var(--bg-primary);
}
.family__role {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.08em;
  color: var(--text-quiet);
}
.family__name {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: var(--step-1);
  color: var(--eh-ink);
  margin-top: var(--sp-2);
}
.family__body {
  color: var(--text-muted);
  margin-top: var(--sp-2);
  font-size: var(--step-0);
}

/* ── Footer ───────────────────────────────────────────────────────── */
.site-footer {
  background: var(--bg-ink);
  color: var(--text-on-ink-muted);
  padding-block: var(--section-y) var(--sp-7);
  margin-top: var(--section-y);
}
.site-footer__inner {
  width: var(--container); margin-inline: auto;
  display: grid; gap: var(--sp-7);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
}
.site-footer h3 {
  color: var(--text-on-ink);
  font-size: var(--step-0);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: var(--sp-4);
}
.site-footer a {
  color: var(--text-on-ink); text-decoration: none;
  display: inline-flex; align-items: center; min-height: 44px;
}
.site-footer a:hover { color: var(--accent); }
.site-footer ul { list-style: none; }
.site-footer li + li { margin-top: var(--sp-1); }
.site-footer__note {
  margin-top: var(--sp-8);
  padding-top: var(--sp-5);
  border-top: 1px solid rgba(233, 238, 243, 0.12);
  display: flex; flex-wrap: wrap; gap: var(--sp-5);
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: rgba(233, 238, 243, 0.55);
  width: var(--container); margin-inline: auto;
}

/* ── Book-a-call strip (parallel CTA band) ────────────────────────── */
.book-strip {
  background: var(--bg-ink); color: var(--text-on-ink);
  padding-block: clamp(3rem, 5vw + 1rem, 5rem);
  position: relative; overflow: hidden;
}
.book-strip__inner {
  width: var(--container); margin-inline: auto;
  display: grid; gap: var(--sp-6);
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
}
@media (min-width: 52em) {
  .book-strip__inner { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
}
.book-strip h2 { color: var(--text-on-ink); font-size: var(--step-3); }
.book-strip p  { color: var(--text-on-ink-muted); }
.book-strip .btn--ghost {
  color: var(--text-on-ink); border-color: var(--text-on-ink);
}
.book-strip .btn--ghost:hover {
  background: var(--text-on-ink); color: var(--eh-ink);
}

/* ── Article body (writing pages) ─────────────────────────────────── */
.prose {
  width: var(--container-narrow); margin-inline: auto;
  font-family: var(--font-serif);
  font-size: var(--step-0);
  line-height: var(--lh-body);
  color: var(--text-body);
}
.prose h2 { font-size: var(--step-3); margin-top: var(--sp-7); }
.prose h3 { font-size: var(--step-2); margin-top: var(--sp-6); }
.prose p, .prose ul, .prose ol { max-width: var(--measure); margin-top: var(--sp-4); }
.prose ul, .prose ol { padding-left: 1.25rem; }
.prose li + li { margin-top: var(--sp-2); }
.prose a { color: var(--accent); }
.prose code {
  font-family: var(--font-mono); font-size: 0.94em;
  background: var(--bg-secondary); padding: 0.1rem 0.35rem; border-radius: 4px;
}
.prose blockquote {
  margin-top: var(--sp-5); padding-left: var(--sp-4);
  border-left: 3px solid var(--accent);
  color: var(--text-muted); font-style: italic;
  max-width: 58ch;
}

/* ── Utility ──────────────────────────────────────────────────────── */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.text-mono { font-family: var(--font-mono); }
.text-quiet { color: var(--text-quiet); }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }

/* ── 404 page ─────────────────────────────────────────────────────── */
.notfound {
  min-height: 70vh;
  display: grid; place-items: center;
  text-align: center;
  padding: var(--sp-8) var(--sp-5);
}
.notfound__code {
  font-family: var(--font-mono);
  font-size: var(--step-3);
  color: var(--accent);
  letter-spacing: 0.1em;
}
.notfound__h1 { font-size: var(--step-4); margin-top: var(--sp-3); }
.notfound__cta { margin-top: var(--sp-6); }
