@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Space+Grotesk:wght@500;600&display=swap');

:root {
    color-scheme: dark;

    /* Surfaces */
    --bg: #000000;
    --section-bg: #020617;
    --surface-nav: rgba(0, 0, 0, 0.88);
    --surface-carousel-card: rgba(15, 23, 42, 0.72);
    --surface-elevated: rgba(15, 23, 42, 0.55);
    --surface-toolbar: rgba(255, 255, 255, 0.04);
    --surface-toolbar-hover: rgba(96, 165, 250, 0.08);
    --surface-accent-wash: rgba(96, 165, 250, 0.07);

    /* Typography */
    --text: #e2e8f0;
    --text-on-accent: #f8fafc;
    --muted: #94a3b8;
    --link-hover: var(--accent-soft);

    /* Borders */
    --border: rgba(255, 255, 255, 0.1);
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-strong: rgba(255, 255, 255, 0.14);
    --border-divider: rgba(255, 255, 255, 0.08);
    --card-border: rgba(30, 58, 175, 0.32);
    --border-accent: rgba(96, 165, 250, 0.55);
    --border-accent-soft: rgba(96, 165, 250, 0.4);
    --border-interactive-hover: rgba(96, 165, 250, 0.45);

    /* Accent scale */
    --accent: #60a5fa;
    --accent-deep: #2563eb;
    --accent-soft: #93c5fd;
    --accent-sky: #38bdf8;
    --accent-muted-fg: rgba(96, 165, 250, 0.78);
    --ring: rgba(96, 165, 250, 0.35);
    --gradient-accent: linear-gradient(135deg, var(--accent-sky) 0%, var(--accent) 42%, var(--accent-deep) 100%);
    --shadow-accent-sm: 0 4px 24px rgba(37, 99, 235, 0.18);
    --shadow-accent-lg: 0 12px 40px rgba(37, 99, 235, 0.22);
    --shadow-outline-hover: 0 8px 28px rgba(37, 99, 235, 0.08);
    --btn-primary-inset-rest: rgba(255, 255, 255, 0.06);
    --btn-primary-inset-hover: rgba(255, 255, 255, 0.1);
    --btn-primary-sheen: rgba(255, 255, 255, 0.14);

    /* Cards & panels (skills grid, form fields) */
    --card: #0f172a;
    --card-hover: #1e293b;

    /* Elevation */
    --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.05), 0 14px 48px rgba(0, 0, 0, 0.38);
    --shadow-card-hover:
        0 0 0 1px rgba(96, 165, 250, 0.42), 0 22px 55px rgba(37, 99, 235, 0.2), 0 0 50px rgba(96, 165, 250, 0.06);
    --shadow-surface-hover: 0 0 0 1px rgba(96, 165, 250, 0.35), 0 16px 40px rgba(37, 99, 235, 0.12);

    /* Chips & CTAs (carousel) */
    --chip-bg: rgba(15, 23, 42, 0.72);
    --chip-text: rgba(226, 232, 240, 0.95);
    --cta-pill-border: rgba(96, 165, 250, 0.38);
    --cta-pill-bg: rgba(96, 165, 250, 0.06);
    --cta-pill-border-hover: rgba(96, 165, 250, 0.65);
    --cta-pill-bg-hover: rgba(96, 165, 250, 0.11);
    --cta-pill-shadow-hover: 0 0 0 1px rgba(96, 165, 250, 0.12), 0 10px 28px rgba(37, 99, 235, 0.12);

    /* Focus */
    --focus-outline-color: var(--accent);
    --focus-outline-width: 3px;
    --focus-outline-offset: 2px;
    --focus-glow: 0 0 0 3px rgba(96, 165, 250, 0.22);
    --focus-halo: 0 0 0 2px var(--bg), 0 0 0 5px rgba(96, 165, 250, 0.55);

    /* Status (contact form) */
    --status-pending-bg: rgba(30, 58, 138, 0.18);
    --status-pending-border: rgba(96, 165, 250, 0.48);
    --status-pending-text: #dbeafe;
    --status-success-bg: rgba(6, 78, 59, 0.22);
    --status-success-border: rgba(52, 211, 153, 0.55);
    --status-success-text: #a7f3d0;
    --status-danger-bg: rgba(127, 29, 29, 0.22);
    --status-danger-border: rgba(248, 113, 113, 0.55);
    --status-danger-text: #fecaca;

    /* Shared “system UI” strip (progress + nav accents) */
    --top-strip-height: 3px;
    --signal-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --radius-btn: 1.125rem;

    /* UI motion: short, consistent (scroll-reveal + hovers) */
    --motion-link: 0.18s;
    --motion-reveal-dur: 0.48s;
    --motion-reveal-y: 0.625rem;
}

html[data-theme="light"] {
    color-scheme: light;

    --surface-nav: rgba(244, 244, 245, 0.92);
    --surface-carousel-card: #ffffff;
    --surface-elevated: #f1f5f9;
    --surface-toolbar: rgba(255, 255, 255, 0.65);
    --surface-toolbar-hover: rgba(239, 246, 255, 0.95);
    --surface-accent-wash: rgba(37, 99, 235, 0.06);

    --bg: #f4f4f5;
    --text: #0f172a;
    --muted: #475569;
    --link-hover: #1e40af;

    --border: rgba(15, 23, 42, 0.12);
    --border-subtle: rgba(15, 23, 42, 0.08);
    --border-strong: rgba(15, 23, 42, 0.18);
    --border-divider: rgba(15, 23, 42, 0.08);
    --card-border: rgba(15, 23, 42, 0.12);
    --border-accent: rgba(37, 99, 235, 0.35);
    --border-accent-soft: rgba(37, 99, 235, 0.26);
    --border-interactive-hover: rgba(37, 99, 235, 0.35);

    --accent: #2563eb;
    --accent-deep: #1d4ed8;
    --accent-soft: #3b82f6;
    --accent-sky: #60a5fa;
    --accent-muted-fg: rgba(37, 99, 235, 0.72);
    --ring: rgba(37, 99, 235, 0.28);
    --gradient-accent: linear-gradient(135deg, var(--accent-sky) 0%, var(--accent) 48%, var(--accent-deep) 100%);
    --shadow-accent-sm: 0 4px 28px rgba(59, 130, 246, 0.12);
    --shadow-accent-lg: 0 12px 40px rgba(37, 99, 235, 0.14);
    --shadow-outline-hover: 0 8px 28px rgba(37, 99, 235, 0.1);
    --btn-primary-inset-rest: rgba(255, 255, 255, 0.5);
    --btn-primary-inset-hover: rgba(255, 255, 255, 0.75);
    --btn-primary-sheen: rgba(255, 255, 255, 0.22);

    --section-bg: #e4e4e7;
    --card: #ffffff;
    --card-hover: #eef2ff;

    --shadow-card: 0 1px 0 rgba(15, 23, 42, 0.06), 0 10px 36px rgba(15, 23, 42, 0.07);
    --shadow-card-hover: 0 0 0 1px var(--ring), 0 20px 50px rgba(37, 99, 235, 0.12);
    --shadow-surface-hover: 0 0 0 1px var(--ring), 0 12px 32px rgba(37, 99, 235, 0.1);

    --chip-bg: rgba(248, 250, 252, 0.96);
    --chip-text: #1e293b;
    --cta-pill-border: rgba(37, 99, 235, 0.22);
    --cta-pill-bg: rgba(37, 99, 235, 0.06);
    --cta-pill-border-hover: var(--accent);
    --cta-pill-bg-hover: rgba(37, 99, 235, 0.1);
    --cta-pill-shadow-hover: 0 10px 28px rgba(37, 99, 235, 0.08);

    --focus-glow: 0 0 0 3px rgba(37, 99, 235, 0.18);
    --focus-halo: 0 0 0 2px var(--bg), 0 0 0 5px rgba(37, 99, 235, 0.45);

    --status-pending-text: #1e3a5f;
    --status-success-text: #065f46;
    --status-danger-text: #991b1b;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
    overflow-x: clip;
}

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

.skip-link {
    position: absolute;
    left: 0.75rem;
    top: -100vh;
    z-index: 100;
    padding: 0.65rem 1.1rem;
    border-radius: var(--radius-btn);
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    color: var(--text);
    background: var(--card);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-card);
}

.skip-link:focus {
    top: 0.75rem;
    outline: none;
}

.skip-link:focus-visible {
    top: 0.75rem;
    outline: var(--focus-outline-width) solid var(--focus-outline-color);
    outline-offset: var(--focus-outline-offset);
    box-shadow: var(--focus-halo);
}

#main-content:focus {
    outline: none;
}

@supports not (overflow: clip) {
    html {
        overflow-x: hidden;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: clip;
}

@supports not (overflow: clip) {
    body {
        overflow-x: hidden;
    }
}

#nav-brand {
    font-size: clamp(0.875rem, 2.35vw, 1.125rem);
    font-weight: 500;
    letter-spacing: -0.02em;
    color: var(--text) !important;
    text-shadow: none !important;
    min-width: 0;
    max-width: min(100%, calc(100vw - 10.5rem));
    transition:
        color 0.22s var(--signal-ease),
        opacity 0.22s var(--signal-ease);
}

@media (min-width: 768px) {
    #nav-brand {
        max-width: none;
    }
}

#nav-brand:hover {
    color: var(--muted) !important;
}

.nav-brand-dot {
    color: var(--accent) !important;
    text-shadow:
        0 0 10px rgba(96, 165, 250, 0.25),
        0 0 18px rgba(59, 130, 246, 0.12) !important;
}

.about-timeline h4 {
    margin: 0;
    font-weight: 600;
}

.explore-list {
    padding: 0;
    margin: 0;
}

.explore-list li {
    position: relative;
    padding-left: 1.1rem;
    list-style: none;
}

.explore-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.55em;
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--accent);
    opacity: 0.88;
}

html[data-theme="light"] .nav-brand-dot {
    text-shadow: 0 0 14px rgba(37, 99, 235, 0.2) !important;
}

#site-nav.site-nav {
    background-color: var(--surface-nav) !important;
}

#site-nav .mobile-menu-panel {
    background-color: var(--surface-nav) !important;
}

.nav-shell {
    min-width: 0;
}

@media (max-width: 767px) {
    #site-nav .mobile-menu-panel .nav-section-link {
        display: flex;
        align-items: center;
        min-height: 2.75rem;
        padding: 0.35rem 0;
    }
}

.carousel-nav-btn {
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-toolbar);
    color: inherit;
    transition:
        border-color 0.2s var(--signal-ease),
        background-color 0.2s var(--signal-ease),
        color 0.2s var(--signal-ease),
        transform 0.2s var(--signal-ease);
}

.carousel-nav-btn:hover {
    border-color: var(--border-interactive-hover);
    background-color: var(--surface-toolbar-hover);
    color: var(--accent);
}

@media (prefers-reduced-motion: no-preference) {
    .carousel-nav-btn:hover {
        transform: scale(1.04);
    }

    .carousel-nav-btn:active {
        transform: scale(0.98);
    }
}

.link-project {
    margin-top: 1.25rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 600;
    color: var(--accent);
    transition:
        opacity 0.2s ease,
        gap 0.2s ease,
        color var(--motion-link) var(--signal-ease);
}

.link-project-icon {
    flex-shrink: 0;
    width: 0.95rem;
    height: 0.95rem;
    opacity: 0.82;
}

.link-project-external::after {
    content: none;
}

.link-project:hover {
    opacity: 0.9;
    gap: 0.55rem;
}

.link-project::after {
    content: '\2192';
    font-weight: 500;
    opacity: 0.85;
}

@media (max-width: 767px) {
    .link-project {
        padding: 0.5rem 0;
        min-height: 2.75rem;
    }
}

html[data-theme="light"] #project-carousel .link-project {
    color: var(--accent-deep);
}

html[data-theme="light"] #project-carousel .link-project:hover {
    color: var(--link-hover);
}

.form-field {
    width: 100%;
    border-radius: var(--radius-btn);
    padding: 0.95rem 1.35rem;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
    outline: none;
    transition:
        border-color 0.22s var(--signal-ease),
        box-shadow 0.22s var(--signal-ease);
}

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.4rem;
}

.form-field:focus {
    border-color: var(--accent);
    box-shadow: var(--focus-glow);
}

.icon-svg {
    flex-shrink: 0;
}

.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    overflow: hidden;
    border-radius: var(--radius-btn);
    padding: 0.9rem 1.75rem;
    font-weight: 600;
    line-height: 1.25;
    transition:
        transform 0.22s var(--signal-ease),
        box-shadow 0.28s var(--signal-ease),
        border-color 0.25s var(--signal-ease),
        background-color 0.28s var(--signal-ease);
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    color: var(--text-on-accent);
    border: 1px solid transparent;
    background-image: var(--gradient-accent);
    box-shadow:
        var(--shadow-accent-sm),
        0 0 0 1px var(--btn-primary-inset-rest) inset;
}

.btn-primary::after {
    content: '';
    position: absolute;
    inset: -40% -60%;
    background: linear-gradient(105deg,
            transparent 42%,
            var(--btn-primary-sheen) 50%,
            transparent 58%);
    transform: translateX(-120%) skewX(-12deg);
    opacity: 0;
    transition:
        opacity 0.35s ease,
        transform 0.55s var(--signal-ease);
    pointer-events: none;
}

.btn-primary:hover::after {
    opacity: 1;
    transform: translateX(120%) skewX(-12deg);
}

.btn-primary:hover {
    box-shadow:
        var(--shadow-accent-lg),
        0 0 0 1px var(--btn-primary-inset-hover) inset;
}

.btn-outline {
    color: inherit;
    background: transparent;
    border: 1px solid var(--border);
}

.btn-outline:hover {
    border-color: var(--accent);
    box-shadow:
        0 0 0 1px var(--ring),
        var(--shadow-outline-hover);
}

@media (max-width: 639px) {
    #hero .hero-cta-secondary-row {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem 1.25rem;
    }

    #hero .hero-cta-secondary-row .hero-cta-secondary.btn {
        flex: 1 1 auto;
        min-width: 0;
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
        padding: 0.65rem 0.5rem;
        min-height: 2.75rem;
        color: var(--accent) !important;
    }

    #hero .hero-cta-secondary-row .hero-cta-secondary.btn:hover {
        box-shadow: none !important;
        opacity: 0.88;
    }

    #hero .hero-cta-secondary-row .hero-cta-secondary.btn:active {
        transform: none;
    }
}

.section-eyebrow {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.6rem;
}

.section-divider-top {
    border-top: 1px solid transparent;
    border-image: linear-gradient(90deg,
            transparent,
            rgba(96, 165, 250, 0.25) 20%,
            rgba(129, 140, 248, 0.15) 50%,
            rgba(96, 165, 250, 0.25) 80%,
            transparent) 1;
}

.section-surface {
    background-color: transparent;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

@media (min-width: 768px) {
    .section-surface {
        -webkit-backdrop-filter: blur(12px);
        backdrop-filter: blur(12px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .section-surface {
        -webkit-backdrop-filter: blur(6px);
        backdrop-filter: blur(6px);
    }
}

.skills-group-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--muted);
}

html[data-theme="light"] .section-divider-top {
    border-image: linear-gradient(90deg,
            transparent,
            rgba(59, 130, 246, 0.22) 22%,
            rgba(129, 140, 248, 0.12) 50%,
            rgba(59, 130, 246, 0.22) 78%,
            transparent) 1;
}

@media (prefers-reduced-motion: reduce) {

    .btn:active {
        transform: none;
    }

    .btn-primary::after {
        display: none;
    }
}

/* Theme Toggle */
#theme-toggle {
    background: #27272a;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
    transition:
        box-shadow 0.22s var(--signal-ease),
        transform 0.2s var(--signal-ease),
        background-color 0.22s var(--signal-ease);
}

html[data-theme="light"] #theme-toggle {
    background: #f59e0b;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

@media (prefers-reduced-motion: reduce) {
    #theme-toggle {
        transition: none;
    }

    #theme-toggle:hover,
    #theme-toggle:active {
        transform: none;
    }
}

#toggle-track {
    background: transparent;
}

#sun-icon {
    opacity: 0;
    transition: opacity 0.3s;
}

#moon-icon {
    opacity: 1;
    transition: opacity 0.3s;
}

html[data-theme="light"] #sun-icon {
    opacity: 1;
}

html[data-theme="light"] #moon-icon {
    opacity: 0;
}

#toggle-knob {
    transform: translateX(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: transform 0.28s var(--signal-ease), box-shadow 0.22s ease;
}

html[data-theme="light"] #toggle-knob {
    transform: translateX(24px);
}

@media (prefers-reduced-motion: reduce) {
    #toggle-knob {
        transition: none;
    }
}

@media (prefers-reduced-motion: no-preference) {
    #theme-toggle:hover {
        transform: scale(1.02);
    }

    #theme-toggle:active {
        transform: scale(0.98);
    }
}

/* Progress Bar */
#progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: var(--top-strip-height);
    background: linear-gradient(90deg, transparent, var(--accent) 18%, #38bdf8 52%, #2563eb 100%);
    z-index: 9999;
    width: 0%;
    transition: width 0.12s var(--signal-ease);
    pointer-events: none;
    box-shadow: 0 0 12px rgba(96, 165, 250, 0.35);
}

html[data-theme="light"] #progress-bar {
    background: linear-gradient(90deg, transparent, var(--accent) 22%, #3b82f6 55%, #1d4ed8 100%);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.25);
}

.accent-blue {
    color: var(--accent) !important;
    text-shadow: 0 0 10px rgba(96, 165, 250, 0.6), 0 0 20px rgba(96, 165, 250, 0.4);
    transition: text-shadow 0.6s ease-out;
}

.accent-blue.in-view {
    animation: lightning-glow 5s infinite ease-in-out;
}

html[data-theme="light"] .accent-blue {
    text-shadow:
        0 0 18px rgba(37, 99, 235, 0.12),
        0 0 32px rgba(37, 99, 235, 0.06);
}

html[data-theme="light"] .accent-blue.in-view {
    animation: lightning-glow-light 5s infinite ease-in-out;
}

/* Scroll-driven section titles (ui.js): calmer glow, no flicker pulse */
h2.accent-blue {
    text-shadow:
        0 0 14px rgba(96, 165, 250, 0.24),
        0 0 30px rgba(37, 99, 235, 0.09) !important;
}

h2.accent-blue.in-view {
    animation: none !important;
}

html[data-theme="light"] h2.accent-blue {
    text-shadow:
        0 0 12px rgba(37, 99, 235, 0.08),
        0 0 22px rgba(37, 99, 235, 0.05) !important;
}

html[data-theme="light"] h2.accent-blue.in-view {
    animation: none !important;
}

@keyframes lightning-glow-light {

    0%,
    100% {
        text-shadow:
            0 0 14px rgba(37, 99, 235, 0.14),
            0 0 26px rgba(37, 99, 235, 0.08);
    }

    25% {
        text-shadow:
            0 0 18px rgba(37, 99, 235, 0.2),
            0 0 34px rgba(37, 99, 235, 0.1);
    }

    50% {
        text-shadow:
            0 0 16px rgba(37, 99, 235, 0.16),
            0 0 30px rgba(37, 99, 235, 0.09);
    }

    75% {
        text-shadow:
            0 0 18px rgba(37, 99, 235, 0.18),
            0 0 36px rgba(37, 99, 235, 0.1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .accent-blue.in-view {
        animation: none !important;
    }
}

@keyframes lightning-glow {

    0%,
    100% {
        text-shadow: 0 0 12px rgba(96, 165, 250, 0.75), 0 0 25px rgba(96, 165, 250, 0.55), 0 0 45px rgba(96, 165, 250, 0.35);
    }

    25% {
        text-shadow: 0 0 18px rgba(96, 165, 250, 0.95), 0 0 38px rgba(96, 165, 250, 0.8), 0 0 65px rgba(96, 165, 250, 0.55), 0 0 90px rgba(96, 165, 250, 0.3);
    }

    50% {
        text-shadow: 0 0 14px rgba(96, 165, 250, 0.85), 0 0 30px rgba(96, 165, 250, 0.65), 0 0 55px rgba(96, 165, 250, 0.45);
    }

    75% {
        text-shadow: 0 0 20px rgba(96, 165, 250, 0.98), 0 0 42px rgba(96, 165, 250, 0.85), 0 0 75px rgba(96, 165, 250, 0.6), 0 0 100px rgba(96, 165, 250, 0.25);
    }
}

section {
    background: var(--section-bg);
}


#contact {
    background: var(--bg);
}

#skills .grid>div {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 2rem;
    font-family: ui-monospace, 'Cascadia Code', 'Segoe UI Mono', Consolas, monospace;
    font-size: 0.9rem;
    letter-spacing: 0.055em;
    transition:
        background-color 0.28s var(--signal-ease),
        border-color 0.28s var(--signal-ease),
        transform 0.28s var(--signal-ease),
        box-shadow 0.28s var(--signal-ease);
}

#skills .grid>div:hover {
    background: var(--card-hover);
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: var(--shadow-surface-hover);
}

#skills .skill-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 4.25rem;
    padding: 1.5rem;
    text-align: center;
}

@media (max-width: 639px) {
    #skills .skill-cell {
        padding: 1rem 0.65rem;
        min-height: 3.5rem;
        font-size: 0.8125rem;
        letter-spacing: 0.04em;
    }
}

canvas#bg-canvas {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1 !important;
    opacity: 0.75;
    pointer-events: none;
}

html[data-theme="light"] canvas#bg-canvas {
    opacity: 0.58;
}

/* Light theme overrides */
html[data-theme="light"] body,
html[data-theme="light"] .bg-slate-950,
html[data-theme="light"] .bg-slate-900 {
    background-color: var(--bg) !important;
    color: var(--text) !important;
}

/* Specific sections that need section-bg */
html[data-theme="light"] #contact {
    background-color: var(--section-bg) !important;
}

html[data-theme="light"] #about,
html[data-theme="light"] #skills,
html[data-theme="light"] #projects {
    background-color: transparent !important;
}

html[data-theme="light"] .bg-slate-900\/70 {
    background-color: #ffffff !important;
    box-shadow:
        0 1px 0 rgba(15, 23, 42, 0.06),
        0 10px 40px rgba(15, 23, 42, 0.06);
}

html[data-theme="light"] .bg-slate-900\/50,
html[data-theme="light"] .bg-slate-900\/30 {
    background-color: rgba(255, 255, 255, 0.92) !important;
}

html[data-theme="light"] #skills .grid>div {
    background-color: var(--card) !important;
    border-color: var(--border) !important;
    color: var(--text);
}

html[data-theme="light"] #skills .grid>div:hover {
    background-color: var(--card-hover) !important;
    border-color: var(--accent) !important;
    box-shadow: var(--shadow-surface-hover);
}

html[data-theme="light"] #project-carousel .project-card {
    box-shadow: var(--shadow-card);
}

html[data-theme="light"] #project-carousel .project-card:hover {
    box-shadow: var(--shadow-card-hover);
}

html[data-theme="light"] nav {
    background-color: var(--surface-nav) !important;
    border-bottom-color: var(--border) !important;
}

html[data-theme="light"] nav a {
    color: var(--text) !important;
}

html[data-theme="light"] .resume-download-btn {
    border-color: var(--border) !important;
    color: var(--text) !important;
}

html[data-theme="light"] .resume-download-btn:hover {
    border-color: var(--accent) !important;
    color: var(--accent-deep) !important;
}

html[data-theme="light"] .text-slate-300 {
    color: #334155 !important;
}

html[data-theme="light"] .text-slate-400,
html[data-theme="light"] .text-slate-500 {
    color: var(--muted) !important;
}

html[data-theme="light"] .text-slate-200,
html[data-theme="light"] .text-slate-100 {
    color: var(--text) !important;
}

/* Cards, borders, and hover states */
html[data-theme="light"] .border-blue-900\/30,
html[data-theme="light"] .border-blue-900\/50,
html[data-theme="light"] .border-slate-700 {
    border-color: var(--border) !important;
}

/* Contact form inputs/textarea */
html[data-theme="light"] input,
html[data-theme="light"] textarea {
    background-color: var(--card) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}

html[data-theme="light"] #toggle-track {
    color: inherit;
}

.footer-secondary {
    color: var(--muted);
}

html[data-theme="light"] footer {
    background-color: var(--bg) !important;
    color: var(--text) !important;
}

#form-submit:disabled {
    cursor: wait;
    opacity: 0.8;
}

a:focus-visible,
button:focus-visible,
select:focus-visible,
summary:focus-visible {
    outline: var(--focus-outline-width) solid var(--focus-outline-color);
    outline-offset: var(--focus-outline-offset);
    box-shadow: var(--focus-halo);
}

input:focus-visible,
textarea:focus-visible {
    outline: var(--focus-outline-width) solid var(--focus-outline-color);
    outline-offset: var(--focus-outline-offset);
}

input.form-field:focus-visible,
textarea.form-field:focus-visible {
    outline: none;
    box-shadow: var(--focus-glow);
}

#projects .overflow-x-auto {
    scrollbar-color: var(--accent) transparent;
}

.project-carousel {
    cursor: grab;
    scroll-behavior: smooth;
    scroll-padding: 0;
    scroll-padding-inline: max(0.75rem, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
    user-select: none;
    touch-action: pan-x;
    -webkit-overflow-scrolling: touch;
}

@media (prefers-reduced-motion: reduce) {
    .project-carousel {
        scroll-behavior: auto;
    }
}

#project-carousel.project-carousel {
    -webkit-mask-image: linear-gradient(90deg,
            transparent 0,
            #000 min(28px, 6vw),
            #000 calc(100% - min(28px, 6vw)),
            transparent 100%);
    mask-image: linear-gradient(90deg,
            transparent 0,
            #000 min(28px, 6vw),
            #000 calc(100% - min(28px, 6vw)),
            transparent 100%);
    overscroll-behavior-x: contain;
}

.project-carousel.is-dragging {
    cursor: grabbing;
    scroll-behavior: auto;
    scroll-snap-type: none;
}

.resume-download-btn {
    transition:
        border-color 0.22s var(--signal-ease),
        color 0.22s var(--signal-ease),
        box-shadow 0.26s var(--signal-ease),
        transform 0.2s var(--signal-ease),
        background-color 0.22s var(--signal-ease);
}

@media (prefers-reduced-motion: no-preference) {
    .resume-download-btn:hover {
        transform: translateY(-1px);
    }

    .resume-download-btn:active {
        transform: translateY(0);
    }
}

.mobile-menu-panel {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    padding-bottom: 0;
    padding-top: 0;
    pointer-events: none;
    transform: translateY(-0.5rem);
    transition: max-height 220ms ease, opacity 180ms ease, padding 220ms ease, transform 220ms ease;
}

.mobile-menu-panel.is-open {
    max-height: min(18rem, calc(100vh - 5.5rem));
    opacity: 1;
    padding-bottom: 1rem;
    padding-top: 1rem;
    pointer-events: auto;
    transform: translateY(0);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

@media (prefers-reduced-motion: reduce) {
    .mobile-menu-panel,
    .mobile-menu-panel.is-open {
        transform: none;
    }

    .mobile-menu-panel {
        transition: max-height 200ms ease, opacity 0.16s ease, padding 200ms ease;
    }
}

/* Layering: canvas behind grain behind page */
.page-content {
    position: relative;
    z-index: 1;
    min-width: 0;
    overflow-x: clip;
}

.page-content footer a {
    transition: color var(--motion-link) var(--signal-ease);
}

@supports not (overflow: clip) {
    .page-content {
        overflow-x: hidden;
    }
}

.grain-overlay {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.06;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@media (max-width: 479px) {
    .grain-overlay {
        opacity: 0.038;
    }
}

html[data-theme="light"] .grain-overlay {
    opacity: 0.045;
    mix-blend-mode: multiply;
}

@media (max-width: 479px) {
    html[data-theme="light"] .grain-overlay {
        opacity: 0.03;
    }
}

html.theme-transitioning .grain-overlay {
    animation: themeGrainPulse 0.22s var(--signal-ease);
}

@keyframes themeGrainPulse {
    0%,
    100% {
        opacity: 0.06;
        filter: brightness(1);
    }

    50% {
        opacity: 0.11;
        filter: brightness(1.12);
    }
}

html[data-theme="light"].theme-transitioning .grain-overlay {
    animation: themeGrainPulseLight 0.22s var(--signal-ease);
}

@keyframes themeGrainPulseLight {
    0%,
    100% {
        opacity: 0.045;
        filter: brightness(1);
    }

    50% {
        opacity: 0.085;
        filter: brightness(1.06);
    }
}

@media (prefers-reduced-motion: reduce) {
    .grain-overlay {
        opacity: 0.04;
    }

    html.theme-transitioning .grain-overlay,
    html[data-theme="light"].theme-transitioning .grain-overlay {
        animation: none;
    }
}

/* Display typography */
.font-display,
h1,
h2.accent-blue {
    font-family: 'Space Grotesk', 'Inter', system-ui, sans-serif;
}

.hero-name {
    letter-spacing: -0.045em;
    line-height: 1.03;
}

/* Nav logo letters: always inline-block so kerning/spacing matches intro + post-intro
   (was only under html.brand-intro-active, which caused a snap when that class was removed). */
#nav-brand .nav-brand-char {
    display: inline-block;
}

/* Brand intro: rain-to-nav (class set in brand-intro-boot.js) */
/* Nav: per-letter hidden until outro, then L→R “placement” under flying cluster */
html.brand-intro-active #nav-brand .nav-brand-char {
    opacity: 0;
    transform: translate3d(-0.24em, 0.07em, 0);
}

html.brand-intro-active.brand-intro-nav-reveal #nav-brand .nav-brand-char {
    animation: navBrandCharPlace 0.42s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: calc(0.68s + (var(--nb-i) * 48ms));
}

@keyframes navBrandCharPlace {
    from {
        opacity: 0;
        transform: translate3d(-0.24em, 0.07em, 0);
    }

    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.brand-intro-overlay {
    position: fixed;
    inset: 0;
    /* Above #progress-bar (9999) so attract-mode fills the viewport */
    z-index: 10000;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 1rem;
    isolation: isolate;
}

/* Retro “attract mode”: frosted glass over canvas + page, eases off with the exit */
.brand-intro-backdrop {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    -webkit-backdrop-filter: blur(22px) saturate(0.78) sepia(0.18);
    backdrop-filter: blur(22px) saturate(0.78) sepia(0.18);
    background: rgba(0, 0, 0, 0.46);
}

.brand-intro-backdrop::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 1;
    box-shadow: inset 0 0 min(38vw, 420px) rgba(0, 0, 0, 0.72);
    transition: opacity 0.95s ease-out 0.1s;
}

.brand-intro-backdrop::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.14;
    transition: opacity 0.95s ease-out 0.1s;
    background: repeating-linear-gradient(0deg,
            transparent 0,
            transparent 2px,
            rgba(0, 0, 0, 0.5) 2px,
            rgba(0, 0, 0, 0.5) 3px);
}

html[data-theme="light"] .brand-intro-backdrop {
    -webkit-backdrop-filter: blur(20px) saturate(0.88) sepia(0.08);
    backdrop-filter: blur(20px) saturate(0.88) sepia(0.08);
    background: rgba(12, 12, 18, 0.28);
}

html[data-theme="light"] .brand-intro-backdrop::before {
    box-shadow: inset 0 0 min(38vw, 420px) rgba(0, 0, 0, 0.38);
}

html[data-theme="light"] .brand-intro-backdrop::after {
    opacity: 0.1;
}

.brand-intro-overlay.brand-intro--rain .brand-intro-backdrop {
    animation: brandIntroBackdropAttract 2.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes brandIntroBackdropAttract {
    from {
        -webkit-backdrop-filter: blur(26px) saturate(0.72) sepia(0.22);
        backdrop-filter: blur(26px) saturate(0.72) sepia(0.22);
        background-color: rgba(0, 0, 0, 0.52);
    }

    to {
        -webkit-backdrop-filter: blur(8px) saturate(0.92) sepia(0.08);
        backdrop-filter: blur(8px) saturate(0.92) sepia(0.08);
        background-color: rgba(0, 0, 0, 0.2);
    }
}

html[data-theme="light"] .brand-intro-overlay.brand-intro--rain .brand-intro-backdrop {
    animation: brandIntroBackdropAttractLight 2.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes brandIntroBackdropAttractLight {
    from {
        -webkit-backdrop-filter: blur(24px) saturate(0.82) sepia(0.12);
        backdrop-filter: blur(24px) saturate(0.82) sepia(0.12);
        background-color: rgba(12, 12, 18, 0.38);
    }

    to {
        -webkit-backdrop-filter: blur(7px) saturate(0.96) sepia(0.04);
        backdrop-filter: blur(7px) saturate(0.96) sepia(0.04);
        background-color: rgba(12, 12, 18, 0.12);
    }
}

.brand-intro-overlay.brand-intro--exit .brand-intro-backdrop {
    animation: none;
    transition: backdrop-filter 1.4s cubic-bezier(0.22, 1, 0.36, 1),
        background-color 1.4s cubic-bezier(0.22, 1, 0.36, 1);
    -webkit-backdrop-filter: blur(0) saturate(1) sepia(0);
    backdrop-filter: blur(0) saturate(1) sepia(0);
    background-color: transparent;
}

.brand-intro-overlay.brand-intro--exit .brand-intro-backdrop::before {
    opacity: 0;
    transition: opacity 1.25s cubic-bezier(0.22, 1, 0.36, 1) 0.08s;
}

.brand-intro-overlay.brand-intro--exit .brand-intro-backdrop::after {
    opacity: 0;
    transition: opacity 1.15s cubic-bezier(0.22, 1, 0.36, 1) 0.12s;
}

html[data-theme="light"] .brand-intro-overlay.brand-intro--exit .brand-intro-backdrop {
    -webkit-backdrop-filter: blur(0) saturate(1) sepia(0);
    backdrop-filter: blur(0) saturate(1) sepia(0);
    background-color: transparent;
}

/* Mobile / narrow: backdrop-filter transitions + multi-glyph compositing hitch GPU;
   static rain blur + instant blur-off on exit; glyph path skipped in ui.js (simple cluster). */
@media (max-width: 768px) {
    .brand-intro-overlay.brand-intro--rain .brand-intro-backdrop {
        animation: none;
        -webkit-backdrop-filter: blur(10px) saturate(0.82) sepia(0.12);
        backdrop-filter: blur(10px) saturate(0.82) sepia(0.12);
    }

    html[data-theme="light"] .brand-intro-overlay.brand-intro--rain .brand-intro-backdrop {
        animation: none;
        -webkit-backdrop-filter: blur(8px) saturate(0.9) sepia(0.06);
        backdrop-filter: blur(8px) saturate(0.9) sepia(0.06);
    }

    .brand-intro-overlay.brand-intro--exit .brand-intro-backdrop {
        transition:
            opacity 0.3s ease-out,
            background-color 0.3s ease-out !important;
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
        background-color: transparent !important;
    }

    .brand-intro-overlay.brand-intro--exit .brand-intro-backdrop::before,
    .brand-intro-overlay.brand-intro--exit .brand-intro-backdrop::after {
        transition: opacity 0.28s ease-out !important;
    }

    html.brand-intro-active.brand-intro-nav-reveal #nav-brand .nav-brand-char {
        animation-duration: 0.38s;
        animation-delay: calc(0.42s + (var(--nb-i) * 36ms));
    }
}

@media (prefers-reduced-motion: reduce) {

    .brand-intro-overlay.brand-intro--rain .brand-intro-backdrop,
    html[data-theme="light"] .brand-intro-overlay.brand-intro--rain .brand-intro-backdrop {
        animation: none;
    }

    .brand-intro-overlay.brand-intro--exit .brand-intro-backdrop,
    .brand-intro-overlay.brand-intro--exit .brand-intro-backdrop::before,
    .brand-intro-overlay.brand-intro--exit .brand-intro-backdrop::after {
        transition: none;
    }

    .brand-intro-backdrop {
        -webkit-backdrop-filter: blur(10px) saturate(0.95);
        backdrop-filter: blur(10px) saturate(0.95);
    }

    html.brand-intro-active #nav-brand .nav-brand-char,
    html.brand-intro-active.brand-intro-nav-reveal #nav-brand .nav-brand-char {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }

    .brand-intro-overlay.brand-intro--exit .brand-intro-char {
        animation: none !important;
        opacity: 0 !important;
        transform: none !important;
    }
}

.brand-intro-cluster {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: nowrap;
    align-items: baseline;
    justify-content: center;
    transform-origin: center center;
    font-size: clamp(2.25rem, 7vw, 4rem);
    line-height: 1.1;
}

.brand-intro-char {
    display: inline-block;
    opacity: 0;
}

.brand-intro-overlay.brand-intro--rain .brand-intro-char {
    animation: brandIntroRain 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: calc(var(--bi-i) * 45ms);
}

/* Per-glyph “rain home”: staggered like entrance, each flies to its nav slot */
.brand-intro-overlay.brand-intro--exit .brand-intro-char {
    animation: brandIntroCharRainHome 0.95s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: calc(var(--bi-i) * 48ms);
}

@keyframes brandIntroCharRainHome {
    0% {
        opacity: 1;
        transform: translate3d(var(--fly-mx, 0px), var(--fly-my, 0px), 0) rotate(var(--fly-r0, 0deg)) scale(1);
    }

    82% {
        opacity: 1;
        transform: translate3d(var(--fly-dx, 0px), var(--fly-dy, 0px), 0) rotate(0deg) scale(var(--fly-s, 1));
    }

    100% {
        opacity: 0;
        transform: translate3d(var(--fly-dx, 0px), var(--fly-dy, 0px), 0) rotate(0deg) scale(var(--fly-s, 1));
    }
}

@keyframes brandIntroRain {
    from {
        opacity: 0;
        transform: translate3d(var(--bi-x, 0), -115vh, 0) rotate(var(--bi-r-from, 0deg));
    }

    to {
        opacity: 1;
        transform: translate3d(0, 0, 0) rotate(0deg);
    }
}

.hero-gradient-text {
    background: linear-gradient(105deg, #cbd5e1 0%, var(--accent) 42%, #93c5fd 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

html[data-theme="light"] .hero-gradient-text {
    background: linear-gradient(105deg, #475569 0%, var(--accent) 45%, #2563eb 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

#hero .hero-eyebrow {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0;
}

@media (min-width: 640px) {
    #hero .hero-eyebrow {
        font-size: 0.71875rem;
    }
}

#hero h1.hero-name {
    font-size: clamp(2.625rem, 5.5vw + 1rem, 4.25rem);
    line-height: 0.96;
}

#hero .hero-role-line {
    line-height: 1.38;
    max-width: 42ch;
}

html[data-theme='light'] #hero .hero-role-line {
    color: #475569 !important;
}

#hero .hero-lede.hero-gradient-text {
    margin: 0;
    max-width: 40ch;
    line-height: 1.45;
    opacity: 0.82;
}

@media (min-width: 768px) {
    #hero .hero-lede.hero-gradient-text {
        max-width: 42ch;
        opacity: 0.9;
    }
}

html[data-theme='light'] #hero .hero-lede.hero-gradient-text {
    opacity: 1;
}

#hero .hero-value {
    margin: 0;
}

#hero .hero-cta .btn {
    min-height: 2.75rem;
}

#hero .hero-scroll-affordance {
    text-decoration: none;
    color: var(--muted);
    transition: color var(--motion-link) var(--signal-ease);
}

#hero .hero-scroll-affordance .hero-scroll-icon {
    transition: transform var(--motion-link) var(--signal-ease);
}

#hero .hero-scroll-affordance:hover {
    color: var(--text);
}

@media (prefers-reduced-motion: no-preference) {
    #hero .hero-scroll-affordance:hover .hero-scroll-icon {
        transform: translateY(3px);
    }
}

@media (prefers-reduced-motion: reduce) {
    #hero .hero-scroll-affordance .hero-scroll-icon {
        transition: none !important;
        transform: none !important;
    }
}

html[data-theme='light'] #hero .hero-meta {
    border-top-color: rgba(15, 23, 42, 0.09);
}

#hero .hero-meta a {
    transition: color var(--motion-link) var(--signal-ease);
}

#hero .hero-meta a .icon-svg {
    transition: transform var(--motion-link) var(--signal-ease);
}

@media (prefers-reduced-motion: no-preference) {
    #hero .hero-meta a:hover .icon-svg {
        transform: translateY(-2px);
    }
}

@media (prefers-reduced-motion: reduce) {
    #hero .hero-meta a .icon-svg {
        transition: none;
    }
}

@media (max-width: 767px) {
    #hero .hero-inner {
        gap: clamp(1.5rem, 5vw, 2.25rem);
    }
}

/* Hero depth: vignette + wash over particles */
#hero.hero-stage,
#hero.hero-bg.hero-stage {
    isolation: isolate;
}

#hero.hero-stage::before,
#hero.hero-bg.hero-stage::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 85% 55% at 50% -15%, rgba(59, 130, 246, 0.2), transparent 58%),
        radial-gradient(ellipse 50% 45% at 95% 45%, rgba(37, 99, 235, 0.14), transparent 52%),
        linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.35) 100%);
}

html[data-theme="light"] #hero.hero-stage::before,
html[data-theme="light"] #hero.hero-bg.hero-stage::before {
    background:
        radial-gradient(ellipse 85% 55% at 50% -15%, rgba(59, 130, 246, 0.12), transparent 58%),
        radial-gradient(ellipse 50% 45% at 92% 40%, rgba(37, 99, 235, 0.08), transparent 50%),
        linear-gradient(180deg, transparent 0%, rgba(248, 250, 252, 0.85) 100%);
}

#hero.hero-stage > .max-w-6xl,
#hero.hero-bg.hero-stage > .max-w-6xl,
#hero .hero-inner {
    position: relative;
    z-index: 1;
}

#hero-plate {
    --tilt-x: 0px;
    --tilt-y: 0px;
    --plate-glow: 0.12;
    transform: translate3d(var(--tilt-x), var(--tilt-y), 0);
    transition:
        transform 0.35s var(--signal-ease),
        box-shadow 0.5s var(--signal-ease);
    box-shadow: 0 18px 50px rgba(37, 99, 235, var(--plate-glow));
}

#hero-plate[data-plate-section='about'] {
    --plate-glow: 0.16;
    box-shadow: 0 18px 48px rgba(37, 99, 235, 0.16);
}

#hero-plate[data-plate-section='skills'] {
    --plate-glow: 0.14;
    box-shadow: 0 18px 46px rgba(56, 189, 248, 0.14);
}

#hero-plate[data-plate-section='projects'] {
    --plate-glow: 0.2;
    box-shadow:
        0 18px 52px rgba(37, 99, 235, 0.2),
        0 0 40px rgba(96, 165, 250, 0.08);
}

#hero-plate[data-plate-section='contact'] {
    --plate-glow: 0.14;
    box-shadow: 0 18px 50px rgba(52, 211, 153, 0.12);
}

html[data-theme='light'] #hero-plate {
    box-shadow: 0 18px 45px rgba(59, 130, 246, 0.12);
}

html[data-theme='light'] #hero-plate[data-plate-section='projects'] {
    box-shadow:
        0 18px 48px rgba(37, 99, 235, 0.14),
        0 0 32px rgba(59, 130, 246, 0.08);
}

/* “Build. Ship.” card on home/index — layered after generic #hero-plate rules */
#hero-plate.hero-promo-plate {
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    background:
        radial-gradient(ellipse 95% 85% at 30% 25%, rgba(96, 165, 250, 0.22), transparent 62%),
        linear-gradient(148deg, rgba(15, 23, 42, 0.75), rgba(15, 23, 42, 0.35));
    border: 1px solid rgba(96, 165, 250, 0.38);
    border-radius: 1.5rem;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.05) inset,
        0 12px 48px rgba(37, 99, 235, 0.22),
        0 0 60px rgba(59, 130, 246, 0.06);
}

@media (max-width: 767px) {

    #hero-plate.hero-promo-plate {
        -webkit-backdrop-filter: blur(6px);
        backdrop-filter: blur(6px);
    }
}

html[data-theme='light'] #hero-plate.hero-promo-plate {
    background:
        radial-gradient(ellipse 95% 85% at 28% 22%, rgba(96, 165, 250, 0.14), transparent 58%),
        linear-gradient(148deg, rgba(255, 255, 255, 0.82), rgba(241, 245, 249, 0.55));
    border-color: rgba(59, 130, 246, 0.28);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.65) inset,
        0 12px 40px rgba(59, 130, 246, 0.1);
}

@media (prefers-reduced-motion: no-preference) {
    #hero-plate.hero-promo-plate:hover {
        box-shadow:
            0 0 0 1px rgba(255, 255, 255, 0.08) inset,
            0 18px 58px rgba(37, 99, 235, 0.3),
            0 0 72px rgba(59, 130, 246, 0.1);
    }

    html[data-theme='light'] #hero-plate.hero-promo-plate:hover {
        box-shadow:
            0 0 0 1px rgba(255, 255, 255, 0.75) inset,
            0 16px 50px rgba(59, 130, 246, 0.16);
    }
}

@media (prefers-reduced-motion: reduce) {
    #hero-plate {
        transform: none !important;
        transition: none;
    }
}

/* Scroll-reveal sections */
.reveal-section .reveal-item {
    opacity: 0;
    transform: translate3d(0, var(--motion-reveal-y), 0);
    transition:
        opacity var(--motion-reveal-dur) var(--signal-ease) var(--reveal-stagger, 0ms),
        transform var(--motion-reveal-dur) var(--signal-ease) var(--reveal-stagger, 0ms);
}

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

/* Carousel cards: opacity only — translate3d on overflow-x children breaks drag/scroll */
.reveal-section .reveal-item.reveal-carousel {
    opacity: 0;
    transform: none;
    transition: opacity var(--motion-reveal-dur) var(--signal-ease) var(--reveal-stagger, 0ms);
}

.reveal-section.is-visible .reveal-item.reveal-carousel {
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    .reveal-section .reveal-item.reveal-carousel {
        opacity: 1;
        transition: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .reveal-section .reveal-item {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* Nav: compact on scroll + active section */
.site-nav.is-compact .nav-shell {
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

.site-nav.is-compact {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

html[data-theme="light"] .site-nav.is-compact {
    box-shadow: 0 6px 28px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.site-nav .nav-section-link {
    position: relative;
    transition: color var(--motion-link) var(--signal-ease);
}

.site-nav .nav-section-link.nav-active {
    color: var(--accent) !important;
}

.site-nav .nav-section-link.nav-active::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -0.35rem;
    height: var(--top-strip-height);
    border-radius: 999px;
    background: linear-gradient(90deg, transparent, var(--accent) 25%, #38bdf8 55%, transparent);
    opacity: 0.9;
    box-shadow: 0 0 8px rgba(96, 165, 250, 0.35);
    transition: opacity 0.2s var(--signal-ease);
}

@media (max-width: 767px) {
    .site-nav .nav-section-link.nav-active::after {
        display: none;
    }
}

#project-carousel .project-card {
    flex: 0 0 auto;
    background: var(--surface-carousel-card);
    border-color: var(--card-border);
    transition:
        transform 0.34s var(--signal-ease),
        border-color 0.26s var(--signal-ease),
        box-shadow 0.32s var(--signal-ease);
    box-shadow: var(--shadow-card);
}

@media (min-width: 768px) {
    #project-carousel .project-card {
        width: 100%;
        min-width: 100%;
        max-width: 100%;
        min-height: 26rem;
    }
}

@media (max-width: 767px) {
    #project-carousel .project-card {
        min-height: 0;
        width: min(24rem, calc(100vw - 2.5rem));
        min-width: min(24rem, calc(100vw - 2.5rem));
    }
}

@media (min-width: 1024px) {
    #project-carousel .project-card {
        min-height: 28rem;
    }
}

#project-carousel .project-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-accent);
    box-shadow: var(--shadow-card-hover);
}

#project-carousel .project-card-media {
    overflow: hidden;
}

#project-carousel .project-card-media:has(.project-card-media-placeholder) {
    border-bottom: 1px solid var(--border-subtle);
}

#project-carousel .project-card-img {
    max-width: 100%;
    height: auto;
    transition: transform 0.38s var(--signal-ease);
    will-change: transform;
}

#project-carousel .project-card:hover .project-card-img {
    transform: scale(1.02);
}

#project-carousel .project-card-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    gap: 0.75rem;
    padding: 1.2rem 1.15rem 1.35rem;
    text-align: left;
}

@media (min-width: 768px) {
    #project-carousel .project-card-body {
        gap: 0.82rem;
        padding: 1.5rem 1.75rem 1.85rem;
    }
}

#project-carousel .project-card-eyebrow {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0;
}

#project-carousel .project-card-title {
    margin: 0;
    line-height: 1.2;
    overflow-wrap: anywhere;
    word-break: break-word;
}

@media (min-width: 768px) {
    #project-carousel .project-card-title {
        line-height: 1.22;
    }
}

#project-carousel .project-card-desc {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.58;
    overflow-wrap: anywhere;
}

html[data-theme='light'] #project-carousel .project-card-title {
    color: var(--text) !important;
}

#project-carousel .project-stack {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.25rem;
}

#project-carousel .project-stack-label {
    font-family: ui-monospace, 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.625rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent-muted-fg);
}

#project-carousel .project-spec-tags li {
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    border: 1px solid var(--border-accent-soft);
    background: var(--chip-bg);
    list-style: none;
    font-family: ui-monospace, 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--chip-text);
}

#project-carousel .project-inspect {
    margin-top: 0.25rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--border-divider);
}

#project-carousel .project-inspect-summary {
    width: 100%;
    padding: 0.42rem 0.15rem;
    margin: 0;
    border-radius: 0.35rem;
    font-size: 0.78rem;
    color: color-mix(in srgb, var(--accent) 92%, transparent);
    transition:
        background-color 0.2s var(--signal-ease),
        color 0.2s var(--signal-ease);
}

#project-carousel .project-inspect-summary:hover {
    background: var(--surface-accent-wash);
}

#project-carousel .project-inspect[open] > .project-inspect-summary {
    margin-bottom: 0.2rem;
    color: var(--accent-soft);
}

#project-carousel .project-spec-panel {
    padding: 0 0 0.35rem;
}

#project-carousel .project-spec-panel .project-spec-thesis {
    font-size: 0.895rem;
}

#project-carousel .project-card-footer {
    margin-top: auto;
    padding-top: 1.1rem;
}

#project-carousel .project-card-footer .project-card-cta,
#project-carousel .project-card-footer .link-project {
    margin-top: 0;
}

#project-carousel .project-card-footer .project-card-cta.link-project {
    justify-content: center;
    width: 100%;
    max-width: 100%;
    min-height: 2.75rem;
    padding: 0.65rem 1rem;
    border-radius: var(--radius-btn);
    border: 1px solid var(--cta-pill-border);
    background: var(--cta-pill-bg);
    font-weight: 600;
    font-size: 0.9rem;
    gap: 0.45rem;
    color: var(--accent);
    transition:
        border-color 0.22s var(--signal-ease),
        background-color 0.22s var(--signal-ease),
        box-shadow 0.22s var(--signal-ease),
        opacity 0.2s ease,
        gap 0.2s ease,
        color 0.2s ease;
}

@media (min-width: 480px) {
    #project-carousel .project-card-footer .project-card-cta.link-project {
        width: auto;
        justify-content: flex-start;
        align-self: flex-start;
        min-width: 12rem;
        padding-left: 1.25rem;
        padding-right: 1.35rem;
    }
}

#project-carousel .project-card-footer .project-card-cta.link-project:hover {
    border-color: var(--cta-pill-border-hover);
    background: var(--cta-pill-bg-hover);
    opacity: 1;
    box-shadow: var(--cta-pill-shadow-hover);
}

#project-carousel .project-card-footer .link-project-external::after {
    content: none;
}

html[data-theme='light'] #project-carousel .project-card-footer .project-card-cta.link-project {
    color: var(--accent-deep);
}

html[data-theme='light'] #project-carousel .project-card-footer .project-card-cta.link-project:hover {
    color: var(--accent-deep);
}

#project-carousel .project-card-cta-placeholder {
    display: block;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
    #skills .grid>div,
    #project-carousel .project-card,
    #project-carousel .project-card-img,
    .carousel-nav-btn,
    .resume-download-btn {
        transition: none !important;
    }

    .carousel-nav-btn:hover,
    .carousel-nav-btn:active,
    .resume-download-btn:hover,
    .resume-download-btn:active {
        transform: none;
    }

    #skills .grid>div:hover,
    #project-carousel .project-card:hover {
        transform: none;
    }

    #project-carousel .project-card:hover .project-card-img {
        transform: none;
    }

    #project-carousel.project-carousel {
        mask-image: none;
        -webkit-mask-image: none;
    }
}

/* About timeline (lab log) */
.about-timeline-dot {
    position: absolute;
    left: calc(-1.25rem - 6px);
    top: 0.4rem;
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 0 10px rgba(96, 165, 250, 0.88);
}

@media (max-width: 479px) {
    .about-lab-log-panel .about-timeline > li p:not([class*='font-mono']) {
        font-size: 0.9375rem;
        line-height: 1.58;
    }

    .about-lab-log-panel {
        padding-left: 1.15rem;
        padding-right: 1.15rem;
    }
}

/* Project “inspect” spec sheet */
.project-inspect-summary {
    cursor: pointer;
    list-style: none;
    font-family: ui-monospace, 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    color: color-mix(in srgb, var(--accent) 92%, transparent);
    user-select: none;
}

.project-inspect-summary::-webkit-details-marker {
    display: none;
}

.project-inspect[open] > .project-inspect-summary {
    color: var(--accent-soft);
}

.project-spec-tags li {
    padding: 0.12rem 0.45rem;
    border-radius: 0.2rem;
    border: 1px solid var(--border-accent-soft);
    background: var(--surface-elevated);
    list-style: none;
}

html[data-theme="light"] .project-spec-tags li {
    background: var(--chip-bg);
    border-color: var(--border-accent-soft);
    color: var(--chip-text);
}

/* Contact form terminal-style status */
.form-status-line--pending {
    border-color: var(--status-pending-border) !important;
    background: var(--status-pending-bg);
    color: var(--status-pending-text);
}

.form-status-line--ok {
    border-color: var(--status-success-border) !important;
    background: var(--status-success-bg);
    color: var(--status-success-text);
}

.form-status-line--err {
    border-color: var(--status-danger-border) !important;
    background: var(--status-danger-bg);
    color: var(--status-danger-text);
}

html[data-theme="light"] .form-status-line--pending {
    color: var(--status-pending-text);
}

html[data-theme="light"] .form-status-line--ok {
    color: var(--status-success-text);
}

html[data-theme="light"] .form-status-line--err {
    color: var(--status-danger-text);
}
