@charset "UTF-8";
/* ==========================================================================
   elliotvance.dev — design system
   1.  Tokens
   2.  Reset & base
   3.  Layout primitives
   4.  Typography
   5.  Buttons & links
   6.  Header / navigation
   7.  Hero
   8.  Cards (project / post)
   9.  Sections, grids, timeline, skills
   10. Toolbar, chips, forms
   11. Article (prose, TOC, callouts, code)
   12. Footer
   13. Utilities & motion
   14. Print
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */

:root {
  color-scheme: dark;

  --bg:            #0d1014;
  --bg-elev:       #11151b;
  --surface:       #151a21;
  --surface-2:     #1a2029;
  --text:          #e9edf2;
  --text-strong:   #ffffff;
  --muted:         #98a3b1;
  --faint:         #6d7885;
  --border:        #242b35;
  --border-strong: #313a46;

  --accent:        #ff6b3d;
  --accent-ink:    #ff8f68;
  --accent-soft:   rgba(255, 107, 61, 0.12);
  --accent-line:   rgba(255, 107, 61, 0.32);
  --ok:            #3ecf8e;
  --ok-soft:       rgba(62, 207, 142, 0.12);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 24px -8px rgba(0, 0, 0, 0.65);
  --shadow-lg: 0 24px 60px -24px rgba(0, 0, 0, 0.8);

  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable Text",
    "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
    Georgia, ui-serif, serif;
  --font-mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  --step--1: clamp(0.82rem, 0.79rem + 0.14vw, 0.88rem);
  --step-0:  clamp(1rem, 0.97rem + 0.16vw, 1.08rem);
  --step-1:  clamp(1.2rem, 1.13rem + 0.35vw, 1.4rem);
  --step-2:  clamp(1.5rem, 1.35rem + 0.7vw, 1.9rem);
  --step-3:  clamp(1.9rem, 1.6rem + 1.4vw, 2.7rem);
  --step-4:  clamp(2.4rem, 1.85rem + 2.6vw, 4rem);

  --wrap: 1120px;
  --wrap-narrow: 760px;
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --header-h: 68px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg:            #fbf9f6;
    --bg-elev:       #ffffff;
    --surface:       #ffffff;
    --surface-2:     #f5f1eb;
    --text:          #151a20;
    --text-strong:   #000000;
    --muted:         #5a6472;
    --faint:         #808b98;
    --border:        #e6e1d8;
    --border-strong: #d5cec2;
    --accent:        #d1451c;
    --accent-ink:    #ad3813;
    --accent-soft:   rgba(209, 69, 28, 0.08);
    --accent-line:   rgba(209, 69, 28, 0.28);
    --ok:            #128358;
    --ok-soft:       rgba(18, 131, 88, 0.09);
    --shadow-sm: 0 1px 2px rgba(21, 26, 32, 0.06);
    --shadow-md: 0 8px 24px -12px rgba(21, 26, 32, 0.18);
    --shadow-lg: 0 28px 60px -30px rgba(21, 26, 32, 0.3);
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg:            #fbf9f6;
  --bg-elev:       #ffffff;
  --surface:       #ffffff;
  --surface-2:     #f5f1eb;
  --text:          #151a20;
  --text-strong:   #000000;
  --muted:         #5a6472;
  --faint:         #808b98;
  --border:        #e6e1d8;
  --border-strong: #d5cec2;
  --accent:        #d1451c;
  --accent-ink:    #ad3813;
  --accent-soft:   rgba(209, 69, 28, 0.08);
  --accent-line:   rgba(209, 69, 28, 0.28);
  --ok:            #128358;
  --ok-soft:       rgba(18, 131, 88, 0.09);
  --shadow-sm: 0 1px 2px rgba(21, 26, 32, 0.06);
  --shadow-md: 0 8px 24px -12px rgba(21, 26, 32, 0.18);
  --shadow-lg: 0 28px 60px -30px rgba(21, 26, 32, 0.3);
}

/* 2. Reset & base ---------------------------------------------------------- */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 24px);
}

body {
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.65;
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

img, svg, video { display: block; max-width: 100%; }
img { height: auto; }

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

button { background: none; border: 0; cursor: pointer; }

a { color: inherit; text-decoration: none; }

::selection { background: var(--accent); color: #fff; }

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

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin-block: 2.5rem;
}

/* 3. Layout primitives ----------------------------------------------------- */

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: clamp(1.15rem, 4vw, 2rem);
}

.wrap--narrow { max-width: var(--wrap-narrow); }

main { flex: 1 0 auto; }

.section { padding-block: clamp(3.5rem, 8vw, 6.5rem); }
.section--tight { padding-block: clamp(2.5rem, 5vw, 3.5rem); }
.section--alt {
  background: var(--bg-elev);
  border-block: 1px solid var(--border);
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem 2rem;
  margin-bottom: clamp(1.75rem, 4vw, 2.75rem);
}

.section-head__title { max-width: 46ch; }
.section-head__lead {
  color: var(--muted);
  max-width: 52ch;
  margin-top: 0.6rem;
}

.grid { display: grid; gap: clamp(1rem, 2.5vw, 1.75rem); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: 200;
  padding: 0.7rem 1.1rem;
  background: var(--accent);
  color: #fff;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-weight: 600;
  transition: top 0.18s var(--ease);
}
.skip-link:focus { top: 0; }

/* 4. Typography ------------------------------------------------------------ */

h1, h2, h3, h4 {
  color: var(--text-strong);
  line-height: 1.15;
  letter-spacing: -0.022em;
  font-weight: 640;
  text-wrap: balance;
}

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

p { text-wrap: pretty; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-ink);
}

.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--accent-line);
}

.eyebrow--plain::before { display: none; }

.lead {
  font-size: var(--step-1);
  line-height: 1.55;
  color: var(--muted);
  text-wrap: pretty;
}

.muted { color: var(--muted); }
.small { font-size: var(--step--1); }
.mono { font-family: var(--font-mono); font-size: 0.9em; }

.serif-accent {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0;
}

/* 5. Buttons & links ------------------------------------------------------- */

.btn {
  --btn-bg: var(--surface-2);
  --btn-fg: var(--text);
  --btn-bd: var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.72rem 1.25rem;
  border: 1px solid var(--btn-bd);
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 0.93rem;
  font-weight: 560;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.16s var(--ease), background-color 0.18s var(--ease),
    border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), color 0.18s var(--ease);
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn--primary {
  --btn-bg: var(--accent);
  --btn-fg: #fff;
  --btn-bd: transparent;
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.btn--primary:hover { --btn-bg: var(--accent-ink); }

.btn--outline {
  --btn-bg: transparent;
  --btn-bd: var(--border-strong);
}
.btn--outline:hover {
  --btn-bd: var(--accent-line);
  --btn-bg: var(--accent-soft);
  color: var(--accent-ink);
}

.btn--ghost { --btn-bg: transparent; --btn-bd: transparent; color: var(--muted); }
.btn--ghost:hover { --btn-bg: var(--accent-soft); color: var(--accent-ink); }

.btn--sm { padding: 0.5rem 0.9rem; font-size: 0.85rem; }
.btn--block { width: 100%; }

.btn svg { width: 1em; height: 1em; flex: none; }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 560;
  color: var(--accent-ink);
}
.link-arrow::after {
  content: "→";
  transition: transform 0.2s var(--ease);
}
.link-arrow:hover::after { transform: translateX(3px); }

.link-underline {
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 0.22em;
  text-decoration-thickness: 1px;
  transition: text-decoration-color 0.18s var(--ease), color 0.18s var(--ease);
}
.link-underline:hover {
  color: var(--accent-ink);
  text-decoration-color: var(--accent);
}

/* 6. Header / navigation --------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s var(--ease), background-color 0.25s var(--ease);
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .site-header { background: var(--bg); }
}

.site-header.is-stuck {
  border-bottom-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 640;
  letter-spacing: -0.01em;
  color: var(--text-strong);
  margin-right: auto;
}

.brand__mark { width: 30px; height: 30px; flex: none; }
.brand__mark rect,
.brand__mark path { transition: fill 0.25s var(--ease); }

.brand__text { display: flex; flex-direction: column; line-height: 1.1; }
.brand__name { font-size: 0.98rem; }
.brand__role {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 400;
}

.nav { display: flex; align-items: center; gap: 0.15rem; }

.nav__link {
  position: relative;
  padding: 0.5rem 0.72rem;
  border-radius: 8px;
  font-size: 0.92rem;
  color: var(--muted);
  transition: color 0.18s var(--ease), background-color 0.18s var(--ease);
}
.nav__link:hover { color: var(--text); background: var(--surface-2); }
.nav__link.is-active { color: var(--text-strong); }
.nav__link.is-active::after {
  content: "";
  position: absolute;
  left: 0.72rem;
  right: 0.72rem;
  bottom: 0.1rem;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.header-actions { display: flex; align-items: center; gap: 0.5rem; }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease),
    background-color 0.18s var(--ease);
}
.theme-toggle:hover {
  color: var(--accent-ink);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="dark"]) .theme-toggle .icon-moon { display: block; }
}

.nav-toggle {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text);
  place-items: center;
}
.nav-toggle svg { width: 18px; height: 18px; }
.nav-toggle .icon-close { display: none; }

.mobile-nav {
  display: none;
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
  padding: 0.75rem clamp(1.15rem, 4vw, 2rem) 1.5rem;
}
.mobile-nav__list { list-style: none; padding: 0; display: grid; gap: 0.15rem; }
.mobile-nav__link {
  display: block;
  padding: 0.75rem 0.5rem;
  border-radius: 10px;
  font-size: 1.02rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.mobile-nav__link.is-active { color: var(--accent-ink); }
.mobile-nav__foot {
  margin-top: 1.1rem;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

@media (max-width: 900px) {
  .nav { display: none; }
  .nav-toggle { display: grid; }
  .mobile-nav { display: none; }
  body.nav-open .mobile-nav { display: block; }
  body.nav-open .nav-toggle .icon-menu { display: none; }
  body.nav-open .nav-toggle .icon-close { display: block; }
  body.nav-open { overflow: hidden; }
}

@media (max-width: 620px) {
  .header-actions .btn { display: none; }
  .brand__role { display: none; }
}

/* 7. Hero ------------------------------------------------------------------ */

.hero {
  position: relative;
  padding-block: clamp(3.5rem, 9vw, 7rem) clamp(3rem, 7vw, 5.5rem);
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: -35% -20% auto -20%;
  height: 620px;
  background:
    radial-gradient(46% 52% at 22% 42%, var(--accent-soft) 0%, transparent 68%),
    radial-gradient(38% 44% at 78% 22%, rgba(120, 140, 255, 0.09) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 68px 68px;
  mask-image: radial-gradient(70% 55% at 50% 20%, #000 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(70% 55% at 50% 20%, #000 0%, transparent 75%);
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
}

.hero__inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}

@media (max-width: 880px) {
  .hero__inner { grid-template-columns: 1fr; }
  .hero__art { order: -1; max-width: 320px; }
}

.hero__title { margin-top: 1.1rem; }
.hero__title .serif-accent { color: var(--accent-ink); }
.hero__lead { margin-top: 1.35rem; max-width: 54ch; }
.hero__actions {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.hero__stats {
  margin-top: 2.75rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 1.5rem 1.1rem;
}

.stat__num {
  font-size: var(--step-2);
  font-weight: 640;
  color: var(--text-strong);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.stat__label {
  font-size: var(--step--1);
  color: var(--muted);
  margin-top: 0.15rem;
}

.hero__art { position: relative; }
.hero__art svg { width: 100%; height: auto; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.8rem 0.35rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.8rem;
  color: var(--muted);
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-soft);
  animation: pulse 2.6s var(--ease) infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* 8. Cards ----------------------------------------------------------------- */

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.22s var(--ease), border-color 0.22s var(--ease),
    box-shadow 0.22s var(--ease);
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}
.card__body { padding: 1.35rem 1.4rem 1.5rem; display: flex; flex-direction: column; flex: 1; gap: 0.65rem; }
.card__title { font-size: var(--step-1); font-weight: 620; }
.card__title a::after { content: ""; position: absolute; inset: 0; }
.card__excerpt { color: var(--muted); font-size: 0.95rem; flex: 1; }
.card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  font-size: 0.82rem;
  color: var(--faint);
  font-family: var(--font-mono);
}
.card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.4rem;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
}

.card__media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.card__media svg { width: 100%; height: 100%; }
.card__media--tall { aspect-ratio: 4 / 3; }

.card--post .card__body { gap: 0.5rem; }

.card--compact { flex-direction: row; align-items: stretch; }
.card--compact .card__media {
  flex: 0 0 168px;
  aspect-ratio: auto;
  border-bottom: 0;
  border-right: 1px solid var(--border);
}
@media (max-width: 620px) {
  .card--compact { flex-direction: column; }
  .card--compact .card__media {
    flex: none;
    aspect-ratio: 16 / 9;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
}

/* Project cards */
.project-card .card__media { aspect-ratio: 3 / 2; }
.project-card__stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.tag {
  display: inline-block;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.tag--accent { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-ink); }
.tag--ok { border-color: transparent; background: var(--ok-soft); color: var(--ok); }

/* 9. Sections, timeline, skills -------------------------------------------- */

.timeline { list-style: none; padding: 0; position: relative; }
.timeline::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6rem;
  bottom: 0.6rem;
  width: 1px;
  background: linear-gradient(var(--border), transparent);
}
.timeline__item {
  position: relative;
  padding: 0 0 2.25rem 1.9rem;
}
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item::before {
  content: "";
  position: absolute;
  left: -4.5px;
  top: 0.62rem;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}
.timeline__when {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}
.timeline__what { font-size: var(--step-1); font-weight: 620; color: var(--text-strong); margin-top: 0.2rem; }
.timeline__where { color: var(--accent-ink); font-size: 0.92rem; }
.timeline__text { color: var(--muted); font-size: 0.95rem; margin-top: 0.5rem; max-width: 62ch; }

.skill-list { list-style: none; padding: 0; display: grid; gap: 0.5rem; }
.skill-list li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.93rem;
  color: var(--muted);
}
.skill-list li::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: var(--accent);
  flex: none;
  transform: rotate(45deg);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.4rem, 3vw, 2rem);
}
.panel--flat { background: transparent; }
.panel__title { font-size: var(--step-1); font-weight: 620; margin-bottom: 1rem; }

.fact-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px dashed var(--border);
  font-size: 0.92rem;
}
.fact-row:last-child { border-bottom: 0; }
.fact-row dt { color: var(--faint); }
.fact-row dd { color: var(--text); text-align: right; margin: 0; }

.stack-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.stack-strip span {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  border: 1px dashed var(--border-strong);
  color: var(--muted);
}

/* 10. Toolbar, chips, forms ------------------------------------------------ */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 2rem;
}

.search {
  position: relative;
  flex: 1 1 260px;
  max-width: 360px;
}
.search__input {
  width: 100%;
  padding: 0.66rem 0.9rem 0.66rem 2.4rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.92rem;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.search__input::placeholder { color: var(--faint); }
.search__input:focus {
  outline: none;
  border-color: var(--accent-line);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.search__icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--faint);
  pointer-events: none;
}

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.83rem;
  transition: all 0.16s var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip.is-active {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent-ink);
}
.chip__count { opacity: 0.6; margin-left: 0.25rem; font-family: var(--font-mono); font-size: 0.75em; }

.result-count { font-size: 0.85rem; color: var(--faint); margin-left: auto; }

.form { display: grid; gap: 1.15rem; }
.field { display: grid; gap: 0.4rem; }
.field__label { font-size: 0.85rem; font-weight: 560; color: var(--text); }
.field__label .req { color: var(--accent); }
.field__input,
.field__textarea,
.field__select {
  width: 100%;
  padding: 0.72rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.field__select {
  appearance: none;
  padding-right: 2.4rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 1.25rem) calc(50% + 1px), calc(100% - 1rem) calc(50% + 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}
.field__select option {
  background: var(--bg-elev);
  color: var(--text);
}
.field__textarea { min-height: 150px; resize: vertical; }
.field__input:focus,
.field__textarea:focus,
.field__select:focus {
  outline: none;
  border-color: var(--accent-line);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.field__hint { font-size: 0.8rem; color: var(--faint); }
.field__error { font-size: 0.8rem; color: var(--accent-ink); min-height: 1.1em; }
.field.has-error .field__input,
.field.has-error .field__textarea { border-color: var(--accent); }

.form__status {
  display: none;
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--ok);
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 0.9rem;
}
.form__status.is-visible { display: block; }
.form__status--error { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }

.checkbox {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  font-size: 0.87rem;
  color: var(--muted);
}
.checkbox input { margin-top: 0.28rem; accent-color: var(--accent); }

.contact-item {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
}
.contact-item:last-child { border-bottom: 0; }
.contact-item__icon {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.contact-item__icon svg { width: 16px; height: 16px; }
.contact-item__label { font-size: 0.78rem; color: var(--faint); text-transform: uppercase; letter-spacing: 0.08em; font-family: var(--font-mono); }
.contact-item__value { font-weight: 520; }

/* 11. Article -------------------------------------------------------------- */

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.83rem;
  color: var(--faint);
  font-family: var(--font-mono);
}
.breadcrumbs a:hover { color: var(--accent-ink); }
.breadcrumbs span[aria-hidden] { opacity: 0.5; }

.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: var(--accent);
  z-index: 150;
  transition: width 0.08s linear;
}

.post-header {
  padding-block: clamp(2.5rem, 6vw, 4rem) clamp(1.5rem, 3vw, 2rem);
}
.post-header__title { margin-top: 1rem; max-width: 22ch; }
.post-header__standfirst {
  margin-top: 1.25rem;
  font-size: var(--step-1);
  color: var(--muted);
  max-width: 60ch;
}
.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
  margin-top: 1.75rem;
  padding-top: 1.35rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--faint);
}
.post-meta__author { display: flex; align-items: center; gap: 0.6rem; }
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  flex: none;
}
.avatar--lg { width: 64px; height: 64px; }

.post-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}
@media (max-width: 940px) {
  .post-layout { grid-template-columns: 1fr; }
  .post-aside { display: none; }
}
.post-aside { position: sticky; top: calc(var(--header-h) + 28px); }

.toc__title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 0.85rem;
}
.toc__list { list-style: none; padding: 0; display: grid; gap: 0.1rem; }
.toc__list a {
  display: block;
  padding: 0.3rem 0 0.3rem 0.85rem;
  border-left: 2px solid var(--border);
  font-size: 0.85rem;
  color: var(--muted);
  transition: all 0.16s var(--ease);
}
.toc__list a:hover { color: var(--text); border-left-color: var(--border-strong); }
.toc__list a.is-active {
  color: var(--accent-ink);
  border-left-color: var(--accent);
  font-weight: 520;
}
.toc__list .toc__sub a { padding-left: 1.6rem; font-size: 0.8rem; }
.toc__empty { font-size: 0.85rem; color: var(--faint); }

.prose {
  max-width: 68ch;
  font-size: 1.03rem;
  line-height: 1.75;
}
.prose > * + * { margin-top: 1.35em; }
.prose h2 {
  font-size: var(--step-2);
  margin-top: 2.4em;
  scroll-margin-top: calc(var(--header-h) + 24px);
}
.prose h3 {
  font-size: var(--step-1);
  margin-top: 2em;
  scroll-margin-top: calc(var(--header-h) + 24px);
}
.prose h2 + p, .prose h3 + p { margin-top: 0.85em; }
.prose a {
  color: var(--accent-ink);
  text-decoration: underline;
  text-decoration-color: var(--accent-line);
  text-underline-offset: 0.2em;
}
.prose a:hover { text-decoration-color: var(--accent); }
.prose strong { color: var(--text-strong); font-weight: 620; }
.prose ul, .prose ol { padding-left: 1.35em; }
.prose li + li { margin-top: 0.5em; }
.prose li::marker { color: var(--accent); }
.prose blockquote {
  margin-inline: 0;
  padding: 0.2rem 0 0.2rem 1.35rem;
  border-left: 3px solid var(--accent);
  font-family: var(--font-serif);
  font-size: 1.12rem;
  font-style: italic;
  color: var(--text);
}
.prose blockquote cite {
  display: block;
  margin-top: 0.6rem;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-style: normal;
  color: var(--faint);
}
.prose code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  padding: 0.14em 0.4em;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--accent-ink);
}
.prose pre {
  padding: 1.15rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  overflow-x: auto;
  font-size: 0.86rem;
  line-height: 1.65;
  tab-size: 2;
}
.prose pre code {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font-size: 1em;
}
.prose img, .prose figure svg { border-radius: var(--radius); border: 1px solid var(--border); }
.prose figure { margin: 2em 0; }
.prose figcaption {
  margin-top: 0.7rem;
  font-size: 0.83rem;
  color: var(--faint);
  text-align: center;
}
.prose hr { margin-block: 2.75rem; }
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.prose th, .prose td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.prose th {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 500;
}

.callout {
  padding: 1.15rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  background: var(--surface);
  font-size: 0.94rem;
}
.callout__title {
  font-weight: 620;
  color: var(--text-strong);
  margin-bottom: 0.35rem;
  font-size: 0.95rem;
}
.callout p + p { margin-top: 0.7em; }

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 2.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
}

.post-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 1rem;
  margin-top: 2rem;
}
.post-nav__item {
  display: block;
  padding: 1.15rem 1.3rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.18s var(--ease), transform 0.18s var(--ease);
}
.post-nav__item:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.post-nav__dir {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}
.post-nav__title { font-weight: 600; color: var(--text-strong); margin-top: 0.35rem; }
.post-nav__item--next { text-align: right; }

.author-box {
  display: flex;
  gap: 1.15rem;
  align-items: flex-start;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  margin-top: 2.5rem;
}
.author-box__name { font-weight: 620; color: var(--text-strong); }
.author-box p { color: var(--muted); font-size: 0.92rem; margin-top: 0.4rem; }

.share-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 1.75rem;
  font-size: 0.85rem;
  color: var(--faint);
}

/* 12. Footer --------------------------------------------------------------- */

.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
  padding-block: clamp(2.75rem, 6vw, 4rem) 2rem;
  font-size: 0.92rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(auto-fit, minmax(140px, 1fr));
  gap: clamp(1.75rem, 4vw, 3rem);
}
@media (max-width: 720px) {
  .footer-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .footer-about { grid-column: 1 / -1; }
}
.footer-about p { color: var(--muted); margin-top: 0.9rem; max-width: 40ch; font-size: 0.9rem; }
.footer-col__title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 0.95rem;
}
.footer-links { list-style: none; padding: 0; display: grid; gap: 0.55rem; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--accent-ink); }

.social-row { display: flex; gap: 0.5rem; margin-top: 1.25rem; }
.social-row a {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--border);
  color: var(--muted);
  transition: all 0.18s var(--ease);
}
.social-row a:hover {
  color: var(--accent-ink);
  border-color: var(--accent-line);
  background: var(--accent-soft);
  transform: translateY(-2px);
}
.social-row svg { width: 16px; height: 16px; }

.footer-bottom {
  margin-top: clamp(2.25rem, 5vw, 3.25rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  font-size: 0.83rem;
  color: var(--faint);
}
.footer-bottom__meta { display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; align-items: center; }

.newsletter {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: minmax(0, 1fr) minmax(0, 420px);
  align-items: center;
  padding: clamp(1.75rem, 4vw, 2.75rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(120% 140% at 100% 0%, var(--accent-soft) 0%, transparent 60%),
    var(--surface);
}
@media (max-width: 780px) { .newsletter { grid-template-columns: 1fr; } }
.newsletter__form { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.newsletter__form .field__input { flex: 1 1 200px; border-radius: 999px; }

/* 13. Utilities & motion --------------------------------------------------- */

/* Data tables (uses, outcomes, audit findings) */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.data-table caption {
  text-align: left;
  color: var(--faint);
  font-size: 0.83rem;
  padding-bottom: 0.85rem;
}
.data-table th,
.data-table td {
  padding: 0.72rem 0.9rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.data-table th {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 500;
  white-space: nowrap;
}
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table td:first-child { color: var(--text); font-weight: 520; }
.data-table .num {
  font-family: var(--font-mono);
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

kbd {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  padding: 0.16em 0.45em;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  white-space: nowrap;
  line-height: 1.3;
}

.portrait {
  width: 100%;
  max-width: 320px;
  height: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.media-frame {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  gap: clamp(1.75rem, 4vw, 3.25rem);
  align-items: start;
}
@media (max-width: 800px) {
  .split { grid-template-columns: 1fr; }
  .split__aside { max-width: 300px; }
}

.definition-list { display: grid; gap: 0; margin: 0; }

/* Structural BEM blocks: these carry no decoration, but they are grid and flex
   children, so they need min-width:0 to stop long words forcing overflow. */
.footer-col,
.toc,
.stat { min-width: 0; }

.contact-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: clamp(1.75rem, 4vw, 3.25rem);
  align-items: start;
}
@media (max-width: 880px) {
  .contact-layout { grid-template-columns: 1fr; }
}

.faq { border-bottom: 1px solid var(--border); }
.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 0;
  font-weight: 560;
  color: var(--text);
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  font-family: var(--font-mono);
  font-size: 1.05rem;
  line-height: 1;
  color: var(--accent-ink);
  flex: none;
}
.faq[open] summary::after { content: "\2212"; }
.faq > p {
  padding-bottom: 1rem;
  color: var(--muted);
  font-size: 0.93rem;
  max-width: 60ch;
}
.faq summary:hover { color: var(--accent-ink); }

.center { text-align: center; }
.stack-sm > * + * { margin-top: 0.75rem; }
.stack > * + * { margin-top: 1.35rem; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mt-3 { margin-top: 3rem; }
.mb-2 { margin-bottom: 2rem; }
.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;
}
.empty-state {
  padding: 3.5rem 1.5rem;
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--muted);
}

/* Reveal-on-scroll is opt-in. The gating class is added by the inline head script,
   and main.js confirms it loaded within 2.5s; if scripting is unavailable or the
   script fails to load, content stays visible instead of stuck at opacity 0. */
.js-reveal .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
  will-change: opacity, transform;
}
.js-reveal .reveal.is-visible,
.js-reveal.no-js-reveal .reveal { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* 404 */
.error-page {
  min-height: 62vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding-block: clamp(3rem, 8vw, 6rem);
}
.error-page__code {
  font-family: var(--font-mono);
  font-size: clamp(4rem, 16vw, 9rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.05em;
  background: linear-gradient(160deg, var(--accent), var(--accent-ink) 45%, var(--faint));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* 14. Print ---------------------------------------------------------------- */

@media print {
  .site-header, .site-footer, .post-aside, .progress-bar, .newsletter, .share-row { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .prose { max-width: none; }
  .prose a { color: #000; text-decoration: underline; }
  .prose pre { border: 1px solid #ccc; background: #f7f7f7; }
}
