body {
    margin: 0;
    overflow-x: hidden;
    /* Default (non-home) pages */
    background-color: #f7f7f8;
    color: #0f172a;
    font-family: 'Inter', sans-serif;
}

/* Home page only */
body.sb-home {
    background-color: #030619;
    color: white;
}

/* The First Section (formerly Final Section) */
#intro-section {
    position: relative;
    width: 100%;
    /* Let the intro size to its content (no forced viewport height) */
    min-height: auto;
    z-index: 20;
    background: #030619;
    /* Solid background to cover canvas initially if needed */
    pointer-events: auto;
    padding-top: clamp(6rem, 12vh, 10rem); /* Increased to account for navbar height */
    display: block;
}

/* Video section styling for better mobile visibility and animation */
#video-section {
    position: relative;
    z-index: 10;
    will-change: transform;
}

#hero-video {
    display: block;
    max-width: 100%;
    height: auto;
    will-change: opacity;
    background-color: #030619;
}

/* Ensure content can slide over video */
#content-below-video {
    position: relative;
    z-index: 15;
    //background: linear-gradient(to bottom, transparent 0%, #030619 50%);
    will-change: transform;
}

/* Mobile adjustments for video */
@media (max-width: 768px) {
    #intro-section {
        padding-bottom: 2rem;
    }
    
    #video-section {
        margin-top: 0;
        margin-bottom: 2rem;
    }
    
    #hero-video {
        border-radius: 0.75rem;
        min-height: 200px;
    }
    
    /* Ensure content has solid background on mobile after animation */
    #content-below-video {
        background: linear-gradient(to bottom, rgba(3, 6, 25, 0) 0%, rgba(3, 6, 25, 0.8) 30%, #030619 60%);
        padding-top: 2rem;
    }
}

#canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 1;
    opacity: 1;
    /* Always visible as background */
    pointer-events: auto;
    touch-action: none;
}

/* Mobile adjustments for canvas */
@media (max-width: 768px) {
    #canvas-container {
        touch-action: pan-y;
        /* Allow vertical scrolling on mobile */
    }
}

#canvas-container.active {
    pointer-events: auto;
}

#canvas-container.dragging {
    cursor: grabbing;
}

#canvas-container.hovering {
    cursor: grab;
}

/* Virtual scroll track removed - using real content height now */
#scroll-track {
    display: none;
}

/* Alternating Content and Object Layers */
.content-layer {
    position: relative;
    /* Let sections size to their content (no forced viewport height) */
    min-height: auto;
    z-index: 30;
    background: linear-gradient(180deg,
            rgba(3, 6, 25, 0.62) 0%,
            rgba(3, 6, 25, 0.78) 55%,
            rgba(3, 6, 25, 0.88) 100%);
    backdrop-filter: blur(8px);
    width: 100%;
    /* Vertical rhythm (still padded, but driven by content) */
    padding: clamp(2.5rem, 5vw, 4rem) 0;
    transition: opacity 0.3s ease;
}

/*
  Constrains inner content so grids/cards don't touch viewport borders.
  Many sections in `index.html` rely on this wrapper class.
*/
.content-wrapper {
    width: 100%;
    max-width: 72rem; /* slightly tighter than Tailwind max-w-6xl-ish */
    margin: 0 auto;
    padding-inline: clamp(1.25rem, 4vw, 3.25rem);
    box-sizing: border-box;
}

/* Footer specific styling */
.content-layer[data-section="footer"] {
    min-height: auto;
    padding: 2.5rem 0 2rem;
}

.object-layer {
    position: relative;
    /*
      Spacer between content sections so the 3D scene has "breathing room".
      IMPORTANT: keep this transparent so only the content sections have the background panel.
    */
    min-height: clamp(20rem, 85vh, 56rem);
    z-index: 20;
    width: 100%;
    /* Trigger layer for 3D object positioning */
}

/* Mobile: slightly smaller spacer so it doesn't feel endless */
@media (max-width: 768px) {
    .object-layer {
        min-height: clamp(14rem, 70vh, 40rem);
    }
}

/* Main Content Section (hidden - content moved to layers) */
#content-section {
    display: none;
}

/* HTML Overlay Elements (synced with 3D) */
.marker {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    opacity: 0;
    pointer-events: none;
    width: 100%;
    mix-blend-mode: difference;
}

.year {
    font-family: 'Instrument Serif', serif;
    font-size: 8vw;
    line-height: 1;
    color: #fff;
    text-shadow: 0 0 30px rgba(168, 85, 247, 0.5);
    display: block;
}

.label {
    font-family: 'Inter', sans-serif;
    font-size: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: #A855F7;
    margin-top: 1rem;
    display: block;
}

.description {
    font-size: 1rem;
    color: #ccc;
    max-width: 400px;
    margin: 1rem auto;
    line-height: 1.5;
}

/* UI Overlay */
#ui {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    display: flex;
    justify-content: space-between;
    padding: 2rem;
    box-sizing: border-box;
    opacity: 0;
    /* Hidden initially on intro */
    transition: opacity 0.5s ease;
}

.logo-mark {
    font-family: 'Instrument Serif', serif;
    font-size: 1.5rem;
    color: white;
    opacity: 0.8;
}

.scroll-indicator {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    animation: pulse 2s infinite;
    opacity: 0;
    /* Hidden initially */
    transition: opacity 0.5s ease;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.3;
    }

    50% {
        opacity: 1;
    }
}

.btn {
    pointer-events: auto;
    cursor: pointer;
}

.glitch {
    position: relative;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #030619;
}

.glitch::before {
    left: 2px;
    text-shadow: -1px 0 red;
    animation: glitch-anim-1 2s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -1px 0 blue;
    animation: glitch-anim-2 3s infinite linear alternate-reverse;
}

@keyframes glitch-anim-1 {
    0% {
        clip-path: inset(20% 0 80% 0);
    }

    20% {
        clip-path: inset(60% 0 10% 0);
    }

    100% {
        clip-path: inset(10% 0 50% 0);
    }
}

@keyframes glitch-anim-2 {
    0% {
        clip-path: inset(10% 0 60% 0);
    }

    20% {
        clip-path: inset(80% 0 5% 0);
    }

    100% {
        clip-path: inset(30% 0 20% 0);
    }
}

/* 3D Labels Styles */
.label-3d {
    pointer-events: none;
    text-align: left;
    white-space: nowrap;
}

/* Mobile adjustments for 3D labels */
@media (max-width: 768px) {
    .label-3d {
        text-align: center;
        white-space: normal;
        word-break: break-word;
    }

    .label-3d .label-name {
        font-size: 1.8rem;
        max-width: 120px;
    }

    .label-3d .label-year {
        font-size: 0.9rem;
    }

    .label-3d .label-desc {
        font-size: 0.7rem;
        max-width: 140px;
    }

    .label-3d::before {
        display: none;
        /* Hide connector line on mobile */
    }
}

.label-3d .label-name {
    font-family: 'Instrument Serif', serif;
    font-size: 2.5rem;
    color: #fff;
    line-height: 1.1;
    text-shadow: 0 0 20px rgba(168, 85, 247, 0.6), 0 0 40px rgba(168, 85, 247, 0.3);
    margin-bottom: 0.25rem;
}

.label-3d .label-year {
    font-family: 'Instrument Serif', serif;
    font-size: 1.25rem;
    font-style: italic;
    color: #A855F7;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

.label-3d .label-desc {
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.6);
    max-width: 220px;
    white-space: normal;
    line-height: 1.5;
}

/* Decorative line connector */
.label-3d::before {
    content: '';
    position: absolute;
    left: -30px;
    top: 50%;
    width: 25px;
    height: 1px;
    background: linear-gradient(90deg, transparent, #A855F7);
    transform: translateY(-50%);
}

/* Content Cards & Sections */
.card {
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.10);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.card::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(600px circle at 20% 10%, rgba(168, 85, 247, 0.16), transparent 45%),
        radial-gradient(600px circle at 80% 0%, rgba(255, 255, 255, 0.10), transparent 40%);
    opacity: 0.55;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.card:hover {
    border-color: #A855F7;
    transform: translateY(-3px);
    box-shadow:
        0 14px 40px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(168, 85, 247, 0.12) inset;
}

.card:hover::before {
    opacity: 0.85;
}

/* Typography polish for section headings inside timeline sections */
.content-layer h2 {
    letter-spacing: -0.02em;
    line-height: 1.06;
}

.section-title {
    font-family: 'Instrument Serif', serif;
}