/* Launch popup — template-parts/launch-popup.php, js/launch-popup.js. */

.sc-launch {
    --sc-launch-ink: #362c25;
    --sc-launch-muted: rgba(54, 44, 37, 0.7);
    --sc-launch-accent: #8c6f58;
    --sc-launch-bg: #ede5e0;
    --sc-launch-field: #f4eee9;
    --sc-launch-line: #dccfc4;
    --sc-launch-button: #362c25;
    --sc-launch-button-text: #ede5e0;

    position: fixed;
    inset: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;

    /* The only animation: the whole popup fades in and out. */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0s linear 0.5s;
    will-change: opacity;
    font-family: "Jost", system-ui, sans-serif;
    color: var(--sc-launch-ink);
}

.sc-launch.is-open {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s ease, visibility 0s linear 0s;
}

html.sc-launch-open {
    overflow: hidden;
}

.sc-launch__overlay {
    position: absolute;
    inset: 0;
    background: rgba(54, 44, 37, 0.6);
}

.sc-launch__dialog {
    position: relative;
    display: grid;
    grid-template-columns: 39% 1fr;
    width: 100%;
    max-width: 920px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    background: var(--sc-launch-bg);
    box-shadow: 0 30px 80px rgba(54, 44, 37, 0.3);
}

/* Theme button styles carry an element + class, so these need the extra
   .sc-launch and !important to keep the icon from being squeezed to 0px. */
.sc-launch .sc-launch__close {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px !important;
    height: 44px !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin: 0;
    border: 0 !important;
    border-radius: 50%;
    background: transparent !important;
    color: var(--sc-launch-ink) !important;
    line-height: 1;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.sc-launch .sc-launch__close svg {
    flex: none;
    display: block;
    width: 22px;
    height: 22px;
}

.sc-launch .sc-launch__close:hover {
    opacity: 0.6;
}

.sc-launch .sc-launch__close:focus-visible {
    outline: 2px solid var(--sc-launch-accent);
    outline-offset: 2px;
}

.sc-launch__media {
    position: relative;
    min-height: 100%;
    overflow: hidden;
}

.sc-launch__media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* After a successful claim the code panel fades in where the form was. */
.sc-launch__success:not([hidden]) {
    animation: sc-launch-fade 0.5s ease both;
}

@keyframes sc-launch-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.sc-launch__content {
    padding: 64px 48px 56px;
}

.sc-launch__eyebrow {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 30px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--sc-launch-accent);
}

.sc-launch__eyebrow::before {
    content: "";
    width: 32px;
    height: 1px;
    background: currentColor;
}

.sc-launch .sc-launch__title {
    margin: 0 0 26px;
    font-family: "Lora", Georgia, serif !important;
    font-size: 44px !important;
    font-weight: 400 !important;
    line-height: 1.05em !important;
    color: var(--sc-launch-ink);
}

.sc-launch__text {
    margin: 0 0 30px;
    font-size: 16px;
    line-height: 1.65;
    color: var(--sc-launch-muted);
}

.sc-launch__text strong {
    font-weight: 500;
    color: var(--sc-launch-ink);
}

.sc-launch__label {
    display: block;
    margin-bottom: 10px;
    font-size: 13px;
    color: var(--sc-launch-ink);
}

.sc-launch .sc-launch__input {
    display: block;
    width: 100%;
    min-height: 52px;
    margin: 0 0 12px;
    padding: 12px 16px;
    border: 1px solid var(--sc-launch-line);
    border-radius: 0;
    background: var(--sc-launch-field);
    font-family: inherit;
    font-size: 15px;
    color: var(--sc-launch-ink);
    transition: border-color 0.3s ease;
}

.sc-launch .sc-launch__input:focus {
    border-color: var(--sc-launch-ink);
    outline: none;
}

.sc-launch__hp {
    position: absolute !important;
    left: -9999px !important;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.sc-launch .sc-launch__submit {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: 12px 20px;
    border: 0;
    border-radius: 0;
    background: var(--sc-launch-button);
    color: var(--sc-launch-button-text);
    font-family: inherit;
    font-size: 12px;
    line-height: 20px;
    text-align: center;
    text-decoration: none;
    font-weight: 400;
    letter-spacing: 2.4px;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.3s ease;
}

.sc-launch .sc-launch__submit:hover,
.sc-launch .sc-launch__submit:focus-visible {
    background: var(--sc-launch-accent);
    color: var(--sc-launch-button-text);
}

/* Image on the right */
.sc-launch--image-right .sc-launch__dialog {
    grid-template-columns: 1fr 39%;
}

.sc-launch--image-right .sc-launch__media {
    order: 2;
}

/* No image: a narrower single column */
.sc-launch--image-none .sc-launch__dialog {
    grid-template-columns: 1fr;
    max-width: 600px;
}

.sc-launch .sc-launch__submit:disabled {
    opacity: 0.7;
    cursor: wait;
}

.sc-launch__feedback {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
}

.sc-launch__feedback.is-error {
    margin-top: 12px;
    color: #a33a2c;
}

.sc-launch__code {
    margin: 0 0 20px;
    padding: 16px;
    border: 1px dashed var(--sc-launch-accent);
    background: var(--sc-launch-field);
    font-size: 22px;
    font-weight: 500;
    letter-spacing: 3px;
    text-align: center;
    color: var(--sc-launch-ink);
    user-select: all;
}

.sc-launch__note {
    margin: 18px 0 0;
    font-size: 12px;
    color: var(--sc-launch-muted);
}

@media (max-width: 767px) {
    .sc-launch {
        padding: 12px;
    }

    .sc-launch .sc-launch__dialog {
        grid-template-columns: 1fr;
        max-height: calc(100vh - 24px);
    }

    .sc-launch--image-right .sc-launch__media {
        order: 0;
    }

    /* Without a photo behind it the close button needs no circle. */
    .sc-launch.sc-launch--image-none .sc-launch__close {
        background: transparent !important;
        box-shadow: none;
    }

    .sc-launch__media {
        height: var(--sc-launch-mobile-h, 220px);
        min-height: 0;
    }

    .sc-launch__media img {
        object-position: center 15%;
    }

    /* Over the photo on phones, so it gets a solid circle to stay visible. */
    .sc-launch .sc-launch__close {
        top: 12px;
        right: 12px;
        width: 40px !important;
        height: 40px !important;
        background: rgba(237, 229, 224, 0.92) !important;
        box-shadow: 0 4px 14px rgba(54, 44, 37, 0.18);
    }

    .sc-launch .sc-launch__close svg {
        width: 16px;
        height: 16px;
    }

    .sc-launch__content {
        padding: 32px 24px 28px;
    }

    .sc-launch__eyebrow {
        margin-bottom: 18px;
    }

    .sc-launch .sc-launch__title {
        margin-bottom: 16px;
        font-size: 30px !important;
    }

    .sc-launch__text {
        margin-bottom: 22px;
        font-size: 15px;
    }
}

@media (max-width: 767px) and (max-height: 700px) {
    .sc-launch__media {
        height: min(var(--sc-launch-mobile-h, 220px), 150px);
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .sc-launch--image-left .sc-launch__dialog {
        grid-template-columns: 36% 1fr;
    }

    .sc-launch--image-right .sc-launch__dialog {
        grid-template-columns: 1fr 36%;
    }

    .sc-launch__content {
        padding: 56px 36px 44px;
    }

    .sc-launch .sc-launch__title {
        font-size: 36px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sc-launch,
    .sc-launch *,
    .sc-launch.is-open,
    .sc-launch.is-open * {
        transition-duration: 0s !important;
        transition-delay: 0s !important;
        animation: none !important;
    }
}

/* Image on the right puts the close button over the photo. */
.sc-launch.sc-launch--image-right .sc-launch__close {
    background: rgba(237, 229, 224, 0.92) !important;
    box-shadow: 0 4px 14px rgba(54, 44, 37, 0.18);
}
