/* --- 1. Design Tokens --- */
:root {
    --bg: #F7F4EE;
    --bg-subtle: #EFECE5;
    --ink: #181715;
    --ink-secondary: #433F3A;
    --ink-muted: #666058;
    --accent: #9E5A3C;
    --yarn-taupe: #9A8873;
    --rule: #D6D0C5;
    --section-divider: #C5BDB0;
    --header-bg: rgba(247, 244, 238, 0.9);
    --hl-color: rgba(158, 90, 60, 0.22);
    --warp-line: rgba(24, 23, 21, 0.032);

    --font-serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    --space-1: 0.25rem;  /* 4px */
    --space-2: 0.5rem;   /* 8px */
    --space-3: 0.75rem;  /* 12px */
    --space-4: 1rem;     /* 16px */
    --space-5: 1.25rem;  /* 20px */
    --space-6: 1.5rem;  /* 24px */
    --space-8: 2rem;     /* 32px */
    --space-10: 2.5rem;  /* 40px */
    --space-12: 3rem;    /* 48px */

    --container: 1120px;
    --gutter: clamp(1.25rem, 4vw, 2.5rem);
    --header-h: 4rem;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-reveal: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
    --bg: #131211;
    --bg-subtle: #1B1917;
    --ink: #F2EFE9;
    --ink-secondary: #C8C2B9;
    --ink-muted: #9E978E;
    --accent: #D08564;
    --yarn-taupe: #B5A38E;
    --rule: #302D29;
    --section-divider: #38342F;
    --header-bg: rgba(19, 18, 17, 0.9);
    --hl-color: rgba(208, 133, 100, 0.26);
    --warp-line: rgba(242, 239, 233, 0.03);
}

/* --- 2. Reset, Base & Scroll-Snap Architecture --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    scroll-padding-top: var(--header-h);
    -webkit-text-size-adjust: 100%;
}

/* Desktop Editorial Chapter Snapping (Proximity preserves natural scroll & long sections) */
@media (min-width: 769px) and (min-height: 600px) and (prefers-reduced-motion: no-preference) {
    html {
        scroll-snap-type: y proximity;
    }
}

body {
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.65;
    background-color: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    transition: background-color 200ms var(--ease), color 200ms var(--ease);
}

h1, h2, h3, h4 {
    text-wrap: balance;
    font-weight: 400;
}

p, li {
    text-wrap: pretty;
}

p {
    max-width: 65ch;
}

ul {
    list-style: none;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
}

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

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

.tabular {
    font-variant-numeric: tabular-nums;
}

/* Skip Link */
.skip-link {
    position: absolute;
    top: -3.5rem;
    left: var(--gutter);
    background-color: var(--ink);
    color: var(--bg);
    padding: var(--space-2) var(--space-4);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    z-index: 200;
    transition: top 180ms var(--ease);
}

.skip-link:focus {
    top: var(--space-3);
}

/* --- 3. Marker Highlight (<mark class="hl">) --- */
mark.hl {
    color: inherit;
    font-weight: 500;
    background-color: transparent;
    background-image: linear-gradient(transparent 58%, var(--hl-color) 58%);
    background-repeat: no-repeat;
    background-position: 0 0;
    background-size: 100% 100%;
    padding: 0 0.14em;
    margin: 0 -0.06em;
    border-radius: 1px;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

/* Hidden/reset state when parent section is outside viewport */
.js mark.hl {
    background-size: 0% 100%;
    transition: background-size 220ms ease-out 0ms;
}

/* Active reveal state when parent section enters viewport */
.js .is-visible mark.hl {
    background-size: 100% 100%;
    transition: background-size 680ms var(--ease-reveal) 320ms;
}

/* --- 4. Repeatable Bidirectional Section Reveal Animations --- */
/* Hidden/Reset State (fast, delay-free reset when section exits viewport) */
.js .hero .hero-status,
.js .hero .hero-name,
.js .hero .hero-lead,
.js .hero .hero-actions {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 220ms ease-out 0ms, transform 220ms ease-out 0ms;
}

/* Active State (sequenced editorial entrance when Hero is in viewport) */
.js .hero.is-visible .hero-status {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 580ms var(--ease-reveal) 40ms, transform 580ms var(--ease-reveal) 40ms;
}

.js .hero.is-visible .hero-name {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 620ms var(--ease-reveal) 110ms, transform 620ms var(--ease-reveal) 110ms;
}

.js .hero.is-visible .hero-lead {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 620ms var(--ease-reveal) 200ms, transform 620ms var(--ease-reveal) 200ms;
}

.js .hero.is-visible .hero-actions {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 620ms var(--ease-reveal) 290ms, transform 620ms var(--ease-reveal) 290ms;
}

/* Section Heading & Main Body: Hidden/Reset State */
.js .fade-section .col-heading {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 220ms ease-out 0ms, transform 220ms ease-out 0ms;
}

.js .fade-section .col-body {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 220ms ease-out 0ms, transform 220ms ease-out 0ms;
}

/* Section Heading & Main Body: Active Reveal State (Heading first, Body second) */
.js .fade-section.is-visible .col-heading {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 560ms var(--ease-reveal) 0ms, transform 560ms var(--ease-reveal) 0ms;
}

.js .fade-section.is-visible .col-body {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 640ms var(--ease-reveal) 130ms, transform 640ms var(--ease-reveal) 130ms;
}

/* Staggered Child Items: Hidden/Reset State */
.js .fade-section .stagger-item {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 200ms ease-out 0ms, transform 200ms ease-out 0ms;
}

/* Staggered Child Items: Active Reveal State */
.js .fade-section.is-visible .stagger-item {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 580ms var(--ease-reveal), transform 580ms var(--ease-reveal);
    transition-delay: calc(170ms + (var(--stagger-index, 0) * 85ms));
}

/* --- 5. Layout Container, Editorial Section Dividers & 12-Col Grid --- */
.container {
    max-width: var(--container);
    width: 100%;
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.grid-12 {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: var(--space-6);
    row-gap: var(--space-6);
    align-items: start;
}

/* Container-aligned 1px horizontal divider with subtle 36px terracotta lead segment */
.stitch-section {
    position: relative;
    padding: clamp(3rem, 6.5vh, 4.5rem) 0;
    scroll-margin-top: var(--header-h);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stitch-section::before {
    content: "";
    position: absolute;
    top: 0;
    left: max(var(--gutter), calc((100% - var(--container)) / 2 + var(--gutter)));
    right: max(var(--gutter), calc((100% - var(--container)) / 2 + var(--gutter)));
    height: 1px;
    background: linear-gradient(
        90deg,
        var(--accent) 0,
        var(--accent) 36px,
        var(--section-divider) 36px,
        var(--section-divider) 100%
    );
    pointer-events: none;
}

@media (min-width: 769px) and (min-height: 600px) {
    .hero {
        min-height: calc(92svh - var(--header-h));
        scroll-snap-align: start;
    }

    .stitch-section {
        min-height: calc(76svh - var(--header-h));
        scroll-snap-align: start;
    }

    /* Education has more vertical density */
    #education.stitch-section {
        min-height: calc(88svh - var(--header-h));
    }

    /* Shorter sections sit comfortably without excess blank space */
    #where-im-headed.stitch-section {
        min-height: 46svh;
    }

    #contact.stitch-section {
        min-height: 58svh;
    }
}

/* Left Column Heading & Subtle Editorial Metadata Kicker */
.col-heading {
    grid-column: 1 / 4;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.col-body {
    grid-column: 4 / 13;
}

.section-kicker {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-muted);
}

.section-heading {
    font-family: var(--font-serif);
    font-size: clamp(1.85rem, 3vw, 2.35rem);
    line-height: 1.1;
    color: var(--ink);
    letter-spacing: -0.01em;
}

.section-note {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: var(--ink-muted);
    line-height: 1.45;
    margin-top: var(--space-1);
    max-width: 20ch;
}

/* Inline Animated Text Underline Link */
.text-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    color: var(--ink);
    font-weight: 500;
    background-image: linear-gradient(var(--accent), var(--accent));
    background-repeat: no-repeat;
    background-position: 0 100%;
    background-size: 100% 1px;
    padding-bottom: 2px;
    transition: color 180ms var(--ease), background-size 200ms var(--ease);
}

.text-link:hover {
    color: var(--accent);
    background-size: 100% 2px;
}

/* --- 6. Header & Navigation --- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-h);
    background-color: var(--header-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--section-divider);
}

.header-inner {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

.wordmark {
    font-family: var(--font-serif);
    font-size: 1.45rem;
    line-height: 1;
    color: var(--ink);
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.site-nav {
    display: flex;
    align-items: center;
}

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

.nav-link {
    font-size: 0.875rem;
    color: var(--ink-secondary);
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    position: relative;
    transition: color 180ms var(--ease);
}

.nav-link:hover,
.nav-link[aria-current="location"] {
    color: var(--ink);
}

.nav-link[aria-current="location"]::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0.55rem;
    height: 1.5px;
    background-color: var(--accent);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.icon-btn {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--rule);
    border-radius: 4px;
    color: var(--ink);
    transition: border-color 180ms var(--ease), background-color 180ms var(--ease);
}

.icon-btn:hover {
    border-color: var(--ink);
    background-color: var(--bg-subtle);
}

.icon-sun { display: none; }
.icon-moon { display: block; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

.menu-toggle {
    display: none;
}

.icon-close { display: none; }
.menu-toggle[aria-expanded="true"] .icon-menu { display: none; }
.menu-toggle[aria-expanded="true"] .icon-close { display: block; }

/* --- Theme toggle: an anime character that mirrors the current mode ---
   Light: he works at his laptop (eyes follow your cursor, blinks, types, pushes up his glasses).
   Dark: he sleeps with his spectacles on the nightstand (wakes a little when you hover). */
.theme-toggle {
    position: relative;
    width: 96px;
    height: 52px;
    padding: 0;
    border-radius: 26px;
    overflow: hidden;
    --nx: 0;
    --ny: 0;
    transition: border-color 180ms var(--ease), background-color 180ms var(--ease), transform 160ms var(--ease);
}
.theme-toggle:hover { transform: translateY(-1px); }
.theme-toggle:active { transform: scale(0.95); }

.theme-scene {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 76px;
    height: 47.5px;
    overflow: visible;
    transition: opacity 320ms var(--ease), transform 380ms var(--ease);
}
.scene-work  { opacity: 1; transform: none; }
.scene-sleep { opacity: 0; transform: translateY(10px) scale(0.9); }
[data-theme="dark"] .scene-work  { opacity: 0; transform: translateY(-10px) scale(0.9); }
[data-theme="dark"] .scene-sleep { opacity: 1; transform: none; }

/* Only the visible scene animates */
[data-theme="dark"] .scene-work,
[data-theme="dark"] .scene-work *,
:root:not([data-theme="dark"]) .scene-sleep,
:root:not([data-theme="dark"]) .scene-sleep * { animation-play-state: paused !important; }

.theme-toggle.is-react .theme-scene { animation: sceneReact 620ms var(--ease); }
@keyframes sceneReact { 0% { transform: scale(0.86); } 45% { transform: scale(1.1); } 100% { transform: scale(1); } }

/* ---- working ---- */
.scene-work .pupil {
    transform: translate(calc(var(--nx, 0) * 1.3px), calc(var(--ny, 0) * 0.9px + 0.4px));
    transition: transform 120ms ease-out;
}
.scene-work .scene-head {
    transform-origin: 38px 29px;
    transform: rotate(calc(var(--nx, 0) * 2.4deg)) translate(calc(var(--nx, 0) * 0.5px), 0);
    transition: transform 240ms ease-out;
}
.scene-work .scene-eyes {
    transform-box: fill-box;
    transform-origin: 50% 50%;
    animation: sceneBlink 5.4s infinite;
}
.scene-work .scene-glasses { animation: sceneGlassesPush 9s ease-in-out infinite; }
.scene-work .mouth-a, .scene-work .mouth-b { transition: opacity 160ms; }
.scene-work .blush { transition: fill-opacity 200ms; }
.theme-toggle:hover .scene-work .mouth-a { opacity: 0; }
.theme-toggle:hover .scene-work .mouth-b { opacity: 1; }
.theme-toggle:hover .scene-work .blush { fill-opacity: 0.9; }
.theme-toggle:hover .scene-work .glare { animation: sceneGlare 900ms ease-out; }

.scene-work .hand-l { animation: sceneType 260ms ease-in-out infinite alternate; }
.scene-work .hand-r { animation: sceneType 310ms ease-in-out -120ms infinite alternate; }
.scene-work .scene-logo { animation: sceneLogo 2.4s ease-in-out infinite; }
.scene-work .st1 { animation: sceneSteam 2.4s ease-in-out infinite; }
.scene-work .st2 { animation: sceneSteam 2.4s ease-in-out -1.1s infinite; }
.scene-work .sp { transform-box: fill-box; transform-origin: center; animation: sceneTwinkle 2.6s ease-in-out infinite; }
.scene-work .sp2 { animation-delay: -1.2s; }
.theme-toggle:hover .scene-work .hand-l { animation-duration: 130ms; }
.theme-toggle:hover .scene-work .hand-r { animation-duration: 150ms; }

@keyframes sceneBlink { 0%, 91%, 100% { transform: scaleY(1); } 94.5% { transform: scaleY(0.08); } }
@keyframes sceneGlassesPush {
    0%, 88%, 100% { transform: translateY(0); }
    92% { transform: translateY(-0.9px); }
    95% { transform: translateY(0.2px); }
}
@keyframes sceneGlare { 0% { transform: translateX(-1px); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateX(5px); opacity: 0; } }
@keyframes sceneType  { from { transform: translateY(0); } to { transform: translateY(0.9px); } }
@keyframes sceneLogo  { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
@keyframes sceneSteam {
    0%   { opacity: 0; transform: translateY(2px); }
    40%  { opacity: 0.9; }
    100% { opacity: 0; transform: translateY(-4px); }
}
@keyframes sceneTwinkle { 0%, 100% { opacity: 0.35; transform: scale(0.6); } 50% { opacity: 1; transform: scale(1); } }

/* ---- sleeping ---- */
.scene-sleep .scene-blanket {
    transform-box: fill-box;
    transform-origin: 50% 100%;
    animation: sceneBreathe 3.4s ease-in-out infinite;
}
.scene-sleep .scene-z path { opacity: 0; animation: sceneZ 3s ease-in-out infinite; }
.scene-sleep .scene-z .z2 { animation-delay: 0.7s; }
.scene-sleep .scene-z .z3 { animation-delay: 1.4s; }
.scene-sleep .scene-star { animation: sceneStar 2.4s ease-in-out infinite; }
.scene-sleep .scene-star2 { animation-delay: -1.1s; }
.scene-sleep .glare { animation: sceneGlint 3.6s ease-in-out infinite; }
.scene-sleep .sleep-closed, .scene-sleep .sleep-peek { transition: opacity 160ms; }
.theme-toggle:hover .scene-sleep .sleep-closed { opacity: 0; }
.theme-toggle:hover .scene-sleep .sleep-peek { opacity: 1; }
.theme-toggle:hover .scene-sleep .scene-q { opacity: 1; animation: sceneQ 520ms var(--ease); }
.theme-toggle:hover .scene-sleep .scene-z path { animation-duration: 1.8s; }

@keyframes sceneBreathe { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.08); } }
@keyframes sceneStar    { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
@keyframes sceneGlint   { 0%, 70%, 100% { opacity: 0.1; } 82% { opacity: 1; } }
@keyframes sceneQ       { from { transform: translateY(4px) scale(0.6); } to { transform: none; } }
@keyframes sceneZ {
    0%   { opacity: 0; transform: translate(0, 3px); }
    30%  { opacity: 1; }
    100% { opacity: 0; transform: translate(4px, -5px); }
}

@media (max-width: 520px) {
    .theme-toggle { width: 80px; height: 46px; border-radius: 23px; }
    .theme-scene { width: 64px; height: 40px; }
}
@media (max-width: 360px) {
    .theme-toggle { width: 68px; height: 42px; border-radius: 21px; }
    .theme-scene { width: 54px; height: 34px; }
}

/* --- Music switch: a modern pocket radio ---
   Tap it to switch on (needle tunes in, speaker thumps, LED glows). Drag, scroll or arrow-key the knob for volume. */
.music-wrap { position: relative; display: flex; align-items: center; --amp: 0.45; }

.radio { position: relative; width: 88px; height: 52px; flex: none; }

.radio-btn {
    display: block;
    position: relative;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: none;
    color: var(--ink);
    cursor: pointer;
    transition: transform 160ms var(--ease);
    -webkit-tap-highlight-color: transparent;
}
.radio-btn:hover { transform: translateY(-1px); }
.radio-btn:active { transform: scale(0.97); }
.radio-svg { display: block; width: 100%; height: 100%; overflow: visible; }

.radio-body { transition: stroke 240ms var(--ease); }
.music-wrap.is-playing .radio-body { stroke: var(--accent); }

/* antenna */
.radio-antenna { transform-origin: 74px 9.5px; transform-box: view-box; transition: transform 420ms var(--ease); }
.radio-btn:hover .radio-antenna { transform: rotate(-9deg); }
.music-wrap.is-playing .radio-antenna { animation: antennaSway 3.4s ease-in-out infinite alternate; }
@keyframes antennaSway { from { transform: rotate(-4deg); } to { transform: rotate(5deg); } }

/* speaker: rings thump on the beat, harder when the volume is up */
.rd { transform-origin: 24px 28px; transform-box: view-box; }
.music-wrap.is-playing .rd1 { animation: rdBeat 780ms ease-out infinite; }
.music-wrap.is-playing .rd2 { animation: rdBeat 780ms ease-out 50ms infinite; }
.music-wrap.is-playing .rd3 { animation: rdBeat 780ms ease-out 100ms infinite; }
.music-wrap.is-playing .rd0 { animation: rdCone 780ms ease-out infinite; }
@keyframes rdBeat { 0%, 100% { transform: scale(1); } 14% { transform: scale(calc(1 + var(--amp, 0.45) * 0.17)); } }
@keyframes rdCone { 0%, 100% { transform: scale(1); } 14% { transform: scale(calc(1 + var(--amp, 0.45) * 0.6)); } }

/* LED */
.radio-led { transition: fill 200ms; }
.music-wrap.is-playing .radio-led { fill: var(--accent); }
.music-wrap.is-playing .radio-led-glow { animation: ledPulse 1.6s ease-in-out infinite; }
@keyframes ledPulse { 0%, 100% { opacity: 0.18; } 50% { opacity: 0.6; } }

/* display + tuning needle */
.radio-freq { font-family: var(--font-mono); letter-spacing: 0.04em; transition: fill 200ms; }
.music-wrap.is-playing .radio-freq { fill: var(--accent); }
.radio-needle-wrap { transition: transform 1100ms cubic-bezier(0.3, 1.5, 0.45, 1); }
.music-wrap.is-playing .radio-needle-wrap { transform: translateX(var(--tune, 16px)); }
.radio-needle { opacity: 0.5; transition: opacity 300ms; }
.music-wrap.is-playing .radio-needle { opacity: 1; animation: needleJitter 2.6s ease-in-out 1.2s infinite; }
@keyframes needleJitter { 0%, 100% { transform: translateX(0); } 30% { transform: translateX(0.5px); } 65% { transform: translateX(-0.4px); } }

/* volume knob (the invisible overlay handles drag / wheel / keys) */
.radio-knob {
    position: absolute;
    left: 63.6%;
    top: 51.9%;
    width: 22.7%;
    height: 38.5%;
    border-radius: 50%;
    cursor: grab;
    touch-action: none;
    z-index: 2;
    -webkit-tap-highlight-color: transparent;
}
.radio-knob:active { cursor: grabbing; }
.radio-knob:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.radio-knob-g { transform-box: fill-box; transform-origin: center; transition: transform 160ms var(--ease); }
.radio:has(.radio-knob:hover) .radio-knob-g,
.radio:has(.radio-knob:focus-visible) .radio-knob-g { transform: scale(1.1); }

/* feedback rings (click ripple, autoplay hint) */
.radio-ring { transform-origin: 44px 28px; transform-box: view-box; }
.music-wrap.is-hint .radio-ring { animation: musicHint 1800ms ease-out infinite; }
.music-wrap.is-pop .radio-ring { animation: musicRing 520ms ease-out forwards; }
@keyframes musicHint { 0% { transform: scale(1); opacity: 0.7; } 100% { transform: scale(1.12, 1.3); opacity: 0; } }
@keyframes musicRing { from { transform: scale(1); opacity: 0.85; } to { transform: scale(1.14, 1.35); opacity: 0; } }

/* Player panel (mouse/keyboard; hidden on touch screens where the device has its own volume) */
.music-pop {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 262px;
    display: flex;
    flex-direction: column;
    gap: 13px;
    padding: 15px 17px 14px;
    background-color: var(--bg);
    border: 1px solid var(--rule);
    border-radius: 12px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 180ms var(--ease), transform 180ms var(--ease), visibility 0s linear 180ms;
    z-index: 120;
}
.music-pop::before {            /* invisible bridge so the panel stays open while moving the mouse */
    content: "";
    position: absolute;
    left: 0; right: 0; top: -12px; height: 12px;
}
.music-wrap:hover .music-pop {
    opacity: 1; visibility: visible; transform: none; transition-delay: 0s;
}
.music-wrap:has(:focus-visible) .music-pop {
    opacity: 1; visibility: visible; transform: none; transition-delay: 0s;
}
@media (hover: none) { .music-pop { display: none; } }

.music-pop-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.music-pop-track { display: block; font-family: var(--font-serif); font-size: 1.4rem; line-height: 1.05; color: var(--ink); }
.music-pop-artist {
    display: block; margin-top: 3px;
    font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--ink-muted);
}
.music-pop-state {
    display: inline-flex; align-items: center; gap: 6px; flex: none; margin-top: 4px;
    font-family: var(--font-mono); font-size: 0.64rem; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--ink-muted);
}
.music-pop-state::before {
    content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-muted);
}
.music-wrap.is-playing .music-pop .music-pop-state { color: var(--accent); }
.music-wrap.is-playing .music-pop .music-pop-state::before {
    background: var(--accent); animation: musicBlink 1.4s ease-in-out infinite;
}
@keyframes musicBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.music-row { display: flex; align-items: center; gap: 11px; }
.music-row-label,
.music-time {
    font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--ink-muted); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.music-row-label { width: 3.4ch; }
.music-time { min-width: 9.6ch; text-align: right; }
.music-pop-val { min-width: 4ch; text-align: right; color: var(--ink); }

.music-range {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    min-width: 0;
    height: 20px;
    background: transparent;
    cursor: pointer;
    --v: 0%;
}
.music-range::-webkit-slider-runnable-track {
    height: 4px; border-radius: 2px;
    background: linear-gradient(90deg, var(--accent) var(--v), var(--rule) var(--v));
}
.music-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px; height: 16px; margin-top: -6px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg);
    box-shadow: 0 0 0 1px var(--accent);
    transition: transform 140ms var(--ease);
}
.music-range:hover::-webkit-slider-thumb,
.music-range:active::-webkit-slider-thumb { transform: scale(1.2); }
.music-range::-moz-range-track { height: 4px; border-radius: 2px; background: var(--rule); }
.music-range::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
.music-range::-moz-range-thumb {
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--accent); border: 2px solid var(--bg);
}

@media (max-width: 520px) {
    .radio { width: 70px; height: 41.4px; }
}
@media (max-width: 360px) {
    .radio { width: 60px; height: 35.5px; }
}

/* --- 7. Hero Section (Warp-and-Weft + Two Subtle Yarn Threads) --- */
.hero {
    position: relative;
    overflow: hidden;
    padding: clamp(3rem, 7.5vh, 5rem) 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    scroll-margin-top: var(--header-h);
    background-image:
        repeating-linear-gradient(0deg, var(--warp-line) 0, var(--warp-line) 1px, transparent 1px, transparent 20px),
        repeating-linear-gradient(90deg, var(--warp-line) 0, var(--warp-line) 1px, transparent 1px, transparent 20px);
    background-size: 20px 20px;
}

.hero-yarn-backdrop {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.hero-yarn-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.yarn-strand-terracotta {
    stroke: var(--accent);
    opacity: 0.25;
    animation: yarnDriftSlow 44s ease-in-out infinite alternate;
}

.yarn-strand-taupe {
    stroke: var(--yarn-taupe);
    opacity: 0.22;
    animation: yarnDriftSlow 50s ease-in-out infinite alternate-reverse;
}

[data-theme="dark"] .yarn-strand-terracotta {
    opacity: 0.2;
}

[data-theme="dark"] .yarn-strand-taupe {
    opacity: 0.18;
}

@keyframes yarnDriftSlow {
    0% { transform: translateY(-3px); }
    100% { transform: translateY(3px); }
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 48rem;
}

.hero-status {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--ink-muted);
    letter-spacing: 0.02em;
    margin-bottom: var(--space-3);
}

.hero-name {
    font-family: var(--font-serif);
    font-size: clamp(3.75rem, 9vw, 6.75rem);
    line-height: 0.96;
    letter-spacing: -0.02em;
    color: var(--ink);
    margin-bottom: var(--space-4);
}

.hero-lead {
    font-size: clamp(1.125rem, 1.75vw, 1.35rem);
    line-height: 1.55;
    color: var(--ink-secondary);
    max-width: 56ch;
    margin-bottom: var(--space-6);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3) var(--space-4);
}

.btn-primary {
    min-height: 44px;
    padding: 0 var(--space-5);
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 4px;
    background-color: var(--ink);
    color: var(--bg);
    border: 1px solid var(--ink);
    transition: background-color 180ms var(--ease), border-color 180ms var(--ease), color 180ms var(--ease);
}

.btn-primary:hover {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #FAF8F5;
}

.hero-text-link {
    min-height: 44px;
    padding: 0 var(--space-2);
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: 0.9rem;
    color: var(--ink-secondary);
    transition: color 180ms var(--ease);
}

.hero-text-link:hover {
    color: var(--ink);
}

/* --- 8. About Section (Two Paragraphs + Subtle Metadata Strip) --- */
.about-stack {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.about-text {
    font-size: clamp(1.04rem, 1.28vw, 1.15rem);
    line-height: 1.68;
    color: var(--ink-secondary);
    max-width: 63ch;
}

.about-meta-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-4);
    margin-top: var(--space-2);
    padding-top: var(--space-4);
    border-top: 1px solid var(--rule);
}

.meta-cell-label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-muted);
    margin-bottom: 2px;
}

.meta-cell-val {
    font-size: 0.9rem;
    color: var(--ink);
    font-weight: 500;
}

/* --- 9. Education Section (Degree, Selected Coursework, School & Academic Distinction) --- */
.edu-list {
    display: flex;
    flex-direction: column;
}

.edu-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--space-4);
    padding: var(--space-5) 0;
    border-bottom: 1px solid var(--rule);
    align-items: baseline;
}

.edu-row:first-child {
    padding-top: 0;
}

.edu-row:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.edu-institution {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    line-height: 1.2;
    color: var(--ink);
    margin-bottom: 2px;
}

.edu-degree {
    font-size: 0.96rem;
    color: var(--ink-secondary);
}

.edu-scores {
    margin-top: var(--space-1);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--ink-muted);
}

.edu-scores strong {
    color: var(--ink);
    font-weight: 500;
}

.edu-meta {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--ink-muted);
    text-align: right;
    white-space: nowrap;
}

/* Compact Selected Coursework & Academic Focus Header */
.edu-subsection {
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px dashed var(--rule);
}

.edu-sublabel-bar {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.edu-sublabel {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-muted);
}

.edu-sublabel-tag {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--accent);
    letter-spacing: 0.04em;
}

.coursework-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--space-6);
    row-gap: var(--space-1);
}

.coursework-list li {
    font-size: 0.885rem;
    line-height: 1.5;
    color: var(--ink-secondary);
    position: relative;
    padding-left: var(--space-3);
}

.coursework-list li::before {
    content: "·";
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: 600;
}

/* Compact Editorial Achievement Highlight (Academic Distinction) */
.edu-row.edu-distinction {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: var(--space-6);
    padding-top: var(--space-5);
    padding-bottom: 0;
    border-bottom: none;
}

.edu-row.edu-distinction::before {
    content: "";
    position: absolute;
    top: -1px;
    left: 0;
    width: 3rem;
    height: 2px;
    background-color: var(--accent);
}

.distinction-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.distinction-kicker {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 2px;
}

.distinction-title-group {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-1) var(--space-3);
}

.distinction-title-group .edu-institution {
    margin-bottom: 0;
}

.distinction-qualifier {
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--ink-secondary);
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.distinction-qualifier::before {
    content: "·";
    color: var(--accent);
    font-weight: 600;
}

.distinction-cert {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--ink-muted);
    margin-top: 2px;
}

.distinction-rank {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    padding-left: var(--space-6);
    border-left: 1px dashed var(--rule);
}

.distinction-rank-primary {
    font-family: var(--font-serif);
    font-size: clamp(1.85rem, 2.5vw, 2.25rem);
    line-height: 1;
    color: var(--ink);
    letter-spacing: -0.01em;
}

.distinction-rank-primary mark.hl {
    font-weight: 400;
    padding: 0 0.1em;
}

.distinction-rank-sub {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: var(--ink-muted);
    margin-top: var(--space-1);
    white-space: nowrap;
}

/* --- 10. Experience Section (With 4-Item Metadata Fact Rail) --- */
.exp-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-4);
    margin-bottom: var(--space-3);
}

.exp-role {
    font-family: var(--font-serif);
    font-size: 1.65rem;
    line-height: 1.15;
    color: var(--ink);
}

.exp-company {
    font-size: 1rem;
    font-weight: 500;
    color: var(--ink-secondary);
    margin-top: 2px;
}

.exp-meta {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--ink-muted);
    text-align: right;
}

.exp-fact-rail {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-3);
    padding: var(--space-3) 0;
    margin-bottom: var(--space-4);
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
}

.exp-fact-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-right: var(--space-2);
    border-right: 1px dashed var(--rule);
}

.exp-fact-item:last-child {
    border-right: none;
    padding-right: 0;
}

.exp-fact-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-muted);
}

.exp-fact-val {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--ink);
}

.exp-bullets {
    display: grid;
    gap: var(--space-3);
    padding-left: var(--space-4);
}

.exp-bullets li {
    position: relative;
    color: var(--ink-secondary);
    font-size: 0.985rem;
    max-width: 64ch;
}

.exp-bullets li::before {
    content: "";
    position: absolute;
    left: calc(-1 * var(--space-4));
    top: 0.68em;
    width: 5px;
    height: 1.5px;
    background-color: var(--accent);
}

/* --- 11. Beyond Class Section (Two Columns + Small Editorial Topic Labels) --- */
.beyond-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-8);
}

.beyond-col {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.sub-heading {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    line-height: 1.2;
    color: var(--ink);
}

.beyond-col p {
    font-size: 0.96rem;
    color: var(--ink-secondary);
}

.topic-label-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-2);
    margin: var(--space-1) 0;
}

.topic-label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--ink-secondary);
    background-color: var(--bg-subtle);
    border: 1px solid var(--rule);
    padding: 0.15rem 0.5rem;
    border-radius: 2px;
    letter-spacing: 0.02em;
}

.beyond-points {
    display: grid;
    gap: var(--space-2);
    margin-top: var(--space-1);
    border-top: 1px solid var(--rule);
    padding-top: var(--space-3);
}

.beyond-points li {
    font-size: 0.935rem;
    color: var(--ink-secondary);
    padding-left: var(--space-4);
    position: relative;
}

.beyond-points li::before {
    content: "·";
    position: absolute;
    left: 0.25rem;
    color: var(--accent);
    font-weight: 600;
}

/* --- 12. Skills Section (Three Categories + Descriptive Subtitles) --- */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-8);
}

.skill-group-header {
    padding-bottom: var(--space-3);
    margin-bottom: var(--space-3);
    border-bottom: 1px solid var(--rule);
}

.skill-group-title {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink);
    margin-bottom: var(--space-1);
}

.skill-group-sub {
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--ink-muted);
}

.skill-items {
    display: grid;
    gap: var(--space-2);
}

.skill-items li {
    font-size: 0.95rem;
    color: var(--ink-secondary);
    position: relative;
    padding-left: var(--space-3);
}

.skill-items li::before {
    content: "·";
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: 600;
}

/* --- 13. Where I'm Headed (Pullquote + Three Focus Labels) --- */
.direction-pullquote {
    border-left: 2px solid var(--accent);
    padding: var(--space-1) 0 var(--space-1) var(--space-5);
}

.direction-quote {
    font-family: var(--font-serif);
    font-size: clamp(1.45rem, 2.4vw, 1.95rem);
    line-height: 1.32;
    color: var(--ink);
    max-width: 52ch;
}

.direction-focus-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-5);
    margin-top: var(--space-4);
    padding-left: var(--space-5);
}

.direction-focus-label {
    font-family: var(--font-mono);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.direction-focus-label::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: var(--accent);
}

/* --- 14. Contact & Minimal Footer --- */
.contact-intro {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--ink-muted);
    letter-spacing: 0.01em;
    margin-bottom: var(--space-4);
}

.email-action-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
}

.email-primary-link {
    font-family: var(--font-serif);
    font-size: clamp(1.75rem, 3.5vw, 2.6rem);
    line-height: 1.1;
    color: var(--ink);
    border-bottom: 1px solid var(--rule);
    padding-bottom: 2px;
    transition: color 180ms var(--ease), border-color 180ms var(--ease);
    word-break: break-all;
}

.email-primary-link:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.copy-btn {
    min-height: 44px;
    padding: 0 var(--space-3);
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--ink-secondary);
    border: 1px solid var(--rule);
    border-radius: 4px;
    background-color: var(--bg-subtle);
    transition: border-color 180ms var(--ease), color 180ms var(--ease);
}

.copy-btn:hover {
    border-color: var(--ink);
    color: var(--ink);
}

.copy-status {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--accent);
}

.contact-meta-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-6);
    padding-top: var(--space-5);
    border-top: 1px solid var(--rule);
}

.contact-item-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: var(--space-1);
}

.contact-item-val {
    font-size: 0.95rem;
    color: var(--ink);
}

.site-footer {
    position: relative;
    padding: var(--space-5) 0;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--ink-muted);
}

.site-footer::before {
    content: "";
    position: absolute;
    top: 0;
    left: max(var(--gutter), calc((100% - var(--container)) / 2 + var(--gutter)));
    right: max(var(--gutter), calc((100% - var(--container)) / 2 + var(--gutter)));
    height: 1px;
    background-color: var(--section-divider);
    pointer-events: none;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-3);
}

/* --- 15. Responsive Breakpoints --- */
@media (max-width: 1024px) {
    .col-heading,
    .col-body {
        grid-column: 1 / -1;
    }

    .section-note {
        max-width: none;
    }

    .grid-12 {
        row-gap: var(--space-4);
    }
}

@media (max-width: 768px) {
    html {
        scroll-snap-type: none;
    }

    .menu-toggle {
        display: inline-flex;
    }

    .site-nav {
        position: fixed;
        top: var(--header-h);
        left: 0;
        right: 0;
        background-color: var(--bg);
        border-bottom: 1px solid var(--rule);
        padding: var(--space-4) var(--gutter) var(--space-6);
        display: none;
        box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
    }

    .site-nav.is-open {
        display: block;
    }

    .nav-list {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    .nav-link {
        width: 100%;
        border-bottom: 1px dashed var(--rule);
        font-size: 0.95rem;
    }

    .nav-link[aria-current="location"]::after {
        display: none;
    }

    .hero {
        min-height: calc(88svh - var(--header-h));
        padding: var(--space-8) 0;
    }

    .stitch-section,
    #education.stitch-section,
    #where-im-headed.stitch-section,
    #contact.stitch-section {
        min-height: auto;
        padding: clamp(2.5rem, 6vw, 3.5rem) 0;
    }

    .hero-name {
        font-size: clamp(3rem, 13vw, 4.5rem);
        margin-bottom: var(--space-3);
    }

    .hero-lead {
        font-size: 1.05rem;
        margin-bottom: var(--space-5);
    }

    .about-meta-strip {
        grid-template-columns: 1fr;
        gap: var(--space-3);
    }

    .edu-row {
        grid-template-columns: 1fr;
        gap: var(--space-1);
        padding: var(--space-4) 0;
    }

    .edu-row.edu-distinction {
        grid-template-columns: 1fr;
        gap: var(--space-3);
        padding-top: var(--space-4);
    }

    .distinction-qualifier::before {
        display: none;
    }

    .distinction-title-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .distinction-rank {
        align-items: flex-start;
        text-align: left;
        padding-left: var(--space-3);
        border-left: 2px solid var(--accent);
    }

    .edu-meta,
    .exp-meta {
        text-align: left;
    }

    .exp-fact-rail {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--space-3);
    }

    .exp-fact-item:nth-child(2) {
        border-right: none;
    }

    .coursework-list,
    .beyond-grid,
    .skills-grid,
    .contact-meta-grid {
        grid-template-columns: 1fr;
        gap: var(--space-5);
    }

    .coursework-list {
        gap: var(--space-1);
    }

    .direction-focus-row {
        padding-left: 0;
    }
}

/* --- 16. Reduced Motion Preference --- */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
        scroll-snap-type: none;
    }
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        transition-delay: 0ms !important;
    }
    .yarn-strand-terracotta,
    .yarn-strand-taupe {
        animation: none;
    }
    .js .hero .hero-status,
    .js .hero .hero-name,
    .js .hero .hero-lead,
    .js .hero .hero-actions,
    .js .fade-section .col-heading,
    .js .fade-section .col-body,
    .js .fade-section .stagger-item {
        opacity: 1 !important;
        transform: none !important;
    }
    .js mark.hl {
        background-size: 100% 100% !important;
    }
}

/* --- 17. Print Stylesheet (One-Page A4 Clean Resume) --- */
.print-only-header {
    display: none;
}

@media print {
    @page {
        size: A4 portrait;
        margin: 10mm 12mm;
    }

    html, body {
        background: #FFFFFF;
        color: #000000;
        font-size: 9pt;
        line-height: 1.35;
        scroll-snap-type: none;
    }

    .skip-link,
    .site-header,
    .hero,
    .section-kicker,
    .section-note,
    .about-meta-strip,
    .copy-btn,
    .copy-status,
    .contact-section,
    .site-footer {
        display: none;
    }

    .print-only-header {
        display: block;
        border-bottom: 1pt solid #000000;
        padding-bottom: 4pt;
        margin-bottom: 6pt;
    }

    .print-name {
        font-family: var(--font-serif);
        font-size: 19pt;
        line-height: 1;
        margin-bottom: 3pt;
    }

    .print-contact-line {
        font-family: var(--font-mono);
        font-size: 7.8pt;
        color: #222222;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }

    .js .fade-section .col-heading,
    .js .fade-section .col-body,
    .js .fade-section .stagger-item {
        opacity: 1;
        transform: none;
    }

    mark.hl,
    .js mark.hl {
        background: none;
        font-weight: 600;
        padding: 0;
        margin: 0;
    }

    .stitch-section::before,
    .site-footer::before {
        display: none;
    }

    .stitch-section,
    #education.stitch-section,
    #where-im-headed.stitch-section {
        min-height: auto;
        padding: 4.5pt 0;
        border-top: 0.5pt solid #CCCCCC;
        page-break-inside: avoid;
        break-inside: avoid;
        display: block;
    }

    #about.stitch-section {
        border-top: none;
        padding-top: 0;
    }

    .grid-12 {
        display: block;
    }

    .section-heading {
        font-family: var(--font-sans);
        font-size: 9pt;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        margin-bottom: 2.5pt;
    }

    .about-stack {
        gap: 3pt;
    }

    .about-text {
        font-size: 8.4pt;
        max-width: 100%;
        color: #111111;
    }

    .edu-row {
        padding: 2pt 0;
        border-bottom: none;
    }

    .edu-institution {
        font-family: var(--font-sans);
        font-size: 9pt;
        font-weight: 600;
    }

    .edu-degree,
    .edu-scores,
    .edu-meta {
        font-size: 8pt;
        color: #111111;
    }

    .edu-subsection {
        margin-top: 2pt;
        padding-top: 2pt;
        border-top: none;
    }

    .edu-sublabel-bar {
        margin-bottom: 1pt;
    }

    .edu-sublabel,
    .edu-sublabel-tag {
        font-size: 7.4pt;
        color: #333333;
    }

    .coursework-list {
        grid-template-columns: repeat(3, 1fr);
        column-gap: 8pt;
        row-gap: 0.5pt;
    }

    .coursework-list li {
        font-size: 7.8pt;
        color: #111111;
    }

    .edu-row.edu-distinction {
        padding-top: 3pt;
        gap: 8pt;
    }

    .edu-row.edu-distinction::before {
        display: none;
    }

    .distinction-kicker {
        font-size: 7pt;
        color: #333333;
        margin-bottom: 0;
    }

    .distinction-qualifier {
        font-size: 8pt;
        color: #111111;
    }

    .distinction-cert {
        font-size: 7.5pt;
        color: #333333;
    }

    .distinction-rank {
        border-left: none;
        padding-left: 0;
    }

    .distinction-rank-primary {
        font-family: var(--font-sans);
        font-size: 9pt;
        font-weight: 600;
    }

    .distinction-rank-sub {
        font-size: 7.5pt;
        color: #222222;
        margin-top: 0;
    }

    .exp-header {
        margin-bottom: 2pt;
    }

    .exp-role {
        font-family: var(--font-sans);
        font-size: 9pt;
        font-weight: 600;
    }

    .exp-company,
    .exp-meta {
        font-size: 8pt;
        color: #111111;
    }

    .exp-fact-rail {
        padding: 2pt 0;
        margin-bottom: 3pt;
        gap: 6pt;
    }

    .exp-fact-label {
        font-size: 6.8pt;
    }

    .exp-fact-val {
        font-size: 7.8pt;
    }

    .exp-bullets {
        gap: 1.5pt;
    }

    .exp-bullets li {
        font-size: 8.2pt;
        color: #111111;
        max-width: 100%;
    }

    .beyond-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12pt;
    }

    .sub-heading {
        font-family: var(--font-sans);
        font-size: 8.8pt;
        font-weight: 600;
    }

    .topic-label-row {
        gap: 3pt;
        margin: 1pt 0;
    }

    .topic-label {
        font-size: 7pt;
        padding: 0 3pt;
        background: none;
        border: 0.5pt solid #BBBBBB;
    }

    .beyond-col p,
    .beyond-points li {
        font-size: 8pt;
        color: #111111;
    }

    .beyond-points {
        padding-top: 2pt;
        margin-top: 1pt;
        gap: 1pt;
    }

    .skills-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10pt;
    }

    .skill-group-header {
        margin-bottom: 2pt;
        padding-bottom: 1.5pt;
    }

    .skill-group-title {
        font-size: 7.8pt;
        color: #111111;
        margin-bottom: 0;
    }

    .skill-group-sub {
        font-size: 7.2pt;
        color: #444444;
    }

    .skill-items {
        gap: 1pt;
    }

    .skill-items li {
        font-size: 8pt;
        color: #111111;
    }

    .direction-pullquote {
        border-left: 1.5pt solid #000000;
        padding: 1pt 0 1pt 6pt;
    }

    .direction-quote {
        font-family: var(--font-sans);
        font-size: 8.25pt;
        max-width: 100%;
    }

    .direction-focus-row {
        margin-top: 2pt;
        padding-left: 6pt;
        gap: 8pt;
    }

    .direction-focus-label {
        font-size: 7pt;
        color: #222222;
    }
}

/* ==========================================================================
   20. Loader: AG monogram + India -> USA trade route
   ========================================================================== */
#ag-loader { display: none; }

html.is-loading { overflow: hidden; }

.js #ag-loader {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(1rem, 3.2vh, 1.9rem);
    padding: 1.5rem;
    background-color: var(--bg);
    color: var(--ink);
    transition: opacity 650ms var(--ease), visibility 0s linear 650ms;
}

.js #ag-loader.is-done {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Logo: a trade-stamp seal. Rings draw in, the ring text slowly turns like a compass bezel,
   the AG monogram is drawn as one thread, then the whole seal "presses" once. */
.ag-logo {
    width: clamp(96px, 15vw, 128px);
    height: auto;
    display: block;
    overflow: visible;
    animation: agPress 560ms var(--ease) 2250ms;
}

.ag-logo .ag-ring-o,
.ag-logo .ag-ring-i {
    fill: none;
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: agDraw 950ms var(--ease) forwards;
}
.ag-logo .ag-ring-o { stroke: var(--ink); stroke-width: 2.2; animation-delay: 100ms; }
.ag-logo .ag-ring-i { stroke: var(--ink-muted); stroke-width: 0.8; animation-delay: 300ms; }

.ag-logo .ag-spin {
    transform-box: view-box;
    transform-origin: 60px 60px;
    animation: agSpin 30s linear infinite;
}
.ag-logo .ag-ring-text {
    font-family: var(--font-mono);
    font-size: 7.1px;
    font-weight: 500;
    fill: var(--ink-secondary);
    opacity: 0;
    animation: agFadeIn 700ms ease 650ms forwards;
}

.ag-logo .ag-stroke {
    fill: none;
    stroke: var(--ink);
    stroke-width: 3.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: agDraw 800ms var(--ease) forwards;
}
.ag-logo .ag-a  { animation-delay: 750ms; }
.ag-logo .ag-a2 { animation-delay: 1250ms; animation-duration: 350ms; }
.ag-logo .ag-g  { animation-delay: 1100ms; animation-duration: 950ms; }
.ag-logo .ag-g2 { animation-delay: 1900ms; animation-duration: 300ms; }

.ag-logo .ag-thread {
    fill: none;
    stroke: var(--accent);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-dasharray: 3.6 3;
    opacity: 0;
    animation: agFadeIn 500ms ease 2000ms forwards;
}

@keyframes agDraw  { to { stroke-dashoffset: 0; } }
@keyframes agSpin  { to { transform: rotate(360deg); } }
@keyframes agPress { 0% { transform: scale(1); } 40% { transform: scale(1.06); } 100% { transform: scale(1); } }

.ag-map-wrap { width: min(500px, 86vw); }

.ag-map-stack {
    position: relative;
    width: 100%;
    aspect-ratio: 334 / 118;
    opacity: 0;
    animation: agFadeIn 700ms var(--ease) 700ms forwards;
}

.ag-map {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* The dotted land never changes, so it gets its own layer and is rasterised once.
   Only the tiny live overlay (route, ship, pulses) repaints while loading. */
.ag-map-base {
    will-change: transform;
    transform: translateZ(0);
}

@keyframes agFadeIn { to { opacity: 1; } }

.ag-land    { fill: url(#ag-dots); }
.ag-land-hi { fill: url(#ag-dots-hi); }
.ag-dot     { fill: var(--yarn-taupe); opacity: 0.6; }
.ag-dot-hi  { fill: var(--accent); }

.ag-route-halo {
    fill: none;
    stroke: var(--bg);
    stroke-width: 3.2;
    stroke-linecap: round;
    opacity: 0.85;
}
.ag-route {
    fill: none;
    stroke: var(--accent);
    stroke-width: 0.9;
    stroke-linecap: round;
    stroke-dasharray: 1.4 2.4;
    opacity: 0.85;
}
@keyframes agMarch { to { stroke-dashoffset: -4; } }

.ag-node     { fill: var(--accent); }
.ag-node-in  { fill: var(--bg); }
.ag-pulse    { fill: none; stroke: var(--accent); stroke-width: 0.9; }
.ag-ship-hull { fill: var(--ink); }
.ag-c1 { fill: var(--accent); }
.ag-c2 { fill: var(--ink-secondary); }
.ag-c3 { fill: var(--yarn-taupe); }
.ag-crate { fill: var(--accent); stroke: var(--bg); stroke-width: 0.5; }

.ag-label-origin { font-weight: 600; fill: var(--ink); }

.ag-label {
    font-family: var(--font-mono);
    font-size: 4.5px;
    letter-spacing: 0.06em;
    fill: var(--ink-secondary);
    paint-order: stroke;
    stroke: var(--bg);
    stroke-width: 2px;
    stroke-linejoin: round;
}

.ag-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.85rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-muted);
}
.ag-pct { color: var(--ink); font-variant-numeric: tabular-nums; }

.ag-bar {
    height: 2px;
    margin-top: 0.55rem;
    background: var(--rule);
    overflow: hidden;
}
.ag-bar-fill {
    height: 100%;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: 0 50%;
    will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
    .ag-logo .ag-ring-o, .ag-logo .ag-ring-i, .ag-logo .ag-stroke { stroke-dashoffset: 0; animation: none; }
    .ag-logo .ag-ring-text, .ag-logo .ag-thread { opacity: 1; animation: none; }
    .ag-logo .ag-spin, .ag-logo { animation: none; }
    .ag-route { animation: none; }
    .ag-map-stack { opacity: 1; animation: none; }
}

@media print {
    #ag-loader { display: none !important; }
}

/* ==========================================================================
   21. Resume utilities: reading thread, back to top, PDF / contact actions
   ========================================================================== */
html {
    scrollbar-width: thin;
    scrollbar-color: var(--yarn-taupe) transparent;
}

/* A single terracotta thread along the header's lower edge that fills as you read */
.read-progress {
    position: fixed;
    left: 0;
    right: 0;
    top: calc(var(--header-h) - 2px);
    height: 2px;
    background-color: var(--accent);
    transform: scaleX(0);
    transform-origin: 0 50%;
    will-change: transform;
    pointer-events: none;
    z-index: 101;
}

button.hero-text-link {
    background: none;
    border: 0;
    cursor: pointer;
    font-family: inherit;
}

.distinction-rank-pct {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: var(--ink-secondary);
    margin-top: 2px;
    white-space: nowrap;
}

.contact-item-sub {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--ink-muted);
    margin-top: var(--space-1);
}

.to-top {
    position: fixed;
    right: var(--gutter);
    bottom: calc(var(--space-6) + env(safe-area-inset-bottom, 0px));
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-secondary);
    background-color: var(--bg);
    border: 1px solid var(--rule);
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 220ms var(--ease), transform 220ms var(--ease),
                visibility 0s linear 220ms, border-color 180ms var(--ease), color 180ms var(--ease);
    z-index: 90;
}
.to-top.is-shown {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition-delay: 0s;
}
.to-top:hover { color: var(--ink); border-color: var(--accent); }

@media print {
    .read-progress,
    .to-top,
    .distinction-rank-pct,
    .contact-item-sub { display: none !important; }
}


/* --- 22. Skills evidence, linked highlights, printed headline --- */
.skill-group-evidence {
    margin-top: var(--space-4);
    padding-top: var(--space-3);
    border-top: 1px dashed var(--rule);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    line-height: 1.6;
    color: var(--ink-muted);
}

.meta-link {
    color: inherit;
    background-image: linear-gradient(var(--accent), var(--accent));
    background-repeat: no-repeat;
    background-position: 0 100%;
    background-size: 0 1px;
    padding-bottom: 2px;
    transition: background-size 220ms var(--ease);
}
.meta-link:hover,
.meta-link:focus-visible { background-size: 100% 1px; }

@media print {
    .skill-group-evidence { display: none !important; }
    .print-headline {
        font-family: var(--font-sans);
        font-size: 8.8pt;
        font-weight: 600;
        color: #111111;
        margin-bottom: 2pt;
    }
}

/* ==========================================================================
   23. Hero route map, business mindset, market facts
   ========================================================================== */
/* ---- hero map: Panipat to its buyers ---- */
.hero .container { position: relative; }
.hero-map {
    position: absolute;
    top: -1.25rem;
    right: var(--gutter);
    width: min(520px, 43vw);
    aspect-ratio: 334 / 118;
    z-index: 0;
    pointer-events: none;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 22%), linear-gradient(180deg, transparent 0, #000 20%), linear-gradient(0deg, transparent 0, #000 16%);
    -webkit-mask-composite: source-in;
    mask-image: linear-gradient(90deg, transparent 0, #000 22%), linear-gradient(180deg, transparent 0, #000 20%), linear-gradient(0deg, transparent 0, #000 16%);
    mask-composite: intersect;
}
.hero-map svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: hidden; }
.hero-map-base { will-change: transform; transform: translateZ(0); }
.hm-dot-land { fill: var(--yarn-taupe); opacity: 0.5; }
.hm-dot-hi   { fill: var(--accent); }
.hm-land  { fill: url(#hm-dots); }
.hm-dest  { fill: url(#hm-dots-hi); opacity: 0.55; }
.hm-india { fill: url(#hm-dots-hi); }
.hm-route {
    fill: none;
    stroke: var(--accent);
    stroke-width: 0.8;
    stroke-linecap: round;
    stroke-dasharray: 1.4 2.4;
    opacity: 0;
}
.hm-node { fill: var(--bg); stroke: var(--accent); stroke-width: 0.9; opacity: 0; }
.hm-dot  { fill: var(--accent); }
.hm-origin { fill: var(--accent); }
.hm-origin-ring { fill: none; stroke: var(--accent); stroke-width: 0.8; opacity: 0.5; }
.hm-label {
    font-family: var(--font-mono);
    font-size: 4.2px;
    letter-spacing: 0.08em;
    font-weight: 500;
    fill: var(--ink-secondary);
    paint-order: stroke;
    stroke: var(--bg);
    stroke-width: 1.8px;
    stroke-linejoin: round;
}
.hero.is-visible .hm-route { animation: hmIn 900ms var(--ease) forwards; animation-delay: calc(500ms + var(--i, 0) * 140ms); }
.hero.is-visible .hm-node  { animation: hmIn 600ms var(--ease) forwards; animation-delay: calc(1100ms + var(--i, 0) * 140ms); }
@keyframes hmIn { to { opacity: 1; } }
@media (max-width: 1100px) {
    .hero-map {
        position: relative;
        top: auto;
        right: auto;
        width: 100%;
        max-width: 560px;
        margin: var(--space-8) auto 0;
        -webkit-mask-image: none;
        mask-image: none;
    }
}
@media (prefers-reduced-motion: reduce) { .hm-dot { display: none; } }

/* ---- experience takeaway ---- */
.exp-takeaway {
    margin-top: var(--space-6);
    padding-left: var(--space-4);
    border-left: 2px solid var(--accent);
    font-family: var(--font-serif);
    font-size: 1.2rem;
    line-height: 1.4;
    color: var(--ink);
    max-width: 56ch;
}
.exp-takeaway-label {
    display: block;
    margin-bottom: var(--space-1);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent);
}

/* ---- business mindset ---- */
.mindset-intro {
    max-width: 56ch;
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--ink-secondary);
}
.mindset-grid {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-5);
    margin-top: var(--space-6);
}
.mindset-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-6);
    background-color: var(--bg-subtle);
    border: 1px solid var(--rule);
    border-radius: 4px;
}
.mindset-card:hover { border-color: var(--accent); }
.mindset-icon { width: 28px; height: 28px; color: var(--accent); flex: none; }
.mindset-title {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    line-height: 1.15;
    color: var(--ink);
    font-weight: 400;
}
.mindset-text { font-size: 0.95rem; line-height: 1.62; color: var(--ink-secondary); }
.mindset-from {
    margin-top: auto;
    padding-top: var(--space-3);
    border-top: 1px dashed var(--section-divider);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    line-height: 1.55;
    letter-spacing: 0.02em;
    color: var(--ink-muted);
}
.mindset-link {
    color: var(--ink-secondary);
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-underline-offset: 3px;
}
.mindset-link:hover { color: var(--ink); }

/* ---- market facts + next steps ---- */
.market-block { margin-top: var(--space-12); }
.market-stats {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-6);
    margin-top: var(--space-5);
}
.market-stats li { padding-top: var(--space-4); border-top: 1px solid var(--section-divider); }
.market-fig {
    display: block;
    font-family: var(--font-serif);
    font-size: clamp(2.1rem, 3.4vw, 2.7rem);
    line-height: 1;
    letter-spacing: -0.01em;
    color: var(--ink);
}
.market-sym { color: var(--accent); }
.market-label {
    display: block;
    margin-top: var(--space-2);
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--ink-secondary);
}
.market-read {
    margin-top: var(--space-6);
    max-width: 62ch;
    color: var(--ink-secondary);
    line-height: 1.65;
}
.market-sources {
    margin-top: var(--space-4);
    max-width: 72ch;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    line-height: 1.8;
    color: var(--ink-muted);
}
.market-sources a {
    color: var(--ink-secondary);
    text-decoration: underline;
    text-decoration-color: var(--section-divider);
    text-underline-offset: 2px;
}
.market-sources a:hover { color: var(--ink); text-decoration-color: var(--accent); }

.next-learn { margin-top: var(--space-10); }
.next-list {
    list-style: none;
    display: grid;
    gap: var(--space-3);
    margin-top: var(--space-4);
    max-width: 62ch;
}
.next-list li {
    position: relative;
    padding-left: var(--space-5);
    color: var(--ink-secondary);
    line-height: 1.55;
}
.next-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.78em;
    width: 10px;
    height: 1px;
    background-color: var(--accent);
}

/* ---- contact intro: a proper lead line, not a caption ---- */
.contact-intro {
    font-family: var(--font-sans);
    font-size: 1.05rem;
    line-height: 1.6;
    letter-spacing: 0;
    color: var(--ink-secondary);
    max-width: 46ch;
    margin-bottom: var(--space-3);
}
.contact-focus { padding-left: 0; margin-top: 0; margin-bottom: var(--space-6); }

@media (max-width: 860px) {
    .market-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
    .mindset-grid { grid-template-columns: 1fr; }
    .mindset-card { padding: var(--space-5); }
}

@media print {
    .hero-map, #mindset, .market-block, .next-learn, .exp-takeaway, .contact-focus, #contact { display: none !important; }
}

/* ==========================================================================
   24. Hero: yarn that follows the cursor, and the scroll-down arrow
   ========================================================================== */
.hero { padding-bottom: clamp(5.5rem, 12vh, 7.5rem); }

.hero-threads {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.hero-scroll {
    position: absolute;
    left: 50%;
    bottom: var(--space-5);
    width: 46px;
    height: 46px;
    margin-left: -23px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-secondary);
    background-color: var(--bg);
    border: 1px solid var(--rule);
    border-radius: 50%;
    z-index: 2;
    transition: border-color 180ms var(--ease), color 180ms var(--ease), transform 180ms var(--ease);
}
.hero-scroll svg { animation: heroScrollBob 2.2s ease-in-out infinite; }
.hero-scroll:hover { color: var(--ink); border-color: var(--accent); transform: translateY(2px); }
@keyframes heroScrollBob {
    0%, 100% { transform: translateY(-2px); }
    50%      { transform: translateY(3px); }
}

@media print { .hero-threads, .hero-scroll { display: none !important; } }
