/* ---------- Theme tokens ---------- */
  :root,
  [data-theme="dark"] {
    --bg: #0c0c0a;
    --bg-elev: #131310;
    --line: #2a2a26;
    --line-soft: #1c1c19;
    --ink: #ece8e0;
    --ink-dim: #9a948a;
    --ink-faint: #5e5a52;
    --signal: #d2ff3a;
    --signal-dim: #8aab1f;
    --signal-text: #0c0c0a;
    --noise-opacity: 0.7;
    --nav-bg: rgba(12, 12, 10, 0.72);
  }

  [data-theme="light"] {
    --bg: #f3efe5;
    --bg-elev: #ebe5d7;
    --line: #c9c2b1;
    --line-soft: #ddd6c5;
    --ink: #1a1814;
    --ink-dim: #5e5a4f;
    --ink-faint: #8c8678;
    --signal: #4a6500;
    --signal-dim: #6b8a1f;
    --signal-text: #f3efe5;
    --noise-opacity: 0.4;
    --nav-bg: rgba(243, 239, 229, 0.78);
  }

  * { box-sizing: border-box; margin: 0; padding: 0; }
  html {
    scroll-behavior: smooth;
    scroll-padding-top: 60px;
  }

  body {
    --serif: "Fraunces", Georgia, serif;
    --sans: "Inter Tight", -apple-system, BlinkMacSystemFont, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    font-weight: 400;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    position: relative;
    transition: background 0.3s ease, color 0.3s ease;
  }

  body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
      linear-gradient(var(--line-soft) 1px, transparent 1px),
      linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
    background-size: 80px 80px;
    opacity: 0.35;
    pointer-events: none;
    z-index: 0;
    transform: translateZ(0);
  }

  /* Static noise overlay, no blend mode (much cheaper to composite) */
  body::after {
    content: "";
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.18 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
    opacity: var(--noise-opacity);
    pointer-events: none;
    z-index: 1;
    transform: translateZ(0); /* promote to own compositor layer */
  }

  .wrap {
    position: relative;
    z-index: 2;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 32px;
  }

  /* ---------- Top nav ---------- */
  .topnav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 50;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: var(--nav-bg);
    border-bottom: 1px solid var(--line-soft);
    transition: background 0.3s ease;
    will-change: backdrop-filter;
    transform: translateZ(0);
  }
  .topnav .inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 32px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }
  .nav-right { display: flex; align-items: center; gap: 24px; }
  .topnav nav { display: flex; gap: 28px; }
  .topnav nav a {
    color: var(--ink-dim);
    text-decoration: none;
    transition: color 0.2s ease;
  }
  .topnav nav a:hover { color: var(--signal); }
  .topnav nav a span { color: var(--ink-faint); margin-right: 6px; }

  .theme-toggle {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--ink-dim);
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-family: inherit;
    padding: 0;
  }
  .theme-toggle:hover {
    color: var(--signal);
    border-color: var(--signal-dim);
  }
  .theme-toggle svg { width: 14px; height: 14px; }
  .theme-toggle .icon-sun { display: none; }
  .theme-toggle .icon-moon { display: block; }
  [data-theme="dark"] .theme-toggle .icon-sun { display: block; }
  [data-theme="dark"] .theme-toggle .icon-moon { display: none; }

  /* ---------- Reveal animation ---------- */
  .reveal {
    opacity: 0;
    transform: translateY(20px);
    animation: rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  }
  @keyframes rise {
    to { opacity: 1; transform: translateY(0); }
  }

  /* ---------- Hero ---------- */
  .hero {
    min-height: 100vh;
    padding: 140px 0 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
  }

  .hero .meta-row {
    display: flex;
    gap: 24px;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin-bottom: 40px;
  }
  .hero .meta-row .status {
    color: var(--signal);
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .hero .meta-row .status::before {
    content: "";
    width: 6px; height: 6px;
    background: var(--signal);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--signal);
  }

  .hero h1 {
    font-family: var(--serif);
    font-weight: 350;
    font-size: clamp(56px, 11vw, 152px);
    line-height: 0.96;
    letter-spacing: -0.035em;
    margin-bottom: 8px;
    /* Fixed height + visible overflow keeps siblings from shifting when
       a taller font (like Century Schoolbook) cycles in. Descenders still
       render below the box visually. */
    height: 1.92em;
    overflow: visible;
    transition: font-family 0s;
  }
  .hero h1 .italic {
    font-style: italic;
    font-weight: 300;
    color: var(--signal);
  }

  .hero .role {
    font-family: var(--mono);
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-dim);
    margin-top: 32px;
    margin-bottom: 28px;
    display: flex;
    align-items: center;
    gap: 14px;
  }
  .hero .role::before {
    content: "";
    width: 32px; height: 1px;
    background: var(--ink-faint);
  }
  .hero .role .accent {
    color: var(--signal);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
  }
  .hero .role .accent:hover {
    border-bottom-color: var(--signal);
  }

  .hero .lede {
    font-family: var(--serif);
    font-weight: 300;
    font-size: clamp(20px, 2.4vw, 28px);
    line-height: 1.4;
    max-width: 760px;
    color: var(--ink);
    letter-spacing: -0.01em;
  }
  .hero .lede em {
    font-style: italic;
    color: var(--signal);
  }

  .hero .contact-row {
    margin-top: 56px;
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.04em;
  }
  .hero .contact-row a {
    color: var(--ink-dim);
    text-decoration: none;
    border-bottom: 1px solid var(--line);
    padding-bottom: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .hero .contact-row a:hover {
    color: var(--signal);
    border-bottom-color: var(--signal);
  }
  .hero .contact-row a span { color: var(--ink-faint); }

  /* ---------- Section ---------- */
  section { padding: 100px 0; position: relative; }
  /* Each non-hero section fills the viewport at minimum so anchor
     navigation lands cleanly with no next-section peek. Sections taller
     than the viewport (like experience) just stay their natural height. */
  section:not(.hero) {
    min-height: 100vh;
  }

  .section-head {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 60px;
    padding-bottom: 60px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 60px;
    align-items: end;
  }

  .section-head .label {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-faint);
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .section-head .label .num {
    color: var(--signal);
    font-size: 14px;
  }

  .section-head h2 {
    font-family: var(--serif);
    font-weight: 300;
    font-size: clamp(38px, 5vw, 64px);
    line-height: 1;
    letter-spacing: -0.025em;
  }
  .section-head h2 em {
    font-style: italic;
    color: var(--ink-dim);
    font-weight: 300;
  }
  .section-head h2.compact {
    font-size: clamp(24px, 3.2vw, 40px);
    line-height: 1.2;
  }

  /* ---------- About ---------- */
  .about-grid {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 60px;
  }
  .about-grid .side {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-faint);
  }
  .about-grid .side > div { margin-bottom: 28px; }
  .about-grid .side .key { color: var(--ink-faint); margin-bottom: 6px; }
  .about-grid .side .val {
    color: var(--ink);
    text-transform: none;
    letter-spacing: 0;
    font-size: 13px;
  }
  .about-grid .side .val.counter {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    color: var(--signal);
    font-size: 12px;
    letter-spacing: 0.01em;
    line-height: 1.55;
  }
  .about-grid .side .val.status-val {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--ink);
    letter-spacing: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }
  .about-grid .side .val.status-val::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ink-faint);
    flex-shrink: 0;
  }
  .about-grid .side .val.status-val[data-state="available"]::before {
    background: var(--signal);
    box-shadow: 0 0 10px var(--signal);
  }
  .about-grid .side .val.status-val[data-state="at-work"]::before {
    background: var(--signal);
  }
  .about-grid .side .val.status-val[data-state="asleep"]::before {
    background: var(--ink-faint);
  }

  .about-grid .body {
    font-family: var(--serif);
    font-weight: 300;
    font-size: clamp(20px, 2vw, 24px);
    line-height: 1.5;
    letter-spacing: -0.01em;
    color: var(--ink);
    max-width: 760px;
  }
  .about-grid .body p + p { margin-top: 24px; }

  /* ---------- Experience ---------- */
  .exp-item {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 60px;
    padding: 48px 0;
    border-bottom: 1px solid var(--line-soft);
    position: relative;
  }
  .exp-item:last-child { border-bottom: none; }

  .exp-item .when {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-faint);
  }
  .exp-item .when .badges {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .exp-item .when .badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 2px;
    font-weight: 600;
    font-size: 10px;
    letter-spacing: 0.08em;
    font-family: var(--mono);
    text-transform: uppercase;
  }
  .exp-item .when .badge.active {
    background: var(--signal);
    color: var(--signal-text);
  }
  .exp-item .when .badge.fulltime,
  .exp-item .when .badge.parttime {
    border: 1px solid var(--line);
    color: var(--ink-dim);
  }

  .exp-item .body { max-width: 760px; }

  .exp-item h3 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: 30px;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
  }
  .exp-item .where {
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.04em;
    color: var(--ink-dim);
    margin-bottom: 24px;
    display: flex;
    gap: 8px;
    align-items: center;
  }
  .exp-item .where .sep { color: var(--ink-faint); }

  .exp-item ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
  .exp-item ul li {
    position: relative;
    padding-left: 24px;
    color: var(--ink-dim);
    font-size: 15.5px;
    line-height: 1.6;
  }
  .exp-item ul li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--signal);
    font-family: var(--mono);
    font-size: 14px;
  }
  .exp-item ul li strong {
    color: var(--ink);
    font-weight: 500;
  }

  /* ---------- Capabilities ---------- */
  .cap-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
  }
  .cap-block {
    background: var(--bg);
    padding: 40px 32px;
    position: relative;
  }
  .cap-block .cap-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px dashed var(--line);
  }
  .cap-block .cap-head h4 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: 22px;
    letter-spacing: -0.01em;
  }
  .cap-block .cap-head .idx {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--ink-faint);
    letter-spacing: 0.1em;
  }
  .cap-block .tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .cap-block .tags span {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--ink-dim);
    padding: 5px 10px;
    border: 1px solid var(--line);
    border-radius: 2px;
    transition: all 0.2s ease;
    cursor: default;
  }
  .cap-block .tags span:hover {
    color: var(--signal);
    border-color: var(--signal-dim);
  }

  /* ---------- Credentials ---------- */
  .cred-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }
  .cred-card {
    border: 1px solid var(--line);
    background: var(--bg-elev);
    padding: 32px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  .cred-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0;
    width: 3px; height: 100%;
    background: var(--signal);
  }
  .cred-card .label {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin-bottom: 16px;
  }
  .cred-card h4 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: 24px;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
  }
  .cred-card .issuer {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--ink-dim);
    margin-bottom: 12px;
  }
  .cred-card .date {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--signal);
    margin-bottom: 18px;
  }
  .cred-card .verify {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-dim);
    text-decoration: none;
    border-top: 1px dashed var(--line);
    padding-top: 14px;
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s ease;
    align-self: flex-start;
  }
  .cred-card .verify:hover { color: var(--signal); }
  .cred-card .verify .arr {
    transition: transform 0.2s ease;
    display: inline-block;
  }
  .cred-card .verify:hover .arr { transform: translate(2px, -2px); }
  .cred-card.edu::before { background: var(--ink-dim); }
  .cred-card.edu .date { color: var(--ink-dim); }

  /* ---------- Projects ---------- */
  /* Single-column stack of full-width project cards. Each card has a
     header row (status + index), a serif title, optional summary,
     a description, and a tag row for the stack/tools used. */
  #projects {
    min-height: auto;
  }
  .projects-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
  }
  .project-card {
    border: 1px solid var(--line);
    background: var(--bg-elev);
    padding: 32px 36px;
    position: relative;
    contain: layout style;
  }
  .project-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0;
    width: 3px; height: 100%;
    background: var(--signal);
  }
  .project-card .project-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
  }
  .project-card .project-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--signal);
  }
  .project-card .project-status::before {
    content: "";
    width: 6px; height: 6px;
    background: var(--signal);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--signal);
  }
  .project-card .project-idx {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--ink-faint);
    letter-spacing: 0.1em;
  }
  .project-card h3 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: 28px;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
  }
  .project-card .project-summary {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--ink-dim);
    letter-spacing: 0.02em;
    margin-bottom: 20px;
  }
  .project-card .project-desc {
    font-size: 15.5px;
    color: var(--ink-dim);
    line-height: 1.65;
    max-width: 780px;
  }
  .project-card .project-desc strong {
    color: var(--ink);
    font-weight: 500;
  }
  .project-card .project-stack {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px dashed var(--line);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .project-card .project-stack .tag {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--ink-dim);
    padding: 5px 10px;
    border: 1px solid var(--line);
    border-radius: 2px;
    transition: all 0.2s ease;
  }
  .project-card .project-stack .tag:hover {
    color: var(--signal);
    border-color: var(--signal-dim);
  }

  /* ---------- Interests ---------- */
  /* Compact section — overrides the global section min-height since
     the content is brief by design. Thin row list, not cards. */
  #interests {
    min-height: auto;
  }
  .interests-list {
    display: grid;
    gap: 0;
    max-width: 900px;
    border-top: 1px solid var(--line-soft);
  }
  .interest {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 32px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line-soft);
    align-items: baseline;
  }
  .interest .interest-label {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-faint);
  }
  .interest .interest-body {
    font-size: 14.5px;
    color: var(--ink-dim);
    line-height: 1.55;
  }
  .interest .interest-body em {
    color: var(--ink);
    font-style: italic;
  }
  .interest .interest-body a {
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1px solid var(--line);
    padding-bottom: 1px;
    transition: all 0.2s ease;
  }
  .interest .interest-body a:hover {
    color: var(--signal);
    border-bottom-color: var(--signal);
  }
  /* Placeholder link styling for items without a URL yet — dashed
     underline + dim color makes the "not clickable" state clear. */
  .interest .interest-body .placeholder-link {
    color: var(--ink-faint);
    border-bottom: 1px dashed var(--line);
    padding-bottom: 1px;
    cursor: help;
  }

  /* ---------- Footer ---------- */
  footer {
    padding: 120px 0 60px;
    border-top: 1px solid var(--line);
    margin-top: 80px;
  }
  footer .signoff {
    font-family: var(--serif);
    font-weight: 300;
    font-size: clamp(40px, 6vw, 80px);
    line-height: 1;
    letter-spacing: -0.03em;
    margin-bottom: 32px;
  }
  footer .signoff em { font-style: italic; color: var(--signal); }

  footer .foot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 32px 40px;
    padding-top: 28px;
    border-top: 1px solid var(--line);
  }
  footer .foot-grid .col .lbl {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin-bottom: 12px;
  }
  footer .foot-grid .col a {
    color: var(--ink);
    text-decoration: none;
    font-family: var(--mono);
    font-size: 14px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 2px;
    transition: all 0.2s ease;
  }
  footer .foot-grid .col a:hover {
    color: var(--signal);
    border-bottom-color: var(--signal);
  }
  footer .foot-grid .col p {
    font-family: var(--mono);
    font-size: 14px;
    color: var(--ink);
    line-height: 1.6;
  }
  footer .foot-grid .col .country {
    color: var(--ink-faint);
    font-size: 11px;
    margin-right: 6px;
  }
  footer .colophon {
    margin-top: 80px;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--ink-faint);
    letter-spacing: 0.06em;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
  }

  /* ---------- Responsive ---------- */
  /* ============================================================
     MOBILE / TABLET — main breakpoint
     ============================================================ */
  @media (max-width: 860px) {
    .wrap { padding: 0 20px; }

    /* Nav: tighten, hide the numeric prefixes, let it wrap if needed */
    .topnav .inner { padding: 10px 20px; }
    .nav-right { gap: 12px; }
    .topnav nav {
      gap: 14px;
      font-size: 10px;
      flex-wrap: wrap;
      justify-content: flex-end;
    }
    .topnav nav a span { display: none; }

    /* Sections: less vertical padding, single-column grids */
    section { padding: 56px 0; }
    section:not(.hero) { min-height: 0; }  /* don't force full-viewport on phones */
    .section-head, .about-grid, .exp-item {
      grid-template-columns: 1fr;
      gap: 20px;
    }
    .section-head { padding-bottom: 28px; margin-bottom: 28px; }

    /* Hero: reclaim vertical space, scale type down, relax the locked height */
    .hero {
      min-height: 0;
      padding: 120px 0 64px;
    }
    .hero h1 {
      font-size: clamp(44px, 13vw, 88px);
      /* min-height (not fixed height) reserves space for the 2-line name so
         font cycling between different-width fonts doesn't shove the page;
         min- lets it grow if a font genuinely needs a 3rd line. */
      height: auto;
      min-height: 2.1em;
      line-height: 1.02;
    }
    .hero .role {
      flex-wrap: wrap;
      gap: 8px 12px;
      font-size: 11px;
      margin-top: 24px;
      margin-bottom: 24px;
    }
    .hero .role::before { display: none; }  /* drop the decorative dash on mobile */
    .hero .lede { font-size: clamp(17px, 4.8vw, 22px); }
    .hero .contact-row {
      margin-top: 36px;
      flex-direction: column;
      align-items: flex-start;
      gap: 14px;
    }
    .hero .contact-row a { font-size: 13px; }

    /* About sidebar stats sit above the body on mobile */
    .about-grid .side { display: flex; flex-wrap: wrap; gap: 20px 40px; }
    .about-grid .side > div { margin-bottom: 0; }

    /* Experience: timeline meta sits above the body */
    .exp-item .when { margin-bottom: 4px; }
    .exp-item .when .badges { margin-top: 8px; }

    /* Grids collapse to single column */
    .cap-grid { grid-template-columns: 1fr; }
    .cred-grid { grid-template-columns: 1fr; }
    .interest {
      grid-template-columns: 1fr;
      gap: 4px;
      padding: 14px 0;
    }

    /* Project card: tighter padding */
    .project-card { padding: 24px 22px; }
    .project-card h3 { font-size: 24px; }

    /* Footer: stack columns */
    footer { padding: 80px 0 48px; }
    footer .foot-grid { grid-template-columns: 1fr; gap: 28px; }
    footer .signoff { margin-bottom: 28px; }
  }

  /* ============================================================
     SMALL PHONES — extra tightening under 480px
     ============================================================ */
  @media (max-width: 480px) {
    .wrap { padding: 0 16px; }
    .topnav .inner { padding: 10px 16px; }
    .topnav nav { gap: 10px; font-size: 9px; }

    .hero { padding: 100px 0 48px; }
    .hero h1 { font-size: clamp(38px, 13vw, 60px); }
    .hero .lede { font-size: 16px; line-height: 1.45; }
    .hero .role { font-size: 10px; }

    .section-head h2 { font-size: clamp(30px, 9vw, 40px); }
    .section-head h2.compact { font-size: clamp(22px, 6.5vw, 30px); }

    .exp-item h3 { font-size: 24px; }
    .exp-item h3 .title-suffix { display: block; margin-left: 0; margin-top: 4px; }

    .cap-block { padding: 28px 22px; }
    .cred-card { padding: 24px 22px; }

    /* Counter/status text can get long — keep it readable */
    .about-grid .side .val.counter { font-size: 11.5px; }
  }

  ::selection { background: var(--signal); color: var(--signal-text); }

  /* ---------- Performance optimizations ---------- */

  /* Honor users who prefer reduced motion (accessibility + perf) */
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
      scroll-behavior: auto !important;
    }
  }

  /* Skip rendering work for sections that aren't on screen.
     The browser draws them only when they scroll near the viewport.
     contain-intrinsic-size gives a height hint so the scrollbar
     doesn't jump while content is virtual. */
  #capabilities,
  #credentials,
  #projects,
  #interests,
  footer {
    content-visibility: auto;
    contain-intrinsic-size: 1px 900px;
  }

  /* Isolate repeated items — the browser doesn't need to repaint
     siblings when one of these changes, and layout work is scoped. */
  .exp-item,
  .cap-block,
  .cred-card {
    contain: layout style;
  }

  /* Tablet breakpoint — cleaner mid-size layouts */
  @media (max-width: 1024px) and (min-width: 861px) {
    .section-head,
    .about-grid,
    .exp-item {
      grid-template-columns: 160px 1fr;
      gap: 40px;
    }
    .wrap { padding: 0 28px; }
  }

  /* Job title suffix — slightly smaller and dim, sits inline */
  .exp-item h3 .title-suffix {
    font-family: var(--mono);
    font-size: 0.55em;
    font-weight: 400;
    color: var(--ink-dim);
    letter-spacing: 0.02em;
    margin-left: 6px;
    vertical-align: middle;
  }

  /* "View all projects" link below the projects-list */
  .view-all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 28px;
    padding: 10px 18px;
    border: 1px solid var(--line);
    border-radius: 2px;
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-dim);
    text-decoration: none;
    transition: all 0.2s ease;
  }
  .view-all:hover {
    color: var(--signal);
    border-color: var(--signal-dim);
    background: var(--bg-elev);
  }
  .view-all .arr {
    display: inline-block;
    transition: transform 0.25s ease;
  }
  .view-all:hover .arr { transform: translateX(4px); }
