/* =========================================================
   NÜMO — Checkout modal
   Mobile-first:
     • <600px → fullscreen sheet with sticky header + sticky CTA
     • ≥600px → centered modal with breathing room
   Inputs are 16px+ so iOS doesn't auto-zoom on focus.
   ========================================================= */

body.nco-open { overflow: hidden; }

.nco {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: stretch;       /* card fills the overlay on mobile */
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
    font-family: "Manrope", system-ui, sans-serif;
    color: #f4ece4;
}
.nco.is-open { opacity: 1; pointer-events: auto; }

.nco__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(7, 6, 10, .82);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    cursor: pointer;
}

/* ----- The card (single flex column: head / body / foot) ----- */
.nco__card {
    position: relative;
    z-index: 1;
    flex: 1 1 100%;
    display: flex;
    flex-direction: column;
    background: #0c0a0e;
    width: 100%;
    overflow: hidden;
    /* The fullscreen variant aligns to viewport edges (no border, no
       rounded corners). Desktop gets a proper modal frame below. */
}

/* ----- Header (sticky-ish: stays at top of card) ----- */
.nco__head {
    position: relative;
    flex: 0 0 auto;
    padding: 18px 22px 18px;
    padding-top: calc(18px + env(safe-area-inset-top));
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    background: #0c0a0e;
}
.nco__close {
    position: absolute;
    top: calc(14px + env(safe-area-inset-top));
    right: 14px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, .06);
    color: #f4ece4;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .2s ease, transform .15s ease;
}
.nco__close:hover { background: rgba(255, 255, 255, .12); transform: scale(1.05); }
.nco__close:active { transform: scale(0.95); }
.nco__close svg { width: 18px; height: 18px; }

.nco__eyebrow {
    margin: 0 0 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.24em;
    color: #c5704d;
    text-transform: uppercase;
}
.nco__head-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
}
.nco__product {
    margin: 0;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.01em;
    color: #f4ece4;
    /* Soft wrap if the title is long on narrow screens */
    flex: 1 1 auto;
    min-width: 0;
}
.nco__price {
    margin: 0;
    font-weight: 800;
    font-size: 24px;
    color: #f4ece4;
    letter-spacing: 0.01em;
    white-space: nowrap;
    flex: 0 0 auto;
}

/* ----- Scrollable body ----- */
.nco__body {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px 22px 28px;
}

.nco__section {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, .06);
}
.nco__section:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}
/* Express checkout section — Apple/Google/Amazon Pay buttons sit here.
   The element renders nothing when no wallet is available, in which
   case JS toggles [hidden] on this section and the layout collapses. */
.nco__section--express {
    background: rgba(197, 112, 77, .04);
    border: 1px solid rgba(197, 112, 77, .14);
    border-radius: 10px;
    padding: 14px 16px 0;
    margin-bottom: 18px;
}
.nco__section--express .nco__legend {
    margin-bottom: 12px;
    color: #c5704d;
}
.nco__section--express .nco__pay-mount { margin-bottom: 12px; }
.nco__separator {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #8e827a;
    padding: 14px 0 6px;
}
.nco__separator::before,
.nco__separator::after {
    content: "";
    flex: 1 1 auto;
    height: 1px;
    background: rgba(255, 255, 255, .08);
}
.nco__legend {
    margin: 0 0 14px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.22em;
    color: #8e827a;
    text-transform: uppercase;
}

/* ----- Form fields ----- */
.nco__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}
.nco__field > span {
    font-size: 13px;
    color: #c8bdb1;
    letter-spacing: 0.02em;
}
.nco__field > span em { color: #8e827a; font-style: normal; }

.nco__field input,
.nco__field select {
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid rgba(255, 255, 255, .14);
    background: #07060a;
    color: #f4ece4;
    font: inherit;
    /* 16px keeps iOS from auto-zooming on focus */
    font-size: 16px;
    line-height: 1.2;
    padding: 14px 14px;
    border-radius: 8px;
    min-height: 50px;
    transition: border-color .15s ease, background .15s ease;
    width: 100%;
}
.nco__field select {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='8' viewBox='0 0 14 8' fill='none' stroke='%23c8bdb1' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><polyline points='1,1 7,7 13,1'/></svg>");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 38px;
    cursor: pointer;
}
.nco__field select option {
    background: #0c0a0e;
    color: #f4ece4;
}
.nco__field input:focus,
.nco__field select:focus {
    outline: none;
    border-color: #c5704d;
    background: #0a0810;
    box-shadow: 0 0 0 3px rgba(197, 112, 77, .18);
}
.nco__field input:invalid:not(:placeholder-shown) {
    border-color: rgba(227, 107, 107, .5);
}
.nco__row {
    display: flex;
    gap: 12px;
}
.nco__field--grow { flex: 1 1 auto; min-width: 0; }
.nco__field--cp   { flex: 0 0 40%; }

/* Stripe PaymentElement mount */
.nco__pay-mount { min-height: 80px; }

/* ----- Footer (sticky-ish: stays at bottom of card) ----- */
.nco__foot {
    flex: 0 0 auto;
    padding: 14px 22px;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255, 255, 255, .08);
    background: #0c0a0e;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nco__error {
    margin: 0;
    padding: 10px 14px;
    background: rgba(227, 107, 107, .12);
    border: 1px solid rgba(227, 107, 107, .3);
    border-radius: 8px;
    color: #f4c3c3;
    font-size: 13.5px;
    line-height: 1.4;
    display: none;
}
.nco__error.is-shown { display: block; }

.nco__submit {
    margin: 0;
    padding: 16px 28px;
    min-height: 54px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(180deg, #d88a63, #c5704d);
    color: #fff;
    font-family: inherit;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 14px 30px -12px rgba(197, 112, 77, .45);
    transition: transform .15s ease, box-shadow .2s ease, opacity .15s ease;
    position: relative;
    overflow: hidden;
}
.nco__submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 20px 40px -12px rgba(197, 112, 77, .55);
}
.nco__submit:active:not(:disabled) { transform: translateY(1px); }
.nco__submit:disabled { opacity: 0.7; cursor: progress; }

.nco__submit-spinner {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2.5px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: nco-spin .8s linear infinite;
}
.nco__submit.is-loading .nco__submit-label { visibility: hidden; }
.nco__submit.is-loading .nco__submit-spinner { display: block; }
@keyframes nco-spin { to { transform: rotate(360deg); } }

.nco__legal {
    margin: 0;
    font-size: 11px;
    letter-spacing: 0.04em;
    color: #8e827a;
    text-align: center;
    line-height: 1.4;
}

/* ===== Desktop = centered modal ===== */
@media (min-width: 600px) {
    .nco {
        align-items: flex-start;
        padding: 48px 16px;
    }
    .nco__card {
        flex: 0 0 auto;
        max-width: 480px;
        max-height: calc(100dvh - 96px);
        max-height: calc(100vh - 96px);
        border-radius: 14px;
        border: 1px solid rgba(255, 255, 255, .08);
        box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .7);
    }
    .nco__head { padding-top: 22px; }
    .nco__close { top: 14px; right: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    .nco, .nco__submit, .nco__close { transition: none; }
    .nco__submit-spinner { animation: none; }
}
