/* =========================
   GALLERY PAGE — isolated + premium
   Requires: <main class="page page--gallery">
   NOTE: lightbox styles assume the lightbox is appended inside root (.page--gallery)
   ========================= */

.page--gallery{
    --bg: #0b1010;
    --glass: rgba(255,255,255,.08);
    --stroke: rgba(255,255,255,.14);
    --shadow: 0 18px 55px rgba(0,0,0,.35);
    --shadow2: 0 10px 26px rgba(0,0,0,.24);
    --r-lg: 28px;
    --r-md: 18px;

    --text: rgba(255,255,255,.92);
    --muted: rgba(255,255,255,.78);
    --brand: #8fb3a5;
}

/* make sure we override global main background */
main.page--gallery{
    background: var(--bg) !important;
    position: relative;
    overflow: hidden;
}

/* optional background texture */
main.page--gallery::before{
    content:"";
    position:absolute;
    inset:0;
    background-image: url("/images/bg_2.png");
    background-position:center;
    background-size:cover;
    background-repeat:no-repeat;
    opacity:.22;
    filter:saturate(.9) contrast(1.05);
    pointer-events:none;
    z-index:0;
}

main.page--gallery > *{
    position: relative;
    z-index: 1;
}

/* Title polish */
main.page--gallery .solution_title h1{
    margin: auto;
    padding: 10px 18px;
    width: min(920px, calc(100% - 40px));
    border-radius: 999px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text);
    font-weight: 1000;
    font-size: clamp(28px, 4vw, 54px);
    text-align: center;
}

main.page--gallery .page_subtitle{
    margin: 12px auto 0;
    color: var(--muted);
    text-align: center;
    width: min(900px, calc(100% - 40px));
    line-height: 1.7;
    font-size: 1.05em;
}

/* Stack */
main.page--gallery .solution_strip{
    padding: 34px 0 70px;
}

main.page--gallery .gallery_stack{
    width: min(1200px, calc(100% - 40px));
    margin: 0 auto;
    display: grid;
    gap: 22px;
}

/* Each gallery block as premium “card”
   IMPORTANT: override global .gallery { display:grid; ... } */
main.page--gallery .gallery{
    margin: 20px auto;
    padding: 14px;
    border-radius: var(--r-lg);
    background: var(--glass);
    border: 1px solid var(--stroke);
    box-shadow: var(--shadow2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    overflow: hidden;

    display: block; /* <-- overrides the global .gallery grid */
    max-width: none; /* <-- overrides global max-width if exists */
}

/* Layout (scoped, so global .top/.bottom won't mess other pages) */
main.page--gallery .top{
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 14px;
    align-items: stretch;
}

main.page--gallery .top .big{
    grid-row: 1 / span 2;
    aspect-ratio: 16 / 9;
}

main.page--gallery .top .big.for{
    grid-row: 1 / span 1;
}

main.page--gallery .top .small,
main.page--gallery .top .small-big{
    aspect-ratio: 16 / 9;
}

main.page--gallery .bottom{
    margin-top: 14px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

main.page--gallery .bottom figure{
    aspect-ratio: 21 / 9;
}

/* Tiles */
main.page--gallery .gallery figure{
    margin: 0;
    border-radius: var(--r-md);
    overflow: hidden;
    background: rgba(0,0,0,.18);
    border: 1px solid rgba(255,255,255,.12);
    box-shadow: 0 10px 20px rgba(0,0,0,.20);
    position: relative;
    cursor: zoom-in;
    outline: none;
}

main.page--gallery .gallery figure:focus-visible{
    outline: 3px solid rgba(143,179,165,.75);
    outline-offset: 3px;
}

/* images */
main.page--gallery .gallery img{
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transform: scale(1);
    transition: transform .35s ease, filter .35s ease;
    will-change: transform;
}

/* hover depth */
main.page--gallery .gallery figure:hover img{
    transform: scale(1.03);
    filter: saturate(1.05) contrast(1.03);
}

main.page--gallery .gallery figure::after{
    content:"";
    position:absolute;
    inset:0;
    background: linear-gradient(to top, rgba(0,0,0,.35), rgba(0,0,0,0));
    opacity: 0;
    transition: opacity .35s ease;
    pointer-events:none;
}

main.page--gallery .gallery figure:hover::after{
    opacity: 1;
}

/* Mobile */
@media (max-width: 900px){
    main.page--gallery .gallery{ padding: 12px; }
    main.page--gallery .top{ grid-template-columns: 1fr; gap: 12px; }
    main.page--gallery .top .big{ grid-row: auto; aspect-ratio: 16 / 10; }
    main.page--gallery .bottom{ grid-template-columns: 1fr; gap: 12px; }
    main.page--gallery .bottom figure{ aspect-ratio: 16 / 10; }
}

/* ===== Lightbox (isolated to gallery page) =====
   Works only if lightbox is appended inside root (.page--gallery) */
main.page--gallery .gallery-lightbox{
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0);
    opacity: 0;
    z-index: 9999;
    padding: 24px;
    transition: opacity 240ms ease, background 240ms ease;
}

main.page--gallery .gallery-lightbox.is-open{
    display: flex;
    opacity: 1;
    background: rgba(0,0,0,.86);
}

main.page--gallery .gallery-lightbox__panel{
    position: relative;
    max-width: 92vw;
    max-height: 90vh;
    transform: translateY(10px) scale(.98);
    opacity: 0;
    transition: transform 260ms ease, opacity 260ms ease;
    will-change: transform, opacity;
}

main.page--gallery .gallery-lightbox.is-open .gallery-lightbox__panel{
    transform: translateY(0) scale(1);
    opacity: 1;
}

main.page--gallery .gallery-lightbox__img{
    display: block;
    max-width: min(1100px, 92vw);
    max-height: 86vh;
    border-radius: 14px;
    box-shadow: 0 18px 60px rgba(0,0,0,.45);
    transition: opacity 220ms ease;
    opacity: 1;
}

main.page--gallery .gallery-lightbox__img.is-fading{ opacity: 0; }

main.page--gallery .gallery-lightbox__btn,
main.page--gallery .gallery-lightbox__close{
    position: absolute;
    z-index: 3;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.16);
    background: rgba(255,255,255,.12);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: .95;
    transition: transform 160ms ease, background 160ms ease, opacity 160ms ease;
}

main.page--gallery .gallery-lightbox__btn:hover,
main.page--gallery .gallery-lightbox__close:hover{
    background: rgba(255,255,255,.22);
    opacity: 1;
}

main.page--gallery .gallery-lightbox__btn:active,
main.page--gallery .gallery-lightbox__close:active{
    transform: scale(.98);
}

main.page--gallery .gallery-lightbox__btn{
    top: 50%;
    transform: translateY(-50%);
    font-size: 36px;
    line-height: 1;
}

/* default (LTR) */
main.page--gallery .gallery-lightbox__btn--prev{ left: -64px; }
main.page--gallery .gallery-lightbox__btn--next{ right: -64px; }
main.page--gallery .gallery-lightbox__close{ top: -56px; right: 0; font-size: 22px; }

/* RTL */
html[dir="rtl"] main.page--gallery .gallery-lightbox__btn--next{ left: -64px; right: auto; }
html[dir="rtl"] main.page--gallery .gallery-lightbox__btn--prev{ right: -64px; left: auto; }

@media (max-width: 700px){
    html[dir="rtl"] main.page--gallery .gallery-lightbox__btn--next{ left: 12px; }
    html[dir="rtl"] main.page--gallery .gallery-lightbox__btn--prev{ right: 12px; }

    main.page--gallery .gallery-lightbox__btn--prev{ left: 12px; right: auto; }
    main.page--gallery .gallery-lightbox__btn--next{ right: 12px; left: auto; }
    main.page--gallery .gallery-lightbox__close{ top: 12px; right: 12px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce){
    main.page--gallery .gallery img,
    main.page--gallery .gallery figure::after,
    main.page--gallery .gallery-lightbox,
    main.page--gallery .gallery-lightbox__panel,
    main.page--gallery .gallery-lightbox__img{
        transition: none !important;
    }
}
.reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 700ms ease, transform 700ms ease;
    will-change: opacity, transform;
}
.reveal.is-in { opacity: 1; transform: translateY(0); }

.reveal--scale { transform: translateY(18px) scale(0.98); }
.reveal--scale.is-in { transform: translateY(0) scale(1); }

/* Stagger */
.reveal-stagger > * {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 550ms ease, transform 550ms ease;
}
.reveal-stagger.is-in > * { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
    .reveal, .reveal-stagger > * { transition: none !important; transform: none !important; opacity: 1 !important; }
}
.lighting_gallery__preview img.is-swap {
    opacity: 0.2;
    transition: opacity 180ms ease;
}