/* ============================================================
   DesArt Simple Gallery – v1.4.0
   ============================================================ */

/* ── Közös reset ── */
.sg-carousel-wrap *,
.sg-carousel-wrap *::before,
.sg-carousel-wrap *::after,
.sg-grid-wrap *,
.sg-grid-wrap *::before,
.sg-grid-wrap *::after {
    box-sizing: border-box;
}

.sg-carousel-wrap,
.sg-grid-wrap {
    position: relative;
    width: 100%;
    margin: 0 auto 2rem;
}

/* ============================================================
   CAROUSEL
   ============================================================ */
.sg-carousel-wrap {
    overflow: hidden;
}

.sg-carousel-track {
    display: flex;
    flex-wrap: nowrap;
    width: 100%;          /* track = pontosan a wrap szélességével egyenlő */
    transition: transform 0.42s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

/*
 * Slide szélesség: flex:0 0 X%; max-width:X% – inline style-ból jön.
 * Padding NINCS – a belső sg-img-box kezeli a vizuális rést.
 * Mobilon CSS felülírja: mindig 1 kép (100%).
 */
.sg-carousel-slide {
    flex-shrink: 0;
    padding: 0 4px;       /* kis rés slide-ok közt */
}

@media (max-width: 767px) {
    .sg-carousel-slide {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        padding: 0;
    }
}

/* 4:3 képarány – carousel */
.sg-carousel-slide .sg-img-box {
    width: 100%;
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #eee;
    border-radius: 3px;
}

.sg-carousel-slide .sg-img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    cursor: zoom-in;
    transition: opacity 0.25s ease;
}

.sg-carousel-slide .sg-img-box img:hover {
    opacity: 0.88;
}

/* Fallback régi böngészőkhöz (aspect-ratio nem támogatott) */
@supports not (aspect-ratio: 4/3) {
    .sg-carousel-slide .sg-img-box {
        padding-top: 75%;
        height: 0;
    }
    .sg-carousel-slide .sg-img-box img {
        position: absolute;
        inset: 0;
        height: 100%;
    }
}

/* ── Navigációs sáv (nyilak + dotok egy sorban) ── */
.sg-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 18px;
    padding: 16px 0 6px;
}

/* Nyíl gombok – kör, lila keret stílus */
.sg-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 2px solid #c7c7f0;
    background: transparent;
    color: #6366f1;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.sg-arrow:hover {
    border-color: #6366f1;
    background: #f0f0ff;
}

/* Dot navigáció */
.sg-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 7px;
}

.sg-dot {
    display: inline-block;
    height: 9px;
    width: 9px;
    border-radius: 999px;
    background: #c5c5e0;
    cursor: pointer;
    transition: width 0.3s ease, background 0.3s ease;
    flex-shrink: 0;
}

.sg-dot.active {
    width: 26px;
    background: #6366f1;
}

/* ============================================================
   GRID – 1-10 oszlop, egységes 4:3 képarány
   ============================================================ */
.sg-grid-wrap {
    display: grid;
    gap: 10px;
}

.sg-cols-1  { grid-template-columns: repeat(1,  1fr); }
.sg-cols-2  { grid-template-columns: repeat(2,  1fr); }
.sg-cols-3  { grid-template-columns: repeat(3,  1fr); }
.sg-cols-4  { grid-template-columns: repeat(4,  1fr); }
.sg-cols-5  { grid-template-columns: repeat(5,  1fr); }
.sg-cols-6  { grid-template-columns: repeat(6,  1fr); }
.sg-cols-7  { grid-template-columns: repeat(7,  1fr); }
.sg-cols-8  { grid-template-columns: repeat(8,  1fr); }
.sg-cols-9  { grid-template-columns: repeat(9,  1fr); }
.sg-cols-10 { grid-template-columns: repeat(10, 1fr); }

/* Tablet */
@media (max-width: 1024px) {
    .sg-cols-7,
    .sg-cols-8,
    .sg-cols-9,
    .sg-cols-10 { grid-template-columns: repeat(6, 1fr); }
    .sg-cols-5,
    .sg-cols-6  { grid-template-columns: repeat(4, 1fr); }
}

/* Mobil */
@media (max-width: 767px) {
    .sg-cols-4,
    .sg-cols-5,
    .sg-cols-6,
    .sg-cols-7,
    .sg-cols-8,
    .sg-cols-9,
    .sg-cols-10 { grid-template-columns: repeat(3, 1fr); }
    .sg-cols-3  { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .sg-cols-2,
    .sg-cols-3,
    .sg-cols-4,
    .sg-cols-5,
    .sg-cols-6,
    .sg-cols-7,
    .sg-cols-8,
    .sg-cols-9,
    .sg-cols-10 { grid-template-columns: repeat(2, 1fr); }
}

/* 4:3 képarány – grid cella */
.sg-grid-item {
    overflow: hidden;
    background: #f0f0f0;
    border-radius: 4px;
    aspect-ratio: 4 / 3;
    position: relative;
}

.sg-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    cursor: zoom-in;
    transition: transform 0.32s ease, opacity 0.25s ease;
}

.sg-grid-item img:hover {
    transform: scale(1.05);
    opacity: 0.88;
}

/* Fallback régi böngészőkhöz */
@supports not (aspect-ratio: 4/3) {
    .sg-grid-item {
        padding-top: 75%;
        height: 0;
    }
    .sg-grid-item img {
        position: absolute;
        inset: 0;
        height: 100%;
    }
}

/* ============================================================
   LIGHTBOX
   ============================================================ */
#sg-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.90);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    animation: sgFadeIn 0.22s ease;
}

#sg-lightbox.open {
    display: flex;
}

@keyframes sgFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

#sg-lightbox-img {
    max-width: 90vw;
    max-height: 82vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.55);
    display: block;
    animation: sgImgIn 0.28s ease;
}

@keyframes sgImgIn {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}

#sg-lightbox-caption {
    color: rgba(255, 255, 255, 0.75);
    font-size: 14px;
    margin-top: 12px;
    min-height: 20px;
    text-align: center;
    max-width: 80vw;
}

#sg-lightbox button {
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #fff;
    cursor: pointer;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    position: absolute;
    padding: 0;
}

#sg-lightbox button:hover {
    background: rgba(255, 255, 255, 0.26);
}

#sg-lb-close { top: 18px;  right: 22px;  font-size: 28px; }
#sg-lb-prev  { left: 18px; top: 50%; transform: translateY(-50%); }
#sg-lb-next  { right: 18px; top: 50%; transform: translateY(-50%); }

#sg-lightbox-counter {
    color: rgba(255, 255, 255, 0.50);
    font-size: 13px;
    position: absolute;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
}
