/* ==========================================================================
   USAGE GUIDE & PALETTE DEFINITIONS
   ========================================================================== 
   Primary Colors:
   - Vanilla Cream (#F0E7D5): Used for main backgrounds, providing a warm, 
     elegant base that reduces eye strain compared to pure white.
   - Midnight Indigo (#212842): High-contrast dark shade used for primary text,
     headings, buttons (CTAs), and strong accents.

   Extended Neutral Palette (Complementary):
   - Soft Slate (#4A5568): A muted grey-blue that bridges the contrast. Used for 
     secondary text, descriptions, and subtle UI elements.
   - Muted Gold (#C5A059): A sophisticated accent color used for subtle highlights, 
     focus states, or secondary hover effects.
   - Card Cream (#FAF6F0): A slightly lighter tint of Vanilla Cream to provide 
     subtle elevation and separation for cards and inputs.
   - Subtle Border (#DCD1BD): For dividing lines and structural borders.

   Accessibility: 
   - Midnight Indigo (#212842) on Vanilla Cream (#F0E7D5) yields a contrast 
     ratio > 10:1, comfortably exceeding WCAG AA (4.5:1) requirements.
   ========================================================================== */

/* ==========================================================================
   CSS VARIABLES
   ========================================================================== */
:root {
    /* Color Palette */
    --bg-primary: #F0E7D5;
    --card-bg: #FAF6F0;
    --text-primary: #212842;
    --text-muted: #4A5568;
    --accent-color: #212842;
    --accent-hover: #151a2d;
    --accent-gold: #C5A059;
    --border-color: #DCD1BD;
    --nav-glass-bg: rgba(240, 231, 213, 0.85);
    
    /* Typography */
    --font-primary: 'Inter', sans-serif;
    --base-line-height: 1.6;

    /* Layout & Animation */
    --transition: all 0.3s ease-in-out;
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --shadow-base: 0 4px 6px rgba(33, 40, 66, 0.05);
    --shadow-hover: 0 12px 24px rgba(33, 40, 66, 0.12);
}

/* -----------------------------------------------------
   Dark mode overrides (apply when body.dark-theme exists)
   ----------------------------------------------------- */
body.dark-theme {
    /* swap to dark background with light text */
    --bg-primary: #212842;
    --card-bg: #2c334b;
    --text-primary: #F0E7D5;
    --text-muted: #C5A059;
    --accent-color: #F0E7D5;
    --accent-hover: #FAF6F0;
    --border-color: #4A5568;
    --nav-glass-bg: rgba(33, 40, 66, 0.85);
}

/* ==========================================================================
   CSS RESET & BASE SETUP
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
}

body, h1, h2, h3, h4, h5, h6, p, figure {
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

/* Hide native scrollbars globally for a cleaner UI
   - keeps scroll behavior but removes native scrollbar visuals
   - cross-browser: WebKit, Firefox, and IE/Edge */
*::-webkit-scrollbar { display: none; width: 0; height: 0; }
html, body, * {
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
}

body {
    font-family: var(--font-primary);
    font-weight: 400;
    line-height: var(--base-line-height);
    color: var(--text-primary);
    background-color: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
}

/* Specific Element Handling */
img {
    display: block;
    max-width: 100%;
    height: auto;
}

ul {
    padding: 0;
    margin: 0;
}

/* ==========================================================================
   TYPOGRAPHY & UTILITY CLASSES
   ========================================================================== */
h1, h2, h3, h4 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.text-primary { color: var(--text-primary); }
.text-muted { color: var(--text-muted); }
.bg-primary { background-color: var(--bg-primary); }
.bg-card { background-color: var(--card-bg); }

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.section {
    padding: 6rem 0;
}

.section-title {
    font-size: 2.25rem;
    margin-bottom: 2.5rem;
    position: relative;
    display: inline-block;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ==========================================================================
   LAYOUT & COMPONENT STYLING
   ========================================================================== */

/* HEADER & NAVBAR */
.header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--nav-glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(220, 209, 189, 0.5);
    padding: 1rem 0;
}

.header__container {
    display: flex;
    justify-content: space-between; /* logo/nav on left, controls on right */
    align-items: center;
    position: relative; /* for absolute children */
}

.logo {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
}

/* wrapper around logo + nav to keep center cluster */
.header-main {
    display: flex;
    align-items: center;
    gap: 3.5rem; /* more space between logo and nav so items don't stick */
}

/* center navigation bar within header container */
.nav {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.nav__list {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.nav__link {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    transition: var(--transition);
}

/* Links Hover State per prompt */
.nav__link:hover, .project-link:hover {
    color: var(--accent-color);
}

.header__controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: absolute;
    right: 1rem;
}

#music-toggle {
    /* keep button visible while scrolling */
    position: fixed; /* fixed to viewport so it doesn't scroll out of view */
    top: 72px; /* place below the sticky header - adjust if your header height differs */
    left: 1rem;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    background: transparent;
    border: 1px solid rgba(33,40,66,0.06);
    border-radius: 999px; /* fully round */
    cursor: pointer;
    color: var(--text-primary);
    font-size: 1.25rem;
    z-index: 900; /* sit below header but above page content */
    transition: left 0.28s ease, background 0.22s ease, color 0.22s ease, top 0.22s ease;
}
/* use explicit left when shifted so the button sits exactly at the sidebar edge */
#music-toggle.shifted {
    left: 300px; /* equal to sidebar width so it's flush with the panel */
    top: 72px;
    transform: none;
    background: var(--card-bg);
    color: var(--text-primary);
    /* keep circular normally, but make the left edge flat when attached */
    border-top-right-radius: 999px;
    border-bottom-right-radius: 999px;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    /* remove left border so there's no visible seam against the panel */
    border-left: none;
    box-shadow: 2px 0 8px rgba(33,40,66,0.08);
    z-index: 910; /* above the sidebar edge so it visually attaches */
}
#music-toggle:hover {
    color: var(--accent-color);
}
#music-toggle:focus {
    outline: 2px solid rgba(0,0,0,0.08);
    outline-offset: 2px;
}

/* sidebar that slides from left (z-index lowered so header stays above) */
.music-sidebar {
    position: fixed;
    top: 0;
    left: -320px; /* hide off-screen initially */
    width: 300px;
    height: 100%;
    background: var(--card-bg);
    box-shadow: 2px 0 12px rgba(33,40,66,0.15);
    transition: left 0.3s ease;
    z-index: 900; /* header is 1000 */
    overflow-y: hidden; /* Let the inner player handle scrolling */
    padding-top: 0; /* Remove padding, let player control its own layout */
}
.music-sidebar.open {
    left: 0;
}

/* ensure main content doesn't shift when sidebar opens - optional overlay */
.music-sidebar + main::before {
    content: '';
}

/* subtle top scroll progress indicator for the music sidebar */
.music-sidebar .scroll-indicator {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    pointer-events: none;
    z-index: 920;
    opacity: 0;
    transition: opacity 180ms ease;
}
.music-sidebar.open .scroll-indicator { opacity: 1; }
.music-sidebar .scroll-indicator__bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-color), var(--accent-gold));
    transition: width 120ms linear;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}

/* Theme Toggle Button */
#theme-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    transition: var(--transition);
}

#theme-toggle:hover {
    background: rgba(33, 40, 66, 0.05);
}

/* HERO SECTION */
.hero {
    min-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.hero__content {
    max-width: 800px; /* Constraints for readability */
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero__title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    letter-spacing: -0.02em;
}

.text-highlight {
    color: var(--accent-gold);
}

.hero__subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    max-width: 600px;
}

.hero__actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    border: 2px solid transparent;
}

.btn--primary {
    background: var(--accent-color);
    color: var(--bg-primary);
}

.btn--secondary {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

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

/* Button Hover States */
.btn:hover {
    transform: translateY(-2px);
}

.btn--primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 12px rgba(33, 40, 66, 0.2);
}

.btn--secondary:hover, .btn--outline:hover {
    background: var(--text-primary);
    color: var(--bg-primary);
    border-color: var(--text-primary);
}

/* ABOUT SECTION */
.about__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.about__img {
    /* make portrait perfectly round and add smooth animation */
    border-radius: 50%;
    box-shadow: var(--shadow-base);
    object-fit: cover;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    cursor: pointer;
}

/* hover/focus animation for circular image */
.about__img:hover,
.about__img:focus {
    transform: scale(1.05) rotate(2deg);
    box-shadow: 0 8px 20px rgba(33, 40, 66, 0.2);
}

.about__bio {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.about__bio p {
    margin-bottom: 1rem;
}

/* PROJECTS SECTION */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.project-card {
    background: var(--card-bg);
    border-radius: var(--border-radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-base);
    transition: transform 220ms cubic-bezier(.2,.8,.2,1), box-shadow 220ms cubic-bezier(.2,.8,.2,1);
    will-change: transform, box-shadow;
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover);
}

.project-card__image {
    margin: -1.5rem -1.5rem 1.5rem -1.5rem; /* Break out of padding */
    border-radius: var(--border-radius-md) var(--border-radius-md) 0 0;
    overflow: hidden;
}

.project-card__image img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    transition: transform 300ms cubic-bezier(.2,.8,.2,1);
    will-change: transform;
}

.project-card:hover .project-card__image img,
.project-card__image:hover img {
    transform: scale(1.05);
}

.project-card__content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.project-card__description {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.project-card__tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.tag {
    background: var(--bg-primary);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    border: 1px solid var(--border-color);
}

.project-card__links {
    display: flex;
    gap: 1.5rem;
}

.project-link {
    color: var(--text-muted);
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    font-size: 0.9rem;
}

/* CONTACT SECTION */
.contact__container {
    max-width: 600px;
    margin: 0 auto;
}

.contact__header {
    text-align: center;
    margin-bottom: 3rem;
}

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

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-label {
    font-weight: 600;
    font-size: 0.9rem;
}

.form-input, .form-textarea {
    width: 100%;
    padding: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background: var(--card-bg);
    color: var(--text-primary);
    font-family: var(--font-primary);
    transition: var(--transition);
}

.form-input:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(33, 40, 66, 0.1);
}

.btn--full {
    width: 100%;
}

/* FOOTER */
.footer {
    padding: 3rem 0;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.footer__container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.footer__copyright {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* make social icons appear in a horizontal row */
.footer__social {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    padding: 0;
    margin: 0;
    list-style: none;
}

.footer__social-item {
    /* flex items default to row, no extra needed */
}

.footer__social-link {
    color: var(--text-muted);
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.footer__social-link:hover {
    color: var(--accent-color);
    transform: translateY(-2px);
}

/* ==========================================================================
   RESPONSIVENESS & MEDIA QUERIES
   ========================================================================== */

/* Strict Hamburger visibility setup for desktop */
@media (min-width: 769px) {
    .hamburger {
        display: none !important;
    }
}

/* Mobile & Tablet */
@media (max-width: 768px) {
    .container {
        padding: 0 1.5rem;
    }

    .section {
        padding: 4rem 0;
    }

    /* Navbar behavior on mobile */
    .nav {
        display: none; /* Hide desktop nav links */
    }

    /* when menu is toggled open via script, show the nav container */
    .nav.open {
        display: block;
        position: absolute;
        top: 100%;
        right: 2rem;
        background: var(--bg-primary);
        border-radius: var(--border-radius-md);
        box-shadow: var(--shadow-base);
        padding: 1rem 1.5rem;
        z-index: 1000;
    }

    .nav.open .nav__list {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }

    .hamburger {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 0.5rem;
        z-index: 1001;
    }

    .hamburger__line {
        width: 24px;
        height: 2px;
        background-color: var(--text-primary);
        transition: var(--transition);
        border-radius: 2px;
    }

    /* Stack sections on mobile */
    .hero__actions {
        flex-direction: column;
        width: 100%;
    }

    .btn {
        width: 100%;
    }

    .about__grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .about__image-wrapper {
        order: -1; /* Ensure image stays above text on mobile */
        max-width: 300px;
        margin: 0 auto;
        /* keep circular crop during rotation/scale */
        overflow: hidden;
        border-radius: 50%;
        display: inline-block;
    }
}
/* ==========================================================================
   LOADING SCREEN
   ========================================================================== */

/* Lock body scroll while loader is active */
body.loading {
    overflow: hidden;
}

#loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #212842;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    /* fade out when done */
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

#loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* ── Grain overlay for texture ── */
#loader::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
    opacity: 0.4;
    pointer-events: none;
}

/* ── Decorative diagonal rule lines ── */
#loader::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 60px,
        rgba(197, 160, 89, 0.03) 60px,
        rgba(197, 160, 89, 0.03) 61px
    );
    pointer-events: none;
}

/* ── Corner accents ── */
.loader-corner {
    position: absolute;
    width: 40px;
    height: 40px;
    border-color: rgba(197, 160, 89, 0.4);
    border-style: solid;
}
.loader-corner--tl { top: 2rem; left: 2rem; border-width: 1px 0 0 1px; }
.loader-corner--tr { top: 2rem; right: 2rem; border-width: 1px 1px 0 0; }
.loader-corner--bl { bottom: 2rem; left: 2rem; border-width: 0 0 1px 1px; }
.loader-corner--br { bottom: 2rem; right: 2rem; border-width: 0 1px 1px 0; }

/* ── Subtle top label ── */
.loader-eyebrow {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: rgba(197, 160, 89, 0.6);
    margin-bottom: 3.5rem;
    opacity: 0;
    animation: loaderFadeUp 0.8s ease forwards 0.3s;
}

/* ── Type prompt ── */
.loader-prompt {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(240, 231, 213, 0.3);
    margin-bottom: 2rem;
    opacity: 0;
    animation: loaderFadeUp 0.8s ease forwards 0.5s;
}

/* ── Main word display ── */
.loader-word {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 110px;
    margin-bottom: 2.5rem;
}

/* Characters container */
.loader-chars {
    display: flex;
    gap: 0.04em;
}

/* Each character span - Animated Assembly Version */
.loader-char {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: clamp(52px, 8vw, 88px);
    font-weight: 400;
    letter-spacing: -0.01em;
    color: #F0E7D5;
    line-height: 1;
    display: inline-block;
    opacity: 0;
    transition: opacity 0.18s ease, transform 0.22s ease, color 0.3s ease;
}

/* Animated version - starts scattered */
.loader-char-animated {
    opacity: 0;
    transform: translate(var(--start-x, 0), var(--start-y, 0)) 
               rotate(var(--start-rotate, 0deg)) 
               scale(var(--start-scale, 0.5));
    transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Assembled state - letters fly into position */
.loader-char-animated.assembled {
    opacity: 1;
    transform: translate(0, 0) rotate(0deg) scale(1);
    color: #F0E7D5;
}

/* Legacy typed state for backwards compatibility */
.loader-char.typed {
    opacity: 1;
    transform: translateY(0);
    color: #F0E7D5;
}

/* Wrong character shake feedback */
.loader-char.wrong {
    color: #e05252;
    animation: loaderShake 0.35s ease;
}

/* Cursor blink at end of typed text */
.loader-cursor {
    display: inline-block;
    width: 3px;
    height: 0.85em;
    background: #C5A059;
    border-radius: 2px;
    margin-left: 4px;
    align-self: center;
    animation: loaderBlink 1s step-end infinite;
    opacity: 1;
    transition: opacity 0.2s;
}
.loader-cursor.hidden { opacity: 0; }

/* ── Progress bar under word ── */
.loader-progress-track {
    width: clamp(200px, 40vw, 340px);
    height: 2px;
    background: rgba(240, 231, 213, 0.08);
    border-radius: 2px;
    overflow: hidden;
    opacity: 0;
    animation: loaderFadeUp 0.8s ease forwards 0.6s;
}

.loader-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #C5A059, #F0E7D5);
    border-radius: 2px;
    width: 0%;
    transition: width 0.15s ease;
}

/* ── Hint text below bar ── */
.loader-hint {
    margin-top: 1.4rem;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 400;
    color: rgba(240, 231, 213, 0.22);
    letter-spacing: 0.08em;
    opacity: 0;
    animation: loaderFadeUp 0.8s ease forwards 0.7s;
    transition: color 0.3s ease;
    height: 16px;
}

/* ── "Access granted" state ── */
.loader-chars.done .loader-char {
    color: #C5A059;
}

/* ── Flying word animation to logo ── */
.loader-fly-clone {
    position: fixed;
    font-family: 'Georgia', 'Times New Roman', serif;
    font-weight: 400;
    color: #212842;
    white-space: nowrap;
    pointer-events: none;
    z-index: 10000;
    transition: none; /* JS-driven via WAAPI */
}

/* ── Keyframes ── */
@keyframes loaderFadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes loaderBlink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}

@keyframes loaderShake {
    0%,100% { transform: translateX(0); }
    20%     { transform: translateX(-6px); }
    40%     { transform: translateX(6px); }
    60%     { transform: translateX(-4px); }
    80%     { transform: translateX(4px); }
}

@keyframes loaderFlash {
    0%,100% { background: #212842; }
    50%     { background: #2c334b; }
}
/* ==========================================================================
   CUSTOM CURSOR
   ========================================================================== */
*, *::before, *::after { cursor: none !important; }

#cursor-dot {
    position: fixed;
    top: 0; left: 0;
    width: 6px; height: 6px;
    background: var(--accent-gold);
    border-radius: 50%;
    pointer-events: none;
    z-index: 99999;
    transform: translate(-50%, -50%);
    transition: width 0.2s ease, height 0.2s ease, background 0.2s ease, opacity 0.3s ease;
    will-change: transform;
}

#cursor-ring {
    position: fixed;
    top: 0; left: 0;
    width: 36px; height: 36px;
    border: 1.5px solid rgba(197, 160, 89, 0.5);
    border-radius: 50%;
    pointer-events: none;
    z-index: 99998;
    transform: translate(-50%, -50%);
    transition: width 0.35s cubic-bezier(0.25,0.46,0.45,0.94),
                height 0.35s cubic-bezier(0.25,0.46,0.45,0.94),
                border-color 0.3s ease,
                background 0.3s ease,
                opacity 0.3s ease;
    will-change: transform;
}

/* Hover state — ring expands and fills slightly */
body.cursor-hover #cursor-ring {
    width: 56px; height: 56px;
    border-color: rgba(197, 160, 89, 0.8);
    background: rgba(197, 160, 89, 0.06);
}
body.cursor-hover #cursor-dot {
    width: 4px; height: 4px;
    background: var(--accent-gold);
}

/* Click state — ring shrinks fast */
body.cursor-click #cursor-ring {
    width: 20px; height: 20px;
    border-color: var(--accent-gold);
    background: rgba(197, 160, 89, 0.15);
    transition: width 0.1s ease, height 0.1s ease;
}
body.cursor-click #cursor-dot {
    width: 8px; height: 8px;
}

/* Text cursor override */
body.cursor-text #cursor-ring {
    width: 3px; height: 32px;
    border-radius: 2px;
    border-color: var(--accent-gold);
}
body.cursor-text #cursor-dot { opacity: 0; }

/* ==========================================================================
   HERO CANVAS BACKGROUND
   ========================================================================== */
.hero {
    position: relative;
    overflow: hidden;
}

#hero-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* Vignette overlay — darkens edges for drama */
.hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        ellipse 80% 70% at 50% 50%,
        transparent 40%,
        rgba(var(--bg-primary-rgb, 240, 231, 213), 0.55) 100%
    );
    pointer-events: none;
    z-index: 1;
}

body.dark-theme .hero::after {
    background: radial-gradient(
        ellipse 80% 70% at 50% 50%,
        transparent 40%,
        rgba(33, 40, 66, 0.65) 100%
    );
}

/* Push hero content above canvas */
.hero__container {
    position: relative;
    z-index: 2;
}

/* ── Hero title character animation ── */
.hero__title .word {
    display: inline-block;
    overflow: hidden;
    vertical-align: bottom;
    margin-right: 0.25em;
}
.hero__title .word:last-child { margin-right: 0; }

.hero__title .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(105%);
    animation: heroCharReveal 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.hero__subtitle {
    opacity: 0;
    transform: translateY(12px);
    animation: heroFadeUp 0.8s ease forwards;
}

.hero__actions {
    opacity: 0;
    transform: translateY(12px);
    animation: heroFadeUp 0.8s ease forwards;
}

/* Idle float on highlighted name */
.hero__title .text-highlight {
    display: inline-block;
    animation: heroNameFloat 4s ease-in-out infinite;
    animation-delay: 1.4s;
}

@keyframes heroCharReveal {
    to { opacity: 1; transform: translateY(0); }
}
@keyframes heroFadeUp {
    to { opacity: 1; transform: translateY(0); }
}
@keyframes heroNameFloat {
    0%, 100% { transform: translateY(0px); }
    50%       { transform: translateY(-5px); }
}

/* ==========================================================================
   SCROLL REVEAL
   ========================================================================== */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.75s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.75s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children of a reveal-group */
.reveal-group > * {
    opacity: 0;
    transform: translateY(32px);
    transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal-group.revealed > *:nth-child(1) { opacity:1; transform:translateY(0); transition-delay: 0s; }
.reveal-group.revealed > *:nth-child(2) { opacity:1; transform:translateY(0); transition-delay: 0.1s; }
.reveal-group.revealed > *:nth-child(3) { opacity:1; transform:translateY(0); transition-delay: 0.2s; }
.reveal-group.revealed > *:nth-child(4) { opacity:1; transform:translateY(0); transition-delay: 0.3s; }
.reveal-group.revealed > *:nth-child(5) { opacity:1; transform:translateY(0); transition-delay: 0.4s; }
.reveal-group.revealed > *:nth-child(6) { opacity:1; transform:translateY(0); transition-delay: 0.5s; }

/* Section title reveal with underline sweep */
.section-title {
    overflow: hidden;
}
.section-title::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0%;
    height: 2px;
    background: var(--accent-gold);
    transition: width 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.3s;
}
.reveal-group.revealed .section-title::after,
.revealed.section-title::after {
    width: 100%;
}

/* ==========================================================================
   3D TILT PROJECT CARDS
   ========================================================================== */
.project-card {
    transform-style: preserve-3d;
    transform: perspective(900px) rotateX(0deg) rotateY(0deg);
    transition: box-shadow 0.4s ease, transform 0.1s ease;
    will-change: transform;
    position: relative;
    overflow: hidden;
}

/* Sheen overlay — tracks cursor position via JS custom props */
.project-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        circle at var(--mx, 50%) var(--my, 50%),
        rgba(255,255,255,0.08) 0%,
        transparent 60%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 10;
    border-radius: var(--border-radius-md);
}
.project-card:hover::before { opacity: 1; }

/* Gold edge glow on hover */
.project-card:hover {
    box-shadow: 0 24px 60px rgba(33,40,66,0.18),
                0 0 0 1px rgba(197,160,89,0.2);
}

/* ==========================================================================
   MUSIC TOGGLE — hide-on-scroll tweak
   ========================================================================== */
#music-toggle {
    transition: left 0.28s ease, background 0.22s ease, color 0.22s ease,
                top 0.22s ease, opacity 0.25s ease, transform 0.25s ease;
}
#music-toggle.hidden-on-scroll {
    opacity: 0;
    transform: translateX(-8px);
    pointer-events: none;
}

/* ==========================================================================
   MUSIC PLAYER COMPONENT STYLES
   ========================================================================== */

/* Music player root container adjustments */
#music-player-root {
    height: 100%;
    width: 100%;
}

/* Music player buttons */
.mp-icon-btn {
    background: transparent;
    border: none;
    color: #a1a1aa;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.mp-icon-btn:hover {
    background: rgba(255,255,255,0.08);
    color: #e4e4e7;
    transform: scale(1.05);
}

.mp-icon-btn:active {
    transform: scale(0.95);
}

/* Play button - larger and more prominent */
.mp-play-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #818cf8 0%, #6366f1 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mp-play-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 32px rgba(99, 102, 241, 0.5);
}

.mp-play-btn:active {
    transform: scale(0.95);
}

/* Custom range slider for progress */
.mp-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(
        to right, 
        #818cf8 0%, 
        #818cf8 var(--prog, 0%), 
        rgba(255,255,255,0.1) var(--prog, 0%), 
        rgba(255,255,255,0.1) 100%
    );
    outline: none;
    cursor: pointer;
}

.mp-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: transform 0.15s ease;
}

.mp-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.mp-range::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: transform 0.15s ease;
}

.mp-range::-moz-range-thumb:hover {
    transform: scale(1.2);
}

/* Queue item styling */
.mp-queue-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    background: transparent;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    margin-bottom: 6px;
}

.mp-queue-item:hover {
    background: rgba(255,255,255,0.05);
}

.mp-queue-item.active {
    background: rgba(129, 140, 248, 0.15);
}

.mp-queue-item:active {
    transform: scale(0.98);
}

/* Custom scrollbar for music player */
.mp-scrollbar::-webkit-scrollbar {
    width: 8px;
    display: block !important;
}

.mp-scrollbar::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.03);
    border-radius: 4px;
}

.mp-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 4px;
    transition: background 0.2s ease;
}

.mp-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.25);
}

/* Firefox scrollbar */
.mp-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) rgba(255,255,255,0.03);
}

/* Animated bars for playing indicator */
.mp-bar {
    width: 3px;
    background: linear-gradient(to top, #818cf8, #a78bfa);
    border-radius: 2px;
}

@keyframes mp-bounce {
    0%, 100% { height: 8px; }
    50% { height: 100%; }
}

/* Responsive adjustments for music sidebar */
@media (max-width: 768px) {
    .music-sidebar {
        width: 280px;
        left: -300px;
    }
    
    #music-toggle.shifted {
        left: 280px;
    }
    
    .mp-play-btn {
        width: 56px;
        height: 56px;
    }
}

/* Dark theme specific adjustments */
body.dark-theme .mp-icon-btn {
    color: #71717a;
}

body.dark-theme .mp-icon-btn:hover {
    background: rgba(255,255,255,0.06);
    color: #d4d4d8;
}

body.dark-theme .mp-range {
    background: linear-gradient(
        to right, 
        #818cf8 0%, 
        #818cf8 var(--prog, 0%), 
        rgba(255,255,255,0.08) var(--prog, 0%), 
        rgba(255,255,255,0.08) 100%
    );
}

body.dark-theme .mp-queue-item:hover {
    background: rgba(255,255,255,0.04);
}

body.dark-theme .mp-queue-item.active {
    background: rgba(129, 140, 248, 0.12);
}

