/**
 * mod_lwnewsletter — Laserworld newsletter slide-in
 *
 * Every rule is scoped under .lwnl so the module can never leak styling into
 * the surrounding template, and every property the panel relies on is set
 * explicitly so a template reset cannot take it away.
 */

.lwnl {
    --lwnl-navy: #283242;
    --lwnl-navy-deep: #1b2432;
    --lwnl-amber: #ffa000;
    --lwnl-amber-dark: #e08e00;
    --lwnl-paper: #ffffff;
    --lwnl-line: #d3d9e2;
    --lwnl-muted: #5f6b7d;
    --lwnl-danger: #c0392b;
    --lwnl-top: 90px;
    --lwnl-width: 322px;

    position: fixed;
    top: var(--lwnl-top);
    z-index: 9999;
    width: var(--lwnl-width);
    max-width: calc(100vw - 24px);
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--lwnl-navy);
    text-align: left;
    box-sizing: border-box;
}

.lwnl *,
.lwnl *::before,
.lwnl *::after {
    box-sizing: border-box;
}

/* The display values below are explicit, so [hidden] has to be explicit too
   or a hidden spinner keeps its inline-block and stays on screen. */
.lwnl [hidden] {
    display: none !important;
}

.lwnl--right {
    right: 0;
    transform: translateX(calc(100% + 30px));
}

.lwnl--left {
    left: 0;
    transform: translateX(calc(-100% - 30px));
}

.lwnl {
    transition: transform 520ms cubic-bezier(0.22, 0.68, 0.32, 1), opacity 320ms ease;
    opacity: 0;
    will-change: transform;
}

.lwnl.is-open {
    transform: translateX(0);
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    .lwnl {
        transition: opacity 200ms ease;
        transform: none;
    }

    .lwnl--right,
    .lwnl--left {
        transform: none;
    }
}

/* ---------------------------------------------------------------- panel -- */

/* The panel must never run off the bottom of a short viewport; the header
   stays put and the form scrolls inside it instead. */
.lwnl__panel {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - var(--lwnl-top) - 16px);
    overflow: hidden;
    background: var(--lwnl-paper);
    border-radius: 4px 0 0 4px;
    box-shadow: 0 10px 34px rgba(16, 22, 32, 0.26), 0 2px 6px rgba(16, 22, 32, 0.14);
}

.lwnl--left .lwnl__panel {
    border-radius: 0 4px 4px 0;
}

.lwnl__bar {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 10px 10px 14px;
    background: var(--lwnl-navy);
    color: #fff;
}

.lwnl__bar-mark {
    display: block;
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    background: var(--lwnl-amber);
}

.lwnl__bar-title {
    flex: 1 1 auto;
    margin: 0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.lwnl__close {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    color: #fff;
    background: transparent;
    border: 0;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 140ms ease, color 140ms ease;
}

.lwnl__close:hover,
.lwnl__close:focus-visible {
    color: var(--lwnl-navy);
    background: var(--lwnl-amber);
}

.lwnl__body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 18px 18px 16px;
    overflow-y: auto;
}

/* --------------------------------------------------------------- content -- */

.lwnl__title {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--lwnl-navy);
}

.lwnl__intro {
    margin: 0 0 14px;
    font-size: 13px;
    color: var(--lwnl-muted);
}

.lwnl__alert {
    margin: 0 0 12px;
    padding: 9px 11px;
    font-size: 13px;
    color: #7c2318;
    background: #fdecea;
    border-left: 3px solid var(--lwnl-danger);
    border-radius: 2px;
}

.lwnl__field {
    margin: 0 0 11px;
}

.lwnl__label {
    display: block;
    margin: 0 0 4px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--lwnl-navy);
    text-transform: uppercase;
}

.lwnl__req {
    color: var(--lwnl-amber-dark);
}

.lwnl__input {
    display: block;
    width: 100%;
    height: auto;
    margin: 0;
    padding: 9px 10px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.35;
    color: var(--lwnl-navy);
    background: #fff;
    border: 1px solid var(--lwnl-line);
    border-radius: 3px;
    box-shadow: none;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

.lwnl__input:focus {
    border-color: var(--lwnl-amber);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(255, 160, 0, 0.22);
}

.lwnl__input.is-invalid {
    border-color: var(--lwnl-danger);
}

.lwnl__select {
    padding-right: 30px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5l5-5' fill='none' stroke='%23283242' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 11px 7px;
}

/* --------------------------------------------------------------- captcha -- */

.lwnl__captcha {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
}

/* The PNG is 400x130 and is shown at roughly half that, so it stays sharp on
   high-density screens. height:auto keeps the aspect ratio whatever width the
   panel ends up with. */
.lwnl__captcha-img {
    flex: 1 1 auto;
    display: block;
    width: 100%;
    max-width: 216px;
    height: auto;
    border-radius: 3px;
}

.lwnl__captcha-reload {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    color: var(--lwnl-muted);
    background: transparent;
    border: 1px solid var(--lwnl-line);
    border-radius: 3px;
    cursor: pointer;
    transition: color 140ms ease, border-color 140ms ease;
}

.lwnl__captcha-reload:hover,
.lwnl__captcha-reload:focus-visible {
    color: var(--lwnl-navy);
    border-color: var(--lwnl-amber);
}

.lwnl__captcha-reload.is-busy {
    opacity: 0.5;
    pointer-events: none;
}

.lwnl__captcha-input {
    width: 100%;
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    text-indent: 0.3em;
}

/* ---------------------------------------------------------------- submit -- */

.lwnl__submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin: 14px 0 0;
    padding: 11px 14px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--lwnl-navy);
    text-transform: uppercase;
    background: var(--lwnl-amber);
    border: 1px solid var(--lwnl-amber);
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

.lwnl__submit:hover,
.lwnl__submit:focus-visible {
    color: #fff;
    background: var(--lwnl-navy);
    border-color: var(--lwnl-navy);
}

.lwnl__submit[disabled] {
    cursor: default;
    opacity: 0.65;
}

.lwnl__consent {
    margin: 11px 0 0;
    font-size: 11.5px;
    line-height: 1.45;
    color: var(--lwnl-muted);
}

.lwnl__consent a {
    color: var(--lwnl-muted);
    text-decoration: underline;
    text-decoration-color: var(--lwnl-amber);
    text-underline-offset: 2px;
}

.lwnl__consent a:hover {
    color: var(--lwnl-navy);
}

/* --------------------------------------------------------------- honeypot -- */

.lwnl__hp {
    position: absolute !important;
    left: -9999px !important;
    top: auto !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
}

/* ---------------------------------------------------------------- states -- */

.lwnl__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 168px;
}

.lwnl__spinner {
    display: inline-block;
    width: 22px;
    height: 22px;
    border: 2px solid rgba(40, 50, 66, 0.2);
    border-top-color: var(--lwnl-amber);
    border-radius: 50%;
    animation: lwnl-spin 700ms linear infinite;
}

.lwnl__spinner--button {
    width: 15px;
    height: 15px;
    border-color: rgba(40, 50, 66, 0.25);
    border-top-color: var(--lwnl-navy);
}

@keyframes lwnl-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .lwnl__spinner {
        animation-duration: 2s;
    }
}

.lwnl__done {
    padding: 8px 0 4px;
    text-align: center;
}

.lwnl__done-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    margin: 0 0 12px;
    color: var(--lwnl-navy);
    background: var(--lwnl-amber);
    border-radius: 50%;
}

.lwnl__done .lwnl__intro {
    margin-bottom: 0;
}

/* ---------------------------------------------------------------- mobile -- */

@media (max-width: 640px) {
    .lwnl {
        top: auto;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        bottom: 0;
        transform: translateY(100%);
    }

    .lwnl--right,
    .lwnl--left {
        transform: translateY(100%);
    }

    .lwnl.is-open,
    .lwnl--right.is-open,
    .lwnl--left.is-open {
        transform: translateY(0);
    }

    .lwnl__panel,
    .lwnl--left .lwnl__panel {
        max-height: calc(100vh - 16px);
        border-radius: 6px 6px 0 0;
    }

    @media (prefers-reduced-motion: reduce) {
        .lwnl,
        .lwnl--right,
        .lwnl--left {
            transform: none;
        }
    }
}
