/*
 * Content Lightbox — module stylesheet
 *
 * A fixed full-viewport wrapper (moved to <body> by the module JS) holding
 * a dark translucent overlay and a white dialog. Desktop: dialog centred,
 * width capped by --ea-clb-max-width, height grows with the content up to
 * the viewport, then the dialog itself scrolls. Mobile (≤ 690px): dialog
 * fills the screen; the close-button bar is sticky at the top of the
 * scrolling dialog, so the content can never cover it (on desktop too).
 *
 * HOW TO RESTYLE
 * --------------
 * Same contract as pricing-selector: PALETTE tokens (base colours, fonts,
 * radii) and ELEMENTS tokens (one per element) on .ea-content-lightbox;
 * the rules below only consume tokens.
 *
 * Salient hardening: the close <button> carries !important on background /
 * border / border-radius / box-shadow / color because the theme styles
 * button globally (border-radius 200px !important etc.). The content area
 * is outside Salient's .row wrappers once moved to <body>, so it only needs
 * its own typography, not resets against row selectors.
 */

/* 1. PALETTE ----------------------------------------------------------- */

.ea-content-lightbox {
    --ea-clb-font-heading: 'Poppins', sans-serif;
    --ea-clb-font-body: 'Lato', sans-serif;

    --ea-clb-green: #00634c;
    --ea-clb-green-dark: #004f38;
    --ea-clb-white: #ffffff;
    --ea-clb-grey: #f2f2f2;
    --ea-clb-grey-line: #e3e3e3;
    --ea-clb-text: #2b2b2b;
    --ea-clb-text-muted: #6b6b6b;

    --ea-clb-radius: 16px;
    --ea-clb-shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 24px 60px rgba(0, 0, 0, 0.2);

    --ea-clb-max-width: 760px;
    --ea-clb-margin: 24px;         /* viewport gap around the dialog on desktop */
    --ea-clb-duration: 200ms;      /* keep in sync with HIDE_DELAY in the JS */
    --ea-clb-z: 100000;
}

/* 2. ELEMENTS ---------------------------------------------------------- */

.ea-content-lightbox {
    --ea-clb-overlay-bg: rgba(17, 28, 25, 0.6);

    --ea-clb-dialog-bg: var(--ea-clb-white);
    --ea-clb-dialog-shadow: var(--ea-clb-shadow);

    --ea-clb-bar-bg: var(--ea-clb-white);

    --ea-clb-close-size: 40px;
    --ea-clb-close-bg: var(--ea-clb-grey);
    --ea-clb-close-color: var(--ea-clb-green);
    --ea-clb-close-hover-bg: var(--ea-clb-green);
    --ea-clb-close-hover-color: var(--ea-clb-white);

    --ea-clb-content-pad: 0 36px 36px;
    --ea-clb-content-color: var(--ea-clb-text);
    --ea-clb-heading-color: var(--ea-clb-text);
    --ea-clb-link-color: var(--ea-clb-green);
}

/* 3. WRAPPER + OVERLAY -------------------------------------------------- */

.ea-content-lightbox {
    position: fixed;
    inset: 0;
    z-index: var(--ea-clb-z);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--ea-clb-margin);
    box-sizing: border-box;
}

.ea-content-lightbox[hidden] {
    display: none !important;
}

.ea-content-lightbox__overlay {
    position: absolute;
    inset: 0;
    background: var(--ea-clb-overlay-bg);
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--ea-clb-duration) ease;
}

/* Page scroll lock while a lightbox is open (class set by the JS) */
html.ea-content-lightbox-lock,
html.ea-content-lightbox-lock body {
    overflow: hidden !important;
}

/* 4. DIALOG ------------------------------------------------------------- */

.ea-content-lightbox__dialog {
    position: relative;
    width: 100%;
    max-width: var(--ea-clb-max-width);
    max-height: 100%;              /* = viewport minus the wrapper padding */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--ea-clb-dialog-bg);
    border-radius: var(--ea-clb-radius);
    box-shadow: var(--ea-clb-dialog-shadow);
    opacity: 0;
    transform: translateY(14px);
    transition: opacity var(--ea-clb-duration) ease, transform var(--ea-clb-duration) ease;
}

.ea-content-lightbox.is-open .ea-content-lightbox__overlay {
    opacity: 1;
}

.ea-content-lightbox.is-open .ea-content-lightbox__dialog {
    opacity: 1;
    transform: none;
}

/* 5. CLOSE BAR ---------------------------------------------------------- */

/* Sticky inside the scrolling dialog: the button stays visible however far
   the content scrolls, on desktop and mobile alike. */
.ea-content-lightbox__bar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    justify-content: flex-end;
    padding: 14px 14px 6px;
    background: var(--ea-clb-bar-bg);
}

.ea-content-lightbox__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--ea-clb-close-size);
    height: var(--ea-clb-close-size);
    padding: 0 !important;
    background: var(--ea-clb-close-bg) !important;
    color: var(--ea-clb-close-color) !important;
    border: none !important;
    border-radius: 50% !important;
    box-shadow: none !important;
    cursor: pointer;
    transition: background-color var(--ea-clb-duration) ease, color var(--ea-clb-duration) ease;
}

.ea-content-lightbox__close:hover,
.ea-content-lightbox__close:focus-visible {
    background: var(--ea-clb-close-hover-bg) !important;
    color: var(--ea-clb-close-hover-color) !important;
}

.ea-content-lightbox__close:focus-visible {
    outline: 2px solid var(--ea-clb-green);
    outline-offset: 2px;
}

.ea-content-lightbox__close-icon {
    display: block;
    width: 16px;
    height: 16px;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 3l10 10M13 3L3 13' stroke='%23000' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / contain;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 3l10 10M13 3L3 13' stroke='%23000' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / contain;
}

/* 6. CONTENT ------------------------------------------------------------ */

.ea-content-lightbox__content {
    padding: var(--ea-clb-content-pad);
    font-family: var(--ea-clb-font-body);
    font-size: 16px;
    line-height: 1.65;
    color: var(--ea-clb-content-color);
}

.ea-content-lightbox__content h1,
.ea-content-lightbox__content h2,
.ea-content-lightbox__content h3,
.ea-content-lightbox__content h4,
.ea-content-lightbox__content h5,
.ea-content-lightbox__content h6 {
    margin: 0 0 0.6em;
    font-family: var(--ea-clb-font-heading);
    color: var(--ea-clb-heading-color);
    line-height: 1.3;
}

.ea-content-lightbox__content p,
.ea-content-lightbox__content ul,
.ea-content-lightbox__content ol {
    margin: 0 0 1em;
}

.ea-content-lightbox__content > :last-child {
    margin-bottom: 0;
}

.ea-content-lightbox__content a {
    color: var(--ea-clb-link-color);
    text-decoration: underline;
}

.ea-content-lightbox__content img {
    max-width: 100%;
    height: auto;
}

/* 7. MOBILE ------------------------------------------------------------- */

@media (max-width: 690px) {
    .ea-content-lightbox {
        padding: 0;
    }

    .ea-content-lightbox__dialog {
        max-width: none;
        height: 100%;
        max-height: none;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }

    .ea-content-lightbox__bar {
        flex-shrink: 0;
    }

    /* Centre short content vertically; auto margins collapse to 0 when the
       content overflows, so long content scrolls normally from the top
       (align-items: center would clip the top instead). */
    .ea-content-lightbox__content {
        padding: 0 20px 28px;
        flex-shrink: 0;
        margin-top: auto;
        margin-bottom: auto;
    }
}

/* 8. REDUCED MOTION ----------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    .ea-content-lightbox__overlay,
    .ea-content-lightbox__dialog,
    .ea-content-lightbox__close {
        transition: none;
    }
}
