/*
 * Age confirmation overlay (Vinmag_AgeGate). Standalone on purpose: it does not depend on the theme's
 * Tailwind build. Colours come from the theme token --color-secondary (the plum of the old shop's
 * gate) with the same value as fallback.
 */

/* hidden for everybody until head.phtml marks the page as pending (no JS, or already confirmed) */
.vinmag-age-gate {
    display: none;
}

html.age-gate-pending .vinmag-age-gate {
    display: flex;
}

html.age-gate-pending body {
    overflow: hidden;
}

.vinmag-age-gate {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow-y: auto;
    background: rgba(159, 31, 99, 0.95);
    background: color-mix(in srgb, var(--color-secondary, #9f1f63) 95%, transparent);
}

.vinmag-age-gate__card {
    width: 100%;
    max-width: 37.5rem;
    margin: auto;
    background: #fff;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    text-align: center;
    animation: vinmag-age-gate-in 0.25s ease-out;
}

.vinmag-age-gate__title {
    margin: 0;
    padding: 0.5rem 1rem;
    background: var(--color-secondary, #9f1f63);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.5;
}

.vinmag-age-gate__body {
    padding: 1.25rem 1.25rem 1.5rem;
}

.vinmag-age-gate__logo {
    display: block;
    width: 7.5rem;
    max-width: 40%;
    height: auto;
    margin: 0 auto 0.75rem;
}

.vinmag-age-gate__message {
    margin: 0 0 1.25rem;
    color: #111;
    font-size: 1rem;
    line-height: 1.4;
}

.vinmag-age-gate__actions {
    display: grid;
    gap: 0.75rem;
}

.vinmag-age-gate__button {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 0;
    background: var(--color-secondary, #9f1f63);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.vinmag-age-gate__button:hover {
    filter: brightness(1.12);
}

.vinmag-age-gate__button:focus-visible,
.vinmag-age-gate__denied:focus-visible {
    outline: 3px solid #111;
    outline-offset: 2px;
}

/* answer "under 18": the question goes away, the message stays (the page stays locked) */
.vinmag-age-gate__denied {
    display: none;
    margin-bottom: 0;
}

.vinmag-age-gate.is-denied .vinmag-age-gate__question {
    display: none;
}

.vinmag-age-gate.is-denied .vinmag-age-gate__denied {
    display: block;
}

@keyframes vinmag-age-gate-in {
    from {
        opacity: 0;
        transform: scale(0.96);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .vinmag-age-gate__card {
        animation: none;
    }
}

@media print {
    .vinmag-age-gate {
        display: none !important;
    }
}
