/* Gallery Page - Immersive, Modern, Editorial Design */

/* Gallery Page Wrapper - Background Layer */
.gallery-page {
    position: relative;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: visible !important; /* CRITICAL: Must be visible, NOT auto, for sticky to work */
    /* Removed isolation: isolate - it breaks sticky positioning */
    /* Ensure no transforms that would break sticky */
    transform: none;
}

/* Static Parallax Background */
.gallery-bg {
    position: fixed;
    inset: 0;
    z-index: -1; /* Behind everything */
    background: url('/assets/images/gallery-background.webp') center/cover no-repeat;
    background-attachment: fixed;
    pointer-events: none;
}

.gallery-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(245, 250, 245, 0.45);
}

/* Gallery Inner Content - Above Background */
.gallery-inner {
    position: relative;
    z-index: 1; /* Above background, below header */
    background: transparent; /* Ensure transparency */
    overflow: visible; /* Ensure sticky works - no overflow */
    /* Ensure no transforms that would break sticky */
    transform: none;
}

/* Hero Section - Premium Misty Green Design (Gallery page only) */
.gallery-page .gallery-hero {
    position: relative;
    min-height: clamp(340px, 52vh, 560px);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-align: center;
    z-index: 1;
    padding-top: clamp(72px, 10vh, 120px);
    padding-bottom: clamp(72px, 14vh, 120px);
}

/* Background Image Layer */
.gallery-hero-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    background-image: url('assets/images/about-hero.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transform: scale(1.03);
    will-change: transform;
}

/* Misty Green Overlay - Layered Gradients */
.gallery-hero-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    /* Layered gradients for misty green effect */
    background: 
        /* Radial gradient to brighten center behind title */
        radial-gradient(ellipse at center 40%, rgba(127, 176, 105, 0.15) 0%, transparent 60%),
        /* Linear gradient to darken top slightly under header */
        linear-gradient(to bottom, rgba(26, 77, 46, 0.4) 0%, transparent 20%),
        /* Overall translucent green wash */
        linear-gradient(to bottom, 
            rgba(26, 77, 46, 0.55) 0%, 
            rgba(45, 122, 79, 0.45) 40%, 
            rgba(127, 176, 105, 0.35) 100%);
}

/* Hero Content Container */
.gallery-hero-inner {
    position: relative;
    z-index: 2;
    max-width: 900px;
    padding: 0 20px;
    width: 100%;
    animation: fadeInUp 0.8s ease-out;
}

/* Hero Title */
.gallery-hero-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.2rem, 4vw, 4rem);
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.1;
    letter-spacing: -1.5px;
    color: white;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.25), 0 1px 4px rgba(0, 0, 0, 0.2);
    position: relative;
}

/* Subtle divider accent under title */
.gallery-hero-title::after {
    content: '';
    position: absolute;
    bottom: -0.75rem;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 2px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 1px;
}

/* Hero Subtitle */
.gallery-hero-subtitle {
    font-size: clamp(1rem, 1.5vw, 1.25rem);
    font-weight: 300;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
    margin-top: 1.5rem;
    letter-spacing: 0.2px;
}

/* Soft hero bottom fade: barely noticeable, hero emerges into gallery (Gallery page only) */
.gallery-page .gallery-hero::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: clamp(160px, 22vh, 220px);
    z-index: 1;
    background: linear-gradient(to bottom, transparent 0%, var(--bg-light, #fafafa) 100%);
    pointer-events: none;
}

/* Minimal organic line divider: single stroke, calm transition (Gallery page only) */
.gallery-page .gallery-hero-line {
    position: absolute;
    bottom: 52px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: min(900px, 88vw);
    height: 24px;
    z-index: 2;
    pointer-events: none;
    color: var(--primary-green, #1a4d2e);
    opacity: 0.32;
}

.gallery-page .gallery-hero-line svg {
    width: 100%;
    height: 100%;
    display: block;
}

.gallery-page .gallery-hero-line svg path {
    stroke-width: 1.5;
}

/* Fade in animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Floating Toggle Pill */
.gallery-floating-toggle {
    position: fixed;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    pointer-events: none;
}

.gallery-toggle-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(229, 231, 235, 0.6);
    border-radius: 50px;
    padding: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.08);
    pointer-events: auto;
    width: clamp(200px, 40vw, 280px);
    min-width: 200px;
}

.gallery-toggle-option {
    position: relative;
    flex: 1;
    padding: clamp(0.625rem, 1.2vw, 0.75rem) clamp(1rem, 2vw, 1.5rem);
    background: transparent;
    border: none;
    color: var(--text-medium, #4a4a4a);
    font-size: clamp(0.875rem, 1.5vw, 0.95rem);
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50px;
    z-index: 2;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
}

.gallery-toggle-option:hover {
    color: var(--secondary-green, #2d7a4f);
}

.gallery-toggle-option:focus-visible {
    outline: 2px solid var(--secondary-green, #2d7a4f);
    outline-offset: 2px;
}

.gallery-toggle-option.active {
    color: white;
}

.gallery-toggle-slider {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
    background: linear-gradient(135deg, var(--secondary-green, #2d7a4f), var(--accent-green, #7fb069));
    border-radius: 50px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
    box-shadow: 0 2px 8px rgba(45, 122, 79, 0.3);
}

.gallery-toggle-pill[data-active="videos"] .gallery-toggle-slider {
    transform: translateX(100%);
}

/* Gallery Content Wrapper */
.gallery-content-wrapper {
    position: relative;
    min-height: 60vh;
    z-index: 1; /* Above background */
    scroll-margin-top: 100px; /* Prevent content from hiding behind sticky bar */
}

.gallery-panel {
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    padding: 3rem 20px;
    background: transparent; /* Allow background to show through */
}

.gallery-panel.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* Mosaic Grid Wrapper */
.gallery-mosaic-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Mosaic Container - Vertical stack of blocks */
.gallery-mosaic {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 24px 0;
}

/* Mosaic Block - Each block contains 6 tiles in a 12-column grid */
.gallery-mosaic-block {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: 60px;
    gap: 24px;
    margin-bottom: 24px;
}

.gallery-mosaic-block:last-child {
    margin-bottom: 0;
}

/* Mosaic Tile Base Styles */
.gallery-mosaic-item {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    background: #ffffff;
    background: var(--bg-white, #ffffff);
}

.gallery-mosaic-item:hover {
    box-shadow: 0 20px 40px -8px rgba(0, 0, 0, 0.2), 0 8px 16px -4px rgba(0, 0, 0, 0.15);
    transform: translateY(-8px);
}

/* Mosaic Tile Pattern - Explicit spans for 12-column grid */
.gallery-mosaic-item.mosaic-tile-1 {
    grid-column: 1 / span 4;
    grid-row: span 5;
}

.gallery-mosaic-item.mosaic-tile-2 {
    grid-column: 5 / span 8;
    grid-row: span 8;
}

.gallery-mosaic-item.mosaic-tile-3 {
    grid-column: 1 / span 4;
    grid-row: span 5;
}

.gallery-mosaic-item.mosaic-tile-4 {
    grid-column: 5 / span 4;
    grid-row: span 4;
}

.gallery-mosaic-item.mosaic-tile-5 {
    grid-column: 9 / span 4;
    grid-row: span 4;
}

.gallery-mosaic-item.mosaic-tile-6 {
    grid-column: 1 / span 12;
    grid-row: span 6;
}

.gallery-mosaic-inner {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 16px;
    overflow: hidden;
    display: block;
}

.gallery-mosaic-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-mosaic-item:hover .gallery-mosaic-image {
    transform: scale(1.08);
}

.gallery-mosaic-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.6) 70%, rgba(0,0,0,0.8) 100%);
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: flex-end;
    padding: 1.5rem;
    pointer-events: none;
    z-index: 1;
}

.gallery-mosaic-item:hover .gallery-mosaic-overlay {
    opacity: 1;
}

.gallery-mosaic-info {
    color: white;
    width: 100%;
}

.gallery-mosaic-info h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: white;
    font-weight: 600;
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.gallery-mosaic-info p {
    font-size: 0.9rem;
    opacity: 0.9;
    line-height: 1.4;
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/* Fallback Grid (< 6 images) */
.gallery-fallback-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
    padding: 28px 0;
}

.gallery-fallback-item {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    box-shadow: var(--shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05));
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transition: var(--transition, all 0.3s cubic-bezier(0.4, 0, 0.2, 1));
    cursor: pointer;
    background: #ffffff;
    background: var(--bg-white, #ffffff);
    aspect-ratio: 4 / 3;
}

.gallery-fallback-item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    box-shadow: var(--shadow-2xl, 0 25px 50px -12px rgba(0, 0, 0, 0.25));
}

.gallery-fallback-inner {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 16px;
    overflow: hidden;
}

.gallery-fallback-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-fallback-item:hover .gallery-fallback-image {
    transform: scale(1.1);
}

.gallery-fallback-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.6) 70%, rgba(0,0,0,0.8) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: flex-end;
    padding: 1.5rem;
    pointer-events: none;
}

.gallery-fallback-item:hover .gallery-fallback-overlay {
    opacity: 1;
}

.gallery-fallback-info {
    color: white;
    width: 100%;
}

.gallery-fallback-info h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: white;
    font-weight: 600;
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.gallery-fallback-info p {
    font-size: 0.9rem;
    opacity: 0.9;
    line-height: 1.4;
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/* Video Grid */
.gallery-video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.gallery-video-item {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    box-shadow: var(--shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05));
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transition: var(--transition, all 0.3s cubic-bezier(0.4, 0, 0.2, 1));
    background: #ffffff;
    background: var(--bg-white, #ffffff);
    cursor: pointer;
}

.gallery-video-item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    box-shadow: var(--shadow-2xl, 0 25px 50px -12px rgba(0, 0, 0, 0.25));
}

.gallery-video-thumbnail {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
    background: #fafafa;
    background: var(--bg-light, #fafafa);
}

.gallery-video-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-video-item:hover .gallery-video-thumbnail img {
    transform: scale(1.1);
}

.gallery-video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.gallery-video-item:hover .gallery-video-overlay {
    background: rgba(0, 0, 0, 0.5);
}

.gallery-video-play {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: transform 0.3s ease;
    z-index: 1;
}

.gallery-video-play:hover {
    transform: scale(1.1);
}

.gallery-video-play:active {
    transform: scale(0.95);
}

.gallery-video-info {
    padding: 1.5rem;
}

.gallery-video-info h3 {
    font-size: 1.2rem;
    color: #1a4d2e;
    color: var(--primary-green, #1a4d2e);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.gallery-video-info p {
    font-size: 0.95rem;
    color: #4a4a4a;
    color: var(--text-medium, #4a4a4a);
    line-height: 1.6;
}

/* Video Modal */
.video-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-modal-overlay.active {
    display: flex;
    opacity: 1;
}

.video-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
}

.video-modal-container {
    position: relative;
    z-index: 10001;
    max-width: 90%;
    max-height: 90vh;
    width: 100%;
    max-width: 1200px;
    animation: modalSlideUp 0.4s ease-out;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.video-modal-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 2.5rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
    z-index: 10002;
    line-height: 1;
}

.video-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.video-modal-content {
    background: #ffffff;
    background: var(--bg-white, #ffffff);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    box-shadow: var(--shadow-2xl, 0 25px 50px -12px rgba(0, 0, 0, 0.5));
}

.video-modal-title {
    padding: 2rem 2rem 1rem;
    font-family: 'Playfair Display', serif;
    font-size: 1.75rem;
    color: #1a4d2e;
    color: var(--primary-green, #1a4d2e);
    font-weight: 600;
    margin: 0;
}

.video-modal-player {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background: #000;
}

.video-modal-player iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.video-modal-description {
    padding: 1rem 2rem 2rem;
    color: #4a4a4a;
    color: var(--text-medium, #4a4a4a);
    line-height: 1.6;
    margin: 0;
}

/* Empty State */
.gallery-empty-state {
    text-align: center;
    padding: 6rem 2rem;
    background: #ffffff;
    background: var(--bg-white, #ffffff);
    border-radius: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    box-shadow: var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06));
    max-width: 600px;
    margin: 0 auto;
}

.gallery-empty-state h3 {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    color: #1a4d2e;
    color: var(--primary-green, #1a4d2e);
    margin-bottom: 1rem;
    font-weight: 600;
}

.gallery-empty-state p {
    color: #6b7280;
    color: var(--text-light, #6b7280);
    font-size: 1.1rem;
}

/* Responsive Design */
@media (max-width: 900px) {
    /* Tablet: Switch to 6-column grid */
    .gallery-mosaic-block {
        grid-template-columns: repeat(6, 1fr);
        grid-auto-rows: 50px;
        gap: 18px;
    }
    
    /* Adjust tile spans for 6-column grid */
    .gallery-mosaic-item.mosaic-tile-1 {
        grid-column: 1 / span 3;
        grid-row: span 4;
    }
    
    .gallery-mosaic-item.mosaic-tile-2 {
        grid-column: 4 / span 3;
        grid-row: span 6;
    }
    
    .gallery-mosaic-item.mosaic-tile-3 {
        grid-column: 1 / span 3;
        grid-row: span 4;
    }
    
    .gallery-mosaic-item.mosaic-tile-4 {
        grid-column: 4 / span 2;
        grid-row: span 3;
    }
    
    .gallery-mosaic-item.mosaic-tile-5 {
        grid-column: 6 / span 1;
        grid-row: span 3;
    }
    
    .gallery-mosaic-item.mosaic-tile-6 {
        grid-column: 1 / span 6;
        grid-row: span 5;
    }
    
    .gallery-fallback-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
        padding: 18px 0;
    }
    
    .gallery-video-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .gallery-page .gallery-hero {
        min-height: clamp(260px, 40vh, 360px);
        padding-top: clamp(56px, 7vh, 90px);
    }
    
    .gallery-hero-inner {
        padding: 0 16px;
    }
    
    .gallery-page .gallery-hero::after {
        height: clamp(140px, 20vh, 180px);
    }
    
    .gallery-panel {
        padding: 2rem 20px;
    }
    
    /* Floating toggle adjustments for mobile */
    .gallery-floating-toggle {
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }
    
    .gallery-toggle-pill {
        width: clamp(180px, 50vw, 240px);
        min-width: 180px;
    }
    
    /* Mobile: Single column with consistent aspect ratio */
    .gallery-mosaic-block {
        grid-template-columns: 1fr;
        grid-auto-rows: auto;
        gap: 14px;
        justify-items: center;
    }
    
    .gallery-mosaic-item {
        grid-column: 1 !important;
        grid-row: span 1 !important;
        aspect-ratio: 4 / 3;
        max-width: 100%;
        width: 100%;
    }
    
    .gallery-mosaic-item.mosaic-tile-1,
    .gallery-mosaic-item.mosaic-tile-2,
    .gallery-mosaic-item.mosaic-tile-3,
    .gallery-mosaic-item.mosaic-tile-4,
    .gallery-mosaic-item.mosaic-tile-5,
    .gallery-mosaic-item.mosaic-tile-6 {
        grid-column: 1 !important;
        grid-row: span 1 !important;
        aspect-ratio: 4 / 3;
        max-width: 100%;
        width: 100%;
    }
    
    /* Disable hover effects on mobile */
    .gallery-mosaic-item:hover {
        transform: none;
    }
    
    .gallery-mosaic-item:hover .gallery-mosaic-image {
        transform: none;
    }
    
    /* Ensure mosaic wrapper centers content on mobile */
    .gallery-mosaic-wrapper {
        padding: 0 14px;
    }
    
    .gallery-mosaic {
        padding: 14px 0;
    }
    
    .gallery-fallback-grid {
        grid-template-columns: 1fr;
        gap: 14px;
        padding: 14px 0;
    }
    
    .gallery-fallback-item {
        aspect-ratio: 4 / 3;
        min-height: 250px;
    }
    
    .gallery-video-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .video-modal-container {
        max-width: 95%;
    }
    
    .video-modal-close {
        top: -40px;
        width: 40px;
        height: 40px;
        font-size: 2rem;
    }
    
    .video-modal-title {
        padding: 1.5rem 1.5rem 1rem;
        font-size: 1.5rem;
    }
    
    .video-modal-description {
        padding: 1rem 1.5rem 1.5rem;
    }
}

@media (max-width: 480px) {
    .gallery-page .gallery-hero {
        min-height: clamp(240px, 35vh, 320px);
        padding-top: clamp(52px, 6vh, 80px);
    }
    
    .gallery-page .gallery-hero::after {
        height: clamp(120px, 18vh, 160px);
    }
    
    .gallery-page .gallery-hero-line {
        bottom: 36px;
        height: 20px;
    }
    
    .gallery-page .gallery-hero-line svg path {
        stroke-width: 1;
    }
    
    .gallery-mosaic-item {
        min-height: 250px !important;
    }
    
    /* Floating toggle adjustments for small phones */
    .gallery-floating-toggle {
        bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    }
    
    .gallery-toggle-pill {
        width: clamp(160px, 60vw, 220px);
        min-width: 160px;
    }
    
    .gallery-fallback-item {
        min-height: 220px;
    }
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .gallery-hero {
        min-height: clamp(280px, 45vh, 400px);
        padding-top: clamp(60px, 8vh, 100px);
    }
    
    .gallery-hero-bg {
        transform: none;
    }
    
    .gallery-page .gallery-hero::after {
        height: clamp(150px, 20vh, 200px);
    }
    
    .gallery-page .gallery-hero-line {
        bottom: 44px;
    }
    
    .gallery-page .gallery-hero-line svg path {
        stroke-width: 1.25;
    }
    
    /* Disable fixed background attachment on mobile for iOS compatibility */
    .gallery-bg {
        background-attachment: scroll;
        position: absolute;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gallery-hero-bg {
        transform: none !important;
    }
    
    .gallery-hero-inner {
        animation: none;
    }
    
    .gallery-panel {
        transition: none;
    }
    
    .gallery-masonry-inner,
    .gallery-video-item {
        transition: none;
    }
    
    .gallery-masonry-image,
    .gallery-video-thumbnail img {
        transition: none;
    }
    
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
