/**
 * Announcement Banner / Popup Styles
 * Pairs with js/announcement-banner.js
 */

/* ===== ANNOUNCEMENT OVERLAY ===== */

.announcement-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 300ms ease, visibility 300ms ease;
}

.announcement-overlay[hidden] {
    display: none;
}

.announcement-overlay.is-active {
    opacity: 1;
    visibility: visible;
}

/* Dims the rest of the page */
.announcement-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    cursor: pointer;
    border: none;
    padding: 0;
}

/* ===== DIALOG / IMAGE ===== */

.announcement-dialog {
    position: relative;
    z-index: 1;
    max-width: 90vw;
    max-height: 90vh;
    line-height: 0;
    transform: scale(0.92);
    transition: transform 300ms cubic-bezier(0.22, 0.90, 0.30, 1);
}

/* Makes a load failure obvious instead of silently invisible */
.announcement-dialog.has-error {
    min-width: 280px;
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: #1a1a1a;
    border: 2px dashed #e04b4b;
    border-radius: 8px;
    color: #ffb3b3;
    font: 14px/1.5 sans-serif;
    text-align: center;
}

.announcement-overlay.is-active .announcement-dialog {
    transform: scale(1);
}

/* Image never exceeds the viewport, keeps whatever orientation it naturally is */
.announcement-image {
    display: block;
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* ===== CLOSE BUTTON ===== */

.announcement-close {
    position: absolute;
    top: -14px;
    right: -14px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #fff;
    color: #111;
    font-size: 22px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: transform 150ms ease;
}

.announcement-close:hover,
.announcement-close:focus-visible {
    transform: scale(1.08);
}

@media (max-width: 47.99em) {
    .announcement-close {
        top: 8px;
        right: 8px;
    }
}

/* ===== SOUND TOGGLE BUTTON ===== */

.announcement-sound-btn {
    position: absolute;
    bottom: 16px;
    right: 16px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(15, 23, 42, 0.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    transition: background 200ms ease, transform 150ms ease, border-color 200ms ease;
    user-select: none;
}

.announcement-sound-btn:hover,
.announcement-sound-btn:focus-visible {
    background: rgba(15, 23, 42, 0.95);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.04);
}

.announcement-sound-btn.is-muted {
    background: rgba(15, 23, 42, 0.85);
    border-color: rgba(255, 255, 255, 0.35);
}

.announcement-sound-btn.is-unmuted {
    background: rgba(5, 150, 105, 0.88);
    border-color: rgba(110, 231, 183, 0.6);
}

.announcement-sound-btn.is-unmuted:hover,
.announcement-sound-btn.is-unmuted:focus-visible {
    background: rgba(4, 120, 87, 0.95);
    border-color: rgba(167, 243, 208, 0.8);
}

.announcement-sound-btn .sound-icon {
    display: block;
    flex-shrink: 0;
}

@media (max-width: 47.99em) {
    .announcement-sound-btn {
        bottom: 12px;
        right: 12px;
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* Prevent background scroll while the popup is open */
body.announcement-open {
    overflow: hidden;
}

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

    .announcement-overlay,
    .announcement-dialog {
        transition: none !important;
    }
}