/* ==========================================================================
   Sector Gallery Showcase – Front-end styles
   PrestaShop 1.6 | PHP 7.2
   ========================================================================== */

/* Google Fonts – Poppins */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap');

/* ============================================================
   GALLERY GRID PAGE
   ============================================================ */

.sgs-gallery-page {
    max-width: 1187px;
    width: calc(100% - 20px);
    overflow: hidden;
    padding: 0;
    margin: 0 auto;
    margin-bottom: 100px;
}

.sgs-grid {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    gap: 10px;
}

/* Fallback gap for older browsers */
@supports not (gap: 4px) {
    .sgs-card {
        margin: 2px;
    }
}

/* ---- Cards ---- */
.sgs-card {
    position: relative;
    overflow: hidden;
    display: block;
    text-decoration: none;
    background: #333;
    cursor: pointer;
}

/* First two cards: 50% width */
.sgs-card--large {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 calc(50% - 5px);
    flex: 0 0 calc(50% - 8px);
    height: 377px;
}

/* Remaining cards: 33.33% width */
.sgs-card:not(.sgs-card--large) {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 calc(33.333% - 7px);
    flex: 0 0 calc(33.333% - 7px);
    height: 377px;
}

/* ---- Background image layer ---- */
.sgs-card__bg {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    -webkit-transition: -webkit-transform 0.4s ease;
    transition: -webkit-transform 0.4s ease;
    transition: transform 0.4s ease;
    transition: transform 0.4s ease, -webkit-transform 0.4s ease;
}

.sgs-card:hover .sgs-card__bg {
    -webkit-transform: scale(1.05);
    transform: scale(1.05);
}

/* ---- Dark overlay ---- */
.sgs-card__overlay {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.3);
    -webkit-transition: background 0.3s ease;
    transition: background 0.3s ease;
}

.sgs-card:hover .sgs-card__overlay {
    background: rgba(0, 0, 0, 0.45);
}

/* ---- Card body (centered title) ---- */
.sgs-card__body {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    padding: 20px;
}

.sgs-card__label {
    border: 1px solid #fff;
    padding: 15px 24px;
    text-align: center;
}

.sgs-card__label span {
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 28px;
    color: #fff;
    display: block;
    line-height: 1.2;
}

/* ---- Arrow icon ---- */
.sgs-card__arrow {
    position: absolute;
    bottom: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    -webkit-transition: -webkit-transform 0.3s ease;
    transition: -webkit-transform 0.3s ease;
    transition: transform 0.3s ease;
    transition: transform 0.3s ease, -webkit-transform 0.3s ease;
}

.sgs-card:hover .sgs-card__arrow {
    -webkit-transform: translateX(4px);
    transform: translateX(4px);
}

/* ---- Empty state ---- */
.sgs-no-sectors {
    padding: 40px 20px;
    text-align: center;
    color: #666;
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
}


/* ============================================================
   DETAIL PAGE
   ============================================================ */

.sgs-detail-page {
    max-width: 1200px;
    width: calc(100% - 20px);
    margin: 0 auto;
    padding: 0px 0px 50px;
}

/* ---- Back link ---- */
.sgs-back-link {
    display: -webkit-inline-box;
    display: -ms-inline-flexbox;
    display: inline-flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 8px;
    color: #315133;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 16px;
    text-decoration: none;
    margin-bottom: 20px;
    -webkit-transition: color 0.2s ease;
    transition: color 0.2s ease;
}

.sgs-back-link:hover,
.sgs-back-link:focus {
    text-decoration: underline;
    color: #315133;
}

.sgs-back-link svg {
    -ms-flex-negative: 0;
    flex-shrink: 0;
}

/* ---- Main image viewer ---- */
.sgs-main-viewer {
    position: relative;
    background: #000;
    overflow: hidden;
    line-height: 0;
}

.sgs-main-viewer img#sgs-main-image {
    width: 100%;
    height: auto;
    max-height: 818px;
    min-height: 818px;
    -o-object-fit: cover;
    object-fit: cover;
    display: block;
    -webkit-transition: opacity 0.3s ease;
    transition: opacity 0.3s ease;
    line-height: 0;
}

.sgs-main-viewer img#sgs-main-image.sgs-fading {
    opacity: 0;
}

/* FancyBox trigger wraps the main image – behave like the image itself */
.sgs-fancybox-trigger {
    display: block;
    line-height: 0;
    cursor: zoom-in;
}

/* Prevent PrestaShop/Bootstrap theme styles from breaking FancyBox image display */
.fancybox-container img,
.fancybox-image {
    min-height: 0 !important;
    max-height: none !important;
    width: auto !important;
    height: auto !important;
    -o-object-fit: contain !important;
    object-fit: contain !important;
}

/* ---- Main image overlay ---- */
.sgs-main-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 130px;
    background: rgba(0, 0, 0, 0.5);
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    padding: 0 30px;
}

.sgs-main-overlay .sgs-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 24px;
    color: #fff;
    margin: 0 0 6px;
    line-height: 1.3;
}

.sgs-main-overlay .sgs-subtitle {
    font-family: 'Poppins', sans-serif;
    font-weight: 400;
    font-size: 14px;
    color: #fff;
    margin: 0;
    line-height: 1.4;
}

/* ---- Thumbnail carousel wrapper ---- */
.sgs-carousel-wrap {
    position: relative;
    margin-top: 20px;
    padding: 0 28px;
    overflow: hidden;
}

/* ---- Individual thumbnail ---- */
.sgs-thumb {
    margin: 0 5px;
    cursor: pointer;
    overflow: hidden;
    height: 175px;
    outline: none;
}

.sgs-thumb img {
    width: 100%;
    height: 175px;
    -o-object-fit: cover;
    object-fit: cover;
    display: block;
    -webkit-transition: opacity 0.2s ease;
    transition: opacity 0.2s ease;
}

.sgs-thumb.is-active img,
.sgs-thumb:hover img {
    opacity: 0.75;
}

/* ---- Prev / Next buttons ---- */
.sgs-prev,
.sgs-next {
    position: absolute;
    top: 50%;
    -webkit-transform: translateY(-50%);
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: #333;
    z-index: 10;
    -webkit-transition: opacity 0.2s ease;
    transition: opacity 0.2s ease;
    line-height: 1;
}

.sgs-prev:hover,
.sgs-next:hover {
    opacity: 0.6;
}

.sgs-prev {
    left: 0;
}

.sgs-next {
    right: 0;
}

/* ---- Counter ---- */
.sgs-counter {
    text-align: center;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 20px;
    color: #000;
    margin-top: 15px;
    line-height: 1;
}


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

@media (max-width: 991px) {
    .sgs-card--large,
    .sgs-card:not(.sgs-card--large) {
        -webkit-box-flex: 0;
        -ms-flex: 0 0 calc(50% - 8px);
        flex: 0 0 calc(50% - 8px);
        height: 280px;
    }

    .sgs-card__label span {
        font-size: 28px;
    }

    .sgs-main-overlay {
        height: 100px;
    }

    .sgs-main-overlay .sgs-title {
        font-size: 20px;
    }
}

@media (max-width: 767px) {
    .sgs-card--large,
    .sgs-card:not(.sgs-card--large) {
        -webkit-box-flex: 0;
        -ms-flex: 0 0 100%;
        flex: 0 0 100%;
        height: 260px;
    }

    .sgs-card__label span {
        font-size: 28px;
        white-space: normal;
    }

    .sgs-card__label {
        padding: 10px 18px;
    }

    .sgs-detail-page {
        padding: 20px 10px 30px;
    }

    .sgs-main-overlay {
        height: 90px;
        padding: 0 15px;
    }

    .sgs-main-overlay .sgs-title {
        font-size: 18px;
    }

    .sgs-main-overlay .sgs-subtitle {
        font-size: 13px;
    }

    .sgs-carousel-wrap {
        padding: 0 40px;
    }

    .sgs-counter {
        font-size: 16px;
    }
}

@media (max-width: 479px) {
    .sgs-card__label span {
        font-size: 28px;
    }
}

/* ---- Detail page – mobile (≤ 480 px) matches Figma node 1557:35 ---- */
@media (max-width: 480px) {
    .sgs-detail-page {
        width: calc(100% - 24px);
        padding: 15px 0 30px;
    }

    /* Square-ish main image matching Figma proportions (409 × 399) */
    .sgs-main-viewer img#sgs-main-image {
        min-height: 0;
        max-height: none;
        height: calc(100vw - 24px);
    }

    /* Overlay: Figma shows 82 px tall, left-padded text */
    .sgs-main-overlay {
        height: 82px;
        padding: 0 15px;
    }

    /* Restore full font sizes – Figma shows 24 px / 14 px on mobile */
    .sgs-main-overlay .sgs-title {
        font-size: 24px;
        margin: 0 0 4px;
    }

    .sgs-main-overlay .sgs-subtitle {
        font-size: 14px;
    }

    /* Thumbnail strip: no side padding since arrows are hidden */
    .sgs-carousel-wrap {
        padding: 0;
        margin-top: 10px;
    }

    /* 2-column flex grid – Slick is not initialised on mobile */
    #sgs-thumbs {
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
        -ms-flex-wrap: wrap;
            flex-wrap: wrap;
        gap: 10px;
    }

    /* Each thumbnail: half width minus half the gap, 130 px tall */
    #sgs-thumbs .sgs-thumb {
        -webkit-box-flex: 0;
            -ms-flex: 0 0 calc(50% - 5px);
                flex: 0 0 calc(50% - 5px);
        margin: 0;
        height: 130px;
    }

    #sgs-thumbs .sgs-thumb img {
        width: 100%;
        height: 130px;
    }

    /* Hide prev / next arrows – not needed with flex grid */
    .sgs-prev,
    .sgs-next {
        display: none;
    }

    /* Counter: keep 20 px per Figma */
    .sgs-counter {
        font-size: 20px;
        margin-top: 12px;
    }
}
