/* Shared Emma Mason banner appearance for Hyva and p4. */
:root {
    --banner-z-index: 50;
    --countdown-digits-color: #f8f8f8;
    --countdown-label-color: #59585a;
}

.top-banner-wrapper {
    --banner-image-height: var(--mobile-banner-height, 32px);
    position: relative;
    background: transparent;
    height: var(--banner-image-height);
    box-shadow: none;
}

.top-banner-wrapper.expanded {
    box-shadow: none;
}

.top-banner-wrapper .banner-content,
.top-banner-wrapper .banner-wrapper {
    height: 100%;
}

.top-banner-wrapper .banner-container {
    height: var(--banner-image-height);
    overflow: hidden;
}

.top-banner-wrapper .banner-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

/* Keep the reserved space when the banner content is hidden. */
.top-banner-wrapper.is-empty > * {
    visibility: hidden;
    pointer-events: none;
}

.countdown-dashboard {
    display: flex;
    position: absolute;
    inset: 0;
    pointer-events: none;
    align-items: center;
    box-sizing: border-box;
    justify-content: center;
    padding: 0 1rem;
    text-align: center;
    z-index: 2;
}

.countdown-container {
    --countdown-box-height: 38px;
    --countdown-box-width: 36px;
    --countdown-digit-size: 20px;
    --countdown-label-size: 10px;
    display: flex;
    align-items: flex-start;
    gap: 2px;
    font-family: Arial, "Helvetica Neue", "Segoe UI", sans-serif;
    justify-content: center;
    line-height: 1;
}

.countdown-item {
    align-items: center;
    backdrop-filter: blur(4px);
    background-color: var(--countdown-box-background, rgba(216, 216, 211, 0.62));
    border: 1px solid rgba(255, 255, 255, 0.46);
    border-radius: 5px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.38);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    height: var(--countdown-box-height);
    justify-content: center;
    margin: 0;
    min-width: var(--countdown-box-width);
    padding: 0 4px;
}

.countdown-digits {
    color: var(--countdown-digits-color);
    font-size: var(--countdown-digit-size);
    font-variant-numeric: tabular-nums;
    font-weight: bold;
    line-height: 0.9;
    min-width: 2ch;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
}

.countdown-label {
    color: var(--countdown-label-color);
    font-size: var(--countdown-label-size);
    font-weight: bold;
    line-height: 1;
    margin-top: 2px;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.28);
}

.countdown-separator {
    align-self: flex-start;
    color: var(--countdown-digits-color);
    font-size: var(--countdown-digit-size);
    font-weight: bold;
    line-height: 0.9;
    margin: 0;
    /* Match the digits' top edge, excluding the label underneath. */
    padding-top: calc((var(--countdown-box-height) - var(--countdown-digit-size) * 0.9 - var(--countdown-label-size) - 2px) / 2);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
}

.countdown-day-marker {
    display: none;
}

.close-banner {
    width: 40px;
    height: 40px;
    z-index: 200;
    right: 0px;
    top: 0px;
}

.close-banner:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.collapse-top-banner {
    transition: opacity 0.3s ease;
}

.mobile-banner-toggle {
    display: none;
}

/* Mobile specific styles */
@media (max-width: 767px) {
    .top-banner-wrapper {
        --mobile-toggle-width: max(44px, 9%);
    }

    /* Lock the image's natural height on expansion so later loads/errors cannot shift the page. */
    .top-banner-wrapper.expanded {
        --banner-image-height: var(--expanded-banner-image-height, var(--mobile-banner-height, 32px));
    }

    .top-banner-wrapper:not(.expanded) .banner-image {
        height: auto;
        object-fit: cover;
        object-position: top;
    }

    .top-banner-wrapper .countdown-dashboard {
        /* Keep the countdown inside the artwork and clear of the expansion arrow. */
        padding: 8px calc(var(--mobile-toggle-width) + 8px) 8px 8px;
    }

    .top-banner-wrapper:not(.expanded) .countdown-dashboard {
        padding-top: 0;
        padding-bottom: 0;
    }

    .top-banner-wrapper:not(.expanded) .countdown-container {
        --countdown-digit-size: clamp(14px, 4vw, 16px);
        align-items: center;
        gap: 1px;
        height: 100%;
    }

    .top-banner-wrapper:not(.expanded) .countdown-item {
        backdrop-filter: none;
        background-color: transparent;
        border: 0;
        box-shadow: none;
        flex-direction: row;
        gap: 1px;
        height: auto;
        min-width: 0;
        padding: 0;
    }

    .top-banner-wrapper:not(.expanded) .countdown-days {
        margin-right: 4px;
    }

    .top-banner-wrapper:not(.expanded) .countdown-label {
        /* Retain the unit names for assistive technology without using visual space. */
        border: 0;
        clip-path: inset(50%);
        height: 1px;
        margin: -1px;
        overflow: hidden;
        padding: 0;
        position: absolute;
        white-space: nowrap;
        width: 1px;
    }

    .top-banner-wrapper:not(.expanded) .countdown-day-marker {
        color: var(--countdown-digits-color);
        display: inline;
        font-size: var(--countdown-digit-size);
        font-weight: bold;
        line-height: 0.9;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
    }

    .top-banner-wrapper:not(.expanded) .countdown-separator {
        align-self: center;
        padding-top: 0;
    }

    .top-banner-wrapper:not(.expanded) .countdown-day-separator {
        display: none;
    }

    .mobile-banner-toggle {
        background: transparent;
        border: 0;
        cursor: pointer;
        display: flex;
        height: var(--mobile-banner-height, 32px);
        justify-content: flex-end;
        padding: 0;
        position: absolute;
        right: 0;
        top: 0;
        width: 100%;
        z-index: 3;
    }

    .top-banner-wrapper.expanded .mobile-banner-toggle {
        height: max(44px, 6vw);
        width: var(--mobile-toggle-width);
    }

    /* Cover the arrow embedded in legacy artwork with a stable, stateful control. */
    .mobile-banner-toggle-icon {
        align-items: center;
        background: #111;
        color: #fff;
        display: flex;
        height: 100%;
        justify-content: center;
        width: var(--mobile-toggle-width);
    }

    .top-banner-wrapper.expanded .mobile-banner-toggle-icon {
        width: 100%;
    }

    .mobile-banner-toggle-icon svg {
        height: 24px;
        max-height: 100%;
        width: 24px;
    }

    .mobile-banner-toggle[aria-expanded="true"] svg {
        transform: rotate(180deg);
    }

    .mobile-banner-toggle:focus-visible {
        outline: 2px solid currentColor;
        outline-offset: -2px;
    }

}

/* Desktop styles */
@media (min-width: 768px) {
    .top-banner-wrapper {
        --banner-image-height: 80px;
        position: relative;
    }

    .countdown-dashboard {
        position: absolute;
        inset: 0;
        padding: 0 clamp(8px, 0.625vw, 16px);
    }

    /* Keep boxes smaller than the banner while retaining readable minimums. */
    .countdown-container {
        --countdown-box-height: clamp(32px, 2.5vw, 64px);
        --countdown-box-width: clamp(32px, 2.15vw, 55px);
        --countdown-digit-size: clamp(16px, 1.4vw, 35px);
        --countdown-label-size: clamp(11px, 0.55vw, 14px);
        gap: clamp(2px, 0.1171875vw, 3px);
    }

    .countdown-item {
        padding: 0 clamp(3px, 0.234375vw, 6px);
    }

    .close-banner {
        top: 1rem;
        right: 1rem;
        width: 2rem;
        height: 2rem;
    }
}

/* Large screen styles */
@media (min-width: 1024px) {
    .top-banner-wrapper {
        --banner-image-height: 96px;
    }
}

/* Animation classes */
.slide-fade-enter-active,
.slide-fade-leave-active {
    transition: all 0.5s ease;
}

.slide-fade-enter-from {
    opacity: 0;
    transform: translateX(30px);
}

.slide-fade-leave-to {
    opacity: 0;
    transform: translateX(-30px);
}

/* Accessibility improvements */
.banner-link:focus {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}


/* Print styles */
@media print {
    .top-banner-wrapper {
        display: none;
    }
}

