/**
 * Nexcart Public Styles — Design Token System + Shared Base Components
 *
 * This file is the single source of truth for the Nexcart customer-facing
 * frontend. It is loaded on every page and declares:
 *
 *   1. The design token system (:root custom properties).
 *   2. Dark-mode token overrides via prefers-color-scheme.
 *   3. Reduced-motion overrides.
 *   4. The shared component library (buttons, inputs, notices, toasts,
 *      prices, badges, skeleton shimmer, focus ring, screen-reader text).
 *
 * Design language: Polaris-inspired. Restrained neutral surfaces, crisp
 * 1px borders, subtle elevation stack, 4/6/8/12 radius scale, tight
 * type scale, generous whitespace. Primary accent retains the Nexcart
 * brand navy — Polaris's structural grammar without forfeiting brand.
 *
 * Per-surface stylesheets (nexcart-shop.css, nexcart-cart-page.css,
 * nexcart-side-cart.css, nexcart-express-checkout.css, nexcart-checkout.css)
 * are enqueued in addition to this file only on the pages that need them.
 *
 * Naming convention: everything is prefixed .nexcart- (kebab-case) and
 * scoped under body.nexcart to prevent bleeding into the active theme.
 * No bare element selectors. No hardcoded color/spacing values below the
 * token layer. No @import. No external fonts. No external image assets.
 *
 * @package Nexcart
 */

/* ================================================================
   1. DESIGN TOKENS — LIGHT MODE
   ================================================================ */

:root {
    /* -------- Brand accent --------
     * Polaris "interactive" slot. The brand ships as a deep neutral
     * navy — we keep it to protect brand identity, but translate
     * Polaris's accent/hover/active state machine onto it. */
    --nexcart-accent:              #111827;
    --nexcart-accent-hover:        #1f2937;
    --nexcart-accent-active:       #050a14;
    --nexcart-accent-foreground:   #ffffff;
    --nexcart-accent-soft:         #f1f2f3;
    --nexcart-accent-ring:         rgba(17, 24, 39, 0.20);

    /* -------- Background levels (Polaris surfaces) --------
     * bg-page      → Polaris `bg` (#F6F6F7) — app canvas.
     * bg-surface   → Polaris `bg-surface` (#FFFFFF) — cards, sheets.
     * bg-surface-alt → Polaris `bg-surface-secondary` (#FAFBFB).
     * bg-elevated  → Polaris `bg-surface-elevated` — popovers, menus.
     * bg-inverse   → Polaris `bg-inverse` for dark banners. */
    --nexcart-bg-page:             #f6f6f7;
    --nexcart-bg-surface:          #ffffff;
    --nexcart-bg-surface-alt:      #fafbfb;
    --nexcart-bg-elevated:         #ffffff;
    --nexcart-bg-inverse:          #1a1a1a;
    --nexcart-bg-backdrop:         rgba(26, 26, 26, 0.42);

    /* -------- Text hierarchy (Polaris) --------
     * text         : #202223 — body, headings (AAA ≥ 14:1 on white).
     * text-muted   : #6D7175 — secondary (AA ≈ 5.4:1).
     * text-subtle  : #8C9196 — decorative only (≈ 3.4:1).
     * text-disabled: Polaris disabled (#BABFC3 → pass 3:1 only).
     */
    --nexcart-text:                #202223;
    --nexcart-text-muted:          #6d7175;
    --nexcart-text-subtle:         #8c9196;
    --nexcart-text-disabled:       #babfc3;
    --nexcart-text-inverse:        #ffffff;
    --nexcart-text-link:           #202223;
    --nexcart-text-link-hover:     #000000;

    /* -------- Borders (Polaris) --------
     * border        : #E1E3E5 — standard dividers.
     * border-strong : #BABFC3 — input / button borders.
     * border-subtle : #EDEEEF — whisper dividers inside cards.
     */
    --nexcart-border:              #e1e3e5;
    --nexcart-border-strong:       #babfc3;
    --nexcart-border-subtle:       #edeeef;
    --nexcart-border-focus:        #202223;
    --nexcart-border-error:        #d72c0d;
    --nexcart-border-success:      #008060;

    /* -------- Semantic: sale / urgency (Polaris critical) -------- */
    --nexcart-sale-accent:         #d72c0d;

    /* -------- Semantic: error (Polaris critical) -------- */
    --nexcart-error-bg:            #fff4f4;
    --nexcart-error-border:        #fed3d1;
    --nexcart-error-fg:            #8e1f0b;
    --nexcart-error-accent:        #d72c0d;

    /* -------- Semantic: success (Polaris success green) -------- */
    --nexcart-success-bg:          #ebf7ef;
    --nexcart-success-border:      #aee9d1;
    --nexcart-success-fg:          #0c5132;
    --nexcart-success-accent:      #008060;

    /* -------- Semantic: warning (Polaris caution) -------- */
    --nexcart-warning-bg:          #fff5ea;
    --nexcart-warning-border:      #ffc96b;
    --nexcart-warning-fg:          #8a6116;
    --nexcart-warning-accent:      #b98900;

    /* -------- Semantic: info (Polaris highlight blue) -------- */
    --nexcart-info-bg:             #ebf3ff;
    --nexcart-info-border:         #a4cffa;
    --nexcart-info-fg:             #0c3d6a;
    --nexcart-info-accent:         #2c6ecb;

    /* -------- Semantic: rating (product stars, reviews) -------- */
    --nexcart-rating-accent:       #f59e0b;
    --nexcart-rating-track:        var(--nexcart-border);

    /* -------- Semantic: backorder (soft amber pill) -------- */
    --nexcart-backorder-bg:        #fff7ed;
    --nexcart-backorder-fg:        #9a3412;
    --nexcart-backorder-border:    #fdba74;

    /* -------- Semantic: featured (soft gold pill) -------- */
    --nexcart-featured-bg:         #fef3c7;
    --nexcart-featured-fg:         #92400e;
    --nexcart-featured-border:     #fcd34d;

    /* -------- Text selection -------- */
    --nexcart-selection-bg:        #111827;
    --nexcart-selection-fg:        #ffffff;

    /* -------- Overlay (modal, lightbox) -------- */
    --nexcart-overlay-strong:      rgba(15, 23, 42, 0.86);
    --nexcart-overlay-control-bg:  rgba(255, 255, 255, 0.14);
    --nexcart-overlay-control-hover-bg: rgba(255, 255, 255, 0.26);
    --nexcart-overlay-control-fg:  #ffffff;

    /* -------- Radius scale (Polaris-aligned) --------
     * Polaris uses 4/6/8/12/16 increments. Keeping `md` at 8px (cards,
     * buttons, inputs) matches Polaris Card / Button / TextField. `lg`
     * at 12px matches Polaris Popover / Modal panels. */
    --nexcart-radius-xs:           4px;
    --nexcart-radius-sm:           6px;
    --nexcart-radius-md:           8px;
    --nexcart-radius-lg:           12px;
    --nexcart-radius-xl:           16px;
    --nexcart-radius-pill:         999px;

    /* -------- Shadow scale (Polaris elevation) --------
     * Polaris elevation is deliberately flat — cards carry a single
     * 1px dark line with a faint lift rather than a diffused blur.
     * We keep the layered blur for the higher tiers (popovers, modals,
     * overlay) where Polaris does use real elevation.
     *
     *  xs        → inline pills / chips.
     *  subtle    → Polaris "Card" elevation (bordered, 1px shadow line).
     *  medium    → Polaris "Popover".
     *  prominent → Polaris "Modal".
     *  overlay   → top-of-stack image lightbox / image viewer.
     *  pill      → badge-over-image (sale / stock on a product photo).
     */
    --nexcart-shadow-xs:           0 1px 0 rgba(0, 0, 0, 0.04);
    --nexcart-shadow-subtle:       0 1px 0 rgba(0, 0, 0, 0.05),
                                   0 0 0 1px rgba(0, 0, 0, 0.02);
    --nexcart-shadow-medium:       0 3px 6px -3px rgba(0, 0, 0, 0.10),
                                   0 8px 20px -4px rgba(0, 0, 0, 0.12),
                                   0 0 0 1px rgba(0, 0, 0, 0.05);
    --nexcart-shadow-prominent:    0 4px 12px -2px rgba(0, 0, 0, 0.12),
                                   0 26px 58px -12px rgba(0, 0, 0, 0.22);
    --nexcart-shadow-overlay:      0 24px 56px rgba(0, 0, 0, 0.20),
                                   0 8px 20px rgba(0, 0, 0, 0.10);
    --nexcart-shadow-focus:        0 0 0 3px var(--nexcart-accent-ring);
    --nexcart-shadow-focus-error:  0 0 0 3px rgba(215, 44, 13, 0.24);
    --nexcart-shadow-elevated-up:  0 -6px 18px -4px rgba(0, 0, 0, 0.08);
    /* Dense lift for pills floating over imagery (sale badge, stock
       pill). Denser than --nexcart-shadow-subtle so the pill separates
       cleanly from any product photo behind it. */
    --nexcart-shadow-pill:         0 2px 6px rgba(0, 0, 0, 0.16);
    --nexcart-shadow-inset:        inset 0 1px 0 rgba(0, 0, 0, 0.04);

    /* -------- Spacing scale (4px grid) -------- */
    --nexcart-space-1:             4px;
    --nexcart-space-2:             8px;
    --nexcart-space-3:             12px;
    --nexcart-space-4:             16px;
    --nexcart-space-5:             20px;
    --nexcart-space-6:             24px;
    --nexcart-space-7:             32px;
    --nexcart-space-8:             40px;
    --nexcart-space-9:             48px;
    --nexcart-space-10:            64px;
    --nexcart-space-11:            80px;

    /* -------- Typography (Polaris scale) --------
     * Polaris leans on a near-Inter system stack with a tight numeric
     * font for tabular tasks. The size scale mirrors Polaris body /
     * heading tokens: 13 caption, 14 body (default), 16 body-lg, 20
     * heading-md, 24 heading-lg, 28 heading-xl, 40 display. */
    --nexcart-font-family:         "Inter", -apple-system, BlinkMacSystemFont,
                                   "Segoe UI", "Helvetica Neue", Arial,
                                   "Noto Sans", sans-serif,
                                   "Apple Color Emoji", "Segoe UI Emoji";
    --nexcart-font-numeric:        "Inter", "SF Pro Text", -apple-system,
                                   BlinkMacSystemFont, "Segoe UI",
                                   "Helvetica Neue", Arial, sans-serif;

    --nexcart-font-size-tiny:      11px;
    --nexcart-font-size-xs:        12px;
    --nexcart-font-size-sm:        13px;
    --nexcart-font-size-base:      14px;
    --nexcart-font-size-md:        16px;
    --nexcart-font-size-lg:        20px;
    --nexcart-font-size-xl:        24px;
    --nexcart-font-size-2xl:       28px;
    --nexcart-font-size-display:   40px;
    /* Fluid display scales with viewport, used for marketing-weight
       headings (empty states, setup wizard, account welcome). */
    --nexcart-font-size-display-fluid: clamp(28px, 2vw + 22px, 44px);

    --nexcart-line-height-tight:   1.2;
    --nexcart-line-height-snug:    1.4;
    --nexcart-line-height-base:    1.55;
    --nexcart-line-height-loose:   1.7;

    --nexcart-letter-spacing-tight: -0.01em;
    --nexcart-letter-spacing-wide:  0.08em;

    --nexcart-font-weight-regular: 400;
    --nexcart-font-weight-medium:  500;
    --nexcart-font-weight-semibold: 600;
    --nexcart-font-weight-bold:    700;

    /* -------- Transition --------
     * `ease` is the "product" curve — slight overshoot, premium feel.
     * `ease-standard` is Material-style for neutral motion.
     * `ease-emphasize` is for the main CTA / cart drawer slide, a
     * decelerate curve that lands the element with authority.
     * `ease-spring` adds a touch of personality for confirmations.
     */
    --nexcart-ease:                cubic-bezier(0.2, 0.8, 0.2, 1);
    --nexcart-ease-standard:       cubic-bezier(0.4, 0, 0.2, 1);
    --nexcart-ease-emphasize:      cubic-bezier(0.16, 1, 0.3, 1);
    --nexcart-ease-spring:         cubic-bezier(0.34, 1.56, 0.64, 1);
    --nexcart-duration-fast:       120ms;
    --nexcart-duration-base:       180ms;
    --nexcart-duration-slow:       300ms;
    --nexcart-duration-slower:     480ms;

    /* -------- Z-index layers -------- */
    --nexcart-z-base:              1;
    --nexcart-z-raised:            10;
    --nexcart-z-sticky:            100;
    --nexcart-z-backdrop:          900;
    --nexcart-z-drawer:            1000;
    --nexcart-z-modal:             1100;
    --nexcart-z-toast:             1200;
    --nexcart-z-tooltip:           1300;

    /* -------- Layout -------- */
    --nexcart-container-max:       1200px;
    --nexcart-container-narrow:    820px;
    --nexcart-container-wide:      1320px;
    --nexcart-touch-target:        44px;
    --nexcart-input-height:        48px;
    --nexcart-button-height:       48px;
    --nexcart-button-height-lg:    56px;

    /* -------- Breakpoints (for container queries + documentation) --------
     * These are declarative values only — CSS media queries cannot
     * consume custom properties, so each surface still has to hardcode
     * the number — but standardising the vocabulary prevents drift. */
    --nexcart-bp-sm:               480px;
    --nexcart-bp-md:               768px;
    --nexcart-bp-lg:               960px;
    --nexcart-bp-xl:               1200px;

    /* -------- Legacy aliases ------------------------------------
       These map the old token names used by surfaces that are not
       yet rewritten (account, thank-you / order, gallery, reviews,
       filter, sort, breadcrumbs, vault payment method form) onto
       the new token system. Removing these would break the look
       of pages outside the five rewritten surfaces. */
    --nexcart-primary:    var(--nexcart-accent);
    --nexcart-text-light: var(--nexcart-text-muted);
    --nexcart-bg:         var(--nexcart-bg-surface-alt);
    --nexcart-bg-white:   var(--nexcart-bg-surface);
    --nexcart-bg-light:   var(--nexcart-bg-surface-alt);
    --nexcart-text-muted: var(--nexcart-text-muted);
    --nexcart-success:    var(--nexcart-success-accent);
    --nexcart-warning:    var(--nexcart-warning-accent);
    --nexcart-radius:     var(--nexcart-radius-md);
    --nexcart-shadow:     var(--nexcart-shadow-subtle);

    /* --nexcart-color-* aliases used by nexcart-shop.css variation /
       bundle section as `var(--nexcart-color-text, #fallback)` — we
       define the variables so merchant overrides cascade, while the
       inline fallbacks still catch any edge-case where this block
       is omitted. */
    --nexcart-color-text:          var(--nexcart-text);
    --nexcart-color-muted:         var(--nexcart-text-muted);
    --nexcart-color-border:        var(--nexcart-border-strong);
    --nexcart-color-accent:        var(--nexcart-accent);
    --nexcart-color-danger:        var(--nexcart-error-accent);
    --nexcart-color-success:       var(--nexcart-success-accent);
    --nexcart-color-surface-alt:   var(--nexcart-bg-surface-alt);
}

/* ================================================================
   1.a GLOBAL NEXCART BODY-LEVEL POLISH
   ----------------------------------------------------------------
   Applied only when the Nexcart frontend scope is active, never
   globally on the site. Gives every Nexcart surface a cohesive,
   premium baseline: selection color, tabular numerics by default
   for prices / counts, and a thin custom scrollbar where supported.
   ================================================================ */

body.nexcart ::selection,
.nexcart-root ::selection,
.nexcart-cart-drawer ::selection {
    background: var(--nexcart-selection-bg);
    color: var(--nexcart-selection-fg);
}

.nexcart-price,
.nexcart-total,
.nexcart-qty-input,
[data-nexcart-numeric] {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1, "kern" 1;
}

/* Thin custom scrollbar for Nexcart-owned scroll containers (cart
   drawer body, order summary, variation dropdown lists). Scoped so
   it cannot bleed into the host theme's own scrollable regions. */
.nexcart-scroll-thin {
    scrollbar-width: thin;
    scrollbar-color: var(--nexcart-border-strong) transparent;
}
.nexcart-scroll-thin::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
.nexcart-scroll-thin::-webkit-scrollbar-track {
    background: transparent;
}
.nexcart-scroll-thin::-webkit-scrollbar-thumb {
    background: var(--nexcart-border-strong);
    border-radius: var(--nexcart-radius-pill);
    border: 2px solid var(--nexcart-bg-surface);
}
.nexcart-scroll-thin::-webkit-scrollbar-thumb:hover {
    background: var(--nexcart-text-subtle);
}

/* ================================================================
   2. DARK MODE TOKEN OVERRIDES
   ================================================================ */

@media (prefers-color-scheme: dark) {
    :root {
        --nexcart-accent:              #f3f4f6;
        --nexcart-accent-hover:        #ffffff;
        --nexcart-accent-active:       #e5e7eb;
        --nexcart-accent-foreground:   #0f172a;
        --nexcart-accent-soft:         #283548;
        --nexcart-accent-ring:         rgba(243, 244, 246, 0.22);

        --nexcart-bg-page:             #0f172a;
        --nexcart-bg-surface:          #1e293b;
        --nexcart-bg-surface-alt:      #162032;
        --nexcart-bg-elevated:         #283548;
        --nexcart-bg-inverse:          #f3f4f6;
        --nexcart-bg-backdrop:         rgba(0, 0, 0, 0.68);

        --nexcart-text:                #f1f5f9;
        --nexcart-text-muted:          #94a3b8;
        --nexcart-text-subtle:         #64748b;
        --nexcart-text-disabled:       #475569;
        --nexcart-text-inverse:        #0f172a;
        --nexcart-text-link:           #f1f5f9;
        --nexcart-text-link-hover:     #ffffff;

        --nexcart-border:              #334155;
        --nexcart-border-strong:       #475569;
        --nexcart-border-subtle:       #1e293b;
        --nexcart-border-focus:        #f1f5f9;

        --nexcart-sale-accent:         #f87171;

        --nexcart-error-bg:            #2a1414;
        --nexcart-error-border:        #7f1d1d;
        --nexcart-error-fg:            #fecaca;
        --nexcart-success-bg:          #0c1f18;
        --nexcart-success-border:      #065f46;
        --nexcart-success-fg:          #a7f3d0;
        --nexcart-warning-bg:          #1f1704;
        --nexcart-warning-border:      #78350f;
        --nexcart-warning-fg:          #fcd34d;
        --nexcart-info-bg:             #0c1a2d;
        --nexcart-info-border:         #1e3a8a;
        --nexcart-info-fg:             #bfdbfe;

        --nexcart-shadow-xs:           0 1px 1px rgba(0, 0, 0, 0.28),
                                       0 1px 2px rgba(0, 0, 0, 0.22);
        --nexcart-shadow-subtle:       0 1px 2px rgba(0, 0, 0, 0.35),
                                       0 1px 3px rgba(0, 0, 0, 0.25);
        --nexcart-shadow-medium:       0 4px 12px rgba(0, 0, 0, 0.42),
                                       0 2px 4px rgba(0, 0, 0, 0.28);
        --nexcart-shadow-prominent:    0 12px 32px rgba(0, 0, 0, 0.55),
                                       0 4px 12px rgba(0, 0, 0, 0.32);
        --nexcart-shadow-overlay:      0 24px 56px rgba(0, 0, 0, 0.70),
                                       0 8px 20px rgba(0, 0, 0, 0.45);
        --nexcart-shadow-focus-error:  0 0 0 4px rgba(248, 113, 113, 0.25);
        --nexcart-shadow-elevated-up:  0 -8px 20px rgba(0, 0, 0, 0.32);
        --nexcart-shadow-pill:         0 2px 6px rgba(0, 0, 0, 0.55);
        --nexcart-shadow-inset:        inset 0 1px 2px rgba(0, 0, 0, 0.35);

        /* Semantic — rating still uses warm amber; slightly brighter
           against dark surfaces so stars read "lit up". */
        --nexcart-rating-accent:       #fbbf24;
        --nexcart-rating-track:        var(--nexcart-border);

        /* Semantic — backorder / featured pills. Softer text so amber
           doesn't scream against dark surface; backgrounds shift to
           deep warm tones with enough contrast for AA. */
        --nexcart-backorder-bg:        #2a1e10;
        --nexcart-backorder-fg:        #fdba74;
        --nexcart-backorder-border:    #7c3a10;
        --nexcart-featured-bg:         #2b1f06;
        --nexcart-featured-fg:         #fcd34d;
        --nexcart-featured-border:     #78350f;

        /* Selection on dark surfaces needs an accent-coloured
           background and a high-contrast foreground. */
        --nexcart-selection-bg:        #f3f4f6;
        --nexcart-selection-fg:        #0f172a;

        /* Overlays need to be darker still so they still feel like a
           modal layer when the underlying page is already dark. */
        --nexcart-overlay-strong:      rgba(0, 0, 0, 0.82);
        --nexcart-overlay-control-bg:  rgba(255, 255, 255, 0.10);
        --nexcart-overlay-control-hover-bg: rgba(255, 255, 255, 0.22);
        --nexcart-overlay-control-fg:  #f1f5f9;
    }
}

/* ================================================================
   3. REDUCED MOTION
   ================================================================ */

@media (prefers-reduced-motion: reduce) {
    :root {
        --nexcart-duration-fast: 0.01ms;
        --nexcart-duration-base: 0.01ms;
        --nexcart-duration-slow: 0.01ms;
    }

    .nexcart,
    .nexcart *,
    .nexcart *::before,
    .nexcart *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ================================================================
   4. ROOT SCOPING + RESET
   ================================================================ */

/* Scope every Nexcart style under the body class so bare element
   selectors are impossible. Any rule outside .nexcart is forbidden. */

.nexcart .nexcart-root,
.nexcart-cart-drawer,
.nexcart-cart-drawer-overlay,
.nexcart-toast-region {
    font-family: var(--nexcart-font-family);
    color: var(--nexcart-text);
    line-height: var(--nexcart-line-height-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "kern" 1, "liga" 1, "tnum" 0;
}

/* ================================================================
   5. SCREEN-READER HELPERS
   ================================================================ */

.nexcart-sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.nexcart-live-region {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ================================================================
   6. FOCUS RING (global replacement for outline: none)
   ----------------------------------------------------------------
   The Nexcart focus ring is a thick accent-ring coloured glow
   paired with a 2px transparent outline — the outline makes the
   state visible even in forced-colors mode (Windows high contrast),
   while the box-shadow provides the designed ring in every other
   context. Applied only to `:focus-visible` so mouse clicks on
   buttons don't flash the ring.
   ================================================================ */

.nexcart-focusable:focus,
.nexcart-focusable:focus-visible,
.nexcart-field-input:focus,
.nexcart-field-input:focus-visible,
.nexcart-button:focus-visible,
.nexcart-icon-button:focus-visible {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: var(--nexcart-shadow-focus);
    border-color: var(--nexcart-border-focus);
}

/* Links inside Nexcart surfaces: subtle underline offset for
   readability, deliberate focus state, and a gentle colour shift
   on hover rather than an opacity dim (which harms contrast). */
.nexcart a,
.nexcart-root a {
    text-underline-offset: 0.18em;
    text-decoration-thickness: 1px;
}

.nexcart a:hover,
.nexcart-root a:hover {
    text-decoration-thickness: 1.5px;
}

/* Forced-colors (Windows High Contrast): give the accent ring a
   system colour so focus is still visible when CSS colours are
   overridden. */
@media (forced-colors: active) {
    .nexcart-focusable:focus-visible,
    .nexcart-field-input:focus-visible,
    .nexcart-button:focus-visible,
    .nexcart-icon-button:focus-visible {
        outline: 2px solid CanvasText;
        outline-offset: 2px;
        box-shadow: none;
    }
}

/* ================================================================
   7. BUTTONS
   ================================================================ */

.nexcart-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--nexcart-space-2);
    min-height: var(--nexcart-button-height);
    padding: 0 var(--nexcart-space-6);
    border: 1px solid transparent;
    border-radius: var(--nexcart-radius-md);
    background: var(--nexcart-accent);
    color: var(--nexcart-accent-foreground);
    font-family: inherit;
    font-size: var(--nexcart-font-size-base);
    font-weight: var(--nexcart-font-weight-semibold);
    line-height: 1;
    letter-spacing: var(--nexcart-letter-spacing-tight);
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
    transition:
        background-color var(--nexcart-duration-base) var(--nexcart-ease),
        color var(--nexcart-duration-base) var(--nexcart-ease),
        border-color var(--nexcart-duration-base) var(--nexcart-ease),
        box-shadow var(--nexcart-duration-base) var(--nexcart-ease),
        transform var(--nexcart-duration-fast) var(--nexcart-ease);
    -webkit-appearance: none;
    appearance: none;
}

.nexcart-button:hover,
.nexcart-button:focus-visible {
    background: var(--nexcart-accent-hover);
    color: var(--nexcart-accent-foreground);
    text-decoration: none;
}

.nexcart-button:active {
    background: var(--nexcart-accent-active);
    transform: translateY(1px);
}

.nexcart-button:focus-visible {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: var(--nexcart-shadow-focus);
}

.nexcart-button[disabled],
.nexcart-button.is-disabled {
    background: var(--nexcart-accent-soft);
    color: var(--nexcart-text-disabled);
    border-color: var(--nexcart-border);
    cursor: not-allowed;
    opacity: 0.85;
    transform: none;
}

.nexcart-button.is-loading {
    color: transparent !important;
    position: relative;
    pointer-events: none;
}

.nexcart-button.is-loading::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid currentColor;
    border-radius: 50%;
    border-top-color: transparent;
    color: var(--nexcart-accent-foreground);
    animation: nexcart-spin 700ms linear infinite;
}

.nexcart-button--secondary {
    background: var(--nexcart-bg-surface);
    color: var(--nexcart-text);
    border-color: var(--nexcart-border-strong);
}

.nexcart-button--secondary:hover,
.nexcart-button--secondary:focus-visible {
    background: var(--nexcart-bg-surface-alt);
    color: var(--nexcart-text);
    border-color: var(--nexcart-border-focus);
}

.nexcart-button--ghost {
    background: transparent;
    color: var(--nexcart-text);
    border-color: transparent;
}

.nexcart-button--ghost:hover,
.nexcart-button--ghost:focus-visible {
    background: var(--nexcart-accent-soft);
    color: var(--nexcart-text);
}

.nexcart-button--block {
    width: 100%;
    display: flex;
}

.nexcart-button--lg {
    min-height: var(--nexcart-button-height-lg);
    font-size: var(--nexcart-font-size-md);
    padding: 0 var(--nexcart-space-7);
    border-radius: var(--nexcart-radius-md);
}

.nexcart-button--confirmed {
    background: var(--nexcart-success-accent);
    color: var(--nexcart-text-inverse);
}

.nexcart-button--confirmed:hover,
.nexcart-button--confirmed:focus-visible {
    background: var(--nexcart-success-accent);
    color: var(--nexcart-text-inverse);
}

.nexcart-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--nexcart-touch-target);
    height: var(--nexcart-touch-target);
    border: 1px solid transparent;
    border-radius: var(--nexcart-radius-md);
    background: transparent;
    color: var(--nexcart-text-muted);
    cursor: pointer;
    transition:
        background-color var(--nexcart-duration-base) var(--nexcart-ease),
        color var(--nexcart-duration-base) var(--nexcart-ease);
    -webkit-appearance: none;
    appearance: none;
}

.nexcart-icon-button:hover,
.nexcart-icon-button:focus-visible {
    background: var(--nexcart-accent-soft);
    color: var(--nexcart-text);
}

.nexcart-icon-button svg {
    width: 20px;
    height: 20px;
    display: block;
}

/* ================================================================
   8. FORM FIELDS
   ================================================================ */

.nexcart-field {
    display: flex;
    flex-direction: column;
    gap: var(--nexcart-space-2);
    margin-bottom: var(--nexcart-space-4);
}

.nexcart-field-label {
    display: inline-flex;
    align-items: center;
    gap: var(--nexcart-space-1);
    font-size: var(--nexcart-font-size-sm);
    font-weight: var(--nexcart-font-weight-medium);
    color: var(--nexcart-text);
    line-height: var(--nexcart-line-height-snug);
}

.nexcart-field-required {
    color: var(--nexcart-error-accent);
    font-weight: var(--nexcart-font-weight-bold);
    margin-left: 2px;
}

.nexcart-field-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.nexcart-field-input,
.nexcart-field-select,
.nexcart-field-textarea {
    width: 100%;
    min-height: var(--nexcart-input-height);
    padding: 0 var(--nexcart-space-4);
    background: var(--nexcart-bg-surface);
    border: 1px solid var(--nexcart-border-strong);
    border-radius: var(--nexcart-radius-md);
    color: var(--nexcart-text);
    font-family: inherit;
    font-size: var(--nexcart-font-size-base);
    line-height: var(--nexcart-line-height-snug);
    transition:
        border-color var(--nexcart-duration-base) var(--nexcart-ease),
        box-shadow var(--nexcart-duration-base) var(--nexcart-ease),
        background-color var(--nexcart-duration-base) var(--nexcart-ease);
    -webkit-appearance: none;
    appearance: none;
}

.nexcart-field-textarea {
    min-height: 120px;
    padding: var(--nexcart-space-3) var(--nexcart-space-4);
    resize: vertical;
    font-family: inherit;
}

.nexcart-field-select {
    padding-right: var(--nexcart-space-9);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='none' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M1 1l5 5 5-5'/></svg>");
    background-repeat: no-repeat;
    background-position: right var(--nexcart-space-4) center;
    cursor: pointer;
}

.nexcart-field-input:focus,
.nexcart-field-select:focus,
.nexcart-field-textarea:focus {
    outline: none;
    border-color: var(--nexcart-border-focus);
    box-shadow: var(--nexcart-shadow-focus);
}

.nexcart-field-input::placeholder,
.nexcart-field-textarea::placeholder {
    color: var(--nexcart-text-subtle);
    opacity: 1;
}

.nexcart-field.is-error .nexcart-field-input,
.nexcart-field.is-error .nexcart-field-select,
.nexcart-field.is-error .nexcart-field-textarea {
    border-color: var(--nexcart-border-error);
    background-color: var(--nexcart-error-bg);
}

.nexcart-field.is-error .nexcart-field-input:focus,
.nexcart-field.is-error .nexcart-field-select:focus,
.nexcart-field.is-error .nexcart-field-textarea:focus {
    box-shadow: var(--nexcart-shadow-focus-error);
    border-color: var(--nexcart-border-error);
}

.nexcart-field.is-valid .nexcart-field-input,
.nexcart-field.is-valid .nexcart-field-select,
.nexcart-field.is-valid .nexcart-field-textarea {
    border-color: var(--nexcart-border-success);
}

.nexcart-field-trailing-icon {
    position: absolute;
    right: var(--nexcart-space-4);
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    pointer-events: none;
    color: var(--nexcart-text-muted);
}

.nexcart-field.is-error .nexcart-field-trailing-icon {
    color: var(--nexcart-error-accent);
}

.nexcart-field.is-valid .nexcart-field-trailing-icon {
    color: var(--nexcart-success-accent);
}

.nexcart-field-error-text {
    display: flex;
    align-items: center;
    gap: var(--nexcart-space-1);
    font-size: var(--nexcart-font-size-xs);
    color: var(--nexcart-error-accent);
    line-height: var(--nexcart-line-height-snug);
    margin: 0;
}

.nexcart-field-help-text {
    font-size: var(--nexcart-font-size-xs);
    color: var(--nexcart-text-muted);
    line-height: var(--nexcart-line-height-snug);
    margin: 0;
}

.nexcart-field-checkbox,
.nexcart-field-radio {
    display: inline-flex;
    align-items: center;
    gap: var(--nexcart-space-2);
    cursor: pointer;
    font-size: var(--nexcart-font-size-sm);
    color: var(--nexcart-text);
    user-select: none;
}

.nexcart-field-checkbox input[type="checkbox"],
.nexcart-field-radio input[type="radio"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--nexcart-accent);
}

/* ================================================================
   9. NOTICES
   ================================================================ */

.nexcart-notice {
    display: flex;
    align-items: flex-start;
    gap: var(--nexcart-space-3);
    padding: var(--nexcart-space-3) var(--nexcart-space-4);
    border: 1px solid var(--nexcart-border);
    border-radius: var(--nexcart-radius-md);
    background: var(--nexcart-bg-surface);
    color: var(--nexcart-text);
    font-size: var(--nexcart-font-size-sm);
    line-height: var(--nexcart-line-height-snug);
    margin-bottom: var(--nexcart-space-3);
}

.nexcart-notice-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nexcart-notice-body {
    flex: 1;
    min-width: 0;
}

.nexcart-notice--success {
    background: var(--nexcart-success-bg);
    border-color: var(--nexcart-success-border);
    color: var(--nexcart-success-fg);
}

.nexcart-notice--error {
    background: var(--nexcart-error-bg);
    border-color: var(--nexcart-error-border);
    color: var(--nexcart-error-fg);
}

.nexcart-notice--warning {
    background: var(--nexcart-warning-bg);
    border-color: var(--nexcart-warning-border);
    color: var(--nexcart-warning-fg);
}

.nexcart-notice--info {
    background: var(--nexcart-info-bg);
    border-color: var(--nexcart-info-border);
    color: var(--nexcart-info-fg);
}

/* ================================================================
   10. TOAST REGION
   ================================================================ */

.nexcart-toast-region {
    position: fixed;
    inset: auto var(--nexcart-space-5) var(--nexcart-space-5) auto;
    display: flex;
    flex-direction: column;
    gap: var(--nexcart-space-3);
    z-index: var(--nexcart-z-toast);
    pointer-events: none;
    max-width: calc(100vw - var(--nexcart-space-10));
    width: 360px;
}

.nexcart-toast {
    display: flex;
    align-items: center;
    gap: var(--nexcart-space-3);
    padding: var(--nexcart-space-4) var(--nexcart-space-5);
    background: var(--nexcart-bg-elevated);
    color: var(--nexcart-text);
    border: 1px solid var(--nexcart-border);
    border-radius: var(--nexcart-radius-md);
    box-shadow: var(--nexcart-shadow-prominent);
    font-size: var(--nexcart-font-size-sm);
    pointer-events: auto;
    transform: translateY(8px);
    opacity: 0;
    animation: nexcart-toast-in var(--nexcart-duration-slow) var(--nexcart-ease) forwards;
}

.nexcart-toast.is-leaving {
    animation: nexcart-toast-out var(--nexcart-duration-base) var(--nexcart-ease) forwards;
}

.nexcart-toast-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    color: var(--nexcart-text-muted);
}

.nexcart-toast-body {
    flex: 1;
    min-width: 0;
    font-weight: var(--nexcart-font-weight-medium);
}

.nexcart-toast-action {
    flex-shrink: 0;
    background: transparent;
    border: none;
    color: var(--nexcart-text);
    font-weight: var(--nexcart-font-weight-semibold);
    font-size: var(--nexcart-font-size-sm);
    cursor: pointer;
    padding: var(--nexcart-space-1) var(--nexcart-space-2);
    border-radius: var(--nexcart-radius-sm);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.nexcart-toast-action:hover,
.nexcart-toast-action:focus-visible {
    background: var(--nexcart-accent-soft);
}

.nexcart-toast--success .nexcart-toast-icon { color: var(--nexcart-success-accent); }
.nexcart-toast--error   .nexcart-toast-icon { color: var(--nexcart-error-accent); }
.nexcart-toast--info    .nexcart-toast-icon { color: var(--nexcart-info-accent); }

@keyframes nexcart-toast-in {
    from { transform: translateY(16px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

@keyframes nexcart-toast-out {
    from { transform: translateY(0);    opacity: 1; }
    to   { transform: translateY(16px); opacity: 0; }
}

/* ================================================================
   11. PRICES
   ================================================================ */

.nexcart-price {
    font-family: var(--nexcart-font-numeric);
    font-variant-numeric: tabular-nums;
    font-weight: var(--nexcart-font-weight-semibold);
    color: var(--nexcart-text);
    letter-spacing: var(--nexcart-letter-spacing-tight);
}

.nexcart-price-group {
    display: inline-flex;
    align-items: baseline;
    gap: var(--nexcart-space-2);
}

.nexcart-price-regular {
    /* Body-copy (the struck-through original price must remain readable even
     * with the line-through). Use the AA-contrast muted token, not subtle. */
    color: var(--nexcart-text-muted);
    font-weight: var(--nexcart-font-weight-regular);
    text-decoration: line-through;
    font-size: 0.9em;
}

.nexcart-price-sale {
    color: var(--nexcart-sale-accent);
    font-weight: var(--nexcart-font-weight-bold);
}

/* ================================================================
   12. BADGES
   ================================================================ */

.nexcart-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--nexcart-space-1);
    padding: 4px var(--nexcart-space-3);
    background: var(--nexcart-accent-soft);
    color: var(--nexcart-text);
    border: 1px solid var(--nexcart-border);
    border-radius: var(--nexcart-radius-pill);
    font-size: var(--nexcart-font-size-xs);
    font-weight: var(--nexcart-font-weight-semibold);
    line-height: 1;
    letter-spacing: var(--nexcart-letter-spacing-wide);
    text-transform: uppercase;
    white-space: nowrap;
}

.nexcart-badge--accent {
    background: var(--nexcart-accent);
    color: var(--nexcart-accent-foreground);
    border-color: var(--nexcart-accent);
}

.nexcart-badge--success {
    background: var(--nexcart-success-bg);
    color: var(--nexcart-success-fg);
    border-color: var(--nexcart-success-border);
}

.nexcart-badge--warning {
    background: var(--nexcart-warning-bg);
    color: var(--nexcart-warning-fg);
    border-color: var(--nexcart-warning-border);
}

.nexcart-badge--muted {
    background: var(--nexcart-bg-surface-alt);
    color: var(--nexcart-text-muted);
    border-color: var(--nexcart-border);
}

/* ================================================================
   13. SKELETON SHIMMER
   ================================================================ */

.nexcart-skeleton {
    position: relative;
    overflow: hidden;
    background: var(--nexcart-bg-surface-alt);
    border-radius: var(--nexcart-radius-md);
    isolation: isolate;
}

.nexcart-skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.45) 50%,
        transparent 100%
    );
    transform: translateX(-100%);
    animation: nexcart-shimmer 1.4s infinite var(--nexcart-ease-standard);
}

@media (prefers-color-scheme: dark) {
    .nexcart-skeleton::after {
        background: linear-gradient(
            90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.08) 50%,
            transparent 100%
        );
    }
}

@keyframes nexcart-shimmer {
    100% { transform: translateX(100%); }
}

@keyframes nexcart-spin {
    to { transform: rotate(360deg); }
}

/* ================================================================
   14. MINI CART (reused across all pages)
   ================================================================ */

.nexcart-mini-cart {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--nexcart-space-2);
    min-width: var(--nexcart-touch-target);
    min-height: var(--nexcart-touch-target);
    padding: 0 var(--nexcart-space-3);
    background: transparent;
    border: 1px solid var(--nexcart-border);
    border-radius: var(--nexcart-radius-md);
    color: var(--nexcart-text);
    cursor: pointer;
    position: relative;
    transition: all var(--nexcart-duration-base) var(--nexcart-ease);
}

.nexcart-mini-cart:hover,
.nexcart-mini-cart:focus-visible {
    background: var(--nexcart-accent-soft);
    border-color: var(--nexcart-border-focus);
}

.nexcart-mini-cart:focus-visible {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: var(--nexcart-shadow-focus);
}

.nexcart-mini-cart-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: currentColor;
}

.nexcart-mini-cart-icon svg {
    width: 22px;
    height: 22px;
}

.nexcart-mini-cart-count {
    position: absolute;
    top: -6px;
    right: -6px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--nexcart-accent);
    color: var(--nexcart-accent-foreground);
    border-radius: var(--nexcart-radius-pill);
    font-size: 11px;
    font-weight: var(--nexcart-font-weight-bold);
    font-variant-numeric: tabular-nums;
    line-height: 1;
    pointer-events: none;
}

.nexcart-mini-cart-total {
    font-size: var(--nexcart-font-size-sm);
    font-weight: var(--nexcart-font-weight-semibold);
    font-variant-numeric: tabular-nums;
}

/* ================================================================
   15. GENERIC HELPERS USED IN TEMPLATES
   ================================================================ */

.nexcart-container {
    max-width: var(--nexcart-container-max);
    margin: 0 auto;
    padding: 0 var(--nexcart-space-5);
    font-family: var(--nexcart-font-family);
    color: var(--nexcart-text);
    line-height: var(--nexcart-line-height-base);
    font-size: var(--nexcart-font-size-base);
}

.nexcart-section-heading {
    font-family: var(--nexcart-font-family);
    font-size: var(--nexcart-font-size-lg);
    font-weight: var(--nexcart-font-weight-semibold);
    letter-spacing: var(--nexcart-letter-spacing-tight);
    color: var(--nexcart-text);
    margin: 0 0 var(--nexcart-space-5);
    line-height: var(--nexcart-line-height-tight);
}

.nexcart-divider {
    display: flex;
    align-items: center;
    gap: var(--nexcart-space-4);
    margin: var(--nexcart-space-6) 0;
    color: var(--nexcart-text-muted);
    font-size: var(--nexcart-font-size-xs);
    font-weight: var(--nexcart-font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: var(--nexcart-letter-spacing-wide);
}

.nexcart-divider::before,
.nexcart-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--nexcart-border);
}

.nexcart-trust-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--nexcart-space-4);
    margin-top: var(--nexcart-space-4);
    padding-top: var(--nexcart-space-4);
    border-top: 1px solid var(--nexcart-border-subtle);
    color: var(--nexcart-text-muted);
    font-size: var(--nexcart-font-size-xs);
}

.nexcart-trust-lock {
    display: inline-flex;
    align-items: center;
    gap: var(--nexcart-space-1);
}

.nexcart-trust-lock svg {
    width: 14px;
    height: 14px;
    color: var(--nexcart-success-accent);
}

.nexcart-payment-logos {
    display: inline-flex;
    align-items: center;
    gap: var(--nexcart-space-2);
}

.nexcart-payment-logos svg {
    width: 32px;
    height: 20px;
    display: block;
}

/* ================================================================
   16. LEGACY SHARED SURFACES (not part of the five rewritten ones)
   ================================================================
   The five surfaces in the rewrite scope (shop / cart / side cart /
   express checkout / checkout) have their own per-surface stylesheet.
   The rules below cover the customer-facing surfaces that are NOT
   part of the rewrite — account, thank-you / order, product gallery,
   product reviews, breadcrumbs, product filter & sort, lightbox, and
   the vault add-payment-method form. They use the legacy token
   aliases declared in :root above so the look stays consistent.

   These rules are pending a future iteration. New code should not
   depend on this section.
   ================================================================ */

/* -------- Notices (legacy table-based variants) -------- */

.nexcart-notices {
    margin-bottom: var(--nexcart-space-5);
}

.nexcart-notice-success {
    background: var(--nexcart-success-bg);
    border: 1px solid var(--nexcart-success-border);
    color: var(--nexcart-success-fg);
    padding: var(--nexcart-space-3) var(--nexcart-space-4);
    border-radius: var(--nexcart-radius-md);
    margin-bottom: var(--nexcart-space-2);
    font-size: var(--nexcart-font-size-sm);
}

.nexcart-notice-error {
    background: var(--nexcart-error-bg);
    border: 1px solid var(--nexcart-error-border);
    color: var(--nexcart-error-fg);
    padding: var(--nexcart-space-3) var(--nexcart-space-4);
    border-radius: var(--nexcart-radius-md);
    margin-bottom: var(--nexcart-space-2);
    font-size: var(--nexcart-font-size-sm);
}

.nexcart-notice-info {
    background: var(--nexcart-info-bg);
    border: 1px solid var(--nexcart-info-border);
    color: var(--nexcart-info-fg);
    padding: var(--nexcart-space-3) var(--nexcart-space-4);
    border-radius: var(--nexcart-radius-md);
    margin-bottom: var(--nexcart-space-2);
    font-size: var(--nexcart-font-size-sm);
}

/* -------- Thank You Page -------- */

.nexcart-thankyou {
    max-width: 780px;
    margin: var(--nexcart-space-4) auto;
    padding: 0 var(--nexcart-space-4);
    font-family: var(--nexcart-font-family);
    color: var(--nexcart-text);
    line-height: var(--nexcart-line-height-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Hero */
.nexcart-thankyou-hero {
    text-align: center;
    padding: var(--nexcart-space-3) var(--nexcart-space-5) var(--nexcart-space-6);
    margin-bottom: var(--nexcart-space-5);
    animation: nexcart-thankyou-fade-in 420ms var(--nexcart-ease) both;
}

.nexcart-thankyou-success-icon {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto var(--nexcart-space-5);
    border-radius: var(--nexcart-radius-pill);
    background: var(--nexcart-success-bg);
    color: var(--nexcart-success-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 0 0 1px color-mix(in srgb, var(--nexcart-success-accent) 18%, transparent),
        0 0 0 8px color-mix(in srgb, var(--nexcart-success-accent) 10%, transparent),
        0 10px 24px -12px color-mix(in srgb, var(--nexcart-success-accent) 55%, transparent);
    animation: nexcart-thankyou-pop 520ms var(--nexcart-ease) both;
}

.nexcart-thankyou-success-icon::after {
    content: "";
    position: absolute;
    inset: -14px;
    border-radius: inherit;
    border: 2px solid color-mix(in srgb, var(--nexcart-success-accent) 28%, transparent);
    opacity: 0;
    animation: nexcart-thankyou-ring 1200ms var(--nexcart-ease) 240ms both;
}

.nexcart-thankyou-success-icon svg {
    width: 38px;
    height: 38px;
    display: block;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: nexcart-thankyou-check 460ms var(--nexcart-ease) 220ms forwards;
}

@keyframes nexcart-thankyou-pop {
    0%   { opacity: 0; transform: scale(0.7); }
    60%  { opacity: 1; transform: scale(1.06); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes nexcart-thankyou-check {
    to { stroke-dashoffset: 0; }
}

@keyframes nexcart-thankyou-ring {
    0%   { opacity: 0.9; transform: scale(0.85); }
    100% { opacity: 0; transform: scale(1.25); }
}

@keyframes nexcart-thankyou-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .nexcart-thankyou-hero,
    .nexcart-thankyou-success-icon,
    .nexcart-thankyou-success-icon::after,
    .nexcart-thankyou-success-icon svg,
    .nexcart-thankyou-card {
        animation: none !important;
    }
    .nexcart-thankyou-success-icon svg {
        stroke-dashoffset: 0;
    }
}

.nexcart-thankyou-title {
    font-size: var(--nexcart-font-size-2xl);
    line-height: var(--nexcart-line-height-tight);
    letter-spacing: var(--nexcart-letter-spacing-tight);
    font-weight: var(--nexcart-font-weight-bold);
    color: var(--nexcart-text);
    margin: 0 0 var(--nexcart-space-3);
}

.nexcart-thankyou-subtitle {
    font-size: var(--nexcart-font-size-md);
    color: var(--nexcart-text-muted);
    margin: 0 auto var(--nexcart-space-5);
    max-width: 520px;
}

.nexcart-thankyou-subtitle strong {
    color: var(--nexcart-text);
    font-weight: var(--nexcart-font-weight-semibold);
    word-break: break-word;
}

.nexcart-thankyou-order-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--nexcart-space-3);
    margin: 0;
    padding: var(--nexcart-space-2) var(--nexcart-space-4);
    background: var(--nexcart-bg-surface);
    border: 1px solid var(--nexcart-border);
    border-radius: var(--nexcart-radius-pill);
    font-size: var(--nexcart-font-size-sm);
    box-shadow: var(--nexcart-shadow-subtle);
}

.nexcart-thankyou-order-badge-label {
    color: var(--nexcart-text-muted);
    text-transform: uppercase;
    letter-spacing: var(--nexcart-letter-spacing-wide);
    font-size: var(--nexcart-font-size-xs);
    font-weight: var(--nexcart-font-weight-semibold);
    padding-right: var(--nexcart-space-3);
    border-right: 1px solid var(--nexcart-border);
}

.nexcart-thankyou-order-badge-value {
    color: var(--nexcart-text);
    font-weight: var(--nexcart-font-weight-semibold);
    font-family: var(--nexcart-font-numeric);
    font-feature-settings: "tnum" 1;
    letter-spacing: 0.02em;
}

/* Cards */
.nexcart-thankyou-card {
    background: var(--nexcart-bg-surface);
    border: 1px solid var(--nexcart-border);
    border-radius: var(--nexcart-radius-lg);
    padding: var(--nexcart-space-6) var(--nexcart-space-6);
    margin-bottom: var(--nexcart-space-5);
    box-shadow: var(--nexcart-shadow-subtle);
    animation: nexcart-thankyou-fade-in 460ms var(--nexcart-ease) both;
}

.nexcart-thankyou-card--summary   { animation-delay: 80ms; }
.nexcart-thankyou-card--items     { animation-delay: 140ms; }
.nexcart-thankyou-card--addresses { animation-delay: 200ms; }

.nexcart-thankyou-card-title {
    font-size: var(--nexcart-font-size-lg);
    font-weight: var(--nexcart-font-weight-semibold);
    color: var(--nexcart-text);
    margin: 0 0 var(--nexcart-space-5);
    line-height: var(--nexcart-line-height-snug);
    letter-spacing: var(--nexcart-letter-spacing-tight);
}

/* Summary card: meta grid.
   Two balanced columns on tablet+; a single column on narrow screens.
   The previous auto-fit(minmax 180px) caused 4 items to wrap as 3 + 1
   — visually lopsided. A fixed 2-column layout reads as intentional. */
.nexcart-thankyou-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--nexcart-space-5) var(--nexcart-space-6);
    margin: 0;
}

.nexcart-thankyou-meta-item {
    margin: 0;
    min-width: 0;
}

.nexcart-thankyou-meta dt {
    font-size: var(--nexcart-font-size-xs);
    color: var(--nexcart-text-muted);
    text-transform: uppercase;
    letter-spacing: var(--nexcart-letter-spacing-wide);
    font-weight: var(--nexcart-font-weight-semibold);
    margin: 0 0 var(--nexcart-space-1);
}

.nexcart-thankyou-meta dd {
    font-size: var(--nexcart-font-size-base);
    color: var(--nexcart-text);
    font-weight: var(--nexcart-font-weight-semibold);
    margin: 0;
    word-break: break-word;
    font-variant-numeric: tabular-nums;
}

/* Items table */
.nexcart-thankyou-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 var(--nexcart-space-5);
    font-size: var(--nexcart-font-size-base);
}

.nexcart-thankyou-table thead th {
    text-align: left;
    padding: 0 var(--nexcart-space-3) var(--nexcart-space-3);
    font-size: var(--nexcart-font-size-xs);
    font-weight: var(--nexcart-font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: var(--nexcart-letter-spacing-wide);
    color: var(--nexcart-text-muted);
    border-bottom: 1px solid var(--nexcart-border);
    white-space: nowrap;
}

.nexcart-thankyou-table thead th:first-child { padding-left: 0; }
.nexcart-thankyou-table thead th:last-child  { padding-right: 0; text-align: right; }

.nexcart-thankyou-table .nexcart-thankyou-col-qty {
    text-align: center;
    width: 1%;
}

.nexcart-thankyou-table tbody td {
    padding: var(--nexcart-space-4) var(--nexcart-space-3);
    color: var(--nexcart-text);
    border-bottom: 1px solid var(--nexcart-border-subtle);
    vertical-align: middle;
}

.nexcart-thankyou-table tbody td:first-child { padding-left: 0; }
.nexcart-thankyou-table tbody td:last-child {
    padding-right: 0;
    text-align: right;
    font-weight: var(--nexcart-font-weight-semibold);
    font-variant-numeric: tabular-nums;
}

.nexcart-thankyou-table tbody tr:last-child td { border-bottom: none; }

.nexcart-thankyou-item-name {
    font-weight: var(--nexcart-font-weight-medium);
    color: var(--nexcart-text);
}

/* Totals */
.nexcart-thankyou-totals {
    margin: 0;
    border-top: 1px solid var(--nexcart-border);
    padding-top: var(--nexcart-space-4);
    display: flex;
    flex-direction: column;
    gap: var(--nexcart-space-2);
}

.nexcart-thankyou-totals-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--nexcart-space-4);
    margin: 0;
    font-size: var(--nexcart-font-size-base);
}

.nexcart-thankyou-totals-row dt {
    color: var(--nexcart-text-muted);
    font-weight: var(--nexcart-font-weight-regular);
    margin: 0;
}

.nexcart-thankyou-totals-row dd {
    color: var(--nexcart-text);
    font-weight: var(--nexcart-font-weight-semibold);
    margin: 0;
    font-variant-numeric: tabular-nums;
}

.nexcart-thankyou-totals-row--discount dd {
    color: var(--nexcart-success-accent);
}

.nexcart-thankyou-totals-row--grand {
    margin-top: var(--nexcart-space-3);
    padding-top: var(--nexcart-space-4);
    border-top: 1px solid var(--nexcart-border);
    font-size: var(--nexcart-font-size-lg);
}

.nexcart-thankyou-totals-row--grand dt {
    color: var(--nexcart-text);
    font-weight: var(--nexcart-font-weight-semibold);
    letter-spacing: var(--nexcart-letter-spacing-tight);
}

.nexcart-thankyou-totals-row--grand dd {
    font-weight: var(--nexcart-font-weight-bold);
    font-size: var(--nexcart-font-size-xl);
    letter-spacing: var(--nexcart-letter-spacing-tight);
}

/* Addresses */
.nexcart-thankyou-addresses {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--nexcart-space-6);
}

.nexcart-thankyou-address {
    min-width: 0;
}

.nexcart-thankyou-address-title {
    font-size: var(--nexcart-font-size-xs);
    font-weight: var(--nexcart-font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: var(--nexcart-letter-spacing-wide);
    color: var(--nexcart-text-muted);
    margin: 0 0 var(--nexcart-space-2);
}

.nexcart-thankyou-address address {
    font-style: normal;
    font-size: var(--nexcart-font-size-base);
    color: var(--nexcart-text);
    line-height: var(--nexcart-line-height-loose);
    margin: 0;
}

/* CTAs */
.nexcart-thankyou-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--nexcart-space-3);
    margin-top: var(--nexcart-space-6);
}

.nexcart-thankyou-actions .nexcart-btn {
    min-width: 200px;
}

/* Responsive */
@media (max-width: 560px) {
    .nexcart-thankyou {
        margin: var(--nexcart-space-3) auto;
    }

    .nexcart-thankyou-hero {
        padding: var(--nexcart-space-2) var(--nexcart-space-2) var(--nexcart-space-4);
    }

    .nexcart-thankyou-card {
        padding: var(--nexcart-space-5) var(--nexcart-space-4);
        border-radius: var(--nexcart-radius-md);
    }

    .nexcart-thankyou-title {
        font-size: var(--nexcart-font-size-xl);
    }

    .nexcart-thankyou-meta {
        grid-template-columns: minmax(0, 1fr);
        gap: var(--nexcart-space-4);
    }

    .nexcart-thankyou-order-badge {
        max-width: 100%;
        flex-wrap: wrap;
        justify-content: center;
    }

    .nexcart-thankyou-order-badge-value {
        word-break: break-all;
    }

    .nexcart-thankyou-table thead {
        display: none;
    }

    .nexcart-thankyou-table,
    .nexcart-thankyou-table tbody,
    .nexcart-thankyou-table tr,
    .nexcart-thankyou-table td {
        display: block;
        width: 100%;
    }

    .nexcart-thankyou-table tbody tr {
        padding: var(--nexcart-space-3) 0;
        border-bottom: 1px solid var(--nexcart-border-subtle);
    }

    .nexcart-thankyou-table tbody tr:last-child {
        border-bottom: none;
    }

    .nexcart-thankyou-table tbody td {
        padding: var(--nexcart-space-1) 0;
        border: none;
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: var(--nexcart-space-3);
        text-align: right;
    }

    .nexcart-thankyou-table tbody td::before {
        content: attr(data-label);
        font-size: var(--nexcart-font-size-xs);
        color: var(--nexcart-text-muted);
        text-transform: uppercase;
        letter-spacing: var(--nexcart-letter-spacing-wide);
        font-weight: var(--nexcart-font-weight-semibold);
    }

    .nexcart-thankyou-table tbody td.nexcart-thankyou-col-product {
        font-weight: var(--nexcart-font-weight-semibold);
        padding-bottom: var(--nexcart-space-2);
    }

    .nexcart-thankyou-table tbody td.nexcart-thankyou-col-product::before {
        content: none;
    }

    .nexcart-thankyou-table tbody td.nexcart-thankyou-col-product .nexcart-thankyou-item-name {
        text-align: left;
        flex: 1;
    }

    .nexcart-thankyou-actions .nexcart-btn {
        width: 100%;
        min-width: 0;
    }
}


/* -------- Customer Account -------- */
/* The full account stylesheet has moved to assets/css/nexcart-account.css,
 * conditionally enqueued on the account surface only. The generic button
 * primitive below remains here because it's consumed by other templates
 * (e.g. product reviews) that live outside the account surface. */

.nexcart-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--nexcart-space-2);
    padding: var(--nexcart-space-3) var(--nexcart-space-5);
    border: 1px solid transparent;
    border-radius: var(--nexcart-radius-md);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.nexcart-btn--primary {
    background: var(--nexcart-accent);
    color: var(--nexcart-accent-foreground);
    border-color: var(--nexcart-accent);
}
.nexcart-btn--primary:hover {
    background: var(--nexcart-accent-hover);
    border-color: var(--nexcart-accent-hover);
}

.nexcart-btn--secondary {
    background: var(--nexcart-bg-surface);
    color: var(--nexcart-text);
    border-color: var(--nexcart-border-strong);
}
.nexcart-btn--secondary:hover {
    background: var(--nexcart-bg-surface-alt);
    border-color: var(--nexcart-text-muted);
}

.nexcart-btn--ghost {
    background: transparent;
    color: var(--nexcart-text-muted);
}
.nexcart-btn--ghost:hover {
    background: var(--nexcart-bg-surface-alt);
    color: var(--nexcart-text);
}

.nexcart-btn--small {
    padding: var(--nexcart-space-1) var(--nexcart-space-3);
    font-size: 13px;
    border-radius: var(--nexcart-radius-sm);
}

.nexcart-btn--full { width: 100%; }


/* -------- Product Reviews -------- */

.nexcart-reviews {
    margin: var(--nexcart-space-7) 0;
}

.nexcart-reviews-title {
    font-size: var(--nexcart-font-size-xl);
    font-weight: var(--nexcart-font-weight-bold);
    letter-spacing: var(--nexcart-letter-spacing-tight);
    margin: 0 0 var(--nexcart-space-4);
    color: var(--nexcart-text);
}

.nexcart-reviews-summary {
    margin-bottom: var(--nexcart-space-6);
    padding: var(--nexcart-space-4) var(--nexcart-space-5);
    background: var(--nexcart-bg-surface-alt);
    border: 1px solid var(--nexcart-border-subtle);
    border-radius: var(--nexcart-radius-md);
    display: inline-block;
}

.nexcart-reviews-average {
    display: flex;
    align-items: center;
    gap: var(--nexcart-space-3);
}

.nexcart-reviews-average-number {
    font-size: var(--nexcart-font-size-2xl);
    font-weight: var(--nexcart-font-weight-bold);
    color: var(--nexcart-text);
    font-variant-numeric: tabular-nums;
    line-height: var(--nexcart-line-height-tight);
}

.nexcart-star-rating {
    display: inline-flex;
    gap: 2px;
}

.nexcart-star {
    font-size: var(--nexcart-font-size-lg);
    line-height: 1;
}

.nexcart-star-filled { color: var(--nexcart-rating-accent); }
.nexcart-star-empty  { color: var(--nexcart-rating-track); }

.nexcart-reviews-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nexcart-review {
    padding: var(--nexcart-space-4) 0;
    border-bottom: 1px solid var(--nexcart-border-subtle);
}

.nexcart-review:last-child { border-bottom: none; }

.nexcart-review-header {
    display: flex;
    align-items: center;
    gap: var(--nexcart-space-3);
    flex-wrap: wrap;
    margin-bottom: var(--nexcart-space-2);
}

.nexcart-review-author {
    font-weight: var(--nexcart-font-weight-semibold);
    font-size: var(--nexcart-font-size-sm);
    color: var(--nexcart-text);
}

.nexcart-review-verified {
    display: inline-flex;
    align-items: center;
    gap: var(--nexcart-space-1);
    font-size: var(--nexcart-font-size-xs);
    color: var(--nexcart-success-fg);
    font-weight: var(--nexcart-font-weight-semibold);
    background: var(--nexcart-success-bg);
    border: 1px solid var(--nexcart-success-border);
    padding: 2px var(--nexcart-space-2);
    border-radius: var(--nexcart-radius-xs);
    line-height: var(--nexcart-line-height-tight);
}

.nexcart-review-date {
    font-size: var(--nexcart-font-size-sm);
    color: var(--nexcart-text-muted);
}

.nexcart-review-content {
    font-size: var(--nexcart-font-size-sm);
    line-height: var(--nexcart-line-height-loose);
    color: var(--nexcart-text);
}

.nexcart-reviews-none {
    color: var(--nexcart-text-muted);
    font-size: var(--nexcart-font-size-sm);
}

.nexcart-review-form-wrapper {
    margin-top: var(--nexcart-space-7);
    padding-top: var(--nexcart-space-6);
    border-top: 1px solid var(--nexcart-border);
}

.nexcart-review-form-title {
    font-size: var(--nexcart-font-size-lg);
    font-weight: var(--nexcart-font-weight-bold);
    margin: 0 0 var(--nexcart-space-4);
    color: var(--nexcart-text);
}

.nexcart-review-form textarea,
.nexcart-review-form input[type="text"],
.nexcart-review-form input[type="email"] {
    width: 100%;
    padding: var(--nexcart-space-3) var(--nexcart-space-4);
    background: var(--nexcart-bg-surface);
    border: 1px solid var(--nexcart-border-strong);
    border-radius: var(--nexcart-radius-md);
    color: var(--nexcart-text);
    font-size: var(--nexcart-font-size-sm);
    font-family: inherit;
    transition:
        border-color var(--nexcart-duration-base) var(--nexcart-ease),
        box-shadow var(--nexcart-duration-base) var(--nexcart-ease);
}

.nexcart-review-form textarea:focus,
.nexcart-review-form input[type="text"]:focus,
.nexcart-review-form input[type="email"]:focus {
    outline: none;
    border-color: var(--nexcart-border-focus);
    box-shadow: var(--nexcart-shadow-focus);
}

.nexcart-star-selector {
    display: inline-flex;
    gap: var(--nexcart-space-1);
    direction: rtl;
}

.nexcart-star-selector input[type="radio"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.nexcart-star-selector .nexcart-star-label {
    cursor: pointer;
    font-size: var(--nexcart-font-size-xl);
    color: var(--nexcart-rating-track);
    transition: color var(--nexcart-duration-fast) var(--nexcart-ease);
}

.nexcart-star-selector .nexcart-star-label:hover,
.nexcart-star-selector .nexcart-star-label:hover ~ .nexcart-star-label,
.nexcart-star-selector input[type="radio"]:checked ~ .nexcart-star {
    color: var(--nexcart-rating-accent);
}

.nexcart-star-selector input[type="radio"]:checked + .nexcart-star,
.nexcart-star-selector .nexcart-star-label:has(input:checked),
.nexcart-star-selector .nexcart-star-label:has(input:checked) ~ .nexcart-star-label {
    color: var(--nexcart-rating-accent);
}

.nexcart-star-selector input[type="radio"]:focus-visible + .nexcart-star,
.nexcart-star-selector .nexcart-star-label:has(input:focus-visible) {
    outline: 2px solid var(--nexcart-border-focus);
    outline-offset: 2px;
    border-radius: var(--nexcart-radius-xs);
}

.nexcart-btn-submit-review {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--nexcart-space-2);
    min-height: var(--nexcart-button-height);
    padding: 0 var(--nexcart-space-6);
    background: var(--nexcart-accent);
    color: var(--nexcart-accent-foreground);
    border: 1px solid transparent;
    border-radius: var(--nexcart-radius-md);
    font-size: var(--nexcart-font-size-base);
    font-weight: var(--nexcart-font-weight-semibold);
    letter-spacing: var(--nexcart-letter-spacing-tight);
    cursor: pointer;
    margin-top: var(--nexcart-space-2);
    transition:
        background-color var(--nexcart-duration-base) var(--nexcart-ease),
        transform var(--nexcart-duration-fast) var(--nexcart-ease);
}

.nexcart-btn-submit-review:hover,
.nexcart-btn-submit-review:focus-visible {
    background: var(--nexcart-accent-hover);
}

.nexcart-btn-submit-review:active {
    background: var(--nexcart-accent-active);
    transform: translateY(1px);
}

/* -------- Related, Upsell & Cross-sell Product Grids (legacy titles) -------- */

.nexcart-related-products,
.nexcart-upsell-products {
    margin: var(--nexcart-space-8) 0;
}

.nexcart-related-products-title,
.nexcart-upsell-products-title {
    font-size: var(--nexcart-font-size-xl);
    font-weight: var(--nexcart-font-weight-bold);
    letter-spacing: var(--nexcart-letter-spacing-tight);
    margin: 0 0 var(--nexcart-space-5);
    color: var(--nexcart-text);
}

/* -------- Breadcrumbs -------- */

.nexcart-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: var(--nexcart-space-3) 0;
    font-size: var(--nexcart-font-size-sm);
    color: var(--nexcart-text-muted);
    line-height: var(--nexcart-line-height-base);
}

.nexcart-breadcrumb-item a {
    color: var(--nexcart-text-muted);
    text-decoration: none;
    transition: color var(--nexcart-duration-base) var(--nexcart-ease);
}

.nexcart-breadcrumb-item a:hover,
.nexcart-breadcrumb-item a:focus-visible {
    color: var(--nexcart-text);
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

.nexcart-breadcrumb-active {
    color: var(--nexcart-text);
    font-weight: var(--nexcart-font-weight-semibold);
}

/* -------- Product Gallery -------- */

.nexcart-product-gallery {
    max-width: 600px;
}

.nexcart-gallery-main {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--nexcart-border);
    border-radius: var(--nexcart-radius-md);
    background: var(--nexcart-bg-surface-alt);
    margin-bottom: var(--nexcart-space-3);
}

.nexcart-gallery-main-image {
    display: block;
    width: 100%;
    height: auto;
    cursor: zoom-in;
    transition: transform var(--nexcart-duration-slower) var(--nexcart-ease-emphasize);
}

.nexcart-gallery-main-image:hover {
    transform: scale(1.03);
}

.nexcart-gallery-thumbnails {
    display: flex;
    gap: var(--nexcart-space-2);
    flex-wrap: wrap;
}

.nexcart-gallery-thumb {
    width: 72px;
    height: 72px;
    padding: 0;
    border: 2px solid var(--nexcart-border);
    border-radius: var(--nexcart-radius-sm);
    overflow: hidden;
    cursor: pointer;
    background: var(--nexcart-bg-surface-alt);
    transition:
        border-color var(--nexcart-duration-base) var(--nexcart-ease),
        transform var(--nexcart-duration-fast) var(--nexcart-ease);
    flex-shrink: 0;
}

.nexcart-gallery-thumb:hover,
.nexcart-gallery-thumb:focus-visible,
.nexcart-gallery-thumb.active {
    border-color: var(--nexcart-border-focus);
}

.nexcart-gallery-thumb:focus-visible {
    outline: 2px solid transparent;
    box-shadow: var(--nexcart-shadow-focus);
}

.nexcart-gallery-thumb:active {
    transform: scale(0.97);
}

.nexcart-gallery-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* -------- Lightbox -------- */

.nexcart-lightbox {
    position: fixed;
    inset: 0;
    z-index: var(--nexcart-z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition:
        opacity var(--nexcart-duration-slow) var(--nexcart-ease),
        visibility var(--nexcart-duration-slow) var(--nexcart-ease);
}

.nexcart-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.nexcart-lightbox-overlay {
    position: absolute;
    inset: 0;
    background: var(--nexcart-overlay-strong);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.nexcart-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    z-index: 1;
}

.nexcart-lightbox-image {
    display: block;
    max-width: 90vw;
    max-height: 85vh;
    border-radius: var(--nexcart-radius-md);
    box-shadow: var(--nexcart-shadow-overlay);
}

.nexcart-lightbox-close,
.nexcart-lightbox-prev,
.nexcart-lightbox-next {
    position: absolute;
    background: var(--nexcart-overlay-control-bg);
    border: none;
    color: var(--nexcart-overlay-control-fg);
    cursor: pointer;
    line-height: 1;
    transition:
        background-color var(--nexcart-duration-base) var(--nexcart-ease),
        transform var(--nexcart-duration-fast) var(--nexcart-ease);
}

.nexcart-lightbox-close {
    top: calc(-1 * var(--nexcart-space-8));
    right: 0;
    width: var(--nexcart-touch-target);
    height: var(--nexcart-touch-target);
    padding: 0;
    font-size: var(--nexcart-font-size-2xl);
    border-radius: var(--nexcart-radius-pill);
    background: transparent;
}

.nexcart-lightbox-close:hover,
.nexcart-lightbox-close:focus-visible {
    background: var(--nexcart-overlay-control-bg);
}

.nexcart-lightbox-prev,
.nexcart-lightbox-next {
    top: 50%;
    transform: translateY(-50%);
    width: var(--nexcart-touch-target);
    height: var(--nexcart-touch-target);
    padding: 0;
    font-size: var(--nexcart-font-size-2xl);
    border-radius: var(--nexcart-radius-pill);
}

.nexcart-lightbox-prev:hover,
.nexcart-lightbox-prev:focus-visible,
.nexcart-lightbox-next:hover,
.nexcart-lightbox-next:focus-visible {
    background: var(--nexcart-overlay-control-hover-bg);
}

.nexcart-lightbox-close:focus-visible,
.nexcart-lightbox-prev:focus-visible,
.nexcart-lightbox-next:focus-visible {
    outline: 2px solid var(--nexcart-overlay-control-fg);
    outline-offset: 2px;
}

.nexcart-lightbox-prev { left: calc(-1 * var(--nexcart-space-10)); }
.nexcart-lightbox-next { right: calc(-1 * var(--nexcart-space-10)); }

@media (max-width: 768px) {
    .nexcart-lightbox-prev { left: var(--nexcart-space-1); }
    .nexcart-lightbox-next { right: var(--nexcart-space-1); }
    .nexcart-lightbox-close {
        top: calc(-1 * var(--nexcart-space-7));
        right: calc(-1 * var(--nexcart-space-1));
    }
}

/* -------- Product Filter -------- */

.nexcart-product-filter {
    font-size: var(--nexcart-font-size-sm);
    color: var(--nexcart-text);
}

.nexcart-filter-section {
    margin-bottom: var(--nexcart-space-5);
    padding-bottom: var(--nexcart-space-4);
    border-bottom: 1px solid var(--nexcart-border-subtle);
}

.nexcart-filter-section:last-of-type {
    border-bottom: none;
}

.nexcart-filter-title {
    font-size: var(--nexcart-font-size-xs);
    font-weight: var(--nexcart-font-weight-semibold);
    letter-spacing: var(--nexcart-letter-spacing-wide);
    text-transform: uppercase;
    margin: 0 0 var(--nexcart-space-3);
    color: var(--nexcart-text-muted);
}

.nexcart-filter-category-list,
.nexcart-filter-rating-list,
.nexcart-filter-attribute-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nexcart-filter-category-list li,
.nexcart-filter-rating-list li,
.nexcart-filter-attribute-list li {
    margin-bottom: var(--nexcart-space-2);
}

.nexcart-filter-category-list label,
.nexcart-filter-rating-list label,
.nexcart-filter-attribute-list label,
.nexcart-filter-stock-label {
    display: flex;
    align-items: center;
    gap: var(--nexcart-space-2);
    cursor: pointer;
    font-size: var(--nexcart-font-size-sm);
    color: var(--nexcart-text);
    padding: var(--nexcart-space-1) 0;
    border-radius: var(--nexcart-radius-xs);
    transition: color var(--nexcart-duration-fast) var(--nexcart-ease);
}

.nexcart-filter-category-list label:hover,
.nexcart-filter-rating-list label:hover,
.nexcart-filter-attribute-list label:hover,
.nexcart-filter-stock-label:hover {
    color: var(--nexcart-accent);
}

.nexcart-filter-category-list label input[type="checkbox"],
.nexcart-filter-rating-list label input[type="checkbox"],
.nexcart-filter-attribute-list label input[type="checkbox"],
.nexcart-filter-stock-label input[type="checkbox"] {
    accent-color: var(--nexcart-accent);
    width: 16px;
    height: 16px;
}

.nexcart-filter-count {
    color: var(--nexcart-text-muted);
    font-size: var(--nexcart-font-size-xs);
    font-variant-numeric: tabular-nums;
}

.nexcart-filter-price-range {
    display: flex;
    align-items: center;
    gap: var(--nexcart-space-2);
}

.nexcart-filter-price-input {
    width: 96px;
    min-height: 36px;
    padding: 0 var(--nexcart-space-3);
    background: var(--nexcart-bg-surface);
    border: 1px solid var(--nexcart-border-strong);
    border-radius: var(--nexcart-radius-sm);
    color: var(--nexcart-text);
    font-size: var(--nexcart-font-size-sm);
    font-variant-numeric: tabular-nums;
    transition:
        border-color var(--nexcart-duration-base) var(--nexcart-ease),
        box-shadow var(--nexcart-duration-base) var(--nexcart-ease);
}

.nexcart-filter-price-input:focus {
    outline: none;
    border-color: var(--nexcart-border-focus);
    box-shadow: var(--nexcart-shadow-focus);
}

.nexcart-filter-price-separator {
    color: var(--nexcart-text-muted);
    font-size: var(--nexcart-font-size-md);
}

.nexcart-filter-stars {
    color: var(--nexcart-rating-accent);
    letter-spacing: 1px;
}

.nexcart-filter-actions {
    display: flex;
    gap: var(--nexcart-space-2);
    margin-top: var(--nexcart-space-4);
}

.nexcart-filter-reset {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--nexcart-space-2);
    min-height: 36px;
    padding: 0 var(--nexcart-space-4);
    background: var(--nexcart-bg-surface);
    color: var(--nexcart-text);
    border: 1px solid var(--nexcart-border-strong);
    border-radius: var(--nexcart-radius-sm);
    font-size: var(--nexcart-font-size-sm);
    font-weight: var(--nexcart-font-weight-semibold);
    cursor: pointer;
    transition:
        background-color var(--nexcart-duration-base) var(--nexcart-ease),
        border-color var(--nexcart-duration-base) var(--nexcart-ease);
}

.nexcart-filter-reset:hover,
.nexcart-filter-reset:focus-visible {
    background: var(--nexcart-bg-surface-alt);
    border-color: var(--nexcart-border-focus);
}

.nexcart-filter-reset:focus-visible {
    outline: 2px solid transparent;
    box-shadow: var(--nexcart-shadow-focus);
}

.nexcart-filter-results {
    margin-top: var(--nexcart-space-5);
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--nexcart-space-5);
}

.nexcart-filter-results.loading {
    opacity: 0.5;
    pointer-events: none;
    transition: opacity var(--nexcart-duration-base) var(--nexcart-ease);
}

/* -------- Product Sort -------- */

.nexcart-product-sort {
    display: inline-flex;
    align-items: center;
    margin-bottom: var(--nexcart-space-4);
}

.nexcart-sort-select {
    min-height: 36px;
    padding: 0 var(--nexcart-space-8) 0 var(--nexcart-space-3);
    background: var(--nexcart-bg-surface);
    border: 1px solid var(--nexcart-border-strong);
    border-radius: var(--nexcart-radius-sm);
    font-size: var(--nexcart-font-size-sm);
    color: var(--nexcart-text);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='none' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M1 1l5 5 5-5'/></svg>");
    background-repeat: no-repeat;
    background-position: right var(--nexcart-space-3) center;
    transition:
        border-color var(--nexcart-duration-base) var(--nexcart-ease),
        box-shadow var(--nexcart-duration-base) var(--nexcart-ease);
}

.nexcart-sort-select:hover {
    border-color: var(--nexcart-border-focus);
}

.nexcart-sort-select:focus {
    outline: none;
    border-color: var(--nexcart-border-focus);
    box-shadow: var(--nexcart-shadow-focus);
}
