/* =========================================
   HERO SECTION - PERFORMANCE OPTIMIZED
========================================= */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;800&family=Michroma&family=Orbitron:wght@800&display=swap');

/* =========================================
   BASE STYLES
========================================= */

body {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    color: #ffffff;
    overflow-x: hidden;
    background-color: #020617;
}

/*
   PERFORMANCE FIX #1:
   Replaced body::before pseudo-element with a dedicated .site-bg div in HTML.
   A fixed pseudo-element with background-size:cover forces a full-page repaint
   on every single scroll frame (the browser must re-rasterize the entire
   background each time). A promoted GPU layer (translateZ(0)) on a real element
   avoids this — the compositor handles it without triggering the paint pipeline.
*/
.site-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('../img/latest-hero-bg.png') no-repeat center center;
    background-size: cover;
    z-index: -1;
    transform: translateZ(0);
    will-change: transform;
}

/* =========================================
   HERO SECTION
========================================= */

.hero-section {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 15vh;
    overflow: hidden;
    background: url('../img/latest-hero-bg.png') no-repeat center center;
    background-size: cover;
}

.hero-layout-grid {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 4vw;
    width: 100%;
    max-width: 1400px;
    height: 100%;
    padding: 0 10vw; /* Increased padding to move everything right */
    margin: 0 auto;
    box-sizing: border-box;
    z-index: 10;
}

.hero-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    max-width: 600px;
    pointer-events: none;
    z-index: 10;
    transform: translateY(-8vh);
}

/* =========================================
   BRAND & HEADLINE
========================================= */

.brand-header {
    margin-bottom: 1.5rem;
    opacity: 1;
    pointer-events: auto;
}

.brand-logo {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem;
    letter-spacing: 4px;
    color: #60a5fa;
    text-transform: uppercase;
}

.main-headline {
    margin: 0;
    line-height: 1.1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    opacity: 1;
    pointer-events: auto;
}

.outline-text {
    font-family: 'Michroma', sans-serif;
    font-size: 3.5rem;
    color: transparent;
    -webkit-text-stroke: 1px rgba(96, 165, 250, 0.4);
    letter-spacing: -1px;
    text-transform: uppercase;
    white-space: nowrap;
}

.solid-text {
    font-family: 'Michroma', sans-serif;
    font-size: 3.5rem;
    color: #e2e8f0;
    letter-spacing: -1px;
    text-transform: uppercase;
    text-shadow: 0 0 20px rgba(96, 165, 250, 0.3);
    white-space: nowrap;
}

.service-description {
    margin-top: 2rem;
    max-width: 500px;
    font-size: 1.1rem;
    line-height: 1.6;
    color: #94a3b8;
    text-align: left;
    font-weight: 300;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    pointer-events: auto;
    z-index: 10;
}

/* =========================================
   3D MODEL CANVAS - ANTI-PIXELATION
========================================= */

.model-container {
    flex: 1;
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    overflow: hidden; /* Hide text that overflows from the right side */
}

#aiModelCanvas {
    width: 100% !important;
    height: 100% !important;
    max-width: 650px;
    max-height: 650px;
    z-index: 2;
    pointer-events: none;

    /* Anti-pixelation */
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    -webkit-font-smoothing: subpixel-antialiased;
    -moz-osx-font-smoothing: grayscale;

    /*
       PERFORMANCE FIX #2:
       Removed will-change: transform from here.
       will-change creates a new compositor layer and consumes GPU VRAM.
       The canvas already has hardware acceleration via translateZ(0).
       Stacking multiple will-change elements simultaneously (canvas + body bg
       + card + scrolling text) causes layer thrashing on mid-range devices.
       Only the actively-scrolling .site-bg needs will-change: transform.
    */
    image-rendering: -webkit-optimize-contrast;
}

/* =========================================
   SCROLLING BACKGROUND TEXT
========================================= */

.scrolling-text-container {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 150%;
    transform: translate(-50%, -50%);
    overflow: hidden;
    white-space: nowrap;
    z-index: 0;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10rem; /* Much more space between the two rows */
    opacity: 0.7;
}

.scrolling-text {
    display: inline-block;
    animation: scrollText 40s linear infinite;
    font-family: 'Outfit', sans-serif; /* Lighter, more elegant font */
    font-size: 1.1rem;
    font-weight: 600;
    color: rgba(148, 163, 184, 0.35); /* Soft slate fill instead of outline-only */
    -webkit-text-stroke: none;
    letter-spacing: 5px;
    text-transform: uppercase;
}

.scrolling-text.reverse {
    animation: scrollTextReverse 40s linear infinite;
    color: rgba(96, 165, 250, 0.3); /* Subtle blue tint for alternating rows */
}

@keyframes scrollText {
    0% { transform: translateX(0%); }
    100% { transform: translateX(-50%); }
}

@keyframes scrollTextReverse {
    0% { transform: translateX(-50%); }
    100% { transform: translateX(0%); }
}

/* =========================================
   EXPANDING CARD
========================================= */

.expanding-card {
    position: absolute;
    z-index: 20;
    bottom: 8vh;
    left: max(10vw, calc(50vw - 700px + 10vw)); /* Align perfectly with the 10vw padding of the 1400px container */
    width: 320px;
    height: 110px;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.expanding-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
}

.preview-content {
    padding: 20px 30px;
    width: 100%;
}

.mini-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.7rem;
    color: #60a5fa;
    letter-spacing: 2px;
}

.mini-headline {
    font-family: 'Michroma', sans-serif;
    font-size: 1.1rem;
    color: #f8fafc;
    font-weight: 700;
    margin: 5px 0 0 0;
}

.next-section {
    min-height: 100vh;
    background-color: #000;
    position: relative;
    z-index: 5;
}

/* =========================================
   MEDIA QUERIES - TABLET
========================================= */

@media (max-width: 992px) {
    .hero-layout-grid {
        flex-direction: column;
        justify-content: flex-start;
        padding-top: 10vh;
        padding: 0 5vw;
    }

    .model-container {
        margin-top: -5vh;
        width: 100%;
        height: 50vh;
    }

    .hero-content {
        align-items: center;
        text-align: center;
        margin-left: 0;
        transform: translateY(0);
    }

    .main-headline {
        align-items: center;
    }

    .service-description {
        text-align: center;
        margin-top: 1.5rem;
        max-width: 90%;
    }
}

@media (max-width: 768px) {
    .hero-section {
        padding-top: 15vh;
    }

    .main-headline {
        flex-direction: column;
        gap: 0.5rem;
    }

    .outline-text,
    .solid-text {
        font-size: 2.5rem;
    }

    .model-container {
        height: 40vh;
    }

    #aiModelCanvas {
        width: 80vw !important;
        height: 80vw !important;
    }

    .expanding-card {
        width: 92%;
        height: 120px;
        bottom: 2vh;
        left: 4%;
        border-radius: 16px;
    }
}

/* =========================================
   MEDIA QUERIES - MOBILE
========================================= */

@media (max-width: 576px) {
    body {
        overflow-x: hidden;
        width: 100%;
        overscroll-behavior-y: none;
    }

    .hero-section {
        padding-top: 70px;
        height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        overflow: hidden;
        transform: translateZ(0);
    }

    .hero-layout-grid {
        flex-direction: column;
        justify-content: flex-start;
        padding: 15px 5vw 0 5vw;
        height: calc(100% - 135px);
    }

    .hero-content {
        align-items: center;
        width: 100%;
        margin-left: 0;
        transform: translateY(0);
        flex-shrink: 0;
    }

    .brand-header {
        margin-bottom: 0.6rem;
    }

    .brand-logo {
        font-size: 0.75rem;
        letter-spacing: 3px;
    }

    .main-headline {
        align-items: center;
        width: 100%;
    }

    /* Fixed: Shifted further up to create extra breathing room from bottom panel */
    .model-container {
        margin-top: -4.5rem;
        width: 100%;
        height: auto;
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 200px;
    }

    #aiModelCanvas {
        width: 100% !important;
        height: 100% !important;
        max-width: 380px;
        max-height: 380px;
        z-index: 2;
        pointer-events: none;
        transition: opacity 0.4s ease;
    }

    .outline-text,
    .solid-text {
        font-size: 1.8rem !important;
        line-height: 1.1;
        text-align: center;
        white-space: normal;
        letter-spacing: 0px;
        display: block;
        width: 100%;
    }

    .service-description {
        margin-top: 0.5rem;
        width: 100%;
        text-align: center;
        font-size: 0.86rem;
        line-height: 1.4;
        z-index: 10;
        transition: opacity 0.4s ease;
        text-shadow: 0 2px 8px rgba(0,0,0,0.8);
    }

    .expanding-card {
        position: absolute;
        bottom: 2.5vh;
        left: 4%;
        width: 92%;
        height: 110px;
        border-radius: 16px;
        z-index: 100;
        background: rgba(12, 12, 12, 1);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        transition: opacity 0.4s ease;
    }

    .expanding-card.expanded {
        border-radius: 0;
        background: rgba(10, 10, 10, 0.95);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
    }

    .expanding-card.expanded ~ .hero-content .service-description,
    .expanding-card.expanded ~ #aiModelCanvas {
        opacity: 0;
        pointer-events: none;
    }

    .scrolling-text-container {
        height: 95%;
        width: 150%;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        gap: 0;
        opacity: 0.38;
    }

    .scrolling-text {
        font-size: 0.95rem;
        animation: scrollText 45s linear infinite;
    }
}