/* ==========================================================================
   K2H THEME · POPUP  (includes/partials/popup.php + popup.js)
   Native <dialog>; works with or without the festive extras.
   ========================================================================== */

.k2h-popup {
    width: min(92vw, 560px);
    max-width: none;
    max-height: none;
    margin: auto;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--k2h-on-dark);
    overflow: visible;
}
.k2h-popup:not([open]) { display: none; }

.k2h-popup::backdrop {
    background: rgba(5, 13, 26, .78);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.k2h-popup__panel {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--k2h-navy-800);
    border: 1px solid rgba(232, 207, 148, .55);
    box-shadow: 0 40px 100px -20px rgba(0, 0, 0, .8);
}
.k2h-popup__panel::before {          /* inner gold hairline */
    content: "";
    position: absolute;
    inset: 6px;
    border: 1px solid rgba(232, 207, 148, .25);
    pointer-events: none;
}

.k2h-popup__media { display: block; line-height: 0; }
.k2h-popup__media img {
    display: block;
    width: 100%;
    height: auto;
    max-height: calc(100dvh - 150px);
    object-fit: contain;
    background: var(--k2h-navy-900);
}

.k2h-popup__actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    padding: 14px;
}
.k2h-popup__actions .k2h-btn { min-height: 48px; }

.k2h-popup__close {
    position: absolute;
    top: -16px;
    right: -16px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    padding: 0;
    border: 1px solid var(--k2h-gold-300);
    border-radius: 50%;
    background: var(--k2h-crimson-600);
    color: #FFFFFF;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(0, 0, 0, .5);
    transition: transform var(--k2h-dur) var(--k2h-ease), background-color var(--k2h-dur) ease;
}
.k2h-popup__close:hover { transform: rotate(90deg); background: var(--k2h-crimson-500); }

/* open / close animation (popup.js toggles .is-visible) */
.k2h-popup[open] .k2h-popup__panel {
    opacity: 0;
    transform: translateY(24px) scale(.96);
    transition: opacity .45s var(--k2h-ease), transform .45s var(--k2h-ease);
}
.k2h-popup.is-visible .k2h-popup__panel { opacity: 1; transform: none; }

@media (max-width: 575.98px) {
    .k2h-popup { width: calc(100vw - 32px); }
    .k2h-popup__close { top: -12px; right: -8px; }
    .k2h-popup__media img { max-height: calc(100dvh - 170px); }
}

/* lock page scroll while open */
html.k2h-popup-open { overflow: hidden; }

@media (max-width: 575.98px) {
    .k2h-popup__actions { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 10px; }
    .k2h-popup__actions .k2h-btn { min-height: 46px; padding-inline: 8px; font-size: .72rem; letter-spacing: .08em; }
}
