/* ==========================================================================
   avinash-gupta.com — "Datasheet Editorial" design system (v2)
   Scope: main.css is the single stylesheet for every page.
   Warm paper · copper accent · portrait-led · hairline-ruled grid.
   Fonts: Space Grotesk (display/UI), Newsreader italic (editorial emphasis),
          Space Mono (marginal annotations / metadata).
   Supersedes v1 "Laboratory Instrument" (dark/phosphor).
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;700&family=Newsreader:ital,wght@1,300;1,400&family=Space+Mono&display=swap');

/* ---------- Design tokens ---------- */
:root {
  /* Palette (exact per DESIGN_BRIEF_v2) */
  --bg: #F6F3EC;                    /* warm paper, site-wide */
  --surface: #FCFAF5;               /* cards, hover row fills */
  --ink: #16140F;                   /* warm near-black text */
  --ink-dim: #6E6A61;               /* metadata, captions */
  --accent: #C14E1F;                /* copper — the ONLY chromatic element */
  --accent-soft: rgba(193, 78, 31, 0.12); /* hover washes, focus ring */

  /* Hairlines — ALL rules/dividers use these, never solid gray */
  --hairline: rgba(22, 20, 15, 0.14);
  --hairline-strong: rgba(22, 20, 15, 0.34);

  /* Dark band (ONE inverted band per page max — footer, optional highlight) */
  --dark-bg: #16140F;
  --dark-text: #F6F3EC;
  --dark-dim: rgba(246, 243, 236, 0.55);
  --dark-line: rgba(246, 243, 236, 0.16);

  /* Type stacks */
  --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif; /* italic only */
  --font-mono: 'Space Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;

  /* Layout */
  --well: 1200px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --section-pad: clamp(4rem, 7vw, 7rem);

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-focus: cubic-bezier(0.8, 0, 0.2, 1);
  --reveal-dur: 0.8s;
}

/* ==========================================================================
   @layer reset
   ========================================================================== */
@layer reset {
  *, *::before, *::after { box-sizing: border-box; }

  * { margin: 0; }

  html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
  }

  body {
    min-height: 100dvh;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

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

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

  ul[role='list'], ol[role='list'] { list-style: none; padding: 0; }

  a { color: inherit; }
}

/* ==========================================================================
   @layer base
   ========================================================================== */
@layer base {
  body {
    background-color: var(--bg);
    color: var(--ink);
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(15px, 1.2vw, 17px);
    line-height: 1.6;
    /* Page load-in "coming into focus": opacity + blur(12px) → 0 */
    animation: page-in 1.2s var(--ease-focus) 0.2s both;
  }

  @keyframes page-in {
    from { opacity: 0; filter: blur(12px); }
    to   { opacity: 1; filter: blur(0); }
  }

  /* Paper grain — fixed SVG feTurbulence noise overlay */
  body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 2000;
    pointer-events: none;
    opacity: 0.035;
    mix-blend-mode: multiply;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 300px 300px;
  }

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

  h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.05;
    text-wrap: balance;
  }

  h1 { font-size: clamp(40px, 6.5vw, 84px); }
  h2 { font-size: clamp(30px, 4.5vw, 56px); }
  h3 { font-size: clamp(22px, 2.8vw, 32px); }
  h4 { font-size: clamp(18px, 2vw, 23px); }

  p { max-width: 68ch; }

  a {
    text-decoration: none;
    transition: color 0.2s ease;
  }

  a:hover { color: var(--accent); }

  small { font-size: 0.82em; }

  /* Newsreader italic for 1–2 emphasis words inside headlines */
  h1 em, h2 em, h3 em, .statement em, .hero-lede em {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 400;
    letter-spacing: -0.01em;
  }

  /* Keyboard focus — 2px copper ring everywhere */
  :focus { outline: none; }
  :focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 1px;
  }

  /* Progressive enhancement */
  @view-transition { navigation: auto; }
}

/* ==========================================================================
   @layer layout — wells, page grid, sections, separators
   ========================================================================== */
@layer layout {
  .well {
    width: 100%;
    max-width: var(--well);
    margin-inline: auto;
    padding-inline: var(--gutter);
  }

  /* 5-column page grid `.5fr 1fr 1fr 1fr .5fr` with hairline column rules */
  .page-grid {
    display: grid;
    grid-template-columns: 0.5fr 1fr 1fr 1fr 0.5fr;
    column-gap: clamp(1rem, 2.5vw, 2rem);
    background-image:
      linear-gradient(var(--hairline), var(--hairline)),
      linear-gradient(var(--hairline), var(--hairline)),
      linear-gradient(var(--hairline), var(--hairline)),
      linear-gradient(var(--hairline), var(--hairline));
    background-size: 1px 100%, 1px 100%, 1px 100%, 1px 100%;
    background-position: 12.5% 0, 37.5% 0, 62.5% 0, 87.5% 0;
    background-repeat: no-repeat;
  }

  .section {
    padding-block: var(--section-pad);
    border-top: 1px solid var(--hairline);
  }

  .section:first-of-type { border-top: none; }

  /* Section heading pattern: mono eyebrow (FIG. NN — LABEL) + display title */
  .section-head { margin-bottom: clamp(2.5rem, 5vw, 4.5rem); }

  .eyebrow {
    display: block;
    font-family: var(--font-mono);
    font-size: clamp(11px, 0.9vw, 12px);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent);
    margin-bottom: 0.85rem;
  }

  .eyebrow::before {
    content: '';
    display: block;
    width: 100%;
    border-top: 1px solid var(--hairline-strong);
    margin-bottom: 0.85rem;
  }

  .section-title {
    color: var(--ink);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
  }

  .section-lede {
    margin-top: 1.25rem;
    color: var(--ink-dim);
    max-width: 56ch;
  }

  /* Hairline utilities */
  .hairline-top { border-top: 1px solid var(--hairline); }
  .hairline-bottom { border-bottom: 1px solid var(--hairline); }
  .rule {
    border: none;
    border-top: 1px solid var(--hairline);
    margin-block: 0;
  }
}

/* ==========================================================================
   @layer components
   ========================================================================== */
@layer components {

  /* ---------- Shared header chrome v2 (exact class contract) ---------- */
  .site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(246, 243, 236, 0.85);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--hairline);
  }

  .site-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    max-width: var(--well);
    margin-inline: auto;
    padding: 0.9rem var(--gutter);
    min-height: 56px;
  }

  .brand {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.4rem;
    letter-spacing: -0.03em;
    color: var(--ink);
    line-height: 1;
  }

  .brand:hover { color: var(--ink); }

  .brand-dot { color: var(--accent); }

  .nav-links {
    display: flex;
    align-items: center;
    gap: clamp(1rem, 2.4vw, 2rem);
    list-style: none;
    padding: 0;
    margin: 0;
  }

  .nav-links a {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-dim);
    padding: 0.45rem 0;
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    position: relative;
  }

  .nav-links a:hover { color: var(--accent); }

  .nav-links a[aria-current='page'] { color: var(--accent); }

  .nav-links a[aria-current='page']::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    border-bottom: 1px solid var(--accent);
  }

  .nav-cv {
    border: 1px solid var(--hairline-strong);
    padding: 0.45rem 0.9rem !important;
    color: var(--ink) !important;
  }

  .nav-cv:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg) !important;
  }

  /* Hamburger — hidden on desktop */
  .nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--hairline-strong);
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding: 0.5rem 0.85rem;
    min-height: 24px;
    cursor: pointer;
  }

  .nav-toggle:hover { border-color: var(--accent); color: var(--accent); }

  /* ---------- Hero: split-name + portrait ---------- */
  .hero-split {
    position: relative;
    padding-block: clamp(4rem, 10vw, 8rem) clamp(3rem, 7vw, 5.5rem);
    min-height: 78vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .hero-name {
    font-size: clamp(4rem, 12vw, 11rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 0.95;
    text-transform: uppercase;
    color: var(--ink);
  }

  .hero-name-line { display: block; position: relative; z-index: 3; }

  /* GUPTA top-left, AVINASH right-aligned lower — name spans full width */
  .hero-name-line--first { text-align: left; padding-right: 28vw; }
  /* padding-right reserves the right-hand gutter where the portrait sits,
     so the portrait never overlaps the AVINASH line */
  .hero-name-line--last { text-align: right; padding-right: clamp(220px, 26vw, 400px); }

  /* GUPTA top-left, AVINASH right-aligned lower — name spans full width */
  .hero-name-line--first { text-align: left; padding-right: 26vw; }
  /* padding-right reserves the right-hand gutter where the portrait sits,
     so the portrait never overlaps the AVINASH line */
  .hero-name-line--last { text-align: right; padding-right: clamp(200px, 24vw, 360px); }

  /* B&W portrait in the reserved right-hand gutter, clear of the name */
  .hero-portrait {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-58%);
    width: clamp(180px, 21vw, 300px);
    z-index: 2;
  }

  .hero-portrait img {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    filter: grayscale(1) contrast(1.05);
    /* Portrait load-in: clip-path inset(0 100% 0 0) → inset(0) via JS .is-loaded */
    clip-path: inset(0 100% 0 0);
    transition: clip-path 1.2s ease-out;
  }

  .hero-portrait.is-loaded img { clip-path: inset(0 0 0 0); }

  /* Offset copper ring — the single graphic gesture */
  .portrait-ring {
    position: absolute;
    width: 82%;
    aspect-ratio: 1;
    left: -14%;
    bottom: -12%;
    border: 1px solid var(--accent);
    border-radius: 50%;
    z-index: -1;
    pointer-events: none;
  }

  .portrait-caption {
    margin-top: 0.75rem;
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-dim);
  }

  /* Role-cycling line under the name (JS: translateY + opacity crossfade) */
  .role-cycle {
    position: relative;
    margin-top: clamp(1.75rem, 3.5vw, 2.75rem);
    height: 1.9em;
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(1.05rem, 1.9vw, 1.5rem);
    letter-spacing: 0.01em;
    color: var(--ink);
    overflow: hidden;
  }

  .role-cycle-item {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    opacity: 0;
    transform: translateY(60%);
    transition: opacity 0.6s ease, transform 0.6s var(--ease-out);
  }

  .role-cycle-item::before {
    content: '';
    width: 1.75rem;
    border-top: 1px solid var(--accent);
    flex: none;
  }

  .role-cycle-item.is-active {
    opacity: 1;
    transform: translateY(0);
  }

  .role-cycle-item.is-exit {
    opacity: 0;
    transform: translateY(-60%);
  }

  /* Mono corner annotations (coordinates, discipline tags) */
  .corner-note {
    position: absolute;
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-dim);
    pointer-events: none;
  }

  .corner-note--tl { top: clamp(1rem, 2.5vw, 2rem); left: 0; }
  .corner-note--tr { top: clamp(1rem, 2.5vw, 2rem); right: 0; text-align: right; }
  .corner-note--bl { bottom: clamp(1rem, 2.5vw, 2rem); left: 0; }
  .corner-note--br { bottom: clamp(1rem, 2.5vw, 2rem); right: 0; text-align: right; }

  /* Static right-angle schematic-trace SVG along the left margin — unanimated */
  .schematic-margin {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: clamp(40px, 5vw, 72px);
    height: 100%;
    pointer-events: none;
    color: var(--hairline-strong);
  }

  .schematic-margin .net-live { color: var(--accent); }

  .hero-lede {
    margin-top: 1.5rem;
    color: var(--ink-dim);
    font-size: clamp(1.02rem, 1.5vw, 1.25rem);
    max-width: 52ch;
  }

  /* ---------- Statement (about strip) ---------- */
  .statement {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(1.6rem, 3.2vw, 2.5rem);
    line-height: 1.28;
    letter-spacing: -0.015em;
    max-width: 22ch;
  }

  /* statement + small mono bio in right column */
  .statement-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: clamp(2rem, 5vw, 4.5rem);
    align-items: start;
  }

  .statement-bio {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.04em;
    line-height: 1.9;
    color: var(--ink-dim);
    text-transform: none;
    border-left: 1px solid var(--hairline);
    padding-left: clamp(1.25rem, 2.5vw, 2rem);
  }

  /* ---------- Experience: full-width ruled rows ---------- */
  .row-list { list-style: none; padding: 0; }

  .row {
    display: grid;
    grid-template-columns: 3rem 1.35fr 1fr 0.85fr auto;
    align-items: baseline;
    gap: clamp(1rem, 2.5vw, 2rem);
    padding: clamp(1.5rem, 3vw, 2.25rem) clamp(0.75rem, 1.5vw, 1.25rem);
    border-top: 1px solid var(--hairline);
    transition: background 0.25s ease;
  }

  .row-list .row:last-child { border-bottom: 1px solid var(--hairline); }

  .row:hover { background: var(--surface); }

  .row-index {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.12em;
    color: var(--accent);
  }

  .row-org {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.15rem, 2vw, 1.6rem);
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--ink);
  }

  /* Title underline scaleX(0 → 1) from left on row hover */
  .row-title {
    position: relative;
    display: inline-block;
    font-weight: 500;
    color: var(--ink);
  }

  .row-title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 100%;
    height: 1px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
  }

  .row:hover .row-title::after,
  .row:focus-within .row-title::after { transform: scaleX(1); }

  .row-loc, .row-years {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-dim);
  }

  .row-years { text-align: right; }

  /* Full-width detail paragraph inside a .row grid item
     (consolidates the former inline grid-column: 1 / -1 overrides) */
  .row-detail {
    grid-column: 1 / -1;
    margin-top: 1.25rem;
    color: var(--ink-dim);
    font-size: 0.92em;
  }

  /* ---------- Research: alternating 60/40 splits ---------- */
  .split {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: clamp(2rem, 5vw, 4.5rem);
    align-items: center;
    padding-block: clamp(2.5rem, 5vw, 4.5rem);
    border-top: 1px solid var(--hairline);
  }

  .split:first-of-type { border-top: none; }

  .split--rev { grid-template-columns: 2fr 3fr; }
  .split--rev .split-figure { order: 2; }
  .split--rev .split-body { order: 1; }

  .split-figure { position: relative; }

  .split-figure img {
    width: 100%;
    filter: grayscale(1) contrast(1.03);
    border: 1px solid var(--hairline);
  }

  .split-fig-no {
    position: absolute;
    top: -0.5rem;
    right: -0.5rem;
    background: var(--bg);
    border: 1px solid var(--accent);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    padding: 0.3em 0.7em;
    text-transform: uppercase;
  }

  .split-body h3 { margin-bottom: 0.75rem; }
  .split-body p { color: var(--ink-dim); }

  /* ---------- Publications: numbered index list ---------- */
  .index-list {
    list-style: none;
    padding: 0;
    counter-reset: index-item;
  }

  .index-item {
    display: grid;
    grid-template-columns: 3.5rem 1fr auto;
    align-items: baseline;
    gap: clamp(1rem, 2.5vw, 2rem);
    padding: clamp(1.5rem, 3vw, 2.25rem) clamp(0.75rem, 1.5vw, 1.25rem);
    border-top: 1px solid var(--hairline);
    transition: background 0.25s ease;
  }

  .index-list .index-item:last-child { border-bottom: 1px solid var(--hairline); }

  .index-item:hover { background: var(--surface); }

  .index-num {
    font-family: var(--font-mono);
    font-size: clamp(0.95rem, 1.4vw, 1.15rem);
    letter-spacing: 0.1em;
    color: var(--accent);
  }

  .index-title {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(1.05rem, 1.8vw, 1.4rem);
    letter-spacing: -0.01em;
    line-height: 1.3;
    color: var(--ink);
  }

  .index-meta {
    margin-top: 0.4rem;
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-dim);
  }

  /* DOI / citation links revealed on hover */
  .index-links {
    display: flex;
    gap: 1rem;
    opacity: 0;
    transform: translateX(4px);
    transition: opacity 0.25s ease, transform 0.25s ease;
  }

  .index-item:hover .index-links,
  .index-item:focus-within .index-links {
    opacity: 1;
    transform: translateX(0);
  }

  .index-links a {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent);
    border-bottom: 1px solid var(--accent);
    padding-bottom: 1px;
    min-height: 24px;
    display: inline-flex;
    align-items: center;
  }

  /* ---------- Journey: oversized Newsreader italic year markers ---------- */
  .year-marker {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 300;
    font-size: clamp(3rem, 7vw, 6rem);
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--ink-dim);
  }

  /* Timeline rail (kept from v1, refit to light) */
  .timeline { position: relative; }

  .tl-item {
    display: grid;
    grid-template-columns: 9rem 1fr;
    gap: clamp(1.5rem, 4vw, 3.5rem);
    padding-block: clamp(2rem, 4vw, 3.25rem);
    border-top: 1px solid var(--hairline);
    position: relative;
  }

  .tl-item:first-of-type { border-top: none; }

  .tl-year {
    position: sticky;
    top: 96px;
    align-self: start;
  }

  .tl-title {
    font-size: clamp(24px, 3vw, 34px);
    margin-bottom: 0.4rem;
  }

  .tl-org {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-dim);
    margin-bottom: 1rem;
  }

  .tl-body p, .tl-body li { color: var(--ink-dim); font-size: 0.95em; }
  .tl-body ul { padding-left: 1.1rem; }
  .tl-body li { margin-bottom: 0.4rem; }
  .tl-body li::marker { color: var(--accent); }
  .tl-body img { filter: grayscale(1) contrast(1.03); border: 1px solid var(--hairline); }

  /* ---------- Buttons ---------- */
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding: 0.85rem 1.6rem;
    min-height: 24px;
    background: var(--accent);
    color: var(--bg);
    border: 1px solid var(--accent);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  }

  /* invert fill ↔ outline on hover */
  .btn:hover {
    background: transparent;
    color: var(--accent);
  }

  .btn-outline {
    background: transparent;
    color: var(--ink);
    border-color: var(--hairline-strong);
  }

  .btn-outline:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
  }

  /* ---------- Grid + cards (1px hairline gaps, flat ruled surfaces) ---------- */
  .grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--hairline);
    border: 1px solid var(--hairline);
  }

  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }

  .card {
    background: var(--surface);
    padding: clamp(1.5rem, 3vw, 2.5rem);
    transition: background 0.25s ease;
  }

  .card:hover { background: var(--accent-soft); }

  .card .tag {
    display: block;
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent);
    margin-bottom: 0.9rem;
  }

  .card h3 {
    font-size: clamp(20px, 2.2vw, 27px);
    margin-bottom: 0.75rem;
  }

  .card p { color: var(--ink-dim); font-size: 0.92em; }

  .card .meta {
    margin-top: 1.25rem;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-dim);
  }

  /* ---------- Numbered artifacts (research projects) ---------- */
  .artifact {
    display: grid;
    grid-template-columns: 4.5rem 1fr;
    gap: clamp(1.25rem, 3vw, 2.5rem);
    padding-block: clamp(1.75rem, 3.5vw, 2.75rem);
    border-top: 1px solid var(--hairline);
  }

  .artifact:first-of-type { border-top: none; }

  .artifact-num {
    font-family: var(--font-mono);
    font-size: clamp(0.9rem, 1.4vw, 1.1rem);
    color: var(--hairline-strong); /* decorative numeral, non-essential */
    letter-spacing: 0.1em;
  }

  .artifact-title {
    font-size: clamp(21px, 2.4vw, 30px);
    margin-bottom: 0.6rem;
  }

  .artifact-meta {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-dim);
    margin-bottom: 0.6rem;
  }

  .artifact-body { color: var(--ink-dim); font-size: 0.92em; }

  .artifact a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
  }

  /* ---------- Stats ---------- */
  .stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--hairline);
    border: 1px solid var(--hairline);
  }

  .stat {
    background: var(--surface);
    padding: clamp(1.5rem, 3vw, 2.25rem);
  }

  .stat-value {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(38px, 5vw, 60px);
    letter-spacing: -0.03em;
    line-height: 1;
    color: var(--ink);
  }

  .stat-label {
    margin-top: 0.75rem;
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-dim);
  }

  /* ---------- Footer: the ONE dark band ---------- */
  .site-footer {
    background: var(--dark-bg);
    color: var(--dark-text);
    border-top: 1px solid var(--hairline);
    padding-block: clamp(3rem, 6vw, 5rem) clamp(2rem, 4vw, 3rem);
  }

  .site-footer ::selection { background: var(--accent); color: var(--dark-bg); }

  .site-footer a { color: var(--dark-text); }
  .site-footer a:hover { color: var(--accent); }

  /* Oversized email CTA, full width */
  .footer-email {
    display: block;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.7rem, 5.5vw, 4rem);
    letter-spacing: -0.03em;
    line-height: 1.1;
    padding-bottom: clamp(1.75rem, 4vw, 3rem);
    border-bottom: 1px solid var(--dark-line);
    margin-bottom: clamp(1.75rem, 4vw, 3rem);
    width: fit-content;
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .footer-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 2rem;
  }

  .footer-social {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(1.25rem, 3vw, 2.25rem);
    list-style: none;
    padding: 0;
    margin: 0;
  }

  .footer-social a {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--dark-dim);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 24px;
  }

  .footer-social a:hover { color: var(--accent); }

  /* arrow shifts translate(2px,-2px) on hover */
  .footer-social a .arrow,
  .footer-social a::after {
    transition: transform 0.2s ease;
  }

  .footer-social a::after {
    content: '↗';
    font-size: 0.9em;
  }

  .footer-social a:hover::after { transform: translate(2px, -2px); }

  .footer-note {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--dark-dim);
  }

  .footer-copy {
    margin-top: clamp(2rem, 4vw, 3rem);
    padding-top: 1.5rem;
    border-top: 1px solid var(--dark-line);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem;
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--dark-dim);
  }

  /* ---------- Scroll reveal: blur + rise ---------- */
  .reveal {
    opacity: 0;
    transform: translateY(30px);
    filter: blur(8px);
    transition:
      opacity var(--reveal-dur) ease,
      transform var(--reveal-dur) var(--ease-out),
      filter var(--reveal-dur) ease;
  }

  .reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }

  /* ---------- Utility text ---------- */
  .mono {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
  }

  .dim { color: var(--ink-dim); }
  .accent { color: var(--accent); }

  /* Generic underline scaleX link */
  .u-line {
    position: relative;
    display: inline-block;
  }

  .u-line::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 100%;
    height: 1px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
  }

  .u-line:hover::after, .u-line:focus-visible::after { transform: scaleX(1); }

  /* ---------- Spacing & layout utilities ---------- */
  .mt-1 { margin-top: 0.75rem; }
  .mt-2 { margin-top: 1.25rem; }
  .mt-3 { margin-top: 1.5rem; }
  .mt-4 { margin-top: 2rem; }

  .mono-sm { font-size: 11px; }

  .list-reset { list-style: none; padding: 0; }

  .btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .grid-continue { margin-top: 1px; }

  /* Embedded tool frame (tools page) */
  .tool-frame {
    width: 100%;
    height: 720px;
    border: 1px solid var(--hairline-strong);
    background: var(--surface);
  }
}

/* ==========================================================================
   @layer responsive — mobile < 768px
   ========================================================================== */
@layer responsive {
  @media (max-width: 899px) {
    /* Portrait falls into normal flow between the stacked name lines */
    .hero-split { min-height: auto; }

    .hero-portrait {
      position: relative;
      right: auto;
      top: auto;
      transform: none;
      width: min(64vw, 280px);
      margin-block: clamp(1.5rem, 5vw, 2.5rem);
      margin-left: auto;
    }

    .hero-name-line--first { padding-right: 0; }
    .hero-name-line--last { padding-right: 0; }

    .schematic-margin { display: none; }

    .corner-note--bl, .corner-note--br { display: none; }

    .split, .split--rev { grid-template-columns: 1fr; }
    .split--rev .split-figure { order: 0; }
    .split--rev .split-body { order: 1; }

    .statement-grid { grid-template-columns: 1fr; }

    .row {
      grid-template-columns: 2.25rem 1fr;
      grid-template-areas:
        'index org'
        'index title'
        'index loc'
        'index years';
      row-gap: 0.35rem;
    }

    .row-index { grid-area: index; }
    .row-org { grid-area: org; }
    .row-title { grid-area: title; }
    .row-loc { grid-area: loc; }
    .row-years { grid-area: years; text-align: left; }

    .index-item { grid-template-columns: 2.5rem 1fr; }
    .index-links { grid-column: 2; opacity: 1; transform: none; }

    .tl-item { grid-template-columns: 1fr; gap: 0.75rem; }
    .tl-year { position: static; }
  }

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

    .nav-links {
      position: absolute;
      top: 100%;
      left: 0;
      right: 0;
      display: none;
      flex-direction: column;
      align-items: stretch;
      gap: 0;
      background: var(--surface);
      border-bottom: 1px solid var(--hairline);
      padding: 0.5rem var(--gutter) 1.25rem;
    }

    .site-header.nav-open .nav-links { display: flex; }

    .nav-links a {
      display: flex;
      padding: 0.85rem 0;
      border-top: 1px solid var(--hairline);
    }

    .nav-links li:first-child a { border-top: none; }

    .nav-links a[aria-current='page']::after { display: none; }

    .nav-cv {
      border: none !important;
      color: var(--accent) !important;
      padding: 0.85rem 0 !important;
    }

    .nav-cv:hover { background: none; }

    .grid, .grid-2, .grid-4, .stats { grid-template-columns: 1fr; }

    .artifact { grid-template-columns: 3rem 1fr; }

    .footer-grid { flex-direction: column; }
    .footer-copy { flex-direction: column; gap: 0.5rem; }
  }
}

/* ==========================================================================
   Reduced motion — disable ALL animation
   ========================================================================== */
@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;
  }

  body { animation: none; }

  .reveal { opacity: 1; transform: none; filter: none; }

  .hero-portrait img { clip-path: inset(0 0 0 0); }

  /* role-cycle rotation is paused in JS; first item stays visible */
  .role-cycle-item { position: static; }
  .role-cycle-item:not(.is-active) { display: none; }
}
