/*
 * Holiday toast, shown as a centered modal.
 * Bootstrap 4.0.0 has no Toast, .ratio, .text-black or .fw-bold,
 * so everything needed is defined here, scoped to .holiday-toast.
 * Assumes .bg-main is already defined by the theme.
 *
 * Structure:
 *   .holiday-toast          full-screen backdrop; flexbox centers the dialog
 *     .holiday-toast__dialog  the card (GSAP animates its transform)
 */

/* ---- Backdrop: centers the dialog with flexbox, no transform needed ---- */
.holiday-toast {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1080; /* above Bootstrap 4 modals (1050) and popovers (1060); raise if a header covers it */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.65);
}

.holiday-toast[hidden] {
    display: none !important;
}

/* ---- Dialog card ---- */
.holiday-toast__dialog {
    position: relative;
    /* Fallback, then the real width: full 572px, but never wider than the
       viewport, and never so wide that the 572:733 image + buttons would
       overflow the viewport height. */
    width: calc(100vw - 2rem);
    max-width: 572px;
    width: min(572px, calc(100vw - 2rem), calc((100vh - 8rem) * var(--holiday-w, 572) / var(--holiday-h, 733)));
    background: #343a40; /* Bootstrap .bg-dark; the class is also applied in the markup */
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.3);
    outline: 0;
}

/* Page scroll lock while open (padding-right is set by JS to avoid a jump) */
.holiday-toast-open {
    overflow: hidden;
}

/*
 * Image box: reserves the image's height before it loads (no layout shift).
 * --holiday-w / --holiday-h are set inline by PHP from the uploaded image's
 * real dimensions (defaults 572 x 733), so the box always matches the image
 * and object-fit never has to crop anything.
 */
.holiday-toast__media {
    position: relative;
    display: block;
    width: 100%;
    overflow: hidden;
}

.holiday-toast__media::before {
    display: block;
    padding-top: calc(var(--holiday-h, 733) / var(--holiday-w, 572) * 100%);
    content: "";
}

/* Size the <img> itself (and a <picture> wrapper if a plugin adds one),
   so theme rules like img { height: auto } can't push it out of the box. */
.holiday-toast .holiday-toast__media .holiday-toast__img,
.holiday-toast .holiday-toast__media picture {
    position: absolute;
    top: 0;
    left: 0;
    /* !important, same as Bootstrap's .h-100: a theme rule is forcing height: auto */
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0;
}

.holiday-toast .holiday-toast__media .holiday-toast__img {
    display: block;
    object-fit: cover;
}

/* ---- Close button (top right, over the image) ---- */
.holiday-toast__close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 2;
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    line-height: 1;
    cursor: pointer;
}

.holiday-toast__close svg {
    display: block;
    width: 1rem;
    height: 1rem;
    pointer-events: none;
}

.holiday-toast__close:hover,
.holiday-toast__close:focus {
    opacity: 0.85;
}

/* ---- Buttons: fill the row, equal widths ---- */
.holiday-toast__actions {
    display: flex;
}

.holiday-toast__btn {
    flex: 1 1 0; /* 1 button = full width, 2 = 50/50 */
    border-radius: 0;
    font-weight: 700;
}

@media screen and (max-width: 767.98px) {
    .holiday-toast__btn {
        font-size: 14px !important;
    }
}

.holiday-toast__btn + .holiday-toast__btn {
    border-left: 1px solid rgba(0, 0, 0, 0.15);
}

.holiday-toast__btn:hover,
.holiday-toast__btn:focus {
    opacity: 0.9;
}

/* BS4.0 has no .text-black */
.holiday-toast .text-black,
.holiday-toast .text-black:hover,
.holiday-toast .text-black:focus {
    color: #000 !important;
}

@media (prefers-reduced-motion: reduce) {
    .holiday-toast * {
        transition: none !important;
    }
}