/*
 * Roth Pet of the Month — popup shell and admin preview.
 * Tokens are based on the live Roth site: red #ff0000 bar/coupon accent,
 * charcoal #282828 navigation, #454545 headings, #808080 body copy,
 * #f3f3f3 panels, #e5e5e5 borders, white content. The live child-theme
 * #888 CTA is represented by contrast-safe #707070 with white labels.
 */
.roth-pom-popup,
.roth-pom-popup-preview-page__main,
.roth-pom-popup-image-preview {
    --roth-pom-primary: #707070;
    --roth-pom-primary-2: #282828;
    --roth-pom-primary-hover: #000000;
    --roth-pom-secondary: #282828;
    --roth-pom-accent: #FF0000;
    --roth-pom-heading: #FF0000;
    --roth-pom-bg: #F3F3F3;
    --roth-pom-surface: #FFFFFF;
    --roth-pom-border: #E5E5E5;
    --roth-pom-field-border: #888888;
    --roth-pom-text: #454545;
    --roth-pom-text-muted: #707070;
    --roth-pom-ink: var(--roth-pom-text);
    --roth-pom-muted: var(--roth-pom-text-muted);
    --roth-pom-line: var(--roth-pom-border);
    --roth-pom-soft: var(--roth-pom-bg);
    --roth-pom-radius: 0;
    --roth-pom-shadow: 0 12px 34px rgba(40, 40, 40, .22);
}

.roth-pom-popup {
    position: fixed;
    z-index: 100000;
    inset: 50% auto auto 50%;
    display: block;
    box-sizing: border-box;
    width: min(92vw, 880px);
    max-width: 880px;
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid var(--roth-pom-border);
    border-radius: var(--roth-pom-radius);
    background: var(--roth-pom-surface);
    box-shadow: var(--roth-pom-shadow);
    color: var(--roth-pom-text);
    font-family: inherit;
    line-height: 1.5;
    transform: translate(-50%, -50%);
    scrollbar-gutter: stable;
}

.roth-pom-popup *,
.roth-pom-popup *::before,
.roth-pom-popup *::after {
    box-sizing: border-box;
}

.roth-pom-popup:not([open]):not([data-open="true"]) {
    display: none;
}

.roth-pom-popup::backdrop {
    background: rgba(40, 40, 40, .72);
}

.roth-pom-popup[data-open="true"]::before {
    content: none;
}

.roth-pom-popup[data-open="true"] {
    box-shadow: 0 0 0 100vmax rgba(40, 40, 40, .72), var(--roth-pom-shadow);
}

.roth-pom-popup__panel {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, .88fr) minmax(0, 1.12fr);
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 350px;
    isolation: isolate;
    background: var(--roth-pom-bg);
}

.roth-pom-popup__panel--text-only {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
    background: var(--roth-pom-surface);
}

.roth-pom-popup__image {
    position: sticky;
    top: 0;
    display: block;
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    height: 100%;
    min-height: 350px;
    max-height: 480px;
    align-self: start;
    object-fit: contain;
    background: var(--roth-pom-bg);
}

.roth-pom-popup__content {
    grid-column: 2;
    grid-row: 2;
    align-self: start;
    min-width: 0;
    padding: clamp(1.7rem, 4vw, 2.5rem);
    padding-top: 3.5rem;
}

.roth-pom-popup__panel:not(.roth-pom-popup__panel--text-only) .roth-pom-popup__content {
    background: var(--roth-pom-surface);
}

.roth-pom-popup__panel--text-only .roth-pom-popup__content {
    grid-column: 1;
    max-width: 820px;
    padding: 3.5rem clamp(1.5rem, 5vw, 3rem) clamp(1.75rem, 5vw, 3rem);
}

.roth-pom-popup__logo {
    display: block;
    width: min(100%, 300px);
    max-width: 100%;
    height: auto;
    margin: 0 0 1.35rem;
}

.roth-pom-popup__eyebrow {
    max-width: calc(100% - 2.75rem);
    margin: 0 0 .72rem;
    color: var(--roth-pom-primary);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .12em;
    line-height: 1.4;
    text-transform: uppercase;
}

.roth-pom-popup__eyebrow::before {
    display: inline-block;
    width: 1.35rem;
    height: 2px;
    margin: 0 .55rem .2rem 0;
    background: var(--roth-pom-accent);
    content: "";
}

.roth-pom-popup h2 {
    max-width: 17ch;
    margin: 0 2.6rem .8rem 0;
    color: var(--roth-pom-heading);
    font-size: clamp(1.875rem, 3.7vw, 2.375rem);
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1.1;
    text-wrap: balance;
}

.roth-pom-popup__content > p:not(.roth-pom-popup__eyebrow):not(.roth-pom-popup__prize):not(.roth-pom-popup__trust) {
    margin: .72rem 0 1.05rem;
    color: var(--roth-pom-text);
    font-size: .96rem;
    line-height: 1.6;
}

.roth-pom-popup__content .roth-pom-popup__prize {
    margin: 1.05rem 0 .9rem;
    border-left: 3px solid var(--roth-pom-accent);
    border-radius: 0;
    padding: .7rem .9rem;
    background: var(--roth-pom-bg);
    color: var(--roth-pom-secondary);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.45;
}

.roth-pom-popup__trust {
    margin: 1.25rem 0 0;
    padding-top: .9rem;
    border-top: 1px solid var(--roth-pom-line);
    color: var(--roth-pom-text);
    font-size: .78rem;
    line-height: 1.55;
}

.roth-pom-popup__close {
    position: sticky;
    z-index: 4;
    top: .7rem;
    grid-column: 1 / -1;
    grid-row: 1;
    justify-self: end;
    display: inline-grid;
    width: 44px;
    height: 44px;
    margin: .65rem .65rem -3.45rem 0;
    place-items: center;
    border: 1px solid transparent !important;
    border-radius: 0;
    padding: 0;
    background: transparent !important;
    color: var(--roth-pom-primary) !important;
    box-shadow: none !important;
    font: inherit;
    font-size: .9rem;
    line-height: 1;
    cursor: pointer;
    transition: color .16s ease;
}

.roth-pom-popup__close:hover {
    border-color: transparent !important;
    background: transparent !important;
    color: var(--roth-pom-accent) !important;
}

.roth-pom-popup .roth-pom-popup__cta,
.roth-pom-popup .roth-pom-popup__sample-form button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 148px;
    min-height: 46px;
    margin-top: .52rem;
    border: 1px solid #FFFFFF !important;
    border-radius: 0;
    padding: 10px 25px;
    background: var(--roth-pom-primary) !important;
    color: #FFFFFF !important;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 2px;
    line-height: 1.4;
    text-align: center;
    text-decoration: none !important;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color .16s ease, border-color .16s ease, transform .16s ease;
}

.roth-pom-popup .roth-pom-popup__cta:hover,
.roth-pom-popup .roth-pom-popup__sample-form button:not(:disabled):hover {
    border-color: #FFFFFF !important;
    background: var(--roth-pom-primary-hover) !important;
    color: #FFFFFF !important;
}

.roth-pom-popup__cta:active,
.roth-pom-popup__sample-form button:active {
    transform: translateY(0);
}

.roth-pom-popup__cta:disabled,
.roth-pom-popup__sample-form button:disabled {
    cursor: wait;
}

.roth-pom-popup :focus-visible,
.roth-pom-popup-preview-open:focus-visible {
    outline: 3px solid var(--roth-pom-accent);
    outline-offset: 3px;
}

.roth-pom-popup__close:focus-visible {
    outline: 2px solid var(--roth-pom-accent);
    outline-offset: -5px;
}

.roth-pom-popup__form[hidden] {
    display: none !important;
}

/* The dialog is a single scroll viewport; the form has no nested scrollbar. */
.roth-pom-popup__form {
    max-height: none;
    margin-top: 1.3rem;
    overflow: visible;
    overscroll-behavior: auto;
}

.roth-pom-popup__form .roth-pom {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.roth-pom-popup__form .roth-pom__title,
.roth-pom-popup__form .roth-pom__prize {
    display: none;
}

.roth-pom-popup__form .roth-pom__intro {
    margin-bottom: 1.15rem;
}

.roth-pom-popup__sample-form {
    padding: 1.15rem;
    border: 1px solid var(--roth-pom-line);
    border-radius: 0;
    background: var(--roth-pom-bg);
}

.roth-pom-popup__sample-form p {
    margin: 0 0 .9rem;
    color: var(--roth-pom-text);
}

.roth-pom-popup__sample-form label {
    display: block;
    margin: .8rem 0;
    color: var(--roth-pom-secondary);
    font-weight: 700;
}

.roth-pom-popup__sample-form input {
    display: block;
    box-sizing: border-box;
    width: 100%;
    min-height: 46px;
    margin-top: .35rem;
    border: 1px solid var(--roth-pom-field-border);
    border-radius: 0;
    padding: .65rem;
    background: var(--roth-pom-surface);
    color: var(--roth-pom-ink);
    font: inherit;
}

/* Admin preview page and media preview use the same Roth token system. */
.roth-pom-popup-preview-page__main {
    width: min(calc(100% - 2rem), 760px);
    margin: 2rem auto;
    border: 1px solid var(--roth-pom-border);
    border-radius: 0;
    padding: clamp(1.25rem, 4vw, 2rem);
    background: var(--roth-pom-bg);
    color: var(--roth-pom-text);
    font-family: inherit;
    font-size: 16px;
    line-height: 1.55;
}

.roth-pom-popup-preview-open {
    min-height: 46px;
    border: 1px solid #FFFFFF;
    border-radius: 0;
    padding: 10px 25px;
    background: var(--roth-pom-primary);
    color: #FFFFFF;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
}

.roth-pom-popup [hidden] {
    display: none !important;
}

.roth-pom-popup-image-preview img {
    display: block;
    width: 100%;
    max-width: 240px;
    max-height: 180px;
    margin: 0 0 .75rem;
    border: 1px solid var(--roth-pom-border);
    border-radius: 0;
    object-fit: cover;
}

@media (max-width: 767px) {
    .roth-pom-popup {
        width: min(94vw, 520px);
        max-height: calc(100vh - 1rem);
        max-height: calc(100dvh - 1rem);
    }

    .roth-pom-popup__panel {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto auto auto;
        min-height: 0;
    }

    .roth-pom-popup__panel--text-only {
        grid-template-rows: auto minmax(0, 1fr);
    }

    .roth-pom-popup__image {
        position: static;
        grid-column: 1;
        grid-row: 2;
        height: 160px;
        min-height: 0;
        max-height: none;
    }

    .roth-pom-popup__content,
    .roth-pom-popup__panel--text-only .roth-pom-popup__content {
        grid-column: 1;
        grid-row: 3;
        padding: 3.5rem clamp(1.15rem, 5vw, 1.65rem) 1.6rem;
    }

    .roth-pom-popup__panel--text-only .roth-pom-popup__content {
        grid-row: 2;
    }

    .roth-pom-popup__close {
        margin: .55rem .55rem -3.35rem 0;
    }

    .roth-pom-popup h2 {
        font-size: clamp(1.75rem, 8vw, 2.2rem);
    }

    .roth-pom-popup__form {
        margin-top: 1.05rem;
    }

    .roth-pom-popup__form .roth-pom__fields {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 390px) {
    .roth-pom-popup {
        width: calc(100vw - 1rem);
        max-height: calc(100vh - .75rem);
        max-height: calc(100dvh - .75rem);
    }

    .roth-pom-popup__panel {
        grid-template-rows: auto auto auto;
    }

    .roth-pom-popup__panel--text-only {
        grid-template-rows: auto minmax(0, 1fr);
    }

    .roth-pom-popup__image {
        height: 160px;
    }

    .roth-pom-popup__content,
    .roth-pom-popup__panel--text-only .roth-pom-popup__content {
        padding: 3.25rem 1rem 1.25rem;
    }

    .roth-pom-popup h2 {
        margin-right: 2rem;
        font-size: 1.75rem;
    }

    .roth-pom-popup__close {
        margin: .45rem .45rem -3.25rem 0;
    }

    .roth-pom-popup__cta {
        width: 100%;
        min-height: 52px;
    }
}

@media (max-width: 340px) {
    .roth-pom-popup {
        width: calc(100vw - .75rem);
    }

    .roth-pom-popup__content,
    .roth-pom-popup__panel--text-only .roth-pom-popup__content {
        padding-right: .9rem;
        padding-left: .9rem;
    }

    .roth-pom-popup__form .roth-pom__submit {
        min-width: 0;
        padding-inline: .65rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .roth-pom-popup *,
    .roth-pom-popup *::before,
    .roth-pom-popup *::after,
    .roth-pom-popup-preview-open {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}
