/* ==========================================================================
   Adventskalender (Add-on)
   Markup: tpl/common/adventskalender.tpl.php, Logik: tpl/assets/js/adventskalender.js
   Türchen-Positionen stammen aus dem Altshop (px auf 800x652) und werden hier
   über CSS-Variablen --x/--y in Prozent umgerechnet → skaliert auf jede Breite.
   ========================================================================== */

/* ---------- Kalender-Modal ---------- */
.advent-dialog {
    max-width: 860px;
    width: calc(100% - 1rem);
    margin: .5rem auto;
}

/* Kalender komplett sichtbar halten, wenn der Viewport flach ist (Querformat / kleine Laptops) */
@media (max-height: 760px) {
    .advent-dialog {
        max-width: min(860px, calc((100vh - 2rem) / .815));
    }
}

.advent-content {
    background: transparent;
    border: 0;
    box-shadow: none;
}

.advent-calendar {
    position: relative;
    width: 100%;
    aspect-ratio: 800 / 652;
    /* Die Türchen-Felder sind in der Grafik transparent (Altshop: weiß hinterlegt) */
    background: #fff url('../img/advent/kalender.webp') center / 100% 100% no-repeat;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .45);
    user-select: none;
}

/* Das "X" ist Teil der Hintergrundgrafik (oben rechts) – unsichtbarer Button darüber */
.advent-close {
    position: absolute;
    top: 1.5%;
    right: 1.5%;
    width: 7%;
    height: 8%;
    background: transparent;
    border: 0;
    cursor: pointer;
    z-index: 20;
}

.advent-close:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
    border-radius: 6px;
}

/* ---------- Türchen ---------- */
.advent-door {
    position: absolute;
    left: calc(var(--x) / 800 * 100%);
    top: calc(var(--y) / 652 * 100%);
    width: 14%;
    /* 112 / 800 */
    height: 17.0245%;
    /* 111 / 652 */
    perspective: 700px;
    z-index: 3;
}

/* Vorderseite = Ausschnitt aus der Türen-Grafik an exakt derselben Stelle */
.advent-door-front {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background: #0a7a3b;
    /* Rückseite der Tür */
    transform-origin: left center;
    transition: transform .9s cubic-bezier(.4, 0, .2, 1);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35);
}

.advent-door-front::before {
    content: "";
    position: absolute;
    width: calc(800 / 112 * 100%);
    height: calc(652 / 111 * 100%);
    left: calc(var(--x) / 112 * -100%);
    top: calc(var(--y) / 111 * -100%);
    background: url('../img/advent/tueren.webp') 0 0 / 100% 100% no-repeat;
    transition: opacity .25s ease .35s;
}

/* Dahinter: Produktbild (nur beim heutigen Türchen gerendert) */
.advent-door-inside {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    overflow: hidden;
    box-shadow: inset 0 0 14px rgba(0, 0, 0, .25);
}

.advent-door-inside img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

/* Zustände */
.advent-door.is-future .advent-door-front {
    cursor: not-allowed;
}

.advent-door.is-past .advent-door-front {
    cursor: default;
    filter: grayscale(.7) brightness(.8);
}

.advent-door.is-past::after {
    content: "";
    position: absolute;
    right: 6%;
    bottom: 6%;
    width: 18%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: rgba(255, 255, 255, .85) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='%230a7a3b' d='M13.5 4.5 6.5 11.5 2.5 7.5l1-1 3 3 6-6z'/></svg>") center / 70% no-repeat;
    pointer-events: none;
}

.advent-door.is-today {
    cursor: pointer;
    z-index: 5;
}

.advent-door.is-today .advent-door-front {
    animation: advent-pulse 1.6s ease-in-out infinite;
}

.advent-door.is-today:hover .advent-door-front,
.advent-door.is-today:focus-visible .advent-door-front {
    transform: rotateY(-22deg);
}

.advent-door.is-today:focus-visible {
    outline: none;
}

.advent-door.is-open {
    z-index: 10;
}

.advent-door.is-open .advent-door-front {
    transform: rotateY(-150deg) !important;
    animation: none;
    box-shadow: 4px 0 12px rgba(0, 0, 0, .35);
}

.advent-door.is-open .advent-door-front::before {
    opacity: 0;
}

@keyframes advent-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 2px #fff, 0 0 10px 2px rgba(255, 215, 0, .6);
    }

    50% {
        box-shadow: 0 0 0 2px #fff, 0 0 22px 8px rgba(255, 215, 0, .95);
    }
}

@media (prefers-reduced-motion: reduce) {

    .advent-door-front,
    .advent-door-front::before {
        transition: none;
    }

    .advent-door.is-today .advent-door-front {
        animation: none;
        box-shadow: 0 0 0 2px #fff, 0 0 16px 5px rgba(255, 215, 0, .8);
    }
}

/* ---------- Produkt-Modal ---------- */
.advent-product-header {
    background: linear-gradient(135deg, #c8102e 0%, #8f0a1f 100%);
    color: #fff;
}

.advent-product-header .modal-title {
    font-weight: 700;
}

.advent-card-wrap .product-default {
    margin-bottom: 0;
}

.advent-card-wrap .product-image {
    max-height: 240px;
}

.advent-product-footer {
    border-top: 0;
    padding-top: 0;
}

/* ---------- Sidebar-Link (wie der rote "Angebote"-Link in aside.tpl.php) ---------- */
.advent-nav-link {
    background: linear-gradient(135deg, #0f8a47 0%, #0a6b36 100%);
    border: 1px solid #0f8a47;
    margin: 0 12px 8px 12px;
    transition: box-shadow .2s ease;
}

.advent-nav-link:hover,
.advent-nav-link:focus {
    color: #fff;
    box-shadow: 0 4px 8px rgba(15, 138, 71, .35);
}

.advent-nav-shine {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0) 40%, rgba(255, 255, 255, .2) 50%, rgba(255, 255, 255, 0) 60%);
    pointer-events: none;
}

/* ---------- Konfetti-Canvas (über dem Bootstrap-Modal, z-index 1055) ---------- */
.advent-confetti {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1080;
}
