/* ===========================================================================
   ZERO ID — checkout
   Layers on top of zeroid-theme.css (tokens, nav, buttons, footer).
   =========================================================================== */

/* ---------- Shell ---------- */
.checkout {
    display: grid;
    grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
    min-height: 100vh;
    min-height: 100dvh;
}

@media (max-width:1040px) {
    .checkout {
        grid-template-columns: 1fr;
    }
}

/* ---------- Left: card preview + summary ---------- */
.checkout-aside {
    position: relative;
    padding: clamp(28px, 4vw, 56px);
    border-right: 1px solid var(--line);
    overflow: hidden;
}

@media (min-width:1041px) {
    .checkout-aside {
        position: sticky;
        top: 0;
        height: 100vh;
        height: 100dvh;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
}

@media (max-width:1040px) {
    .checkout-aside {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
}

.checkout-aside::before {
    content: "";
    position: absolute;
    top: -18%;
    left: -12%;
    width: 680px;
    aspect-ratio: 1;
    background: radial-gradient(circle, rgba(206, 255, 12, .12), transparent 62%);
    pointer-events: none;
}

.aside-inner {
    position: relative;
    width: 100%;
    max-width: 460px;
    margin-inline: auto;
}

/* ---------- Card preview ---------- */
.card-stage {
    perspective: 1400px;
    margin-bottom: clamp(24px, 3vw, 36px);
}

/* A real metal card reads through four stacked cues: a milled bevelled edge,
   a fine brushed grain, a moving specular highlight, and type that sits *in*
   the surface rather than on it. Each is a separate layer below. */
.preview-card {
    position: relative;
    width: 100%;
    aspect-ratio: 1.586;
    border-radius: 16px;
    padding: clamp(18px, 3vw, 26px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #fff;
    background: linear-gradient(135deg, #1a1a1a 0%, #000000 100%);
    /* Milled edge: bright top bevel, dark bottom, plus a hairline rim. */
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .28),
        inset 0 -1px 0 rgba(0, 0, 0, .55),
        inset 0 0 0 1px rgba(255, 255, 255, .1),
        0 1px 2px rgba(0, 0, 0, .5),
        0 40px 80px -30px rgba(0, 0, 0, .95);
    transform: rotateX(var(--rx, 5deg)) rotateY(var(--ry, -10deg));
    transform-style: preserve-3d;
    transition: transform 400ms var(--ease), background 300ms var(--ease);
    overflow: hidden;
    will-change: transform;
}

/* Brushed-metal grain — very fine, very low contrast. */
.preview-card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(102deg,
            rgba(255, 255, 255, .045) 0 1px,
            rgba(0, 0, 0, .035) 1px 2px);
    opacity: .7;
    mix-blend-mode: overlay;
}

/* Specular sweep — follows the pointer via --sx. */
.preview-card::after {
    content: "";
    position: absolute;
    inset: -40%;
    pointer-events: none;
    background: linear-gradient(100deg,
            transparent 38%,
            rgba(255, 255, 255, .16) 48%,
            rgba(255, 255, 255, .04) 55%,
            transparent 64%);
    transform: translateX(calc((var(--sx, .5) - .5) * 42%));
    transition: transform 240ms var(--ease);
}

.preview-card.is-light {
    color: #0B0B0D;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .6),
        inset 0 -1px 0 rgba(0, 0, 0, .3),
        inset 0 0 0 1px rgba(0, 0, 0, .12),
        0 1px 2px rgba(0, 0, 0, .4),
        0 40px 80px -30px rgba(0, 0, 0, .9);
}

.preview-card.is-light .mc-label,
.preview-card.is-light .mc-sub {
    color: rgba(0, 0, 0, .55);
}

.card-graphic,
.card-artwork {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

/* Uploaded artwork is laser-etched into the metal, not pasted on top:
   soft-light keeps the surface grain and colour showing through. */
.card-artwork {
    background-repeat: no-repeat;
    background-position: center;
    background-size: 62% auto;
    opacity: .55;
    mix-blend-mode: soft-light;
    filter: drop-shadow(0 1px 0 rgba(255, 255, 255, .25));
}

/* ---------- Engraved type ---------- */
.mc-number,
.mc-name,
.mc-brandmark b {
    text-shadow:
        0 1px 0 rgba(255, 255, 255, .22),
        0 -1px 1px rgba(0, 0, 0, .55);
}

.preview-card.is-light .mc-number,
.preview-card.is-light .mc-name,
.preview-card.is-light .mc-brandmark b {
    text-shadow:
        0 1px 0 rgba(255, 255, 255, .65),
        0 -1px 1px rgba(0, 0, 0, .28);
}

.preview-card>*:not(.card-graphic):not(.card-artwork) {
    position: relative;
    z-index: 1;
}

.mc-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.mc-brand {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.mc-logo svg {
    height: 20px;
    width: auto;
}

/* EMV chip: gold substrate with the real contact-pad layout etched in. */
.mc-chip {
    position: relative;
    width: 46px;
    height: 35px;
    border-radius: 6px;
    background:
        linear-gradient(145deg, #F0E6BC 0%, #C9B978 22%, #9E9670 52%, #D8CDA0 78%, #B3A56F 100%);
    box-shadow:
        inset 0 0 0 1px rgba(0, 0, 0, .28),
        inset 0 1px 0 rgba(255, 255, 255, .5),
        0 1px 2px rgba(0, 0, 0, .45);
    overflow: hidden;
}

/* Horizontal pad separations */
.mc-chip::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to bottom, transparent 30%, rgba(0, 0, 0, .38) 30%, rgba(0, 0, 0, .38) calc(30% + 1px), transparent calc(30% + 1px)),
        linear-gradient(to bottom, transparent 50%, rgba(0, 0, 0, .38) 50%, rgba(0, 0, 0, .38) calc(50% + 1px), transparent calc(50% + 1px)),
        linear-gradient(to bottom, transparent 70%, rgba(0, 0, 0, .38) 70%, rgba(0, 0, 0, .38) calc(70% + 1px), transparent calc(70% + 1px));
}

/* Central contact block + vertical splits */
.mc-chip::after {
    content: "";
    position: absolute;
    inset: 22% 34% 22% 34%;
    border: 1px solid rgba(0, 0, 0, .38);
    border-radius: 2px;
    background:
        linear-gradient(to right, transparent 49%, rgba(0, 0, 0, .3) 49%, rgba(0, 0, 0, .3) 51%, transparent 51%);
}

/* Contactless waves */
.mc-wave {
    display: block;
    color: currentColor;
    opacity: .55;
}

.mc-mid {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mc-number {
    font-family: var(--font-mono);
    font-size: clamp(.95rem, 2.4vw, 1.125rem);
    letter-spacing: .14em;
}

.mc-bottom {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
}

.mc-label {
    font-family: var(--font-mono);
    font-size: 8px;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .5);
    margin-bottom: 4px;
}

.mc-name {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: .02em;
    word-break: break-word;
    transition: font-family 200ms var(--ease);
}

.mc-brandmark {
    text-align: right;
}

.mc-brandmark b {
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: .04em;
    display: block;
}

.mc-sub {
    font-size: 8px;
    letter-spacing: .12em;
    color: rgba(255, 255, 255, .5);
}

/* ---------- Order summary ---------- */
.summary {
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
}

.summary-plan {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
}

.summary-plan img {
    height: 26px;
    width: auto;
}

.summary-badge {
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--lime-soft);
    border: 1px solid rgba(206, 255, 12, .3);
    color: var(--lime);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.summary-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding-block: 12px;
    font-size: .875rem;
    color: var(--fg-muted);
}

.summary-row+.summary-row {
    border-top: 1px solid var(--line);
}

.summary-row b {
    font-family: var(--font-mono);
    color: var(--fg);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.summary-total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-top: 6px;
    padding-top: 16px;
    border-top: 1px solid var(--line-strong);
}

.summary-total>div>span {
    display: block;
}

.summary-total span {
    font-size: .9375rem;
    font-weight: 600;
}

/* Shows the arithmetic behind the total: card price + minimum top-up. */
.summary-calc {
    margin-top: 3px;
    font-family: var(--font-mono);
    font-size: .75rem;
    font-weight: 400;
    color: var(--fg-dim);
    font-variant-numeric: tabular-nums;
}

.summary-total b {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -.03em;
}

.summary-total em {
    font-family: var(--font-mono);
    font-style: normal;
    font-size: .75rem;
    color: var(--lime);
    margin-left: 6px;
}

.summary-note {
    margin-top: 14px;
    font-size: .75rem;
    line-height: 1.5;
    color: var(--fg-dim);
}

/* ---------- Right: form ---------- */
.checkout-main {
    padding: clamp(28px, 4vw, 56px) clamp(20px, 4vw, 56px) clamp(40px, 5vw, 72px);
}

.checkout-form-wrap {
    width: 100%;
    max-width: 560px;
    margin-inline: auto;
}

/* Steps */
.steps {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: clamp(24px, 3vw, 34px);
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--fg-dim);
    list-style: none;
    flex-wrap: wrap;
}

.steps li {
    display: flex;
    align-items: center;
    gap: 8px;
}

.steps i {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid var(--line-strong);
    font-style: normal;
    font-size: 10px;
}

.steps li[aria-current="step"] {
    color: var(--lime);
}

.steps li[aria-current="step"] i {
    background: var(--lime);
    border-color: var(--lime);
    color: var(--on-lime);
    font-weight: 700;
}

.steps .arrow {
    opacity: .4;
}

.checkout-main h1 {
    font-size: clamp(1.625rem, 3vw, 2.25rem);
}

.checkout-sub {
    margin-top: 10px;
    margin-bottom: clamp(24px, 3vw, 32px);
    color: var(--fg-muted);
    font-size: .9375rem;
}

/* Fieldsets */
.field-group {
    border: 0;
    padding: 0;
    margin: 0 0 4px;
}

.field-group legend {
    display: block;
    width: 100%;
    padding: 0 0 14px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--line);
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--fg-dim);
}

.field-group+.field-group {
    margin-top: clamp(28px, 3vw, 38px);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 18px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0 18px;
}

@media (max-width:620px) {

    .form-row,
    .form-row-3 {
        grid-template-columns: 1fr;
    }
}

.form-group {
    margin-bottom: 20px;
    min-width: 0;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: .8125rem;
    font-weight: 600;
    color: var(--fg);
}

.form-group .hint {
    font-weight: 400;
    color: var(--fg-dim);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group select {
    width: 100%;
    height: 50px;
    padding: 0 16px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--fg);
    font-family: inherit;
    font-size: .9375rem;
    transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.form-group select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237E7E89' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 44px;
}

.form-group input::placeholder {
    color: var(--fg-dim);
}

.form-group input:hover,
.form-group select:hover {
    border-color: rgba(255, 255, 255, .28);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--lime);
    background: var(--surface-2);
    box-shadow: 0 0 0 3px var(--lime-soft);
}

.form-group input:-webkit-autofill {
    -webkit-text-fill-color: var(--fg);
    -webkit-box-shadow: 0 0 0 1000px var(--surface-2) inset;
}

/* iOS Safari zooms when focusing a field under 16px.
   These repeat the attribute selectors above on purpose: a plainer
   `.form-group input` is less specific than `.form-group input[type="text"]`
   and would lose, media query or not. */
@media (max-width:640px) {

    .form-group input[type="text"],
    .form-group input[type="email"],
    .form-group input[type="tel"],
    .form-group select,
    .country-search input {
        font-size: 16px;
    }
}

/* ---------- Country field ---------- */
.country-field {
    position: relative;
}

.country-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    height: 50px;
    padding: 0 44px 0 16px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--fg);
    font-family: inherit;
    font-size: .9375rem;
    text-align: left;
    cursor: pointer;
    transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.country-trigger::after {
    content: "";
    position: absolute;
    right: 16px;
    width: 14px;
    height: 14px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237E7E89' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat center;
    transition: transform var(--dur) var(--ease);
}

.country-trigger[aria-expanded="true"]::after {
    transform: rotate(180deg);
}

.country-trigger:hover {
    border-color: rgba(255, 255, 255, .28);
}

.country-trigger:focus-visible {
    border-color: var(--lime);
}

.country-trigger img {
    flex: none;
    border-radius: 2px;
}

.country-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 40;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    background: var(--surface-2);
    box-shadow: 0 24px 48px -18px rgba(0, 0, 0, .9);
    overflow: hidden;
}

.country-search {
    padding: 10px;
    border-bottom: 1px solid var(--line);
}

.country-search input {
    width: 100%;
    height: 42px;
    padding: 0 14px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    background: var(--bg);
    color: var(--fg);
    font-family: inherit;
    font-size: .875rem;
}

.country-search input:focus {
    outline: none;
    border-color: var(--lime);
}

.country-options {
    max-height: 260px;
    overflow-y: auto;
    padding: 6px;
}

.country-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    border: 0;
    border-radius: var(--r-sm);
    background: none;
    color: var(--fg-muted);
    font-family: inherit;
    font-size: .875rem;
    text-align: left;
    cursor: pointer;
    transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.country-option:hover,
.country-option:focus-visible {
    background: var(--lime-soft);
    color: var(--fg);
}

.country-option img {
    flex: none;
    border-radius: 2px;
}

.country-option span {
    flex: 1;
}

.country-option em {
    font-family: var(--font-mono);
    font-style: normal;
    font-size: .75rem;
    color: var(--fg-dim);
}

.country-empty {
    padding: 16px 12px;
    color: var(--fg-dim);
    font-size: .875rem;
    text-align: center;
}

/* ---------- Phone ---------- */
.phone-wrap {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    background: var(--surface);
    overflow: hidden;
    transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.phone-wrap:hover {
    border-color: rgba(255, 255, 255, .28);
}

.phone-wrap:focus-within {
    border-color: var(--lime);
    background: var(--surface-2);
    box-shadow: 0 0 0 3px var(--lime-soft);
}

.phone-wrap .dial {
    display: grid;
    place-items: center;
    flex: none;
    min-width: 64px;
    padding-inline: 12px;
    border-right: 1px solid var(--line);
    background: rgba(255, 255, 255, .035);
    color: var(--fg-muted);
    font-family: var(--font-mono);
    font-size: .8125rem;
}

.phone-wrap input {
    border: 0;
    border-radius: 0;
    background: transparent;
    height: 48px;
}

.phone-wrap input:hover,
.phone-wrap input:focus {
    border: 0;
    background: transparent;
    box-shadow: none;
}

/* ---------- Card customisation ---------- */
.swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 6px;
}

.swatch {
    position: relative;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    border: 2px solid transparent;
    box-shadow: 0 0 0 1px var(--line-strong);
    cursor: pointer;
    transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease),
        box-shadow var(--dur) var(--ease);
}

.swatch:hover {
    transform: scale(1.06);
}

.swatch.is-active {
    border-color: var(--lime);
    box-shadow: 0 0 0 1px var(--lime), 0 0 0 5px var(--lime-soft);
}

.swatch[data-color="dark"] {
    background: linear-gradient(135deg, #1a1a1a 0%, #000 100%);
}

.swatch[data-color="titanium"] {
    background: linear-gradient(135deg, #444a54 0%, #292d32 100%);
}

.swatch[data-color="onyx"] {
    background: linear-gradient(135deg, #1c3a64 0%, #0d214a 100%);
}

.swatch[data-color="silver"] {
    background: linear-gradient(135deg, #c0c0c0 0%, #9e9e9e 100%);
}

.swatch[data-color="gold"] {
    background: linear-gradient(135deg, #e3c480 0%, #b88a00 100%);
}

.swatch[data-color="custom"] {
    background: conic-gradient(#ff6b6b, #ffd93d, #6bcB77, #4d96ff, #b06bff, #ff6b6b);
}

.custom-color {
    margin-top: 14px;
}

/* ---------- Artwork upload ---------- */
.upload {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 46px;
    padding: 12px 20px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--r-md);
    color: var(--fg);
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.upload-btn:hover {
    border-color: var(--lime);
    background: var(--lime-soft);
}

.upload input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
}

.upload input[type="file"]:focus-visible+.upload-btn {
    outline: 2px solid var(--lime);
    outline-offset: 3px;
}

.upload-name {
    font-size: .8125rem;
    color: var(--fg-dim);
}

.upload-error {
    display: block;
    margin-top: 8px;
    font-size: .8125rem;
    color: var(--danger);
}

/* ---------- Submit ---------- */
.checkout-submit {
    width: 100%;
    min-height: 54px;
    margin-top: 10px;
    padding: 15px 26px;
    border: 0;
    border-radius: 999px;
    background: var(--lime);
    color: var(--on-lime);
    font-family: inherit;
    font-size: .9375rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color var(--dur) var(--ease), transform var(--dur) var(--ease),
        opacity var(--dur) var(--ease);
}

.checkout-submit:hover:not(:disabled) {
    background: #DDFF4D;
}

.checkout-submit:active:not(:disabled) {
    transform: scale(.99);
}

.checkout-submit:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.secure-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    font-size: .8125rem;
    color: var(--fg-dim);
}

.secure-note svg {
    color: var(--lime);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 22px;
    padding-block: 5px;
    font-size: .8125rem;
    color: var(--fg-dim);
    text-decoration: none;
    transition: color var(--dur) var(--ease);
}

.back-link:hover {
    color: var(--fg);
}

@media (prefers-reduced-motion: reduce) {
    .preview-card {
        transform: none;
    }
}
