/* ================================
   ROOT
   ================================ */

html, body {
    overflow-x: hidden; /* Cuts off any stray pixels causing scroll */
    max-width: 100%;
}

.hero-root {
    position: relative;
    --total-duration: 0.9s;
}
.hero {
    position: relative;
    min-height: 100vh;
    z-index: 2;

    /* ADD THESE 2 LINES */
    width: 100%;
    overflow-x: hidden; /* Prevents Header/Nav from expanding the page */
}

/* ================================
   BACKGROUND
   ================================ */

.hero-bg {
    position: fixed;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 0;
}

/* ================================
   SLICE LAYER
   ================================ */

.hero-slices {
    position: fixed;
    inset: 0;

    display: grid;
    grid-auto-flow: column;
    grid-template-columns: repeat(var(--slice-count), 1fr);
    grid-template-rows: 1fr;

    height: 100vh;
    z-index: 5;
    pointer-events: none;
}

/* ================================
   SLICE BASE
   =============================== */

/* ================================
   SLICE BASE
   ================================ */

.hero-slice {
    height: 100%;
    background: #ffffff;

    transform: translateY(0);
    opacity: 1;
    z-index: 5;

    /* animation-name: sliceReveal;  <-- Removed to prevent auto-start */
    animation-fill-mode: forwards;

    /* speed control */
    animation-duration: calc(0.8s * var(--speed));

    /* stagger */
    animation-delay: calc(
            (var(--order) - 1) * (var(--total-duration) / var(--slice-count))
    );

    animation-timing-function: cubic-bezier(.4,0,.2,1);
}

/* NEW: Only run animation when parent is loaded */
.hero-root.is-loaded .hero-slice {
    animation-name: sliceReveal;
}

/* ================================
   EASING VARIANTS
   ================================ */

/*.hero-slice[style*="--curve: 0"] {*/
/*    animation-timing-function: cubic-bezier(.4,0,.2,1);*/
/*}*/

/*.hero-slice[style*="--curve: 1"] {*/
/*    animation-timing-function: cubic-bezier(.2,.8,.2,1);*/
/*}*/

/*.hero-slice[style*="--curve: 2"] {*/
/*    animation-timing-function: cubic-bezier(.6,0,.1,1);*/
/*}*/

/* ================================
   DIRECTIONAL REVEAL
   ================================ */

@keyframes sliceReveal {
    0% {
        transform: translateY(0);
        opacity: 1;
    }

    70% {
        opacity: 1;
    }

    100% {
        transform: translateY(calc(-100% * var(--vdir)));
        opacity: 0;
    }
}

/* ================================
   FOREGROUND
   ================================ */

.hero {
    position: relative;
    min-height: 100vh;
    z-index: 2;
}

/* ================================
   ACCESSIBILITY
   ================================ */

@media (prefers-reduced-motion: reduce) {
    .hero-slice {
        animation: none;
        opacity: 0;
        transform: translateY(-100%);
    }
}


/* ================================
   GLASS GRID ARCHITECTURE
   ================================ */

:root {
    /* --- TWEAK VARIABLES HERE --- */

    /* Desktop Sizing */
    --grid-max-width: 1400px;
    --grid-row-gap: 3rem;
    --tile-small-height: 180px; /* Height of Gallery/Playground buttons */
    --info-col-width: 1.4fr;    /* Width of 'Who Am I' vs Buttons (1fr) */
    --grid-column-gap: 15rem;
    --grid-side-padding: 4rem;

    /* Mobile Sizing (< 700px) */
    --mobile-tile-height: 200px;
    --mobile-gap: 6rem;       /* Vertical space between cards on mobile */
    --mobile-padding: 2rem;   /* <--- NEW: Controls Left/Right spacing on mobile */
}

.glass-grid {
    display: grid;
    width: 100%;
    max-width: var(--grid-max-width);
    margin: 8rem auto 0;
    padding: 0 var(--grid-side-padding);
    box-sizing: border-box;
    row-gap: var(--grid-row-gap);
    column-gap: var(--grid-column-gap);

    /* Desktop Layout (Screenshot 1):
      2 Columns, 2 Rows.
      Left column holds Info. Right column holds Gallery & Playground.
    */
    grid-template-columns: var(--info-col-width) 1fr;
    grid-template-rows: var(--tile-small-height) var(--tile-small-height);
    grid-template-areas:
        "info gallery"
        "info playground";
}

/* ================================
   GRID ITEM PLACEMENT
   ================================ */

.box-info {
    grid-area: info;
    /* No manual height needed; it stretches to fill the 2 rows defined above */
}

.box-gallery {
    grid-area: gallery;
}

.box-playground {
    grid-area: playground;
}

/* ================================
   RESPONSIVE STATES
   ================================ */

/* TABLET / INTERMEDIATE (Screenshot 2 Logic) */
/* When screen gets smaller, we keep the layout but shrink the text box width slightly */
@media (max-width: 1300px) {
    :root {
        --info-col-width: 1.1fr; /* Make columns nearly equal on tablets */
        --tile-small-height: 160px; /* Slightly shorter items */
        --grid-column-gap: 5rem;
    }
}

/* MOBILE LAYOUT (Screenshot 3) */
/* Under 700px, switch to a simple vertical stack */
@media (max-width: 700px) {
    .glass-grid {
        display: flex;
        flex-direction: column;

        width: 100%;
        max-width: 100%;

        /* 2. Padding creates the side gaps (Left/Right) */
        padding: 0 var(--mobile-padding);

        /* 3. Top Margin only */
        margin: 4rem 0 6rem 0;

        gap: var(--mobile-gap);
        box-sizing: border-box; /* Crucial: Ensures padding doesn't add to width */
    }

    .glass-box {
        /* On mobile, we ignore grid heights and use a robust aspect ratio or min-height */
        min-height: var(--mobile-tile-height);
        width: 100%; /* Full width */
        margin: 0;
        box-sizing: border-box;
        aspect-ratio: unset; /* Let content dictate shape or use fixed height */
    }

    /* Optional: Make the Info box slightly taller on mobile if needed */
    .box-info {
        min-height: 300px;
    }
}

/* ================================
   GLASS BOX STYLING
   ================================ */

.glass-box {
    /* Base Visuals */
    /*background: rgba(255,255,255,0.06);*/
    -webkit-backdrop-filter: blur(1.5px) saturate(110%);
    backdrop-filter: blur(1.5px) saturate(110%);
    box-shadow:
            0 6px 18px rgba(0,0,0,0.28),
            0 18px 46px rgba(0,0,0,0.42);

    border-radius: 12px;
    padding: 2.5rem;

    /* Flex alignment for content */
    display: flex;
    flex-direction: column;
    justify-content: center;

    /* Text Styles */
    color: #ffffff;
    text-decoration: none;
    position: relative;
    overflow: hidden;

    /* Physics */
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.glass-box.box-info {
    justify-content: flex-start;
    text-align: left;
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

.glass-box.box-link {
    align-items: center;
    cursor: pointer;
}

/* Typography */
.glass-box h3 {
    font-family: system-ui;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    margin-top: 0;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.glass-box .typewriter-text {
    font-size: 1.1rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 1);
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* Hover Effects */
.glass-box:hover {
    transform: translateY(-5px);
    /*background: rgba(255,255,255,0.08);*/
}

/* ================================
   PILL BUTTONS
   ================================ */
.glass-box.box-info .pill-btn {
    position: relative;
    z-index: 2;
    background: rgba(0, 0, 0, 0.01) !important; /* Force dark background */
    /*padding: 12px 28px;*/
    border-radius: 12px;
    /*box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);*/
    /*border: 1px solid rgba(255, 255, 255, 0.2);*/

    /*font-weight: 600;*/
    /*font-size: 1.1rem;*/
    /*letter-spacing: 0.02em;*/
    /*color: #fff;*/
    transition: transform 0.3s ease;
    display: inline-block;
    /*line-height: 1;*/
}

.glass-box.box-link .pill-btn {
    position: relative;
    z-index: 2;
    background: rgba(0, 0, 0, 0.2) !important; /* Force dark background */
    padding: 12px 28px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    /*border: 1px solid rgba(255, 255, 255, 0.2);*/

    font-family: 'Wolf2', system-ui;
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: 0.02em;
    color: #fff;
    transition: transform 0.3s ease;
    display: inline-block;
    line-height: 1;
}

.glass-box.box-link:hover .pill-btn {
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
}
