/* ============================================================
   Robert Sundaye — Chalk & Circuit  ·  v2
   Warm paper · ember accent · graph-paper grid · aurora depth

    1 Tokens          2 Themes         3 Reset
    4 Atmosphere      5 Layout         6 Header
    7 Hero            8 Marquee        9 Components
   10 About          11 Timeline      12 Projects
   13 Education      14 Skills        15 Contact
   16 Footer         17 Motion        18 Responsive
   19 Print
   ============================================================ */

/* ── 1. Tokens ───────────────────────────────────────────── */
:root {
  color-scheme: light dark;

  /* Surfaces */
  --paper:       #FBF9F5;
  --surface:     #FFFFFF;
  --surface-2:   #F5F1E9;
  --surface-3:   #EEE8DC;
  --line:        #E7E0D2;
  --line-soft:   rgba(16, 26, 43, .07);

  /* Ink */
  --text:        #0F1A2B;
  --text-muted:  #4C5B70;
  /* Darker than it looks like it needs to be: this drives 11–12px mono labels
     (dates, credential IDs, captions), and the old #78879A only reached 3.7:1
     on paper. This clears 4.5:1. */
  --text-faint:  #5C6B80;

  /* Ember — the teaching/chalk warmth. Text-safe on paper (5.4:1). */
  --accent:        #B45309;
  --accent-bright: #E08616;
  --accent-quiet:  rgba(180, 83, 9, .09);
  --accent-line:   rgba(180, 83, 9, .26);
  --accent-glow:   rgba(224, 134, 22, .30);
  --on-accent:     #FFFFFF;

  /* Circuit — cool secondary. Decorative only: gradients, glows, never body text. */
  --cool:       #2F5FD0;
  --cool-glow:  rgba(47, 95, 208, .22);

  --grid-color:  rgba(16, 26, 43, .5);
  --grid-alpha:  .07;
  --mono-bg:     #F2EDE3;
  --grain-alpha: .035;
  --aurora-alpha: .55;

  /* Elevation — layered, soft-UI evolution: close contact shadow + wide ambient */
  --shadow-sm: 0 1px 2px rgba(16, 26, 43, .05), 0 2px 8px rgba(16, 26, 43, .04);
  --shadow-md: 0 2px 6px rgba(16, 26, 43, .06), 0 12px 28px rgba(16, 26, 43, .07);
  --shadow-lg: 0 4px 12px rgba(16, 26, 43, .07), 0 24px 56px rgba(16, 26, 43, .10);

  /* Type */
  --font-serif: "Newsreader", Georgia, "Times New Roman", serif;
  --font-sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono:  "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --step--1: clamp(.82rem, .79rem + .13vw, .89rem);
  --step-0:  clamp(1rem, .96rem + .18vw, 1.09rem);
  --step-1:  clamp(1.15rem, 1.08rem + .34vw, 1.35rem);
  --step-2:  clamp(1.35rem, 1.21rem + .68vw, 1.75rem);
  --step-3:  clamp(1.7rem, 1.44rem + 1.28vw, 2.45rem);
  --step-4:  clamp(2.1rem, 1.6rem + 2.5vw, 3.6rem);
  --step-5:  clamp(2.6rem, 1.6rem + 4.8vw, 5.4rem);

  /* Space */
  --space-2xs: .375rem;
  --space-xs:  .625rem;
  --space-s:   1rem;
  --space-m:   1.5rem;
  --space-l:   2.25rem;
  --space-xl:  clamp(2.75rem, 5vw, 4rem);
  --space-2xl: clamp(4rem, 8.5vw, 7.5rem);

  --shell:  1180px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius:    16px;
  --radius-lg: 24px;

  /* Motion */
  --t-fast:   160ms;
  --t:        240ms;
  --t-slow:   420ms;
  --t-reveal: 760ms;
  --ease:        cubic-bezier(.22, .61, .36, 1);
  --ease-out:    cubic-bezier(.16, 1, .3, 1);      /* expo.out — entrances */
  --ease-spring: cubic-bezier(.34, 1.4, .64, 1);   /* restrained overshoot */

  --header-h: 76px;
}

/* ── 2. Themes ───────────────────────────────────────────── */
/* The dark ramp is declared twice on purpose: once for the explicit toggle and
   once behind the media query, so a visitor with JS disabled and a dark system
   preference still gets the dark theme. Plain CSS has no way to share one block
   across a media boundary — keep the two lists in sync when editing. */
html[data-theme="dark"] {
  color-scheme: dark;

  --paper:       #080D16;
  --surface:     #101A2B;
  --surface-2:   #0C1421;
  --surface-3:   #16233A;
  --line:        #1F2E45;
  --line-soft:   rgba(233, 239, 246, .08);

  --text:        #E9EFF6;
  --text-muted:  #A2B3C7;
  --text-faint:  #71849B;

  --accent:        #FBBF24;
  --accent-bright: #FCD34D;
  --accent-quiet:  rgba(251, 191, 36, .12);
  --accent-line:   rgba(251, 191, 36, .30);
  --accent-glow:   rgba(251, 191, 36, .26);
  --on-accent:     #0B1220;

  --cool:      #7AA2FF;
  --cool-glow: rgba(122, 162, 255, .20);

  --grid-color:  rgba(233, 239, 246, .5);
  --grid-alpha:  .055;
  --mono-bg:     #0C1421;
  --grain-alpha: .05;
  --aurora-alpha: .42;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, .38), 0 14px 32px rgba(0, 0, 0, .36);
  --shadow-lg: 0 6px 16px rgba(0, 0, 0, .42), 0 28px 64px rgba(0, 0, 0, .46);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    color-scheme: dark;

    --paper:       #080D16;
    --surface:     #101A2B;
    --surface-2:   #0C1421;
    --surface-3:   #16233A;
    --line:        #1F2E45;
    --line-soft:   rgba(233, 239, 246, .08);

    --text:        #E9EFF6;
    --text-muted:  #A2B3C7;
    --text-faint:  #71849B;

    --accent:        #FBBF24;
    --accent-bright: #FCD34D;
    --accent-quiet:  rgba(251, 191, 36, .12);
    --accent-line:   rgba(251, 191, 36, .30);
    --accent-glow:   rgba(251, 191, 36, .26);
    --on-accent:     #0B1220;

    --cool:      #7AA2FF;
    --cool-glow: rgba(122, 162, 255, .20);

    --grid-color:  rgba(233, 239, 246, .5);
    --grid-alpha:  .055;
    --mono-bg:     #0C1421;
    --grain-alpha: .05;
    --aurora-alpha: .42;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-md: 0 2px 6px rgba(0, 0, 0, .38), 0 14px 32px rgba(0, 0, 0, .36);
    --shadow-lg: 0 6px 16px rgba(0, 0, 0, .42), 0 28px 64px rgba(0, 0, 0, .46);
  }
}

/* ── 3. Reset ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

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

body {
  position: relative;
  background: var(--paper);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.65;
  font-feature-settings: "cv05" 1, "cv08" 1, "ss01" 1;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color var(--t-slow) var(--ease), color var(--t-slow) var(--ease);
}

img, svg, video { display: block; max-width: 100%; }
ul, ol { list-style: none; padding: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
code { font-family: var(--font-mono); font-size: .88em; }

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.13;
  letter-spacing: -.016em;
  font-optical-sizing: auto;
  text-wrap: balance;
}
p { text-wrap: pretty; }

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

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

.skip-link {
  position: absolute;
  top: -100px; left: var(--gutter);
  z-index: 300;
  padding: .7rem 1.15rem;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-weight: 600;
  transition: top var(--t) var(--ease);
}
.skip-link:focus { top: 0; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ── 4. Atmosphere ───────────────────────────────────────── */
/* Fixed film grain — kills gradient banding and adds print-like texture.
   Deliberately no mix-blend-mode: blending a fixed layer against scrolling
   content forces the blend to repaint every frame. A plain low-opacity overlay
   composites once and costs nothing on scroll. */
.grain {
  position: fixed;
  inset: 0;
  z-index: 3;                 /* over content (z-2), under the header (z-100) */
  pointer-events: none;
  opacity: var(--grain-alpha);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Slow-drifting colour fields behind the hero. Decorative, no text over the cores. */
.aurora {
  position: absolute;
  inset: -30% -10% auto;
  height: 150%;
  z-index: 0;
  pointer-events: none;
  opacity: var(--aurora-alpha);
  filter: blur(80px);
}
.aurora span {
  position: absolute;
  display: block;
  border-radius: 50%;
  will-change: transform;
}
.aurora span:nth-child(1) {
  top: 8%; left: 52%;
  width: 42vw; height: 42vw;
  background: radial-gradient(circle, var(--accent-glow), transparent 68%);
  animation: drift-a 26s var(--ease) infinite alternate;
}
.aurora span:nth-child(2) {
  top: 26%; left: 4%;
  width: 34vw; height: 34vw;
  background: radial-gradient(circle, var(--cool-glow), transparent 68%);
  animation: drift-b 32s var(--ease) infinite alternate;
}
.aurora span:nth-child(3) {
  top: 46%; left: 66%;
  width: 28vw; height: 28vw;
  background: radial-gradient(circle, var(--accent-glow), transparent 70%);
  animation: drift-c 22s var(--ease) infinite alternate;
}

@keyframes drift-a { to { transform: translate3d(-9%, 12%, 0) scale(1.14); } }
@keyframes drift-b { to { transform: translate3d(12%, -9%, 0) scale(1.1); } }
@keyframes drift-c { to { transform: translate3d(-7%, -13%, 0) scale(.88); } }

/* Graph paper: fine 8px rule under a heavier 40px major line. */
.grid-bg {
  position: absolute;
  inset: -5% -5% auto;
  height: 130%;
  z-index: 0;
  background-image:
    linear-gradient(to right,  var(--grid-color) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-color) 1px, transparent 1px),
    linear-gradient(to right,  var(--grid-color) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-color) 1px, transparent 1px);
  background-size: 40px 40px, 40px 40px, 8px 8px, 8px 8px;
  opacity: var(--grid-alpha);
  pointer-events: none;
  mask-image: radial-gradient(120% 92% at 66% 16%, #000 5%, transparent 72%);
  -webkit-mask-image: radial-gradient(120% 92% at 66% 16%, #000 5%, transparent 72%);
}

/* ── 5. Layout ───────────────────────────────────────────── */
.shell {
  width: min(100% - (var(--gutter) * 2), var(--shell));
  margin-inline: auto;
}

main { position: relative; z-index: 2; }

.section { position: relative; padding-block: var(--space-2xl); }
.section--alt {
  background: var(--surface-2);
  border-block: 1px solid var(--line);
}

.section__head { max-width: 68ch; }

.section__label, .eyebrow {
  font-family: var(--font-mono);
  font-size: .73rem;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
}
.section__label {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  margin-bottom: .9rem;
}
/* The rule draws itself as the heading scrolls in — only where the observer can
   actually flip .is-visible, so it is never stuck at zero width without JS. */
.section__label::before {
  content: "";
  width: 28px; height: 1px;
  background: currentColor;
  transform-origin: left;
  transition: transform var(--t-slow) var(--ease-out) 120ms;
}
.js .reveal .section__label::before { transform: scaleX(0); }
.js .reveal.is-visible .section__label::before { transform: scaleX(1); }

.section__title { font-size: var(--step-3); }
.section__intro {
  max-width: 62ch;
  margin-top: var(--space-s);
  color: var(--text-muted);
  font-size: var(--step-1);
  line-height: 1.55;
}
.subsection__title {
  margin-top: var(--space-xl);
  margin-bottom: var(--space-m);
  font-size: var(--step-2);
}

/* ── 6. Header ───────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--paper) 72%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease),
              background-color var(--t) var(--ease);
}
.site-header.is-stuck {
  border-bottom-color: var(--line);
  box-shadow: var(--shadow-sm);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
}
.site-header__inner {
  display: flex; align-items: center; gap: var(--space-m);
  height: var(--header-h);
}

/* Read-progress rail. Native scroll timeline where supported, JS-fed elsewhere. */
.progress {
  position: absolute; inset: auto 0 -1px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright), var(--cool));
  transform-origin: left;
  transform: scaleX(var(--progress, 0));
  opacity: 0;
  transition: opacity var(--t) var(--ease);
}
.site-header.is-stuck .progress { opacity: 1; }

@supports (animation-timeline: scroll()) {
  .progress {
    animation: progress-grow linear;
    animation-timeline: scroll(root block);
  }
  @keyframes progress-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
}

.brand {
  display: inline-flex; align-items: center; gap: .7rem;
  margin-right: auto;
  transition: opacity var(--t) var(--ease);
}
.brand:hover { opacity: .82; }
.brand__mark {
  position: relative;
  display: grid; place-items: center;
  width: 34px; height: 34px;
  background: linear-gradient(140deg, var(--accent-bright), var(--accent));
  color: var(--on-accent);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .02em;
  box-shadow: 0 2px 10px var(--accent-glow);
  overflow: hidden;
}
/* A sheen sweeps the monogram on hover — one small reward, not a loop. */
.brand__mark::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 38%, rgba(255,255,255,.55) 50%, transparent 62%);
  transform: translateX(-120%);
  transition: transform var(--t-slow) var(--ease);
}
.brand:hover .brand__mark::after { transform: translateX(120%); }
.brand__name {
  font-family: var(--font-serif);
  font-size: 1.08rem;
  font-weight: 600;
  white-space: nowrap;
}

.nav__list { display: flex; align-items: center; gap: .15rem; }
.nav__list a {
  position: relative;
  display: block;
  padding: .5rem .8rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .92rem;
  font-weight: 500;
  transition: color var(--t-fast) var(--ease);
}
.nav__list a::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  background: var(--accent-quiet);
  opacity: 0;
  transform: scale(.9);
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease-spring);
}
.nav__list a:hover { color: var(--text); }
.nav__list a:hover::before { opacity: 1; transform: scale(1); }
.nav__list a.is-active { color: var(--accent); font-weight: 600; }
.nav__list a.is-active::after {
  content: "";
  position: absolute; left: .8rem; right: .8rem; bottom: .2rem;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  animation: underline-in var(--t) var(--ease-out) both;
}
@keyframes underline-in { from { transform: scaleX(0); opacity: 0; } to { transform: scaleX(1); opacity: 1; } }

.site-header__actions { display: flex; align-items: center; gap: .35rem; }
.icon-btn {
  position: relative;
  display: grid; place-items: center;
  width: 42px; height: 42px;
  border-radius: 12px;
  color: var(--text-muted);
  transition: color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.icon-btn:hover { background: var(--accent-quiet); color: var(--accent); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 20px; height: 20px; }

/* Sun/moon crossfade with a quarter turn — the toggle should feel like a switch. */
.icon-btn .icon-sun, .icon-btn .icon-moon {
  grid-area: 1 / 1;
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease-spring);
}
.icon-moon { opacity: 0; transform: rotate(-70deg) scale(.6); }
.icon-sun  { opacity: 1; transform: none; }
html[data-theme="dark"] .icon-sun  { opacity: 0; transform: rotate(70deg) scale(.6); }
html[data-theme="dark"] .icon-moon { opacity: 1; transform: none; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .icon-sun  { opacity: 0; transform: rotate(70deg) scale(.6); }
  html:not([data-theme="light"]) .icon-moon { opacity: 1; transform: none; }
}

.nav-toggle { display: none; }
.nav-toggle__bars { display: grid; gap: 4px; width: 19px; }
.nav-toggle__bars span {
  height: 2px; background: currentColor; border-radius: 2px;
  transition: transform var(--t) var(--ease-spring), opacity var(--t-fast) var(--ease);
}
.nav-toggle[aria-expanded="true"] .nav-toggle__bars span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ── 7. Hero ─────────────────────────────────────────────── */
.hero {
  position: relative;
  z-index: 2;
  overflow: hidden;
  padding-block: clamp(3rem, 7vw, 5.5rem) clamp(2.5rem, 5vw, 4.5rem);
  border-bottom: 1px solid var(--line);
}

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

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: 1.35rem;
  padding: .4rem .85rem .4rem .7rem;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  border: 1px solid var(--accent-line);
  border-radius: 100px;
  text-transform: none;
  letter-spacing: .03em;
  font-size: .78rem;
  backdrop-filter: blur(8px);
}
/* Live pulse — the one intentional infinite animation on the page. */
.eyebrow__tick {
  position: relative;
  width: 7px; height: 7px;
  background: var(--accent);
  border-radius: 50%;
  flex: none;
}
.eyebrow__tick::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: 50%;
  background: var(--accent);
  animation: ping 2.4s var(--ease-out) infinite;
}
@keyframes ping {
  0%   { transform: scale(1);   opacity: .7; }
  70%  { transform: scale(3.2); opacity: 0; }
  100% { transform: scale(3.2); opacity: 0; }
}

.hero__name {
  font-size: var(--step-5);
  line-height: 1.0;
  letter-spacing: -.035em;
}
/* Word-by-word rise, driven by JS splitting. Falls back to a whole-line rise. */
.hero__name:not(.is-split) { animation: rise-in var(--t-reveal) var(--ease-out) both; }
.hero__name .word {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  padding-block: .06em;   /* room for descenders inside the clip */
  margin-block: -.06em;
}
.hero__name .word__inner {
  display: inline-block;
  transform: translateY(105%);
  animation: word-rise 900ms var(--ease-out) forwards;
  animation-delay: calc(var(--i, 0) * 75ms);
}
@keyframes word-rise { to { transform: none; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

.hero__title {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: .5rem .9rem;
  margin-top: 1.1rem;
  color: var(--accent);
  font-family: var(--font-serif);
  font-size: var(--step-1);
  font-weight: 600;
}
.hero__title-sep { width: 5px; height: 5px; background: currentColor; border-radius: 50%; opacity: .55; }

.hero__intro {
  max-width: 54ch;
  margin-top: 1.25rem;
  color: var(--text-muted);
  font-size: var(--step-1);
  line-height: 1.6;
}
.hero__actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 2rem; }

/* Staggered entrance for everything under the headline. */
.hero__body > * { animation: rise-in var(--t-reveal) var(--ease-out) both; }
.hero__body > .eyebrow      { animation-delay: 60ms; }
.hero__body > .hero__name   { animation-delay: 0ms; }
.hero__body > .hero__title  { animation-delay: 300ms; }
.hero__body > .hero__intro  { animation-delay: 380ms; }
.hero__body > .hero__actions{ animation-delay: 460ms; }
.hero__name.is-split { animation: none; opacity: 1; }

/* Portrait — chip-like frame with a soft ember halo and a light pointer tilt. */
.hero__portrait {
  position: relative;
  justify-self: center;
  width: 100%;
  max-width: 320px;
  perspective: 1000px;
  animation: rise-in 900ms var(--ease-out) 200ms both;
}
.hero__portrait::before {
  content: "";
  position: absolute;
  inset: -14%;
  z-index: -1;
  background: radial-gradient(circle at 50% 45%, var(--accent-glow), transparent 62%);
  filter: blur(28px);
  opacity: .9;
}
.portrait-frame {
  position: relative;
  border-radius: var(--radius);
  transform: rotateX(var(--ry, 0deg)) rotateY(var(--rx, 0deg));
  transform-style: preserve-3d;
  transition: transform var(--t-slow) var(--ease);
}
.portrait {
  width: 100%;
  height: auto;                 /* must pair with width:100%, or the height
                                   attribute makes aspect-ratio a no-op */
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.portrait--monogram {
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, var(--accent-quiet), transparent 62%), var(--surface-2);
  border-color: var(--accent-line);
  color: var(--accent);
}
.portrait__initials {
  font-family: var(--font-mono);
  font-size: clamp(3rem, 8vw, 4.4rem);
  font-weight: 600;
  letter-spacing: .06em;
}
/* Corner brackets — a drafting/technical cue rather than a plain border. */
.portrait-frame::before,
.portrait-frame::after {
  content: "";
  position: absolute;
  width: 34px; height: 34px;
  border: 2px solid var(--accent);
  opacity: .75;
  transition: transform var(--t-slow) var(--ease), opacity var(--t-slow) var(--ease);
}
.portrait-frame::before {
  top: -9px; left: -9px;
  border-right: 0; border-bottom: 0;
  border-radius: var(--radius-sm) 0 0 0;
}
.portrait-frame::after {
  bottom: -9px; right: -9px;
  border-left: 0; border-top: 0;
  border-radius: 0 0 var(--radius-sm) 0;
}
.hero__portrait:hover .portrait-frame::before { transform: translate(-4px, -4px); }
.hero__portrait:hover .portrait-frame::after  { transform: translate(4px, 4px); }

/* Floating credential tag on the portrait. */
.portrait-tag {
  position: absolute;
  right: -.75rem; bottom: 1.75rem;
  z-index: 3;
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem .8rem;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--line);
  border-radius: 100px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
  font-family: var(--font-mono);
  font-size: .7rem;
  letter-spacing: .04em;
  color: var(--text-muted);
  white-space: nowrap;
  animation: float-y 7s var(--ease) infinite alternate;
}
.portrait-tag b { color: var(--accent); font-weight: 600; }
@keyframes float-y { to { transform: translateY(-9px); } }

.hero__scroll {
  position: relative; z-index: 2;
  display: inline-flex; align-items: center; gap: .55rem;
  margin-top: clamp(2rem, 4vw, 3.25rem);
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  transition: color var(--t) var(--ease);
  animation: rise-in var(--t-reveal) var(--ease-out) 620ms both;
}
.hero__scroll:hover { color: var(--accent); }
.hero__scroll span {
  display: grid; place-items: center;
  width: 22px; height: 34px;
  border: 1px solid currentColor;
  border-radius: 100px;
}
.hero__scroll span::before {
  content: "";
  width: 3px; height: 6px;
  background: currentColor;
  border-radius: 2px;
  animation: scroll-hint 1.9s var(--ease) infinite;
}
@keyframes scroll-hint {
  0%, 100% { transform: translateY(-4px); opacity: 0; }
  35%      { opacity: 1; }
  70%      { transform: translateY(5px); opacity: 0; }
}

/* ── 8. Marquee ──────────────────────────────────────────── */
.marquee {
  position: relative;
  z-index: 2;
  padding-block: 1.1rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee__track {
  display: flex;
  width: max-content;
  gap: 2.5rem;
  animation: marquee 42s linear infinite;
}
.marquee:hover .marquee__track,
.marquee:focus-within .marquee__track { animation-play-state: paused; }
.marquee__item {
  display: flex; align-items: center; gap: 2.5rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: .8rem;
  letter-spacing: .05em;
  white-space: nowrap;
}
.marquee__item::after {
  content: "";
  width: 5px; height: 5px;
  background: var(--accent);
  border-radius: 50%;
  opacity: .5;
}
@keyframes marquee { to { transform: translateX(-50%); } }

/* ── 9. Components ───────────────────────────────────────── */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .85rem 1.55rem;
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-weight: 600;
  border: 1px solid transparent;
  overflow: hidden;
  isolation: isolate;
  transition: transform var(--t) var(--ease-spring), box-shadow var(--t) var(--ease),
              color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.btn svg { width: 18px; height: 18px; transition: transform var(--t) var(--ease-spring); }
.btn:active { transform: translateY(0) scale(.98); }

.btn--primary {
  background: linear-gradient(135deg, var(--accent-bright), var(--accent));
  color: var(--on-accent);
  box-shadow: 0 1px 2px rgba(16,26,43,.16), 0 10px 26px var(--accent-glow);
}
/* Sheen sweep on hover instead of a colour swap — reads as material, not a state flip. */
.btn--primary::after {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.35) 50%, transparent 65%);
  transform: translateX(-120%);
  transition: transform var(--t-slow) var(--ease);
}
.btn--primary:hover { transform: translateY(-3px); box-shadow: 0 6px 14px rgba(16,26,43,.18), 0 18px 40px var(--accent-glow); }
.btn--primary:hover::after { transform: translateX(120%); }
.btn--primary:hover svg { transform: translateY(2px); }

.btn--ghost {
  border-color: var(--line);
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(8px);
}
.btn--ghost:hover {
  border-color: var(--accent-line);
  color: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.btn--ghost:hover svg { transform: translateX(3px); }

.chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip {
  padding: .4rem .78rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 100px;
  color: var(--text-muted);
  font-size: .84rem;
  font-weight: 500;
  transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease),
              transform var(--t-fast) var(--ease-spring), background-color var(--t-fast) var(--ease);
}
.chip:hover {
  border-color: var(--accent-line);
  color: var(--accent);
  background: var(--accent-quiet);
  transform: translateY(-2px);
}
.chip--mono { font-family: var(--font-mono); font-size: .77rem; background: var(--mono-bg); }
.chips--sm .chip { font-size: .76rem; padding: .3rem .66rem; }

.badge {
  display: inline-block;
  padding: .14rem .58rem;
  border-radius: 100px;
  font-size: .72rem;
  font-weight: 600;
}
.badge--now { background: var(--accent); color: var(--on-accent); }

.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  margin-right: .1rem;
  border: 1.5px solid var(--text-faint);
  border-radius: 50%;
}
.status-dot--live {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-quiet);
}

/* Shared card surface + pointer-tracked spotlight.
   --mx/--my are written by JS; the layer stays at 0 opacity until pointer entry. */
.card {
  position: relative;
  isolation: isolate;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform var(--t-slow) var(--ease-out), box-shadow var(--t-slow) var(--ease),
              border-color var(--t) var(--ease);
}
.card::before {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  border-radius: inherit;
  background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 50%),
              var(--accent-quiet), transparent 62%);
  opacity: 0;
  transition: opacity var(--t-slow) var(--ease);
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-line);
  box-shadow: var(--shadow-md);
}
@media (hover: hover) and (pointer: fine) {
  .card:hover::before { opacity: 1; }
}

/* ── 10. About ───────────────────────────────────────────── */
.about__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 3.75rem);
  margin-top: var(--space-l);
  align-items: start;
}
.about__prose p + p { margin-top: 1.1rem; }
.about__prose p { color: var(--text-muted); font-size: var(--step-0); }
/* Lead paragraph set in the serif, with a drop-cap-adjacent scale bump. */
.about__prose p:first-child {
  color: var(--text);
  font-family: var(--font-serif);
  font-size: var(--step-2);
  line-height: 1.42;
  letter-spacing: -.01em;
}

.facts { display: grid; gap: .7rem; }
.fact {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 1.05rem 1.25rem;
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-xs) var(--radius-sm) var(--radius-sm) var(--radius-xs);
  overflow: hidden;
}
.fact:hover { transform: translateX(4px); }
.fact__value {
  flex: none;
  min-width: 2.6ch;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.fact__label { color: var(--text-muted); font-size: .88rem; line-height: 1.45; }

/* ── 11. Timeline ────────────────────────────────────────── */
.timeline { position: relative; margin-top: var(--space-l); padding-left: 2.25rem; }
.timeline::before {
  content: "";
  position: absolute; top: .6rem; bottom: .6rem; left: 5px;
  width: 1px;
  background: var(--line);
}
/* The ember overlay draws down the rail as the section scrolls through. */
.timeline__rail {
  position: absolute; top: .6rem; bottom: .6rem; left: 5px;
  width: 1px;
  background: linear-gradient(to bottom, var(--accent), var(--accent-line));
  transform-origin: top;
  transform: scaleY(var(--draw, 0));
}
@supports (animation-timeline: view()) {
  .timeline__rail {
    transform: scaleY(0);
    animation: rail-draw linear both;
    animation-timeline: view();
    animation-range: cover 12% cover 78%;
  }
  @keyframes rail-draw { to { transform: scaleY(1); } }
}

.timeline__item { position: relative; padding-bottom: 2.15rem; }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__marker {
  position: absolute; top: 1.35rem; left: calc(-2.25rem + 1px);
  width: 11px; height: 11px;
  background: var(--paper);
  border: 2px solid var(--accent);
  border-radius: 2px;
  transform: rotate(45deg);
  transition: transform var(--t) var(--ease-spring), box-shadow var(--t) var(--ease);
}
.timeline__item:first-child .timeline__marker {
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-quiet);
}
.timeline__item:hover .timeline__marker {
  transform: rotate(45deg) scale(1.35);
  box-shadow: 0 0 0 5px var(--accent-quiet);
}

.role { padding: 1.55rem 1.7rem; }
.role__title { font-size: var(--step-1); }
.role__org { margin-top: .25rem; color: var(--accent); font-weight: 600; font-size: .95rem; }
.role__meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .9rem;
  margin-top: .5rem;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: .77rem;
}
.role__dates { display: inline-flex; align-items: center; gap: .4rem; }
.role__points { margin-top: 1.05rem; display: grid; gap: .55rem; }
.role__points li {
  position: relative;
  padding-left: 1.35rem;
  color: var(--text-muted);
  font-size: .95rem;
}
.role__points li::before {
  content: "";
  position: absolute; top: .68em; left: .15rem;
  width: 7px; height: 1px;
  background: var(--accent);
  transition: width var(--t) var(--ease);
}
.role:hover .role__points li::before { width: 11px; }

/* ── 12. Projects ────────────────────────────────────────── */
/* Two fixed columns rather than auto-fit: the flagship takes the whole first
   row, and a single follow-up card then reads as a deliberate half rather than
   an orphaned third. */
.projects {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.4rem;
  margin-top: var(--space-l);
}
.project {
  display: flex; flex-direction: column; gap: .85rem;
  padding: clamp(1.5rem, 3vw, 2.1rem);
  overflow: hidden;
}
.project--featured { grid-column: 1 / -1; }
/* Full-width card, but the prose still stops at a comfortable measure. */
.project--featured .project__summary { max-width: 78ch; }
.project--featured::after {
  content: "";
  position: absolute; inset: 0 0 auto; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright), var(--cool));
}
.project__kind {
  display: flex; align-items: center; gap: .6rem;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.project__year {
  padding-left: .6rem;
  border-left: 1px solid var(--accent-line);
  color: var(--text-faint);
}
.project__title { font-size: var(--step-2); }
.project__summary { color: var(--text-muted); font-size: .97rem; }

.project__shots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: .7rem;
  margin-top: .4rem;
}
.project__shot {
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease),
              transform var(--t-slow) var(--ease-out);
}
.project__shot:hover {
  border-color: var(--accent-line);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}
.project__shot img {
  width: 100%;
  height: auto;              /* pairs with width:100% so aspect-ratio applies */
  aspect-ratio: 2 / 1;       /* matches the browser screenshots, so nothing is cropped */
  object-fit: cover;
  object-position: top center;
  transition: transform var(--t-slow) var(--ease-out);
}
.project__shot:hover img { transform: scale(1.06); }
.project__shot figcaption {
  position: relative;
  padding: .45rem .6rem;
  border-top: 1px solid var(--line);
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: .69rem;
}
/* Zoom affordance, revealed on hover only — never the sole cue (the link has a label). */
.project__shot a::after {
  content: "";
  position: absolute; top: .5rem; right: .5rem;
  width: 28px; height: 28px;
  background:
    linear-gradient(currentColor, currentColor) center/11px 1.5px no-repeat,
    linear-gradient(currentColor, currentColor) center/1.5px 11px no-repeat;
  color: var(--on-accent);
  background-color: var(--accent);
  border-radius: 50%;
  opacity: 0;
  transform: scale(.7);
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease-spring);
}
.project__shot:hover a::after { opacity: 1; transform: scale(1); }

.project .chips { margin-top: auto; padding-top: .35rem; }
.project__link a {
  display: inline-flex; align-items: center; gap: .4rem;
  color: var(--accent);
  font-weight: 600;
  font-size: .92rem;
  border-bottom: 1px solid var(--accent-line);
  transition: gap var(--t) var(--ease), border-color var(--t) var(--ease);
}
.project__link a:hover { gap: .65rem; border-bottom-color: var(--accent); }

/* ── 13. Education ───────────────────────────────────────── */
.degrees {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(265px, 1fr));
  gap: 1.15rem;
  margin-top: var(--space-l);
}
.degree { padding: 1.5rem 1.6rem; }
.degree__title { font-size: var(--step-1); }
.degree__org { margin-top: .35rem; color: var(--accent); font-weight: 600; font-size: .92rem; }
.degree__place { margin-top: .1rem; color: var(--text-faint); font-size: .84rem; }
.degree__status {
  display: flex; align-items: center; gap: .5rem;
  margin-top: .95rem; padding-top: .85rem;
  border-top: 1px solid var(--line);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: .75rem;
}

.certs { display: grid; gap: .7rem; }
.cert {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1.1rem;
  padding: 1.05rem 1.3rem;
  border-radius: var(--radius-sm);
}
.cert:hover { transform: translateX(5px); }
.cert__icon {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  color: var(--accent);
  background: var(--accent-quiet);
  border-radius: 10px;
  flex: none;
  transition: transform var(--t) var(--ease-spring);
}
.cert:hover .cert__icon { transform: scale(1.08) rotate(-4deg); }
.cert__icon svg { width: 21px; height: 21px; }
.cert__title { font-size: 1.02rem; font-weight: 600; }
.cert__issuer { margin-top: .12rem; color: var(--text-muted); font-size: .86rem; }
.cert__credential { margin-top: .28rem; color: var(--text-faint); font-size: .76rem; }
.cert__credential code { padding: .1rem .38rem; background: var(--mono-bg); border-radius: 4px; }
.cert__date {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: .77rem;
  white-space: nowrap;
}

/* ── 14. Skills ──────────────────────────────────────────── */
.skills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.4rem;
  margin-top: var(--space-l);
}
.skillgroup { padding: 1.6rem 1.7rem; }
.skillgroup__name {
  display: flex; align-items: center; gap: .7rem;
  margin-bottom: 1.1rem;
  font-size: var(--step-1);
}
.skillgroup__index {
  display: grid; place-items: center;
  width: 26px; height: 26px;
  background: var(--accent-quiet);
  border: 1px solid var(--accent-line);
  border-radius: 8px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: .7rem;
  font-weight: 600;
  flex: none;
}
/* Chips fade in one after another once the group scrolls into view. */
.js .reveal .chip { opacity: 0; transform: translateY(8px); }
.js .reveal.is-visible .chip {
  animation: chip-in 460ms var(--ease-out) forwards;
  animation-delay: calc(var(--i, 0) * 40ms);
}
@keyframes chip-in { to { opacity: 1; transform: none; } }

/* ── 15. Contact ─────────────────────────────────────────── */
.section--contact {
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
  border-top: 1px solid var(--line);
}
.contact__cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
  gap: 1.05rem;
  margin-top: var(--space-l);
}
.contact-card { padding: 1.5rem 1.6rem; }
.contact-card__icon {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  margin-bottom: .95rem;
  color: var(--accent);
  background: var(--accent-quiet);
  border-radius: 11px;
  transition: transform var(--t) var(--ease-spring);
}
.contact-card:hover .contact-card__icon { transform: translateY(-3px) scale(1.06); }
.contact-card__icon svg { width: 21px; height: 21px; }
.contact-card__label {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: .71rem;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.contact-card__value {
  margin-top: .4rem;
  font-family: var(--font-serif);
  font-size: 1.02rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.contact-card__value a { border-bottom: 1px solid var(--accent-line); transition: color var(--t-fast) var(--ease); }
.contact-card__value a:hover { color: var(--accent); }
.contact-card__arrow {
  display: inline-block;
  color: var(--accent);
  transition: transform var(--t) var(--ease-spring);
}
.contact-card--link:hover .contact-card__arrow { transform: translate(3px, -3px); }

.contact__cv { margin-top: var(--space-m); color: var(--text-muted); font-size: .95rem; }
.contact__cv a { color: var(--accent); font-weight: 600; border-bottom: 1px solid var(--accent-line); }

/* ── 16. Footer ──────────────────────────────────────────── */
.site-footer {
  position: relative;
  z-index: 2;
  padding-block: var(--space-xl) var(--space-m);
  border-top: 1px solid var(--line);
  background: var(--paper);
  overflow: hidden;
}
.site-footer__inner {
  display: flex; flex-wrap: wrap;
  gap: var(--space-m);
  align-items: flex-end;
  justify-content: space-between;
}
.site-footer__links { display: flex; flex-wrap: wrap; gap: .35rem 1.35rem; }
.site-footer__links a {
  color: var(--text-muted);
  font-size: .9rem;
  transition: color var(--t-fast) var(--ease);
}
.site-footer__links a:hover { color: var(--accent); }
.site-footer__copy { color: var(--text-faint); font-family: var(--font-mono); font-size: .78rem; }
.site-footer__top {
  display: inline-flex; align-items: center; gap: .45rem;
  color: var(--text-muted);
  font-size: .88rem;
  font-weight: 500;
  transition: color var(--t-fast) var(--ease);
}
.site-footer__top span { transition: transform var(--t) var(--ease-spring); }
.site-footer__top:hover { color: var(--accent); }
.site-footer__top:hover span { transform: translateY(-3px); }

/* Oversized wordmark, faded out at the baseline — a signature, not a heading.
   Sized in cqw against the shell, not vw: the shell stops growing at 1180px, so
   a viewport-relative size would run the name off the edge on wide screens. */
.site-footer .shell { container-type: inline-size; }
.site-footer__mark {
  margin-top: var(--space-l);
  font-family: var(--font-serif);
  font-size: clamp(2.5rem, 13vw, 9rem);
  font-size: 14cqw;
  font-weight: 600;
  line-height: .82;
  letter-spacing: -.04em;
  color: transparent;
  background: linear-gradient(180deg, var(--text) -10%, transparent 88%);
  -webkit-background-clip: text;
  background-clip: text;
  opacity: .16;
  user-select: none;
  white-space: nowrap;
}

/* ── 17. Motion ──────────────────────────────────────────── */
/* Scoped to .js (set by the inline head script) so that with scripting blocked
   every revealable stays visible instead of being hidden with no way back. */
.js .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity var(--t-reveal) var(--ease-out), transform var(--t-reveal) var(--ease-out);
  transition-delay: calc(var(--i, 0) * 70ms);
}
.js .reveal--left  { transform: translateX(-26px); }
.js .reveal--right { transform: translateX(26px); }
.js .reveal--scale { transform: translateY(18px) scale(.97); }

.js .reveal.is-visible { opacity: 1; transform: none; }

/* View Transitions: the theme wipe is animated from JS as a clip-path on the
   incoming snapshot, so the default cross-fade has to be switched off. */
::view-transition-old(root),
::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-old(root) { z-index: 1; }
::view-transition-new(root) { z-index: 2; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: .01ms !important;
    transition-delay: 0ms !important;
  }
  .js .reveal, .hero__body > *, .hero__portrait, .hero__scroll { opacity: 1 !important; transform: none !important; }
  .hero__name .word__inner { transform: none !important; }
  .js .reveal .chip { opacity: 1 !important; transform: none !important; }
  .aurora { display: none; }
  .marquee__track { animation: none; transform: none; }
  .portrait-frame { transform: none !important; }
}

/* ── 18. Responsive ──────────────────────────────────────── */
@media (max-width: 1000px) {
  .hero__inner { grid-template-columns: 1fr; }
  .hero__portrait { order: -1; justify-self: center; max-width: 230px; }
  .about__grid { grid-template-columns: 1fr; }
}

@media (max-width: 780px) {
  :root { --header-h: 66px; }
  .nav-toggle { display: grid; }

  .nav {
    position: fixed;
    inset: var(--header-h) 0 auto;
    max-height: calc(100dvh - var(--header-h));
    overflow-y: auto;
    padding: .6rem var(--gutter) 1.5rem;
    background: color-mix(in srgb, var(--paper) 96%, transparent);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    opacity: 0; visibility: hidden; transform: translateY(-12px);
    transition: opacity var(--t) var(--ease), transform var(--t) var(--ease-out), visibility var(--t);
  }
  .nav.is-open { opacity: 1; visibility: visible; transform: none; }
  .nav__list { flex-direction: column; align-items: stretch; gap: .1rem; }
  .nav__list a { padding: .9rem .65rem; font-size: 1.02rem; }
  .nav__list a.is-active::after { display: none; }
  .nav__list a.is-active { background: var(--accent-quiet); }
  /* Menu items cascade in behind the panel. */
  .nav.is-open .nav__list li {
    animation: rise-in 420ms var(--ease-out) both;
    animation-delay: calc(var(--i, 0) * 45ms);
  }

  .hero__portrait { max-width: 190px; }
  .portrait-tag { right: -.5rem; bottom: 1rem; font-size: .64rem; padding: .4rem .65rem; }
  .projects { grid-template-columns: 1fr; }
  .cert { grid-template-columns: auto minmax(0, 1fr); row-gap: .45rem; }
  .cert__date { grid-column: 2; }
  .btn { flex: 1 1 auto; justify-content: center; }
  .site-footer__inner { align-items: flex-start; }
}

@media (max-width: 460px) {
  /* The name stays visible at every width — the RS mark alone identifies nothing. */
  .brand__name { font-size: .93rem; }
  .brand { gap: .5rem; }
  .brand__mark { width: 30px; height: 30px; font-size: .76rem; }
  .fact { flex-direction: column; gap: .3rem; }
  .hero__scroll { display: none; }
}

/* ── 19. Print — renders as a clean CV ───────────────────── */
@media print {
  :root {
    --paper: #fff; --surface: #fff; --surface-2: #fff; --surface-3: #fff;
    --text: #000; --text-muted: #222; --text-faint: #444;
    --line: #bbb; --accent: #8a4308; --accent-quiet: transparent;
    --shadow-sm: none; --shadow-md: none; --shadow-lg: none;
  }
  .site-header, .site-footer, .grid-bg, .aurora, .grain, .hero__actions,
  .nav, .icon-btn, .skip-link, .contact__cv, .marquee,
  .hero__scroll, .portrait-tag, .progress { display: none !important; }

  body { font-size: 10.5pt; line-height: 1.45; }
  .section { padding-block: 1rem; border: 0; }
  .hero { padding-block: 0 .9rem; }
  .hero__inner { grid-template-columns: 1fr; }
  .hero__portrait { display: none; }
  .js .reveal, .hero__body > * { opacity: 1 !important; transform: none !important; animation: none !important; }
  .js .reveal .chip { opacity: 1 !important; transform: none !important; }

  .role, .cert, .project, .skillgroup, .degree, .fact, .contact-card {
    break-inside: avoid;
    box-shadow: none;
  }
  h2, h3 { break-after: avoid; }
}
