* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: #f7f9fa;
    color: #4a5d6e;
    overflow-x: hidden;
    overflow-y: auto;
}

.intro {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #e4edf2, #f7f9fa);
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    z-index: 50;
    pointer-events: none;
    /* Opaque from the very first paint — this is what should cover the
       canvas/nav while everything loads, not something that starts
       invisible and has to be faded IN before it can hide anything. */
    opacity: 1;
    /* Breathing room + centered wrapping — without this the title/subtitle
       can touch (or run past) the screen edges on narrow phones. */
    padding: 0 24px;
    text-align: center;
}

.intro h1 {
    /* Fluid instead of a fixed 4rem — scales continuously with viewport
       width so it never overflows a narrow phone screen, rather than
       relying on a single breakpoint jump. */
    font-size: clamp(2.1rem, 9vw, 4rem);
    font-weight: 300;
    margin-bottom: 1rem;
    color: #5c7c94;
    /* Stays hidden until main.js has replaced the raw text with scramble
       spans — the real English word should never flash on screen before
       the letters start cycling through Sanskrit glyphs. */
    visibility: hidden;
}

/* Each letter cycles through Sanskrit glyphs before settling — a brief
   glow marks the moment it locks into its real character. */
.scramble-letter {
    display: inline-block;
    min-width: 0.55em;
    transition: color 0.25s ease, text-shadow 0.25s ease;
}

.scramble-letter.resolved {
    color: #4a6880;
    text-shadow: 0 0 18px rgba(92, 124, 148, 0.35);
}

.intro p {
    font-size: clamp(0.95rem, 3.4vw, 1.2rem);
    color: #8fa5b5;
    margin-bottom: 2rem;
    max-width: 32em;
    opacity: 0; /* faded in by GSAP once the title has resolved */
}

.timeline-container {
    width: 80vw;
    height: 60vh;
    max-width: 1400px;
    max-height: 800px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    overflow: hidden;
    border-radius: 20px;
    box-shadow: 0 30px 60px rgba(74, 104, 128, 0.15), 0 0 0 1px rgba(141, 169, 196, 0.2);
    background: linear-gradient(to top, #e4edf2, #b8d4e3); /* Sky */
}

/* --- PARALLAX BACKGROUNDS --- */
.parallax-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 60%; /* Ends where the road starts */
    z-index: 0;
}

.layer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 200%;
    height: 100%;
}

.sky-layer {
    z-index: 1;
}

.airplane {
    position: absolute;
    top: 20%;
    left: -100px;
    width: 80px;
    opacity: 0.7;
    animation: flyAirplane 30s linear infinite;
}

@keyframes flyAirplane {
    0% { transform: translateX(0vw) translateY(0); }
    100% { transform: translateX(110vw) translateY(-50px); }
}

.bird {
    position: absolute;
    width: 30px;
    opacity: 0.6;
}

.bird1 {
    top: 30%;
    left: 40%;
    animation: flyBird 15s linear infinite, bobBird 2s ease-in-out infinite alternate;
}
.bird2 {
    top: 35%;
    left: 60%;
    animation: flyBird 20s linear infinite 5s, bobBird 2.5s ease-in-out infinite alternate;
}

@keyframes flyBird {
    0% { left: 110vw; }
    100% { left: -10vw; }
}
@keyframes bobBird {
    0% { transform: translateY(-5px); }
    100% { transform: translateY(5px); }
}

.city-layer {
    z-index: 2;
    height: 200px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='400' height='200' viewBox='0 0 400 200'><path d='M0,200 L0,150 L30,150 L30,100 L70,100 L70,120 L100,120 L100,80 L150,80 L150,140 L190,140 L190,60 L240,60 L240,110 L280,110 L280,70 L320,70 L320,130 L360,130 L360,90 L400,90 L400,200 Z' fill='%23d3dee5'/><path d='M20,200 L20,170 L50,170 L50,130 L90,130 L90,160 L130,160 L130,100 L180,100 L180,150 L220,150 L220,80 L260,80 L260,120 L300,120 L300,90 L340,90 L340,140 L380,140 L380,110 L400,110 L400,200 Z' fill='%23c1d1dc'/></svg>");
    background-repeat: repeat-x;
    background-position: bottom;
    background-size: contain;
    animation: moveCity 30s linear infinite;
}

@keyframes moveCity {
    0% { transform: translateX(0); }
    100% { transform: translateX(-400px); }
}

.trees-layer {
    z-index: 3;
    height: 100px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='100' viewBox='0 0 300 100'><circle cx='50' cy='50' r='40' fill='%23b2ccca' /><circle cx='90' cy='60' r='30' fill='%23b2ccca' /><circle cx='30' cy='65' r='25' fill='%23b2ccca' /><rect x='45' y='80' width='10' height='20' fill='%23a19590' /><circle cx='200' cy='40' r='35' fill='%239dbdb7' /><circle cx='230' cy='55' r='30' fill='%239dbdb7' /><circle cx='170' cy='60' r='20' fill='%239dbdb7' /><rect x='195' y='70' width='10' height='30' fill='%23a19590' /></svg>");
    background-repeat: repeat-x;
    background-position: bottom;
    background-size: contain;
    animation: moveTrees 5s linear infinite;
}

@keyframes moveTrees {
    0% { transform: translateX(0); }
    100% { transform: translateX(-300px); }
}

/* --- FOREGROUND ROAD & TIMELINE --- */
.timeline-path {
    position: absolute;
    top: 60%;
    left: 0;
    width: 100%;
    height: 40%;
    background: #edf2f5;
    border-top: 4px solid #d3e0e8;
    z-index: 5;
    overflow: hidden;
}

.road-line {
    position: absolute;
    top: 20px;
    left: 0;
    width: 200vw; 
    height: 4px;
    background: repeating-linear-gradient(
        to right,
        #d3e0e8,
        #d3e0e8 40px,
        transparent 40px,
        transparent 80px
    );
}

.moving-road {
    animation: moveRoad 1.5s linear infinite;
}

@keyframes moveRoad {
    from { transform: translateX(0); }
    to { transform: translateX(-80px); } 
}

.timeline-content {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    display: flex;
    align-items: center;
    z-index: 8;
}

#floating-labels {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.year-label {
    position: absolute;
    top: 25%;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
}

.past-label {
    left: 10%;
}

.present-label {
    right: 40%;
}

.year-label .year {
    font-size: 3.5rem;
    font-weight: 400;
    color: #4a6880;
    text-shadow: 0 0 15px rgba(255,255,255,0.9);
    letter-spacing: 2px;
}

.year-label .event {
    font-size: 1.2rem;
    color: #7b9ebc;
    background: rgba(255,255,255,0.7);
    padding: 6px 18px;
    border-radius: 20px;
    backdrop-filter: blur(5px);
    margin-top: 5px;
    box-shadow: 0 5px 15px rgba(92,124,148, 0.1);
}

.mist-past {
    position: absolute;
    top: 0;
    left: -20%; 
    width: 40%; 
    height: 100%;
    background: linear-gradient(to right, #ffffff 10%, rgba(255,255,255,0.9) 40%, transparent);
    z-index: 15; 
    pointer-events: none;
}

.mystery-future {
    position: absolute;
    left: 100%;
    width: 150%;
    height: 100%;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.9) 20%, #ffffff);
    padding-left: 10%;
    margin-left: -20%; /* Starts the mist gradient at the center of the car */
    z-index: 15; /* Ensures the mist visually covers the front of the car as it drives into the future */
}

.mystery-future h2 {
    font-size: 4rem;
    font-weight: 300;
    color: #aebfd1;
    letter-spacing: 4px;
    text-shadow: 0 0 30px rgba(174,191,209, 0.6);
    z-index: 5;
}

.mist-gradient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at left, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 80%);
    pointer-events: none;
}

/* --- CAR AND BUBBLE --- */
.car-wrapper {
    position: absolute;
    top: 60%;
    left: 50%;
    right: auto; 
    transform: translate(-50%, -85%);
    z-index: 10;
}

#car-svg {
    width: 300px;
    height: auto;
    filter: drop-shadow(0 10px 15px rgba(109, 142, 168, 0.2));
}

.car-bounce {
    animation: bounce 0.6s infinite alternate ease-in-out;
    transform-origin: center;
}

@keyframes bounce {
    0% { transform: translateY(0px) rotate(0deg); }
    100% { transform: translateY(-3px) rotate(1deg); }
}

.wheel {
    transform-origin: center center;
}

.head-bob {
    animation: headBob 2.5s ease-in-out infinite alternate;
    transform-origin: -5px -10px; 
}

@keyframes headBob {
    0% { transform: rotate(-8deg); }
    100% { transform: rotate(12deg); }
}

.speech-bubble {
    position: absolute;
    bottom: 100%; 
    left: 10%; 
    background: white;
    padding: 15px 20px;
    border-radius: 20px;
    border-bottom-left-radius: 0;
    box-shadow: 0 15px 35px rgba(92,124,148, 0.15);
    width: 250px;
    text-align: center;
    opacity: 0;
    transform: scale(0.5);
    transform-origin: bottom left;
    pointer-events: none;
    z-index: 20;
    margin-bottom: 10px;
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 0;
    border-width: 15px 15px 0 0;
    border-style: solid;
    border-color: white transparent transparent transparent;
}

.speech-bubble p {
    font-size: 1rem;
    color: #5c7c94;
    margin-bottom: 10px;
    line-height: 1.4;
    font-weight: 400;
}

.contact-btn {
    display: inline-block;
    background: #8da9c4;
    color: white;
    text-decoration: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    transition: all 0.3s;
    pointer-events: auto;
}

.contact-btn:hover {
    background: #7b9ebc;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(141, 169, 196, 0.3);
}

/* === NAV/FOOTER SCRIM === */
/* Same background colour as the page, fading to transparent — sits just
   below the actual nav/footer text (z-index 1999 vs 2000) so scrolling
   section content visually dissolves before it reaches that text,
   instead of the two overlapping directly. Heights come from the same
   measured --nav-clearance / --footer-clearance variables main.js sets
   for the corner-position padding, so the fade always covers exactly as
   much as the fixed corners actually occupy. */
.nav-scrim {
    position: fixed;
    left: 0;
    width: 100vw;
    pointer-events: none;
    z-index: 1999;
}

.nav-scrim-top {
    top: 0;
    height: var(--nav-clearance, 140px);
    background: linear-gradient(to bottom, #f7f9fa 0%, #f7f9fa 45%, rgba(247, 249, 250, 0) 100%);
}

.nav-scrim-bottom {
    bottom: 0;
    height: var(--footer-clearance, 140px);
    background: linear-gradient(to top, #f7f9fa 0%, #f7f9fa 45%, rgba(247, 249, 250, 0) 100%);
}

/* === CINEMATIC 4-CORNER FRAME === */
.cinematic-frame {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 2000;
}

.cinematic-frame > div,
.cinematic-frame > nav {
    position: absolute;
    padding: 40px 50px;
    pointer-events: auto;
    /* Hidden until GSAP's entrance animation runs — otherwise the nav/
       brand/socials flash fully visible for as long as it takes the
       scripts (p5, GSAP) to finish loading before that tween even starts. */
    opacity: 0;
}

.frame-tl { top: 0; left: 0; }
.frame-tr { top: 0; right: 0; display: flex; gap: 30px; }
.frame-bl { bottom: 0; left: 0; }
.frame-br { bottom: 0; right: 0; text-align: right; }

/* Typography for the frame */
.cinematic-frame {
    color: #5c7c94;
    font-weight: 300;
}

.brand-name {
    font-size: 1.2rem;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.brand-title {
    font-size: 0.9rem;
    letter-spacing: 1px;
    color: #8da9c4;
}

.cinematic-nav a {
    font-size: 0.9rem;
    font-weight: 400;
    color: #5c7c94;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.3s ease;
}

.cinematic-nav a:hover,
.cinematic-nav a.active {
    color: #4a6880;
    letter-spacing: 4px;
    font-weight: 500;
}

.frame-bl p {
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.social-links {
    margin-bottom: 5px;
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

.social-link {
    font-size: 0.9rem;
    color: #5c7c94;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color 0.3s;
}

.social-link:hover {
    color: #4a6880;
}

.social-link .material-icons {
    font-size: 14px;
}

.copyright {
    font-size: 0.8rem;
    color: #8da9c4;
    letter-spacing: 1px;
}

/* === SPA VIEWS === */
#app-container {
    padding-top: 80px; /* Offset for fixed nav */
    min-height: 100vh;
}

#home {
    /* Home view has no top padding so timeline is flush */
    margin-top: -80px; 
}

.view {
    display: none;
    opacity: 0;
    /* Transition is driven by GSAP (see main.js) for the cinematic
       crossfade + scale — no CSS transition here to avoid the two
       fighting each other. */
}

.view.active {
    display: block;
    opacity: 1;
}

/* === CONTENT SECTIONS === */
.content-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 60px 20px;
    min-height: calc(100vh - 150px);
}

/* Corner content — shared by About, Projects, and Contact: tucked into
   the bottom-right, the same way the brand, nav, bio and socials already sit
   in the four corners of the frame, rather than a centered block. */
.corner-position {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    min-height: calc(100vh - 150px);
    /* --footer-clearance is set by main.js from the fixed footer's actual
       measured height — the 140px is only a fallback for the brief moment
       before that JS runs (or if it's disabled). */
    padding-bottom: var(--footer-clearance, 140px);
}

/* The bio grew into a real paragraph rather than a one-liner, so About
   sits a bit more toward center (not hard against the right edge like
   Projects/Contact) and wraps wider, to keep it from forcing a scroll. */
#about .content-container {
    justify-content: center;
}

.about-card {
    text-align: center;
    max-width: 620px;
    position: relative;
}

.about-card::before,
.projects-list::before {
    content: '';
    display: block;
    width: 7px;
    height: 7px;
    margin: 0 0 20px auto;
    background: #8da9c4;
    opacity: 0.5;
    transform: rotate(45deg);
}

/* Centered ornament for About specifically — must come after the shared
   rule above (same specificity) to actually win the cascade. */
.about-card::before {
    margin: 0 auto 20px;
}

.about-card .description {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 1.25rem;
    line-height: 1.5;
    color: #8fa5b5;
}

/* Projects — no images, just title / description / link, stacked and
   right-aligned in the same corner as About. */
.projects-list {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 34px;
    max-width: 440px;
}

.project-entry {
    text-align: right;
}

.project-title {
    font-family: 'Cinzel', serif;
    font-weight: 600;
    font-size: 1.15rem;
    letter-spacing: 1px;
    color: #5c7c94;
    margin-bottom: 8px;
}

.project-desc {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 1.15rem;
    line-height: 1.6;
    color: #8fa5b5;
    margin-bottom: 10px;
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #7b9ebc;
    text-decoration: none;
    transition: color 0.3s ease, letter-spacing 0.3s ease;
}

.project-link .material-icons {
    font-size: 14px;
}

.project-link:hover {
    color: #4a6880;
    letter-spacing: 2px;
}

/* Contact — LinkedIn / Instagram / X as titles, stacked in the same
   bottom-right corner list as Projects (reuses .projects-list for the
   layout), each one itself the link, styled like .project-title with
   the same arrow used everywhere else on the site. */
.contact-social-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Cinzel', serif;
    font-weight: 600;
    font-size: 1.3rem;
    letter-spacing: 1px;
    color: #5c7c94;
    text-decoration: none;
    transition: color 0.3s ease, letter-spacing 0.3s ease;
}

.contact-social-title:hover {
    color: #4a6880;
    letter-spacing: 2px;
}

.contact-social-title .material-icons {
    font-size: 18px;
}

/* The email address keeps the same layout/hover behaviour as Instagram
   and X, but plain letters instead of the ornate Cinzel serif — the
   decorative style reads oddly with @ and . in it. */
.contact-email {
    font-family: 'Outfit', sans-serif;
    font-weight: 400;
    letter-spacing: 0.5px;
}

.social-links {
    margin-bottom: 15px;
}

/* === MOBILE RESPONSIVENESS === */
@media (max-width: 800px) {
    #home {
        overflow: hidden;
        touch-action: none; 
    }

    .cinematic-frame > div,
    .cinematic-frame > nav {
        padding: 25px 20px;
    }

    /* Stack navigation vertically in the top right corner */
    .frame-tr {
        flex-direction: column;
        align-items: flex-end;
        gap: 20px;
    }

    /* Stacking the nav vertically makes it much taller (~180px) than the
       80px the content offset was reserving for it — push content down to
       actually clear it, and keep #home's canvas centering math in sync. */
    #app-container {
        padding-top: 190px;
    }
    #home {
        margin-top: -190px;
    }

    /* Make bio and copyright font slightly smaller to prevent overlap */
    .frame-bl p, .copyright, .brand-title {
        font-size: 0.75rem;
    }
    .brand-name {
        font-size: 1.1rem;
    }
    
    /* Unified centered footer for mobile to prevent overlap */
    .frame-bl {
        bottom: 75px;
        width: 100vw;
        text-align: center;
        padding: 0 20px;
    }
    
    .frame-br {
        width: 100vw;
        text-align: center;
        padding-top: 10px;
    }

    /* Keep social links neat and centered */
    .social-links {
        justify-content: center;
        margin-bottom: 8px;
    }

    /* Center timeline and shrink it to ensure it fits between the HUD corners */
    .timeline-container {
        height: 40vh;
        width: 90vw;
        border-radius: 15px;
    }

    /* Stays bottom-right on mobile too — padding-bottom itself now comes
       from --footer-clearance (measured in JS), which already accounts
       for the taller stacked footer here. min-height still needs its own
       mobile value though, to account for the taller (190px) top offset
       now reserved for the stacked nav above. */
    .corner-position {
        min-height: calc(100vh - 320px);
    }

    .about-card,
    .projects-list {
        max-width: 78vw;
    }

    .about-card .description {
        font-size: 1.05rem;
        line-height: 1.45;
    }

    .project-title {
        font-size: 0.82rem;
        margin-bottom: 3px;
    }

    .project-desc {
        font-size: 0.75rem;
        line-height: 1.2;
        margin-bottom: 5px;
    }

    .project-link {
        font-size: 0.62rem;
    }

    .contact-social-title {
        font-size: 1.1rem;
    }

    .projects-list {
        gap: 11px;
    }
}
