/* ==========================================================================
   Portfolio — liquid glass theme
   1. Tokens          6. Skills            11. Copyright bar
   2. Base            7. Timeline & jobs   12. Dock
   3. Glass surfaces  8. Projects & modal  13. Motion
   4. Buttons/chips   9. Contact           14. Fallbacks & responsive
   5. Hero           10. Form states
   ========================================================================== */

/* 1. Tokens -------------------------------------------------------------- */
:root {
    --bg: #eef2fa;
    --bg-2: #eef6ff;
    --heading: #0b1222;
    --text: #1e293b;
    --text-muted: #475569;
    --text-dim: #5f6b7f;

    --accent: #2563eb;
    --accent-rgb: 37, 99, 235;
    --accent-2: #0369a1;
    --accent-2-rgb: 3, 105, 161;
    --success: #059669;
    --success-rgb: 5, 150, 105;
    --danger: #e11d48;
    --danger-rgb: 225, 29, 72;
    --danger-text: #be123c;
    --on-accent: #ffffff;
    --gradient: linear-gradient(120deg, var(--accent) 0%, var(--accent-2) 100%);
    /* Theme tints (RGB triplets) for glows and glass; colour presets override these and the accents. */
    --tint-1: 147, 197, 253;
    --tint-2: 165, 180, 252;
    --tint-3: 125, 211, 252;
    /* Base colour of glass surfaces: white on light presets, slate on the dark one. */
    --glass-rgb: 255, 255, 255;
    --canvas-mix: #ffffff;

    /* Light liquid glass: milky translucent white, strong blur, bright rim. */
    --glass-bg: linear-gradient(135deg, rgba(var(--glass-rgb), .62) 0%, rgba(var(--glass-rgb), .3) 100%);
    --glass-strong: rgba(var(--glass-rgb), .78);
    --glass-border: rgba(var(--glass-rgb), .8);
    --glass-highlight: rgba(var(--glass-rgb), .95);
    --glass-blur: 26px;
    --line: rgba(15, 23, 42, .08);
    --line-strong: rgba(15, 23, 42, .14);
    --surface-1: rgba(var(--glass-rgb), .42);
    --surface-2: rgba(var(--glass-rgb), .72);
    /* Shared depth for glass: bright top lip, faint bottom edge, layered soft shadow. */
    --glass-depth: inset 0 1px 0 rgba(var(--glass-rgb), .95), inset 0 -1px 0 rgba(15, 23, 42, .04), 0 2px 6px rgba(30, 41, 90, .05), 0 24px 48px -24px rgba(30, 41, 90, .28);
    --glass-depth-sm: inset 0 1px 0 rgba(var(--glass-rgb), .95), inset 0 -1px 0 rgba(15, 23, 42, .03), 0 6px 16px -10px rgba(30, 41, 90, .22);

    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-pill: 999px;

    --shadow-sm: 0 6px 20px -10px rgba(30, 41, 90, .22);
    --shadow: 0 24px 60px -24px rgba(30, 41, 90, .3);
    --shadow-glow: 0 0 0 1px rgba(var(--accent-rgb), .18), 0 18px 44px -16px rgba(var(--accent-rgb), .35);

    --space-section: clamp(3.5rem, 7vw, 5.5rem);
    --dur-fast: .2s;
    --dur: .45s;
    --dur-slow: .8s;
    --ease: cubic-bezier(.2, .8, .2, 1);
    --ease-spring: cubic-bezier(.34, 1.56, .64, 1);

    --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --dock-h: 54px;
    --dock-gap: 14px;
    --dock-reserve: calc(var(--dock-h) + var(--dock-gap) * 2 + var(--safe-bottom));
}

/* 2. Base ---------------------------------------------------------------- */
html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    font-size: clamp(.95rem, .9rem + .2vw, 1.05rem);
    line-height: 1.65;
    color: var(--text);
    background: var(--bg);
    overflow-x: clip;
    padding-bottom: var(--dock-reserve);
    -webkit-font-smoothing: antialiased;
    --bs-body-color: var(--text);
    --bs-body-bg: var(--bg);
    --bs-secondary-color: var(--text-muted);
    --bs-border-color: var(--glass-border);
}

h1, h2, h3, h4 { color: var(--heading); letter-spacing: -.015em; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: color-mix(in srgb, var(--accent) 78%, #000); }
::selection { background: rgba(var(--accent-rgb), .2); color: var(--heading); }

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

section[tabindex="-1"]:focus { outline: none; }

.skip-link {
    position: fixed;
    top: calc(.75rem + env(safe-area-inset-top, 0px));
    left: .75rem;
    z-index: 2000;
    padding: .6rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: var(--on-accent);
    font-weight: 600;
    text-decoration: none;
    /* Invisible until focused. Moving it up alone isn't enough: with viewport-fit=cover, iOS Safari
       draws the page behind the status bar, where the shifted link showed as a red pill by the clock. */
    opacity: 0;
    pointer-events: none;
    transform: translateY(calc(-100% - 1.5rem - env(safe-area-inset-top, 0px)));
    transition: transform var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease);
}
.skip-link:focus { opacity: 1; pointer-events: auto; transform: none; color: var(--on-accent); }

/* Ambient background: a calm, near-flat light canvas with two very soft glows,
   enough tint for the glass to pick up without blotches. */
.ambient {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
    background:
        radial-gradient(1100px 520px at 78% -8%, rgba(var(--tint-1), .28), transparent 65%),
        radial-gradient(900px 520px at 8% 108%, rgba(var(--tint-2), .3), transparent 65%),
        linear-gradient(180deg, color-mix(in srgb, var(--bg) 55%, var(--canvas-mix)) 0%, var(--bg) 55%, color-mix(in srgb, var(--bg) 75%, var(--canvas-mix)) 100%);
}

.ambient__orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    will-change: transform;
}
.ambient__orb--a { top: 18%; right: -10vmax; width: 34vmax; height: 34vmax; background: rgb(var(--tint-1)); opacity: .35; animation: drift 50s ease-in-out infinite; }
.ambient__orb--b { bottom: 8%; left: -12vmax; width: 30vmax; height: 30vmax; background: rgb(var(--tint-2)); opacity: .3; animation: drift 58s ease-in-out infinite reverse; }
.ambient__orb--c,
.ambient__orb--d,
.ambient__grid { display: none; }

.section {
    position: relative;
    padding-block: var(--space-section);
}
.section--last { padding-bottom: calc(var(--space-section) * .6); }

.section-head {
    max-width: 640px;
    margin: 0 auto clamp(2rem, 5vw, 3.25rem);
    text-align: center;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    margin-bottom: .9rem;
    padding: .3rem .8rem;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-pill);
    background: rgba(var(--glass-rgb), .6);
    box-shadow: var(--shadow-sm);
    color: var(--accent);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    font-family: var(--font-mono);
    font-size: .75rem;
    font-weight: 500;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.section-title {
    margin-bottom: .6rem;
    font-size: clamp(1.75rem, 1.3rem + 2vw, 2.6rem);
    font-weight: 750;
}

.section-sub { margin: 0; color: var(--text-muted); }

.card-title-sm {
    margin-bottom: 1.1rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--heading);
}

.lead-text { color: var(--text-muted); }

.empty-note, .empty-state { color: var(--text-dim); }
.empty-state {
    margin: 2rem auto 0;
    padding: 1.4rem;
    max-width: 420px;
    border: 1px dashed var(--line-strong);
    background: var(--surface-1);
    border-radius: var(--radius-md);
    text-align: center;
}
.empty-state .bi { display: block; margin-bottom: .35rem; font-size: 1.6rem; color: var(--accent); }

/* 3. Glass surfaces ------------------------------------------------------ */
.glass,
.glass-card,
.skill-group {
    position: relative;
    background: var(--glass-bg);
    border: 1px solid rgba(var(--glass-rgb), .5);
    box-shadow: var(--glass-depth);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
    backdrop-filter: blur(var(--glass-blur)) saturate(180%);
}

.glass-card {
    padding: clamp(1.25rem, 1rem + 1.5vw, 2rem);
    border-radius: var(--radius-lg);
    isolation: isolate;
}

/* Liquid sheen: a soft specular highlight top-left and a faint caustic bottom-right. */
.glass-card::before,
.skill-group::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    background:
        /* Spotlight that follows the cursor (motion.js sets --sx/--sy). */
        radial-gradient(420px circle at var(--sx, -999px) var(--sy, -999px), rgba(var(--accent-rgb), .09), transparent 55%),
        radial-gradient(120% 80% at 0% 0%, rgba(var(--glass-rgb), .75), transparent 45%),
        radial-gradient(70% 55% at 100% 100%, rgba(var(--tint-1), .35), transparent 60%);
    pointer-events: none;
}
/* Light-catching rim: bright on the top-left edge, fading out, catching again bottom-right. */
.glass-card::after,
.skill-group::after {
    content: "";
    position: absolute;
    inset: -1px;
    z-index: 1;
    padding: 1.5px;
    border-radius: inherit;
    background:
        radial-gradient(260px circle at var(--sx, -999px) var(--sy, -999px), rgba(var(--accent-rgb), .6), transparent 60%),
        linear-gradient(135deg, rgba(var(--glass-rgb), 1) 0%, rgba(var(--glass-rgb), .25) 30%, rgba(var(--glass-rgb), 0) 55%, rgba(var(--glass-rgb), .55) 100%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
    pointer-events: none;
}

/* A faint colour field behind each section's content gives the glass something to refract. */
.section { isolation: isolate; }
.section::before {
    content: "";
    position: absolute;
    inset: 12% 6% 8%;
    z-index: -1;
    background:
        radial-gradient(40% 50% at 22% 55%, rgba(var(--tint-1), .45), transparent 70%),
        radial-gradient(38% 48% at 80% 45%, rgba(var(--tint-2), .4), transparent 70%),
        radial-gradient(30% 40% at 55% 90%, rgba(var(--tint-3), .3), transparent 70%);
    filter: blur(40px);
    pointer-events: none;
}

/* 4. Buttons, chips, tags ------------------------------------------------ */
.btn-glass,
.btn-glass-primary {
    --bs-btn-padding-x: 1.3rem;
    --bs-btn-padding-y: .72rem;
    --bs-btn-font-weight: 600;
    --bs-btn-border-radius: var(--radius-pill);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-height: 44px;
    transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease),
                background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.btn-sm.btn-glass, .btn-sm.btn-glass-primary { --bs-btn-padding-x: 1rem; --bs-btn-padding-y: .5rem; min-height: 40px; font-size: .875rem; }

.btn-glass-primary {
    border: 1px solid rgba(var(--glass-rgb), .35);
    background: linear-gradient(135deg, rgba(var(--accent-rgb), .88) 0%, rgba(var(--accent-2-rgb), .78) 100%);
    color: var(--on-accent);
    box-shadow: inset 0 1px 0 rgba(var(--glass-rgb), .45), inset 0 -2px 6px rgba(2, 20, 60, .2), 0 10px 24px -12px rgba(var(--accent-rgb), .75);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    backdrop-filter: blur(12px) saturate(180%);
}
.btn-glass-primary:hover,
.btn-glass-primary:focus-visible {
    color: var(--on-accent);
    background: linear-gradient(135deg, rgba(var(--accent-rgb), .9) 0%, rgba(var(--accent-2-rgb), .82) 100%);
    transform: translateY(-2px);
    box-shadow: inset 0 1px 0 rgba(var(--glass-rgb), .55), inset 0 -2px 6px rgba(2, 20, 60, .2), 0 16px 30px -14px rgba(var(--accent-rgb), .85);
}
.btn-glass-primary:active { transform: translateY(0); color: var(--on-accent); }
.btn-glass-primary:disabled { color: var(--on-accent); opacity: .75; }

.btn-glass {
    border: 1px solid var(--glass-border);
    background: rgba(var(--glass-rgb), .55);
    color: var(--heading);
    box-shadow: var(--shadow-sm), inset 0 1px 0 var(--glass-highlight);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    backdrop-filter: blur(16px) saturate(180%);
}
.btn-glass:hover,
.btn-glass:focus-visible {
    color: var(--heading);
    border-color: #fff;
    background: rgba(var(--glass-rgb), .85);
    transform: translateY(-2px);
}

.chip-list,
.tag-list,
.skill-list,
.tick-list,
.contact-list,
.timeline,
.dock__list,
.job__meta { list-style: none; margin: 0; padding: 0; }

.chip-list { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1rem; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .25rem .65rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    background: var(--surface-1);
    color: var(--text-muted);
    font-size: .8rem;
    font-weight: 500;
}
.chip-list--sm .chip { font-size: .75rem; padding: .2rem .55rem; }
.chip .bi { color: var(--accent); }

.tag-list { display: flex; flex-wrap: wrap; gap: .3rem .75rem; margin-bottom: .55rem; }
.tag-list li {
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: .72rem;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.tag-list li + li::before { content: "·"; margin-right: .75rem; color: var(--text-dim); }

.tick-list li {
    position: relative;
    padding-left: 1.6rem;
    margin-bottom: .45rem;
    color: var(--text-muted);
}
.tick-list li::before {
    content: "";
    position: absolute;
    left: .15rem;
    top: .5em;
    width: .55rem;
    height: .3rem;
    border-left: 2px solid var(--accent);
    border-bottom: 2px solid var(--accent);
    transform: rotate(-45deg);
}
.tick-list--star li::before {
    width: .5rem; height: .5rem; top: .55em;
    border: 0; border-radius: 2px;
    background: var(--accent-2);
    transform: rotate(45deg);
}

/* 5. Hero ---------------------------------------------------------------- */
.hero {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 100vh;
    min-height: 100svh;
    padding-block: 4rem 6rem;
    overflow: hidden;
    text-align: center;
    isolation: isolate;
}

.hero__cover {
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(55% 45% at 50% 36%, rgba(var(--glass-rgb), .7), transparent 70%),
        radial-gradient(45% 45% at 80% 70%, rgba(var(--tint-3), .3), transparent 70%),
        radial-gradient(40% 40% at 18% 72%, rgba(var(--tint-1), .3), transparent 70%);
}
.hero__lines {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    color: var(--accent);
    opacity: .35;
    stroke-width: 1.2;
}
.hero__code {
    position: absolute;
    left: 50%;
    bottom: 18%;
    transform: translateX(-50%);
    color: rgba(15, 23, 42, .2);
    font-family: var(--font-mono);
    font-size: .8rem;
    white-space: nowrap;
}

.hero__inner { position: relative; max-width: 760px; }

/* Full-bleed cover photo: the whole hero is the photo, text sits on a dark scrim on the left. */
.hero--cover {
    color: #fff;
    border-radius: 0 0 clamp(24px, 3vw, 40px) clamp(24px, 3vw, 40px);
    box-shadow: 0 30px 60px -32px rgba(15, 23, 42, .45);
}
.hero__cover-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 70% 25%;
}
.hero--cover .hero__cover { background: #050a16; }
.hero--cover .hero__cover::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(4, 8, 20, .92) 0%, rgba(4, 8, 20, .85) 30%, rgba(4, 8, 20, .68) 48%, rgba(4, 8, 20, .12) 68%, rgba(4, 8, 20, 0) 80%),
        linear-gradient(180deg, rgba(4, 8, 20, 0) 70%, rgba(4, 8, 20, .45) 100%);
}
.hero--cover .hero__lines,
.hero--cover .hero__code { display: none; }

/* Light mist over the photo: a faint white veil, thicker fog at the bottom, slow drifting patches
   and a slight blur. --face-x/--face-y keep the face sharp and fog-free. */
.hero__mist {
    --face-x: 67%;
    --face-y: 33%;
    --face-rx: 15%;
    --face-ry: 26%;
    position: absolute;
    inset: 0;
    z-index: 1;
    overflow: hidden;
    pointer-events: none;
    background:
        radial-gradient(70% 45% at 15% 105%, rgba(255, 255, 255, .26), transparent 70%),
        radial-gradient(60% 40% at 85% 108%, rgba(255, 255, 255, .22), transparent 70%),
        radial-gradient(50% 30% at 40% -5%, rgba(255, 255, 255, .1), transparent 70%),
        linear-gradient(180deg, rgba(255, 255, 255, .05) 0%, rgba(255, 255, 255, .09) 60%, rgba(255, 255, 255, .2) 100%);
    -webkit-backdrop-filter: blur(2.5px);
    backdrop-filter: blur(2.5px);
    -webkit-mask-image: radial-gradient(ellipse var(--face-rx) var(--face-ry) at var(--face-x) var(--face-y), transparent 55%, #000 100%);
    mask-image: radial-gradient(ellipse var(--face-rx) var(--face-ry) at var(--face-x) var(--face-y), transparent 55%, #000 100%);
}
.hero__mist::before,
.hero__mist::after {
    content: "";
    position: absolute;
    inset: -20%;
    filter: blur(36px);
    will-change: transform;
}
.hero__mist::before {
    background:
        radial-gradient(28% 16% at 25% 72%, rgba(255, 255, 255, .16), transparent 70%),
        radial-gradient(22% 14% at 60% 88%, rgba(255, 255, 255, .14), transparent 70%);
    animation: mist-drift 46s ease-in-out infinite alternate;
}
.hero__mist::after {
    background:
        radial-gradient(26% 15% at 80% 60%, rgba(255, 255, 255, .1), transparent 70%),
        radial-gradient(30% 18% at 10% 40%, rgba(255, 255, 255, .08), transparent 70%);
    animation: mist-drift 60s ease-in-out infinite alternate-reverse;
}
@keyframes mist-drift {
    from { transform: translate3d(-4%, 0, 0); }
    to { transform: translate3d(5%, -3%, 0); }
}
.hero--cover .hero__inner { max-width: 1320px; width: 100%; padding-inline: clamp(1.25rem, 5vw, 4.5rem); }
.hero--cover .hero__content { max-width: 760px; text-align: left; }
.hero--cover .hero__name {
    color: #fff;
    font-size: clamp(2.2rem, 1rem + 3.4vw, 4rem);
    text-shadow: 0 2px 24px rgba(0, 0, 0, .35);
}
@media (min-width: 1200px) {
    .hero--cover .hero__name { white-space: nowrap; }
}
.hero--cover .hero__role { background-image: linear-gradient(120deg, #93c5fd, #7dd3fc); }
.hero--cover .hero__tagline { margin: 0 0 2rem; color: rgba(255, 255, 255, .82); }
.hero--cover .hero__cta { justify-content: flex-start; }
.hero--cover .status-pill { border-color: rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .12); color: #fff; box-shadow: none; }
/* Both hero buttons: clear liquid glass over the photo. */
.hero--cover .btn-glass {
    border-color: rgba(255, 255, 255, .32);
    background: linear-gradient(150deg, rgba(255, 255, 255, .2), rgba(255, 255, 255, .06));
    color: #fff;
    box-shadow: 0 10px 28px -14px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .4), inset 0 -1px 0 rgba(255, 255, 255, .08);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    backdrop-filter: blur(18px) saturate(180%);
}
.hero--cover .btn-glass:hover,
.hero--cover .btn-glass:focus-visible {
    border-color: rgba(255, 255, 255, .5);
    background: linear-gradient(150deg, rgba(255, 255, 255, .3), rgba(255, 255, 255, .12));
    color: #fff;
}
.hero--cover .hero__scroll { color: rgba(255, 255, 255, .75); }
.hero--cover .hero__scroll:hover { color: #fff; }
.hero--cover :focus-visible { outline-color: #93c5fd; }

@media (max-width: 1199.98px) {
    /* Face at the top, text anchored to the bottom over a darker scrim. */
    .hero--cover { align-items: end; place-items: end center; padding-bottom: calc(var(--dock-reserve) + 1.25rem); }
    .hero__cover-img { object-position: 72% 20%; }
    .hero__mist { --face-x: 62%; --face-y: 32%; --face-rx: 22%; --face-ry: 26%; }
    .hero--cover .hero__cover::after {
        background: linear-gradient(180deg, rgba(4, 8, 20, .1) 0%, rgba(4, 8, 20, .45) 36%, rgba(4, 8, 20, .9) 62%, rgba(4, 8, 20, .97) 100%);
    }
    .hero--cover .hero__content { max-width: none; text-align: center; }
    .hero--cover .hero__tagline { margin-inline: auto; }
    .hero--cover .hero__cta { justify-content: center; }
    .hero--cover .hero__scroll { display: none; }
}

.hero__avatar {
    position: relative;
    width: clamp(128px, 22vw, 168px);
    aspect-ratio: 1;
    margin: 0 auto 1.5rem;
    padding: 6px;
    border-radius: 50%;
    background: conic-gradient(from 200deg, #60a5fa, #7dd3fc, #a5b4fc, #ffffff, #60a5fa);
    box-shadow: 0 24px 60px -18px rgba(var(--accent-rgb), .45);
}
.hero__avatar::after {
    /* Glass ring: a translucent band just outside the gradient ring. */
    content: "";
    position: absolute;
    inset: -14px;
    border-radius: 50%;
    border: 1px solid rgba(var(--glass-rgb), .9);
    background: rgba(var(--glass-rgb), .35);
    box-shadow: var(--shadow-sm), inset 0 1px 0 #fff;
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    backdrop-filter: blur(14px) saturate(180%);
    z-index: -1;
}
.hero__portrait { width: min(300px, 72vw); margin: -1.5rem auto 1.25rem; }

/* Desktop without a cover photo: copy on the left, portrait dial on the right. */
@media (min-width: 992px) {
    .hero:not(.hero--cover) .hero__inner {
        display: grid;
        grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
        align-items: center;
        gap: clamp(2rem, 4vw, 4rem);
        max-width: 1200px;
        text-align: left;
    }
    .hero:not(.hero--cover) .hero__portrait { order: 2; width: min(480px, 100%); margin: 0 auto; }
}
/* Wide desktop: a bigger stage. Larger name and portrait, more breathing room between them. */
@media (min-width: 1200px) {
    .hero:not(.hero--cover) .hero__inner {
        grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr);
        gap: 1.5rem;
        max-width: 1320px;
        padding-inline: clamp(1rem, 1.5vw, 1.5rem);
    }
    .hero:not(.hero--cover) .hero__portrait { width: min(620px, 100%); }
    /* One line: the size tracks the viewport so the full name fits the text column. */
    .hero:not(.hero--cover) .hero__name { font-size: min(3.75rem, 4.3vw); line-height: 1.05; margin-bottom: .9rem; white-space: nowrap; }
    .hero:not(.hero--cover) .hero__role { margin-bottom: 1.1rem; font-size: clamp(1.35rem, 1rem + .6vw, 1.7rem); }
    .hero:not(.hero--cover) .hero__tagline { max-width: 600px; margin-bottom: 2.4rem; font-size: 1.25rem; }
    .hero:not(.hero--cover) .hero__cta .btn { --bs-btn-padding-x: 1.6rem; --bs-btn-padding-y: .85rem; min-height: 52px; font-size: 1.05rem; }
    .hero:not(.hero--cover) .hero__stats { margin-top: 2.6rem; }
    .hero:not(.hero--cover) .hero__stat dd { font-size: 2.4rem; }
    .hero:not(.hero--cover) .hero__stat dt { font-size: .85rem; }
    .hero:not(.hero--cover) .hero__tagline { margin-inline: 0; }
    .hero:not(.hero--cover) .hero__cta { justify-content: flex-start; }
}

.hero__avatar img,
.hero__initials {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    background: rgba(var(--glass-rgb), .88);
}
.hero__initials span {
    font-size: clamp(2.6rem, 6vw, 3.4rem);
    font-weight: 800;
    letter-spacing: -.03em;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    margin-bottom: 1.1rem;
    padding: .35rem .9rem;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-pill);
    background: rgba(var(--glass-rgb), .6);
    box-shadow: var(--shadow-sm);
    color: var(--text-muted);
    font-size: .82rem;
    font-weight: 600;
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    backdrop-filter: blur(14px) saturate(180%);
}
.status-pill__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim); }
.status-pill__dot.is-on { background: var(--success); box-shadow: 0 0 0 4px rgba(var(--success-rgb), .18); animation: pulse 2.4s ease-in-out infinite; }

.hero__name {
    margin-bottom: .5rem;
    font-size: clamp(2.1rem, 1.3rem + 4.2vw, 4rem);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -.035em;
}
.hero__role {
    margin-bottom: .9rem;
    font-size: clamp(1.05rem, .95rem + .6vw, 1.35rem);
    font-weight: 600;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.hero__tagline {
    max-width: 560px;
    margin: 0 auto 2rem;
    color: var(--text-muted);
    font-size: clamp(1rem, .95rem + .3vw, 1.15rem);
}
.hero__role { min-height: 1.6em; }
@keyframes caret-blink { 50% { opacity: 0; } }
.hero__cta { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; }

.hero__scroll {
    position: absolute;
    left: 50%;
    bottom: calc(var(--dock-reserve) + .5rem);
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    margin-left: -20px;
    border-radius: 50%;
    color: var(--text-muted);
    text-decoration: none;
    animation: bob 2.6s ease-in-out infinite;
}
.hero__scroll:hover { color: var(--accent); }

/* 6. About facts & skills ------------------------------------------------ */
.facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
    gap: 1rem;
    margin: 1.5rem 0 0;
}
.fact {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 76px;
    padding: .8rem 1rem .8rem 3.6rem;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    background: var(--surface-1);
    transition: border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.fact:hover { border-color: rgba(var(--accent-rgb), .3); background: var(--surface-2); }
.fact dt { color: var(--text-dim); font-size: .75rem; font-weight: 500; letter-spacing: .03em; text-transform: uppercase; }
.fact dd { margin: 0; color: var(--text); font-weight: 600; }
.fact__icon {
    position: absolute;
    left: .7rem;
    top: 50%;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(var(--accent-rgb), .1);
    color: var(--accent);
    font-size: 1rem;
    transform: translateY(-50%);
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .5rem;
    margin-bottom: 2rem;
}
.filter-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    min-height: 40px;
    padding: .45rem 1rem;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-pill);
    background: rgba(var(--glass-rgb), .55);
    box-shadow: var(--shadow-sm);
    color: var(--text-muted);
    font: inherit;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    backdrop-filter: blur(14px) saturate(180%);
    transition: color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease),
                border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.filter-btn:hover { color: var(--heading); background: rgba(var(--glass-rgb), .85); transform: translateY(-1px); }
.filter-btn.is-active {
    border-color: rgba(var(--glass-rgb), .35);
    background: linear-gradient(135deg, rgba(var(--accent-rgb), .88), rgba(var(--accent-2-rgb), .78));
    color: var(--on-accent);
    box-shadow: inset 0 1px 0 rgba(var(--glass-rgb), .45), 0 8px 22px -12px rgba(var(--accent-rgb), .8);
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
    gap: 1.25rem;
}
.skill-group {
    padding: 1.4rem;
    border-radius: var(--radius-lg);
    isolation: isolate;
}
.skill-group__title {
    display: flex;
    align-items: center;
    gap: .55rem;
    margin-bottom: 1rem;
    font-size: .95rem;
    font-weight: 700;
}
.skill-group__title .bi { color: var(--accent); }
.skill-list { display: flex; flex-wrap: wrap; gap: .5rem; }
.skill-pill {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .85rem;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    background: var(--surface-1);
    color: var(--heading);
    font-size: .875rem;
    font-weight: 500;
    transition: transform var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
                background-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.skill-pill .bi { color: var(--accent); font-size: 1rem; }
.skill-pill:hover {
    transform: translateY(-2px);
    border-color: rgba(var(--accent-rgb), .4);
    background: var(--surface-2);
    box-shadow: 0 10px 22px -12px rgba(var(--accent-rgb), .5);
}

/* 7. Timeline & jobs ----------------------------------------------------- */
.timeline {
    --tl-x: .45rem;
    --tl-pad: 2rem;
    position: relative;
    padding-left: var(--tl-pad);
}
.timeline::before {
    content: "";
    position: absolute;
    left: var(--tl-x);
    top: .5rem;
    bottom: .5rem;
    width: 1px;
    background: linear-gradient(180deg, rgba(var(--accent-rgb), .6), rgba(var(--accent-2-rgb), .4) 60%, transparent);
}
.timeline__item { position: relative; }
.timeline__item + .timeline__item { margin-top: 1rem; }
.timeline__marker {
    position: absolute;
    left: calc(var(--tl-x) - var(--tl-pad) - 5.5px);
    top: 1.35rem;
    width: 12px;
    height: 12px;
    border: 2px solid var(--accent);
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .14), 0 0 12px rgba(var(--accent-rgb), .45);
}
.timeline__marker.is-current { background: var(--accent); }

.timeline__card {
    padding: 1rem 1.15rem;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    background: var(--surface-1);
    transition: border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.timeline__card:hover { border-color: rgba(var(--accent-rgb), .3); transform: translateX(3px); }
.timeline__date {
    margin-bottom: .2rem;
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: .75rem;
}
.timeline__title { margin-bottom: .25rem; font-size: 1rem; font-weight: 700; }
.timeline__meta { margin: 0; color: var(--text-muted); font-size: .9rem; }
.timeline__meta .sep { margin-inline: .3rem; color: var(--text-dim); }
.timeline__text { margin: .5rem 0 0; color: var(--text-muted); font-size: .9rem; }

.timeline--jobs { --tl-x: .5rem; --tl-pad: 2.25rem; max-width: 920px; margin-inline: auto; }
.timeline--jobs .timeline__item + .timeline__item { margin-top: 1.5rem; }
.timeline--jobs .timeline__marker { top: 2rem; }

.job { transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.job:hover { transform: translateY(-4px); box-shadow: var(--shadow), var(--shadow-glow); }
.job__head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: .75rem 1.5rem;
    margin-bottom: .85rem;
}
.job__title { margin-bottom: .2rem; font-size: clamp(1.1rem, 1rem + .4vw, 1.3rem); font-weight: 700; }
.job__company { margin: 0; color: var(--accent); font-weight: 600; }
.job__meta { display: flex; flex-wrap: wrap; align-content: flex-start; gap: .4rem; }
.job__meta li {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .2rem .65rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    background: var(--surface-1);
    color: var(--text-muted);
    font-size: .8rem;
}
.job__meta li.is-current { border-color: rgba(var(--success-rgb), .35); background: rgba(var(--success-rgb), .08); color: #047857; }
.job__company-summary { color: var(--text-dim); font-size: .9rem; font-style: italic; }
.job__summary { color: var(--text-muted); }
.job__label {
    margin: 1rem 0 .55rem;
    color: var(--text-dim);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

/* 8. Projects & modal ---------------------------------------------------- */
.project-card {
    --rx: 0deg;
    --ry: 0deg;
    --lift: 0px;
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0;
    overflow: hidden;
    /* 3D tilt toward the cursor (motion.js sets --rx/--ry). */
    transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry)) translateY(var(--lift));
    transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.project-card.is-tilting { transition-duration: .12s, var(--dur), var(--dur); }
.project-card:hover,
.project-card:focus-within {
    --lift: -6px;
    border-color: rgba(var(--accent-rgb), .35);
    box-shadow: var(--shadow), var(--shadow-glow);
}

.project-card__cover {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(var(--tint-1), .45);
}
.project-card__cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--dur-slow) var(--ease);
}
.project-card:hover .project-card__cover img { transform: scale(1.05); }

.cover-placeholder {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(80% 90% at 15% 10%, rgba(var(--tint-1), .85), transparent 60%),
        radial-gradient(70% 80% at 90% 100%, rgba(var(--tint-3), .85), transparent 60%),
        radial-gradient(50% 60% at 85% 10%, rgba(var(--tint-2), .6), transparent 60%),
        linear-gradient(135deg, rgb(var(--tint-1)), rgb(var(--tint-2)));
}
.cover-placeholder .bi {
    font-size: clamp(2.5rem, 6vw, 3.4rem);
    color: #fff;
    filter: drop-shadow(0 8px 18px rgba(30, 41, 90, .3));
    transition: transform var(--dur) var(--ease-spring);
}
.project-card:hover .cover-placeholder .bi { transform: scale(1.1) rotate(-4deg); }

.sample-badge {
    position: absolute;
    top: .75rem;
    right: .75rem;
    padding: .2rem .6rem;
    border: 1px solid rgba(var(--glass-rgb), .9);
    border-radius: var(--radius-pill);
    background: rgba(var(--glass-rgb), .75);
    color: #92400e;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.project-card__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 1.25rem 1.35rem 1.35rem;
}
.project-card__title { margin-bottom: .45rem; font-size: 1.15rem; font-weight: 700; }
.project-card__text { margin-bottom: 0; color: var(--text-muted); font-size: .92rem; }
.project-card__actions {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-top: auto;
    padding-top: 1.25rem;
}

.icon-link-btn {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    background: rgba(var(--glass-rgb), .6);
    box-shadow: var(--shadow-sm);
    color: var(--heading);
    text-decoration: none;
    transition: transform var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.icon-link-btn:hover { color: var(--accent); border-color: rgba(var(--accent-rgb), .45); transform: translateY(-3px) scale(1.06); }

.glass-modal {
    --bs-modal-color: var(--text);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    background: rgba(var(--glass-rgb), .72);
    box-shadow: 0 40px 90px -24px rgba(30, 41, 90, .45), inset 0 1px 0 var(--glass-highlight);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    backdrop-filter: blur(30px) saturate(180%);
}
.glass-modal .modal-header,
.glass-modal .modal-footer { border-color: var(--line); }
.glass-modal .modal-title { font-size: 1.25rem; font-weight: 700; }
.modal-backdrop { --bs-backdrop-bg: #1e2a4a; }
.modal-backdrop.show { opacity: .25; }
/* Frost the page behind an open modal. */
.modal.show { -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.modal.fade .modal-dialog { transform: translateY(24px) scale(.97); transition: transform .3s var(--ease); }
.modal.show .modal-dialog { transform: none; }

.modal-cover {
    aspect-ratio: 16 / 9;
    margin-bottom: 1.25rem;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    background: rgba(var(--tint-1), .45);
}
.modal-cover img { width: 100%; height: 100%; object-fit: cover; }
.modal-cover:has(.cover-placeholder) { aspect-ratio: 21 / 9; }
/* Gallery slider: native scroll-snap, so touch swipe just works. */
.pm-slider { position: relative; height: 100%; }
.pm-slider__track { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.pm-slider__track::-webkit-scrollbar { display: none; }
.pm-slider__slide { flex: 0 0 100%; height: 100%; scroll-snap-align: start; }
.pm-slider__slide img { object-fit: contain; }
.pm-slider__nav {
    position: absolute;
    top: 50%;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    margin-top: -21px;
    border: 1px solid rgba(255, 255, 255, .55);
    border-radius: 50%;
    background: linear-gradient(145deg, rgba(255, 255, 255, .5), rgba(255, 255, 255, .16));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .75), 0 8px 20px -8px rgba(15, 23, 42, .5);
    color: #0f172a;
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    backdrop-filter: blur(14px) saturate(180%);
    transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.pm-slider__nav:hover { background: linear-gradient(145deg, rgba(255, 255, 255, .72), rgba(255, 255, 255, .34)); transform: scale(1.06); }
.pm-slider__nav:disabled { opacity: 0; pointer-events: none; }
.pm-slider__nav--prev { left: .6rem; }
.pm-slider__nav--next { right: .6rem; }
/* Dots in a glass pill; the active one stretches into a bar. */
.pm-slider__dots {
    position: absolute;
    left: 50%;
    bottom: .6rem;
    display: flex;
    align-items: center;
    gap: .35rem;
    padding: .35rem .55rem;
    border: 1px solid rgba(255, 255, 255, .55);
    border-radius: var(--radius-pill);
    background: linear-gradient(145deg, rgba(255, 255, 255, .45), rgba(255, 255, 255, .14));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 8px 20px -10px rgba(15, 23, 42, .5);
    transform: translateX(-50%);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    backdrop-filter: blur(14px) saturate(180%);
}
.pm-slider__dot {
    width: 8px;
    height: 8px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: var(--radius-pill);
    background: rgba(15, 23, 42, .3);
    transition: width var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.pm-slider__dot.is-active { width: 24px; background: var(--accent); }
.modal-cover .cover-placeholder .bi { font-size: 4rem; }
.modal-lead { color: var(--text-muted); }
.modal-h {
    margin: 1.4rem 0 .7rem;
    color: var(--text-dim);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.mini-panel {
    height: 100%;
    padding: 1rem;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    background: var(--surface-1);
}
.mini-panel h3 { margin-bottom: .4rem; font-size: .92rem; font-weight: 700; }
.mini-panel h3 .bi { color: var(--accent); }
.mini-panel p { margin: 0; color: var(--text-muted); font-size: .92rem; }
.sample-note {
    padding: .55rem .85rem;
    border: 1px solid rgba(217, 119, 6, .3);
    border-radius: var(--radius-sm);
    background: rgba(251, 191, 36, .12);
    color: #92400e;
    font-size: .88rem;
}
.modal-nolinks { margin: 0 auto 0 0; color: var(--text-dim); font-size: .88rem; }

/* 9. Contact ------------------------------------------------------------- */
.contact-list { display: grid; gap: .6rem; }
.contact-item {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    gap: .85rem;
    padding: .65rem .7rem;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    background: var(--surface-1);
    transition: border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.contact-item:hover { border-color: rgba(var(--accent-rgb), .3); background: var(--surface-2); }
.contact-item__icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(var(--accent-rgb), .1);
    color: var(--accent);
    font-size: 1.1rem;
}
.contact-item__body { display: flex; flex-direction: column; min-width: 0; }
.contact-item__label { color: var(--text-dim); font-size: .72rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.contact-item__value {
    overflow-wrap: anywhere;
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
}
a.contact-item__value:hover { color: var(--accent); text-decoration: underline; }

.copy-btn {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    background: rgba(var(--glass-rgb), .65);
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.copy-btn:hover { color: var(--accent); border-color: rgba(var(--accent-rgb), .45); }
.contact-item__actions { display: flex; gap: .4rem; }
/* The action (send, chat, open, map) is the main thing to do, so it carries the accent. */
.action-btn { color: var(--accent); text-decoration: none; background: rgba(var(--accent-rgb), .08); border-color: rgba(var(--accent-rgb), .22); }
.action-btn:hover,
.action-btn:focus-visible { color: var(--on-accent); background: var(--accent); border-color: var(--accent); transform: translateY(-1px); }
.copy-btn:active { transform: scale(.92); }
.copy-btn.is-copied { color: var(--success); border-color: rgba(var(--success-rgb), .45); }

/* 10. Form & form states ------------------------------------------------- */
.form-card { display: flex; flex-direction: column; overflow: hidden; }
.form-card .contact-form { display: flex; flex: 1; flex-direction: column; }
.form-card .form-foot { margin-top: auto; padding-top: 1.25rem; }
.contact-form { transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease), filter var(--dur) var(--ease); }

.form-label { margin-bottom: .35rem; color: var(--text-muted); font-size: .85rem; font-weight: 600; }
.glass-input {
    min-height: 46px;
    padding: .7rem 1rem;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: rgba(var(--glass-rgb), .6);
    color: var(--heading);
    transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.glass-input::placeholder { color: var(--text-dim); }
.glass-input:focus {
    border-color: var(--accent);
    background: rgba(var(--glass-rgb), .92);
    color: var(--heading);
    box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .15);
}
.glass-input[aria-invalid="true"] { border-color: var(--danger); }
.glass-input[aria-invalid="true"]:focus { box-shadow: 0 0 0 4px rgba(var(--danger-rgb), .15); }
textarea.glass-input { resize: vertical; min-height: 140px; }
@media (min-width: 992px) {
    /* Fill the form card so it lines up with the contact list beside it. */
    .form-card textarea.glass-input { min-height: 186px; }
}

.field-error {
    display: none;
    align-items: center;
    gap: .4rem;
    margin: .4rem 0 0;
    color: var(--danger-text);
    font-size: .82rem;
}
.field-error:not(:empty) { display: flex; }
/* Icon + text, so errors don't rely on colour alone. */
.field-error::before {
    content: "!";
    flex: none;
    display: grid;
    place-items: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--danger);
    color: #fff;
    font-size: .7rem;
    font-weight: 800;
}

.form-note {
    display: flex;
    gap: .5rem;
    padding: .6rem .85rem;
    border: 1px solid rgba(var(--accent-rgb), .2);
    border-radius: var(--radius-sm);
    background: rgba(var(--accent-rgb), .07);
    color: var(--text-muted);
    font-size: .85rem;
}
.form-note .bi { color: var(--accent); }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.form-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: .75rem;
    margin-top: 1.25rem;
}
.form-alert {
    flex: 1 1 260px;
    margin: 0;
    padding: .6rem .85rem;
    border: 1px solid rgba(var(--danger-rgb), .3);
    border-radius: var(--radius-sm);
    background: rgba(var(--danger-rgb), .07);
    color: var(--danger-text);
    font-size: .88rem;
}
.form-alert::before { content: "⚠ "; }

.btn-submit { min-width: 170px; }
.btn-submit__busy { display: none; align-items: center; gap: .5rem; }
.btn-submit.is-busy .btn-submit__idle { display: none; }
.btn-submit.is-busy .btn-submit__busy { display: inline-flex; }

/* Success: the form fades back while the OK badge pops in over the same card. */
.form-card.is-success .contact-form {
    opacity: 0;
    transform: scale(.97);
    filter: blur(6px);
    visibility: hidden;
    transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease), filter var(--dur) var(--ease), visibility 0s var(--dur);
}
.form-success {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    text-align: center;
}
.form-success[hidden] { display: none !important; }
.form-success__inner { outline: none; animation: fade-in var(--dur) var(--ease) both; }
.form-success__badge {
    display: grid;
    place-items: center;
    width: 112px;
    height: 112px;
    margin: 0 auto 1.25rem;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(var(--glass-rgb), .95), rgba(167, 243, 208, .55));
    border: 1px solid rgba(var(--success-rgb), .35);
    box-shadow: 0 16px 40px -16px rgba(var(--success-rgb), .55);
    animation: pop-in .6s var(--ease-spring) both, glow 1.6s ease-in-out .4s 2;
}
.form-success__badge svg { width: 64px; height: 64px; fill: none; stroke: var(--success); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.form-success__badge circle { stroke-opacity: .35; stroke-dasharray: 151; stroke-dashoffset: 151; animation: draw .7s var(--ease) .15s forwards; }
.form-success__badge path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .45s var(--ease) .5s forwards; }
.form-success__title { margin-bottom: .3rem; color: var(--heading); font-size: 1.5rem; font-weight: 800; }
.form-success__text { margin: 0; color: var(--text-muted); }

/* Inner glass: tiles, chips, small buttons and inputs share one frosted look. */
.fact,
.timeline__card,
.contact-item,
.mini-panel,
.skill-pill,
.copy-btn,
.icon-link-btn,
.glass-input {
    border-color: rgba(var(--glass-rgb), .85);
    background: linear-gradient(135deg, rgba(var(--glass-rgb), .6), rgba(var(--glass-rgb), .28));
    box-shadow: var(--glass-depth-sm);
    -webkit-backdrop-filter: blur(10px) saturate(160%);
    backdrop-filter: blur(10px) saturate(160%);
}
.glass-input { border-color: rgba(15, 23, 42, .1); }
.fact:hover,
.timeline__card:hover,
.contact-item:hover,
.skill-pill:hover { background: linear-gradient(135deg, rgba(var(--glass-rgb), .85), rgba(var(--glass-rgb), .5)); }

/* 11. Copyright bar ------------------------------------------------------ */
.copyright { padding-bottom: .25rem; }
.copyright__bar {
    margin: 0 auto;
    max-width: 640px;
    padding: .45rem 1.1rem;
    border-radius: var(--radius-pill);
    color: var(--text-dim);
    font-size: .8rem;
    text-align: center;
    box-shadow: inset 0 1px 0 var(--glass-highlight);
}

/* 12. Dock --------------------------------------------------------------- */
.dock {
    /* Geometry shared by the bar, the icons and the floating bubble. */
    --dock-pad: .2rem;
    --link-size: 38px;
    --bubble-size: 44px;
    --lift: 13px;

    position: fixed;
    left: 50%;
    /* A slim pill floating just above the bottom edge (and the iPhone home bar). */
    bottom: calc(2px + var(--safe-bottom));
    z-index: 1040;
    transform: translateX(-50%);
    padding: var(--dock-pad) .45rem;
    border: .5px solid rgba(var(--glass-rgb), .9);
    border-radius: 999px;
    /* Opaque enough that icons stay legible over the dark hero photo as well as the light page. */
    background: linear-gradient(150deg, rgba(var(--glass-rgb), .86), rgba(var(--glass-rgb), .66));
    box-shadow: 0 10px 28px -14px rgba(30, 41, 90, .32), 0 1px 2px rgba(30, 41, 90, .06), inset 0 1px 0 rgba(255, 255, 255, .95), inset 0 -1px 0 rgba(15, 23, 42, .04);
    -webkit-backdrop-filter: blur(28px) saturate(200%);
    backdrop-filter: blur(28px) saturate(200%);
    animation: dock-in .7s var(--ease) .3s both;
}
.dock__list { position: relative; z-index: 1; display: flex; align-items: flex-end; gap: .15rem; }

/* The active item rises into a frosted glass bubble that floats above the bar. */
.dock__bubble {
    position: absolute;
    top: calc(var(--dock-pad) + var(--link-size) / 2 - var(--lift) - var(--bubble-size) / 2 - 1px);
    left: 0;
    width: var(--bubble-size);
    height: var(--bubble-size);
    border: 1px solid rgba(var(--glass-rgb), .95);
    border-radius: 50%;
    background:
        radial-gradient(70% 55% at 35% 25%, rgba(var(--glass-rgb), 1), rgba(var(--glass-rgb), 0) 70%),
        linear-gradient(160deg, rgba(var(--glass-rgb), .95), rgba(var(--tint-1), .8));
    box-shadow:
        0 8px 18px -8px rgba(30, 41, 90, .4),
        0 0 0 3px rgba(var(--glass-rgb), .4),
        inset 0 -6px 14px rgba(var(--accent-rgb), .14),
        inset 0 1px 0 #fff;
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
    opacity: 0;
    transform: translateX(var(--bubble-x, 0px));
    transition: transform .55s var(--ease-spring), opacity var(--dur) var(--ease);
    pointer-events: none;
}
.dock.is-ready .dock__bubble { opacity: 1; }

.dock__link {
    position: relative;
    display: grid;
    place-items: center;
    width: var(--link-size);
    height: var(--link-size);
    border-radius: 50%;
    color: var(--text-muted);
    text-decoration: none;
    transform-origin: 50% 100%;
    transition: transform .5s var(--ease-spring), color .25s var(--ease);
}
.dock__icon { display: inline-block; font-size: 1.05rem; line-height: 1; transition: transform .35s var(--ease-spring); }
/* Hover: a soft glass halo blooms behind the icon, which lifts and takes an accent tint. */
.dock__link::before {
    content: "";
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 25%, rgba(var(--accent-rgb), .08), rgba(var(--accent-rgb), .2));
    box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .22), inset 0 1px 0 rgba(255, 255, 255, .8), 0 6px 14px -6px rgba(var(--accent-rgb), .55);
    opacity: 0;
    transform: scale(.4);
    transition: opacity .25s var(--ease), transform .45s var(--ease-spring);
    pointer-events: none;
}
.dock__link:not(.is-active):hover::before,
.dock__link:not(.is-active):focus-visible::before { opacity: 1; transform: scale(1); }
.dock__link:hover,
.dock__link:focus-visible { color: var(--accent); }
.dock__link:not(.is-active):hover .dock__icon,
.dock__link:not(.is-active):focus-visible .dock__icon { transform: translateY(-2px); }
.dock__link:active .dock__icon { transform: translateY(0) scale(.88); transition-duration: .12s; }
/* The icon pops as it rises into the bubble. */
.dock__link.is-active .dock__icon { animation: dock-pop .55s var(--ease-spring); }
@keyframes dock-pop { 0% { transform: scale(.7) rotate(-10deg); } 60% { transform: scale(1.12) rotate(3deg); } 100% { transform: none; } }
.dock .dock__list .dock__item .dock__link.is-active {
    color: var(--accent);
    background: none;
    transform: translateY(calc(var(--lift) * -1));
}
.dock__link.is-active .dock__icon { font-size: 1.15rem; }

/* Desktop: labels are tooltips above the icons, with magnification on hover. */
.dock__label {
    position: absolute;
    z-index: 2;
    bottom: calc(100% + 12px);
    left: 50%;
    padding: .2rem .55rem;
    border: 1px solid rgba(var(--glass-rgb), .9);
    border-radius: 8px;
    background: rgba(var(--glass-rgb), .8);
    box-shadow: var(--shadow-sm);
    color: var(--heading);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, 6px) scale(.85);
    transform-origin: 50% 100%;
    transition: opacity .2s var(--ease), transform .4s var(--ease-spring);
}
.dock__link:hover .dock__label,
.dock__link:focus-visible .dock__label { opacity: 1; transform: translate(-50%, 0) scale(1); }
/* Touch screens keep no sticky hover halo after a tap. */
@media (hover: none) { .dock__link::before { display: none; } }

/* Dock switched off in Admin → Appearance (per screen size): hide it and drop the space kept for it. */
@media (min-width: 768px) {
    html[data-dock-desktop="0"] { --dock-reserve: calc(1rem + var(--safe-bottom)); }
    html[data-dock-desktop="0"] .dock { display: none; }
}
@media (max-width: 767.98px) {
    html[data-dock-mobile="0"] { --dock-reserve: calc(1rem + var(--safe-bottom)); }
    html[data-dock-mobile="0"] .dock { display: none; }
}

/* Toasts sit just above the dock. */
.toast-stack {
    left: 50%;
    bottom: calc(var(--dock-reserve) + 1.5rem);
    z-index: 1090;
    transform: translateX(-50%);
}
.glass-toast {
    width: auto;
    max-width: calc(100vw - 32px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-pill);
    background: rgba(var(--glass-rgb), .85);
    box-shadow: var(--shadow);
    color: var(--heading);
    font-size: .88rem;
    font-weight: 500;
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}
.toast-icon { color: var(--success); font-size: 1.05rem; }
.glass-toast.is-error .toast-icon { color: var(--danger); }

/* 13. Motion ------------------------------------------------------------- */
[data-enter] { animation: enter-up .8s var(--ease) both; }
[data-enter="1"] { animation-name: enter-scale; animation-delay: .05s; }
[data-enter="2"] { animation-delay: .18s; }
[data-enter="3"] { animation-delay: .3s; }
[data-enter="4"] { animation-delay: .42s; }

.js .reveal {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease);
    transition-delay: var(--reveal-delay, 0s);
}
.js .reveal.is-visible { opacity: 1; transform: none; }

@keyframes enter-up { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes enter-scale { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }
@keyframes dock-in { from { opacity: 0; transform: translate(-50%, 30px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes drift {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    50% { transform: translate3d(6vmax, 4vmax, 0) scale(1.08); }
}
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(var(--success-rgb), 0); } }
@keyframes bob { 50% { transform: translateY(6px); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: none; } }
@keyframes glow {
    50% { box-shadow: 0 0 0 10px rgba(var(--success-rgb), .08), 0 0 50px 6px rgba(var(--success-rgb), .3); }
}
@keyframes draw { to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        animation-delay: 0s !important;
        transition-duration: .01ms !important;
    }
    .ambient__orb,
    .hero__mist::before,
    .hero__mist::after { animation: none; }
    .js .reveal { opacity: 1; transform: none; }
    .dock__item .dock__link:not(.is-active),
    .dock__icon { transform: none !important; animation: none !important; }
}

/* 14. Motion layer (motion.js + anime.js) ----------------------------- */
/* Scroll progress: a thin gradient line across the top of the page. */
.scroll-progress {
    position: fixed;
    inset: 0 0 auto;
    z-index: 1050;
    height: 3px;
    pointer-events: none;
    opacity: 0;
    transition: opacity .3s var(--ease);
}
.scroll-progress.is-active { opacity: 1; }
.scroll-progress span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--accent-2), var(--accent), rgb(var(--tint-3)));
    box-shadow: 0 0 12px rgba(var(--accent-rgb), .6);
    transform: scaleX(var(--progress, 0));
    transform-origin: 0 50%;
}

/* Hero name: split into characters that blur up into place. */
.hero__name .word { display: inline-block; white-space: nowrap; }
.hero__name .char { display: inline-block; will-change: transform, opacity, filter; }
/* Wait for motion.js before showing the name; if it never runs, the CSS entrance still plays, just later. */
.motion-pending .hero__name { animation-delay: 1.2s; }
.motion .hero__lines path { will-change: transform; }

/* Rotating designation: a slot roll. Old characters rise out of a mask one by one,
   new ones rise in from below, so two titles never overlap. */
.hero__typed {
    position: relative;
    display: inline-grid;
    vertical-align: bottom;
    overflow: hidden;
    padding-bottom: .12em;
    margin-bottom: -.12em;
    color: var(--accent);
    -webkit-text-fill-color: currentColor;
}
/* Solid colour instead of the gradient clip: background-clip:text also paints the
   screen-reader-only copy of the titles, which shows up as a smudge. */
.hero__role { background: none; color: var(--accent); }
.hero--cover .hero__role,
.hero--cover .hero__typed { background: none; color: #7dd3fc; }
.hero__typed-word { grid-area: 1 / 1; white-space: nowrap; }
.hero__typed .ch { display: inline-block; }
.hero__typed-word.is-in .ch { animation: roll-in .56s cubic-bezier(.2, .9, .25, 1) calc(var(--i) * var(--in-step, 22ms) + var(--in-base, 0ms)) both; }
.hero__typed-word.is-out .ch { animation: roll-out .38s cubic-bezier(.5, 0, .75, 0) calc(var(--i) * var(--out-step, 14ms)) both; }
@keyframes roll-in { from { opacity: 0; transform: translateY(100%); } }
@keyframes roll-out { to { opacity: 0; transform: translateY(-100%); } }

/* Code line as a small glass terminal chip with a blinking cursor. */
.hero__code {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .35rem .8rem;
    border: 1px solid rgba(var(--glass-rgb), .8);
    border-radius: var(--radius-pill);
    background: rgba(var(--glass-rgb), .45);
    box-shadow: var(--shadow-sm);
    color: var(--text-dim);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}
.hero__code-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); box-shadow: 0 0 8px rgba(var(--success-rgb), .7); }
.hero__code-text.is-typing::after {
    content: "";
    display: inline-block;
    width: .5em;
    height: 1em;
    margin-left: 2px;
    vertical-align: -.15em;
    background: var(--accent);
    animation: caret-blink 1s steps(1) infinite;
}

/* Buttons: a light sweep across the primary button, and a magnetic pull toward the cursor. */
.btn-shine { position: relative; overflow: hidden; isolation: isolate; }
.btn-shine::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(110deg, transparent 30%, rgba(var(--glass-rgb), .45) 50%, transparent 70%);
    transform: translateX(-120%);
    animation: shine 4.5s var(--ease) 2s infinite;
    pointer-events: none;
}
@keyframes shine { 0%, 60% { transform: translateX(-120%); } 85%, 100% { transform: translateX(120%); } }
[data-magnetic] {
    transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease),
                background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
                translate .5s var(--ease-spring);
}
[data-magnetic].is-pulled { transition-duration: var(--dur-fast), var(--dur-fast), var(--dur-fast), var(--dur-fast), .15s; }

/* Hero stats under the buttons. */
.hero__stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .5rem clamp(1.25rem, 3vw, 2.25rem);
    margin: 2rem 0 0;
}
.hero__stat { display: flex; flex-direction: column-reverse; }
.hero__stat + .hero__stat { padding-left: clamp(1.25rem, 3vw, 2.25rem); border-left: 1px solid var(--line-strong); }
.hero__stat dd {
    margin: 0;
    font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -.03em;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-variant-numeric: tabular-nums;
}
.hero__stat dt { color: var(--text-dim); font-size: .78rem; font-weight: 600; letter-spacing: .02em; }
.hero--cover .hero__stat dt { color: rgba(255, 255, 255, .7); }
.hero--cover .hero__stat + .hero__stat { border-color: rgba(255, 255, 255, .2); }
.hero--cover .hero__stat dd { background-image: linear-gradient(120deg, #93c5fd, #7dd3fc); }
@media (min-width: 992px) {
    .hero:not(.hero--cover) .hero__stats,
    .hero--cover .hero__stats { justify-content: flex-start; }
}

/* Portrait: tilts in 3D toward the cursor anywhere over the hero. */
.hero__portrait { perspective: 1000px; }
.hero__portrait .halftone {
    transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
    transition: transform .6s var(--ease);
}

/* Portrait reveal: a click opens the real photo as a circle from the click point, sharpening as it
   settles; the dots fade on the canvas underneath (halftone-portrait.js). */
.halftone--reveal { position: relative; }
.halftone--reveal canvas { cursor: zoom-in !important; }
.halftone--reveal.is-revealed canvas { cursor: zoom-out !important; }
.halftone__photo {
    position: absolute;
    top: 50%;
    left: 50%;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    clip-path: circle(0% at var(--cx, 50%) var(--cy, 50%));
    transition: clip-path .8s cubic-bezier(.65, 0, .35, 1);
    pointer-events: none;
}
/* 110% reaches the far edge even from a click near the rim, without racing through the start. */
.is-revealed > .halftone__photo { clip-path: circle(110% at var(--cx, 50%) var(--cy, 50%)); }
.halftone__photo img {
    position: absolute;
    max-width: none;
    filter: blur(10px) saturate(1.2);
    transform: scale(1.08);
    transform-origin: var(--cx, 50%) var(--cy, 50%);
    transition: filter .8s var(--ease), transform .9s var(--ease);
}
.is-revealed > .halftone__photo img { filter: none; transform: none; }
@media (prefers-reduced-motion: reduce) {
    .halftone__photo, .halftone__photo img { transition: none; }
}

/* Section titles: words rise out of a mask. */
.section-title .word-mask { display: inline-block; overflow: hidden; padding-bottom: .08em; margin-bottom: -.08em; vertical-align: bottom; }
.section-title .word { display: inline-block; }

/* Skills marquee: every skill in an endless, edge-faded row. Pauses on hover. */
.marquee {
    display: flex;
    gap: .75rem;
    margin-bottom: 1.75rem;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.marquee__track {
    display: flex;
    flex: none;
    gap: .75rem;
    margin: 0;
    padding: .4rem 0;
    list-style: none;
    animation: marquee 40s linear infinite;
}
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee__item {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .55rem 1rem;
    border: 1px solid rgba(var(--glass-rgb), .85);
    border-radius: var(--radius-pill);
    background: linear-gradient(135deg, rgba(var(--glass-rgb), .7), rgba(var(--glass-rgb), .35));
    box-shadow: var(--glass-depth-sm);
    color: var(--heading);
    font-weight: 600;
    white-space: nowrap;
}
.marquee__item .bi { color: var(--accent); }
@keyframes marquee { to { transform: translateX(calc(-100% - .75rem)); } }

/* Jobs timeline: the line fills as you scroll, and each marker lights up when reached. */
[data-timeline-progress]::after {
    content: "";
    position: absolute;
    left: var(--tl-x);
    top: .5rem;
    bottom: .5rem;
    width: 3px;
    margin-left: -1px;
    border-radius: 3px;
    background: linear-gradient(180deg, var(--accent-2), var(--accent), rgb(var(--tint-3)));
    box-shadow: 0 0 12px rgba(var(--accent-rgb), .55);
    transform: scaleY(var(--progress, 0));
    transform-origin: 50% 0;
}
.motion [data-timeline-progress] .timeline__marker { transition: transform .4s var(--ease-spring), background-color .3s var(--ease), box-shadow .3s var(--ease); }
.motion [data-timeline-progress] .timeline__marker:not(.is-lit) { transform: scale(.7); box-shadow: none; border-color: rgba(var(--accent-rgb), .35); }
[data-timeline-progress] .timeline__marker.is-lit { z-index: 1; transform: scale(1.15); }

/* Dock: macOS-style magnification near the cursor (desktop). */
.dock__icon { transition: transform .35s var(--ease-spring), scale .2s var(--ease); }

/* Contact: the form card glows while you type. */
.form-card:focus-within { box-shadow: var(--glass-depth), 0 0 0 1px rgba(var(--accent-rgb), .25), 0 24px 60px -20px rgba(var(--accent-rgb), .45); }
.glass-input:focus { transform: translateY(-1px); }
.glass-input { transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease); }

/* Phones: the stats fill the space the scroll hint used. */
@media (max-width: 767.98px) {
    .hero:has(.hero__stats) .hero__scroll { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .marquee__track { animation: none; flex-wrap: wrap; }
    .marquee__track + .marquee__track { display: none; }
    .btn-shine::after { display: none; }
    [data-timeline-progress]::after { transform: none; }
}

/* Dark preset ("mode: dark" in Config/themes.php) -------------------------- */
html[data-mode="dark"] {
    color-scheme: dark;
    --heading: #f1f5f9;
    --text: #cbd5e1;
    --text-muted: #9aa8bd;
    --text-dim: #8391a7;
    --glass-rgb: 30, 41, 59;
    --canvas-mix: #000000;
    --glass-bg: linear-gradient(135deg, rgba(30, 41, 59, .62) 0%, rgba(15, 23, 42, .42) 100%);
    --glass-strong: rgba(30, 41, 59, .85);
    --glass-border: rgba(148, 163, 184, .16);
    --glass-highlight: rgba(148, 163, 184, .22);
    --line: rgba(148, 163, 184, .14);
    --line-strong: rgba(148, 163, 184, .26);
    --surface-1: rgba(30, 41, 59, .45);
    --surface-2: rgba(51, 65, 85, .6);
    --glass-depth: inset 0 1px 0 rgba(148, 163, 184, .14), 0 2px 6px rgba(0, 0, 0, .25), 0 24px 48px -24px rgba(0, 0, 0, .65);
    --glass-depth-sm: inset 0 1px 0 rgba(148, 163, 184, .12), 0 6px 16px -10px rgba(0, 0, 0, .55);
    --shadow-sm: 0 6px 20px -10px rgba(0, 0, 0, .55);
    --shadow: 0 24px 60px -24px rgba(0, 0, 0, .75);
}
html[data-mode="dark"] .glass,
html[data-mode="dark"] .glass-card,
html[data-mode="dark"] .skill-group { border-color: var(--glass-border); }
html[data-mode="dark"] .ambient__orb { opacity: .22; }
html[data-mode="dark"] .timeline__marker { background: var(--bg); }
html[data-mode="dark"] .btn-glass:hover,
html[data-mode="dark"] .btn-glass:focus-visible { border-color: rgba(148, 163, 184, .4); }
html[data-mode="dark"] .glass-input { border-color: rgba(148, 163, 184, .22); color: var(--text); }
html[data-mode="dark"] .dock { box-shadow: 0 10px 28px -14px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(148, 163, 184, .2); }
html[data-mode="dark"] .dock__bubble { box-shadow: 0 14px 28px -10px rgba(0, 0, 0, .6), 0 0 0 3px rgba(148, 163, 184, .12), inset 0 -6px 14px rgba(var(--accent-rgb), .25); }
html[data-mode="dark"] .hero__code-text.is-typing::after,
html[data-mode="dark"] .scroll-progress span { box-shadow: 0 0 14px rgba(var(--accent-rgb), .8); }
html[data-mode="dark"] .modal-backdrop { --bs-backdrop-bg: #000; }
/* Presets with their own gradient (rainbow, Eid) paint it on the main button and the progress lines. */
html[data-gradient] .btn-glass-primary,
html[data-gradient] .scroll-progress span,
html[data-gradient] [data-timeline-progress]::after { background: var(--gradient); }
html[data-gradient] .btn-glass-primary:hover,
html[data-gradient] .btn-glass-primary:focus-visible { background: var(--gradient); filter: saturate(1.15) brightness(1.05); }
/* Mourning preset ("mono"): the portrait and its coloured ring go greyscale. */
html[data-mono] .hero__portrait canvas { filter: grayscale(1) contrast(1.05); }
html[data-mono] .hero__code-dot { background: #737373; box-shadow: none; }
html[data-mono] .status-pill__dot.is-on { background: #525252; box-shadow: 0 0 0 4px rgba(82, 82, 82, .18); animation: none; }
html[data-mode="dark"] .sample-badge,
html[data-mode="dark"] .sample-note { color: #fbbf24; }

/* 15. Fallbacks & responsive -------------------------------------------- */
/* Without backdrop-filter, translucent panels would be hard to read; use near-solid surfaces. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .glass, .glass-card, .skill-group { background: rgba(var(--glass-rgb), .92); }
    .dock, .dock__bubble { background: rgba(var(--glass-rgb), .96); }
    .glass-modal { background: #fff; }
    .btn-glass, .filter-btn, .dock__label, .glass-toast { background: rgba(var(--glass-rgb), .95); }
}


@media (max-width: 767.98px) {
    :root { --dock-h: 46px; --dock-gap: 10px; }

    .hero__code { display: none; }

    .dock {
        --dock-pad: .2rem;
        --link-size: 40px;
        --bubble-size: 42px;
        --lift: 12px;
        width: calc(100% - 24px);
        max-width: 440px;
        padding-inline: .3rem;
    }
    .dock__list { justify-content: space-between; gap: .1rem; }
    .dock__item { flex: 1 1 0; min-width: 0; }
    .dock__link {
        width: 100%;
        border-radius: 999px;
    }
    .dock__link:hover,
    .dock__link:focus-visible { background: none; }
    .dock__icon { font-size: 1.02rem; }
    .dock__link.is-active .dock__icon { font-size: 1.1rem; }
    /* Mobile: icons only; the active item's name sits in the bar under its bubble. */
    .dock__label { display: none; }
    .dock__link.is-active .dock__label {
        display: block;
        top: calc(var(--link-size) + var(--lift) - 13px);
        bottom: auto;
        padding: 0;
        border: 0;
        background: none;
        box-shadow: none;
        color: var(--accent);
        font-size: .62rem;
        font-weight: 700;
        letter-spacing: .02em;
        opacity: 1;
        transform: translateX(-50%);
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }

    /* Filters become one swipeable row instead of wrapping onto several lines. */
    .filter-bar {
        flex-wrap: nowrap;
        justify-content: flex-start;
        margin-inline: calc(var(--bs-gutter-x, 1.5rem) * -.5);
        padding: .25rem calc(var(--bs-gutter-x, 1.5rem) * .5) .5rem;
        overflow-x: auto;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
        -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 24px), transparent);
        mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 24px), transparent);
    }
    .filter-bar::-webkit-scrollbar { display: none; }
    .filter-btn { flex: none; scroll-snap-align: start; }

    .timeline--jobs { --tl-pad: 1.6rem; --tl-x: .35rem; }
    .contact-item { grid-template-columns: 36px minmax(0, 1fr) auto; gap: .55rem; padding: .6rem .55rem; }
    .contact-item__icon { width: 36px; height: 36px; }
    .contact-item__value { font-size: .9rem; }
    /* Two buttons share the row on phones, so they get a little smaller. */
    .contact-item__actions { gap: .3rem; }
    .contact-item__actions .copy-btn { width: 34px; height: 34px; border-radius: 10px; }
    .form-foot .btn-submit { width: 100%; }
}

@media (max-width: 767.98px) {
    .hero__mist { --face-x: 50%; --face-y: 28%; --face-rx: 42%; --face-ry: 24%; }
}

@media (max-width: 359.98px) {
    .dock__icon { font-size: 1.05rem; }
    .hero__cta .btn { width: 100%; }
}

/* 16. Phone performance ------------------------------------------------ */
/* backdrop-filter re-blurs whatever is behind each element on every scroll frame, which phones
   can't keep up with when many cards are on screen. Here only the dock, the popup and toasts keep
   real blur; everything else uses a near-opaque glass colour, and the never-ending background
   drift stops. Desktop is unchanged. */
@media (max-width: 767.98px), (pointer: coarse) {
    .glass, .glass-card, .skill-group,
    .mini-panel, .skill-pill, .copy-btn, .icon-link-btn, .glass-input,
    .eyebrow, .btn-glass, .btn-glass-primary, .status-pill, .filter-btn,
    .sample-badge, .hero__code, .hero__avatar::after, .hero--cover .btn-glass,
    .pm-slider__nav, .pm-slider__dots {
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
    .glass, .glass-card, .skill-group { background: rgba(var(--glass-rgb), .9); }
    .eyebrow, .btn-glass, .status-pill, .filter-btn, .sample-badge, .hero__code,
    .mini-panel, .skill-pill, .copy-btn, .icon-link-btn, .glass-input { background-color: rgba(var(--glass-rgb), .88); }
    .hero--cover .btn-glass, .hero--cover .status-pill { background: rgba(15, 23, 42, .45); }
    .pm-slider__nav, .pm-slider__dots { background: rgba(var(--glass-rgb), .85); }

    /* Big blurred layers: keep them still and lighter to paint. */
    .ambient__orb { filter: blur(60px); animation: none; will-change: auto; }
    .hero__mist { -webkit-backdrop-filter: none; backdrop-filter: none; }
    .hero__mist::before, .hero__mist::after { animation: none; will-change: auto; filter: blur(24px); }
    .btn-shine::after { animation: none; display: none; }
}
