/* =========================================
   1. GLOBAL RESET & TYPOGRAPHY
   ========================================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    outline: none;
    border: 0;
}

body {
    overflow-x: hidden;
    min-height: 100vh;
    font-family: "Inter", sans-serif;
    color: black;
}

/* Typography Defaults */
h1 { font-family: "Inter", sans-serif; font-weight: 300; font-size: 2rem; line-height: 1.5vw; }
h2 { font-style: oblique; font-weight: 300; font-size: 1.2vw; line-height: 1.5vw; }
p { font-size: 1.2vw; line-height: 2.05vw; font-weight: 300; }
b { font-weight: 500; }


/* =========================================
   2. HERO SECTION
   ========================================= */
.portfolio-intro {
    position: relative;
    height: 120vh;
    width: 100vw;
    background-image: linear-gradient(black 100vh, white 100vh);
}

.portfolio-cover {
    position: absolute;
    top: 0;
    height: 100vh;
    width: 100vw;
    background-position: top center;
    background-size: cover;
    mix-blend-mode: screen;
    pointer-events: none;
    z-index: 7;
}

/* --- HERO IMAGE MODIFIERS --- */
.portfolio-cover.roadster-hero {
    background-image: url(../images/Roadster_Images/Roadster_Hero.webp);
}

.portfolio-cover.trulli-hero {
    background-image: url(../images/Speaker_Images/Speaker_Hero.webp);
}

.portfolio-cover.uglystik-hero {
    background-image: url(../images/Tool_Images/Tools_Main.webp);
}

.portfolio-cover.strider-hero {
    background-image: url(../images/Bike_Images/Bike_Hero.webp);
}

.portfolio-cover.nalgene-hero {
    background-image: url(../images/Bottle_Images/Bottle_Hero.webp);
}

.portfolio-title {
    position: sticky;
    top: 70vh;
    padding-top: 8vw;
    margin-left: 10vw;
    color: white;
    mix-blend-mode: difference;
    z-index: 8;
}


/* =========================================
   3. MAIN LAYOUT & INTRO
   ========================================= */
.project-container {
    display: grid;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 10vw;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1vw;
    background-color: white;
}

/* Intro Grid (Role, Scope, Narrative) */
.intro-grid {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 2fr;
    grid-template-rows: auto auto; 
    column-gap: 4vw;
    margin-bottom: 5vw;
}

.intro-headline { grid-column: 2; grid-row: 1; margin-bottom: 40px; }
.intro-details { grid-column: 1; grid-row: 2; }
.intro-text { grid-column: 2; grid-row: 2; margin-top: 0; }

/* Detail Lists (Role/Scope) */
.detail-group { margin-bottom: 30px; }
.detail-group .label { display: block; font-weight: 700; margin-bottom: 8px; font-size: 1.2vw; }
.detail-group .value { display: block; font-weight: 300; font-size: 1.2vw; line-height: 1.6; }


/* =========================================
   4. VISUALS & TEXT BLOCKS
   ========================================= */
/* Three View Grid */
.three-view-grid {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1vw;
}
.view-item img { width: 100%; height: auto; display: block; }

/* Text Blocks */
.text-block.centered { grid-column: 1 / -1; padding: 3vw 9vw; text-align: center; }
.text-block.no-top-padding { padding-top: 0; }

/* Full Width Images */
.full-width-image { grid-column: 1 / -1; width: 100%; }
.full-width-image img { width: 100%; height: auto; display: block; }


/* =========================================
   5. TECHNICAL GRIDS (VARIANTS)
   ========================================= */

/* VARIANT A: Asymmetric (Roadster Style) */
.technical-grid {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 2.5fr;
    gap: 4vw;
    margin-bottom: 100px;
    align-items: start;
}
.tech-col-left, .tech-col-right { display: flex; flex-direction: column; }
.tech-col-left { gap: 15px; }
.tech-col-right { gap: 60px; }

.tech-row-top { display: grid; grid-template-columns: 3fr 1fr; gap: 20px; align-items: center; }
.tech-img { width: 100%; height: auto; display: block; }

/* Roadster Specific Overlaps */
.overlap-effect { margin-top: -250px; mix-blend-mode: multiply; position: relative; z-index: 2; }
.tech-caption.right-align { text-align: right; margin-top: -180px; margin-left: auto; max-width: 40%; position: relative; z-index: 3; }
.tech-caption { font-size: 0.85rem; color: black; line-height: 1.4; }


/* VARIANT B: Split 50/50 (Trulli Style) */
.technical-grid-split {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4vw;
    margin-bottom: 100px;
    align-items: start;
}

.tech-item { display: flex; flex-direction: column; gap: 20px; }
.tech-item .tech-img { width: 100%; height: auto; display: block; border-radius: 4px; }
.tech-item .caption { max-width: 90%; }

/* =========================================
       UGLYSTIK SPECIFIC OVERRIDES
       ========================================= */
    
    /* Single Technical Hero Image */
    .tech-hero-single {
        grid-column: 1 / -1;       /* Span full width of the content grid */
        margin-bottom: 100px;      /* Consistent spacing with other projects */
        width: 100%;
    }

    .tech-hero-single img {
        width: 100%;               /* Fill the container */
        height: auto;              /* Maintain aspect ratio */
        display: block;
    }

/* =========================================
   6. EXPLODED VIEW
   ========================================= */
.exploded-section {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 5vw;
    align-items: center;
    margin-bottom: 120px;
}
.exploded-text p { font-size: 1rem; line-height: 1.6; }
.exploded-img { width: 100%; height: auto; mix-blend-mode: multiply; }

/* MODIFIER: Trulli Vertical Alignment Fix */
.exploded-section.trulli-exploded { align-items: start; margin-bottom: 150px; }
.exploded-section.trulli-exploded .exploded-text { padding-top: 20px; }

/* MODIFIER: Trulli Height Constraint (Prevents massive image) */
.trulli-exploded .exploded-img {
    width: auto !important;
    max-width: 100%;
    max-height: 80vh; 
    display: block;
    margin: 0 auto;
}


/* =========================================
   7. GALLERY GRID
   ========================================= */
.gallery-grid {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 100px;
}

.gallery-item { position: relative; width: 100%; overflow: hidden; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Aspect Ratios */
.gallery-item:not(.portrait):not(.full-width) { aspect-ratio: 4 / 3; }
.gallery-item.portrait { aspect-ratio: 4 / 5; }
.gallery-item.full-width { grid-column: 1 / -1; aspect-ratio: 16 / 9; }

/* Split Row (1/3 + 2/3) */
.gallery-split-row {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
}
.gallery-split-row .gallery-item { height: 100%; min-height: 400px; }


/* =========================================
   8. ANIMATION & UTILITIES
   ========================================= */
.fade-in {
    opacity: 1; 
    transform: translateY(0px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
    will-change: opacity, transform;
    color: black;
}
.fade-in.js-hidden { opacity: 0; transform: translateY(30px); }
.fade-in.appear { opacity: 1; transform: translateY(0px); }

/* Next Project Link */
.next-project-link {
    grid-column: 1 / -1;
    text-decoration: none;
    color: black;
    margin-top: 0px;
    padding: 80px 0;
    display: block;
    transition: background-color 0.3s ease;
}

/* =========================================
   MOBILE RESPONSIVENESS (THE FINAL FIX)
   ========================================= */
@media screen and (max-width: 1160px) {
    
    /* 1. RESET TYPOGRAPHY & SPACING */
    .project-container, p, div { 
        font-size: 16px !important; 
        line-height: 1.6 !important; 
    }
    h1 { font-size: 32px !important; }
    h2 { font-size: 24px !important; margin-bottom: 20px;  margin-top: 60px; line-height: 1.3; }
    
    .intro-headline { 
        margin-top: 100px; /* Space from top nav */
        margin-bottom: 40px; 
    }

    /* 2. THE NUCLEAR OPTION: FORCE VERTICAL STACKING */
    /* This targets EVERY grid container on your site */
    .project-container,
    .intro-grid,
    .three-view-grid,
    .technical-grid,
    .technical-grid-split,
    .exploded-section,
    .exploded-section.trulli-exploded,
    .gallery-grid,
    .gallery-split-row, 
    .tech-row-top {
        display: flex !important;
        flex-direction: column !important; /* Forces vertical stack */
        width: 100% !important;
        height: auto !important;
        gap: 40px !important; /* Space between stacked items */
        padding-left: 5vw !important; /* Restore safety margins */
        padding-right: 5vw !important;
        margin-bottom: 60px !important;
    }

    /* 3. FIX THE "SQUASHED" COLUMNS */
    /* This ensures every item inside those grids expands to fill the phone screen */
    .intro-details, .intro-text, .intro-headline,
    .exploded-text, .exploded-img-wrapper,
    .tech-col-left, .tech-col-right, .tech-item,
    .gallery-item {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        grid-column: auto !important;
        grid-row: auto !important;
    }

    /* 4. SPECIFIC FIXES FOR UGLYSTIK & ROADSTER */
    
    /* Force the "Sidebar" (Role/Scope) to be a full-width block */
    .intro-details {
        order: 1;
        width: 100% !important;
        flex-basis: auto !important; /* Stop trying to be a "column" */
        margin-bottom: 40px !important;
    }

    /* Force the "Main Text" to follow it */
    .intro-text {
        order: 2;
        width: 100% !important;
        flex-basis: auto !important;
    }
    
    /* Ensure the inner text wraps correctly */
    .detail-group, 
    .detail-group .label, 
    .detail-group .value {
        width: 100% !important;
        display: block !important;
        text-align: left !important;
    }

    /* 5. FORCE TEXT SIZE READABILITY */
    
    /* Target the Role & Scope text specifically */
    .detail-group .label,
    .detail-group .value,
    .intro-details,
    .intro-text p {
        font-size: 18px !important; /* Readable standard size */
        line-height: 1.6 !important;
    }
    
    /* Target the "Scope" list items if they are behaving like a block */
    .detail-group .value br {
        content: ""; /* formatting cleanup */
    }

    /* Disable Overlap Effects (Draft Analysis) */
    .overlap-effect { margin-top: 0 !important; }
    .tech-caption.right-align { 
        text-align: left; 
        margin-top: 10px; 
        max-width: 100%; 
    }

    /* Gallery Fixes */
    .gallery-split-row .gallery-item { min-height: 300px; }
    
    /* Next Project Button */
    .next-project-inner { flex-direction: column; align-items: flex-start; gap: 10px; }
    .next-title { font-size: 24px !important; }
    .next-arrow { display: none; }
}