/* ================================================================
   FRAGRANCE BOX — ORDER WIZARD (shared)
   Used by /order (public, index.php) and /dashboard/order (dashboard.php).
   Single source of truth for wizard markup/styles/behavior.
   ================================================================ */

.wizard { display: grid; gap: 0.5rem; }

/* ── Progress indicator ───────────────────────────────────── */
.wiz-progress {
    display: flex; gap: 0.5rem;
    margin-bottom: 1.75rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                max-height 0.5s cubic-bezier(0.16, 1, 0.3, 1),
                margin 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                padding 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 80px;
    overflow: hidden;
}
.wiz-progress-step {
    flex: 1; height: 1px;
    background: rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}
.wiz-progress-step::after {
    content: ''; position: absolute; inset: 0;
    background: #000;
    transform: scaleX(0); transform-origin: left center;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.wiz-progress-step.complete::after { transform: scaleX(1); }
.wiz-progress-step.active::after   { transform: scaleX(0.5); }

/* ── Accordion step ───────────────────────────────────────── */
.wiz-step {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background: #fff;
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                max-height 0.5s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.3s ease;
}
.wiz-step:first-of-type { border-top: 1px solid rgba(0, 0, 0, 0.08); }

.wiz-step.locked { opacity: 0.35; pointer-events: none; }
.wiz-step.locked .wiz-head { cursor: default; }

.wiz-head {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 1.25rem;
    padding: 1.5rem 0.25rem;
    cursor: pointer;
    user-select: none;
    transition: padding 0.3s ease;
}

.wiz-num {
    font-size: 0.6875rem; font-weight: 400;
    letter-spacing: 0.15em;
    color: rgba(0, 0, 0, 0.35);
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    min-width: 24px;
}
.wiz-step.active .wiz-num,
.wiz-step.complete .wiz-num { color: #000; }

.wiz-title {
    font-size: clamp(1.15rem, 2.2vw, 1.5rem);
    font-weight: 200;
    letter-spacing: 0.04em;
    color: #000;
}

.wiz-meta {
    display: flex; align-items: center; gap: 0.875rem;
    font-size: 0.75rem; font-weight: 400;
    letter-spacing: 0.02em;
    color: rgba(0, 0, 0, 0.5);
    text-align: right;
}
.wiz-edit {
    font-size: 0.625rem; font-weight: 500;
    letter-spacing: 0.2em; text-transform: uppercase;
    color: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.2s ease;
}
.wiz-step.complete:not(.active) .wiz-edit { opacity: 1; }
.wiz-step.complete:not(.active):hover .wiz-edit { color: #000; }

.wiz-chevron {
    width: 12px; height: 12px; position: relative;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
}
.wiz-chevron::before,
.wiz-chevron::after {
    content: ''; position: absolute;
    top: 50%; width: 7px; height: 1px;
    background: #000;
}
.wiz-chevron::before { left: 1px;  transform: translateY(-50%) rotate(45deg);  transform-origin: right center; }
.wiz-chevron::after  { right: 1px; transform: translateY(-50%) rotate(-45deg); transform-origin: left center; }
.wiz-step.active .wiz-chevron { transform: rotate(180deg); }

.wiz-body {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.3s ease;
    opacity: 0;
}
.wiz-step.active .wiz-body { opacity: 1; }

.wiz-body-inner {
    padding: 0.5rem 0.25rem 2rem;
    container-type: inline-size;
    container-name: wiz;
}

/* ── Option grids ─────────────────────────────────────────── */
.wiz-options {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(var(--wiz-cols, 2), minmax(0, 1fr));
}
.wiz-options[data-cols="2"] { --wiz-cols: 2; }
.wiz-options[data-cols="3"] { --wiz-cols: 3; }

@container wiz (max-width: 620px) { .wiz-options[data-cols="3"] { --wiz-cols: 1; } }
@container wiz (max-width: 420px) { .wiz-options[data-cols="2"] { --wiz-cols: 1; } }

@supports not (container-type: inline-size) {
    @media (max-width: 820px) {
        .wiz-options { --wiz-cols: 1 !important; }
    }
}

.wiz-option {
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 1.75rem 1.5rem 1.5rem;
    cursor: pointer;
    background: #fff;
    transition: border-color 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.wiz-opt-visual {
    display: flex; align-items: center; justify-content: space-between;
    gap: 0.75rem;
    height: 80px;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
.wiz-opt-visual img {
    height: 72px; width: auto; object-fit: contain;
    user-select: none; -webkit-user-drag: none;
}
.wiz-opt-count {
    font-size: 0.625rem; font-weight: 400;
    letter-spacing: 0.18em; text-transform: uppercase;
    color: rgba(0, 0, 0, 0.4);
    line-height: 1.3;
    text-align: right;
}
.wiz-opt-count strong {
    display: block;
    font-size: 1.625rem;
    font-weight: 200;
    letter-spacing: 0;
    color: #000;
    margin-bottom: 0.25rem;
    font-variant-numeric: tabular-nums;
}

.wiz-option:hover { border-color: rgba(0, 0, 0, 0.45); }
.wiz-option.selected { border-color: #000; }
.wiz-option.selected::before {
    content: ''; position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 2px; background: #000;
}
.wiz-option.selected::after {
    content: '';
    position: absolute; top: 16px; right: 16px;
    width: 16px; height: 16px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.25' stroke-linecap='round' stroke-linejoin='round'><polyline points='3 8 7 12 13 4'/></svg>");
    background-size: contain;
    background-repeat: no-repeat;
}

.wiz-opt-name {
    font-size: 1.0625rem;
    font-weight: 300;
    letter-spacing: 0.02em;
    margin-bottom: 0.5rem;
    color: #000;
}
.wiz-opt-desc {
    font-size: 0.75rem; font-weight: 300; line-height: 1.7;
    color: rgba(0, 0, 0, 0.5);
    letter-spacing: 0.01em;
}

/* ── Pricing bits on option cards ─────────────────────────── */
.wiz-opt-from {
    display: inline-block;
    font-size: 0.625rem; font-weight: 500;
    letter-spacing: 0.2em; text-transform: uppercase;
    color: rgba(0, 0, 0, 0.5);
    margin-top: 0.625rem;
    padding-top: 0.625rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    width: 100%;
    font-variant-numeric: tabular-nums;
}
.wiz-opt-from strong { font-weight: 400; color: #000; }

.wiz-opt-price {
    margin-top: 1rem;
    padding-top: 0.875rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    font-size: 1.125rem;
    font-weight: 300;
    letter-spacing: 0.02em;
    color: #000;
    font-variant-numeric: tabular-nums;
}
.wiz-opt-price-sub {
    display: block;
    font-size: 0.625rem; font-weight: 500;
    letter-spacing: 0.25em; text-transform: uppercase;
    color: rgba(0, 0, 0, 0.4);
    margin-top: 0.25rem;
}

.wiz-pop {
    position: absolute;
    top: 0; right: 0;
    background: #000; color: #fff;
    font-size: 0.5rem; font-weight: 500;
    letter-spacing: 0.3em; text-transform: uppercase;
    padding: 0.5rem 0.875rem;
    z-index: 1;
}
.wiz-option.has-pop { padding-top: 2.5rem; }
.wiz-option.selected .wiz-pop { display: none; }

.wiz-tier-label {
    font-size: 0.5625rem; font-weight: 500;
    letter-spacing: 0.3em; text-transform: uppercase;
    color: rgba(0, 0, 0, 0.4);
    margin-bottom: 0.625rem;
}

/* ── Cart review — the hand-picked fragrances block ───────
   Renders only when the user (or guest) has selected fragrances.
   Each row shows a thumbnail + brand + name + tier with an X button
   that posts a remove to /picks and reloads /order. Empty state
   reassures that picking is optional. */
.wiz-cart {
    margin: 1.25rem 0 0;
    padding: 1rem 0;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}
.wiz-cart-head { margin-bottom: 0.875rem; }
.wiz-cart-title {
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.26em;
    text-transform: uppercase;
    color: rgba(0, 0, 0, 0.6);
    margin-bottom: 0.375rem;
}
.wiz-cart-sub {
    font-size: 0.8125rem;
    line-height: 1.6;
    color: rgba(0, 0, 0, 0.6);
    font-weight: 300;
}
.wiz-cart-sub strong { color: #000; font-weight: 500; }
.wiz-cart-list {
    list-style: none;
    display: grid;
    gap: 0.5rem;
    padding: 0;
    margin: 0;
}
.wiz-cart-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.875rem;
    align-items: center;
    padding: 0.625rem;
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.06);
}
.wiz-cart-media {
    width: 48px; height: 60px;
    background: linear-gradient(180deg, #fafafa 0%, #f1f1f1 100%);
    overflow: hidden;
    flex: none;
    display: block;
}
.wiz-cart-media img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.wiz-cart-media-empty {
    display: flex; align-items: center; justify-content: center;
    width: 100%; height: 100%;
    font-size: 0.5rem; letter-spacing: 0.25em;
    text-transform: uppercase;
    color: rgba(0, 0, 0, 0.25);
}
.wiz-cart-info {
    min-width: 0;
    display: flex; flex-direction: column; gap: 0.125rem;
}
.wiz-cart-brand {
    font-size: 0.5625rem; font-weight: 500; letter-spacing: 0.26em;
    text-transform: uppercase; color: rgba(0, 0, 0, 0.55);
}
.wiz-cart-name {
    font-size: 0.875rem; font-weight: 300; color: #000;
    text-decoration: none; line-height: 1.35;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wiz-cart-name:hover { text-decoration: underline; }
.wiz-cart-meta {
    font-size: 0.5625rem; font-weight: 500; letter-spacing: 0.2em;
    text-transform: uppercase; color: rgba(0, 0, 0, 0.5);
}
.wiz-cart-remove-form { margin: 0; }
.wiz-cart-remove {
    width: 32px; height: 32px;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: 1px solid rgba(0, 0, 0, 0.1);
    color: rgba(0, 0, 0, 0.5);
    cursor: pointer;
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.wiz-cart-remove:hover {
    background: #000; color: #fff; border-color: #000;
}
.wiz-cart-remove svg { width: 14px; height: 14px; }
.wiz-cart-autofill {
    display: flex; align-items: center; gap: 0.5rem;
    margin-top: 0.875rem;
    padding: 0.625rem 0.75rem;
    background: rgba(184, 154, 78, 0.06);
    border: 1px solid rgba(184, 154, 78, 0.3);
    font-size: 0.75rem;
    line-height: 1.55;
    color: rgba(0, 0, 0, 0.65);
    font-weight: 300;
}
.wiz-cart-autofill svg { width: 14px; height: 14px; color: #b89a4e; flex: none; }
.wiz-cart-autofill a { color: inherit; font-weight: 500; text-decoration: underline; }
.wiz-cart-autofill a:hover { color: #000; }
.wiz-cart-empty {
    text-align: left;
}
.wiz-cart-empty .wiz-cart-sub { color: rgba(0, 0, 0, 0.62); }
.wiz-cart-link {
    color: #000; font-weight: 500; text-decoration: underline;
}
.wiz-cart-link:hover { color: rgba(0, 0, 0, 0.7); }

/* ── Confirmation — total ─────────────────────────────────
   Designed as the culminating row of the review list: same
   label/value rhythm as the review rows, with a slightly heavier
   border and darker label so it still reads as the summary total.
   (Modern commerce pattern: Stripe, Shopify, Apple checkout.) */
.wiz-total {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: baseline;
    gap: 1rem;
    padding: 1rem 0 0.25rem;
    margin-top: 0.375rem;
    border-top: 1px solid rgba(0, 0, 0, 0.15);
}
.wiz-total-label {
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgba(0, 0, 0, 0.6);
}
.wiz-total-value {
    justify-self: end;
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.wiz-total-amount {
    font-size: 1.375rem;
    font-weight: 300;
    letter-spacing: 0.005em;
    color: #000;
}
.wiz-total-period {
    font-size: 0.6875rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    color: rgba(0, 0, 0, 0.5);
    margin-left: 0.375rem;
}
.wiz-total-original {
    display: inline-block;
    font-size: 0.875rem;
    font-weight: 300;
    color: rgba(0, 0, 0, 0.38);
    text-decoration: line-through;
    text-decoration-thickness: 1px;
    margin-right: 0.5rem;
    vertical-align: baseline;
    animation: wizPromoFadeIn 0.25s ease;
}
@keyframes wizPromoFadeIn {
    from { opacity: 0; transform: translateY(-2px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Applied promo chip (under total) ──────────────────────── */
.wiz-promo-chip {
    display: flex; align-items: center; gap: 0.625rem;
    margin-top: 0.625rem;
    padding: 0.625rem 0.75rem;
    background: #fafafa;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 3px;
    font-size: 0.75rem;
    color: #000;
    animation: wizPromoFadeIn 0.3s ease;
}
.wiz-promo-chip-icon {
    width: 0.875rem; height: 0.875rem; flex-shrink: 0;
    color: rgba(0, 0, 0, 0.55);
}
.wiz-promo-chip-text {
    flex: 1; display: flex; flex-wrap: wrap; gap: 0.375rem;
    align-items: center;
    font-weight: 300; line-height: 1.4;
}
.wiz-promo-chip-text strong {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.625rem;
    letter-spacing: 0.2em;
    font-weight: 500;
    text-transform: uppercase;
    color: #000;
    padding: 0.1875rem 0.5rem;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 2px;
}
.wiz-promo-chip-remove {
    background: transparent; border: none; cursor: pointer;
    font-size: 0.5625rem; font-weight: 500;
    letter-spacing: 0.18em; text-transform: uppercase;
    color: rgba(0, 0, 0, 0.45);
    padding: 0.25rem 0.5rem;
    font-family: inherit;
    flex-shrink: 0;
    transition: color 0.15s ease;
}
.wiz-promo-chip-remove:hover { color: #000; }
.wiz-promo-chip-remove:disabled { opacity: 0.6; cursor: wait; }

/* ── Confirmation — hero ──────────────────────────────────── */
.wiz-confirm-hero {
    padding: 2rem 0 2.5rem;
    text-align: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    margin-bottom: 0.5rem;
    position: relative;
}
.wiz-confirm-eyebrow {
    font-size: 0.625rem; font-weight: 500;
    letter-spacing: 0.3em; text-transform: uppercase;
    color: rgba(0, 0, 0, 0.35);
    margin-bottom: 1.25rem;
}
.wiz-confirm-media {
    position: relative;
    width: 100%;
    max-width: 280px;
    aspect-ratio: 3 / 2;
    margin: 0 auto 1.25rem;
}
.wiz-confirm-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transform: scale(0.97);
    transition: opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    -webkit-user-drag: none;
    will-change: opacity, transform;
}
.wiz-confirm-img.is-active { opacity: 1; transform: scale(1); }
/* Summary headline: two-level hierarchy.
   Primary = composition (Eau de Parfum) — the product identity.
   Secondary = character · cadence — quieter variant spec.
   Each value is atomic (nowrap); only the primary line scales responsively,
   the secondary is small enough to fit on any phone width.
   Modelled on luxury fragrance product-detail typography
   (Le Labo, Byredo, Chanel) where the concentration is the headline. */
.wiz-confirm-headline {
    margin: 0;
    color: #000;
    text-align: center;
    line-height: 1.2;
    display: block;
}
.wiz-confirm-primary {
    display: block;
    /* Scales smoothly with the viewport — at 320 px screens the font
       drops to ~16 px so "Extrait de Parfum" (17 chars) always fits
       on one line; caps at 36 px on large displays. */
    font-size: clamp(1rem, 5vw, 2.25rem);
    font-weight: 200;
    letter-spacing: 0.02em;
    line-height: 1.2;
    /* Belt and suspenders: never break a composition name across lines */
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
    /* If the viewport is genuinely too narrow for even the scaled font
       (older feature phones), truncate gracefully instead of wrapping */
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wiz-confirm-secondary {
    display: inline-flex;
    align-items: baseline;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.4em 0.625em;
    margin-top: 0.75rem;
    max-width: 100%;
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: rgba(0, 0, 0, 0.5);
}
.wiz-confirm-secondary > span { white-space: nowrap; }
.wiz-confirm-sep {
    opacity: 0.4;
    letter-spacing: 0;
    /* If flex-wrap sends gender/plan to separate lines, the separator lands
       alone on a row — hide it in that case using :only-child / :last-child
       logic isn't possible in pure CSS, so we simply narrow it visually. */
}

/* ── Start Over — tertiary footer action ──────────────────
   Lives below the CTA, not in the hero. Visible only in final state.
   Editorial treatment: centered text link framed by hairline flourishes.
   Premium convention: primary CTA dominates, reset stays quiet. */
.wiz-restart-wrap {
    display: flex;
    justify-content: center;
    margin-top: 1.25rem;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                max-height 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                margin-top 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}
.wizard.is-final .wiz-restart-wrap {
    opacity: 1;
    max-height: 64px;
    pointer-events: auto;
}

.wiz-restart {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 1rem;
    margin: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: rgba(0, 0, 0, 0.4);
    transition: color 0.2s ease, letter-spacing 0.3s ease;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}
.wiz-restart::before,
.wiz-restart::after {
    content: '';
    width: 20px;
    height: 1px;
    background: currentColor;
    opacity: 0.35;
    transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}
.wiz-restart:hover,
.wiz-restart:focus-visible {
    color: #000;
}
.wiz-restart:hover::before,
.wiz-restart:hover::after,
.wiz-restart:focus-visible::before,
.wiz-restart:focus-visible::after {
    width: 28px;
    opacity: 0.6;
}
.wiz-restart:focus-visible {
    outline: 2px solid rgba(0, 0, 0, 0.3);
    outline-offset: 4px;
    border-radius: 2px;
}
.wiz-restart svg {
    width: 11px;
    height: 11px;
    flex-shrink: 0;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.wiz-restart:hover svg {
    transform: rotate(-90deg);
}

/* ── Confirmation — review rows (now editable) ──────────── */
.wiz-review { display: grid; gap: 0; }
.wiz-review-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.875rem;
    align-items: center;
    padding: 0.875rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
.wiz-review-row:last-child { border-bottom: none; }
.wiz-review-label {
    font-size: 0.625rem; font-weight: 500; letter-spacing: 0.2em;
    text-transform: uppercase; color: rgba(0, 0, 0, 0.4);
}
.wiz-review-val {
    font-size: 0.875rem; font-weight: 400; color: #000;
    text-align: right;
    min-width: 0; word-break: break-word;
    justify-self: end;
}
.wiz-review-edit {
    grid-column: 3;
    display: inline-flex; align-items: center; gap: 0.375rem;
    background: transparent; border: none; padding: 0.25rem 0.5rem;
    margin: 0 -0.5rem 0 0; cursor: pointer;
    font-family: inherit;
    font-size: 0.625rem; font-weight: 500;
    letter-spacing: 0.2em; text-transform: uppercase;
    color: rgba(0, 0, 0, 0.35);
    transition: color 0.2s ease;
}
.wiz-review-edit:hover,
.wiz-review-edit:focus-visible { color: #000; }
.wiz-review-edit:focus-visible { outline: 2px solid rgba(0,0,0,0.3); outline-offset: 2px; }
.wiz-review-edit-arrow {
    width: 8px; height: 8px; position: relative;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.wiz-review-edit-arrow::before,
.wiz-review-edit-arrow::after {
    content: ''; position: absolute; top: 50%;
    width: 5px; height: 1px; background: currentColor;
}
.wiz-review-edit-arrow::before { left: 0; transform: translateY(-50%) rotate(45deg);  transform-origin: right center; }
.wiz-review-edit-arrow::after  { right: 0; transform: translateY(-50%) rotate(-45deg); transform-origin: left center; }
.wiz-review-row.is-editing .wiz-review-edit-arrow { transform: rotate(180deg); }

/* Inline editor panel slides in below its row */
.wiz-review-editor {
    grid-column: 1 / -1;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.25s ease,
                margin-top 0.3s ease;
    will-change: max-height, opacity;
}
.wiz-review-row.is-editing .wiz-review-editor {
    max-height: 220px;
    opacity: 1;
    margin-top: 0.75rem;
}

.wiz-pick-grid {
    display: grid;
    gap: 0.5rem;
    grid-template-columns: repeat(var(--pick-cols, 3), minmax(0, 1fr));
}
.wiz-pick-grid[data-cols="2"] { --pick-cols: 2; }
.wiz-pick-grid[data-cols="3"] { --pick-cols: 3; }

.wiz-pick {
    display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
    gap: 0.25rem;
    padding: 0.75rem 0.875rem;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    cursor: pointer;
    font-family: inherit; color: #000;
    text-align: left;
    transition: border-color 0.2s ease, background 0.2s ease;
    min-height: 56px;
}
.wiz-pick:hover { border-color: rgba(0, 0, 0, 0.45); }
.wiz-pick.is-selected {
    border-color: #000;
    background: #000;
    color: #fff;
}
.wiz-pick:focus-visible { outline: 2px solid rgba(0,0,0,0.3); outline-offset: 2px; }
.wiz-pick-name {
    font-size: 0.8125rem; font-weight: 400;
    letter-spacing: 0.02em;
    line-height: 1.2;
}
.wiz-pick-sub {
    font-size: 0.625rem; font-weight: 500;
    letter-spacing: 0.18em; text-transform: uppercase;
    color: rgba(0, 0, 0, 0.45);
    font-variant-numeric: tabular-nums;
}
.wiz-pick.is-selected .wiz-pick-sub { color: rgba(255, 255, 255, 0.7); }

/* Picks with a product thumbnail on the right (used for cadence: monthly/yearly) */
.wiz-pick--with-media {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.875rem;
    min-height: 64px;
    padding: 0.75rem 0.875rem 0.75rem 1rem;
}
.wiz-pick--with-media .wiz-pick-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}
.wiz-pick-media {
    flex-shrink: 0;
    width: 44px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.75;
    transition: opacity 0.2s ease, filter 0.2s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.wiz-pick-media img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}
.wiz-pick:hover .wiz-pick-media {
    opacity: 1;
    transform: scale(1.02);
}
/* Selected state (dark bg) — invert product thumb to white-on-black */
.wiz-pick.is-selected .wiz-pick-media {
    opacity: 1;
    filter: invert(1) brightness(1.15);
}

/* When Account row has no edit control, align the value to the right like a label */
.wiz-review-row[data-review-row="account"] .wiz-review-val,
.wiz-review-row[data-review-row="blacklist"] .wiz-review-val,
.wiz-review-row[data-review-row="picks"] .wiz-review-val {
    grid-column: 2 / 4;
}

/* Picks + Blacklist rows — subtle emphasis on user-preference integration */
.wiz-review-row--blacklist .wiz-review-val,
.wiz-review-row--picks     .wiz-review-val {
    color: rgba(0, 0, 0, 0.65);
}
.wiz-review-manage {
    color: #000;
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 500;
    letter-spacing: 0.02em;
}
.wiz-review-manage:hover { opacity: 0.75; }

/* ── Checkout CTA block ──────────────────────────────────
   Scoped overrides of the base .btn so other buttons keep
   their current look. Premium responsive touch-first design:
   full-width, tall hit target, tactile press feedback, gloss
   sweep on hover, directional arrow, trust indicator below. */
.wiz-cta-wrap {
    margin-top: 1.25rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.875rem;
}

.wiz-cta-wrap .btn,
.wiz-cta-btn {
    /* Override base .btn's inline-block + fixed line-height */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    width: 100%;
    min-height: 54px;
    padding: 0.875rem 1.5rem;
    background: #000;
    color: #fff;
    border: 1px solid #000;
    border-radius: 0;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    text-align: center;
    text-decoration: none;
    white-space: normal;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    isolation: isolate;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.2s ease,
                background 0.25s ease,
                color 0.25s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    appearance: none;
    user-select: none;
    will-change: transform, box-shadow;
}

/* Gloss sweep — subtle premium shimmer on hover (desktop) */
.wiz-cta-wrap .btn::before,
.wiz-cta-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        115deg,
        transparent 30%,
        rgba(255, 255, 255, 0.12) 50%,
        transparent 70%
    );
    transform: translateX(-120%);
    transition: transform 0.75s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    z-index: -1;
}
.wiz-cta-wrap .btn:hover::before,
.wiz-cta-btn:hover::before { transform: translateX(120%); }

.wiz-cta-wrap .btn:hover,
.wiz-cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 38px -20px rgba(0, 0, 0, 0.55),
                0 6px 14px -8px rgba(0, 0, 0, 0.28);
    opacity: 1;
}
.wiz-cta-wrap .btn:active,
.wiz-cta-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 10px -6px rgba(0, 0, 0, 0.45);
    transition-duration: 0.1s;
}
.wiz-cta-wrap .btn:focus-visible,
.wiz-cta-btn:focus-visible {
    outline: 2px solid rgba(0, 0, 0, 0.55);
    outline-offset: 3px;
}

/* Disabled state — before a user has completed the wizard */
.wiz-cta-wrap .btn.wiz-cta-disabled,
.wiz-cta-btn.wiz-cta-disabled {
    opacity: 0.28;
    pointer-events: none;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* SVGs inside the button */
.wiz-cta-btn svg { flex-shrink: 0; }
.wiz-cta-icon { width: 16px; height: 16px; }
.wiz-cta-arrow {
    width: 14px;
    height: 9px;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.wiz-cta-wrap .btn:hover .wiz-cta-arrow { transform: translateX(4px); }

.wiz-cta-label {
    letter-spacing: inherit;
    /* Keep "Sign in with Google to Continue" from breaking mid-word awkwardly */
    word-spacing: 0.02em;
}

/* Secure note — lock glyph + muted copy, centered */
.wiz-cta-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 0.6875rem;
    font-weight: 300;
    color: rgba(0, 0, 0, 0.48);
    letter-spacing: 0.02em;
    line-height: 1.55;
    text-align: center;
}
.wiz-cta-note-icon {
    width: 11px;
    height: 11px;
    flex-shrink: 0;
    opacity: 0.55;
}
.wiz-cta-note > span { min-width: 0; }

/* Legacy hook (still in DOM for JS enablement) */
.wiz-cta-disabled { opacity: 0.3; pointer-events: none; }

/* ── FINAL-STATE FOCUS MODE ─────────────────────────────────
   Once all selections are made and step 4 is active, the
   wizard collapses into a single focused confirmation panel. */
.wizard.is-final .wiz-progress {
    opacity: 0;
    max-height: 0;
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: 0;
    pointer-events: none;
}
.wizard.is-final .wiz-step:not([data-step="4"]) {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
    border: 0;
    pointer-events: none;
}
.wizard.is-final .wiz-step[data-step="4"] {
    border: none;
}
.wizard.is-final .wiz-step[data-step="4"] .wiz-head {
    display: none;
}
.wizard.is-final .wiz-step[data-step="4"] .wiz-body {
    max-height: none !important;
    opacity: 1;
    overflow: visible;
}
.wizard.is-final .wiz-step[data-step="4"] .wiz-body-inner {
    padding: 0.25rem 0.125rem 0;
}

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 600px) {
    /* Step head: stacked, tighter */
    .wiz-head {
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 0.75rem;
        padding: 1.125rem 0.125rem;
    }
    .wiz-num     { grid-column: 1; grid-row: 1; }
    .wiz-title   { grid-column: 2; grid-row: 1; font-size: 1.0625rem; }
    .wiz-chevron { grid-column: 3; grid-row: 1; }
    .wiz-meta {
        grid-column: 2 / 4; grid-row: 2;
        justify-self: start; text-align: left;
        font-size: 0.6875rem; margin-top: 0.125rem;
    }
    .wiz-body-inner { padding: 0.25rem 0.125rem 1.5rem; }
    .wiz-progress   { margin-bottom: 1.25rem; padding-bottom: 1.25rem; }
    .wiz-option     { padding: 1.5rem 1.25rem; }
    .wiz-option.has-pop { padding-top: 2.75rem; }
    .wiz-opt-visual { gap: 0.5rem; }
    .wiz-opt-visual img { height: 60px; }
    .wiz-opt-count strong { font-size: 1.375rem; }

    /* Confirmation hero — far tighter vertical rhythm, centered stack */
    .wiz-confirm-hero {
        padding: 0.75rem 0 1.5rem;
        margin-bottom: 0.25rem;
    }
    .wiz-confirm-eyebrow {
        font-size: 0.5625rem;
        letter-spacing: 0.28em;
        margin-bottom: 1rem;
    }
    .wiz-confirm-media {
        max-width: 200px;
        margin: 0 auto 1rem;
    }
    .wiz-confirm-headline {
        margin: 0 auto;
        max-width: 100%;
    }
    .wiz-confirm-primary {
        /* Font-size handled by the global clamp() — no hard override here
           so scaling stays smooth down to the narrowest viewports. */
        font-weight: 300;
        letter-spacing: 0.015em;
        line-height: 1.25;
    }
    .wiz-confirm-secondary {
        font-size: 0.5625rem;
        letter-spacing: 0.22em;
        margin-top: 0.5rem;
        gap: 0.25em 0.5em;
    }
    .wiz-restart-wrap { margin-top: 1rem; }
    .wiz-restart {
        padding: 0.5rem 0.875rem;
        font-size: 0.5625rem;
        letter-spacing: 0.25em;
        gap: 0.5rem;
    }
    .wiz-restart::before,
    .wiz-restart::after { width: 16px; }
    .wiz-restart:hover::before,
    .wiz-restart:hover::after { width: 22px; }

    /* Review rows — stacked for clearer hierarchy, pill-shaped Change button.
       Grid layout on mobile uses THREE named rows: label+edit / value+edit /
       editor-editor. The editor row spans full width so the inline option
       grid inside it distributes evenly instead of being trapped in the
       narrow 1fr "value" column. */
    .wiz-review { gap: 0; }
    .wiz-review-row {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "label  edit"
            "value  edit"
            "editor editor";
        column-gap: 0.75rem;
        row-gap: 0.125rem;
        padding: 0.875rem 0;
        align-items: center;
    }
    .wiz-review-row > .wiz-review-label { grid-area: label; align-self: end; }
    .wiz-review-row > .wiz-review-val {
        grid-area: value;
        text-align: left;
        justify-self: start;
        font-size: 1rem;
        font-weight: 400;
        letter-spacing: 0.01em;
        align-self: start;
    }

    /* Account row has no Change button and no editor — single-column layout */
    .wiz-review-row[data-review-row="account"] {
        grid-template-columns: 1fr;
        grid-template-areas:
            "label"
            "value";
        row-gap: 0.25rem;
    }
    .wiz-review-row[data-review-row="account"] .wiz-review-val {
        grid-column: 1;
        font-size: 0.8125rem;
        color: rgba(0, 0, 0, 0.65);
    }

    /* Change button — pill-shaped, comfortable hit target, intentional weight */
    .wiz-review-edit {
        grid-area: edit;
        align-self: center;
        justify-self: end;
        display: inline-flex; align-items: center; justify-content: center;
        gap: 0.375rem;
        padding: 0 0.875rem;
        margin: 0;
        min-height: 36px;
        min-width: 90px;
        border: 1px solid rgba(0, 0, 0, 0.15);
        border-radius: 999px;
        background: #fff;
        color: rgba(0, 0, 0, 0.7);
        font-size: 0.5625rem;
        letter-spacing: 0.22em;
        transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    }
    .wiz-review-edit:hover,
    .wiz-review-edit:focus-visible {
        color: #000;
        border-color: rgba(0, 0, 0, 0.4);
    }
    .wiz-review-row.is-editing .wiz-review-edit {
        background: #000;
        color: #fff;
        border-color: #000;
    }
    .wiz-review-edit-arrow::before,
    .wiz-review-edit-arrow::after { height: 1px; }

    /* Inline editor occupies the full-width "editor" row beneath label+value.
       grid-area (not grid-column/row) because the parent uses named areas —
       avoids any auto-placement fallback that would trap the panel in the
       narrow 1fr column and push the option pills to the left. */
    .wiz-review-editor {
        grid-area: editor;
        width: 100%;
        min-width: 0;
    }
    .wiz-review-row.is-editing .wiz-review-editor {
        max-height: 320px;
        margin-top: 0.75rem;
    }
    /* Pick grid: equal-width columns that actually fill the editor panel.
       `minmax(0, 1fr)` prevents intrinsic min-content from forcing columns
       wider than the available space on narrow phones. */
    .wiz-pick-grid {
        width: 100%;
        gap: 0.5rem;
    }
    .wiz-pick {
        padding: 0.625rem 0.75rem;
        min-height: 52px;
        min-width: 0;   /* allow grid children to shrink cleanly */
    }
    .wiz-pick-name { font-size: 0.75rem; }
    .wiz-pick--with-media {
        /* Keep the icon pill in row layout even on mobile — the minimum
           width of the text column was previously fighting with intrinsic
           sizing. */
        min-height: 56px;
        padding: 0.5rem 0.625rem 0.5rem 0.75rem;
        gap: 0.5rem;
    }
    .wiz-pick-media { width: 36px; height: 26px; }

    /* Total — row pattern, tight. Label left, value right. */
    .wiz-total {
        padding: 0.875rem 0 0.125rem;
        margin-top: 0.25rem;
        gap: 0.75rem;
    }
    .wiz-total-label {
        font-size: 0.625rem;
        letter-spacing: 0.2em;
    }
    .wiz-total-amount { font-size: 1.25rem; }
    .wiz-total-period { font-size: 0.625rem; margin-left: 0.3125rem; }
    .wiz-total-original { font-size: 0.75rem; margin-right: 0.375rem; }

    /* CTA — full-width block, tighter rhythm, preserved premium feel */
    .wiz-cta-wrap {
        margin-top: 0.875rem;
        padding-top: 1.125rem;
        gap: 0.75rem;
    }
    .wiz-cta-wrap .btn,
    .wiz-cta-btn {
        min-height: 52px;
        padding: 0.875rem 1.125rem;
        font-size: 0.6875rem;
        letter-spacing: 0.2em;
        gap: 0.5rem;
    }
    /* On touch devices the hover gloss sweep is pointless and drains battery —
       suppress the ::before animation while keeping the press-down feedback. */
    .wiz-cta-wrap .btn::before,
    .wiz-cta-btn::before { display: none; }
    .wiz-cta-wrap .btn:hover,
    .wiz-cta-btn:hover {
        /* Still lift on devices that do support hover at this width (tablets), */
        /* but a smaller amount that feels right on the smaller CTA. */
        transform: translateY(-1px);
        box-shadow: 0 12px 24px -14px rgba(0, 0, 0, 0.45);
    }
    .wiz-cta-arrow { width: 12px; height: 8px; }
    .wiz-cta-icon  { width: 14px; height: 14px; }
    .wiz-cta-note {
        font-size: 0.625rem;
        letter-spacing: 0.015em;
        gap: 0.4375rem;
    }
    .wiz-cta-note-icon { width: 10px; height: 10px; }

    /* Step 4 body padding collapses in final state */
    .wizard.is-final .wiz-step[data-step="4"] .wiz-body-inner {
        padding: 0;
    }
}

/* ── Extra-narrow phones — pull in even more ──────────────── */
@media (max-width: 380px) {
    .wiz-confirm-media { max-width: 170px; }
    /* At ≤380 px the global clamp() already yields ~16 px — no hard override. */
    .wiz-confirm-secondary { font-size: 0.5rem; letter-spacing: 0.2em; margin-top: 0.375rem; }
    .wiz-review-edit { min-width: 80px; padding: 0 0.75rem; }
    .wiz-total-amount { font-size: 1.125rem; }
    .wiz-total-period { font-size: 0.5625rem; }
    .wiz-cta-wrap .btn,
    .wiz-cta-btn {
        min-height: 48px;
        font-size: 0.625rem;
        letter-spacing: 0.18em;
        padding: 0.75rem 0.875rem;
    }
    .wiz-cta-note {
        font-size: 0.5625rem;
        letter-spacing: 0.01em;
    }
}

/* Respect users who prefer less motion */
@media (prefers-reduced-motion: reduce) {
    .wiz-cta-wrap .btn,
    .wiz-cta-btn,
    .wiz-cta-arrow {
        transition-duration: 0.01ms !important;
    }
    .wiz-cta-wrap .btn::before,
    .wiz-cta-btn::before { display: none; }
    .wiz-cta-wrap .btn:hover,
    .wiz-cta-btn:hover { transform: none; }
}
