/* ================================================
   Referencia galéria – kártyás nézet + modal
   Skóp: .ref-page / .ref
   ================================================ */

:root {
    --ref-max: 1280px;
    --ref-gap: clamp(14px, 2.4vw, 24px);
    --ref-col: min(360px, 100%);
    /* kártya szélesség */
    --ref-radius: 14px;
    --ref-shadow: 0 10px 28px rgba(0, 0, 0, .12), 0 2px 10px rgba(0, 0, 0, .08);
    --ref-muted: #6b7280;
    --ref-border: #e7eef6;
    --header-height: 84px;
}

@media (max-width: 720px) {
    :root {
        --header-height: 72px;
    }
}

/* Konténer offset a fix headerhez */
.ref-page .maincontainer {
    max-width: var(--ref-max);
    margin-inline: auto;
    padding: calc(var(--header-height) + 16px) clamp(16px, 3vw, 28px) clamp(16px, 3vw, 28px);
}

/* Hero */
.ref-hero {
    padding-block: clamp(6px, 2.4vw, 14px);
}

.ref-hero__inner {
    display: grid;
    gap: 8px;
}

.ref-title {
    margin: 0;
    font-size: clamp(22px, 2.8vw, 30px);
    line-height: 1.2;
}

.ref-lead {
    margin: 0;
    color: var(--ref-muted);
    font-size: clamp(14px, 1.4vw, 16px);
}

/* GRID – modern kártyás elrendezés */
.ref-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--ref-col), 1fr));
    gap: var(--ref-gap);
    align-items: start;
}

/* KÁRTYA */
.ref-card {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Thumbnail konténer
     - Fix, rugalmas képarány: desktop 16:10, mobilon 1:1
     - Bármilyen bemeneti képméret → object-fit: cover
  */
.ref-thumb {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    border: 1px solid var(--ref-border);
    border-radius: var(--ref-radius);
    background: #f3f4f6;
    overflow: hidden;
    padding: 0;
    cursor: pointer;
    position: relative;
    box-shadow: var(--ref-shadow);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

@media (max-width: 740px) {
    .ref-thumb {
        aspect-ratio: 1 / 1;
    }

    /* mobilon négyzetháló */
}

.ref-thumb img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    /* itt a lényeg: bármekkora forrásból szép vágás */
    object-position: center;
    transform: scale(1.0);
    transition: transform .35s ease;
}

/* Hover effektek */
.ref-thumb__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, .35), rgba(0, 0, 0, 0) 60%);
    opacity: 0;
    transition: opacity .2s ease;
}

.ref-thumb__zoom {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .9);
    color: #0f172a;
    display: grid;
    place-items: center;
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
    transform: scale(.92);
    transition: transform .2s ease, background .2s ease;
}

.ref-thumb:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 40px rgba(0, 0, 0, .16), 0 4px 14px rgba(0, 0, 0, .10);
    border-color: #e2e8f0;
}

.ref-thumb:hover img {
    transform: scale(1.04);
}

.ref-thumb:hover .ref-thumb__overlay {
    opacity: 1;
}

.ref-thumb:hover .ref-thumb__zoom {
    transform: scale(1.0);
    background: #fff;
}

/* Felirat a kártya alatt */
.ref-cap {
    margin: 0;
    font-size: 14px;
    color: #111827;
    line-height: 1.35;
    text-wrap: balance;
}

/* Üres állapot */
.empty-state {
    grid-column: 1/-1;
    text-align: center;
    padding: 32px 16px;
    color: var(--ref-muted);
    border: 1px dashed #e5e7eb;
    border-radius: 12px;
    background: #fff;
}

/* ============ MODAL ============ */
.ref-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
}

.ref-modal[aria-hidden="false"] {
    display: block;
}

.ref-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .66);
    backdrop-filter: blur(1px);
}

.ref-modal__inner {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: clamp(8px, 3vw, 24px);
}

.ref-modal__figure {
    margin: 0;
    max-width: 92vw;
    max-height: 88vh;
    display: grid;
    gap: 8px;
}

.ref-modal__figure img {
    max-width: 92vw;
    max-height: 80vh;
    width: auto;
    height: auto;
    border-radius: 12px;
    display: block;
    box-shadow: 0 16px 48px rgba(0, 0, 0, .4);
}

.ref-modal__figure figcaption {
    color: #e5e7eb;
    text-align: center;
    font-size: 14px;
}

/* Navigációs gombok a modalon */
.ref-close,
.ref-nav {
    position: absolute;
    border: none;
    background: rgba(255, 255, 255, .9);
    color: #0f172a;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    cursor: pointer;
    display: grid;
    place-items: center;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
    transition: transform .15s ease, background .15s ease;
}

.ref-close:hover,
.ref-nav:hover {
    transform: scale(1.05);
    background: #fff;
}

.ref-close {
    top: 18px;
    right: 18px;
    font-size: 18px;
}

.ref-prev {
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 22px;
}

.ref-next {
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 22px;
}

/* Kisegítő finomhangolások */
@media (max-width: 640px) {
    .ref-modal__figure img {
        max-height: 70vh;
    }

    .ref-prev,
    .ref-next {
        top: auto;
        bottom: 18px;
        transform: none;
    }

    .ref-prev {
        left: 18px;
    }

    .ref-next {
        right: 18px;
    }
}