.itm-advent {
    --itm-advent-door: #9e1b22;
    --itm-advent-door-dark: #7a1419;
    --itm-advent-door-locked: rgba(107, 107, 107, .4);
    --itm-advent-door-locked-dark: rgba(77, 77, 77, .85);
    --itm-advent-text: #fff;
    --itm-advent-gold: #e8c46a;
    --itm-advent-bg: #f6f1e9;
    --itm-advent-radius: 6px;
    --itm-advent-gap: 24px;
    --itm-advent-columns: 6;
}

.itm-advent {
    position: relative;
}

.itm-advent--has-background {
    --itm-advent-overlay: rgba(0, 0, 0, .25);
    padding: clamp(16px, 4vw, 48px);
    border-radius: var(--itm-advent-radius);
    overflow: hidden;
    isolation: isolate;
    color: #fff;
}

.itm-advent__background {
    position: absolute;
    inset: 0;
    z-index: -1;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.itm-advent__background::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--itm-advent-overlay);
}

.itm-advent--has-background .itm-advent__title,
.itm-advent--has-background .itm-advent__status {
    text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}

.itm-advent--has-background .itm-advent__door {
    background: rgba(246, 241, 233, .85);
}

.itm-advent__door--locked,
.itm-advent--has-background .itm-advent__door--locked {
    background: transparent;
    box-shadow: none;
}

.itm-advent__title {
    margin-bottom: .5em;
}

.itm-advent__grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(var(--itm-advent-columns), minmax(0, 1fr));
    gap: var(--itm-advent-gap);
}

@media (max-width: 767px) {
    .itm-advent {
        --itm-advent-columns: 4;
        --itm-advent-gap: 8px;
    }
}

@media (max-width: 479px) {
    .itm-advent {
        --itm-advent-columns: 3;
    }
}

.itm-advent__door {
    position: relative;
    aspect-ratio: 1 / 1;
    perspective: 1200px;
    border-radius: var(--itm-advent-radius);
    background: var(--itm-advent-bg);
    box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .08);
}

@supports not (aspect-ratio: 1 / 1) {
    .itm-advent__door::before {
        content: "";
        display: block;
        padding-top: 100%;
    }
}

.itm-advent__content {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: var(--itm-advent-radius);
    display: flex;
    flex-direction: column;
}

.itm-advent__zoom {
    display: block;
    flex: 1 1 auto;
    min-height: 0;
}

.itm-advent__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.itm-advent__placeholder {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: var(--itm-advent-door);
}

.itm-advent__caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: .35em .5em;
    font-size: .8rem;
    line-height: 1.3;
    color: #fff;
    background: linear-gradient(to top, rgba(0, 0, 0, .75), rgba(0, 0, 0, 0));
    pointer-events: none;
}

.itm-advent__caption a {
    pointer-events: auto;
    color: var(--itm-advent-gold);
}

.itm-advent__day {
    font-weight: 700;
    margin-right: .25em;
}

.itm-advent__text {
    display: none;
}

.itm-advent__front {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: var(--itm-advent-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .25em;
    font: inherit;
    color: var(--itm-advent-text);
    background: radial-gradient(circle at 85% 50%, var(--itm-advent-gold) 0 4px, transparent 5px),
    linear-gradient(135deg, var(--itm-advent-door), var(--itm-advent-door-dark));
    box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .15), 0 2px 6px rgba(0, 0, 0, .2);
    transform-origin: left center;
    transition: transform .8s cubic-bezier(.3, .7, .3, 1), box-shadow .8s;
    backface-visibility: hidden;
    cursor: pointer;
    z-index: 2;
}

.itm-advent__number {
    font-size: clamp(1.3rem, 3vw, 2.2rem);
    font-weight: 700;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .3);
}

.itm-advent__hint {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    opacity: .9;
}

.itm-advent__door--today .itm-advent__front {
    box-shadow: 0 0 0 3px var(--itm-advent-gold), 0 4px 14px rgba(0, 0, 0, .3);
    animation: itm-advent-pulse 2.4s ease-in-out infinite;
}

.itm-advent__door--today .itm-advent__front:hover,
.itm-advent__door--today .itm-advent__front:focus-visible {
    transform: rotateY(-18deg);
}

.itm-advent__door.is-open .itm-advent__front {
    transform: rotateY(-110deg);
    box-shadow: none;
    animation: none;
    pointer-events: none;
}

.itm-advent__door.is-open .itm-advent__caption {
    z-index: 3;
}

.itm-advent__door--locked .itm-advent__front {
    background: radial-gradient(circle at 85% 50%, rgba(255, 255, 255, .35) 0 4px, transparent 5px),
    linear-gradient(135deg, var(--itm-advent-door-locked), var(--itm-advent-door-locked-dark));
    cursor: not-allowed;
}

.itm-advent__lock {
    width: 14px;
    height: 11px;
    border-radius: 2px;
    background: rgba(255, 255, 255, .8);
    position: relative;
    margin-top: 8px;
}

.itm-advent__lock::before {
    content: "";
    position: absolute;
    left: 2px;
    top: -8px;
    width: 6px;
    height: 7px;
    border: 2px solid rgba(255, 255, 255, .8);
    border-bottom: 0;
    border-radius: 6px 6px 0 0;
}

.itm-advent__door.is-shaking .itm-advent__front {
    animation: itm-advent-shake .45s;
}

.itm-advent__front:focus-visible {
    outline: 3px solid var(--itm-advent-gold);
    outline-offset: 2px;
}

.itm-advent__status {
    margin: .75em 0 0;
    padding: 0;
    text-align: center;
}

.itm-advent__status:empty {
    margin: 0;
    height: 0;
    overflow: hidden;
}

.itm-advent__dialog {
    max-width: min(92vw, 1100px);
    max-height: 92vh;
    padding: 0;
    border: 0;
    border-radius: var(--itm-advent-radius);
    background: #111;
    color: #fff;
}

.itm-advent__dialog::backdrop {
    background: rgba(0, 0, 0, .75);
}

.itm-advent__dialog-figure {
    margin: 0;
}

.itm-advent__dialog-figure img {
    display: block;
    max-width: 100%;
    max-height: 82vh;
    margin: 0 auto;
}

.itm-advent__dialog-figure figcaption:not(:empty) {
    padding: .75em 1em;
}

.itm-advent__dialog-close {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    font-size: 1.6rem;
    line-height: 1;
    color: #fff;
    background: rgba(0, 0, 0, .6);
    cursor: pointer;
}

@keyframes itm-advent-pulse {
    0%, 100% {
        box-shadow: 0 0 0 3px var(--itm-advent-gold), 0 4px 14px rgba(0, 0, 0, .3);
    }
    50% {
        box-shadow: 0 0 0 6px var(--itm-advent-gold), 0 4px 18px rgba(0, 0, 0, .35);
    }
}

@keyframes itm-advent-shake {
    0%, 100% {
        transform: translateX(0);
    }
    20%, 60% {
        transform: translateX(-5px);
    }
    40%, 80% {
        transform: translateX(5px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .itm-advent__front {
        transition: none;
        animation: none !important;
    }
}
