/* Email capture (mu-plugins/mg-email-capture.php) — a pale yellow panel with a
   yellow border and dark text, so it stands apart from the cards around it
   (casino list, callouts) in either theme. Yellow is the site's CTA colour. */

.mg-capture {
    /* On yellow, the "accent" (focus, checkbox, button) is the dark ink. */
    --c-yellow: var(--mg-accent, #f0b82a);
    --c-bg: color-mix(in srgb, var(--c-yellow) 18%, #fff);
    --c-accent: #0e1115;
    --c-accent-text: #0e1115;
    --c-accent-tint: #262b33;
    --c-ink: #0e1115;
    --c-text: #1d1a12;
    --c-muted: #4a3f22; /* ≥8:1 on the pale yellow and the white inputs */
    --c-surface-alt: #fff;
    --c-border: rgb(14 17 21 / 0.15);
    --c-success: var(--mg-success, #1db67e);
    --c-error: #9b1c1c;
    --c-radius: var(--mg-radius, 10px);
    --c-radius-sm: var(--mg-radius-sm, 6px);
    --c-ring: rgb(14 17 21 / 0.25);

    color-scheme: light; /* the panel is light in both themes: native checkbox/select must match */
    font-family: var(--mg-font, Inter, system-ui, sans-serif);
    color: var(--c-text);
    background: var(--c-bg);
    border: 1.5px solid var(--c-yellow);
    border-radius: var(--c-radius);
    padding: 1.75rem 1.5rem;
    display: grid;
    gap: 1.5rem; /* text → fields */
}

.mg-capture--inline {
    margin: 1.5rem 0 2rem;
}

/* Text */
.mg-capture .mg-capture__text {
    display: grid;
    gap: 0.25rem;
}

.mg-capture .mg-capture__eyebrow {
    margin: 0;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--c-accent-text);
}

.mg-capture .mg-capture__title {
    margin: 0;
    font-family: var(--mg-font-display, Anton, "Arial Narrow", Impact, sans-serif);
    font-weight: 400;
    font-size: 1.5rem;
    line-height: 1.1;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    color: var(--c-ink);
}

.mg-capture .mg-capture__lede {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--c-text);
}

/* Form */
.mg-capture .mg-capture__form {
    display: grid;
    gap: 1rem; /* fields → consent */
    margin: 0;
}

.mg-capture .mg-capture__row {
    display: grid;
    gap: 0.5rem;
}

/* Wrapper per control, so anything a browser extension injects beside the
   input (password-manager icons) stays in this cell instead of becoming a
   grid item and pushing the dropdown into the next column. */
.mg-capture .mg-capture__field {
    position: relative;
    min-width: 0;
}

/* Anything injected into the wrapper floats over the field, taking no space. */
.mg-capture .mg-capture__field > :not(.mg-capture__input) {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
}

@media (min-width: 640px) {
    .mg-capture .mg-capture__row {
        grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto;
    }

    /* Pinned, so a stray injected element can't shift the order either. */
    .mg-capture .mg-capture__row > .mg-capture__field--email { grid-column: 1; grid-row: 1; }
    .mg-capture .mg-capture__row > .mg-capture__field--state { grid-column: 2; grid-row: 1; }
    .mg-capture .mg-capture__row > .mg-capture__btn { grid-column: 3; grid-row: 1; }
}

.mg-capture .mg-capture__input {
    width: 100%;
    min-height: 44px;
    margin: 0;
    padding: 0 0.875rem;
    font: inherit;
    font-size: 16px; /* below 16px iOS zooms the page on focus */
    color: var(--c-ink);
    background: var(--c-surface-alt);
    border: 1px solid var(--c-border);
    border-radius: var(--c-radius-sm);
    box-shadow: none;
}

.mg-capture .mg-capture__input::placeholder {
    color: var(--c-muted);
    opacity: 1;
}

.mg-capture .mg-capture__select:invalid,
.mg-capture .mg-capture__select:has(option[value=""]:checked) {
    color: var(--c-muted);
}

.mg-capture .mg-capture__input:focus,
.mg-capture .mg-capture__input:focus-visible {
    outline: none;
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px var(--c-ring);
}

.mg-capture .mg-capture__btn {
    min-height: 44px;
    padding: 0 1.25rem;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--c-yellow) !important; /* the global button rule forces its colour */
    background: var(--c-ink);
    border: 0;
    border-radius: var(--c-radius-sm);
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.mg-capture .mg-capture__btn:hover,
.mg-capture .mg-capture__btn:focus-visible {
    background: var(--c-accent-tint);
    color: var(--c-yellow) !important;
}

.mg-capture .mg-capture__btn:focus-visible {
    outline: 2px solid var(--c-accent);
    outline-offset: 2px;
}

.mg-capture .mg-capture__btn:disabled {
    cursor: progress;
    opacity: 0.7;
}

.mg-capture .mg-capture__btn.is-loading {
    color: transparent !important;
    background:
        radial-gradient(circle closest-side, var(--c-yellow) 90%, transparent) center / 6px 6px no-repeat,
        var(--c-ink);
    animation: mg-capture-pulse 0.9s ease-in-out infinite;
}

@keyframes mg-capture-pulse {
    50% { background-size: 12px 12px, auto; }
}

.mg-capture .mg-capture__consent {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    margin: 0;
    font-size: 0.75rem;
    line-height: 1.45;
    color: var(--c-muted);
    cursor: pointer;
}

.mg-capture .mg-capture__consent input {
    flex: none;
    width: 16px;
    height: 16px;
    margin: 1px 0 0;
    accent-color: var(--c-accent);
}

.mg-capture .mg-capture__consent a {
    color: var(--c-accent-text);
}

.mg-capture .mg-capture__turnstile:empty {
    display: none;
}

/* Messages: client.js shows them by clearing style.display and adding .show */
.mg-capture .mg-capture__msg:not(.show) {
    display: none;
}

.mg-capture .mg-capture__msg--error {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--c-error);
}

.mg-capture .mg-capture__success {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    font-size: 0.9375rem;
    color: var(--c-text);
}

.mg-capture .mg-capture__success strong {
    color: var(--c-ink);
}

.mg-capture .mg-capture__tick {
    flex: none;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-weight: 700;
    color: #fff;
    background: var(--c-success);
}

/* Dock ---------------------------------------------------------------- */

.mg-capture-dock {
    --d-surface: var(--mg-surface, #0e1115);
    --d-border: var(--mg-border, #232830);
    --d-ink: var(--mg-ink, #fafafc);
    --d-muted: var(--mg-muted, #99a3b0);
    --d-accent: var(--mg-accent, #f0b82a);
    --d-accent-text: var(--mg-accent-text, #f0b82a);
    --d-ease: cubic-bezier(0.32, 0.72, 0, 1);
    font-family: var(--mg-font, Inter, system-ui, sans-serif);
}

.mg-capture-dock[hidden] {
    display: none;
}

/* Slim bar: only when the script says so (.is-bar), which it only does on
   mobile, after a scroll, not dismissed, not subscribed. */
.mg-capture-dock__bar {
    position: fixed;
    z-index: 999;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: stretch;
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--d-surface);
    border-top: 1px solid var(--d-border);
    box-shadow: 0 -6px 20px rgb(0 0 0 / 0.25);
    transform: translateY(110%);
    transition: transform 0.25s var(--d-ease);
}

.mg-capture-dock.is-bar:not(.is-tucked):not(.is-open) .mg-capture-dock__bar {
    transform: none;
}

/* Keep the page's last lines clear of the bar. */
html.mg-capture-dock-on body {
    padding-bottom: calc(52px + env(safe-area-inset-bottom));
}

.mg-capture-dock .mg-capture-dock__open {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-height: 52px;
    margin: 0;
    padding: 0 0 0 1rem;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    text-transform: none;
    letter-spacing: normal;
    color: var(--d-ink) !important;
    background: transparent;
    border: 0;
    border-radius: 0;
    cursor: pointer;
}

.mg-capture-dock .mg-capture-dock__icon {
    color: var(--d-accent-text);
    font-size: 16px;
}

.mg-capture-dock .mg-capture-dock__label {
    flex: 1;
    min-width: 0;
}

.mg-capture-dock .mg-capture-dock__cta {
    flex: none;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--d-accent-text);
    border: 1px solid var(--d-accent);
    border-radius: var(--mg-radius-sm, 6px);
}

.mg-capture-dock .mg-capture-dock__x {
    flex: none;
    width: 44px;
    min-height: 44px;
    margin: 0;
    padding: 0;
    font: inherit;
    font-size: 22px;
    line-height: 1;
    color: var(--d-muted) !important;
    background: transparent;
    border: 0;
    border-radius: 0;
    cursor: pointer;
}

.mg-capture-dock .mg-capture-dock__x:hover,
.mg-capture-dock .mg-capture-dock__x:focus-visible {
    color: var(--d-ink) !important;
    background: transparent;
}

/* Slide-up sheet */
.mg-capture-dock__backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgb(0 0 0 / 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.mg-capture-dock.is-open .mg-capture-dock__backdrop {
    opacity: 1;
    pointer-events: auto;
}

.mg-capture.mg-capture-dock__sheet {
    position: fixed;
    z-index: 1001;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: calc(100dvh - 48px);
    overflow-y: auto;
    padding: 1.5rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom));
    border: 0;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -12px 40px rgb(0 0 0 / 0.4);
    transform: translateY(105%);
    visibility: hidden;
    transition: transform 0.3s var(--d-ease), visibility 0s linear 0.3s;
}

.mg-capture-dock.is-open .mg-capture-dock__sheet {
    transform: none;
    visibility: visible;
    transition: transform 0.3s var(--d-ease), visibility 0s;
}

.mg-capture-dock__sheet:focus {
    outline: none;
}

.mg-capture-dock .mg-capture-dock__x--sheet {
    position: absolute;
    top: 6px;
    right: 6px;
}

.mg-capture-dock__sheet .mg-capture__text {
    padding-right: 2rem;
}

/* Opened from the header "Subscribe" item on a wide screen: a card, not a sheet. */
@media (min-width: 769px) {
    .mg-capture-dock__bar {
        display: none;
    }

    .mg-capture.mg-capture-dock__sheet {
        left: 50%;
        right: auto;
        bottom: 24px;
        width: min(560px, calc(100vw - 48px));
        border-radius: var(--mg-radius, 10px);
        transform: translate(-50%, calc(100% + 24px));
    }

    .mg-capture-dock.is-open .mg-capture-dock__sheet {
        transform: translate(-50%, 0);
    }

    .mg-capture-dock__sheet .mg-capture__row {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mg-capture-dock__bar,
    .mg-capture-dock__backdrop,
    .mg-capture.mg-capture-dock__sheet,
    .mg-capture-dock.is-open .mg-capture-dock__sheet {
        transition: none;
    }

    .mg-capture .mg-capture__btn.is-loading {
        animation: none;
    }
}
