/* ========== RESET & TOKENS ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #08090d;              /* near-black, neutral */
    --bg-2: #0c0e14;
    --surface: #12141c;
    --surface-2: #1a1d28;
    --border: rgba(172, 205, 255, 0.22);
    --border-strong: rgba(172, 205, 255, 0.45);
    --border-soft: rgba(255, 255, 255, 0.06);

    --text: #f3f6fc;        /* brighter primary */
    --text-muted: #c5cdda;   /* was #93a0b8 — much more readable on busy bg */
    --text-dim: #8a93a8;     /* was #5e6a82 */

    --accent: #ACCDFF;          /* soft pastel blue (iOS/Vision-Pro-ish) */
    --accent-bright: #D4E4FF;
    --accent-soft: #E8F0FF;
    --accent-glow: rgba(172, 205, 255, 0.55);

    --grad-1: linear-gradient(135deg, #D4E4FF 0%, #ACCDFF 50%, #6F8FCC 100%);

    --glow: 0 0 32px rgba(172, 205, 255, 0.5);

    --font: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "Fira Code", ui-monospace, "Cascadia Code", monospace;

    --container: 1200px;
    --radius: 14px;
    --radius-lg: 20px;

    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-back: cubic-bezier(0.34, 1.56, 0.64, 1);

    /* ============================================================
       FLUID DESIGN TOKENS (utopia.fyi pattern)
       Math-derived: smoothly interpolates between min viewport (320px)
       and max viewport (1920px). Replace any per-breakpoint sizing.

       Type scale uses Major Third (1.25) on mobile, Perfect Fourth (1.333)
       on desktop — the same scale as Stripe / Linear / Vercel.
       ============================================================ */

    /* TYPE — body & UI text */
    --fs-xs:    clamp(0.75rem,  0.71rem + 0.20vw, 0.875rem);  /* 12 → 14 */
    --fs-sm:    clamp(0.875rem, 0.83rem + 0.23vw, 1rem);      /* 14 → 16 */
    --fs-base:  clamp(0.95rem,  0.91rem + 0.23vw, 1.125rem);  /* 15.2 → 18 */
    --fs-md:    clamp(1.0625rem,1rem + 0.31vw,    1.25rem);   /* 17 → 20 */
    --fs-lg:    clamp(1.25rem,  1.10rem + 0.78vw, 1.75rem);   /* 20 → 28 */

    /* TYPE — display / headings (max sizes bumped for big monitors) */
    --fs-h3:    clamp(1.375rem, 1rem    + 1.88vw, 2.75rem);   /* 22 → 44 */
    --fs-h2:    clamp(1.625rem, 1rem    + 3.13vw, 4rem);      /* 26 → 64 */
    --fs-h1:    clamp(1.75rem,  0.5rem  + 6.25vw, 6rem);      /* 28 → 96 */
    --fs-display: clamp(1.625rem, 0.5rem + 6.25vw, 8rem);     /* 26 → 128, hero */

    /* SPACE — paddings, margins, gaps */
    --space-3xs: clamp(0.25rem,  0.23rem + 0.08vw, 0.3125rem);  /* 4 → 5 */
    --space-2xs: clamp(0.5rem,   0.45rem + 0.23vw, 0.625rem);   /* 8 → 10 */
    --space-xs:  clamp(0.75rem,  0.7rem  + 0.25vw, 0.875rem);   /* 12 → 14 */
    --space-s:   clamp(1rem,     0.91rem + 0.47vw, 1.25rem);    /* 16 → 20 */
    --space-m:   clamp(1.5rem,   1.32rem + 0.94vw, 2rem);       /* 24 → 32 */
    --space-l:   clamp(2rem,     1.55rem + 2.34vw, 3.25rem);    /* 32 → 52 */
    --space-xl:  clamp(2.5rem,   1.5rem  + 5vw,    5rem);       /* 40 → 80 */
    --space-2xl: clamp(3.5rem,   2.27rem + 6.13vw, 6.75rem);    /* 56 → 108 */
    --space-3xl: clamp(5rem,     3.27rem + 8.62vw, 9.5rem);     /* 80 → 152 */

    /* INLINE PADDING — gutters that should never crowd content */
    --pad-inline: clamp(1rem, 0.5rem + 2.5vw, 1.75rem);         /* 16 → 28 */
}

html {
    /* Lenis takes over smooth scrolling — native must be auto */
    scroll-behavior: auto;
    scrollbar-color: var(--accent) var(--bg);
    scrollbar-width: thin;
    /* Backdrop color belongs on html so #bg-canvas (z-index: -1) stays visible
       even when descendants create stacking contexts via transform/opacity. */
    background: var(--bg);
}
html.lenis,
html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-scrolling iframe { pointer-events: none; }

/* WebKit (Chrome / Edge / Safari) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track {
    background: var(--bg);
}
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--accent), #6F8FCC);
    border-radius: 100px;
    border: 2px solid var(--bg);
    box-shadow: inset 0 0 6px rgba(172, 205, 255, 0.4);
}
::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--accent-bright), var(--accent));
}
::-webkit-scrollbar-corner { background: var(--bg); }
/* Hide native scrollbar arrow buttons (Windows-only Chromium quirk) —
   they were the leftover yellow triangles at top/bottom that didn't sync. */
::-webkit-scrollbar-button { display: none; height: 0; width: 0; }

body {
    font-family: var(--font);
    background: transparent;  /* let html bg show through; bg-canvas paints above */
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    cursor: none;
    font-feature-settings: "ss01", "ss02", "cv11";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Body paragraphs get a subtle dark halo so they stay legible
   over the busy particle network. */
.about-text p,
.lead,
.timeline-card p,
.contact-note,
.project-info p,
.preview-desc,
.skill-card > p,
.hero-sub {
    font-weight: 500;
    text-shadow:
        0 1px 2px rgba(0, 0, 0, 0.7),
        0 0 18px rgba(0, 0, 0, 0.5);
}

/* Force a stacking context isolation so transforms inside main can't
   accidentally promote html's bg above the fixed bg-canvas. */
main { position: relative; z-index: 1; }

@media (max-width: 768px) {
    body { cursor: auto; }
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { border: 0; background: none; color: inherit; font: inherit; cursor: none; }
ul, ol { list-style: none; }
input, textarea { font: inherit; color: inherit; }

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

/* ========== LANG TOGGLE ========== */
.lang-toggle {
    position: fixed;
    bottom: 20px;
    right: 76px;        /* sit beside the theme picker (right: 20 + width 44 + gap 12) */
    z-index: 9990;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    color: var(--accent);
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    cursor: none;
    transition: all 0.25s var(--ease);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: grid;
    place-items: center;
}
.lang-toggle:hover {
    background: var(--surface-2);
    transform: scale(1.08);
    box-shadow: var(--glow);
}
.lang-flag {
    pointer-events: none;
    transition: transform 0.4s var(--ease-back);
}

/* ========== THEME PICKER ========== */
.theme-picker {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9990;
}
.theme-toggle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    color: var(--accent);
    display: grid;
    place-items: center;
    cursor: none;
    transition: all 0.25s var(--ease);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.theme-toggle:hover {
    background: var(--surface-2);
    transform: scale(1.08) rotate(-15deg);
    box-shadow: var(--glow);
}
.theme-panel {
    position: absolute;
    bottom: 56px;
    right: 0;
    background: rgba(20, 20, 28, 0.92);
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    padding: 14px;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow: 0 14px 40px -10px rgba(0,0,0,0.7), var(--glow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px) scale(0.95);
    transform-origin: bottom right;
    transition: opacity 0.2s, transform 0.25s var(--ease-back), visibility 0s linear 0.2s;
}
.theme-panel.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    transition: opacity 0.2s, transform 0.25s var(--ease-back), visibility 0s;
}
.theme-panel-title {
    font-size: 10px;
    color: var(--text-dim);
    letter-spacing: 0.2em;
    margin-bottom: 8px;
}
.theme-swatches {
    display: grid;
    grid-template-columns: repeat(4, 28px);
    gap: 8px;
}
.swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: none;
    transition: 0.2s;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.08), inset 0 0 6px rgba(0,0,0,0.2);
}
.swatch:hover { transform: scale(1.18); }
.swatch.active {
    border-color: white;
    transform: scale(1.12);
    box-shadow: 0 0 0 1px rgba(255,255,255,0.4), 0 0 12px currentColor;
}

/* ========== BOOT SPLASH ========== */
.boot-splash {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease, visibility 0s linear 0.6s;
}
.boot-splash.done {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.boot-inner {
    width: min(560px, 90vw);
    padding: 32px;
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    background:
        radial-gradient(circle at 50% 0%, rgba(172,205,255,0.08), transparent 60%),
        var(--surface);
    box-shadow: var(--glow);
}
.boot-logo {
    font-size: 18px;
    color: var(--accent);
    font-weight: 700;
    margin-bottom: 18px;
    letter-spacing: -0.01em;
}
.boot-log {
    font-size: 12px;
    line-height: 1.7;
    color: var(--text-muted);
    min-height: 140px;
    margin-bottom: 18px;
    white-space: pre-wrap;
}
.boot-log .ok    { color: var(--accent); }
.boot-log .ok::before { content: "[ OK ] "; }
.boot-log .info::before  { content: "[ .. ] "; color: var(--text-dim); }
.boot-bar {
    width: 100%;
    height: 3px;
    background: rgba(172,205,255,0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 16px;
}
.boot-bar #boot-bar-fill {
    display: block;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent-bright));
    box-shadow: 0 0 10px var(--accent);
    transition: width 0.15s linear;
}
.boot-tip {
    font-size: 11px;
    color: var(--text-dim);
    text-align: center;
}
.boot-tip kbd {
    display: inline-block;
    padding: 2px 6px;
    background: rgba(172,205,255,0.06);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--accent);
    font-family: var(--mono);
    font-size: 10px;
    margin: 0 1px;
}

/* ========== KONAMI RAINBOW MODE ==========
   IMPORTANT: do NOT put `filter` on body or html — that turns them into the
   containing block for `position: fixed` descendants (incl. #bg-canvas),
   so the network bg detaches from the viewport and slides off-screen on scroll.
   Apply the filter to each visible element individually instead. */
body.rainbow-mode #bg-canvas,
body.rainbow-mode nav,
body.rainbow-mode main,
body.rainbow-mode footer,
body.rainbow-mode .scroll-progress,
body.rainbow-mode .cursor-dot,
body.rainbow-mode .cursor-ring,
body.rainbow-mode .scanlines {
    animation: rainbow-shift 8s linear infinite;
}
@keyframes rainbow-shift {
    0%   { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

/* Scrollbar — synced 8s rainbow cycle (Chromium / Edge / Safari).
   Native scrollbars don't inherit `filter` from ancestors, so we animate
   the thumb's gradient directly through the HSL spectrum. */
body.rainbow-mode ::-webkit-scrollbar-thumb {
    animation: scrollbar-rainbow 8s linear infinite;
}
@keyframes scrollbar-rainbow {
    0%   { background: linear-gradient(180deg, hsl( 50,100%,58%), hsl( 40,100%,45%)); }
    14%  { background: linear-gradient(180deg, hsl(100,100%,58%), hsl( 90,100%,45%)); }
    28%  { background: linear-gradient(180deg, hsl(160,100%,58%), hsl(150,100%,45%)); }
    42%  { background: linear-gradient(180deg, hsl(220,100%,62%), hsl(210,100%,48%)); }
    57%  { background: linear-gradient(180deg, hsl(280,100%,62%), hsl(270,100%,48%)); }
    71%  { background: linear-gradient(180deg, hsl(340,100%,60%), hsl(330,100%,46%)); }
    85%  { background: linear-gradient(180deg, hsl( 30,100%,58%), hsl( 20,100%,45%)); }
    100% { background: linear-gradient(180deg, hsl( 50,100%,58%), hsl( 40,100%,45%)); }
}

/* Firefox — animate `scrollbar-color` on body. This only animates the
   scrollbar-color property itself; nothing here creates a containing block,
   so #bg-canvas's `position: fixed` stays bound to the viewport. */
body.rainbow-mode {
    animation: scrollbar-color-rainbow 8s linear infinite;
}
@keyframes scrollbar-color-rainbow {
    0%   { scrollbar-color: hsl( 50, 100%, 55%) var(--bg); }
    14%  { scrollbar-color: hsl(100, 100%, 55%) var(--bg); }
    28%  { scrollbar-color: hsl(160, 100%, 55%) var(--bg); }
    42%  { scrollbar-color: hsl(220, 100%, 60%) var(--bg); }
    57%  { scrollbar-color: hsl(280, 100%, 60%) var(--bg); }
    71%  { scrollbar-color: hsl(340, 100%, 58%) var(--bg); }
    85%  { scrollbar-color: hsl( 30, 100%, 55%) var(--bg); }
    100% { scrollbar-color: hsl( 50, 100%, 55%) var(--bg); }
}
.rainbow-burst {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    top: 50%; left: 50%;
    width: 6px; height: 6px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: rainbow-particle 1.6s var(--ease) forwards;
}
@keyframes rainbow-particle {
    0%   { opacity: 1; transform: translate(-50%, -50%) scale(0.5); }
    100% { opacity: 0; transform: translate(var(--tx, 0), var(--ty, 0)) scale(1.5); }
}

/* ========== SCANLINES + GLITCH ========== */
.scanlines {
    position: fixed;
    inset: 0;
    z-index: 9000;
    pointer-events: none;
    background:
        repeating-linear-gradient(
            0deg,
            rgba(172, 205, 255, 0.025) 0px,
            rgba(172, 205, 255, 0.025) 1px,
            transparent 1px,
            transparent 3px
        );
    mix-blend-mode: overlay;
    opacity: 0.6;
    animation: scanline-flicker 8s infinite;
}
@keyframes scanline-flicker {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 0.45; }
    52% { opacity: 0.7; }
    54% { opacity: 0.5; }
}
.glitch-overlay {
    position: fixed;
    inset: 0;
    z-index: 9001;
    pointer-events: none;
    opacity: 0;
    background:
        linear-gradient(90deg,
            rgba(255, 0, 100, 0.08) 0%,
            transparent 30%,
            transparent 70%,
            rgba(0, 200, 255, 0.08) 100%
        );
    mix-blend-mode: screen;
}
.glitch-overlay.active {
    animation: glitch-burst 0.45s steps(8) forwards;
}
@keyframes glitch-burst {
    0%   { opacity: 0; transform: translateX(0); }
    20%  { opacity: 0.9; transform: translateX(-3px); }
    40%  { opacity: 0.6; transform: translateX(4px); }
    60%  { opacity: 0.85; transform: translateX(-2px); }
    80%  { opacity: 0.4; transform: translateX(2px); }
    100% { opacity: 0; transform: translateX(0); }
}

/* Site-wide subtle glitch on text shadows */
.glitching {
    animation: chromatic-jitter 0.3s steps(6) !important;
}
@keyframes chromatic-jitter {
    0%, 100% { text-shadow: none; transform: translate(0); }
    33%      { text-shadow: -2px 0 #ff0064, 2px 0 #00d9ff; transform: translate(1px, 0); }
    66%      { text-shadow: 2px 0 #ff0064, -2px 0 #00d9ff; transform: translate(-1px, 0); }
}

/* Hover-triggered holographic glitch (project/skill names) */
.glitch-hover { cursor: none; transition: color 0.2s; }
.glitch-hover:hover { color: var(--accent); }
.glitch-hover.is-glitching {
    animation: holo-glitch 0.5s steps(8) forwards;
}
@keyframes holo-glitch {
    0%   { text-shadow: -3px 0 #ff0064, 3px 0 #00ffff; transform: translateX(-2px); }
    20%  { text-shadow: 3px 0 #ff0064, -3px 0 #00ffff; transform: translateX(2px); }
    40%  { text-shadow: -2px 0 #00ffff, 2px 0 #ff66c4; transform: translateX(-1px); }
    60%  { text-shadow: 2px 0 #ff66c4, -2px 0 #00ffff; transform: translateX(1px); }
    80%  { text-shadow: -1px 0 #ff0064, 1px 0 #00ffff; transform: translateX(0); }
    100% { text-shadow: none; transform: translateX(0); }
}

/* ========== SCROLL PROGRESS ========== */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 0%;
    background: linear-gradient(90deg, transparent, var(--accent) 30%, var(--accent-bright));
    z-index: 9998;
    pointer-events: none;
    box-shadow: 0 0 10px var(--accent), 0 0 20px var(--accent-glow);
    transition: width 0.05s linear;
}

/* ========== GHOST SPOTLIGHT (auto-sweep on hero title) ========== */
.ghost-spotlight {
    position: fixed;
    top: 0; left: 0;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgba(172, 205, 255, 0.32) 0%,
        rgba(172, 205, 255, 0.12) 30%,
        transparent 65%
    );
    pointer-events: none;
    z-index: 9996;
    mix-blend-mode: screen;
    will-change: transform, opacity;
    opacity: 1;
    transition: opacity 0.6s ease;
}
@media (max-width: 768px) {
    .ghost-spotlight { display: none; }
}

/* ========== CURSOR SPARKLE TRAIL ========== */
.cursor-sparkle {
    position: fixed;
    top: 0; left: 0;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent), 0 0 4px var(--accent-bright);
    pointer-events: none;
    z-index: 9996;
    transform: translate(-50%, -50%);
    animation: sparkle-fade 0.85s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    will-change: opacity, transform;
}
@keyframes sparkle-fade {
    0% {
        opacity: 0.95;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 0.6;
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.2);
    }
}
@media (max-width: 768px) {
    .cursor-sparkle { display: none; }
}

/* ========== CURSOR SPOTLIGHT ========== */
.cursor-spotlight {
    position: fixed;
    top: 0; left: 0;
    width: 540px;
    height: 540px;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgba(172, 205, 255, 0.18) 0%,
        rgba(172, 205, 255, 0.08) 35%,
        transparent 70%
    );
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 9997;
    mix-blend-mode: screen;
    will-change: transform;
    opacity: 0;
    transition: opacity 0.4s ease;
}
.cursor-spotlight.visible { opacity: 1; }
@media (max-width: 768px) {
    .cursor-spotlight { display: none; }
}

/* ========== CUSTOM CURSOR ========== */
.cursor-dot, .cursor-ring {
    position: fixed;
    top: 0; left: 0;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    will-change: transform;
}
.cursor-dot {
    width: 6px; height: 6px;
    background: var(--accent);
    box-shadow: 0 0 14px var(--accent), 0 0 4px var(--accent);
}
.cursor-ring {
    width: 32px; height: 32px;
    border: 1.5px solid rgba(172, 205, 255, 0.5);
    transition: width 0.25s var(--ease), height 0.25s var(--ease), border-color 0.25s var(--ease), background 0.25s var(--ease);
}
.cursor-ring.hover {
    width: 56px; height: 56px;
    background: rgba(172, 205, 255, 0.08);
    border-color: var(--accent);
}
@media (max-width: 768px) {
    .cursor-dot, .cursor-ring { display: none; }
}

/* ========== BG CANVAS ========== */
#bg-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    display: block;
}

/* ========== NAV ========== */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 20px max(28px, 5vw);
    background: rgba(5, 5, 7, 0.72);
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s, background 0.3s;
}
.nav.scrolled {
    border-bottom-color: var(--border-soft);
    background: rgba(5, 5, 7, 0.92);
}

.nav-logo {
    font-family: var(--mono);
    font-weight: 700;
    font-size: 16px;
    color: var(--accent);
    letter-spacing: -0.01em;
}
.nav-links {
    display: flex;
    gap: 4px;
    margin-left: auto;
    margin-right: 12px;
}
.nav-links a {
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    border-radius: 8px;
    position: relative;
    transition: color 0.2s;
}
.nav-links a::after {
    content: "";
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 18px; height: 2px;
    background: var(--accent);
    border-radius: 2px;
    transition: transform 0.3s var(--ease);
}
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--accent); }
.nav-links a.active::after { transform: translateX(-50%) scaleX(1); }

.nav-burger { display: none; flex-direction: column; gap: 5px; padding: 8px; }
.nav-burger span { display: block; width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: 0.2s; }

@media (max-width: 880px) {
    .nav { padding: 16px 20px; }
    .nav-links { display: none; }
    /* `!important` is OK here because `.nav-cta` has no `.open` state — only
       `.nav-links.open` needs to be free of `!important` to drop down. */
    .nav .nav-cta { display: none !important; }
    .nav-burger { display: flex; }
    .nav-links.open {
        display: flex; flex-direction: column;
        position: absolute; top: 100%; left: 16px; right: 16px;
        background: var(--surface); margin-right: 0; margin-left: 0;
        padding: 16px; border: 1px solid var(--border-soft); border-radius: 14px;
        gap: 4px;
    }
    .nav-links.open a { padding: 10px 14px; }
}

/* ========== BUTTONS ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 13px 26px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.25s var(--ease);
    cursor: none;
    border: 1px solid transparent;
    position: relative;
    white-space: nowrap;
}
.btn.big { padding: 16px 32px; font-size: 15px; }
.btn-primary {
    background: var(--accent);
    color: var(--bg);
}
.btn-primary:hover {
    background: var(--accent-bright);
    box-shadow: var(--glow), 0 8px 28px -8px rgba(172, 205, 255, 0.6);
    transform: translateY(-2px);
}

/* btn-glow — extra-prominent primary action (hero "Open License Manager")
   Always-on glow + subtle pulse to grab attention; arrow nudges on hover. */
.btn-glow {
    background: linear-gradient(135deg, var(--accent-bright), var(--accent));
    color: var(--bg);
    box-shadow:
        0 0 0 1px rgba(172, 205, 255, 0.4),
        0 8px 24px -6px var(--accent-glow),
        0 0 32px -8px var(--accent);
    animation: btn-glow-pulse 2.6s ease-in-out infinite;
    font-weight: 700;
}
.btn-glow:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow:
        0 0 0 1px var(--accent-bright),
        0 14px 36px -6px var(--accent-glow),
        0 0 48px -4px var(--accent);
    animation-play-state: paused;
}
.btn-glow svg { transition: transform 0.3s var(--ease-back); }
.btn-glow:hover svg { transform: translateX(4px); }

@keyframes btn-glow-pulse {
    0%, 100% {
        box-shadow:
            0 0 0 1px rgba(172, 205, 255, 0.4),
            0 8px 24px -6px var(--accent-glow),
            0 0 32px -8px var(--accent);
    }
    50% {
        box-shadow:
            0 0 0 1px rgba(172, 205, 255, 0.55),
            0 10px 28px -4px var(--accent-glow),
            0 0 44px -4px var(--accent);
    }
}

/* btn-ghost — subtle text-style button (used for tertiary actions) */
.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: transparent;
}
.btn-ghost:hover {
    color: var(--accent);
    background: rgba(172, 205, 255, 0.06);
}
.btn-outline {
    background: transparent;
    color: var(--accent);
    border-color: var(--accent);
}
.btn-outline:hover {
    background: rgba(172, 205, 255, 0.08);
    box-shadow: var(--glow);
    transform: translateY(-2px);
}
.arrow { display: inline-block; transition: transform 0.25s var(--ease); }
.btn:hover .arrow { transform: translate(2px, -2px); }
.nav-cta { padding: 9px 18px; font-size: 13px; }

/* ========== TYPOGRAPHY ========== */
.mono { font-family: var(--mono); }

.kicker {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.25em;
    margin-bottom: 16px;
}

.section-title {
    font-size: var(--fs-h2);  /* 26→48px from token system */
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.025em;
    overflow-wrap: break-word;
    max-width: 100%;
    text-shadow:
        0 2px 8px rgba(0, 0, 0, 0.7),
        0 0 24px rgba(0, 0, 0, 0.45);
}
.section-title .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(80%) rotateX(-90deg);
    transform-origin: 50% 100%;
    will-change: transform, opacity;
}
.section-title .char.is-shown {
    animation: char-rise 0.7s var(--ease-back) forwards;
}
/* `inline-block` children break the parent's `background-clip: text`.
   When chars sit inside a .gradient-text, they need to carry the gradient
   themselves — otherwise they inherit only the transparent fill and vanish. */
.section-title .gradient-text .char {
    background: var(--grad-1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}
@keyframes char-rise {
    to { opacity: 1; transform: translateY(0) rotateX(0); }
}
.gradient-text {
    background: var(--grad-1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Letter burst particles — fired from hovered letter */
.letter-burst {
    position: fixed;
    top: 0; left: 0;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent), 0 0 4px var(--accent-bright);
    pointer-events: none;
    z-index: 9995;
    transform: translate(-50%, -50%);
    will-change: transform, opacity;
    animation: burst-fly var(--dur, 1s) cubic-bezier(0.18, 0.7, 0.4, 1) forwards;
}
@keyframes burst-fly {
    0%   { opacity: 1; transform: translate(-50%, -50%) translate(0, 0) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) translate(var(--dx, 0), var(--dy, 0)) scale(0.2); }
}

/* "S. SHAJON" — 3D-perspective container for magnetic letters */
.hero-title .gradient-text {
    transform-style: preserve-3d;
    perspective: 800px;
}

/* Each letter carries its own clipped gradient + shimmer animation
   (background-clip: text on parent breaks when children are inline-block,
    so we apply it per-letter instead). */
.magnetic-letter {
    display: inline-block;
    background: linear-gradient(
        110deg,
        var(--accent-soft)   0%,
        var(--accent)       25%,
        var(--accent-bright) 50%,
        var(--accent)       75%,
        var(--accent-soft) 100%
    );
    background-size: 220% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    will-change: transform, background-position, filter;
    animation: hero-shimmer 4.5s ease-in-out infinite;
}
@keyframes hero-shimmer {
    0%, 100% {
        background-position: 0% 50%;
        filter: brightness(1)    drop-shadow(0 0 6px rgba(172, 205, 255, 0));
    }
    50% {
        background-position: 100% 50%;
        filter: brightness(1.25) drop-shadow(0 0 22px var(--accent-glow));
    }
}

/* Letter sweep — runs once on page load, traveling L→R across the title */
.magnetic-letter.swept {
    animation: hero-shimmer 4.5s ease-in-out infinite, letter-sweep 0.7s ease-out;
}
@keyframes letter-sweep {
    0%   {
        filter: brightness(1) drop-shadow(0 0 0 transparent);
        transform: translate3d(0, 0, 0) scale(1);
    }
    40%  {
        filter: brightness(1.8) drop-shadow(0 0 32px var(--accent-bright)) drop-shadow(0 0 12px var(--accent));
        transform: translate3d(0, -3px, 30px) scale(1.06);
    }
    100% {
        filter: brightness(1) drop-shadow(0 0 0 transparent);
        transform: translate3d(0, 0, 0) scale(1);
    }
}
.hl { color: var(--accent); font-weight: 600; }

/* ========== HERO ========== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    /* All paddings from token system — vertical fluid via vh, horizontal via shared --pad-inline */
    padding-block: clamp(96px, 13vh, 150px) clamp(50px, 7vh, 90px);
    padding-inline: var(--pad-inline);
    text-align: center;
}
.hero-tilt {
    transform-style: preserve-3d;
    transform:
        perspective(1200px)
        rotateX(var(--ty, 0deg))
        rotateY(var(--tx, 0deg))
        scale(var(--scroll-scale, 1));
    filter: blur(var(--scroll-blur, 0px));
    opacity: var(--scroll-opacity, 1);
    transition: transform 0.15s ease-out;
    will-change: transform, filter, opacity;
    position: relative;
    z-index: 2;
    /* `.hero` is `display: flex; justify-content: center` — that's what
       centers hero-tilt. Don't add nested flex here; the perspective
       transform combined with extra flex caused content overflow on iPad. */
}

/* Floating skill tags — orbiting decorative chips at varied 3D depth */
.hero-floats {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    perspective: 800px;
    transform-style: preserve-3d;
}
.float-tag {
    position: absolute;
    left: calc(var(--x, 50) * 1%);
    top: calc(var(--y, 50) * 1%);
    transform: translate(-50%, -50%) translateZ(var(--z, 0px));
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 500;
    padding: 5px 12px;
    background: rgba(172, 205, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 100px;
    color: var(--accent);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0.55;
    white-space: nowrap;
    animation: float-bob var(--dur, 6s) ease-in-out infinite;
    animation-delay: var(--delay, 0s);
}
.float-tag::before {
    content: "//";
    color: var(--text-dim);
    margin-right: 6px;
    font-weight: 700;
}
@keyframes float-bob {
    0%, 100% { transform: translate(-50%, -50%) translateZ(var(--z, 0px)) translateY(0); }
    50%      { transform: translate(-50%, -50%) translateZ(var(--z, 0px)) translateY(-12px); }
}
@media (max-width: 880px) {
    .hero-floats { display: none; }
}
.hero-inner {
    max-width: 920px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
}
.hero-title {
    /* Uses --fs-display token: 26→88px math-derived, fits all viewports */
    font-size: var(--fs-display);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin-bottom: 0;
    overflow-wrap: anywhere;
    word-wrap: break-word;
    max-width: 100%;
}
/* On narrow screens, allow the gradient word "HuySoftware" itself to break
   between letter spans rather than overflow the viewport. */
@media (max-width: 600px) {
    .hero-title .gradient-text {
        word-break: break-word;
    }
}
/* Keep "HuySoftware" letters together as a unit, but ALLOW the whole word
   to wrap to its own line if there isn't enough room (prevents iPad overflow).
   `display: inline-block` + `max-width: 100%` makes the box wrap as a single
   inline-block when the parent line is too narrow. */
.hero-title .gradient-text {
    display: inline-block;
    max-width: 100%;
    white-space: nowrap;
}
@media (max-width: 880px) {
    /* On small viewports give the title room to break BEFORE the gradient word */
    .hero-title { line-height: 1.15; }
    .hero-title .gradient-text { white-space: normal; }
    /* But individual letter spans must still travel together visually —
       we accept they may break on extreme narrow widths in exchange for fit. */
}
.hero-role {
    font-family: var(--mono);
    font-size: clamp(16px, 2vw, 22px);
    color: var(--text-muted);
}
.role-typed { color: var(--accent); font-weight: 600; }
.caret {
    display: inline-block;
    color: var(--accent);
    margin-left: 4px;
    animation: blink 0.9s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.hero-sub {
    max-width: 600px;
    color: var(--text-muted);
    font-size: clamp(15px, 1.4vw, 17px);
    line-height: 1.65;
}
.hero-cta {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 8px;
}

.scroll-indicator {
    position: absolute;
    bottom: 36px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    font-size: 11px;
    color: var(--text-dim);
    letter-spacing: 0.25em;
}
.scroll-line {
    width: 1px; height: 40px;
    background: linear-gradient(to bottom, var(--accent), transparent);
    animation: scrollPulse 2.2s ease-in-out infinite;
}
@keyframes scrollPulse {
    0%, 100% { opacity: 1; transform: scaleY(1); }
    50% { opacity: 0.4; transform: scaleY(0.6); }
}

/* ========== STATS STRIP (right after hero) ========== */
.stats-strip {
    max-width: var(--container);
    margin: 0 auto;
    padding: 40px 24px 60px;
    position: relative;
}
.stats-grid {
    display: grid;
    /* Auto-fit: 4 cols on wide, 2 on tablet, 1 on small phone — no breakpoints */
    grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr));
    gap: clamp(14px, 2vw, 22px);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: clamp(20px, 3vw, 36px) clamp(16px, 2.5vw, 28px);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.stat-cell {
    text-align: center;
    position: relative;
}
.stat-cell + .stat-cell::before {
    content: "";
    position: absolute;
    left: 0; top: 14%;
    bottom: 14%;
    width: 1px;
    background: linear-gradient(to bottom, transparent, var(--border-strong), transparent);
}
.stat-num {
    font-family: var(--font);
    /* Single fluid value covers 320px to 1920+px viewports */
    font-size: clamp(26px, 4.5vw, 52px);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
    background: var(--grad-1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: clamp(6px, 0.8vw, 10px);
}
.stat-num .stat-count,
.stat-num .stat-unit {
    background: inherit;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.stat-label {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-dim);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

@media (max-width: 880px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 22px 14px;
        padding: 26px 18px;
    }
    .stat-cell + .stat-cell::before { display: none; }
}
@media (max-width: 600px) {
    .stats-grid {
        gap: 18px 12px;
        padding: 22px 14px;
    }
    .stat-num { font-size: clamp(26px, 7.5vw, 36px); }
    .stat-label { font-size: 10.5px; letter-spacing: 0.08em; }
}
/* Only fall to 1-col on very small phones */
@media (max-width: 360px) {
    .stats-grid { grid-template-columns: 1fr; gap: 16px; }
}

/* ========== SECTIONS ========== */
.section {
    max-width: var(--container);
    margin: 0 auto;
    padding-block: var(--space-2xl);   /* 56→108px */
    padding-inline: var(--pad-inline); /* 16→28px */
    position: relative;
}
.section-head { margin-bottom: clamp(36px, 5vw, 56px); }
.section-head.center { text-align: center; }

/* ========== ABOUT ========== */
.about { position: relative; }
#about-bg-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.55;
}
.about-grid { position: relative; z-index: 1; }
.about-grid {
    display: grid;
    /* Auto-fit: 2 cols on desktop, 1 col on tablet/phone — no breakpoints */
    grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
    gap: clamp(36px, 5vw, 80px);
    align-items: center;
}
.about-text { display: flex; flex-direction: column; gap: 20px; }
.about-text .kicker { margin-bottom: 0; }
.about-text .section-title { margin-bottom: 8px; }
.about-text p {
    color: var(--text-muted);
    font-size: 15.5px;
    line-height: 1.75;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.tag-list li {
    font-family: var(--mono);
    font-size: 12px;
    padding: 5px 12px;
    color: var(--accent);
    background: rgba(172, 205, 255, 0.08);
    border: 1px solid var(--border-strong);
    border-radius: 100px;
    transition: 0.2s;
}
.tag-list li:hover { background: rgba(172, 205, 255, 0.18); }
.tag-list.small li { font-size: 11px; padding: 3px 9px; }

.about-visual {
    position: relative;
    height: 380px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    cursor: none;
}
#cube-canvas {
    display: block;
    width: 100%;
    height: 100%;
    max-height: 320px;
}
.cube-hint {
    font-size: 11.5px;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-top: 6px;
}

@media (max-width: 880px) {
    .about-grid { grid-template-columns: 1fr; gap: 40px; }
}

/* ========== SKILLS ========== */
.skills-grid {
    display: grid;
    /* Auto-fit: column count adapts to viewport. Each card is at least 130px,
       so 5 cols at desktop, 4 at tablet, 3 at large phone, 2 at small phone —
       all without media queries. */
    grid-template-columns: repeat(auto-fit, minmax(min(130px, 100%), 1fr));
    gap: clamp(10px, 1.2vw, 16px);
}

.skill-card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    /* Fluid padding scales with the card itself */
    padding: clamp(16px, 2vw, 24px) clamp(10px, 1.4vw, 16px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: all 0.3s var(--ease);
    position: relative;
    overflow: hidden;
}
.skill-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 0%, rgba(172, 205, 255, 0.12), transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}
.skill-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-strong);
    box-shadow: 0 14px 30px -12px rgba(172, 205, 255, 0.15);
}
.skill-card:hover::before { opacity: 1; }
.skill-card i,
.skill-card .skill-emoji,
.skill-card .skill-svg {
    font-size: clamp(28px, 3vw, 36px);
    color: var(--text);
    transition: transform 0.4s var(--ease-back);
    z-index: 1;
}
.skill-card .skill-svg {
    width: clamp(28px, 3vw, 36px);
    height: clamp(28px, 3vw, 36px);
    color: var(--accent);
    display: block;
}
.skill-card:hover i,
.skill-card:hover .skill-emoji,
.skill-card:hover .skill-svg { transform: scale(1.15) rotate(-5deg); }
.skill-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    z-index: 1;
}
.skill-cat {
    font-size: 10.5px;
    color: var(--text-dim);
    letter-spacing: 0.05em;
    z-index: 1;
}

/* ========== PROJECTS ========== */
.project-tabs {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 100px;
    margin-bottom: 40px;
}
.tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    border-radius: 100px;
    transition: 0.25s var(--ease);
}
.tab.active {
    background: var(--surface-2);
    color: var(--text);
    box-shadow: 0 0 0 1px var(--border-soft);
}
.tab-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    box-shadow: 0 0 8px currentColor;
}

.projects-grid {
    display: grid;
    /* Auto-fit: 2 cols when each card has 320px+, else 1 col */
    grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
    gap: clamp(16px, 2vw, 24px);
}

/* ========== FEATURED PROJECT (large 2-col card) ========== */
.project-feature {
    display: grid;
    /* Auto-fit: 2 cols when each side has 320px+, else stacks 1 col */
    grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
    gap: clamp(24px, 4vw, 50px);
    align-items: center;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: clamp(24px, 3.5vw, 44px);
    margin-bottom: clamp(18px, 2vw, 28px);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    position: relative;
    overflow: hidden;
}
.project-feature::before {
    content: "";
    position: absolute;
    top: -100px; right: -100px;
    width: 320px; height: 320px;
    background: radial-gradient(circle, var(--accent-glow), transparent 70%);
    pointer-events: none;
    opacity: 0.4;
}
.project-feature-info { position: relative; z-index: 1; }
.project-tag {
    font-size: 11px;
    color: var(--accent);
    letter-spacing: 0.18em;
    margin-bottom: 14px;
}
.project-feature h3 {
    font-size: clamp(22px, 3vw, 30px);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin-bottom: 14px;
}
.project-feature p {
    color: var(--text-muted);
    margin-bottom: 20px;
    font-size: 14.5px;
    line-height: 1.7;
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}
.project-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}
.project-stack li {
    font-family: var(--mono);
    font-size: 11px;
    padding: 4px 11px;
    background: rgba(172, 205, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: 100px;
    color: var(--text-muted);
}
.project-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Right column: animated code window */
.project-feature-art { position: relative; z-index: 1; }
.art-window {
    background: #0a0d14;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 50px -20px rgba(0,0,0,0.6);
}
.art-bar {
    display: flex;
    gap: 6px;
    padding: 10px 14px;
    background: rgba(255,255,255,0.03);
    border-bottom: 1px solid var(--border-soft);
}
.art-bar span {
    width: 11px; height: 11px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
}
.art-bar span:first-child { background: #ff5f57; }
.art-bar span:nth-child(2) { background: #febc2e; }
.art-bar span:nth-child(3) { background: #28c840; }
.art-body { padding: 22px; }
.art-body pre {
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.85;
    color: var(--text-muted);
    white-space: pre-wrap;
    margin: 0;
}
.t-key { color: #c084fc; }
.t-fn  { color: var(--accent); }
.t-str { color: #4ade80; }
.t-num { color: #fbbf24; }
.t-com { color: var(--text-dim); font-style: italic; }

/* btn-ghost — small alt button used in featured project */
.btn-ghost {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    border: 1px solid var(--border-soft);
}
.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
    color: var(--accent);
}

@media (max-width: 880px) {
    .project-feature {
        grid-template-columns: 1fr;
        padding: 28px;
        gap: 24px;
    }
}

.projects-grid {
    perspective: 1200px;
    container-type: inline-size;     /* enable container queries on grid */
    container-name: projects;
}

/* Project card responds to GRID container width, not viewport.
   Useful when grid is in different layout contexts. */
@container projects (min-width: 700px) {
    .project-card .project-info { padding: var(--space-m); }
    .project-card .project-info h4 { font-size: var(--fs-md); }
}
.project-card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
    transform-style: preserve-3d;
    will-change: transform;
    position: relative;
}
.project-card:hover {
    border-color: var(--border-strong);
    box-shadow: 0 30px 60px -20px rgba(0,0,0,0.5), var(--glow);
}
.project-card .tilt-shine {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(
        circle at var(--mx, 50%) var(--my, 50%),
        rgba(172, 205, 255, 0.18),
        transparent 40%
    );
    opacity: 0;
    transition: opacity 0.3s var(--ease);
    pointer-events: none;
    z-index: 2;
    mix-blend-mode: screen;
}
.project-card:hover .tilt-shine { opacity: 1; }
.project-preview {
    aspect-ratio: 16 / 9;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    border-bottom: 1px solid var(--border-soft);
}
.preview-content {
    text-align: center;
    color: white;
    max-width: 90%;
}
.preview-tag {
    font-size: 9px;
    color: #c084fc;
    letter-spacing: 0.2em;
    margin-bottom: 12px;
}
.preview-title {
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(to right, #f9a8d4, #c084fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 12px;
}
.preview-desc {
    font-size: 11px;
    color: rgba(255,255,255,0.7);
    line-height: 1.5;
    margin-bottom: 14px;
}
.preview-meta {
    font-size: 9px;
    color: rgba(255,255,255,0.5);
    letter-spacing: 0.1em;
    margin-bottom: 8px;
}
.preview-cta {
    display: inline-block;
    padding: 6px 14px;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 100px;
    font-size: 9px;
    font-weight: 600;
    color: white;
    letter-spacing: 0.1em;
}

.preview-window {
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 14px;
    width: 100%;
    color: white;
}
.preview-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 10px;
}
.preview-logo {
    width: 32px; height: 32px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    display: grid; place-items: center;
    font-size: 16px;
}
.preview-h { font-size: 13px; font-weight: 700; color: white; }
.preview-sub { font-size: 10px; color: rgba(255,255,255,0.5); }
.preview-body { display: flex; flex-direction: column; gap: 5px; }
.api-row {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 8px;
    background: rgba(255,255,255,0.04);
    border-radius: 5px;
    font-family: var(--mono);
    font-size: 10px;
}
.method {
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 9px;
}
.method.get { background: rgba(34, 197, 94, 0.25); color: #4ade80; }
.method.post { background: rgba(59, 130, 246, 0.25); color: #60a5fa; }
.path { color: rgba(255,255,255,0.7); }

.tools-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}
.tool-pill {
    padding: 8px 14px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 100px;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 600;
    color: white;
}
.tool-pill.big {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
}

.sms-preview {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    align-items: flex-start;
}
.sms-bubble {
    padding: 10px 14px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 14px;
    font-size: 11px;
    color: white;
}

.project-info { padding: 20px 22px 22px; }
.project-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}
.project-info h4 {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
}
/* Live badge uses bright green now (accent is blue, so green stays distinct
   and matches the universal "live/online" UX convention). */
.badge.live {
    background: rgba(74, 222, 128, 0.12);
    border: 1px solid rgba(74, 222, 128, 0.35);
    color: #4ade80;
}
.badge.live .dot {
    background: #4ade80;
    box-shadow: 0 0 6px #4ade80;
}
.badge.private {
    background: rgba(245, 158, 11, 0.10);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: #f59e0b;
}
.badge.private .dot {
    background: #f59e0b;
    box-shadow: 0 0 6px #f59e0b;
    animation: none;
}
.badge .dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

/* Mini previews for new project cards */
.reg-preview {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
    width: 100%;
}
.reg-row {
    padding: 5px 10px;
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    font-size: 11px;
    color: white;
    width: 100%;
}
.tether-preview { text-align: center; }
.tether-line {
    font-size: 16px;
    font-weight: 600;
    color: white;
    margin-bottom: 6px;
}
.tether-sub {
    font-size: 10px;
    color: rgba(255,255,255,0.6);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.3); }
}
.project-info p {
    color: var(--text-muted);
    font-size: 13.5px;
    line-height: 1.55;
    margin-bottom: 12px;
}
.project-link {
    color: var(--accent);
    font-size: 13px;
    font-weight: 500;
    transition: 0.2s;
}
.project-link:hover { color: var(--accent-bright); }

/* ========== EXPERIENCE / TIMELINE ========== */
.timeline {
    position: relative;
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px 0;
}
.timeline::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 0; bottom: 0;
    width: 1px;
    background: linear-gradient(to bottom, transparent, var(--border-strong) 8%, var(--border-strong) 92%, transparent);
    transform: translateX(-50%);
}
.timeline-item {
    width: 50%;
    padding: 16px 40px;
    position: relative;
}
.timeline-item.right {
    margin-left: 50%;
}
.timeline-item.left {
    margin-left: 0;
    text-align: left;
}
.timeline-item::before {
    content: "";
    position: absolute;
    top: 36px;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
}
.timeline-item.right::before { left: -7px; }
.timeline-item.left::before { right: -7px; }

.timeline-card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 22px 24px;
    transition: 0.3s var(--ease);
}
.timeline-card:hover {
    border-color: var(--border-strong);
    transform: translateY(-3px);
    box-shadow: var(--glow);
}
.timeline-time {
    font-size: 11.5px;
    color: var(--accent);
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    font-weight: 500;
}
.timeline-card h4 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.01em;
}
.timeline-org {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.timeline-card p {
    color: var(--text-muted);
    font-size: 13.5px;
    line-height: 1.65;
    margin-bottom: 12px;
}

@media (max-width: 800px) {
    .timeline::before { left: 16px; }
    .timeline-item, .timeline-item.right, .timeline-item.left {
        width: 100%; margin-left: 0; padding: 16px 0 16px 40px; text-align: left;
    }
    .timeline-item::before, .timeline-item.right::before, .timeline-item.left::before {
        left: 9px; right: auto;
    }
}

/* ========== CONTACT ========== */
.contact-grid {
    display: grid;
    /* Auto-fit: side-by-side when wide enough, stack on narrow */
    grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
    gap: clamp(28px, 4vw, 60px);
    align-items: start;
}
.contact-left .kicker { margin-bottom: 16px; }
.contact-left .section-title { margin-bottom: 18px; }
.lead {
    font-size: 16px;
    color: var(--text-muted);
    margin-bottom: 30px;
    line-height: 1.65;
}
.contact-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.contact-form input,
.contact-form textarea {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    padding: 14px 18px;
    font-size: 14px;
    transition: border-color 0.2s, background 0.2s;
    resize: vertical;
}
.contact-form input::placeholder,
.contact-form textarea::placeholder { color: var(--text-dim); }
.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(172, 205, 255, 0.03);
}
.contact-form button { align-self: stretch; margin-top: 8px; justify-content: center; }

.contact-right { display: flex; flex-direction: column; gap: 12px; }
.contact-card-link {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: 0.25s var(--ease);
}
.contact-card-link:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-strong);
    transform: translateX(4px);
}
.ccl-icon {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    display: grid;
    place-items: center;
    color: var(--text-muted);
    background: transparent;
    transition: color 0.25s var(--ease), transform 0.25s var(--ease), filter 0.25s var(--ease);
}
.ccl-icon svg { display: block; width: 26px; height: 26px; }
.contact-card-link:hover .ccl-icon {
    color: var(--accent);
    transform: scale(1.1);
    filter: drop-shadow(0 0 10px var(--accent-glow));
}
.ccl-title { font-size: 15px; font-weight: 600; }
.ccl-sub { font-size: 12px; color: var(--text-muted); }

.contact-note {
    margin-top: 12px;
    padding: 16px 20px;
    background: rgba(172, 205, 255, 0.05);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
}

@media (max-width: 880px) {
    .contact-grid { grid-template-columns: 1fr; gap: 40px; }
}

/* ========== FOOTER ========== */
.footer {
    border-top: 1px solid var(--border-soft);
    margin-top: 80px;
    padding: 40px 24px 28px;
    max-width: var(--container);
    margin-left: auto;
    margin-right: auto;
}
.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-soft);
}
.footer-brand .nav-logo { font-size: 18px; }
.footer-brand p {
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-dim);
}
.footer-socials {
    display: flex;
    gap: 18px;
}
.fs-link {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    color: var(--text-muted);
    background: transparent;       /* no fill — just the icon */
    transition: color 0.25s var(--ease), transform 0.25s var(--ease);
}
.fs-link svg { display: block; width: 22px; height: 22px; }
.fs-link:hover {
    color: var(--accent);
    transform: translateY(-2px);
    filter: drop-shadow(0 0 8px var(--accent-glow));
}
.footer-top {
    font-size: 13px;
    color: var(--text-muted);
    transition: color 0.2s;
}
.footer-top:hover { color: var(--accent); }
.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 18px;
    font-size: 12px;
    color: var(--text-dim);
}

/* ========== REVEAL ========== */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.85s var(--ease), transform 0.85s var(--ease);
}
.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================
   RESPONSIVE — minimalist breakpoints
   With clamp() and auto-fit grids handling the smooth scaling,
   we only need media queries for STRUCTURAL changes that can't
   be expressed as fluid values:
     - Hide floating tags (they're absolutely positioned, would overlap)
     - Phone-only ambient FX tuning (perf budget)
     - 4K container cap
   Nav burger / nav-cta / nav-links rules live in the nav block above.
   ============================================================ */

/* Hide decorative floating tags below ~1100px — they're absolute-positioned
   percentages, would overlap content on tablets/phones */
@media (max-width: 1100px) {
    .hero-floats { display: none; }
}

/* No-hover devices (touch + mobile) — kill mouse-driven transforms.
   These come from JS that may have started on desktop then resized down,
   leaving stale rotation / translate values. Force-zero them so hero stays
   centered. CSS author !important still allows CSS animations (sweep) to
   work via the animation origin which has higher priority. */
@media (hover: none), (max-width: 768px) {
    .hero-tilt {
        --tx: 0deg !important;
        --ty: 0deg !important;
    }
    .magnetic-letter {
        transform: none !important;
    }
}

/* Phone-only — tone down ambient effects for perf + readability */
@media (max-width: 600px) {
    .scanlines  { opacity: 0.35; }
    #bg-canvas  { opacity: 0.55; }
    /* Theme + lang toggles: smaller + tighter */
    .lang-toggle, .theme-toggle { width: 38px; height: 38px; }
    .lang-toggle  { right: 66px; bottom: 16px; font-size: 10px; }
    .theme-picker { right: 16px;  bottom: 16px; }
    /* Footer stack on narrow */
    .footer-inner  { flex-direction: column; align-items: flex-start; gap: 18px; }
    .footer-bottom { flex-direction: column; align-items: flex-start; gap: 6px; }
}

/* Large desktop / 4K — bump container cap so content doesn't feel tiny */
@media (min-width: 1600px) {
    :root { --container: 1400px; }
}
@media (min-width: 2200px) {
    :root { --container: 1600px; }
}

/* Landscape phone (short height) — hide non-essential hero bits */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-sub         { display: none; }
    .scroll-indicator { display: none; }
}
