.discount-popup {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}

.discount-popup:not([hidden]) {
    display: flex;
}

.discount-popup__backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(20, 22, 14, 0.6);
}

.discount-popup__dialog {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(320px, 480px) minmax(280px, 420px);
    /* The implicit row is auto-sized, so its floor is the tallest item's
       min-content — and .discount-popup__media resolves that to the upload's own
       pixel height (see below). The row then grew past max-height: 90vh and
       overflow: hidden cut the bottom off, taking the submit button and the
       privacy line with it. minmax(0, …) lets the row obey the cap instead. */
    grid-template-rows: minmax(0, 1fr);
    width: 100%;
    max-width: 850px;
    max-height: 90vh;
    overflow: hidden;
    border-radius: 12px;
    background-color: #f1eae1;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
}

.discount-popup__close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background-color: var(--color-cream);
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.discount-popup__close:hover,
.discount-popup__close:focus-visible {
    opacity: 0.7;
}

.discount-popup__close svg {
    display: block;
    width: 16px;
    height: 16px;
}

.discount-popup__content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    padding: clamp(var(--space-5), 5vw, 3rem) clamp(var(--space-4), 4vw, 2.5rem);
    text-align: center;
    overflow-y: auto;
}

.discount-popup__logo {
    display: block;
    align-self: flex-start;
}

.discount-popup__ornament {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    max-width: 200px;
}

.discount-popup__ornament-line {
    flex: 1;
    height: 1px;
    background-color: var(--color-orange-dark);
}

.discount-popup__ornament-icon {
    display: inline-flex;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

.discount-popup__ornament-icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

.discount-popup__heading {
    margin: 0;
    color: var(--color-grey-1);
    font-size: 40px;
    line-height: 1.15;
}

.discount-popup__highlight {
    color: var(--color-orange-dark);
}

.discount-popup__description {
    margin: 0;
    max-width: 24rem;
    color: var(--color-grey-2);
    font-family: var(--font-family-base);
    font-size: 18px;
    line-height: 1.5;
}

.discount-popup__form {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    width: 100%;
    max-width: 24rem;
}

.discount-popup__input-wrap {
    position: relative;
}

.discount-popup__input-icon {
    position: absolute;
    top: 50%;
    left: var(--space-3);
    transform: translateY(-50%);
    display: inline-flex;
    width: 18px;
    height: 18px;
}

.discount-popup__input-icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

.discount-popup__input-icon svg path {
    stroke: var(--color-grey-3);
}

.discount-popup__input {
    width: 100%;
    height: 52px;
    padding-left: calc(var(--space-3) * 2 + 18px);
    padding-right: var(--space-3);
    border: 1px solid #e4dfd2;
    border-radius: 8px;
    background-color: var(--color-cream);
    color: var(--color-grey-1);
    font-family: var(--font-family-base);
    font-size: 16px;
}

.discount-popup__input::placeholder {
    color: var(--color-grey-5);
}

.discount-popup__button {
    height: 52px;
    border: none;
    border-radius: 8px;
    background-color: var(--color-orange-dark);
    color: var(--color-cream);
    font-family: var(--font-family-base);
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.discount-popup__button:hover,
.discount-popup__button:focus-visible {
    opacity: 0.85;
}

.discount-popup__message {
    max-width: 24rem;
    color: var(--color-grey-3);
    font-family: var(--font-family-base);
    font-size: 14px;
    line-height: 1.5;
}

.discount-popup__message.is-error {
    color: var(--color-orange-dark);
}

.discount-popup__privacy {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    margin: 0;
    color: var(--color-grey-3);
    font-family: var(--font-family-base);
    font-size: 13px;
}

.discount-popup__privacy-icon {
    display: inline-flex;
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}

.discount-popup__privacy-icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

.discount-popup__media {
    position: relative;
    /* Without this the grid item's automatic minimum is its content's height,
       and the image below is height: 100% against an indefinite row — which
       counts as auto, so the floor becomes the upload's intrinsic height. That
       is what pushed the dialog past its own max-height. */
    min-height: 0;
    overflow: hidden;
}

.discount-popup__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (max-width: 767px) {
    .discount-popup__dialog {
        grid-template-columns: 1fr;
        max-height: 92vh;
    }

    .discount-popup__media {
        order: -1;
        max-height: 200px;
    }

    .discount-popup__heading {
        font-size: 28px;
    }

    /* Desktop deliberately left-aligns the logo (align-self: flex-start on
       .discount-popup__logo, overriding .discount-popup__content's own
       centered layout) — on the narrow mobile dialog that reads as
       off-center against the rest of the centered content instead. */
    .discount-popup__logo {
        align-self: center;
    }
}
