/* ==========================================================================
   1. GLOBAL RESETS & VARIABLES
   ========================================================================== */
html, body {
    overflow-x: hidden;
    width: 100%;
}

html {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

html::-webkit-scrollbar {
  display: none; /* Chrome, Safari, and Opera */
}

html.lenis,
html.lenis body {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
  overscroll-behavior: contain;
}

.lenis.lenis-stopped {
  overflow: hidden;
}

.lenis.lenis-scrolling iframe {
  pointer-events: none;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-color: #fafafa;
    --text-primary: #111111;
    --text-secondary: #333333;
    --accent-color: #222222;
    --border-color: #eaeaea;
    --side-padding: 50px;
    --card-bg: #ededed;
}

[data-theme="dark"] {
    --bg-color: #0a0a0a;
    --text-primary: #f2f2f2;
    --text-secondary: #a0a0a0;
    --accent-color: #ffffff;
    --border-color: #222222;
    --card-bg: #1a1a1a;
}

body {
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   2. NAVIGATION BAR
   ========================================================================== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    width: 100%;
    background-color: var(--bg-color);
    transition: transform 0.4s ease;
}

.navbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 1rem var(--side-padding);
}

.navbar.nav-hidden {
    transform: translateY(-100%);
}

/* Offset for fixed navbar */
body {
    padding-top: 70px; /* Reduced from 80px to match thinner navbar */
}

.logo a {
    font-size: 2rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: -0.03rem;
    text-decoration: none;
    color: var(--text-primary);
}

.navbar nav ul {
    display: flex;
    list-style: none;
    gap: 2.5rem;
    align-items: center;
    position: relative;
}

.navbar nav a {
    text-decoration: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.25s ease;
}

.navbar nav a:hover {
    color: var(--text-secondary);
}

.menu-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 6px;
}

.bar {
    width: 25px;
    height: 2px;
    background-color: var(--text-primary);
    transition: all 0.3s ease;
}

/* Theme Toggle */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    transition: opacity 0.3s ease;

    /* Position outside the right edge of the nav links */
    position: absolute;
    left: 90%;
    margin-left: 3rem; /* Increase this to move it further right */
    top: 50%;
    transform: translateY(-50%);
}

.theme-toggle:hover {
    opacity: 0.7;
}

.theme-toggle i {
    font-size: 1.1rem;
}

[data-theme="dark"] .fa-moon {
    display: none;
}

[data-theme="light"] .fa-sun {
    display: none;
}

/* ==========================================================================
   X. HERO SLIDESHOW (16:9)
   ========================================================================== */
.hero-slideshow,
.project-hero-image {
    position: sticky;
    top: 0;
    z-index: 1;
}

/* Frees the sticky image from its parent so it covers fully */
.project-hero {
    display: contents;
}

.hero-slideshow {
    width: 100%;
    padding: 0;
    margin-top: 0;
    margin-bottom: 0;
}

.slideshow-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background-color: #ededed;
}

.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.slide.active {
    opacity: 1;
}

.slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Slideshow Indicators */
.slideshow-indicators {
    position: absolute;
    bottom: 5rem; /* Moved from top to bottom */
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 1600px;
    padding: 0 var(--side-padding);
    display: flex;
    justify-content: flex-end; /* Keeps it on the right side */
    z-index: 5;
}

.slideshow-indicators-inner {
    display: flex;
    gap: 0.75rem;
}

.indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(0, 0, 0, 0.1);
    transition: all 0.4s ease;
}

.indicator.active {
    background-color: #ffffff;
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

[data-theme="dark"] .indicator {
    background-color: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .indicator.active {
    background-color: #ffffff;
}

/* ==========================================================================
   4. PORTFOLIO GRID & WORK SECTION
   ========================================================================== */
.work-section,
.project-header,
.project-description,
.technical-block,
.project-gallery,
.gallery-grid,
.gallery-2-col,
.user-research-grid,
.about-page-specific {
    position: relative;
    z-index: 10;
    width: 100%;
    background-color: var(--bg-color);
}

.work-section {
    padding: 2rem var(--side-padding);
}

.work-section h2,
.project-grid {
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
}

.work-section h2 {
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 1.5rem; /* Reduced manually from 2.5rem */
    color: var(--text-secondary);
}

.project-header h1,
.project-header .subtitle,
.project-description .description-inner,
.user-research-grid,
.expertise-container {
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    padding-left: var(--side-padding);
    padding-right: var(--side-padding);
    position: relative;
    z-index: 10;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3.5rem 1.5rem;
    grid-auto-flow: dense;
}

.project-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.3s ease;
}

.project-image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background-color: var(--card-bg);
    border-radius: 12px;
}

.project-image-container img,
.project-image-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mobile-image, .mobile-hero {
    display: none;
}

.project-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.project-info {
    padding-top: 1rem;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03rem;
    color: var(--text-primary);
    line-height: 1.2;
}

.project-info span {
    display: block;
    font-size: 0.95rem;
    font-weight: 400;
    letter-spacing: 0rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* ==========================================================================
   5. SPECIAL 2-COLUMN HORIZONTAL SPAN
   ========================================================================== */
.featured-double {
    grid-column: span 2;
    grid-row: span 1;
    height: 100%;
}

.featured-double .project-image-container {
    aspect-ratio: 1.6 / 1;
    width: 100%;
    height: auto;
    flex-grow: 1;
}

/* ==========================================================================
   6. RESPONSIVE MEDIA QUERIES
   ========================================================================== */
@media (max-width: 1024px) {
    :root {
        --side-padding: 30px;
    }

    .project-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .featured-double {
        grid-column: span 2;
        grid-row: span 1;
        height: 100%;
    }

    .featured-double .project-image-container {
        aspect-ratio: 1.6 / 1;
        height: auto;
        flex-grow: 1;
    }
}

@media (max-width: 768px) {
    /* ---------------------------------------------------------
       MOBILE WHITE SPACE & LAYOUT
       --------------------------------------------------------- */
    :root {
        /* SIDE MARGINS: Increase this for more white space on the left/right */
        --side-padding: 25px;
    }

    .project-grid {
        grid-template-columns: 1fr;
        /* VERTICAL SPACE: Space between project cards on the home page */
        gap: 4rem;
    }
    .featured-double {
        grid-column: span 1;
        grid-row: span 1;
    }
    .project-image-container {
        aspect-ratio: 4 / 5 !important; /* Force 4:5 ratio on mobile */
    }
    .slideshow-container {
        aspect-ratio: 16 / 10; /* Changed to 16:10 ratio on mobile */
    }

    .slideshow-indicators {
        bottom: 2rem; /* Shift it down a bit */
        justify-content: flex-start; /* Aligned to the left */
        padding: 0 var(--side-padding); /* Use global side padding to align with grid */
    }

    .slideshow-indicators-inner {
        gap: 0.5rem; /* Tighter gap on mobile if needed */
    }

    .featured-double .project-image-container {
        height: auto;
    }

    /* Global Mobile Offset */
    body {
        padding-top: 70px !important; /* Reduced to match smaller navbar */
    }

    /* Navbar Mobile Styles */
    .navbar {
        padding: 0;
        background-color: var(--bg-color);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .navbar-inner {
        padding: 0.75rem var(--side-padding); /* Reduced from 1.25rem to keep it slim */
    }

    .hero-slideshow {
        margin-top: 0px !important; /* Force no overlap on mobile */
    }

    .logo a {
        font-size: 1.5rem;
    }

    .menu-toggle {
        display: flex;
        z-index: 101;
    }

    /* Animation for hamburger to X */
    .menu-toggle.active .bar:nth-child(2) {
        opacity: 0;
    }
    .menu-toggle.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    .menu-toggle.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        height: 100vh;
        background-color: var(--bg-color);
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        transition: right 0.4s ease;
        box-shadow: -10px 0 30px rgba(0,0,0,0.05);
        z-index: 100;
    }

    .nav-menu.active {
        right: 0;
    }

    .navbar nav ul {
        flex-direction: column;
        gap: 3rem;
        align-items: center;
    }

    .navbar nav a {
        font-size: 1.5rem;
        color: var(--text-primary);
    }
}

/* ==========================================================================
   7. ABOUT PAGE & HOVER EFFECTS
   ========================================================================== */
.about-page-specific {
    min-height: 80vh;
    padding: 5rem 0; /* Changed from flex to standard block for stacking */
}

.about-page-specific .about-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6rem;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--side-padding);
}

.about-page-specific .about-image img {
    display: block;
    width: 100%;
    max-width: 500px;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    /* Try these increments below to see what looks best: */
    object-position: center 94%; /* Nudges it up a tiny bit */
    /* object-position: center 30%; */ /* Moves it up a bit more */
    /* object-position: center 20%; */ /* Noticeably higher */
    /* object-position: center 10%; */ /* Near the very top */
    border-radius: 50%;
}

.about-page-specific .about-text h1 {
    font-size: 3.5rem;
    letter-spacing: -0.03rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.about-page-specific .about-text p {
    font-size: 1.15rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* Expertise Section */
.expertise-container {
    max-width: 1600px;
    width: 100%;
    margin: 5rem auto 0; /* Align with main grid */
    padding: 0 var(--side-padding);
    text-align: left;
}

.expertise-label {
    font-size: 1rem;
    font-weight: 400;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    letter-spacing: -0.01rem;
}

.expertise-list {
    list-style: none;
    padding: 0;
    max-width: 50%; /* Make it half the width */
}

.expertise-list li {
    font-size: 2rem; /* Reduced size */
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.05rem;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

@media (max-width: 1100px) {
    .gallery-grid,
    .gallery-2-col,
    .project-gallery,
    .gallery-row-3,
    .gallery-row-mixed,
    .user-research-grid,
    .text-grid-3,
    .side-visual-block,
    .centered-image-section,
    .problem-header-section,
    .almost-full-bleed,
    .narrow-container {
        grid-template-columns: 1fr;
        gap: 30px;
        width: 100% !important;
        max-width: 100% !important;
        padding-left: var(--side-padding) !important;
        padding-right: var(--side-padding) !important;
    }
}

@media (max-width: 768px) {
    .expertise-list {
        max-width: 100%;
    }
    .expertise-list li {
        font-size: 2rem;
    }

    /* About Page Mobile Fix */
    .about-page-specific .about-container {
        display: flex;
        flex-direction: column;
        align-items: flex-start; /* Align everything to the left */
        gap: 2rem;
    }

    .about-page-specific .about-text {
        display: contents; /* Allows reordering of title and paragraph */
    }

    .about-page-specific .about-text h1 {
        order: 1; /* Title first */
        text-align: left;
        margin-bottom: 0;
        font-size: 2.5rem;
    }

    .about-page-specific .about-text p {
        order: 2; /* Paragraph second */
        text-align: left;
    }

    .about-page-specific .about-image {
        order: 3; /* Image third */
        align-self: center; /* Optionally center the image itself or keep it left */
    }
}

.project-card img.primary-image {
    position: relative;
    z-index: 1;
    transition: opacity 0.4s ease-in-out;
}

.project-card img.secondary-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    z-index: 2;
    transition: opacity 0.4s ease-in-out;
}

.project-card.hover-reveal:hover .secondary-image {
    opacity: 1;
}

/* ==========================================================================
   9. PROJECT PAGES
   ========================================================================== */
.project-page {
    animation: pageFadeIn 0.8s ease forwards;
}

@keyframes pageFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.project-page.page-exit {
    animation: pageFadeOut 0.6s ease forwards;
    pointer-events: none;
}

@keyframes pageFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.project-page main {
    width: 100%;
    background-color: var(--bg-color);
    position: relative;
    z-index: 10;
}

.narrow-container {
    width: 100%;
}

.project-hero {
    display: contents;
}

/* Side-by-Side Technical Block */
.side-visual-block {
    display: grid;
    grid-template-columns: 2fr 1fr; /* Aggressive ratio to prioritize image scale */
    gap: 4rem;
    align-items: center;
    margin: 2rem 0; /* Reduced margin to tighten vertical rhythm */
    padding: 0 var(--side-padding);
}

.side-visual-media {
    overflow: hidden;
    width: 100%;
}

.side-visual-media video,
.side-visual-media img {
    width: 100%; /* Reset to 100% for standard layout */
    height: auto;
    display: block;
}

.side-visual-content {
    max-width: 600px;
    margin-left: 0; /* Removed negative overlap */
    z-index: 2;
    position: relative;
}

.feature-item {
    margin-bottom: 2rem;
}

.feature-item h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.feature-item p {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.feature-footer-text {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: 3.5rem;
    line-height: 1.6;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    max-width: 90%;
}

/* Process Image Grids */
.process-image-grid-6 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
}

.process-image-grid-6 img {
    width: 100% !important;
    aspect-ratio: 4 / 5; /* Forces a professional portrait ratio */
    object-fit: cover;
    border-radius: 4px;
}

.process-image-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1.2fr; /* Match the FEA mockup look */
    gap: 15px;
    width: 100%;
}

.process-image-grid-2 img {
    width: 100% !important; /* Override the 120% from parent */
    height: auto;
    object-fit: contain;
}



/* User Research Grid */
.user-research-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4rem;
    margin-top: 2rem;
    padding: 0 var(--side-padding);
}

.user-card {
    display: flex;
    flex-direction: column;
}

.user-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background-color: #ededed;
    margin-bottom: 1.5rem;
}

.user-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-info strong {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.user-info p {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
    font-style: italic;
}

.technical-block {
    width: 100%;
    margin-bottom: 0;
    padding: 2rem 0; /* Reduced padding from 4rem */
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-color);
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.technical-block .narrow-container {
    display: flex;
    flex-direction: column;
    gap: 1rem; /* Reduced gap from 1.5rem */
}

/* Ensure no double padding inside narrow-container */
.narrow-container .project-description,
.narrow-container .project-description .description-inner,
.narrow-container .project-gallery,
.narrow-container .gallery-grid,
.narrow-container .gallery-2-col,
.narrow-container .description-text {
    padding-left: 0 !important;
    padding-right: 0 !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.technical-block .project-description {
    padding: 0;
    margin: 0;
    background: transparent;
}

/* Ensure no double padding on description inside narrow-container */
.narrow-container .project-description .description-inner {
    max-width: none;
    padding-left: 0;
    padding-right: 0;
    margin: 0;
}

/* Wide Viewport Side-by-Side */
@media (min-width: 1000px) {
    .technical-block .process-side-layout {
        display: grid;
        grid-template-columns: 2fr 1fr;
        gap: 4rem;
        align-items: start;
    }

    .technical-block .process-side-layout .gallery-caption {
        margin-top: 0;
        text-align: left;
    }

    .technical-block .process-side-layout .process-image-grid-6 {
        max-height: 70vh;
    }
}

.technical-block .description-text {
    flex: none; /* Prevents title from growing and creating empty space */
}

.technical-block .description-text h2 {
    margin-bottom: 0.25rem; /* Reduced from 0.5rem or 1rem */
}

.technical-block .description-text p {
    margin-bottom: 0;
}

.technical-block img {
    max-height: 55vh; /* Scale visuals to fit within viewport */
    width: auto;
    margin: 0 auto;
    display: block;
    object-fit: contain;
}

/* Restored narrow-container functionality to align content */
.narrow-container {
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
    padding-left: var(--side-padding);
    padding-right: var(--side-padding);
}

.project-hero {
    width: 100%;
    margin-bottom: 0;
}

.project-hero-image {
    width: 100%;
    height: 100vh;
    margin-top: -70px;
    aspect-ratio: auto;
    overflow: hidden;
    background-color: #ededed;
}

.project-hero-image img,
.project-hero-image video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-header {
    width: 100%;
    margin: 0;
    padding: 3rem 0 0;
    text-align: left;
    background-color: var(--bg-color);
    border-radius: 40px 40px 0 0;
    position: relative;
    z-index: 10;
    box-shadow: 0 -20px 40px rgba(0,0,0,0.05); /* Soft shadow to define the edge */
}

/* --------------------------------------------------------------------------
   PROJECT PAGE WIDTHS (Edit these to change layout width)
   -------------------------------------------------------------------------- */

/* Context Block */
.context-block-wrapper {
    width: 100%;
    background-color: var(--bg-color);
    position: relative;
    z-index: 10;
}

.context-block {
    max-width: 1300px;
    margin: 0 auto;
    padding: 6rem var(--side-padding);
}

.context-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 3rem;
    gap: 4rem;
}

.context-title-group {
    flex: 1;
}

.context-title-group h2 {
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.context-title-group h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: -1rem;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.context-title-group p,
.context-description-bottom p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 1300px;
}

.context-description-bottom {
    margin-top: 1rem;
}

.context-logo {
    width: 100px;
    flex-shrink: 0;
    display: flex;
    justify-content: flex-end;
}

.context-logo img, .context-logo svg {
    width: 100%;
    height: auto;
}

.context-main-image {
    width: 100%;
    aspect-ratio: 21 / 9; /* Cinematic wide ratio (taller than 32:9, shorter than 16:9) */
    overflow: hidden;
}

.context-main-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

@media (max-width: 1100px) {
    .gallery-grid,
    .gallery-2-col,
    .project-gallery,
    .gallery-row-3,
    .gallery-row-mixed,
    .user-research-grid,
    .text-grid-3,
    .side-visual-block,
    .centered-image-section,
    .problem-header-section,
    .almost-full-bleed,
    .narrow-container {
        grid-template-columns: 1fr;
        gap: 30px;
        width: 100% !important;
        max-width: 100% !important;
        padding-left: var(--side-padding) !important;
        padding-right: var(--side-padding) !important;
    }
}

@media (max-width: 768px) {
    .context-header {
        margin-bottom: 2.5rem;
    }

    .context-title-group h2 {
        font-size: 1.5rem;
    }

    .context-title-group h3 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }

    .context-block {
        padding: 4rem var(--side-padding);
    }

    .context-main-image {
        aspect-ratio: 16 / 9; /* Taller on mobile so you can actually see the image */
    }
}

/* 1. MAIN INTRO WIDTH (Title, Subtitle, Paragraph, Metadata, Expertise) */
.navbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 1rem var(--side-padding);
}

/* 2. PROCESS SECTION WIDTH (Technical Blocks: Images and Text) */
.technical-block .description-inner,
.technical-block .project-gallery:not(.full-bleed),
.technical-block .gallery-grid,
.technical-block .gallery-2-col,
.context-block {
    max-width: 1100px;           /* REDUCED TO 1100PX FOR FOCUS */
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    padding-left: var(--side-padding);
    padding-right: var(--side-padding);
    position: relative;
    z-index: 10;
}

.almost-full-bleed {
    max-width: 1600px !important; /* Aligned with Logo/Header Width */
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    padding-left: var(--side-padding);
    padding-right: var(--side-padding);
}

.project-header h1,
.project-header .subtitle {
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--side-padding);
    padding-right: var(--side-padding);
}

.project-header h1 {
    font-size: 6rem;
    font-weight: 700;
    letter-spacing: -2px;
    margin-bottom: -1rem;
}

.project-header .subtitle {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.05rem;
    color: var(--text-primary);
    padding-bottom: 2rem;
}

.project-description {
    width: 100%;
    margin: 0;
    padding: 1rem 0 8rem;
    position: relative;
    background-color: var(--bg-color);
}

.description-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4rem;
    align-items: start;
}

.description-text {
    flex: 1 1 600px; /* Reduced from 800px to wrap earlier */
    max-width: none;
}

.description-details {
    flex: 0 0 auto;
}


.description-text p {
    margin-bottom: 0;               /* Ensure no bottom margin on the paragraph itself */
}

.description-inner > .description-text:only-child {
    grid-column: 1 / span 2;
}

.technical-block .description-inner {
    display: block;
}

.technical-block .description-text {
    max-width: none; /* Allows process text to align with 1300px images */
}

/* Project Process Headers (Technical Blocks) */
.description-text h2 {
    font-size: 2.25rem;       /* MANIPULATE SIZE HERE */
    font-weight: 600;
    text-transform: none;     /* Changed from all-caps to normal title case */
    letter-spacing: -0.03rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.description-text p {
    font-size: 1.15rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.text-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4rem;
    text-align: left;
    border-top: 1px solid var(--border-color);
    padding: 2rem var(--side-padding) 0; /* Minimized gap above, added side padding */
}

.text-grid-item h3 {
    font-size: 0.85rem;
    font-style: italic;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.text-grid-item p {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* LifeAid Specific Problem Styles */
.centered-image-section {
    background-color: #f9f9f9;
    padding: 10vh 0;
    margin-bottom: 0;
    display: flex;
    justify-content: center;
    width: 100vw;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}

.EpipenTiff\.png {
    max-width: 1600px;
    width: 90%;
    height: auto;
    margin: 0 auto;
    transform: translateX(-100px);
}

.problem-header-section {
    text-align: left;
    margin: 0 0 10rem;
    padding-top: 4rem;
}

.problem-headline {
    font-size: 2.25rem !important;
    text-transform: none !important;
    letter-spacing: -0.02em !important;
    font-weight: 600;
    margin: 0 0 1.5rem 0 !important; /* Managed gap below */
    max-width: 1200px;
    color: var(--text-primary);
    line-height: 1.25;
}

.text-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4rem;
    text-align: left;
    border-top: 1px solid var(--border-color);
    padding: 2rem var(--side-padding) 0; /* Minimized gap above, added side padding */
}

.text-grid-item {
    display: flex;
    flex-direction: column;
}

.text-grid-item h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 700;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
}

.text-grid-item p {
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

.description-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 400px; /* Prevents column from getting too wide */
}

.detail-item h3 {
    display: none; /* Hide old labels if they exist */
}

.detail-item p {
    display: flex;
    align-items: baseline;
    font-size: 1.15rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.detail-item p strong {
    display: inline-block;
    width: 140px;          /* Fixed width for labels to create uniform column alignment */
    font-weight: 500;
    color: var(--text-primary);
    flex-shrink: 0;        /* Prevents the label itself from shrinking */
}

.project-gallery {
    width: 100%;
    background-color: var(--bg-color);
}

.project-gallery:not(.full-bleed) {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5mm;
    margin-bottom: 5mm;
}

.project-gallery.full-bleed {
    width: 100%;
    position: relative;
    padding: 0; /* No side padding by default for true full-bleed */
    margin-bottom: 0;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 5mm;
}

.bottom-gallery {
    width: 100% !important;
    max-width: none !important;
    padding-left: max(var(--side-padding), calc((100% - 1100px) / 2)) !important;
    padding-right: max(var(--side-padding), calc((100% - 1100px) / 2)) !important;
    padding-top: 0 !important;
    padding-bottom: 5mm !important;
    background-color: var(--bg-color);
}

.project-gallery.full-bleed .gallery-item-full {
    grid-column: span 12;
    padding: 0rem;
}

.project-gallery.full-bleed .gallery-item-third {
    grid-column: span 4;
}

.project-gallery.full-bleed .gallery-item-single {
    grid-column: span 3; /* Narrower: 25% */
}

.project-gallery.full-bleed .gallery-item-double {
    grid-column: span 9; /* Wider: 75% */
    height: 32vh;
    overflow: hidden;
}

.project-gallery.full-bleed .gallery-item-single {
    height: 32vh;
    overflow: hidden;
}

.project-gallery.full-bleed img {
    height: 100% !important;
    object-fit: cover;
    object-position: center center; /* Vertically centers the image within the frame */
}

.gallery-2-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    justify-content: center;
    gap: 5mm;
    width: 100%;
    margin: 0 auto;
}

.gallery-2-col.full-bleed {
    max-width: none;
    width: 100vw;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    padding: 0;
}

.gallery-2-col .gallery-item-full {
    grid-column: span 2;
}

.gallery-2-col .gallery-item-half {
    grid-column: span 1;
}

.bottom-gallery {
    width: 100% !important;
    max-width: none !important;
    padding-left: max(var(--side-padding), calc((100% - 1100px) / 2)) !important;
    padding-right: max(var(--side-padding), calc((100% - 1100px) / 2)) !important;
    padding-top: 0 !important;
    padding-bottom: 5mm !important;
    background-color: var(--bg-color);
}

.gallery-item-full {
    grid-column: span 3;
}

.gallery-item-double {
    grid-column: span 2;
}

.gallery-item-single {
    grid-column: span 1;
}

/* Ensure all images in the gallery are constrained */
.project-gallery img {
    width: 100%;
    height: auto;
    display: block;
    background-color: transparent;
}

/* Row 3 height matching logic */
.gallery-item-double {
    position: relative;
    width: 100%;
}

.gallery-item-double img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Ensure the single item with aspect-ratio defines the row height */
.gallery-item-single {
    width: 100%;
}

.gallery-item img,
.gallery-row img {
    width: 100%;
    display: block;
    background-color: #ededed;
}

.gallery-caption {
    margin-top: 1.5rem;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
    max-width: 1300px;
}

.gallery-caption strong {
    display: block;
    margin-top: 1rem;
    color: var(--text-primary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.aspect-panoramic {
    width: 100%;
    aspect-ratio: 3 / 1; /* Shorter top image */
    overflow: hidden;
}

.aspect-panoramic img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
}

.aspect-landscape {
    width: 100%;
    aspect-ratio: 3 / 2; /* Shorter bottom images */
    overflow: hidden;
}

.aspect-landscape img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.aspect-16-9 {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.aspect-16-9 img,
.aspect-16-9 video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.aspect-4-5 {
    width: 100%;
    aspect-ratio: 4 / 5;
    overflow: hidden;
}

.aspect-4-5 img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (max-width: 1100px) {
    .gallery-grid,
    .gallery-2-col,
    .project-gallery,
    .gallery-row-3,
    .gallery-row-mixed,
    .user-research-grid,
    .text-grid-3,
    .side-visual-block,
    .centered-image-section,
    .problem-header-section,
    .almost-full-bleed,
    .narrow-container {
        grid-template-columns: 1fr;
        gap: 30px;
        width: 100% !important;
        max-width: 100% !important;
        padding-left: var(--side-padding) !important;
        padding-right: var(--side-padding) !important;
    }
}

@media (max-width: 768px) {
    .gallery-grid,
    .gallery-2-col,
    .project-gallery,
    .gallery-row-3,
    .gallery-row-mixed,
    .user-research-grid,
    .text-grid-3,
    .side-visual-block,
    .centered-image-section,
    .problem-header-section,
    .almost-full-bleed {
        grid-template-columns: 1fr;
        gap: 30px;
        width: 100% !important;
        max-width: 100% !important;
    }
}

@media (max-width: 1100px) {
    .gallery-grid,
    .gallery-2-col,
    .project-gallery,
    .gallery-row-3,
    .gallery-row-mixed,
    .user-research-grid,
    .text-grid-3,
    .side-visual-block,
    .centered-image-section,
    .problem-header-section,
    .almost-full-bleed,
    .narrow-container {
        grid-template-columns: 1fr;
        gap: 30px;
        width: 100% !important;
        max-width: 100% !important;
        padding-left: var(--side-padding) !important;
        padding-right: var(--side-padding) !important;
    }
}

@media (max-width: 768px) {
    /* ---------------------------------------------------------
       PROJECT PAGE: TITLE, SUBTITLE, BODY & METADATA
       --------------------------------------------------------- */

    /* 1. MAIN TITLE */
    .project-header h1 {
        font-size: 3.5rem;          /* Slightly smaller title for mobile */
        letter-spacing: -0.03rem;      /* Space between letters */
        margin-bottom: 0.25rem;      /* Space below title */
        line-height: 1.1;           /* Height of the lines */
    }

    /* 2. SUBTITLE */
    .project-header .subtitle {
        font-size: 1.5rem;         /* Subtitle Size */
        letter-spacing: -0.03rem;       /* Space between letters */
        padding-bottom: 1rem;      /* Reduced spacing between subtitle and paragraph */
        margin-bottom: 0;
        font-weight: 500;
    }

    /* 3. BODY PARAGRAPH */
    .description-text p {
        font-size: 1rem;          /* Paragraph Size */
        letter-spacing: -0.03rem;       /* Space between letters */
        line-height: 1.6;           /* Space between lines */
        margin-bottom: 1.5rem;      /* Space between paragraphs */
    }

    /* 3.5 PROCESS HEADERS (e.g. "Design Driven By Data") */
    .description-text h2 {
        font-size: 1.75rem;         /* Process Header Size */
        letter-spacing: -0.02rem;
        margin-bottom: 1rem;
    }

    /* 4. METADATA (Role, Timeline, etc.) */
    .description-details {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;               /* Space between meta rows */
        margin-top: 3rem;           /* Gap above metadata block (more than subtitle-to-paragraph) */
    }

    .detail-item p {
        font-size: 1rem;            /* Meta Text Size */
        letter-spacing: -0.03rem;
        line-height: 1.4;
        white-space: normal;        /* Allow text to wrap on small screens */
    }

    .detail-item p strong {
        width: 100px;               /* Width of the label (e.g., 'ROLE') */
        font-size: 1rem;          /* Label Size */
        letter-spacing: -0.03rem;    /* Label Letter Spacing */
    }

    /* ---------------------------------------------------------
       PROJECT PAGE: LAYOUT & GALLERIES
       --------------------------------------------------------- */
    .project-header {
        padding-top: 1.5rem;         /* Space between Hero Image and Title */
        margin-top: 0;
        border-radius: 30px 30px 0 0;
    }

    .description-inner {
        display: block;
        gap: 0;
    }
    .description-text, .description-details {
        width: 100%;
    }
    .gallery-grid,
    .gallery-2-col,
    .project-gallery,
    .gallery-row-3,
    .gallery-row-mixed,
    .user-research-grid,
    .text-grid-3,
    .side-visual-block,
    .centered-image-section,
    .problem-header-section,
    .almost-full-bleed {
        grid-template-columns: 1fr;
        gap: 30px;                  /* SPACE BETWEEN IMAGES IN A GRID */
        width: 100% !important;
        max-width: 100% !important;
        padding-left: var(--side-padding) !important;
        padding-right: var(--side-padding) !important;
    }
    .project-hero-image {
        height: 100vh;
        margin-top: -70px;
        aspect-ratio: auto;
    }
    .project-description {
        padding-bottom: 3rem;      /* Use padding instead of margin */
    }

    .technical-block .project-gallery {
        padding-bottom: 0rem;      /* GAP 2: Space between Image and the Paragraph below it */
    }

    .technical-block {
        padding-bottom: 1rem;        /* GAP 3: Space between major sections */
        padding-top: 3rem;          /* GAP 4: Space above the Heading (from divider line) */
    }
}

/* Objective Section */
.objective-section {
    width: 100%;
    background-color: var(--bg-color);
    padding: 2rem var(--side-padding);
    text-align: center;
    position: relative;
    z-index: 10;
}

.objective-inner {
    max-width: 800px;
    margin: 0 auto;
}

.objective-section h2 {
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 2rem;
    display: inline-block;
    border-bottom: 2px solid var(--text-primary);
    padding-bottom: 0rem;
}

.objective-section p {
    font-size: 2rem;
    font-weight: 500;
    line-height: 1.2;
    color: var(--text-primary);
    letter-spacing: -0.02em;

}

/* Expandable Process Section */
.expandable-process-wrapper {
    width: 100%;
    background-color: var(--bg-color);
    position: relative;
    z-index: 10;
    border-top: 1px solid var(--border-color);
    padding-bottom: 0; /* Reduced to pull next section closer */
}

.process-preview {
    width: 100%;
    height: 400px;
    overflow: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    background-color: var(--bg-color);
    padding-bottom: 0.5rem; /* Reduced to bring button closer to bottom */
    transition: height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.preview-images {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    justify-content: center;
    width: 100%;
    position: absolute;
    bottom: 4rem; /* Sit above the button's text area */
    opacity: 0.5; /* Light overlay effect */
    transition: all 0.5s ease;
}

.preview-images img {
    width: 300px;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    transition: transform 0.5s ease;
}

/* Fan-out effect */
.preview-images img:nth-child(1) { transform: rotate(-8deg) translateY(20px); }
.preview-images img:nth-child(2) { transform: rotate(-3deg) translateY(0); }
.preview-images img:nth-child(3) { transform: rotate(5deg) translateY(10px); }

.unfold-button {
    position: relative;
    margin-bottom: 0; /* Removed negative margin to allow more breathing room */
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    z-index: 20;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.unfold-button .icon-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: #5d93cc; /* Muted blue from screenshot */
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.unfold-button span:not(.icon-circle) {
    font-size: 1.1rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-primary);
    font-family: inherit;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.process-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 1s cubic-bezier(0, 1, 0, 1);
}

.process-content h2,
.process-content h3,
.process-content .description-text h2 {
    color: var(--text-primary);
}

.expandable-process-wrapper.active .process-content {
    max-height: 10000px;
    transition: max-height 1s cubic-bezier(1, 0, 1, 0);
}

.expandable-process-wrapper.active .icon-circle {
    transform: rotate(180deg);
}

.expandable-process-wrapper.active .process-preview {
    height: 120px; /* Adjusted height to keep arrow nicely centered vertically */
    overflow: visible;
}

.expandable-process-wrapper.active .preview-images {
    transform: translateY(100px);
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.expandable-process-wrapper.active .unfold-button span:not(.icon-circle) {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.expandable-process-wrapper.active .unfold-button {
    margin-bottom: 0;
    /* Keeps it centered relative to the now smaller process-preview */
    transform: translateY(-20px);
}

@media (max-width: 1100px) {
    .gallery-grid,
    .gallery-2-col,
    .project-gallery,
    .gallery-row-3,
    .gallery-row-mixed,
    .user-research-grid,
    .text-grid-3,
    .side-visual-block,
    .centered-image-section,
    .problem-header-section,
    .almost-full-bleed,
    .narrow-container {
        grid-template-columns: 1fr;
        gap: 30px;
        width: 100% !important;
        max-width: 100% !important;
        padding-left: var(--side-padding) !important;
        padding-right: var(--side-padding) !important;
    }
}

@media (max-width: 768px) {
    .objective-section p {
        font-size: 1.5rem;
    }
    .preview-images img {
        width: 150px;
        height: 200px;
    }
}

/* Wave Overlay Section */
.wave-overlay-section {
    position: relative;
    width: 100%;
    padding: 8rem 0;
    background-color: var(--bg-color);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.wave-text-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 var(--side-padding);
    width: 100%;
    position: relative;
    z-index: 2;
}

.wave-text-container h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--text-primary);
}

.wave-text-container p {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    line-height: 1.4;
    color: var(--text-primary);
}

.wave-background-image {
    width: 100%;
    margin-top: 4rem; /* Desktop gap */
}

.wave-background-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* Colored Text Classes */
.text-flow { color: #00AEEF; }
.text-interruption { color: #E74C3C; }
.text-rise { color: #27AE60; }
.text-dip { color: #F39C12; }
.text-recover { color: #829460; }

@media (max-width: 1100px) {
    .gallery-grid,
    .gallery-2-col,
    .project-gallery,
    .gallery-row-3,
    .gallery-row-mixed,
    .user-research-grid,
    .text-grid-3,
    .side-visual-block,
    .centered-image-section,
    .problem-header-section,
    .almost-full-bleed,
    .narrow-container {
        grid-template-columns: 1fr;
        gap: 30px;
        width: 100% !important;
        max-width: 100% !important;
        padding-left: var(--side-padding) !important;
        padding-right: var(--side-padding) !important;
    }
}

@media (max-width: 768px) {
    .wave-overlay-section {
        padding: 4rem 0;
        flex-direction: column; /* Stack image then text */
    }

    .wave-background-image {
        order: -1; /* Image first */
        margin-top: 0;
        margin-bottom: 3rem;
        width: 100vw;
        position: relative;
        left: 50%;
        transform: translateX(-50%);
        height: 150px; /* Horizontally long, vertically short */
        overflow: hidden;
    }

    .wave-background-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
    }

    .wave-text-container h2 {
        font-size: 1.75rem;
    }

    .wave-text-container p {
        font-size: 1.25rem;
    }
}

/* Requirements Section */
.requirements-section {
    width: 100%;
    padding: 8rem 0;
    background-color: var(--bg-color);
    text-align: center;
}

.requirements-section h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 5rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.requirements-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4rem;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 var(--side-padding);
}

.requirement-category h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 3rem;
    color: var(--text-primary);
}

.circles-container {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.requirement-circle {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
    transition: transform 0.3s ease;
}

.circle-filled {
    background-color: #829460; /* Matches the 'recover' green from the image */
    color: white;
    border: none;
}

.circle-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

[data-theme="dark"] .circle-outline {
    border-color: #333;
}

@media (max-width: 1024px) {
    .requirements-grid {
        grid-template-columns: 1fr;
        gap: 6rem;
    }

    .requirement-circle {
        width: 140px;
        height: 140px;
        font-size: 0.9rem;
    }
}

@media (max-width: 1100px) {
    .gallery-grid,
    .gallery-2-col,
    .project-gallery,
    .gallery-row-3,
    .gallery-row-mixed,
    .user-research-grid,
    .text-grid-3,
    .side-visual-block,
    .centered-image-section,
    .problem-header-section,
    .almost-full-bleed,
    .narrow-container {
        grid-template-columns: 1fr;
        gap: 30px;
        width: 100% !important;
        max-width: 100% !important;
        padding-left: var(--side-padding) !important;
        padding-right: var(--side-padding) !important;
    }
}

@media (max-width: 768px) {
    .requirements-section {
        padding: 4rem 0;
    }

    .requirements-section h2 {
        font-size: 1.75rem;
        margin-bottom: 3rem;
    }

    .circles-container {
        gap: 1rem;
    }

    .requirement-circle {
        width: 110px;
        height: 110px;
        font-size: 0.75rem;
        padding: 1rem;
    }
}

.iteration-diagram {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    margin-top: 4rem;
    margin-bottom: 4rem;
}

.iteration-diagram img {
    width: 100%;
    height: auto;
    display: block;
}

/* Rotating Carousel (Scroll Triggered) */
.rotating-carousel {
    width: 100%;
    height: 500vh; /* Provides the scroll length for the 5 stages */
    background-color: var(--bg-color);
    position: relative;
    z-index: 10;
}

.carousel-sticky-wrapper {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.carousel-header {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    max-width: 1600px;
    width: calc(100% - (var(--side-padding) * 2));
    margin: 0 auto 1.5rem;
    font-size: 2rem;
    color: var(--text-secondary);
}

.carousel-label {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.5s ease;
    font-weight: 700; /* Keep it bold to prevent layout jumping */
    font-size: 2.5rem;
    opacity: 0.15;
    transform: scale(0.8);
    display: inline-block;
}

.carousel-label.active {
    opacity: 1;
    transform: scale(1);
    color: var(--text-primary);
}

.carousel-main {
    max-width: 1600px;
    width: calc(100% - (var(--side-padding) * 2));
    margin: 0 auto;
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden; /* Acts as a window */
    border-radius: 40px;
}

.carousel-track {
    display: flex;
    flex-direction: column;
    width: 100%;
    /* Remove height: 100% so it can grow with its content */
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.carousel-slide {
    width: 100%;
    aspect-ratio: 16 / 9;
    flex-shrink: 0;
    position: relative; /* CRITICAL: Ensure text overlays are anchored to the slide itself */
}

.carousel-slide img,
.carousel-slide video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Carousel Slide Overlays */
.slide-overlay {
    position: absolute;
    z-index: 5;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.slide-overlay.active {
    opacity: 1;
    transform: translateX(0) !important;
}

.slide-overlay.left-mid {
    left: 10%;
    top: 15%; /* Positioned on the upper side */
    text-align: left;
}

.slide-overlay.left-bottom {
    left: 10%;
    bottom: 15%; /* Positioned on the bottom side */
    text-align: left;
}

.slide-overlay.bottom-spread {
    left: 5%;
    right: 5%;
    bottom: 5%;
    top: auto;
    display: flex;
    justify-content: space-between;
    text-align: left; /* Align text to left inside blocks */
}

.mode-block {
    flex: 1;
    padding: 0 1rem;
}

.overlay-small {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.overlay-main {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
    margin-bottom: 0.25rem;
    text-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.overlay-stat {
    font-size: 1.1rem;
    font-weight: 600;
    color: #E74C3C; /* Red for decrease/dip */
    text-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.overlay-stat.increase {
    color: #27AE60; /* Green for increase/focused */
}

.overlay-stat.neutral {
    color: var(--text-primary); /* Neutral color for informational text */
}

.mobile-carousel-text {
    display: none; /* Hidden on desktop */
}

@media (max-width: 1100px) {
    .gallery-grid,
    .gallery-2-col,
    .project-gallery,
    .gallery-row-3,
    .gallery-row-mixed,
    .user-research-grid,
    .text-grid-3,
    .side-visual-block,
    .centered-image-section,
    .problem-header-section,
    .almost-full-bleed,
    .narrow-container {
        grid-template-columns: 1fr;
        gap: 30px;
        width: 100% !important;
        max-width: 100% !important;
        padding-left: var(--side-padding) !important;
        padding-right: var(--side-padding) !important;
    }
}

@media (max-width: 1100px) {
    .slide-overlay {
        display: none !important; /* Hide original overlays when text moves below */
    }

    .mobile-carousel-text {
        display: block;
        max-width: 1600px;
        width: calc(100% - (var(--side-padding) * 2));
        margin: 0 auto;
        padding: 0.5rem 0 2rem;
        min-height: auto;
        background-color: var(--bg-color);
        transition: opacity 0.5s ease;
        text-align: left;
    }

    .mobile-carousel-text .slide-overlay {
        display: block !important;
        position: static;
        width: 100%;
        opacity: 1;
        transform: none;
    }

    .mobile-carousel-text .bottom-spread {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
    }

    .mobile-carousel-text .mode-block {
        padding: 0;
        margin-bottom: 0;
        border-bottom: none;
        padding-bottom: 0;
    }

    .mobile-carousel-text .mode-block:last-child {
        border-bottom: none;
    }

    .mobile-carousel-text .overlay-main {
        font-size: 1.5rem; /* Increased size */
        margin-bottom: 0.2rem;
    }

    .mobile-carousel-text .overlay-small {
        font-size: 0.8rem;
        line-height: 1.3;
        color: var(--text-secondary);
    }

    .mobile-carousel-text .overlay-stat {
        font-size: 0.95rem;
        margin-bottom: 0.2rem;
    }

    .carousel-slide {
        aspect-ratio: 4 / 3;
    }

    .rotating-carousel {
        height: 450vh;
    }

    .carousel-sticky-wrapper {
        padding-top: 2rem;
        padding-bottom: 1rem;
        justify-content: flex-start;
    }

    .carousel-header {
        justify-content: center;
        width: calc(100% - (var(--side-padding) * 2));
        margin: 0 auto 1.5rem; /* Increased margin-bottom */
        font-size: 1.1rem; /* Increased size */
        gap: 0.75rem; /* Increased gap */
        white-space: nowrap;
    }

    .carousel-header::-webkit-scrollbar {
        display: none;
    }

    .carousel-label {
        font-size: 1.1rem; /* Matched header size */
        flex-shrink: 0;
    }

    .carousel-main {
        aspect-ratio: 4 / 3;
        border-radius: 20px;
        width: calc(100% - (var(--side-padding) * 2));
        margin-bottom: 0.5rem;
    }
}

/* ==========================================================================
   8. FOOTER
   ========================================================================== */
.footer {
    width: 100%;
    border-top: 0px solid var(--border-color);
    background-color: #000000;
}

.footer-inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    max-width: 1600px;
    margin: 0 auto;
    padding: 3rem var(--side-padding) 4rem;
}

.footer-info {
    font-size: 0.9rem;
    color: #ffffff;
    grid-column: 1;
}

.back-to-top {
    grid-column: 2;
    background: none;
    border: none;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 0.5rem;
    transition: opacity 0.3s ease;
}

.back-to-top:hover {
    opacity: 0.6;
}

.back-to-top .arrow {
    font-size: 1.2rem;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-5px);
    }
    60% {
        transform: translateY(-3px);
    }
}

.footer-socials {
    grid-column: 3;
    display: flex;
    justify-content: flex-end;
    gap: 1.75rem;
}

.footer-socials a {
    color: #ffffff;
    font-size: 1.5rem;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.footer-socials a:hover {
    opacity: 0.6;
}

@media (max-width: 768px) {
    .footer-inner {
        display: flex;
        flex-direction: column;
        gap: 2.5rem;
        text-align: center;
    }

    .back-to-top {
        order: 1;
    }

    .footer-socials {
        order: 2;
        justify-content: center;
    }

    .footer-info {
        order: 3;
    }
}
