/* ===========================================
   ADVENTI KALENDÁRIUM – TELJES TISZTA VERZIÓ
   Popup + Grid + Mobil támogatás
=========================================== */

/* ===== GRID – DESKTOP ===== */

.advent-calendar-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    position: relative;
    padding: 10px 0;
}

/* ===== CSEMPE ALAP ===== */

.advent-window {
    position: relative;
    border: 1px solid #555;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    background: #f7f7f7;
    aspect-ratio: 1 / 1;
    transform-origin: center center;
    transition: box-shadow 0.25s ease, transform 0.25s ease, filter 0.2s ease;
    z-index: 1;
}

/* Zárt / jövőbeli nap */

.advent-window-locked {
    opacity: 0.35;
    cursor: not-allowed;
}

/* Hover effekt nyitható napra */

.advent-window-openable:hover {
    box-shadow: 0 6px 18px rgba(0,0,0,0.18);
}

/* Kép előlap */

.advent-window-front {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.advent-window-front img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Ha nincs kép */

.advent-window-front-fallback {
    width: 100%;
    height: 100%;
    background: #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: #555;
}

/* ===== POPUP TARTALOM (REJTETT) ===== */

.advent-window-content {
    position: absolute;
    inset: 0;
    padding: 22px 28px;
    background: #ffffff;
    overflow-y: auto;
    display: none;
    font-size: 1rem;
    line-height: 1.6;
    box-sizing: border-box;
}

/* ===== POPUP – DESKTOP ===== */

.advent-window.advent-window-open {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 500px;
    max-width: 90vw;
    max-height: 80vh;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.35);
    z-index: 100;
    aspect-ratio: auto;
}

/* Előlapi kép popupkor eltűnik */

.advent-window.advent-window-open .advent-window-front {
    display: none;
}

/* Tartalom popupkor látszik */

.advent-window.advent-window-open .advent-window-content {
    position: relative;
    inset: auto;
    display: block;
    max-height: 70vh;
}

/* Popup szövegek */

.advent-window-content h3 {
    font-size: 1.4rem;
    margin: 0 0 12px;
    color: #222;
}

.advent-window-content p {
    margin: 8px 0 12px;
    color: #333;
}

/* ===== BEZÁRÓ X – CSAK A POPUPON ===== */

.advent-close-btn {
    display: none;
}

.advent-window.advent-window-open .advent-close-btn {
    display: block;
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font-size: 24px;
    line-height: 1;
    color: #000;        /* fekete X */
    cursor: pointer;
    z-index: 999999;
}

.advent-window.advent-window-open .advent-close-btn:hover {
    color: #333;
}

/* ===== HÁTTÉR SÖTÉTÍTÉSE ===== */

.advent-calendar-grid.advent-calendar-has-open::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 50;
}

.advent-calendar-grid.advent-calendar-has-open .advent-window:not(.advent-window-open) {
    filter: blur(2px) brightness(0.7);
    pointer-events: none;
}

/* ===========================================
   MOBIL (<= 768px)
=========================================== */

@media (max-width: 768px) {

    .advent-calendar-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        padding: 10px;
    }

    .advent-calendar-grid.advent-calendar-has-open::before {
        background: transparent;
    }

    .advent-calendar-grid.advent-calendar-has-open .advent-window:not(.advent-window-open) {
        filter: brightness(0.8);
        pointer-events: none;
    }

    /* Popup ne lebegjen mobilon */

    .advent-window.advent-window-open {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        width: 100%;
        max-width: 100%;
        max-height: none;
        grid-column: 1 / -1;
        box-shadow: 0 10px 24px rgba(0,0,0,0.25);
    }

    .advent-window.advent-window-open .advent-window-content {
        max-height: none;
    }
}
