/* ADA Compliant Popup Modal — modal.css */

/* ── Overlay ─────────────────────────────────────────────────────────────── */
#ada-popup-overlay {
    --ada-overlay-bg: #000000;
    --ada-modal-bg:   #ffffff;
    --ada-text:       #1a1a1a;
    --ada-accent:     #0057b8;
    --ada-radius:     8px;
    --ada-shadow:     0 24px 80px rgba(0, 0, 0, 0.45);

    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;

    background-color: var(--ada-overlay-bg);
    /* Minimum 3:1 contrast for the scrim. Pure black gives maximum contrast. */
    /* We use opacity on the background-color, not the element, so content stays crisp */
    background-color: color-mix(in srgb, var(--ada-overlay-bg) 75%, transparent);

    /* Animate in */
    animation: ada-fade-in 0.25s ease forwards;
}

#ada-popup-overlay.ada-popup-hidden {
    display: none;
}

/* ── Modal Box ───────────────────────────────────────────────────────────── */
.ada-popup-modal {
    position: relative;
    outline: none; /* programmatic focus target — not interactive, no visible ring needed */
    background-color: var(--ada-modal-bg);
    background-image: var(--ada-modal-bg-image, none);
    background-size: cover;
    background-position: center;
    color: var(--ada-text);
    border-radius: var(--ada-radius);
    box-shadow: var(--ada-shadow);
    width: calc(100vw - 2rem);
    max-width: 1200px;
    height: calc(100vh - 2rem);
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    padding: 2rem 1.5rem;

    animation: ada-slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;

    line-height: 1.6;
}

/* ── Full-width variant ──────────────────────────────────────────────────── */
.ada-popup-modal.ada-popup-full-width {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
}

/* ── Decorative florals ──────────────────────────────────────────────────── */
.ada-popup-floral {
    position: absolute;
    width: clamp(120px, 16vw, 240px);
    height: auto;
    pointer-events: none;
    user-select: none;
    display: none; /* hidden on small screens */
}

@media (min-width: 700px) {
    .ada-popup-floral { display: block; }
}

/* Bottom corners */
.ada-popup-floral--bl {
    bottom: 0;
    left: 0;
}
.ada-popup-floral--br {
    bottom: 0;
    right: 0;
}

/* Top corners — flip vertically so stems point inward */
.ada-popup-floral--tl {
    top: 0;
    left: 0;
    transform: scaleY(-1);
}
.ada-popup-floral--tr {
    top: 0;
    right: 0;
    transform: scaleY(-1);
}

/* ── Content Panel (solid bg over background image) ─────────────────────── */
.ada-popup-content-panel {
    background-color: var(--ada-modal-bg);
    border-radius: calc(var(--ada-radius) - 2px);
    padding: 2rem 2rem 1.5rem;
    max-width: 680px;
    margin: 0 auto;
    width: 100%;
}

/* ── Title ───────────────────────────────────────────────────────────────── */
.ada-popup-title {
    margin: 0 0 1rem;
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    font-weight: 700;
    color: var(--ada-text);
    /* padding-right leaves space for X button */
    padding-right: 2.5rem;
    line-height: 1.3;
    text-align: center;
}

/* ── Body ────────────────────────────────────────────────────────────────── */
.ada-popup-body {
    font-size: 1rem;
    color: var(--ada-text);
    margin-bottom: 1.75rem;
    text-align: center;
}

.ada-popup-body p {
    margin: 0 0 1em;
}

.ada-popup-body p:last-child {
    margin-bottom: 0;
}

/* ── Event content styles ────────────────────────────────────────────────── */
/* <address> resets browser italic + uses readable font */
.ada-popup-body address {
    font-style: normal;
    margin: 0.75em 0;
    line-height: 1.7;
}

/* Accessible link color inside the modal body (min 4.5:1 on white) */
.ada-popup-body a {
    color: var(--ada-accent);
    text-underline-offset: 3px;
}

.ada-popup-body a:hover,
.ada-popup-body a:focus {
    text-decoration: none;
}

.ada-popup-body a:focus-visible {
    outline: 3px solid var(--ada-accent);
    outline-offset: 2px;
    border-radius: 2px;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.ada-popup-footer {
    display: flex;
    justify-content: center;
}

/* ── Close Button (primary) ──────────────────────────────────────────────── */
.ada-popup-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--ada-accent);
    color: #ffffff;
    border: 2px solid transparent;
    border-radius: 4px;
    padding: 0.65rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, outline-offset 0.1s ease;
    min-height: 44px; /* WCAG 2.5.5 minimum touch target */
    min-width: 44px;
    font-family: inherit;
}

.ada-popup-btn:hover {
    filter: brightness(1.12);
}

/* ── WCAG 2.4.11 Focus Appearance ─────────────────────────────────────────── */
.ada-popup-btn:focus-visible {
    outline: 3px solid var(--ada-accent);
    outline-offset: 3px;
    box-shadow: 0 0 0 6px rgba(0, 87, 184, 0.25);
}

/* ── Close Icon Button (top-right X) ─────────────────────────────────────── */
.ada-popup-content-panel {
    position: relative; /* anchor for close button */
}

.ada-popup-close-icon {
    position: absolute;
    top: -0.25rem;
    right: -0.25rem;
    background: transparent;
    border: 2px solid transparent;
    border-radius: 4px;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--ada-text);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
    transition: background 0.15s ease;
    font-family: inherit;
}

.ada-popup-close-icon:hover {
    background: rgba(0, 0, 0, 0.07);
}

.ada-popup-close-icon:focus-visible {
    outline: 3px solid var(--ada-accent);
    outline-offset: 3px;
    box-shadow: 0 0 0 6px rgba(0, 87, 184, 0.25);
}

/* ── Animations ──────────────────────────────────────────────────────────── */
@keyframes ada-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes ada-slide-up {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0);    }
}

/* Respect reduced-motion preference (WCAG 2.3.3) */
@media (prefers-reduced-motion: reduce) {
    #ada-popup-overlay,
    .ada-popup-modal {
        animation: none;
    }
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .ada-popup-modal {
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        padding: 2rem 1.25rem 1.5rem;
    }
    .ada-popup-footer {
        justify-content: stretch;
    }
    .ada-popup-btn {
        width: 100%;
    }
}

/* ── High Contrast Mode support ──────────────────────────────────────────── */
@media (forced-colors: active) {
    .ada-popup-btn {
        border: 2px solid ButtonText;
    }
    .ada-popup-close-icon {
        border: 2px solid ButtonText;
    }
}
