/* =========================================================
   RGNH gallery — bosh sahifa bloki, /gallery sahifasi, lightbox
   rgnh-luxury.css tokenlaridan foydalanadi (--purple, --pink, --ink)
   ========================================================= */

.rg-gal{
    --gal-gap:14px;
    --gal-row:190px;
    --gal-radius:22px;
    position:relative;
}

/* ---------- Kategoriya filtri ---------- */

.rg-gal-filters{
    display:flex;
    gap:8px;
    justify-content:center;
    flex-wrap:wrap;
    margin:0 auto 28px;
}

.rg-gal-chip{
    display:inline-flex;
    align-items:center;
    gap:8px;
    padding:9px 16px;
    border-radius:999px;
    border:1px solid rgba(124,58,237,.16);
    background:rgba(255,255,255,.82);
    color:#3b2a63;
    font-weight:800;
    font-size:14px;
    line-height:1.2;
    white-space:nowrap;
    transition:background .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.rg-gal-chip span{
    min-width:22px;
    padding:2px 7px;
    border-radius:999px;
    background:rgba(124,58,237,.10);
    color:#6d28d9;
    font-size:12px;
    font-weight:900;
    text-align:center;
}

.rg-gal-chip:hover{
    color:#3b2a63;
    border-color:rgba(124,58,237,.38);
    transform:translateY(-1px);
}

.rg-gal-chip.is-active{
    color:#fff;
    border-color:transparent;
    background:linear-gradient(135deg,var(--purple,#7c3aed),var(--pink,#ec4899));
    box-shadow:0 12px 30px rgba(124,58,237,.26);
}

.rg-gal-chip.is-active span{
    background:rgba(255,255,255,.22);
    color:#fff;
}

.rg-gal-chip:focus-visible,
.rg-gal-btn:focus-visible,
.rg-gal-card:focus-visible{
    outline:3px solid rgba(124,58,237,.55);
    outline-offset:3px;
}

/* ---------- Grid ---------- */

.rg-gal-grid{
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr));
    grid-auto-rows:var(--gal-row);
    grid-auto-flow:dense;
    gap:var(--gal-gap);
    transition:opacity .2s ease;
}

.rg-gal-grid[aria-busy="true"]{
    opacity:.55;
    pointer-events:none;
}

.rg-gal-card{
    position:relative;
    display:block;
    overflow:hidden;
    border-radius:var(--gal-radius);
    background:linear-gradient(135deg,#ede9fe,#fce7f3);
    color:#fff;
    isolation:isolate;
    box-shadow:0 14px 40px rgba(15,23,42,.10);
    cursor:zoom-in;
    animation:rgGalIn .5s cubic-bezier(.2,.7,.2,1) both;
}

.rg-gal-card.is-tall{ grid-row:span 2; }
.rg-gal-card.is-wide{ grid-column:span 2; }
.rg-gal-card.is-featured{ grid-column:span 2; grid-row:span 2; }
.rg-gal-card.is-video{ cursor:pointer; }

.rg-gal-media,
.rg-gal-media img,
.rg-gal-placeholder{
    position:absolute;
    inset:0;
    width:100%;
    height:100%;
}

.rg-gal-media img{
    object-fit:cover;
    opacity:0;
    transform:scale(1.04);
    transition:opacity .45s ease, transform .7s cubic-bezier(.2,.7,.2,1);
}

.rg-gal-media img.is-loaded{
    opacity:1;
    transform:scale(1);
}

.rg-gal-card:hover .rg-gal-media img.is-loaded{
    transform:scale(1.05);
}

.rg-gal-placeholder{
    display:grid;
    place-items:center;
    font-size:2.4rem;
    color:rgba(109,40,217,.45);
}

/* Pastki qoraytirish — sarlavha o'qilishi uchun */
.rg-gal-card::after{
    content:"";
    position:absolute;
    inset:auto 0 0 0;
    height:62%;
    background:linear-gradient(180deg,transparent,rgba(8,8,22,.72));
    opacity:.85;
    z-index:1;
    pointer-events:none;
    transition:opacity .25s ease;
}

.rg-gal-caption{
    position:absolute;
    left:16px;
    right:16px;
    bottom:14px;
    z-index:2;
    display:flex;
    flex-direction:column;
    gap:3px;
    transform:translateY(4px);
    transition:transform .25s ease;
}

.rg-gal-caption small{
    font-size:12px;
    font-weight:700;
    color:rgba(255,255,255,.78);
    letter-spacing:.01em;
}

.rg-gal-caption strong{
    font-size:15px;
    font-weight:850;
    line-height:1.25;
    display:-webkit-box;
    -webkit-line-clamp:2;
    -webkit-box-orient:vertical;
    overflow:hidden;
}

.rg-gal-card.is-featured .rg-gal-caption strong{ font-size:19px; }

.rg-gal-card:hover .rg-gal-caption{ transform:translateY(0); }

/* Captionsiz kartada qoraytirish kerak emas */
.rg-gal-card:not(:has(.rg-gal-caption)):not(.is-video)::after{ opacity:0; }

/* ---------- Video belgilari ---------- */

.rg-gal-play{
    position:absolute;
    top:50%;
    left:50%;
    z-index:2;
    width:62px;
    height:62px;
    margin:-31px 0 0 -31px;
    display:grid;
    place-items:center;
    border-radius:50%;
    font-size:30px;
    color:#fff;
    background:rgba(255,255,255,.20);
    border:1px solid rgba(255,255,255,.45);
    backdrop-filter:blur(8px);
    -webkit-backdrop-filter:blur(8px);
    box-shadow:0 14px 40px rgba(0,0,0,.28);
    transition:transform .25s ease, background .25s ease;
}

.rg-gal-play i{ margin-left:3px; }

.rg-gal-card:hover .rg-gal-play{
    transform:scale(1.08);
    background:linear-gradient(135deg,var(--purple,#7c3aed),var(--pink,#ec4899));
}

.rg-gal-badge{
    position:absolute;
    top:12px;
    left:12px;
    z-index:2;
    display:inline-flex;
    align-items:center;
    gap:6px;
    padding:5px 10px;
    border-radius:999px;
    font-size:12px;
    font-weight:850;
    color:#fff;
    background:rgba(8,8,22,.58);
    backdrop-filter:blur(6px);
    -webkit-backdrop-filter:blur(6px);
}

/* ---------- Skelet (yuklanayotganda) ---------- */

.rg-gal-skeleton{
    border-radius:var(--gal-radius);
    background:linear-gradient(100deg,#f1edff 30%,#faf8ff 50%,#f1edff 70%);
    background-size:300% 100%;
    animation:rgGalShimmer 1.3s linear infinite;
}

/* ---------- Holatlar ---------- */

.rg-gal-state{
    display:flex;
    flex-direction:column;
    align-items:center;
    gap:8px;
    max-width:460px;
    margin:12px auto 0;
    padding:44px 24px;
    text-align:center;
    border-radius:26px;
    border:1px dashed rgba(124,58,237,.24);
    background:rgba(255,255,255,.72);
    color:var(--muted,#64748b);
}

.rg-gal-state[hidden]{ display:none; }

.rg-gal-state i{
    font-size:2rem;
    color:#8b5cf6;
    margin-bottom:4px;
}

.rg-gal-state strong{
    font-size:1.15rem;
    font-weight:900;
    color:var(--ink,#080816);
}

.rg-gal-state .rg-gal-btn{ margin-top:12px; }

.rg-gal-state.is-error i{ color:#e11d48; }

/* ---------- Tugmalar ---------- */

.rg-gal-footer{
    display:flex;
    justify-content:center;
    margin-top:34px;
}

.rg-gal-footer:empty{ display:none; }

.rg-gal-btn{
    display:inline-flex;
    align-items:center;
    gap:10px;
    padding:13px 24px;
    border:0;
    border-radius:999px;
    color:#fff;
    font-weight:900;
    font-size:15px;
    background:linear-gradient(135deg,var(--purple,#7c3aed),var(--pink,#ec4899));
    box-shadow:0 18px 44px rgba(124,58,237,.26);
    transition:transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}

.rg-gal-btn:hover{
    color:#fff;
    transform:translateY(-2px);
    box-shadow:0 22px 52px rgba(124,58,237,.32);
}

.rg-gal-btn[hidden]{ display:none; }

.rg-gal-btn.is-ghost{
    color:#5b21b6;
    background:rgba(124,58,237,.08);
    box-shadow:none;
}

.rg-gal-btn.is-ghost:hover{ color:#5b21b6; background:rgba(124,58,237,.14); }

.rg-gal-btn.is-loading{
    opacity:.75;
    pointer-events:none;
}

.rg-gal-btn.is-loading i{ animation:rgGalSpin .8s linear infinite; }
.rg-gal-btn.is-loading i::before{ content:"\F130"; } /* bi-arrow-repeat */

/* ---------- /gallery sahifasi ---------- */

.rg-gal-page-section{
    min-height:70vh;
    padding-top:150px;
}

.rg-gal-page-title{
    margin:0;
    font-size:clamp(2.3rem,5vw,4.6rem);
    line-height:.95;
    letter-spacing:-.06em;
    font-weight:1000;
}

/* =========================================================
   Lightbox
   ========================================================= */

.rg-lb{
    position:fixed;
    inset:0;
    z-index:2000;
    display:grid;
    grid-template-columns:72px minmax(0,1fr) 72px;
    grid-template-rows:auto minmax(0,1fr) auto;
    background:rgba(6,5,16,.94);
    color:#fff;
    opacity:0;
    transition:opacity .22s ease;
    overscroll-behavior:contain;
}

.rg-lb[hidden]{ display:none; }
.rg-lb.is-open{ opacity:1; }

.rg-lb-top{
    grid-column:1 / -1;
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:14px 16px 6px 22px;
}

.rg-lb-counter{
    font-size:14px;
    font-weight:800;
    color:rgba(255,255,255,.72);
    font-variant-numeric:tabular-nums;
}

.rg-lb-btn{
    width:48px;
    height:48px;
    display:grid;
    place-items:center;
    border:1px solid rgba(255,255,255,.14);
    border-radius:50%;
    background:rgba(255,255,255,.08);
    color:#fff;
    font-size:20px;
    transition:background .18s ease, transform .18s ease, opacity .18s ease;
}

.rg-lb-btn:hover{ background:rgba(255,255,255,.18); }
.rg-lb-btn:focus-visible{ outline:3px solid rgba(236,72,153,.7); outline-offset:2px; }
.rg-lb-btn:disabled{ opacity:.25; pointer-events:none; }

.rg-lb-nav{
    align-self:center;
    justify-self:center;
    grid-row:2;
}

.rg-lb-nav.is-prev{ grid-column:1; }
.rg-lb-nav.is-next{ grid-column:3; }

.rg-lb-stage{
    grid-column:2;
    grid-row:2;
    position:relative;
    margin:0;
    display:grid;
    place-items:center;
    min-height:0;
    overflow:hidden;
    touch-action:pan-y;
}

.rg-lb-media{
    position:absolute;
    inset:0;
    display:flex;
    align-items:center;
    justify-content:center;
    min-height:0;
}

.rg-lb-media img,
.rg-lb-media video{
    max-width:100%;
    max-height:100%;
    border-radius:14px;
    box-shadow:0 30px 90px rgba(0,0,0,.5);
    animation:rgLbIn .3s ease both;
}

.rg-lb-media img{
    object-fit:contain;
    user-select:none;
    -webkit-user-drag:none;
}

.rg-lb-media video{
    width:auto;
    background:#000;
}

.rg-lb-error{
    display:flex;
    flex-direction:column;
    align-items:center;
    gap:10px;
    color:rgba(255,255,255,.75);
    text-align:center;
}

.rg-lb-error i{ font-size:2rem; color:#fb7185; }
.rg-lb-error a{ color:#f9a8d4; font-weight:800; }

.rg-lb-spinner{
    position:absolute;
    top:50%;
    left:50%;
    width:42px;
    height:42px;
    margin:-21px 0 0 -21px;
    border-radius:50%;
    border:3px solid rgba(255,255,255,.18);
    border-top-color:#f472b6;
    animation:rgGalSpin .8s linear infinite;
    opacity:0;
    pointer-events:none;
    transition:opacity .2s ease;
}

.rg-lb.is-loading .rg-lb-spinner{ opacity:1; }

.rg-lb-caption{
    grid-column:1 / -1;
    grid-row:3;
    max-width:760px;
    width:100%;
    margin:0 auto;
    padding:14px 22px 22px;
    text-align:center;
}

.rg-lb-caption:empty,
.rg-lb-caption.is-empty{ padding-bottom:10px; }

.rg-lb-meta{
    font-size:13px;
    font-weight:700;
    color:rgba(255,255,255,.6);
}

.rg-lb-meta:empty{ display:none; }

.rg-lb-caption h3{
    margin:4px 0 0;
    font-size:1.15rem;
    font-weight:850;
    letter-spacing:-.01em;
}

.rg-lb-caption h3:empty{ display:none; }

.rg-lb-caption p{
    margin:6px 0 0;
    max-height:4.8em;
    overflow:auto;
    font-size:.95rem;
    line-height:1.6;
    color:rgba(255,255,255,.74);
}

.rg-lb-caption p:empty{ display:none; }

body.rg-lb-locked{ overflow:hidden; }

/* ---------- Animatsiyalar ---------- */

@keyframes rgGalIn{
    from{ opacity:0; transform:translateY(14px); }
    to{ opacity:1; transform:none; }
}

@keyframes rgLbIn{
    from{ opacity:0; transform:scale(.97); }
    to{ opacity:1; transform:none; }
}

@keyframes rgGalShimmer{
    from{ background-position:100% 0; }
    to{ background-position:-100% 0; }
}

@keyframes rgGalSpin{
    to{ transform:rotate(360deg); }
}

/* ---------- Moslashuvchanlik ---------- */

@media (max-width: 991.98px){
    .rg-gal{ --gal-row:170px; }
    .rg-gal-grid{ grid-template-columns:repeat(3,minmax(0,1fr)); }
}

@media (max-width: 767.98px){
    .rg-gal{ --gal-row:150px; --gal-gap:10px; --gal-radius:18px; }
    .rg-gal-grid{ grid-template-columns:repeat(2,minmax(0,1fr)); }

    /* Telefonda filtr gorizontal aylantiriladi */
    .rg-gal-filters{
        flex-wrap:nowrap;
        justify-content:flex-start;
        overflow-x:auto;
        margin-left:-12px;
        margin-right:-12px;
        padding:2px 12px 6px;
        scrollbar-width:none;
        -webkit-overflow-scrolling:touch;
    }

    .rg-gal-filters::-webkit-scrollbar{ display:none; }

    .rg-gal-caption{ left:12px; right:12px; bottom:10px; }
    .rg-gal-caption strong{ font-size:13.5px; }
    .rg-gal-caption small{ font-size:11px; }
    .rg-gal-card.is-featured .rg-gal-caption strong{ font-size:16px; }
    .rg-gal-play{ width:50px; height:50px; margin:-25px 0 0 -25px; font-size:24px; }

    .rg-gal-page-section{ padding-top:120px; }

    .rg-lb{ grid-template-columns:0 minmax(0,1fr) 0; }

    .rg-lb-nav{
        position:absolute;
        top:50%;
        width:42px;
        height:42px;
        margin-top:-21px;
        z-index:3;
        background:rgba(0,0,0,.35);
    }

    .rg-lb-nav.is-prev{ left:8px; }
    .rg-lb-nav.is-next{ right:8px; }

    .rg-lb-media img,
    .rg-lb-media video{ border-radius:0; }

    .rg-lb-caption{ padding:12px 16px calc(16px + env(safe-area-inset-bottom)); }
}

@media (max-width: 420px){
    .rg-gal{ --gal-row:128px; }
}

@media (hover: none){
    .rg-gal-card:hover .rg-gal-media img.is-loaded{ transform:none; }
}

@media (prefers-reduced-motion: reduce){
    .rg-gal-card,
    .rg-lb-media img,
    .rg-lb-media video{ animation:none; }

    .rg-gal-media img,
    .rg-gal-chip,
    .rg-gal-btn,
    .rg-lb{ transition:none; }

    .rg-gal-media img{ transform:none; }
    .rg-gal-skeleton{ animation:none; }
}

/* =========================================================
   Bosh sahifa: "bento" tartib (1 katta + 4 kichik).
   Kartaning shakli (tall/wide) bu yerda e'tiborga olinmaydi —
   joylashuv faqat soniga qarab quriladi, shuning uchun teshik qolmaydi.
   ========================================================= */

.rg-gal-grid.is-home{
    grid-template-columns:repeat(4,minmax(0,1fr));
    grid-auto-rows:240px;
    grid-auto-flow:row;
}

.rg-gal-grid.is-home > .rg-gal-card{
    grid-column:span 1;
    grid-row:span 1;
}

/* Birinchisi doim katta */
.rg-gal-grid.is-home > .rg-gal-card:first-child{
    grid-column:span 2;
    grid-row:span 2;
}

/* 1 ta: butun kenglik */
.rg-gal-grid.is-home > .rg-gal-card:first-child:last-child{
    grid-column:1 / -1;
}

/* 2 ta: ikkalasi yarmidan */
.rg-gal-grid.is-home > .rg-gal-card:first-child:nth-last-child(2) ~ .rg-gal-card{
    grid-column:span 2;
    grid-row:span 2;
}

/* 3 ta: katta + o'ngda ikkita keng */
.rg-gal-grid.is-home > .rg-gal-card:first-child:nth-last-child(3) ~ .rg-gal-card{
    grid-column:span 2;
}

/* 4 ta: katta + keng + ikkita kichik */
.rg-gal-grid.is-home > .rg-gal-card:first-child:nth-last-child(4) + .rg-gal-card{
    grid-column:span 2;
}

/* Kichik kartalarda yozuv faqat hover'da — toza ko'rinish */
.rg-gal-grid.is-home > .rg-gal-card:not(:first-child) .rg-gal-caption{
    opacity:0;
    transform:translateY(6px);
    transition:opacity .25s ease, transform .25s ease;
}

.rg-gal-grid.is-home > .rg-gal-card:not(:first-child)::after{
    opacity:0;
    transition:opacity .25s ease;
}

.rg-gal-grid.is-home > .rg-gal-card:hover .rg-gal-caption,
.rg-gal-grid.is-home > .rg-gal-card:focus-visible .rg-gal-caption{
    opacity:1;
    transform:none;
}

.rg-gal-grid.is-home > .rg-gal-card:hover::after,
.rg-gal-grid.is-home > .rg-gal-card:focus-visible::after{
    opacity:1;
}

.rg-gal-grid.is-home > .rg-gal-card:first-child .rg-gal-caption strong{
    font-size:20px;
}

@media (max-width: 991.98px){
    .rg-gal-grid.is-home{ grid-auto-rows:190px; }
}

/* Telefon: 2 ustun, katta karta tepada butun kenglikda */
@media (max-width: 767.98px){
    .rg-gal-grid.is-home{
        grid-template-columns:repeat(2,minmax(0,1fr));
        grid-auto-rows:150px;
    }

    .rg-gal-grid.is-home > .rg-gal-card:first-child{
        grid-column:1 / -1;
        grid-row:span 2;
    }

    .rg-gal-grid.is-home > .rg-gal-card:first-child:nth-last-child(2) ~ .rg-gal-card,
    .rg-gal-grid.is-home > .rg-gal-card:first-child:nth-last-child(3) ~ .rg-gal-card{
        grid-column:span 1;
        grid-row:span 1;
    }

    .rg-gal-grid.is-home > .rg-gal-card:first-child:nth-last-child(2) ~ .rg-gal-card{
        grid-column:1 / -1;
        grid-row:span 2;
    }

    .rg-gal-grid.is-home > .rg-gal-card:first-child:nth-last-child(4) + .rg-gal-card{
        grid-column:1 / -1;
    }

    .rg-gal-grid.is-home > .rg-gal-card:first-child .rg-gal-caption strong{ font-size:16px; }
}

/* =========================================================
   /gallery sahifasi: umumiy footer to'q fon uchun yasalgan,
   bu sahifa foni esa oq — footerga o'z to'q fonini beramiz.
   ========================================================= */

body.rg-gal-page .footer-pro{
    background:
        radial-gradient(760px 320px at 12% 0%, rgba(124,58,237,.22), transparent 60%),
        radial-gradient(620px 280px at 88% 0%, rgba(236,72,153,.14), transparent 60%),
        linear-gradient(180deg, #110f24, #0b0a18);
    border-top:0;
}

body.rg-gal-page .footer-pro .btn-brand{
    display:inline-flex;
    align-items:center;
    gap:8px;
    border:0;
    color:#fff;
    border-radius:999px;
    padding:.82rem 1.2rem;
    font-weight:900;
    background:linear-gradient(135deg,#7c3aed,#ec4899);
    box-shadow:0 18px 44px rgba(124,58,237,.28);
    transition:transform .18s ease, filter .18s ease;
    white-space:nowrap;
}

body.rg-gal-page .footer-pro .btn-brand:hover{
    transform:translateY(-2px);
    filter:saturate(1.08);
}
