/* ==========================================================================
   [YOUR NAME] — PM Portfolio
   Style: Stark Monochrome. White ground, near-black type, one cobalt accent.
   Every colour, space and type size below comes from a token in :root.
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. FONTS — self-hosted on purpose.
   Loading these from fonts.gstatic.com would send every visitor's IP address
   to Google before they had consented to anything. Serving them from our own
   origin removes the only third-party request on the site, which is what lets
   the CSP stay tight and the site avoid a consent banner entirely.
   Latin subset only (~70KB total). To add more subsets, download the matching
   woff2 files and add unicode-range blocks.
   -------------------------------------------------------------------------- */
@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/instrument-serif-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Instrument Serif";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/instrument-serif-400-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Variable font — one file covers 400 through 700 */
@font-face {
  font-family: "Public Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/public-sans-var-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --------------------------------------------------------------------------
   1. TOKENS
   -------------------------------------------------------------------------- */
:root {
  /* Colour — the five required tokens, plus two practical additions */
  --color-bg: #ffffff;
  --color-text: #111111;
  --color-accent: #1b4dff;
  --color-muted: #6b6b6b;
  --color-surface: #f4f4f2;

  --color-border: #e2e2df;
  /* Two border tokens, and the split matters. WCAG 1.4.11 applies to a boundary
     that is the ONLY way to identify a control -- a form input's outline, a ghost
     button's edge. It does not apply to decorative separation: card edges, section
     rules, dividers. So --color-border stays light and good-looking at ~1.2:1, and
     anything that IS the affordance uses --color-border-strong at 3:1 or better.
     Using --color-border on a form input is the exact defect this split prevents. */
  --color-border-strong: #87878f; /* 3.56:1 on --color-bg, 3.24:1 on --color-surface */
  --color-accent-ink: #ffffff; /* text that sits on the accent */

  /* Type — modular scale, ratio 1.25 from a 1rem base */
  --font-display: "Instrument Serif", Georgia, "Times New Roman", serif;
  --font-body: "Public Sans", system-ui, -apple-system, sans-serif;

  --step--1: 0.8rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.5625rem;
  --step-3: 1.9531rem;
  --step-4: 2.4414rem;
  --step-5: 3.0518rem;
  --step-hero: clamp(2.75rem, 8vw, 5rem);

  /* Space */
  --space-2xs: 0.25rem;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1.25rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --space-2xl: 5rem;
  --space-section: 80px;

  /* Layout */
  --max-width: 1100px;
  --gutter: 24px;
  --header-height: 68px;

  /* Depth + motion */
  --shadow-card: 0 1px 2px rgba(17, 17, 17, 0.04), 0 2px 8px rgba(17, 17, 17, 0.04);
  --shadow-card-hover: 0 4px 10px rgba(17, 17, 17, 0.07), 0 12px 28px rgba(17, 17, 17, 0.09);
  --shadow-modal: 0 24px 80px rgba(17, 17, 17, 0.22);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --speed: 220ms;

  --radius: 2px; /* stark, not startup-rounded */
}

@media (min-width: 768px) {
  :root { --space-section: 120px; --gutter: 40px; }
}

/* Dark mode — a pure token swap. Nothing below section 1 hardcodes a colour,
   so redefining these eight variables is the whole feature.

   Three deliberate choices:
   - Text is a warm off-white, not #fff. Pure white on near-black is harsh and
     every well-made dark theme avoids it.
   - The accent is lightened. #1b4dff scores 2.4:1 on a near-black background,
     which fails WCAG AA; #6f8dff clears 6:1.
   - Shadows are rebuilt in pure black at higher alpha. The light-mode shadows
     are rgba(17,17,17,…) and are simply invisible on a dark surface, which
     would flatten every card. */
@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #0e0e10;
    --color-text: #f2f0ec;
    --color-accent: #6f8dff;
    --color-muted: #9b9ba1;
    --color-surface: #17171a;

    --color-border: #2c2c30;
    --color-border-strong: #63636b; /* 3.25:1 on --color-bg, 3.08:1 on --color-surface */
    --color-accent-ink: #0e0e10; /* dark ink on the lightened accent */

    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-card-hover: 0 4px 10px rgba(0, 0, 0, 0.55), 0 12px 28px rgba(0, 0, 0, 0.5);
    --shadow-modal: 0 24px 80px rgba(0, 0, 0, 0.7);
  }

  /* The backdrop is the one colour outside :root, and it has to go darker
     still or the page behind an open deep dive stays legible through it. */
  dialog.deep::backdrop { background: rgba(0, 0, 0, 0.7); }
}

/* --------------------------------------------------------------------------
   2. RESET + BASE
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 16px);
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Scroll lock while a deep dive is open. Driven by the DOM, not by JS state,
   so it can never desync from whatever closed the dialog. */
body:has(dialog.deep[open]) { overflow: hidden; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.015em;
  margin: 0;
}

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

p { margin: 0 0 var(--space-md); }
p:last-child { margin-bottom: 0; }

a {
  color: inherit;
  text-decoration-color: var(--color-border);
  text-underline-offset: 3px;
}
a:hover { text-decoration-color: var(--color-accent); }

img { max-width: 100%; display: block; }

ul { margin: 0; padding: 0; list-style: none; }

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

.skip-link {
  position: absolute;
  top: -100px;
  left: var(--gutter);
  z-index: 200;
  background: var(--color-text);
  color: var(--color-bg);
  padding: var(--space-sm) var(--space-md);
  font-size: var(--step--1);
}
.skip-link:focus { top: var(--space-xs); }

.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;
}

/* --------------------------------------------------------------------------
   3. LAYOUT PRIMITIVES
   -------------------------------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: var(--space-section); }
.section--surface { background: var(--color-surface); }

.section-label {
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin: 0 0 var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.section-label::before {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--color-accent);
  flex: none;
}

.section-intro {
  font-size: var(--step-1);
  color: var(--color-muted);
  max-width: 60ch;
  margin-top: var(--space-md);
}

/* --------------------------------------------------------------------------
   4. BUTTONS — fill-in transition, not a colour swap
   -------------------------------------------------------------------------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.9rem 1.6rem;
  font-family: var(--font-body);
  font-size: var(--step-0);
  font-weight: 600;
  line-height: 1;
  border: 1px solid var(--color-text);
  border-radius: var(--radius);
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  text-decoration: none;
  overflow: hidden;
  isolation: isolate;
  transition: color var(--speed) var(--ease), border-color var(--speed) var(--ease);
}
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--color-text);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--speed) var(--ease);
}
.btn:hover::before,
.btn:focus-visible::before { transform: scaleX(1); }
.btn:hover,
.btn:focus-visible { color: var(--color-accent-ink); }

.btn--accent {
  border-color: var(--color-accent);
  color: var(--color-accent-ink);
}
.btn--accent::before { background: var(--color-accent); transform: scaleX(1); }
.btn--accent:hover::before,
.btn--accent:focus-visible::before { background: var(--color-text); }

/* --------------------------------------------------------------------------
   5. HEADER + NAV
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  display: flex;
  align-items: center;
  background: color-mix(in srgb, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--speed) var(--ease);
}
.site-header.is-stuck { border-bottom-color: var(--color-border); }

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.brand {
  font-family: var(--font-display);
  font-size: var(--step-1);
  text-decoration: none;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand span { color: var(--color-accent); }

.nav-list {
  display: flex;
  gap: var(--space-lg);
  align-items: center;
}

.nav-list a {
  position: relative;
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--color-muted);
  padding-block: var(--space-xs);
  transition: color var(--speed) var(--ease);
}
.nav-list a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--color-accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--speed) var(--ease);
}
.nav-list a:hover { color: var(--color-text); }
.nav-list a.is-active { color: var(--color-text); }
.nav-list a.is-active::after { transform: scaleX(1); }

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--color-text);
}
.nav-toggle svg { width: 20px; height: 20px; }
.nav-toggle .icon-close { display: none; }
.nav-toggle[aria-expanded="true"] .icon-open { display: none; }
.nav-toggle[aria-expanded="true"] .icon-close { display: block; }

@media (max-width: 767px) {
  .nav-toggle { display: inline-flex; }

  .site-nav {
    position: fixed;
    inset: var(--header-height) 0 auto 0;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-md) var(--gutter) var(--space-lg);
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    visibility: hidden;
    transition: grid-template-rows var(--speed) var(--ease),
                opacity var(--speed) var(--ease),
                visibility var(--speed) var(--ease);
  }
  .site-nav.is-open {
    grid-template-rows: 1fr;
    opacity: 1;
    visibility: visible;
  }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    overflow: hidden;
    min-height: 0;
  }
  .nav-list a {
    font-size: var(--step-1);
    padding-block: var(--space-sm);
    border-bottom: 1px solid var(--color-border);
  }
  .nav-list li:last-child a { border-bottom: 0; }
  .nav-list a::after { display: none; }
}

/* --------------------------------------------------------------------------
   6. HERO
   -------------------------------------------------------------------------- */
.hero {
  min-height: calc(100svh - var(--header-height));
  display: flex;
  align-items: center;
  padding-block: var(--space-2xl);
  border-bottom: 1px solid var(--color-border);
}

.hero .wrap {
  display: grid;
  gap: var(--space-2xl);
  align-items: center;
  grid-template-columns: 1fr;
}

@media (min-width: 900px) {
  .hero .wrap {
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
    gap: var(--space-xl);
  }
}

.hero-eyebrow {
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin: 0 0 var(--space-md);
}

.hero h1 { margin-bottom: var(--space-md); }
.hero h1 em { font-style: italic; color: var(--color-accent); }

.hero-role {
  font-size: var(--step-2);
  color: var(--color-text);
  margin-bottom: var(--space-sm);
  font-weight: 400;
}

.hero-positioning {
  font-size: var(--step-1);
  color: var(--color-muted);
  max-width: 48ch;
  margin-bottom: var(--space-lg);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.hero-portrait {
  justify-self: center;
  width: min(300px, 68vw);
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  display: grid;
  place-items: center;
  position: relative;
}
/* <picture> is inline by default, so it would not fill the circular frame and the
   img inside it would size to nothing. Making it a block that fills the grid cell
   keeps the existing `.hero-portrait img` rule working unchanged. */
.hero-portrait picture { display: block; width: 100%; height: 100%; }
.hero-portrait img { width: 100%; height: 100%; object-fit: cover; }
.hero-portrait .initials {
  font-family: var(--font-display);
  font-size: var(--step-5);
  color: var(--color-muted);
  letter-spacing: 0.02em;
}
.hero-portrait::after {
  content: "";
  position: absolute;
  inset: -10px;
  border: 1px solid var(--color-accent);
  border-radius: 50%;
  opacity: 0.35;
}

/* --------------------------------------------------------------------------
   7. ABOUT
   -------------------------------------------------------------------------- */
.about-grid {
  display: grid;
  gap: var(--space-xl);
  grid-template-columns: 1fr;
}
@media (min-width: 900px) {
  .about-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    gap: var(--space-2xl);
  }
}

.about-narrative {
  font-family: var(--font-display);
  font-size: var(--step-3);
  line-height: 1.32;
  letter-spacing: -0.01em;
  max-width: 34ch;
}

.capability-tiles {
  display: grid;
  gap: var(--space-md);
  grid-template-columns: 1fr;
  margin-top: var(--space-lg);
}
@media (min-width: 560px) {
  .capability-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
  .capability-tiles { margin-top: 0; }
}

.tile {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-md);
  background: var(--color-bg);
  transition: transform var(--speed) var(--ease),
              box-shadow var(--speed) var(--ease),
              border-color var(--speed) var(--ease);
}
.tile:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--color-text);
}
.tile svg {
  width: 22px;
  height: 22px;
  color: var(--color-accent);
  margin-bottom: var(--space-sm);
}
.tile h3 {
  font-family: var(--font-body);
  font-size: var(--step-0);
  font-weight: 700;
  letter-spacing: 0;
  margin-bottom: var(--space-2xs);
}
.tile p {
  font-size: var(--step--1);
  color: var(--color-muted);
  line-height: 1.55;
}

.skills { margin-top: var(--space-2xl); }

.skill-group + .skill-group { margin-top: var(--space-lg); }

.skill-group h3 {
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: var(--space-sm);
}

.chips { display: flex; flex-wrap: wrap; gap: var(--space-xs); }

.chip {
  font-size: var(--step--1);
  line-height: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  transition: border-color var(--speed) var(--ease), color var(--speed) var(--ease);
}
.chip:hover { border-color: var(--color-accent); color: var(--color-accent); }

/* --------------------------------------------------------------------------
   8. MOTION — scroll reveal
   -------------------------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 600ms var(--ease), transform 600ms var(--ease);
}
.reveal.is-visible { opacity: 1; transform: none; }

/* Hero staggers on load rather than on scroll */
.hero .stagger > * {
  opacity: 0;
  animation: rise 700ms var(--ease) forwards;
}
.hero .stagger > *:nth-child(1) { animation-delay: 80ms; }
.hero .stagger > *:nth-child(2) { animation-delay: 160ms; }
.hero .stagger > *:nth-child(3) { animation-delay: 240ms; }
.hero .stagger > *:nth-child(4) { animation-delay: 320ms; }
.hero .stagger > *:nth-child(5) { animation-delay: 400ms; }
.hero-portrait { opacity: 0; animation: rise 700ms var(--ease) 320ms forwards; }

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

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

/* --------------------------------------------------------------------------
   9. CASE STUDY CARDS
   -------------------------------------------------------------------------- */
.work-grid {
  display: grid;
  gap: var(--space-md);
  grid-template-columns: 1fr;
  margin-top: var(--space-xl);
}
@media (min-width: 768px) {
  .work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-lg); }
}

.case-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-lg);
  transition: transform var(--speed) var(--ease),
              box-shadow var(--speed) var(--ease),
              border-color var(--speed) var(--ease);
}
.case-card:hover,
.case-card:focus-within {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--color-text);
}

.case-card__impact {
  align-self: flex-start;
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  padding: 0.45rem 0.7rem;
  color: var(--color-accent);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius);
}

.case-card h3 { letter-spacing: -0.02em; }

.case-card__problem { color: var(--color-muted); margin: 0; }

.case-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-top: auto;
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border);
}

.case-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs) var(--space-xs);
  font-size: var(--step--1);
  color: var(--color-muted);
}
.case-tags li::after { content: " /"; color: var(--color-border); }
.case-tags li:last-child::after { content: ""; }

/* The CTA is the real button; its ::after stretches over the whole card so
   the card is clickable without wrapping a heading in a <button>. */
.case-card__cta {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--color-accent);
  white-space: nowrap;
  cursor: pointer;
}
.case-card__cta::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}
.case-card:hover .case-card__cta { text-decoration: underline; text-underline-offset: 4px; }
.case-card__cta:focus-visible { outline: none; }
.case-card__cta:focus-visible::after {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   10. METRICS BAR
   -------------------------------------------------------------------------- */
.metrics-bar {
  border-block: 1px solid var(--color-border);
  background: var(--color-surface);
  padding-block: var(--space-xl);
}
.metrics {
  display: grid;
  gap: var(--space-lg);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 768px) {
  .metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.metric__value {
  font-family: var(--font-display);
  font-size: var(--step-5);
  line-height: 1;
  letter-spacing: -0.02em;
  display: block;
}
.metric__value .suffix { color: var(--color-accent); }

.metric__label {
  display: block;
  margin-top: var(--space-xs);
  font-size: var(--step--1);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-muted);
}

/* --------------------------------------------------------------------------
   11. EXPERIENCE TIMELINE
   -------------------------------------------------------------------------- */
.timeline { margin-top: var(--space-xl); }

.job {
  display: grid;
  gap: var(--space-md);
  grid-template-columns: 1fr;
  padding-block: var(--space-lg);
  border-top: 1px solid var(--color-border);
}
.job:last-child { border-bottom: 1px solid var(--color-border); }

@media (min-width: 768px) {
  .job { grid-template-columns: 200px minmax(0, 1fr); gap: var(--space-xl); }
}

.job__aside { display: flex; align-items: flex-start; gap: var(--space-sm); }

.job__logo {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--color-muted);
}

.job__company { font-weight: 700; display: block; }
.job__dates { font-size: var(--step--1); color: var(--color-muted); }

.job h3 { font-size: var(--step-2); margin-bottom: var(--space-sm); }

.job__bullets { display: grid; gap: var(--space-xs); margin-bottom: var(--space-md); }
.job__bullets li {
  position: relative;
  padding-left: var(--space-md);
  color: var(--color-muted);
}
.job__bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 7px;
  height: 1px;
  background: var(--color-accent);
}
.job__bullets strong { color: var(--color-text); font-weight: 600; }

.link-btn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--color-accent);
  cursor: pointer;
}
.link-btn:hover { text-decoration: underline; text-underline-offset: 4px; }

/* --------------------------------------------------------------------------
   12. WRITING + RECOGNITION
   -------------------------------------------------------------------------- */
.articles {
  display: grid;
  gap: var(--space-md);
  grid-template-columns: 1fr;
  margin-top: var(--space-xl);
}
@media (min-width: 768px) {
  .articles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.article-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding: var(--space-md);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: transform var(--speed) var(--ease),
              box-shadow var(--speed) var(--ease),
              border-color var(--speed) var(--ease);
}
.article-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--color-text);
}
.article-card h3 { font-size: var(--step-1); }
.article-card p { font-size: var(--step--1); color: var(--color-muted); }
.article-card__meta {
  margin-top: auto;
  padding-top: var(--space-sm);
  font-size: var(--step--1);
  color: var(--color-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.recognition-grid {
  display: grid;
  gap: var(--space-xl);
  grid-template-columns: 1fr;
  margin-top: var(--space-xl);
}
@media (min-width: 768px) {
  .recognition-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--space-2xl); }
}

.speaking li {
  padding-block: var(--space-sm);
  border-bottom: 1px solid var(--color-border);
}
.speaking li:first-child { border-top: 1px solid var(--color-border); }
.speaking span { display: block; font-size: var(--step--1); color: var(--color-muted); }

.badges { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--step--1);
  font-weight: 600;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--color-text);
  border-radius: var(--radius);
}
.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--color-accent);
  border-radius: 50%;
}

/* --------------------------------------------------------------------------
   13. CONTACT + FOOTER
   -------------------------------------------------------------------------- */
.contact-grid {
  display: grid;
  gap: var(--space-xl);
  grid-template-columns: 1fr;
  margin-top: var(--space-lg);
}
@media (min-width: 768px) {
  .contact-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-2xl); }
}

.contact-lead {
  font-family: var(--font-display);
  font-size: var(--step-3);
  line-height: 1.3;
  max-width: 24ch;
}

.form-field { display: grid; gap: var(--space-2xs); margin-bottom: var(--space-md); }
.form-field label {
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.form-field input,
.form-field textarea {
  font: inherit;
  color: var(--color-text);
  background: var(--color-bg);
  /* --color-border-strong, not --color-border: on an input the boundary IS the
     affordance, so WCAG 1.4.11 applies and it has to clear 3:1. The contact
     section is `section--surface`, so this is checked against both grounds. */
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  padding: var(--space-sm) var(--space-md);
  width: 100%;
}
.form-field textarea { min-height: 140px; resize: vertical; }
.form-field input:focus,
.form-field textarea:focus { border-color: var(--color-accent); outline-offset: 1px; }

/* Placeholder carries guidance, not the label, so it still has to be legible.
   Browser-default placeholder grey routinely fails 1.4.3. */
.form-field ::placeholder { color: var(--color-muted); opacity: 1; }

.contact-reply {
  margin-top: var(--space-md);
  font-weight: 600;
  color: var(--color-text);
}

.form-note {
  margin-top: var(--space-sm);
  font-size: var(--step--1);
  color: var(--color-muted);
}

/* Empty at load so the live region already exists in the DOM, but takes up no
   space until script.js fills it. :empty is what keeps the margin from showing. */
.form-status {
  margin-top: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-left: 2px solid var(--color-accent);
  background: var(--color-bg);
  font-size: var(--step--1);
  color: var(--color-text);
}
.form-status:empty { display: none; }

.socials { display: flex; flex-wrap: wrap; gap: var(--space-md); margin-top: var(--space-lg); }
.socials a {
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.site-footer {
  border-top: 1px solid var(--color-border);
  padding-block: var(--space-lg);
  font-size: var(--step--1);
  color: var(--color-muted);
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  align-items: center;
  justify-content: space-between;
}
.footer-nav { display: flex; flex-wrap: wrap; gap: var(--space-md); }
.footer-nav a { text-decoration: none; }
.footer-nav a:hover { color: var(--color-accent); }

/* --------------------------------------------------------------------------
   14. DEEP DIVE DIALOG — native <dialog>: Esc + focus trap come free
   -------------------------------------------------------------------------- */
dialog.deep {
  width: min(980px, 100vw);
  max-width: 100vw;
  max-height: 100dvh;
  height: 100dvh;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  box-shadow: var(--shadow-modal);
  overflow: auto;
  overscroll-behavior: contain;
}
dialog.deep::backdrop { background: rgba(17, 17, 17, 0.45); }

dialog.deep[open] { animation: slide-in 320ms var(--ease); }
dialog.deep[open]::backdrop { animation: fade-in 320ms var(--ease); }

@keyframes slide-in {
  from { transform: translateX(40px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.deep__bar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-lg);
  background: color-mix(in srgb, var(--color-bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
}
.deep__kicker {
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.deep__close {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
  cursor: pointer;
  transition: border-color var(--speed) var(--ease), color var(--speed) var(--ease);
}
.deep__close:hover { border-color: var(--color-accent); color: var(--color-accent); }
.deep__close svg { width: 18px; height: 18px; }

.deep__inner { padding: var(--space-xl) var(--space-lg) var(--space-2xl); }
.deep__inner > h2 { margin-bottom: var(--space-md); }

/* TL;DR bar — always the first thing you read */
.tldr {
  display: grid;
  gap: var(--space-md);
  margin-block: var(--space-lg);
  padding: var(--space-lg);
  background: var(--color-surface);
  border-left: 3px solid var(--color-accent);
  border-radius: var(--radius);
}
@media (min-width: 720px) {
  .tldr { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.tldr dt {
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: var(--space-2xs);
}
.tldr dd { margin: 0; }
.tldr .is-outcome { font-weight: 700; color: var(--color-accent); }

.deep__grid { display: grid; gap: var(--space-xl); grid-template-columns: 1fr; }
@media (min-width: 900px) {
  .deep__grid { grid-template-columns: minmax(0, 1fr) 220px; gap: var(--space-2xl); }
}

.deep-section + .deep-section { margin-top: var(--space-xl); }
.deep-section h3 {
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-sm);
}
.deep-section ul { display: grid; gap: var(--space-xs); }
.deep-section ul li { position: relative; padding-left: var(--space-md); }
.deep-section ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 7px;
  height: 1px;
  background: var(--color-accent);
}

blockquote {
  margin: var(--space-md) 0;
  padding-left: var(--space-md);
  border-left: 2px solid var(--color-border);
  font-family: var(--font-display);
  font-size: var(--step-2);
  line-height: 1.35;
}
blockquote cite {
  display: block;
  margin-top: var(--space-xs);
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-style: normal;
  color: var(--color-muted);
}

/* Artifact slot — a labelled placeholder, never a broken image */
.artifact {
  display: grid;
  place-items: center;
  gap: var(--space-2xs);
  min-height: 220px;
  margin-block: var(--space-md);
  padding: var(--space-lg);
  text-align: center;
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  color: var(--color-muted);
  font-size: var(--step--1);
}
.artifact svg { width: 28px; height: 28px; color: var(--color-border); }
.artifact strong { color: var(--color-text); font-size: var(--step-0); }

.deep__side {
  align-self: start;
  padding: var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: var(--step--1);
}
@media (min-width: 900px) {
  .deep__side { position: sticky; top: calc(var(--space-xl) + 40px); }
}
.deep__side dt {
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.deep__side dd { margin: 0 0 var(--space-md); }
.deep__side dd:last-child { margin-bottom: 0; }

/* Click-to-load embed. The iframe is only injected on click, so a third party
   never sees a visitor who didn't ask for it — consent at the point it's
   actually needed, with no site-wide banner. */
.artifact__load { margin-top: var(--space-sm); }
.artifact__note {
  margin: 0;
  font-size: var(--step--1);
  color: var(--color-muted);
}
.artifact iframe {
  width: 100%;
  min-height: 460px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.artifact:has(iframe) {
  display: block;
  min-height: 0;
  padding: 0;
  border-style: solid;
  background: none;
}
.artifact code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
  padding: 0.1em 0.35em;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

/* Diagram artifacts. These are drawn, not screenshotted, which is why they
   carry no redaction risk: nothing in them came off a client system. The SVG
   inherits the page font and `currentColor`, so one drawing works in both
   themes — the thing a pasted-in PNG can never do. */
.artifact--diagram {
  place-items: stretch;
  min-height: 0;
  padding: var(--space-md);
  border-style: solid;
  background: none;
  text-align: left;
}
.artifact.artifact--diagram svg {
  width: 100%;
  height: auto;
  color: var(--color-muted);
  font-family: var(--font-body);
  overflow: visible;
}
/* The one element the reader should land on first. Same restraint as the rest
   of the site: the accent appears once per drawing, never more. */
.artifact--diagram .dg-key { color: var(--color-accent); }
/* The end of a deep dive is the highest-converting position on the site: the
   reader has just been persuaded. Leaving it as the last paragraph of the story
   wastes that. Sits outside .deep__grid so it spans the full dialog width. */
.deep-cta {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-border);
}
.deep-cta p {
  margin: 0 0 var(--space-md);
  font-family: var(--font-display);
  font-size: var(--step-2);
  line-height: 1.2;
  max-width: 24ch;
}

.artifact--diagram figcaption {
  margin-top: var(--space-sm);
  text-align: left;
  color: var(--color-muted);
}

/* --------------------------------------------------------------------------
   15. LEGAL PAGES — privacy.html and anything like it
   -------------------------------------------------------------------------- */
.legal {
  max-width: 68ch;
  padding-block: var(--space-2xl) var(--space-section);
}

.legal h1 { font-size: var(--step-4); margin-bottom: var(--space-xs); }

.legal .updated {
  font-size: var(--step--1);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: var(--space-xl);
}

.legal h2 {
  font-size: var(--step-2);
  margin-top: var(--space-xl);
  margin-bottom: var(--space-sm);
  scroll-margin-top: calc(var(--header-height) + 16px);
}

.legal h3 {
  font-family: var(--font-body);
  font-size: var(--step-0);
  font-weight: 700;
  letter-spacing: 0;
  margin-top: var(--space-md);
  margin-bottom: var(--space-2xs);
}

.legal ul { display: grid; gap: var(--space-xs); margin-bottom: var(--space-md); }
.legal ul li { position: relative; padding-left: var(--space-md); }
.legal ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 7px;
  height: 1px;
  background: var(--color-accent);
}

.legal table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-md);
  font-size: var(--step--1);
}
.legal th,
.legal td {
  text-align: left;
  vertical-align: top;
  padding: var(--space-sm);
  border-bottom: 1px solid var(--color-border);
}
.legal th {
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
  border-bottom-color: var(--color-text);
}

/* A claim worth making loudly, because it's unusual and it's true */
.legal .callout {
  margin-block: var(--space-lg);
  padding: var(--space-lg);
  background: var(--color-surface);
  border-left: 3px solid var(--color-accent);
  border-radius: var(--radius);
}
.legal .callout p:first-child { font-weight: 600; }

.legal .toc {
  margin-bottom: var(--space-xl);
  padding: var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: var(--step--1);
}
.legal .toc ol {
  margin: 0;
  padding-left: var(--space-md);
  display: grid;
  gap: var(--space-2xs);
}

.footer-note { font-size: var(--step--1); color: var(--color-muted); }
.footer-note a { color: var(--color-accent); }

/* --------------------------------------------------------------------------
   14. PRINT — the site is its own CV

   "Download CV" on this project is print-to-PDF. There is no second document
   to maintain and therefore none to go stale.

   Two modes, decided by whether a deep dive is open:
     - nothing open  -> print the page: hero, about, work cards, metrics,
                        experience, recognition, contact. A 2-3 page resume.
     - dialog open   -> print only that dialog, as a standalone case study.

   Pitfalls handled here, each of which produces a silently broken PDF:
     - var() does NOT work inside @page. The margin below is hardcoded.
     - .reveal and .hero .stagger start at opacity:0 and are turned on by an
       IntersectionObserver. Print before scrolling and those sections come out
       BLANK. They are forced visible below.
     - .metric__value is counted up by script.js. Print before it fires and it
       reads 0. The real figure lives in data-count, so it is rendered from the
       attribute instead and is correct whether or not the script ever ran.
     - break-inside: avoid is applied to compact blocks only. On long sections
       the browser has to split anyway, and on flex/grid children it is ignored.
   -------------------------------------------------------------------------- */
@media print {
  @page {
    size: A4;
    margin: 16mm 14mm;
  }

  html { scroll-behavior: auto; }

  body {
    background: #fff;
    color: #000;
    font-size: 10pt;
    line-height: 1.45;
  }

  /* Screen-only furniture */
  .skip-link,
  .site-header,
  .site-nav,
  .nav-toggle,
  .hero-actions,
  .hero-portrait,
  .footer-nav,
  .artifact__load,
  .deep__close,
  #contact form,
  .case-card__cta,
  .btn,
  .link-btn { display: none !important; }

  /* Animations never ran, or ran halfway. Force the end state. */
  .reveal,
  .hero .stagger > * {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
    transition: none !important;
  }

  /* Counters: read the target off the attribute, not off the DOM text. */
  .metric__value { visibility: hidden; position: relative; }
  .metric__value::after {
    visibility: visible;
    position: absolute;
    inset: 0;
    content: attr(data-count) attr(data-suffix);
  }

  .section { padding-block: 10mm 0; }
  .section--surface { background: transparent; }

  /* Keep a heading with the thing it introduces, and don't split small cards. */
  h1, h2, h3 { break-after: avoid; page-break-after: avoid; }
  .case-card,
  .job,
  .article-card,
  .metric,
  .artifact { break-inside: avoid; page-break-inside: avoid; }

  /* Shadows and borders cost toner and add nothing on paper. */
  .case-card,
  .article-card,
  .artifact { box-shadow: none; border: 1px solid #ccc; }

  /* A link is useless on paper unless the destination is printed with it.
     Nav and footer links are already hidden, so this only hits real content. */
  #contact a[href^="http"]::after,
  .article-card a[href^="http"]::after,
  .deep-section a[href^="http"]::after {
    content: " <" attr(href) ">";
    font-size: 8pt;
    word-break: break-all;
  }

  /* --- Deep dives ------------------------------------------------------- */

  /* Closed ones are not part of the CV. */
  dialog.deep:not([open]) { display: none !important; }

  /* An open one prints as a flat document, not a fixed-height panel. */
  dialog.deep[open] {
    display: block;
    position: static;
    width: auto;
    max-width: none;
    height: auto;
    max-height: none;
    margin: 0;
    border: 0;
    box-shadow: none;
    overflow: visible;
    animation: none;
  }
  dialog.deep[open]::backdrop { display: none; }
  dialog.deep[open] .deep__bar { position: static; }
  dialog.deep[open] .deep-section { break-inside: avoid; page-break-inside: avoid; }

  /* ...and when one is open it is the ONLY thing that prints. */
  body:has(dialog.deep[open]) > *:not(dialog.deep) { display: none !important; }
}
