/**
 * ARX Popup - Frontend Styles
 * Version: 1.5.0
 * RGAA compliant styles
 */

:root {
    --arx-popup-primary-color: #2271b1;
    --arx-popup-button-bg: #2271b1;
    --arx-popup-button-bg-hover: #135e96;
    --arx-popup-button-text: #ffffff;
    --arx-popup-text-color: #1d2327;
    --arx-popup-overlay-opacity: 0.7;
    --arx-popup-animation-duration: 300ms;
    --arx-popup-close-size: 12px;
    --arx-popup-close-bg: transparent;
    --arx-popup-divi-width: 80vw;
    --arx-popup-divi-height: 80vh;
    --arx-popup-title-size: 28px;
    --arx-popup-text-size: 16px;
    --arx-popup-button-size: 16px;
    --arx-popup-picto-size: 48px;
    --arx-popup-title-color: #2271b1;
    --arx-popup-button-color: #2271b1;
    --arx-popup-picto-color: #2271b1;
}

.arx-popup-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.arx-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background-color: rgba(0, 0, 0, var(--arx-popup-overlay-opacity));
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--arx-popup-animation-duration) ease-in-out,
                visibility var(--arx-popup-animation-duration) ease-in-out;
}

.arx-popup-overlay.arx-popup-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.arx-popup-container {
    position: relative;
    max-width: 720px;
    width: 100%;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    transform: translateY(12px) scale(0.985);
    transition: transform var(--arx-popup-animation-duration) ease-in-out;
}

.arx-popup-overlay.arx-popup-active .arx-popup-container {
    transform: translateY(0) scale(1);
}

.arx-popup-content,
.arx-popup-shortcode-inner {
    position: relative;
    background: #ffffff;
    box-shadow: 0 18px 55px rgba(0, 0, 0, 0.28);
    overflow: hidden;
}

.arx-popup-content {
    padding: 0;
}

.arx-popup-shortcode {
    position: relative;
    margin: 1.5rem 0;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

.arx-popup-shortcode.arx-popup-shortcode-hidden {
    display: none;
}

.arx-popup-shortcode-inner {
    border: 1px solid color-mix(in srgb, var(--arx-popup-primary-color) 24%, transparent);
    border-radius: 8px;
}

.arx-popup-close,
.arx-popup-shortcode-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 11px;
    border: none;
    border-radius: 999px;
    background-color: var(--arx-popup-close-bg, transparent);
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.arx-popup-close:hover,
.arx-popup-shortcode-close:hover {
    /* Preserve configured close background; use opacity/scale for feedback. */
    background-color: var(--arx-popup-close-bg, transparent);
    opacity: 0.85;
    transform: scale(1.05);
}

.arx-popup-close:focus-visible,
.arx-popup-button:focus-visible,
.arx-popup-shortcode-close:focus-visible {
    outline: 3px solid var(--arx-popup-primary-color);
    outline-offset: 3px;
}

.arx-popup-close img,
.arx-popup-shortcode-close img {
    width: var(--arx-popup-close-size, 12px);
    height: var(--arx-popup-close-size, 12px);
    display: block;
    object-fit: contain;
}

.arx-popup-preview-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 5;
    padding: 4px 10px;
    border-radius: 4px;
    background: #1d2327;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.arx-popup-media--banner {
    background: var(--arx-popup-primary-color);
    max-height: var(--arx-popup-image-size, 280px);
    overflow: hidden;
}

.arx-popup-media--banner img {
    display: block;
    width: 100%;
    height: auto;
    max-height: var(--arx-popup-image-size, 280px);
    object-fit: cover;
}

.arx-popup-media--inline {
    margin: 16px 0;
    max-width: 100%;
}

.arx-popup-media--inline img {
    display: block;
    max-width: 100%;
    height: auto;
    max-height: var(--arx-popup-image-size, 320px);
    border-radius: 6px;
    object-fit: contain;
}

.arx-popup-body {
    padding: 38px 42px 40px;
}

.arx-popup-body--align-center {
    text-align: center;
}

.arx-popup-body--align-center .arx-popup-picto,
.arx-popup-body--align-center .arx-popup-media--inline {
    margin-left: auto;
    margin-right: auto;
}

.arx-popup-body--align-center .arx-popup-media--inline img {
    margin-left: auto;
    margin-right: auto;
}

.arx-popup-picto {
    display: block;
    width: var(--arx-popup-picto-size, 48px);
    height: var(--arx-popup-picto-size, 48px);
    margin: 0 0 16px;
    background-color: var(--arx-popup-picto-color, var(--arx-popup-primary-color));
    mask: var(--arx-popup-picto-mask) center / contain no-repeat;
    -webkit-mask: var(--arx-popup-picto-mask) center / contain no-repeat;
}

.arx-popup-title {
    margin: 0 50px 18px 0;
    color: var(--arx-popup-title-color, var(--arx-popup-primary-color));
    font-size: var(--arx-popup-title-size, 28px);
    line-height: 1.2;
}

.arx-popup-body--align-center .arx-popup-title {
    /* Keep side gutters so the title does not collide with the close button. */
    margin-right: 50px;
    margin-left: 50px;
}

.arx-popup-text {
    margin-bottom: 0;
    color: var(--arx-popup-text-color);
    font-size: var(--arx-popup-text-size, 16px);
    line-height: 1.6;
}

/* Force inheritance so theme `p` / list rules cannot override popup text settings. */
.arx-popup-text p,
.arx-popup-text li {
    color: inherit;
    font-size: inherit;
    line-height: inherit;
}

.arx-popup-text > :first-child {
    margin-top: 0;
}

.arx-popup-text > :last-child {
    margin-bottom: 0;
}

.arx-popup-link {
    margin-top: 24px;
}

.arx-popup-body--align-center .arx-popup-link {
    text-align: center;
}

.arx-popup-button {
    display: inline-block;
    padding: 10px 18px;
    border: 2px solid var(--arx-popup-button-color, var(--arx-popup-button-bg));
    border-radius: 5px;
    background-color: var(--arx-popup-button-color, var(--arx-popup-button-bg));
    color: var(--arx-popup-button-text);
    font-size: var(--arx-popup-button-size, 16px);
    font-weight: 700;
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.arx-popup-button:hover {
    background-color: var(--arx-popup-button-bg-hover, var(--arx-popup-button-color, var(--arx-popup-button-bg)));
    border-color: var(--arx-popup-button-bg-hover, var(--arx-popup-button-color, var(--arx-popup-button-bg)));
    color: var(--arx-popup-button-text);
}

.arx-popup-button:active {
    transform: translateY(0);
}

.arx-popup-error {
    color: #dc3232;
    background: #fef7f1;
    border-left: 4px solid #dc3232;
    padding: 12px;
    margin: 20px 0;
}

@media (max-width: 600px) {
    .arx-popup-overlay {
        padding: 12px;
    }

    .arx-popup-container {
        max-height: calc(100vh - 24px);
    }

    .arx-popup-body {
        padding: 32px 24px 28px;
    }

    .arx-popup-title {
        margin-right: 42px;
    }
}

@media print {
    .arx-popup-overlay,
    .arx-popup-close {
        display: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .arx-popup-overlay,
    .arx-popup-container,
    .arx-popup-close,
    .arx-popup-button {
        transition: none;
    }
}

@media (prefers-contrast: high) {
    .arx-popup-content,
    .arx-popup-shortcode-inner {
        border: 2px solid #000000;
    }
}

.arx-is-popup {
    position: relative !important;
    width: var(--arx-popup-divi-width, 80vw);
    height: var(--arx-popup-divi-height, 80vh);
    max-width: var(--arx-popup-divi-width, 80vw);
    max-height: var(--arx-popup-divi-height, 80vh);
    overflow: auto;
}
