/* =============================================================================================
   Ayush Soni · portfolio
   Type: IBM Plex Sans (text), IBM Plex Serif italic (emphasis), IBM Plex Mono (labels).
   Every size is in rem so the A− / A / A+ control scales the whole page.
   ============================================================================================= */

:root {
  --font-sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'IBM Plex Serif', Georgia, 'Times New Roman', serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --shell: min(1180px, calc(100% - 3rem));
  --radius-l: 1.25rem;
  --radius-m: .875rem;
}

html[data-theme=dark] {
  color-scheme: dark;
  --bg: #0e0c0a;
  --surface: #17130f;
  --surface-2: #211b16;
  --text: #f3eee7;
  --muted: #bdb2a3;
  --dim: #958a7b;
  --line: rgba(243, 232, 216, .11);
  --line-strong: rgba(243, 232, 216, .24);
  --accent: #e0624f;
  --accent-ink: #fff8f2;
  --gold: #e3b75a;
  --shadow: 0 1.5rem 3.5rem rgba(0, 0, 0, .38);
  --header-bg: rgba(14, 12, 10, .82);
  --grid-line: rgba(243, 232, 216, .045);
  /* mesh: PHMS state colours */
  --hex-guide: rgba(243, 232, 216, .17);
  --hex-ghost: rgba(243, 232, 216, .5);
  --hex-photon: #ffdc8f;
  --hex-glow: #ff8a3d;
  --hex-bs: #f75d59;
  --hex-tc: #fad02c;
  --hex-cs: #7fb3d5;
}

html[data-theme=light] {
  color-scheme: light;
  --bg: #f6f3ec;
  --surface: #fffdf9;
  --surface-2: #efe9df;
  --text: #1a1814;
  --muted: #514b42;
  --dim: #6c655a;
  --line: rgba(26, 24, 20, .12);
  --line-strong: rgba(26, 24, 20, .26);
  --accent: #b3402c;
  --accent-ink: #fffaf5;
  --gold: #87600f;
  --shadow: 0 1.25rem 3rem rgba(74, 56, 30, .13);
  --header-bg: rgba(246, 243, 236, .86);
  --grid-line: rgba(26, 24, 20, .05);
  --hex-guide: rgba(26, 24, 20, .2);
  --hex-ghost: rgba(26, 24, 20, .42);
  --hex-photon: #d9480f;
  --hex-glow: #ff9a52;
  --hex-bs: #cf3f3a;
  --hex-tc: #b38600;
  --hex-cs: #2f6fa0;
}

html { font-size: 100%; background: var(--bg); scroll-behavior: smooth; scroll-padding-top: 5.5rem; }
html[data-text=s] { font-size: 87.5%; }
html[data-text=l] { font-size: 118.75%; }

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  position: relative;
  isolation: isolate;
  overflow-x: hidden;
  color: var(--text);
  font: 400 1rem/1.65 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: color .3s;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { margin: 0; font-weight: 600; text-wrap: balance; }
p { margin: 0; }
em { font-family: var(--font-serif); font-style: italic; font-weight: 400; color: var(--accent); letter-spacing: -.01em; }
strong { font-weight: 600; color: var(--text); }

.shell { width: var(--shell); margin-inline: auto; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 1rem; top: -4rem; z-index: 200; padding: .6rem 1rem; border-radius: .5rem; background: var(--accent); color: var(--accent-ink); font-weight: 600; text-decoration: none; transition: top .2s; }
.skip-link:focus { top: 1rem; }
.kicker { display: flex; align-items: center; gap: .6rem; font: 500 .75rem/1.4 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.label { font: 500 .75rem/1.4 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }

/* ---- background layers ----------------------------------------------------------------------- */
.atom-field { position: fixed; inset: 0; z-index: -1; width: 100%; height: 100%; pointer-events: none; }
.spark-layer { position: fixed; inset: 0; z-index: 90; width: 100%; height: 100%; pointer-events: none; }
.scroll-progress { position: fixed; top: 0; left: 0; z-index: 100; width: 0; height: 2px; background: linear-gradient(90deg, var(--accent), var(--gold)); }

/* ---- hidden Matrix rain easter egg ----------------------------------------------------------- */
.matrix-mode[hidden] { display: none !important; }
.matrix-mode {
  position: fixed;
  inset: 0;
  z-index: 1000;
  overflow: hidden;
  background: #020604;
  color: #e3ffe9;
  isolation: isolate;
}
.matrix-rain { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .78; }
.matrix-ui {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: clamp(1.25rem, 4vw, 3rem);
  background: radial-gradient(ellipse at center, rgba(0, 12, 5, .2), rgba(0, 5, 2, .76) 78%);
  animation: matrix-arrive .65s cubic-bezier(.2, .7, .2, 1) both;
}
.matrix-topline { display: flex; justify-content: space-between; gap: 1rem; color: rgba(195, 255, 209, .66); font: 500 .7rem/1.4 var(--font-mono); letter-spacing: .16em; }
.matrix-live { display: inline-flex; align-items: center; gap: .55rem; }
.matrix-live i { width: .42rem; height: .42rem; border-radius: 50%; background: #54ff85; box-shadow: 0 0 1rem rgba(84, 255, 133, .9); animation: matrix-pulse 1.8s ease-in-out infinite; }
.matrix-core { align-self: center; justify-self: center; max-width: 48rem; padding: 2rem 1rem; text-align: center; }
.matrix-kicker { color: #8bffa9; font: 500 .72rem/1.4 var(--font-mono); letter-spacing: .2em; text-transform: uppercase; }
.matrix-core h2 { margin-top: 1.4rem; color: #f0fff3; font-size: clamp(2.8rem, 8vw, 6.5rem); line-height: .98; letter-spacing: -.055em; text-shadow: 0 0 2rem rgba(42, 255, 106, .18); }
.matrix-core h2 em { color: #78ff9d; }
.matrix-description { margin-top: 1.25rem; color: rgba(216, 255, 225, .72); font-size: clamp(.95rem, 2vw, 1.1rem); }
.matrix-exit { display: inline-flex; align-items: center; gap: 1rem; margin-top: 2.4rem; padding: .7rem 0; border: 0; border-bottom: 1px solid rgba(120, 255, 157, .45); background: transparent; color: #caffd6; font: 500 .85rem/1.4 var(--font-mono); cursor: pointer; transition: color .2s, border-color .2s; }
.matrix-exit:hover { color: #fff; border-color: #78ff9d; }
.matrix-exit span { color: #7fff9c; font-size: .7rem; letter-spacing: .12em; }
.matrix-foot { color: rgba(195, 255, 209, .45); font: 500 .62rem/1.5 var(--font-mono); letter-spacing: .12em; text-align: center; }
@keyframes matrix-arrive { from { opacity: 0; transform: scale(1.015); } to { opacity: 1; transform: scale(1); } }
@keyframes matrix-pulse { 50% { opacity: .35; } }
@media (max-width: 540px) {
  .matrix-topline { font-size: .6rem; letter-spacing: .1em; }
  .matrix-foot { font-size: .52rem; letter-spacing: .04em; }
}
@media (prefers-reduced-motion: reduce) {
  .matrix-ui { animation: none; }
  .matrix-live i { animation: none; }
}


.no-select {
  user-select: none;
  -webkit-user-select: none; /* Safari / Chrome */
  -moz-user-select: none;    /* Firefox */
  -ms-user-select: none;     /* Older Edge */
}  

/* ---- rapid-click atomic blast ---------------------------------------------------------------- */
.atomic-charge[hidden] { display: none !important; }
.atomic-charge {
  position: fixed;
  z-index: 92;
  left: 0;
  top: 0;
  width: 4.4rem;
  height: 4.4rem;
  border: 1px solid rgba(255, 187, 100, .9);
  border-radius: 50%;
  opacity: .35;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(var(--charge-scale, .8));
  box-shadow: inset 0 0 1.2rem rgba(255, 163, 67, .12), 0 0 1rem rgba(255, 166, 70, .24);
  transition: transform .12s ease-out, opacity .12s ease-out, box-shadow .12s ease-out;
}
.atomic-charge::before, .atomic-charge::after { content: ''; position: absolute; inset: .38rem; border: 1px solid rgba(255, 227, 167, .7); border-radius: 50%; }
.atomic-charge::before { transform: scale(.72); }
.atomic-charge::after { inset: -.5rem; border-color: rgba(255, 117, 66, .48); transform: scale(var(--charge-scale, .8)); }
.atomic-charge.is-charging { opacity: .4; box-shadow: inset 0 0 1.5rem rgba(255, 190, 96, .3), 0 0 2rem rgba(255, 166, 70, .52); }
.atomic-chroma, .atomic-flash { position: fixed; inset: 0; z-index: 94; pointer-events: none; opacity: 0; }
.atomic-chroma { mix-blend-mode: screen; }
.atomic-chroma.is-active { animation: atomic-chroma .48s ease-out both; }
.atomic-chroma.is-active::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(255, 46, 35, .22), transparent 32%, transparent 68%, rgba(39, 194, 255, .2)); }
.atomic-flash { z-index: 95; }
.atomic-flash.is-active { animation: atomic-flash .62s ease-out both; }
.atomic-flash.is-active::before, .atomic-flash.is-active::after { content: ''; position: absolute; inset: 0; }
.atomic-flash.is-active::before { background: #fffef7; }
.atomic-flash.is-active::after { background: radial-gradient(circle at var(--blast-x, 50%) var(--blast-y, 50%), rgba(255, 255, 239, .92) 0, rgba(255, 235, 190, .68) 2%, rgba(255, 183, 91, .25) 15%, transparent 60%); }
body.atomic-blast #main, body.atomic-blast .site-header, body.atomic-blast .site-footer { animation: atomic-shake .78s cubic-bezier(.36, .07, .19, .97) both; }
@keyframes atomic-flash {
  0% { opacity: 0; }
  8% { opacity: 1; }
  22% { opacity: .72; }
  48% { opacity: .18; }
  100% { opacity: 0; }
}
@keyframes atomic-chroma {
  0%, 100% { opacity: 0; }
  9% { opacity: .8; }
  32% { opacity: .35; }
  58% { opacity: .08; }
}
@keyframes atomic-shake {
  0%, 100% { transform: translate3d(0, 0, 0); filter: none; }
  9% { transform: translate3d(8px, -3px, 0); filter: drop-shadow(2px 0 rgba(255, 46, 35, .52)) drop-shadow(-2px 0 rgba(39, 194, 255, .48)); }
  21% { transform: translate3d(-7px, 2px, 0); }
  34% { transform: translate3d(5px, -1px, 0); filter: drop-shadow(1px 0 rgba(255, 46, 35, .34)) drop-shadow(-1px 0 rgba(39, 194, 255, .3)); }
  48% { transform: translate3d(-3px, 1px, 0); }
  64% { transform: translate3d(1.5px, 0, 0); filter: none; }
  78% { transform: translate3d(-.5px, 0, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .atomic-charge { transition: none; }
  .atomic-chroma.is-active { animation-duration: .2s; }
  .atomic-flash.is-active { animation-duration: .26s; }
  .atomic-flash.is-active::before { opacity: .55; }
  body.atomic-blast #main, body.atomic-blast .site-header, body.atomic-blast .site-footer { animation: none; }
}

/* ---- header ---------------------------------------------------------------------------------- */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--header-bg); backdrop-filter: blur(16px) saturate(1.2); -webkit-backdrop-filter: blur(16px) saturate(1.2); border-bottom: 1px solid var(--line); }
.nav-wrap { width: min(1280px, calc(100% - 3rem)); height: 4.25rem; margin-inline: auto; display: flex; align-items: center; gap: 2rem; }
.wordmark { font: 700 1.35rem/1 var(--font-sans); letter-spacing: -.05em; text-decoration: none; }
.wordmark span { color: var(--accent); }
.primary-nav { display: flex; gap: 1.75rem; margin-left: auto; }
.primary-nav a { position: relative; font-size: .9rem; color: var(--muted); text-decoration: none; transition: color .2s; }
.primary-nav a::after { content: ''; position: absolute; left: 0; right: 100%; bottom: -.35rem; height: 1px; background: var(--accent); transition: right .3s var(--ease); }
.primary-nav a:hover, .primary-nav a.is-current { color: var(--text); }
.primary-nav a:hover::after, .primary-nav a.is-current::after { right: 0; }
.toolbar { display: flex; align-items: center; gap: .5rem; }
.text-size { display: inline-flex; align-items: center; padding: .2rem; border: 1px solid var(--line); border-radius: 999px; }
.text-size button { min-width: 2rem; height: 1.85rem; padding: 0 .4rem; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-weight: 600; line-height: 1; cursor: pointer; transition: background .2s, color .2s; }
.text-size button[data-size=s] { font-size: .75rem; }
.text-size button[data-size=m] { font-size: .9rem; }
.text-size button[data-size=l] { font-size: 1.05rem; }
.text-size sup { font-size: .7em; margin-left: 1px; }
.text-size button:hover { color: var(--text); }
.text-size button[aria-pressed=true] { background: var(--surface-2); color: var(--text); }
.icon-button { width: 2.3rem; height: 2.3rem; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; transition: color .2s, border-color .2s; }
.icon-button:hover { color: var(--text); border-color: var(--line-strong); }
.icon-button svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.sound-toggle .cross { display: none; }
.sound-toggle[aria-pressed=false] .waves { display: none; }
.sound-toggle[aria-pressed=false] .cross { display: inline; }
.sound-toggle[aria-pressed=true] { color: var(--gold); }
html[data-theme=dark] .theme-toggle .moon, html[data-theme=light] .theme-toggle .sun { display: none; }
.resume-link { margin-left: .35rem; padding: .5rem .95rem; border: 1px solid var(--line-strong); border-radius: 999px; font-size: .875rem; font-weight: 500; text-decoration: none; transition: border-color .2s, color .2s; }
.resume-link:hover { border-color: var(--accent); color: var(--accent); }
.menu-toggle { display: none; width: 2.3rem; height: 2.3rem; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: transparent; cursor: pointer; }
.menu-toggle i { display: block; width: .95rem; height: 1.5px; background: var(--text); transition: transform .25s; }
.menu-toggle[aria-expanded=true] i:first-child { transform: translateY(.2rem) rotate(45deg); }
.menu-toggle[aria-expanded=true] i:last-child { transform: translateY(-.2rem) rotate(-45deg); }
.mobile-nav { display: none; }

/* ---- buttons & links --------------------------------------------------------------------------- */
.button { display: inline-flex; align-items: center; gap: .6rem; padding: .8rem 1.3rem; border: 1px solid transparent; border-radius: 999px; font: 500 .95rem/1 var(--font-sans); text-decoration: none; cursor: pointer; transition: transform .2s var(--ease), background .2s, border-color .2s, color .2s; }
.button:hover { transform: translateY(-2px); }
.button-primary { background: var(--accent); color: var(--accent-ink); }
.button-primary:hover { background: color-mix(in srgb, var(--accent) 86%, var(--text)); }
.button-ghost { border-color: var(--line-strong); }
.button-ghost:hover { border-color: var(--accent); color: var(--accent); }
.text-link { display: inline-flex; gap: .4rem; font-weight: 500; text-decoration: none; border-bottom: 1px solid var(--line-strong); padding-bottom: .2rem; transition: color .2s, border-color .2s; }
.text-link:hover { color: var(--accent); border-color: var(--accent); }
.burst-trigger { padding: .4rem 0; border: 0; background: none; color: var(--muted); font: 500 .85rem var(--font-mono); cursor: pointer; transition: color .2s; }
.burst-trigger span { color: var(--gold); margin-left: .2rem; }
.burst-trigger:hover { color: var(--text); }
.tags { display: flex; flex-wrap: wrap; gap: .45rem; margin: 1.25rem 0 0; padding: 0; list-style: none; }
.tags li { padding: .3rem .65rem; border: 1px solid var(--line); border-radius: 999px; font: 400 .75rem/1.2 var(--font-mono); color: var(--muted); }

/* ---- hero ---------------------------------------------------------------------------------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); align-items: center; gap: clamp(2rem, 5vw, 5rem); padding-block: clamp(3.5rem, 8vw, 6.5rem) clamp(3rem, 6vw, 5rem); }
.status-dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 .3rem color-mix(in srgb, var(--gold) 20%, transparent); }
.hero h1 { margin: 1.4rem 0 1.1rem; font-size: clamp(3.4rem, 8.6vw, 7.25rem); line-height: .92; letter-spacing: -.045em; }
.hero h1 em { letter-spacing: -.03em; }
.tagline { margin-bottom: 1.1rem; font-size: clamp(1.25rem, 2.2vw, 1.6rem); font-weight: 600; line-height: 1.3; letter-spacing: -.015em; }
.tagline span { color: var(--gold); }
.lede { max-width: 35rem; font-size: clamp(1rem, 1.35vw, 1.12rem); line-height: 1.7; color: var(--muted); }
.hero-meta { display: flex; flex-wrap: wrap; gap: .5rem 0; margin: 1.75rem 0 0; padding: 0; list-style: none; font: 500 .8rem/1.5 var(--font-mono); letter-spacing: .02em; color: var(--dim); }
.hero-meta li + li::before { content: '•'; margin: 0 .9rem; color: var(--accent); }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.25rem; margin-top: 2.25rem; }
.portrait { position: relative; margin: 0; aspect-ratio: 4 / 5; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); box-shadow: var(--shadow); }
.portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 40% 30%; }
.portrait figcaption, .stage-photo figcaption { position: absolute; left: 1rem; bottom: 1rem; padding: .35rem .7rem; border-radius: 999px; background: rgba(14, 12, 10, .55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: #f6efe6; font: 500 .72rem/1.3 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }

.focus-strip { border-block: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 55%, transparent); }
.focus-inner { display: flex; align-items: baseline; gap: 2rem; padding-block: 1.1rem; }
.focus-inner p { font-size: .92rem; color: var(--muted); }

.ambient-strip { padding-block: 1rem 5rem; }
.ambient-quote { max-width: 54rem; margin: 0 auto; padding: clamp(1.5rem, 5vw, 3.5rem) 0 0; text-align: center; outline: none; touch-action: pan-y; }
.ambient-quote:focus-visible { outline: 2px solid var(--accent); outline-offset: .5rem; border-radius: .25rem; }
.quote-mark { display: block; height: .72em; margin-top: .5rem; color: var(--gold); font: 400 clamp(4rem, 10vw, 6rem)/1 Georgia, serif; opacity: .8; }
.ambient-quote blockquote { margin: 0; }
.ambient-quote p {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: .35rem auto 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(1.55rem, 3.5vw, 2.65rem);
  line-height: 1.28;
  letter-spacing: -.025em;
  color: var(--text);
  text-wrap: pretty;
  transition: opacity .35s ease, transform .35s ease;
}
.ambient-quote.is-changing p { opacity: 0; transform: translateY(.45rem); }
.quote-controls { display: flex; justify-content: center; gap: .65rem; margin-top: 1.5rem; }
.quote-arrow { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--dim); cursor: pointer; font-size: 1.25rem; transition: color .2s, background .2s, transform .2s; }
.quote-arrow:hover { color: var(--text); background: color-mix(in srgb, var(--text) 7%, transparent); transform: translateY(-2px); }
.quote-arrow:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .ambient-quote p, .quote-arrow { transition: none; } }

/* ---- sections --------------------------------------------------------------------------------- */
.section { padding-block: clamp(4.5rem, 9vw, 7.5rem); }
.section-head { margin-bottom: clamp(2rem, 4vw, 3rem); }
.section-head h2 { margin-top: .9rem; max-width: 18ch; font-size: clamp(2.2rem, 5vw, 3.8rem); line-height: 1.04; letter-spacing: -.035em; }

.feature { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); }
.feature-art { position: relative; min-height: 20rem; background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px); background-size: 1.75rem 1.75rem; border-right: 1px solid var(--line); }
.feature-mesh { position: absolute; inset: 2rem 1rem 3.25rem; width: calc(100% - 2rem); height: calc(100% - 5.25rem); }
.feature-mesh .guides path { fill: none; stroke: var(--line-strong); stroke-dasharray: 2 6; }
.feature-mesh .routes path { fill: none; stroke: url(#feature-wave); stroke-width: 2; opacity: .3; }
.feature-mesh .routes .active { stroke-width: 3.2; opacity: 1; stroke-dasharray: 10 6; animation: route-flow 2.4s linear infinite; }
.feature-mesh .nodes circle { fill: var(--surface); stroke: var(--accent); stroke-width: 1.6; }
.feature-mesh .stop-a, .feature-mesh .stop-c { stop-color: var(--accent); }
.feature-mesh .stop-b { stop-color: var(--gold); }
@keyframes route-flow { to { stroke-dashoffset: -64; } }
.feature-tag { position: absolute; left: 1.25rem; bottom: 1.1rem; font: 500 .75rem var(--font-mono); letter-spacing: .06em; color: var(--dim); }
.feature-body { align-self: center; padding: clamp(1.75rem, 4vw, 3rem); }
.feature-body h3 { margin: .8rem 0 .9rem; font-size: clamp(1.6rem, 3vw, 2.25rem); line-height: 1.12; letter-spacing: -.025em; }
.feature-body > p:not(.kicker) { color: var(--muted); }
.feature-body .text-link { margin-top: 1.6rem; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-top: 1rem; }
.card { display: flex; flex-direction: column; padding: 1.6rem; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); transition: transform .25s var(--ease), border-color .25s; }
.card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.card-meta { display: flex; justify-content: space-between; gap: 1rem; font: 500 .72rem/1.4 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.card h3 { margin: 1.1rem 0 .6rem; font-size: 1.2rem; line-height: 1.3; letter-spacing: -.01em; }
.card > p:not(.card-meta) { font-size: .95rem; color: var(--muted); }
.card .tags { margin-top: auto; padding-top: 1.25rem; }

/* ---- 02 / mesh: no frame, the lattice runs off every edge ------------------------------------ */
.mesh-section { position: relative; padding-top: clamp(4.5rem, 9vw, 7.5rem); }
.mesh-head { position: relative; z-index: 2; margin-bottom: 0; pointer-events: none; }
.mesh-hint { display: inline-flex; align-items: center; gap: .55rem; margin-top: 1rem; font: 500 .85rem var(--font-mono); color: var(--gold); transition: opacity .6s; }
.mesh-hint::before { content: ''; width: .45rem; height: .45rem; border-radius: 50%; background: var(--gold); animation: hint-pulse 1.8s ease-in-out infinite; }
.mesh-hint.is-done { opacity: 0; }
@keyframes hint-pulse { 50% { transform: scale(1.8); opacity: .35; } }
.mesh-field { position: relative; width: 100%; height: clamp(30rem, 76vh, 50rem); margin-top: -2.5rem; }
.hex-mesh { display: block; width: 100%; height: 100%; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent), linear-gradient(180deg, transparent, #000 16%, #000 86%, transparent);
  -webkit-mask-composite: source-in; mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent), linear-gradient(180deg, transparent, #000 16%, #000 86%, transparent); mask-composite: intersect; }
.mesh-key { position: absolute; left: max(1.5rem, calc((100% - 1180px) / 2)); bottom: 1.25rem; display: flex; gap: 1.1rem; font: 500 .72rem var(--font-mono); letter-spacing: .08em; color: var(--dim); }
.mesh-key span { display: inline-flex; align-items: center; gap: .4rem; }
.mesh-key svg { width: 1.5rem; height: 1rem; fill: none; stroke-width: 2; stroke-linecap: round; }
.key-bs svg { stroke: var(--hex-bs); } .key-tc svg { stroke: var(--hex-tc); } .key-cs svg { stroke: var(--hex-cs); }
.mesh-reset { position: absolute; right: max(1.5rem, calc((100% - 1180px) / 2)); bottom: 1rem; padding: .45rem .85rem; border: 1px solid var(--line); border-radius: 999px; background: color-mix(in srgb, var(--bg) 70%, transparent); color: var(--muted); font: 500 .78rem var(--font-mono); cursor: pointer; transition: color .2s, border-color .2s; }
.mesh-reset:hover { color: var(--text); border-color: var(--line-strong); }
.mesh-noscript { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }

.hex-ghost path { fill: none; stroke: var(--hex-ghost); stroke-width: 1; }
.hex-ghost rect { fill: var(--bg); stroke: var(--hex-ghost); stroke-width: .8; }
.hex-guide { fill: none; stroke: var(--hex-guide); stroke-width: 1.5; stroke-linecap: round; }
.hex-beam { fill: none; stroke: var(--hex-glow); stroke-linecap: round; opacity: 0; transition: opacity .35s, stroke-width .35s; }
.hex-flow { fill: none; stroke: var(--hex-photon); stroke-width: 1.8; stroke-linecap: round; stroke-dasharray: 4 6; opacity: 0; transition: opacity .35s; }
.hex-flow.is-lit { animation: hex-flow .7s linear infinite; }
@keyframes hex-flow { to { stroke-dashoffset: -10; } }
.hex-mzi { cursor: pointer; outline: none; }
.hex-mzi[data-state=BS] { --hex-state: var(--hex-bs); }
.hex-mzi[data-state=TC] { --hex-state: var(--hex-tc); }
.hex-mzi[data-state=CS] { --hex-state: var(--hex-cs); }
.hex-mzi-hit { fill: transparent; stroke: none; }
.hex-mzi-body { fill: var(--bg); stroke: var(--hex-state); stroke-width: 1.3; transition: stroke-width .15s; }
.hex-mzi-glyph { fill: none; stroke: var(--hex-state); stroke-width: 1.9; stroke-linecap: round; opacity: .5; transition: opacity .3s; }
.hex-mzi.is-lit .hex-mzi-glyph { opacity: 1; }
.hex-mzi:hover .hex-mzi-body { stroke-width: 2.6; }
.hex-mzi:focus-visible .hex-mzi-hit { stroke: var(--hex-state); stroke-width: 1.2; stroke-dasharray: 3 3; }
.hex-mzi.is-flash .hex-mzi-body { animation: hex-flash .5s ease-out; }
@keyframes hex-flash { from { stroke-width: 6; } to { stroke-width: 1.3; } }
.hex-stub { fill: none; stroke-linecap: round; opacity: 0; transition: opacity .35s, stroke-width .35s; }
.hex-input { opacity: 1; stroke-width: 3px; }
.hex-stop { stop-color: var(--hex-photon); }
.hex-source { fill: var(--hex-photon); }
.hex-source-halo { fill: var(--hex-glow); opacity: .35; transform-box: fill-box; transform-origin: center; animation: hex-source 1.6s ease-in-out infinite; }
@keyframes hex-source { 50% { opacity: .1; transform: scale(1.6); } }
.hex-port-label { fill: var(--hex-photon); font: 600 11px var(--font-mono); text-anchor: middle; dominant-baseline: middle; paint-order: stroke; stroke: var(--bg); stroke-width: 4px; stroke-linejoin: round; }

/* ---- 03 / research ------------------------------------------------------------------------------ */
.poster { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); }
.poster-photo { margin: 0; min-height: 18rem; }
.poster-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 60% 40%; }
.poster-body { align-self: center; padding: clamp(1.75rem, 4vw, 3rem); }
.poster-body h3 { margin: .9rem 0; font-size: clamp(1.35rem, 2.5vw, 1.85rem); line-height: 1.22; letter-spacing: -.02em; }
.poster-body > p:not(.kicker) { color: var(--muted); }
.timeline { margin: clamp(2.5rem, 5vw, 4rem) 0 0; padding: 0; list-style: none; }
.timeline li { display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: 2rem; padding-block: 1.75rem; border-top: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 1px solid var(--line); }
.when { padding-top: .2rem; font: 500 .8rem var(--font-mono); letter-spacing: .04em; color: var(--dim); }
.timeline h3 { font-size: 1.2rem; letter-spacing: -.01em; }
.timeline h3 span { font-weight: 400; color: var(--muted); }
.where { margin: .2rem 0 .6rem; font-size: .88rem; color: var(--dim); }
.timeline p:not(.when):not(.where) { max-width: 44rem; color: var(--muted); }
.figures-note { margin-top: 2rem; font-size: .95rem; }

/* ---- 04 / positions ----------------------------------------------------------------------------- */
.positions-layout { display: grid; grid-template-columns: minmax(0, .78fr) minmax(0, 1.22fr); gap: clamp(2rem, 5vw, 4.5rem); align-items: start; }
.stage-photo { position: sticky; top: 6rem; margin: 0; aspect-ratio: 4 / 5; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-l); box-shadow: var(--shadow); }
.stage-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 55% 30%; }
.roles { display: grid; gap: .5rem; }
.role { position: relative; padding: 1.5rem 0 1.5rem 1.75rem; border-bottom: 1px solid var(--line); }
.role::before { content: ''; position: absolute; left: 0; top: 1.7rem; bottom: 1.7rem; width: 2px; border-radius: 2px; background: linear-gradient(var(--accent), var(--gold)); }
.role-org { font: 500 .75rem/1.4 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.role h3 { margin: .5rem 0 .45rem; font-size: clamp(1.35rem, 2.6vw, 1.85rem); line-height: 1.15; letter-spacing: -.025em; }
.role > p:last-child { color: var(--muted); }
.honours { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 2rem; margin: 1.5rem 0 0; padding: 0; list-style: none; }
.honours li { padding: 1rem 0; border-top: 1px solid var(--line); font-size: .95rem; color: var(--muted); }
.honours strong { display: block; margin-bottom: .2rem; font: 500 .72rem var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }

/* ---- 05 / contact -------------------------------------------------------------------------------- */
.contact-layout { display: grid; grid-template-columns: minmax(0, .62fr) minmax(0, 1fr) minmax(0, 1.05fr); gap: clamp(1.75rem, 4vw, 3.5rem); align-items: start; }
.contact-photo { margin: 0; aspect-ratio: 4 / 5; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); box-shadow: var(--shadow); }
.contact-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 32%; }
.contact-email { display: inline-block; font-size: clamp(1.05rem, 1.6vw, 1.4rem); font-weight: 600; letter-spacing: -.02em; text-decoration: none; border-bottom: 2px solid var(--accent); padding-bottom: .2rem; overflow-wrap: anywhere; transition: color .2s; }
.contact-email:hover { color: var(--accent); }
.contact-links ul { margin: 2rem 0 0; padding: 0; list-style: none; }
.contact-links li { display: grid; grid-template-columns: 7rem minmax(0, 1fr); align-items: baseline; gap: 1rem; padding: .9rem 0; border-top: 1px solid var(--line); }
.contact-links li span { font: 500 .75rem var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.contact-links li a { text-decoration: none; }
.contact-links li a:hover { color: var(--accent); }
.contact-links li p { color: var(--muted); }
.contact-form { display: grid; gap: 1rem; padding: clamp(1.25rem, 3vw, 2rem); border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.contact-form label { display: grid; gap: .4rem; font-size: .85rem; font-weight: 500; color: var(--muted); }
.contact-form input, .contact-form textarea { width: 100%; padding: .75rem .9rem; border: 1px solid var(--line-strong); border-radius: .6rem; background: var(--bg); color: var(--text); font: 400 1rem var(--font-sans); transition: border-color .2s, box-shadow .2s; }
.contact-form input::placeholder, .contact-form textarea::placeholder { color: var(--dim); }
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.contact-form textarea { resize: vertical; min-height: 7rem; }
.contact-form .button { justify-self: start; }
.form-note { font-size: .82rem; color: var(--dim); }
.form-note.is-error { color: var(--accent); }
.contact-form button:disabled { opacity: .6; cursor: progress; }
.hp-field { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---- footer with the footfall counter -------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--line); }
.footer-inner { display: flex; align-items: center; gap: 1.5rem; padding-block: 1.75rem; }
.footer-copy { margin-right: auto; font-size: .85rem; color: var(--dim); }
.footfall { display: inline-flex; align-items: center; gap: .5rem; padding: .4rem .85rem; border: 1px solid var(--line); border-radius: 999px; color: var(--dim); font: 500 .78rem/1 var(--font-mono); letter-spacing: .04em; white-space: nowrap; }
.footfall-label { text-transform: uppercase; letter-spacing: .1em; }
.footfall b { font-weight: 600; color: var(--gold); font-variant-numeric: tabular-nums; }
.footfall-dot { width: .45rem; height: .45rem; border-radius: 50%; background: var(--line-strong); }
.footfall.is-live .footfall-dot { background: var(--gold); animation: hint-pulse 2.4s ease-in-out infinite; }
.back-top { font: 500 .8rem var(--font-mono); color: var(--dim); text-decoration: none; }
.back-top:hover { color: var(--accent); }

/* ---- reveal on scroll (only when scripting is on) --------------------------------------------- */
html.js .reveal { opacity: 0; transform: translateY(1.25rem); transition: opacity .8s var(--ease), transform .8s var(--ease); }
html.js .reveal.is-visible { opacity: 1; transform: none; }

/* ---- responsive ---------------------------------------------------------------------------------- */
@media (max-width: 1040px) {
  .primary-nav { gap: 1.2rem; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards .card:last-child { grid-column: 1 / -1; }
  .contact-layout { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); }
  .contact-form { grid-column: 1 / -1; }
}
@media (max-width: 880px) {
  :root { --shell: calc(100% - 2.5rem); }
  .nav-wrap { width: calc(100% - 2.5rem); gap: 1rem; }
  .primary-nav, .resume-link { display: none; }
  .toolbar { margin-left: auto; }
  .menu-toggle { display: flex; }
  .mobile-nav:not([hidden]) { display: grid; padding: .5rem 1.25rem 1.25rem; border-top: 1px solid var(--line); }
  .mobile-nav a { padding: .8rem 0; border-bottom: 1px solid var(--line); color: var(--muted); text-decoration: none; }
  .mobile-nav a:last-child { border-bottom: 0; }
  .hero { grid-template-columns: 1fr; }
  .portrait { width: min(100%, 26rem); }
  .feature, .poster, .positions-layout, .contact-layout { grid-template-columns: 1fr; }
  .feature-art { border-right: 0; border-bottom: 1px solid var(--line); min-height: 15rem; }
  .stage-photo { position: relative; top: 0; width: min(100%, 24rem); }
  .contact-photo { width: min(100%, 20rem); }
}
@media (max-width: 720px) {
  .mesh-field { height: auto; aspect-ratio: 10 / 11; margin-top: -1rem; }
  .hex-port-label { font-size: 17px; stroke-width: 5px; }
  .mesh-key { left: 1.25rem; bottom: .5rem; gap: .8rem; }
  .mesh-reset { right: 1.25rem; bottom: .25rem; }
}
@media (max-width: 600px) {
  :root { --shell: calc(100% - 2.25rem); }
  .nav-wrap { width: calc(100% - 2rem); height: 3.75rem; }
  .text-size button { min-width: 1.75rem; height: 1.65rem; }
  .icon-button, .menu-toggle { width: 2.1rem; height: 2.1rem; }
  .cards { grid-template-columns: 1fr; }
  .focus-inner { display: grid; gap: .4rem; }
  .timeline li { grid-template-columns: 1fr; gap: .4rem; }
  .honours { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .contact-links li { grid-template-columns: 5.5rem minmax(0, 1fr); }
  .footer-inner { flex-wrap: wrap; gap: .75rem 1.25rem; }
  .footer-copy { order: 3; width: 100%; }
}
@media (max-width: 720px) {
  .hex-mesh { -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent), linear-gradient(180deg, transparent, #000 9%, #000 92%, transparent); mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent), linear-gradient(180deg, transparent, #000 9%, #000 92%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  html.js .reveal { opacity: 1; transform: none; }
}
