/* ==========================================================================
   Gallery Component
   ========================================================================== */

/* Gallery Section - Horizontal Scroll */
.gallery-section {
    padding: 3rem 0;
    overflow: hidden;
}

.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
}

.gallery-section h2 {
    text-align: left;
    font-family: var(--font-heading);
    font-size: clamp(2.5rem, 5vw, 4rem);
    color: var(--primary-009);
    margin-bottom: 0;
}

.gallery-controls {
    display: flex;
    gap: 1rem;
}

.gallery-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gallery-section>.container:last-child {
    padding-top: 0;
    padding-bottom: 0;
}



.gallery-scroll {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding: 1.5rem 0 1rem;
    padding-left: max(2rem, calc((100vw - var(--container-max-width, 1440px)) / 2 + 2rem));
    scroll-padding-left: max(2rem, calc((100vw - var(--container-max-width, 1440px)) / 2 + 2rem));
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scrollbar-color: var(--primary-009) transparent;
    width: 100%;
}

/* Spacer pseudo-element to ensure last item has right margin visible */
.gallery-scroll::after {
    content: '';
    flex: 0 0 max(1rem, calc((100vw - var(--container-max-width, 1440px)) / 2 + 1rem));
}

.gallery-item {
    flex: 0 0 420px;
    height: 600px;
    scroll-snap-align: start;
    border-radius: 4rem;
    overflow: hidden;
    position: relative;
    transition: transform 0.3s ease;
}

.gallery-item:hover {
    transform: scale(1.02);
}

/* Specific heights for images */
.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Linear gradient overlay for text readability */
.gallery-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 60%, rgba(0, 0, 0, 0.9) 100%);
    pointer-events: none;
}


/* --- Content Visibility & Overlay Adjustments --- */

/* Default dish name label - visible without hover */
.gallery-dish-name {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    position: absolute;
    bottom: 2rem;
    left: 2rem;
    right: 2rem;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 500;
    color: var(--primary-colour-001);
    z-index: 2;
    text-align: left;
    margin: 0;
    /* Align with figcaption reset */
}

.gallery-dish-name .name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--primary-colour-001) !important;
}

.gallery-dish-name .ingredients {
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--primary-colour-001) !important;
    line-height: 1.4;
    display: block;
    max-width: 40ch;
}

/* ==========================================================================
   Responsive Styles
   ========================================================================== */

/* Custom Scrollbar for Gallery on Mobile/Tablet */
@media screen and (max-width: 1100px) {

    .gallery-scroll {
        scrollbar-width: thin;
        scrollbar-color: var(--primary-009) transparent;
    }

    .gallery-scroll::-webkit-scrollbar {
        display: block;
        height: 6px;
    }

    .gallery-scroll::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.05);
        /* Very subtle track */
        border-radius: 10px;
        /* Dynamic margin to align with Title/Container */
        margin-inline: max(2rem, calc((100vw - var(--container-max-width, 1440px)) / 2 + 2rem));
    }

    .gallery-scroll::-webkit-scrollbar-thumb {
        background-color: var(--primary-009);
        /* Orange Thumb */
        border-radius: 10px;
    }

    /* Disable hover effects on mobile/tablet */
    .gallery-item:hover {
        transform: none !important;
    }

    /* Hide Footer Controls (Buttons & Back to Start) - Use Scrollbar */
    .gallery-footer {
        display: none;
    }
}

@media screen and (max-width: 1024px) {
    .gallery-section {
        padding-top: 0 !important;
    }

    .gallery-section .container {
        padding: 2rem;
    }

    .gallery-section .container h2 {
        text-align: center;
    }

    /* Responsive gallery item sizing */
    .gallery-item {
        flex: 0 0 360px;
        height: 600px;
    }
}

/* Small tablet breakpoint */
@media screen and (max-width: 768px) {
    .gallery-item {
        flex: 0 0 max(340px, 48vw);
        height: 600px;
    }

    .gallery-dish-name {
        bottom: 1.5rem;
        left: 1.5rem;
        right: 1.5rem;
    }
}

/* Mobile breakpoint */
@media screen and (max-width: 480px) {
    .gallery-item {
        flex: 0 0 max(320px, 80vw);
        height: 600px;
    }

    .gallery-dish-name {
        bottom: 1.25rem;
        left: 1.25rem;
        right: 1.25rem;
    }

    .gallery-dish-name .name {
        font-size: 1rem;
    }

    .gallery-dish-name .ingredients {
        font-size: 0.8125rem;
    }
}