:root {
    --bg: #000;
    --fg: #fff;
    --c1: #00f2ff;
    --c2: #ff00ea;
    --glass: rgba(255, 255, 255, 0.05);
    --border-idle: rgba(255, 255, 255, 0.12);
    --dark-grey: #111;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--bg);
    color: var(--fg);
    font-family: 'Poppins', sans-serif;
    overflow-x: hidden;
}

#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    z-index: -1;
    width: 100vw;
    height: 100vh;
}

/* FULL WIDTH SETUP WITH EXTRA BREATHING ROOM */
.full-screen-wrapper {
    width: 100%;
    padding: 0 6%;
    /* Increased padding so content doesn't hit the screen edges */
    position: relative;
    z-index: 1;
}

/* Typography */
.huge-title {
    font-size: clamp(2.5rem, 8vw, 7.5rem);
    font-weight: 900;
    line-height: 0.85;
    margin-bottom: 2rem;
}

.gradient-text {
    background: linear-gradient(90deg, var(--c1), var(--c2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tag {
    text-transform: uppercase;
    letter-spacing: 5px;
    font-size: 0.8rem;
    color: var(--c1);
    margin-bottom: 1rem;
    display: block;
}

.hero-subtext {
    font-size: clamp(1.1rem, 2.2vw, 1.5rem);
    max-width: 850px;
    margin: 2rem 0;
    opacity: 0.8;
    font-weight: 300;
    line-height: 1.5;
}

/* Navigation */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2.5rem 6%;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
}

.logo {
    font-weight: 900;
    font-size: 2rem;
    letter-spacing: -1px;
}

.nav-links a {
    color: white;
    text-decoration: none;
    margin-left: 2.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    transition: 0.3s;
}

.cta-btn {
    border: 1px solid white;
    padding: 0.7rem 1.6rem;
    border-radius: 100px;
    color: white !important;
    transition: 0.4s !important;
}

.cta-btn:hover {
    border-color: var(--c1);
    background: var(--c1);
    color: black !important;
    box-shadow: 0 0 25px var(--c1);
}

/* Hero Buttons */
section {
    padding: 12rem 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.btn {
    padding: 1.1rem 2.6rem;
    border-radius: 100px;
    display: inline-block;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin-right: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.85rem;
}

.primary-gradient {
    background: linear-gradient(45deg, var(--c1), var(--c2));
    color: white;
    border: none;
}

.primary-gradient:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(0, 242, 255, 0.3);
}

.secondary-outline {
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
}

.secondary-outline:hover {
    border-color: var(--c1);
    color: var(--c1);
    transform: translateY(-3px);
}

/* EXPERTISE GRID (Stays as is) */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-top: 4rem;
    width: 100%;
}

/* PORTFOLIO GRID (More boxes per row) */
.work-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 2rem;
    margin-top: 4rem;
    width: 100%;
}

/* Shared Box Styling */
.bento-item,
.work-card {
    background: var(--glass);
    border-radius: 30px;
    position: relative;
    border: 1px solid var(--border-idle);
    transition: transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1), background 0.4s ease;
    will-change: transform, background;
}

/* expertise padding */
.bento-item {
    padding: 3.5rem;
}

.bento-item.wide {
    grid-column: span 2;
}

.stat {
    font-size: 5rem;
    font-weight: 900;

    /* FIX 1: Increase line-height slightly from 1 to 1.1 or 1.2 */
    line-height: 1.1;

    /* FIX 2: inline-block makes the container wrap the text more accurately */
    display: inline-block;

    /* FIX 3: A tiny bit of padding ensures the 'clip' area includes the bottom of the letters */
    padding-bottom: 0.1em;
    margin-bottom: 0.5rem;

    /* The rest of your code stays the same */
    background: linear-gradient(90deg, var(--c1), var(--c2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;

    /* Note: filter can sometimes cause clipping issues on Safari, 
       if it still clips, try moving the drop-shadow to the .bento-item instead */
    filter: drop-shadow(0 0 15px rgba(0, 242, 255, 0.1));
}

.bento-item h3 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

/* HOVER BORDER EFFECT */
.gradient-border::before {
    content: "";
    position: absolute;
    top: -1.5px;
    left: -1.5px;
    right: -1.5px;
    bottom: -1.5px;
    border-radius: 31px;
    padding: 2.5px;
    background: linear-gradient(45deg, var(--c1), var(--c2));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    opacity: 0;
    transition: 0.5s;
    pointer-events: none;
    z-index: 5;
}

.bento-item:hover,
.work-card:hover {
    background: var(--dark-grey);
    opacity: 1 !important;
    transform: translateY(-8px);
    border-color: transparent;
}

.bento-item:hover::before,
.work-card:hover::before {
    opacity: 1;
}

/* WORK CARDS - Sleeker Height */
.work-card {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.work-img {
    height: 380px;
    /* Reduced height to keep boxes from being too tall */
    background-size: cover;
    background-position: center;
    opacity: 0.8;
    transition: 0.8s ease;
}

.work-card:hover .work-img {
    opacity: 1;
    transform: scale(1.03);
}

.work-info {
    padding: 2.5rem;
    flex-grow: 1;
}

.work-info h3 {
    font-size: 1.5rem;
}

.work-info p {
    font-size: 0.8rem;
    color: var(--c1);
    text-transform: uppercase;
    font-weight: 600;
    margin-top: 0.5rem;
    letter-spacing: 2px;
}

/* Footer */
footer {
    padding: 4rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
}

.footer-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-left h3 {
    font-size: 1.4rem;
}

.footer-left p {
    font-size: 0.75rem;
    opacity: 0.4;
}

.email-link {
    font-size: 1.2rem;
    color: white;
    text-decoration: none;
    font-weight: 600;
    transition: 0.3s;
}

.email-link:hover {
    color: var(--c1);
}

@media (max-width: 1100px) {
    .bento-grid {
        grid-template-columns: 1fr;
    }

    .bento-item.wide {
        grid-column: auto;
    }
}

/* FORCE VISIBILITY */
.reel-container {
    width: 100%;
    max-width: 1400px;
    margin: 4rem auto;
    height: 60vh;
    position: relative;
    border-radius: 40px;
    overflow: hidden;
    background: #0f0f0f;
    /* Fallback color */
    z-index: 10;
    /* Ensure it's above the Three.js background */
    /*border: 1px solid rgba(0, 242, 255, 0.2);*/
}

.video-wrapper,
.video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Ensure the GSAP 'reveal' isn't keeping it invisible forever */
.reel-container.reveal {
    opacity: 1 !important;
    visibility: visible !important;
}

.reel-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 50%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2.5rem;
    pointer-events: none;
}

.sound-status,
.reel-center-play {
    pointer-events: auto;
    /* Re-enable clicks for buttons */
}


/* --- MOBILE OPTIMIZATIONS --- */

@media (max-width: 768px) {

    /* --- SECTION SPACING --- */
    section {
        padding: 10rem 0;
        /* Reduced from 12rem to 5rem for tighter flow */
        min-height: auto;
        /* Allows sections to be as tall as their content */
        margin-bottom: 2rem;
        /* Adds a small consistent buffer */
    }

    /* Keep the Hero section feeling substantial but not empty */
    .hero {
        padding-top: 8rem;
        /* Room for the fixed Nav logo */
        padding-bottom: 4rem;
        min-height: 80vh;
        /* Slightly shorter than full screen to hint at scroll */
    }

    /* Tighten the gap between the Tag and the Huge Title */
    .tag {
        margin-bottom: 0.5rem;
    }

    .huge-title {
        margin-bottom: 1.5rem;
        /* Less space before the grid starts */
    }

    /* Reduce gap between section header and the content grid */
    .bento-grid,
    .work-grid {
        margin-top: 2rem;
        /* Reduced from 4rem */
    }

    /* 1. Hide Navigation links */
    .nav-links {
        display: none;
    }

    /* 2. Adjust Hero Buttons: Smaller, Aligned Left, Not Full Width */
    .hero-btns {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        /* Aligns buttons to the left */
        gap: 1.2rem;
        /* Spacing between stacked buttons */
        width: 100%;
    }

    .btn {
        margin-right: 0;
        width: auto;
        /* Buttons no longer stretch to full width */
        min-width: 200px;
        /* Ensures a nice substantial feel without being huge */
        text-align: center;
        padding: 0.9rem 1.8rem;
        /* Slightly smaller padding */
        font-size: 0.8rem;
    }

    /* 3. Global Container Adjustments */
    .full-screen-wrapper {
        padding: 0 5%;
        overflow-x: hidden;
    }

    /* FIX: Word Spacing for Titles */
    .huge-title {
        font-size: 3rem;
        line-height: 1.1;
        /* Better breathing room between lines */
        word-spacing: 0.3rem;
        /* Adds space between "Why" and "Wekthor" */
        margin-bottom: 2rem;
        text-align: left;
    }

    /* 4. Expertise (Bento Grid) Centering Fixes */
    .bento-grid {
        grid-template-columns: 100%;
        /* Explicitly 100% of available space */
        gap: 1.5rem;
        width: 100%;
        display: flex;
        /* Using flex for safer centering on older iOS */
        flex-direction: column;
        align-items: center;
    }

    .bento-item {
        padding: 2.5rem 1.5rem;
        width: 100%;
        /* Fills the container exactly */
        max-width: 100%;
        box-sizing: border-box;
        /* Crucial: padding won't push box past 100% width */
        margin: 0 auto;
        /* Centers the box */
    }

    .stat {
        font-size: 3.2rem;
        /* Adjusted to prevent any overflow on narrow screens */
    }

    .bento-item h3 {
        font-size: 1.4rem;
    }

    /* 5. Showreel Centering */
    .reel-container {
        width: 100%;
        margin: 2rem 0;
        height: 40vh;
        border-radius: 20px;
    }

    /* 6. Selected Projects Fixes */
    .work-grid {
        grid-template-columns: 1fr;
        width: 100%;
        gap: 2rem;
    }

    .work-card {
        width: 100%;
        margin: 0 auto;
    }

    /* FIX: Reduce the height of the project image */
    .work-img {
        height: 300px;
        /* Reduced from 380px/250px to make it sleeker */
    }

    /* FIX: Reduce padding in the info section to save space */
    .work-info {
        padding: 1.5rem;
    }

    /* FIX: Word spacing for project titles to match the main sections */
    .work-info h3 {
        font-size: 1.2rem;
        word-spacing: 0.2rem;
        letter-spacing: 0;
    }

    /* 7. Footer Optimization */
    footer {
        padding: 2rem 0;
    }

    .footer-wrap {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }
}

/* Extra safety for very small screens (iPhone SE/older) */
@media (max-width: 380px) {
    .stat {
        font-size: 2.8rem;
    }

    .huge-title {
        font-size: 2.6rem;
    }
}


/* --- INTERSTITIAL SECTIONS --- */

.interstitial {
    padding: 15rem 0; /* More breathing room */
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.interstitial .reveal {
    width: 100%;
}

.interstitial .huge-title {
    /* Unified size for all: massive but responsive */
    font-size: clamp(2rem, 4.2vw, 4.8rem);
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 2rem;
    color: #fff;
    
    /* Allow it to take up almost the whole screen width to stay on one line */
    max-width: 95vw; 
    margin-left: auto;
    margin-right: auto;
    white-space: normal; /* Allows wrapping on small screens only */
}

/* Ensure the gradient words pop even more */
.interstitial .gradient-text {
    display: inline-block; /* Helps prevent gradient clipping */
}

/* Mobile specific fixes to prevent text being too small or overflowing */
@media (max-width: 768px) {
    .interstitial {
        padding: 8rem 0;
    }
    
    .interstitial .huge-title {
        font-size: 2.0rem; /* Large but fits mobile width */
        line-height: 1.2;
        padding: 0 20px;
    }
}