/* ============================================================
   CWP Popin
   ============================================================ */

/* Overlay */
.cwp-popin {
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.cwp-popin[hidden] {
    display: none;
}

.cwp-popin__overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 27, 29, 0.95);
    cursor: pointer;
}

/* Dialog */
.cwp-popin__dialog {
    position: relative;
    z-index: 1;
    width: fit-content;
    min-width: 400px;
    max-width: min(780px, calc(100vw - 32px));
    min-height: 400px;
    max-height: 90dvh;
    overflow: hidden;
    border-radius: 0;
    background: var(--color-black);
    display: flex;
    flex-direction: column;
}

/* Background image */
.cwp-popin__bg {
    position: absolute;
    inset: 0;
    margin: 0;
    overflow: hidden;
}

.cwp-popin__bg-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    opacity: 0.45;
}

/* Body */
.cwp-popin__body {
    position: relative;
    z-index: 1;
    padding: 48px 60px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0;
    overflow-y: auto;
    max-height: 90dvh;
    flex: 1;
}

/* Title */
.cwp-popin__title {
    font-family: "Bebas Neue", sans-serif;
    font-size: clamp(28px, 5vw, 42px);
    font-weight: 400;
    color: var(--color-white);
    line-height: 1.1;
    text-transform: uppercase;
}

/* Content */
.cwp-popin__content {
    color: var(--color-white);
    font-size: 15px;
    line-height: 1.65;
}

.cwp-popin__content p {
    margin-bottom: 10px;
}

.cwp-popin__content p:last-child {
    margin-bottom: 0;
}

.cwp-popin__content a {
    color: var(--color-primary);
    text-decoration: underline;
}

.cwp-popin__content .popin-text--lg,
.cwp-popin__content .popin-text--md,
.cwp-popin__content .popin-text--sm {
    font-family: "Bebas Neue", sans-serif;
    font-weight: 400;
    text-transform: uppercase;
}

.cwp-popin__content .popin-text--lg {
    font-size: clamp(28px, 4vw, 45px);
    line-height: 1.2;
}

.cwp-popin__content .popin-text--md {
    font-size: clamp(18px, 2.5vw, 25px);
    line-height: 1.45;
}

.cwp-popin__content .popin-text--sm {
    font-size: 12px;
    line-height: 1.6;
}

/* Button */
.cwp-popin__btn {
    align-self: center;
    width: auto;
    overflow: visible;
    margin-top: 20px;
}

.cwp-popin__btn:hover,
.cwp-popin__btn:focus-visible {
    background: var(--color-black);
    color: var(--color-white);
    width: auto;
}

.cwp-popin__btn span:nth-child(1) {
    display: inline;
}

/* Close button */
.cwp-popin__close {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-white);
    background: none;
    outline: none;
    cursor: pointer;
    transition: color 0.15s ease;
}

.cwp-popin__close:hover svg * {
    fill: var(--color-primary);
}

.cwp-popin__close:focus-visible {
    color: var(--color-white);
    outline: none;
}

.cwp-popin__close:focus {
    outline: none;
}

.cwp-popin__close:focus-visible {
  outline: none;
}

/* Focus visible for links/buttons inside */
.cwp-popin__body a:focus-visible,
.cwp-popin__btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 3px;
}

/* Scroll lock on body */
body[data-popin-open] {
    overflow: hidden;
}

/* Screen-reader only */
.cwp-popin .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Animations */
@media (prefers-reduced-motion: no-preference) {
    .cwp-popin {
        animation: cwpPopinFadeIn 0.2s ease both;
    }

    .cwp-popin__dialog {
        animation: cwpPopinSlideUp 0.25s ease both;
    }

    .cwp-popin[hidden] {
        animation: none;
    }
}

@keyframes cwpPopinFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes cwpPopinSlideUp {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* Responsive */
@media (max-width: 500px) {
    .cwp-popin__dialog {
        width: 100%;
        min-width: 0;
        min-height: 300px;
    }

    .cwp-popin__body {
        padding: 40px 28px 28px;
    }

    .cwp-popin__content .popin-text--lg {
        font-size: 28px;
    }

    .cwp-popin__content .popin-text--md {
        font-size: 18px;
    }
}
