/* ===========================================================================
   Sea of Bricks — design tokens
   =========================================================================== */

:root {
    /* Type scale */
    --font-sans: 'Inter Tight', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', 'Segoe UI Mono', Menlo, Consolas, monospace;

    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* Radii */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-pill: 999px;

    /* Layout */
    --nav-h: 64px;
    --sidebar-w: 280px;
    --sidebar-sticky-top: calc(var(--nav-h) + var(--space-8));
    --sidebar-sticky-bottom: var(--space-8);
    --sidebar-h: calc(100svh - var(--sidebar-sticky-top) - var(--sidebar-sticky-bottom));
    --max-w: 1440px;
    --footer-scroll-gap: calc(var(--nav-h) + var(--space-8));

    /* Motion */
    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ----- Dark theme (default) -------------------------------------------- */
:root,
:root[data-theme='dark'] {
    --bg: #0b0d10;
    --bg-elev: #11141a;
    --surface: #14181f;
    --surface-2: #14181f;
    --surface-3: #20262f;
    --border: #232a35;
    --border-strong: #2f3744;
    --text: #e8ecf2;
    --text-muted: #98a3b3;
    --text-dim: #6b7585;

    /* Brand: Lumibricks orange + cyan X-ray contrast */
    --accent: #f97316;
    --accent-2: #22d3ee;
    --accent-soft: #fb923c;
    --accent-glow: rgba(249, 115, 22, 0.35);
    --accent-fade: rgba(249, 115, 22, 0.12);

    --btn-primary-bg: #9a3412;
    --btn-primary-bg-hover: #c2410c;
    --btn-primary-text: #fff7ed;
    --btn-primary-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);

    --good: #22c55e;
    --good-soft: #16a34a;
    --good-fade: rgba(34, 197, 94, 0.14);
    --warn: #f59e0b;
    --warn-fade: rgba(245, 158, 11, 0.14);
    --bad: #ef4444;
    --bad-soft: #dc2626;
    --bad-fade: rgba(239, 68, 68, 0.14);
    --info: #38bdf8;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.45);
    --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
    --shadow-glow: 0 0 0 1px rgba(249, 115, 22, 0.32), 0 8px 24px rgba(249, 115, 22, 0.20);

    /* Solid fallbacks where `color-mix()` is unavailable (Safari < 16.2, etc.) */
    --mix-nav-bg: rgba(11, 13, 16, 0.85);
    --mix-accent-border-40: rgba(249, 115, 22, 0.4);
    --mix-accent-bg-18: rgba(249, 115, 22, 0.18);
    --mix-accent-surface-8: #171a21;
    --mix-accent-border-blend: #3a3228;
    --mix-accent-shadow-12: rgba(249, 115, 22, 0.12);
    --mix-warn-surface-8: #181612;
    --mix-good-border-50: rgba(34, 197, 94, 0.5);
    --mix-warn-border-50: rgba(245, 158, 11, 0.5);
    --mix-accent-border-35: rgba(249, 115, 22, 0.35);
    --mix-good-border-35: rgba(34, 197, 94, 0.35);
    --mix-bad-border-35: rgba(239, 68, 68, 0.35);
}

/* ----- Light theme ----------------------------------------------------- */
:root[data-theme='light'] {
    --bg: #f7f8fa;
    --bg-elev: #ffffff;
    --surface: #ffffff;
    --surface-2: #ffffff;
    --surface-3: #e8eaef;
    --border: #e5e7eb;
    --border-strong: #d1d5db;
    --text: #0f172a;
    --text-muted: #4b5563;
    --text-dim: #9ca3af;

    /* Brand: deeper orange in light mode for contrast on white */
    --accent: #ea580c;
    --accent-2: #0891b2;
    --accent-soft: #f97316;
    --accent-glow: rgba(234, 88, 12, 0.22);
    --accent-fade: rgba(234, 88, 12, 0.08);

    --btn-primary-bg: #c2410c;
    --btn-primary-bg-hover: #9a3412;
    --btn-primary-text: #fff7ed;
    --btn-primary-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);

    --good: #059669;
    --good-soft: #047857;
    --good-fade: rgba(5, 150, 105, 0.08);
    --warn: #d97706;
    --warn-fade: rgba(217, 119, 6, 0.08);
    --bad: #dc2626;
    --bad-soft: #b91c1c;
    --bad-fade: rgba(220, 38, 38, 0.08);
    --info: #0284c7;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.07);
    --shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.10);
    --shadow-glow: 0 0 0 1px rgba(234, 88, 12, 0.20), 0 8px 24px rgba(234, 88, 12, 0.14);

    --mix-nav-bg: rgba(247, 248, 250, 0.85);
    --mix-accent-border-40: rgba(234, 88, 12, 0.4);
    --mix-accent-bg-18: rgba(234, 88, 12, 0.18);
    --mix-accent-surface-8: #fff7f2;
    --mix-accent-border-blend: #e8ddd4;
    --mix-accent-shadow-12: rgba(234, 88, 12, 0.12);
    --mix-warn-surface-8: #fff9f2;
    --mix-good-border-50: rgba(5, 150, 105, 0.5);
    --mix-warn-border-50: rgba(217, 119, 6, 0.5);
    --mix-accent-border-35: rgba(234, 88, 12, 0.35);
    --mix-good-border-35: rgba(5, 150, 105, 0.35);
    --mix-bad-border-35: rgba(220, 38, 38, 0.35);
}

@supports (color: color-mix(in srgb, red, blue)) {
    :root,
    :root[data-theme='dark'] {
        --mix-nav-bg: color-mix(in srgb, var(--bg) 85%, transparent);
        --mix-accent-border-40: color-mix(in srgb, var(--accent) 40%, transparent);
        --mix-accent-bg-18: color-mix(in srgb, var(--accent) 18%, transparent);
        --mix-accent-surface-8: color-mix(in srgb, var(--accent) 8%, var(--surface));
        --mix-accent-border-blend: color-mix(in srgb, var(--accent) 35%, var(--border));
        --mix-accent-shadow-12: color-mix(in srgb, var(--accent) 12%, transparent);
        --mix-warn-surface-8: color-mix(in srgb, var(--warn) 8%, var(--surface));
        --mix-good-border-50: color-mix(in srgb, var(--good) 50%, transparent);
        --mix-warn-border-50: color-mix(in srgb, var(--warn) 50%, transparent);
        --mix-accent-border-35: color-mix(in srgb, var(--accent) 35%, transparent);
        --mix-good-border-35: color-mix(in srgb, var(--good) 35%, transparent);
        --mix-bad-border-35: color-mix(in srgb, var(--bad) 35%, transparent);
    }

    :root[data-theme='light'] {
        --mix-nav-bg: color-mix(in srgb, var(--bg) 85%, transparent);
        --mix-accent-border-40: color-mix(in srgb, var(--accent) 40%, transparent);
        --mix-accent-bg-18: color-mix(in srgb, var(--accent) 18%, transparent);
        --mix-accent-surface-8: color-mix(in srgb, var(--accent) 8%, var(--surface));
        --mix-accent-border-blend: color-mix(in srgb, var(--accent) 35%, var(--border));
        --mix-accent-shadow-12: color-mix(in srgb, var(--accent) 12%, transparent);
        --mix-warn-surface-8: color-mix(in srgb, var(--warn) 8%, var(--surface));
        --mix-good-border-50: color-mix(in srgb, var(--good) 50%, transparent);
        --mix-warn-border-50: color-mix(in srgb, var(--warn) 50%, transparent);
        --mix-accent-border-35: color-mix(in srgb, var(--accent) 35%, transparent);
        --mix-good-border-35: color-mix(in srgb, var(--good) 35%, transparent);
        --mix-bad-border-35: color-mix(in srgb, var(--bad) 35%, transparent);
    }
}

/* ===========================================================================
   Reset & base
   =========================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
}

html,
body {
    width: 100%;
    height: 100%;
}

html {
    color-scheme: dark;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
    overflow-y: scroll;
}

@supports (scrollbar-gutter: stable) {
    html,
    body {
        scrollbar-gutter: stable;
    }

    html {
        overflow-y: auto;
    }
}

:root[data-theme='light'] {
    color-scheme: light;
}

body {
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.5;
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    overflow-x: hidden;
    transition: background 0.25s var(--ease), color 0.25s var(--ease);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    color: var(--accent-soft);
}

button {
    font: inherit;
    color: inherit;
    cursor: pointer;
    background: none;
    border: 0;
}

input,
select,
textarea {
    font: inherit;
    color: inherit;
}

ul {
    list-style: none;
}

h1, h2, h3, h4 {
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
}

::selection {
    background: var(--accent-glow);
    color: var(--text);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.mobile-only {
    display: none !important;
}

/* ===========================================================================
   Top nav
   =========================================================================== */

.site-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--nav-h);
    background: var(--mix-nav-bg);
    -webkit-backdrop-filter: saturate(140%) blur(12px);
    backdrop-filter: saturate(140%) blur(12px);
    border-bottom: 1px solid var(--border);
}

/* Horizontal scroll on an inner wrapper — sticky + overflow on the same
   element breaks touch scrolling on iOS Safari. */
.site-nav__scroll {
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
}

/* Drop panels extend below the bar — don't clip on hover, focus, or open state */
.site-nav:has(.nav-locale[data-open='true']) .site-nav__scroll,
.site-nav:has(.nav-locale:hover) .site-nav__scroll,
.site-nav:has(.nav-locale:focus-within) .site-nav__scroll,
.site-nav:has(.info-popover:hover) .site-nav__scroll,
.site-nav:has(.info-popover:focus-within) .site-nav__scroll,
.site-nav:has(.info-popover button[aria-expanded='true']) .site-nav__scroll {
    overflow: visible;
}

@supports (scrollbar-width: thin) {
    .site-nav__scroll {
        scrollbar-width: thin;
        scrollbar-color: var(--surface-3) transparent;
    }
}

.site-nav__scroll::-webkit-scrollbar {
    height: 5px;
}

.site-nav__scroll::-webkit-scrollbar-track {
    background: transparent;
}

.site-nav__scroll::-webkit-scrollbar-thumb {
    background: var(--surface-3);
    border-radius: var(--radius-pill);
}

.site-nav__scroll::-webkit-scrollbar-thumb:hover {
    background: var(--border-strong);
}

.site-nav__inner {
    max-width: var(--max-w);
    margin: 0 auto;
    height: 100%;
    padding: 0 var(--space-6);
    box-sizing: border-box;
    width: max-content;
    min-width: 100%;
    display: flex;
    align-items: center;
    gap: var(--space-6);
    flex-wrap: nowrap;
}

.brand {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.brand__logo-wrap {
    display: block;
    line-height: 0;
}

.brand__logo {
    display: block;
    height: 40px;
    width: auto;
    max-width: min(200px, 48vw);
}

.brand__logo--sm {
    height: 28px;
    max-width: 120px;
}

/* Legacy class names kept for any external references */
.brand__mark {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 6px var(--accent-glow));
}

.brand__mark--sm {
    width: 24px;
    height: 24px;
}

.brand__wordmark {
    font-family: var(--font-sans);
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: -0.02em;
    background: orange;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.site-nav__spacer {
    flex: 1 1 0;
    min-width: 0;
}

.site-nav__actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
    flex-wrap: nowrap;
}

.site-nav__actions > * {
    flex-shrink: 0;
}

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.18s var(--ease);
}

.icon-btn:hover {
    color: var(--text);
    border-color: var(--border-strong);
    background: var(--surface-2);
    transform: translateY(-1px);
}

.icon-btn--small {
    width: 32px;
    height: 32px;
}

/* Unified locale panel (language + ship-to + currency) */
.nav-locale {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
}

.nav-locale__trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.2;
    flex-shrink: 0;
    transition: border-color 0.18s var(--ease), background-color 0.18s var(--ease);
}

.nav-locale__trigger:hover {
    border-color: var(--border-strong);
    background-color: var(--surface-2);
}

.nav-locale__trigger:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-fade);
}

.nav-locale__summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.02em;
}

.nav-locale__summary-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.nav-locale__summary-flag {
    display: inline-flex;
    width: 20px;
    height: 15px;
    border-radius: 2px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--surface-2);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.nav-locale__summary-flag img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.nav-locale__summary-label {
    white-space: nowrap;
}

.nav-locale__sep {
    color: var(--text-muted);
    font-weight: 500;
}

.nav-locale__chev {
    width: 10px;
    height: 10px;
    color: var(--text-muted);
    transition: transform 0.18s var(--ease);
    margin-left: 2px;
    flex-shrink: 0;
}

.nav-locale[data-open='true'] .nav-locale__chev {
    transform: rotate(180deg);
}

.nav-locale__panel {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    width: max-content;
    max-width: calc(100vw - 24px);
    max-height: calc(100dvh - var(--nav-h) - 12px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.nav-locale__grid {
    display: grid;
    grid-template-columns: max-content max-content max-content;
    align-items: stretch;
}

.nav-locale__col {
    display: flex;
    flex-direction: column;
    width: max-content;
    padding: 12px 16px 14px;
    border-right: 1px solid var(--border);
}

.nav-locale__col:last-child {
    border-right: none;
}

.nav-locale__col-head {
    margin: -12px -16px 8px;
    padding: 10px 16px 8px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}

.nav-locale__list {
    margin: 0;
    padding: 6px 0;
    list-style: none;
    flex: 1;
}

.nav-locale__list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    -webkit-user-select: none;
    user-select: none;
}

.nav-locale__list li:hover {
    background: var(--surface-2);
}

.nav-locale__list li[aria-selected='true'] {
    background: var(--accent-fade);
    color: var(--accent);
}

.nav-locale__list .opt-flag {
    display: inline-flex;
    width: 20px;
    height: 15px;
    border-radius: 2px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--surface-2);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.nav-locale__list .opt-flag img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.nav-locale__list .opt-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Nav selects (language + currency) — small dropdown pills sized to match the
   icon-btn so they sit cleanly in the top-right action cluster. */
.nav-dd {
    position: relative;
    display: inline-block;
}

.nav-dd__trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 8px 0 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.2;
    transition: border-color 0.18s var(--ease), background-color 0.18s var(--ease);
}

.nav-dd__trigger:hover {
    border-color: var(--border-strong);
    background-color: var(--surface-2);
}

.nav-dd__trigger:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-fade);
}

.nav-dd__flag {
    display: inline-flex;
    width: 20px;
    height: 15px;
    border-radius: 2px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--surface-2);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.nav-dd__flag img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.nav-dd__label {
    letter-spacing: 0.02em;
}

.nav-dd__chev {
    width: 10px;
    height: 10px;
    color: var(--text-muted);
    transition: transform 0.18s var(--ease);
    margin-left: 2px;
    flex-shrink: 0;
}

.nav-dd[data-open='true'] .nav-dd__chev {
    transform: rotate(180deg);
}

.nav-dd__menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 100%;
    margin: 0;
    padding: 4px;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 100;
}

.nav-dd__menu li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px 6px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    -webkit-user-select: none;
    user-select: none;
}

.nav-dd__menu li:hover,
.nav-dd__menu li.is-active {
    background: var(--surface-2);
}

.nav-dd__menu li[aria-selected='true'] {
    background: var(--accent-fade);
    color: var(--accent);
}

.nav-dd__menu .opt-flag {
    display: inline-flex;
    width: 20px;
    height: 15px;
    border-radius: 2px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--surface-2);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.nav-dd__menu .opt-flag img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

@media (max-width: 720px) {
    .site-nav__inner {
        gap: var(--space-3);
        padding: 0 var(--space-4);
        max-width: none;
    }

    .site-nav__spacer {
        flex: 1 1 12px;
        min-width: 12px;
    }

    .nav-locale__trigger {
        height: 34px;
        font-size: 0.8rem;
        padding: 0 8px;
        gap: 5px;
    }

    .nav-locale__panel {
        width: min(100%, calc(100vw - 24px));
        max-width: calc(100vw - 24px);
        max-height: calc(100dvh - var(--nav-h) - 8px);
    }

    .nav-locale__grid {
        grid-template-columns: 1fr;
        width: 100%;
    }

    .nav-locale__col {
        width: 100%;
        min-width: 0;
        padding: 10px 14px 12px;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .nav-locale__col-head {
        margin: -10px -14px 8px;
        padding: 10px 14px 8px;
    }

    .nav-locale__col:last-child {
        border-bottom: none;
    }

    .nav-locale__summary-flag {
        width: 18px;
        height: 13px;
    }

    .nav-locale__list .opt-flag {
        width: 18px;
        height: 13px;
    }

    .nav-dd__trigger {
        height: 34px;
        font-size: 0.8rem;
        padding: 0 6px;
        gap: 5px;
    }

    .nav-dd__flag,
    .nav-dd__menu .opt-flag {
        width: 18px;
        height: 13px;
    }
}

.icon-btn .icon {
    width: 18px;
    height: 18px;
}

/* Theme-toggle: show only the relevant icon */
.icon-btn .icon--moon {
    display: none;
}
:root[data-theme='light'] .icon-btn .icon--sun {
    display: none;
}
:root[data-theme='light'] .icon-btn .icon--moon {
    display: block;
}

/* Info popover (affiliate disclosure) */
.info-popover {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
}

/* Invisible bridge in the gap above the panel (replaces ::after so it never blocks link clicks). */
.info-popover__panel::before {
    content: none;
    position: absolute;
    top: -8px;
    left: 0;
    right: 0;
    height: 8px;
}

.info-popover:hover .info-popover__panel::before,
.info-popover:focus-within .info-popover__panel::before,
.info-popover button[aria-expanded='true'] + .info-popover__panel::before {
    content: '';
}

.info-popover__panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 280px;
    max-width: calc(100vw - 32px);
    padding: var(--space-3) var(--space-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    color: var(--text);
    font-size: 13px;
    line-height: 1.5;
    text-align: left;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition:
        opacity 0.18s var(--ease),
        transform 0.18s var(--ease),
        visibility 0s linear 0.18s;
    z-index: 200;
    pointer-events: none;
}

.info-popover:hover .info-popover__panel,
.info-popover:focus-within .info-popover__panel,
.info-popover button[aria-expanded='true'] + .info-popover__panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition-delay: 0s;
    pointer-events: auto;
}

.info-popover__title {
    margin: 0 0 4px;
    font-weight: 600;
    font-size: 13px;
    color: var(--text);
}

.info-popover__body {
    margin: 0;
    color: var(--text-muted);
}

.contact-popover__panel {
    width: min(300px, calc(100vw - 32px));
}

.contact-links {
    list-style: none;
    margin: var(--space-2) 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.contact-links li {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.contact-links__entry {
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: inherit;
    text-decoration: none;
}

.contact-links__entry:hover .contact-links__value {
    text-decoration: underline;
}

.contact-links__entry--static {
    cursor: default;
}

.contact-links__entry--static:hover .contact-links__value {
    text-decoration: none;
}

.contact-links__label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.contact-links__value {
    color: var(--accent);
    word-break: break-word;
}

.nav-support-btn {
    height: 38px;
    padding: 0 12px;
    font-size: 0.85rem;
    flex-shrink: 0;
}

/* ===========================================================================
   Buttons
   =========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.92rem;
    border: 1px solid transparent;
    transition: all 0.18s var(--ease);
    white-space: nowrap;
}

.btn--primary {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    box-shadow: var(--btn-primary-shadow);
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
}

.btn--primary:hover {
    background: var(--btn-primary-bg-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
    color: var(--btn-primary-text);
}

.btn--ghost {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}

.btn--ghost:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
}

.btn--block {
    width: 100%;
}

.btn-link {
    background: none;
    color: var(--accent-soft);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 4px 6px;
    border-radius: 4px;
}

.btn-link:hover {
    color: var(--accent);
    background: var(--accent-fade);
}

/* ===========================================================================
   First-visit welcome dialog
   =========================================================================== */

body.welcome-dialog-open {
    overflow: hidden;
    touch-action: none;
}

.welcome-dialog {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding:
        max(var(--space-4), env(safe-area-inset-top, 0px))
        max(var(--space-4), env(safe-area-inset-right, 0px))
        max(var(--space-4), env(safe-area-inset-bottom, 0px))
        max(var(--space-4), env(safe-area-inset-left, 0px));
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s var(--ease), visibility 0.22s var(--ease);
}

.welcome-dialog.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.welcome-dialog__backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    padding: 0;
    margin: 0;
    background: rgba(0, 0, 0, 0.62);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    cursor: pointer;
}

.welcome-dialog__panel {
    position: relative;
    z-index: 1;
    width: min(440px, 100%);
    max-height: min(88vh, calc(100svh - 2 * var(--space-4)));
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: calc(var(--space-6) + var(--space-2)) var(--space-6) var(--space-6);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xl);
    background: var(--surface);
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--accent-fade);
    transform: translateY(12px) scale(0.98);
    transition: transform 0.22s var(--ease);
}

.welcome-dialog.is-open .welcome-dialog__panel {
    transform: translateY(0) scale(1);
}

.welcome-dialog__close {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    z-index: 2;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-color: var(--border-strong);
    background: var(--surface-3);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

.welcome-dialog__close:hover {
    color: var(--text);
    border-color: var(--text-muted);
    background: var(--border-strong);
    transform: none;
}

.welcome-dialog__title {
    margin: 0 var(--space-8) var(--space-4) 0;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

.welcome-dialog__body {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin: 0 0 var(--space-4);
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.55;
}

.welcome-dialog__body p {
    margin: 0;
}

.welcome-dialog__em {
    font-style: normal;
    font-weight: 700;
    color: var(--accent-soft);
}

.welcome-dialog__em--good {
    color: var(--good);
}

.welcome-dialog__question {
    margin-top: var(--space-1);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border);
    color: var(--text);
    font-weight: 600;
}

.welcome-dialog__footnote {
    margin: 0 0 var(--space-4);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.45;
}

.welcome-dialog .btn--primary {
    background: var(--text);
    color: var(--bg);
    box-shadow: var(--shadow-sm);
    text-shadow: none;
}

.welcome-dialog .btn--primary:hover {
    filter: brightness(0.92);
    color: var(--bg);
    box-shadow: var(--shadow-md);
}

@media (max-width: 520px) {
    .welcome-dialog {
        align-items: flex-end;
        padding:
            max(var(--space-3), env(safe-area-inset-top, 0px))
            max(var(--space-3), env(safe-area-inset-right, 0px))
            max(var(--space-3), env(safe-area-inset-bottom, 0px))
            max(var(--space-3), env(safe-area-inset-left, 0px));
    }

    .welcome-dialog__panel {
        width: 100%;
        max-height: min(90svh, 100%);
        padding: calc(var(--space-5) + var(--space-2)) var(--space-5) max(var(--space-5), env(safe-area-inset-bottom, 0px));
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
    }

    .welcome-dialog.is-open .welcome-dialog__panel {
        transform: translateY(0) scale(1);
    }

    .welcome-dialog__title {
        font-size: 1.12rem;
        margin-right: var(--space-6);
    }

    .welcome-dialog__body {
        font-size: 0.92rem;
    }
}

/* ===========================================================================
   Recently updated strip (between nav and main)
   =========================================================================== */

.recent-updates-strip {
    background: var(--bg);
}

.recent-updates-strip--expanded {
    border-bottom: 1px solid var(--border);
}

.recent-updates__shell {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: var(--space-6) var(--space-6) var(--space-5);
    box-sizing: border-box;
}

.recent-updates-strip:not(.recent-updates-strip--expanded) .recent-updates__shell {
    padding-bottom: var(--space-2);
}

.recent-updates-strip:not(.recent-updates-strip--expanded):not([hidden]) + .layout {
    padding-top: var(--space-4);
}

.recent-updates__head {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-4);
    text-align: center;
    user-select: none;
    -webkit-user-select: none;
}

.recent-updates__title {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    margin: 0;
    font-size: clamp(1.35rem, 2.8vw, 1.85rem);
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.25;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.recent-updates__count {
    font-weight: 800;
    color: var(--accent-soft);
    letter-spacing: 0.02em;
}

.recent-updates-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 40px;
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--mix-accent-border-blend, var(--border-strong));
    border-radius: var(--radius-pill);
    background: var(--accent-fade);
    color: var(--accent);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    transition:
        color 0.2s var(--ease),
        border-color 0.2s var(--ease),
        box-shadow 0.2s var(--ease),
        background-color 0.2s var(--ease);
}

.recent-updates-toggle__action,
.recent-updates-toggle__new {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    line-height: 1;
    white-space: nowrap;
}

.recent-updates-toggle__new {
    color: var(--good);
}

.recent-updates-toggle:hover {
    color: var(--accent-soft);
    border-color: var(--accent);
    background: var(--mix-accent-bg-18, var(--accent-fade));
    box-shadow: 0 2px 10px var(--mix-accent-shadow-12, var(--accent-fade));
}

.recent-updates-toggle:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-fade);
}

.recent-updates-toggle--new {
    color: var(--good);
    border-color: var(--good-soft);
    background: var(--good-fade);
    animation: recent-updates-toggle-pulse 2.2s ease-in-out infinite;
}

@keyframes recent-updates-toggle-pulse {
    0%, 100% {
        box-shadow: 0 0 8px var(--good-fade);
    }
    50% {
        box-shadow: 0 0 16px var(--good-fade), 0 0 28px var(--good-fade);
    }
}

.recent-updates-toggle__chev {
    display: block;
    stroke-width: 2.5;
    transition: transform 0.2s var(--ease);
}

.recent-updates-toggle[aria-expanded='true'] .recent-updates-toggle__chev {
    transform: rotate(180deg);
}

.recent-updates {
    padding-top: var(--space-5);
}

.recent-updates__carousel {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-inline: 44px;
    user-select: none;
    -webkit-user-select: none;
}

.recent-updates__viewport {
    overflow: hidden;
    min-width: 0;
    width: 100%;
    display: flex;
    justify-content: center;
}

.recent-updates__track {
    display: grid;
    grid-template-columns: repeat(var(--recent-cols, 1), minmax(0, 220px));
    gap: var(--space-5);
    justify-content: center;
    align-items: stretch;
    width: fit-content;
    max-width: 100%;
    margin-inline: auto;
}

.recent-updates__track .product-card {
    width: 100%;
    max-width: 220px;
    height: 100%;
    display: flex;
    flex-direction: column;
    user-select: text;
    -webkit-user-select: text;
}

.recent-updates__track .product-info {
    flex: 1 1 auto;
}

.recent-updates__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--mix-accent-border-blend, var(--border-strong));
    border-radius: var(--radius-pill);
    background: var(--accent-fade);
    color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    box-shadow: 0 2px 8px var(--mix-accent-shadow-12, rgba(0, 0, 0, 0.18));
    transition:
        color 0.2s var(--ease),
        border-color 0.2s var(--ease),
        background-color 0.2s var(--ease),
        box-shadow 0.2s var(--ease);
}

.recent-updates__nav svg {
    stroke-width: 2.5;
}

#recent-updates-prev {
    left: 0;
}

#recent-updates-next {
    right: 0;
}

.recent-updates__nav:hover {
    color: var(--accent-soft);
    border-color: var(--accent);
    background: var(--mix-accent-bg-18, var(--accent-fade));
    box-shadow: 0 4px 14px var(--mix-accent-shadow-12, var(--accent-glow));
}

.recent-updates__nav:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-fade);
}

.recent-updates__nav[hidden] {
    display: none;
}

@media (max-width: 1100px) {
    .recent-updates__shell {
        padding-inline: var(--space-4);
    }
}

@media (max-width: 520px) {
    .recent-updates__shell {
        padding: var(--space-5) var(--space-4) var(--space-4);
    }

    .recent-updates-strip:not(.recent-updates-strip--expanded) .recent-updates__shell {
        padding-bottom: var(--space-2);
    }

    .recent-updates__carousel {
        padding-inline: 0;
    }

    .recent-updates__nav {
        width: 32px;
        height: 32px;
    }

    #recent-updates-prev {
        left: -4px;
    }

    #recent-updates-next {
        right: -4px;
    }

    .recent-updates__track {
        grid-template-columns: repeat(var(--recent-cols, 1), minmax(0, 1fr));
    }

    .recent-updates__track .product-card {
        max-width: none;
    }
}

/* ===========================================================================
   Layout: sidebar + results
   =========================================================================== */

.layout {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: var(--space-8) var(--space-6);
    padding-bottom: var(--space-8);
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    column-gap: var(--space-8);
    align-items: stretch;
}

.sidebar-col {
    grid-column: 1;
    min-width: 0;
}

.results {
    grid-column: 2;
    min-width: 0;
    padding-bottom: var(--footer-scroll-gap);
}

/* ===========================================================================
   Sidebar
   =========================================================================== */

.sidebar {
    position: sticky;
    top: var(--sidebar-sticky-top);
    height: var(--sidebar-h);
    max-height: var(--sidebar-h);
    overflow-y: auto;
    overscroll-behavior: contain;
    scroll-padding-bottom: var(--space-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0;
    box-shadow: var(--shadow-sm);
}

.sidebar__inner {
    display: flex;
    flex-direction: column;
    padding: var(--space-5);
    padding-bottom: var(--space-8);
}

@supports (scrollbar-gutter: stable) {
    .sidebar {
        scrollbar-gutter: stable;
    }
}

@supports (scrollbar-color: #000 #fff) {
    .sidebar {
        scrollbar-width: auto;
        scrollbar-color: var(--surface-3) transparent;
    }
}

.sidebar::-webkit-scrollbar {
    width: 14px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--surface-3);
    border-radius: var(--radius-pill);
    border: 3px solid var(--surface);
    background-clip: padding-box;
    min-height: 32px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--border-strong);
    background-clip: padding-box;
}

.sidebar::-webkit-scrollbar-corner {
    background: transparent;
}

.sidebar__head {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.sidebar__title {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-right: auto;
}

/* Live product count in the sidebar header — sits next to "Filters" as a
   plain inline label, no badge styling. */
.sidebar__count {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
    line-height: 1.4;
}

.sidebar__count strong {
    color: var(--text);
    font-weight: 700;
    margin-right: 2px;
}

/* Sort-control wrapper inside the sidebar — gives the redesigned sort
   dropdown its own visual breathing room above the filter list. */
.sidebar__sort {
    margin-bottom: var(--space-2);
}

.sidebar__sort .sort-control {
    width: 100%;
    box-sizing: border-box;
}

.sidebar__sort .sort-control__select {
    flex: 1;
    min-width: 0;
}

.sidebar__apply {
    margin-top: var(--space-5);
}

.sidebar-backdrop {
    display: none;
}

/* Filter blocks */
.filter-block {
    padding: var(--space-3) 0;
}

.filter-block:last-of-type {
    border-bottom: 0;
}

.filter-block__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: var(--space-2);
}

.filter-block__label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-2);
}

.filter-block__head .filter-block__label {
    margin-bottom: 0;
}

.range-value {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text);
    background: var(--surface-2);
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
    font-variant-numeric: tabular-nums slashed-zero;
}

/* Search box */
.search-wrap {
    position: relative;
}

.search-wrap__icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-dim);
    pointer-events: none;
}

.search-wrap__clear {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-dim);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.18s var(--ease), background 0.18s var(--ease);
}

.search-wrap__clear:hover {
    color: var(--text);
    background: var(--surface);
}

.search-wrap__clear:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-fade);
}

.search-wrap__clear[hidden] {
    display: none;
}

.search-input {
    width: 100%;
    padding: 10px 36px 10px 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    background: var(--surface-2);
    color: var(--text);
    transition: border-color 0.2s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.search-input::placeholder {
    color: var(--text-dim);
}

.search-input:hover {
    border-color: var(--border-strong);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-fade);
    background: var(--surface);
}

/* Range sliders */
.dual-range {
    position: relative;
    height: 24px;
    margin-top: var(--space-2);
}

.dual-range-track,
.dual-range-progress {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 4px;
    border-radius: var(--radius-pill);
    pointer-events: none;
}

.dual-range-track {
    background: var(--surface-3);
}

.dual-range-progress {
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-soft) 100%);
    left: 0%;
    right: 0%;
}

.dual-range input[type='range'] {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 24px;
    margin: 0;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
}

.dual-range input[type='range']::-webkit-slider-runnable-track {
    height: 4px;
    background: transparent;
}

.dual-range input[type='range']::-webkit-slider-thumb {
    -webkit-appearance: none;
    pointer-events: auto;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--surface);
    background: var(--accent);
    cursor: pointer;
    margin-top: -6px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    transition: transform 0.15s var(--ease);
}

.dual-range input[type='range']::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.dual-range input[type='range']::-moz-range-track {
    height: 4px;
    background: transparent;
}

.dual-range input[type='range']::-moz-range-thumb {
    pointer-events: auto;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--surface);
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* Activity date inputs */
.activity-date-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
    margin-top: var(--space-2);
}

/* min-width:0 unlocks the columns: by default grid items inherit the
   intrinsic minimum of their content, which for <input type=date> is the
   placeholder text + native calendar icon (~140px in Chrome). Without this
   override the two date fields would overflow the sidebar. */
.activity-date-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
    min-width: 0;
}

.activity-date-field input[type='date'] {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 7px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text);
    font-size: 0.82rem;
    transition: border-color 0.18s var(--ease);
}

.activity-date-field input[type='date']:hover {
    border-color: var(--border-strong);
}

.activity-date-field input[type='date']:focus {
    outline: none;
    border-color: var(--accent);
}

.activity-date-filter:not(:has(#activity-date-enabled:checked)) .activity-date-inputs {
    opacity: 0.45;
    pointer-events: none;
}

/* Facet groups (Retailers, Warehouse, Collection) */
.facet {
    border-bottom: 1px dashed var(--border);
    padding: var(--space-3) 0;
}

.facet[open] .facet__head::after {
    transform: rotate(180deg);
}

.facet__head .filter-block__label {
    margin-bottom: 0;
}

.facet__head-action {
    margin-right: var(--space-3);
    flex-shrink: 0;
}

.facet--range .facet__body {
    margin-top: var(--space-2);
}

.facet__head {
    list-style: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    min-height: 30px;
    padding: 4px 0;
    -webkit-user-select: none;
    user-select: none;
    position: relative;
}

.facet__head::-webkit-details-marker {
    display: none;
}

.facet__head::after {
    content: '';
    width: 9px;
    height: 9px;
    border-right: 2px solid var(--accent);
    border-bottom: 2px solid var(--accent);
    transform: rotate(45deg);
    margin-right: 6px;
    transition:
        transform 0.18s var(--ease),
        border-color 0.18s var(--ease);
}

.facet__head:hover::after {
    border-color: var(--accent-soft);
}

.facet__count,
.facet__head .range-value {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    height: 22px;
    min-height: 22px;
    line-height: 1;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
    background: var(--surface-2);
    padding: 0 8px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
    margin-right: var(--space-3);
    margin-left: auto;
    white-space: nowrap;
    font-variant-numeric: tabular-nums slashed-zero;
    box-sizing: border-box;
}

.facet__head .range-value {
    color: var(--text);
}

.facet__count:empty {
    visibility: hidden;
    pointer-events: none;
}

.facet__count:empty::before {
    content: '\00a0';
}

.facet__head .range-value:empty {
    visibility: hidden;
    pointer-events: none;
}

.facet__head .range-value:empty::before {
    content: '\00a0';
}

.facet__body {
    margin-top: var(--space-3);
}

.facet__list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-right: 4px;
}

/* Toggle/checkbox rows */
.checkbox-row,
.toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text);
    transition: background 0.15s var(--ease);
    -webkit-user-select: none;
    user-select: none;
}

.checkbox-row:hover,
.toggle-row:hover {
    background: var(--surface-2);
}

.checkbox-row input[type='checkbox'],
.toggle-row input[type='checkbox'] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}

.facet__list .toggle-row,
.facet__list .checkbox-row {
    font-size: 0.88rem;
}

.facet__option-count {
    margin-left: auto;
    padding-left: var(--space-2);
    color: var(--accent-soft);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

.toggle-stack {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: var(--space-2);
}

.toggle-row--btn {
    border: 1px solid var(--border);
    background: var(--surface-2);
    text-align: left;
    width: 100%;
    transition: all 0.18s var(--ease);
}

.toggle-row__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-dim);
    flex-shrink: 0;
    transition: background 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.toggle-row--btn[aria-pressed='true'] {
    border-color: var(--bad);
    background: var(--bad-fade);
    color: var(--text);
}

.toggle-row--btn[aria-pressed='true'] .toggle-row__dot {
    background: var(--bad);
    box-shadow: 0 0 0 3px var(--bad-fade);
}

.toggle-row--hot {
    background: linear-gradient(135deg, var(--accent-fade), transparent);
    border: 1px solid var(--mix-accent-border-40);
    margin-bottom: 4px;
    font-weight: 600;
}

.toggle-row--hot:hover {
    background: linear-gradient(135deg, var(--mix-accent-bg-18), transparent);
    border-color: var(--accent);
}

.toggle-row--hot:has(input:checked) {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-soft) 100%);
    border-color: var(--accent);
    color: white;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.toggle-row__hint {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-left: 4px;
}

.toggle-row--hot:has(input:checked) .toggle-row__hint {
    color: rgba(255, 255, 255, 0.85);
}

/* ===========================================================================
   Results: applied-filter chips, toolbar, grid
   =========================================================================== */

.applied-filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
}

.applied-filters__label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.applied-filters__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: var(--accent-fade);
    border: 1px solid var(--accent);
    color: var(--text);
    border-radius: var(--radius-pill);
    font-size: 0.82rem;
    font-weight: 500;
    transition: all 0.15s var(--ease);
}

.chip__remove {
    color: var(--text-muted);
    line-height: 1;
    padding: 0 0 0 2px;
    font-size: 0.95rem;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.chip__remove:hover {
    background: var(--accent);
    color: white;
}

/* Sort dropdown — designed as the visual focal point of the results toolbar.
   Subtle accent gradient + left-edge accent stripe + accent caret + lift on
   hover make the control read as actionable without being loud. */
.sort-control {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding-left: 16px;
    background: linear-gradient(135deg,
        var(--mix-accent-surface-8) 0%,
        var(--surface) 60%);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition:
        border-color 0.18s var(--ease),
        box-shadow 0.18s var(--ease),
        transform 0.18s var(--ease),
        background 0.18s var(--ease);
}

.sort-control::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, var(--accent), var(--accent-soft));
}

.sort-control:hover {
    border-color: var(--mix-accent-border-blend);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--mix-accent-shadow-12);
}

.sort-control:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-fade);
    transform: translateY(-1px);
}

.sort-control__icon {
    width: 15px;
    height: 15px;
    color: var(--accent);
    flex-shrink: 0;
}

.sort-control__select {
    -webkit-appearance: none;
    appearance: none;
    border: none;
    background-color: transparent;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='%23f97316' d='M6 8.7 1.4 4.1l.9-.9L6 6.9l3.7-3.7.9.9z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 11px;
    padding: 9px 32px 9px 4px;
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    line-height: 1.2;
}

.sort-control__select:focus {
    outline: none;
}

.sort-control__select option {
    background: var(--surface);
    color: var(--text);
    font-weight: 500;
}

/* ===========================================================================
   Product cards
   =========================================================================== */

/* Default 4-column layout: floor sized so 4 cards fit comfortably at the
   typical results-pane width (~1100 px after sidebar). On narrower windows
   the grid wraps gracefully to 3 / 2 / 1 columns without leaving cards
   awkwardly wide. */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-5);
    margin-bottom: var(--space-10);
}

.product-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    isolation: isolate;
}

.product-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-lg);
}

.product-card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Special states */
.product-card.all-time-low-match {
    border-color: var(--bad);
    box-shadow: 0 4px 14px var(--bad-fade);
}

.product-card.all-time-low-match:hover {
    border-color: var(--bad);
    box-shadow: 0 8px 22px rgba(239, 68, 68, 0.25);
}

.product-card.new-listing {
    border-color: var(--good);
    box-shadow: 0 4px 14px var(--good-fade);
}

.product-card.new-listing:hover {
    border-color: var(--good);
    box-shadow: 0 8px 22px rgba(34, 197, 94, 0.25);
}

.product-card.retired-listing {
    border-color: var(--warn);
    box-shadow: 0 4px 14px var(--warn-fade);
}

.product-card.retired-listing:hover {
    border-color: var(--warn);
    box-shadow: 0 8px 22px rgba(245, 158, 11, 0.25);
}

.product-card.overpriced {
    border-color: var(--warn);
    background: linear-gradient(165deg, var(--surface) 0%, var(--mix-warn-surface-8) 100%);
    box-shadow: 0 4px 18px rgba(217, 119, 6, 0.18);
}

/* Image area */
.product-card__media {
    position: relative;
    aspect-ratio: 4 / 3;
    background: var(--surface-2);
    overflow: hidden;
}

.product-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: transparent;
    transition: transform 0.4s var(--ease);
}

.product-card:hover .product-image {
    transform: scale(1.04);
}

/* Top-right discount / overpriced corner ribbon — flush with the image edge,
   mirrors the NEW / RETIRED banners on the opposite corner. */
.image-corner-ribbon {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 3;
    pointer-events: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 12px;
    border-radius: 0 0 0 var(--radius-md);
    font-weight: 800;
    font-size: 0.95rem;
    line-height: 1;
    letter-spacing: 0.01em;
    box-shadow: -2px 2px 6px rgba(0, 0, 0, 0.25);
}

.image-corner-ribbon__text {
    line-height: 1;
    color: white;
    letter-spacing: 0.01em;
}

.image-corner-ribbon--overpriced {
    background: var(--bad);
}

.image-corner-ribbon--discount.image-corner-ribbon--tier-red {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

.image-corner-ribbon--discount.image-corner-ribbon--tier-orange {
    background: linear-gradient(135deg, #f97316, #ea580c);
}

.image-corner-ribbon--discount.image-corner-ribbon--tier-yellow {
    background: linear-gradient(135deg, #eab308, #ca8a04);
}

.image-corner-ribbon--discount.image-corner-ribbon--tier-yellow .image-corner-ribbon__text {
    color: #1a1a1a;
}

.image-corner-ribbon--discount.image-corner-ribbon--tier-green {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

.image-corner-ribbon--discount.image-corner-ribbon--tier-accent {
    background: linear-gradient(135deg, var(--accent), var(--accent-soft));
}

/* Top-left vertical NEW / RETIRED */
.image-corner-new-vertical,
.image-corner-retired-vertical {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    padding: 8px 6px;
    border-radius: 0 0 var(--radius-md) 0;
    box-shadow: var(--shadow-sm);
    font-family: var(--font-mono);
    font-weight: 800;
}

.image-corner-new-vertical {
    background: linear-gradient(165deg, #15803d, var(--good));
}

.image-corner-retired-vertical {
    background: linear-gradient(165deg, #92400e, var(--warn));
    pointer-events: auto;
    cursor: help;
}

.image-corner-new-vertical span,
.image-corner-retired-vertical span {
    display: block;
    font-size: 1rem;
    line-height: 1;
    text-align: center;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.image-corner-new-vertical span + span,
.image-corner-retired-vertical span + span {
    margin-top: 2px;
}

/* Card body */
.product-info {
    padding: var(--space-4) var(--space-5) var(--space-5);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

/* Retailer pill — single-line label showing the retailer name. Variant
   location / type render below as chips (see .product-locations). */
.retailer-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text);
    align-self: flex-start;
    max-width: 100%;
    white-space: nowrap;
}

.product-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Product location / variant chips — used for Lumibricks regions and for
   non-Lumibricks retailer variant location + type. */
.product-locations__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.product-location-chip {
    display: inline-block;
    font-size: 0.74rem;
    font-weight: 700;
    line-height: 1.2;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    background: var(--good-fade);
    border: 1px solid var(--mix-good-border-50);
    color: var(--good);
}

.product-location-chip--preorder {
    background: var(--warn-fade);
    border-color: var(--mix-warn-border-50);
    color: var(--warn);
}

.variant-tag {
    display: inline-block;
    padding: 3px 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.74rem;
    color: var(--text-muted);
    text-transform: capitalize;
    align-self: flex-start;
}

.collection-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.collection-tag {
    display: inline-block;
    padding: 2px 8px;
    background: var(--accent-fade);
    border: 1px solid var(--mix-accent-border-35);
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    color: var(--accent-soft);
    line-height: 1.3;
    font-weight: 500;
}

/* Price block */
.price-info {
    margin-top: auto;
    padding-top: var(--space-2);
}

.current-price {
    font-family: var(--font-mono);
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--accent-soft);
    line-height: 1.05;
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    font-variant-numeric: tabular-nums slashed-zero;
}

.current-price.overpriced-price {
    color: var(--bad);
}

.original-price {
    color: var(--text-dim);
    text-decoration: line-through;
    font-family: var(--font-mono);
    font-size: 0.92rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums slashed-zero;
}

.shipping-note {
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-top: 4px;
}

.shipping-note .referral-code-inline {
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* All-time-low block: visually separated from the current price by a thin
   divider, with the label on its own header row above the value row. The
   label always shows in full (no truncation needed at this layout). */
.all-time-low {
    margin-top: var(--space-3);
    padding-top: var(--space-2);
    border-top: 1px solid var(--border);
    font-size: 0.82rem;
    color: var(--text-muted);
}

.all-time-low .label {
    display: block;
    color: var(--text-dim);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
}

.all-time-low .atl-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.all-time-low .price {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--good);
    font-variant-numeric: tabular-nums slashed-zero;
    flex-shrink: 0;
    white-space: nowrap;
}

.all-time-low .atl-date {
    color: var(--text-dim);
    flex-shrink: 0;
    white-space: nowrap;
    margin-left: auto;
    font-size: 0.78rem;
}

/* Discount % vs. base price at the all-time low. Rendered as a compact tinted
   chip so the eye reads it as "label" rather than another inline number next
   to the actual price. Green for typical savings; red on the rare anomaly
   where ATL exceeds base. */
.all-time-low .atl-pct {
    flex-shrink: 0;
    white-space: nowrap;
    font-weight: 700;
    font-size: 0.7rem;
    line-height: 1.3;
    font-variant-numeric: tabular-nums;
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    letter-spacing: 0.02em;
}

.all-time-low .atl-pct--save {
    color: var(--good);
    background: var(--good-fade);
    border: 1px solid var(--mix-good-border-35);
}

.all-time-low .atl-pct--premium {
    color: var(--bad);
    background: var(--bad-fade);
    border: 1px solid var(--mix-bad-border-35);
}

/* ===========================================================================
   Loading / empty states
   =========================================================================== */

.loading {
    text-align: center;
    padding: var(--space-12) 0;
    color: var(--text-muted);
}

.loading__spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--surface-3);
    border-top-color: var(--accent);
    border-radius: 50%;
    margin: 0 auto var(--space-4);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.empty-state {
    text-align: center;
    padding: var(--space-16) var(--space-6);
    background: var(--surface);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    color: var(--text-muted);
}

.empty-state svg {
    color: var(--text-dim);
    margin: 0 auto var(--space-4);
    display: block;
}

.empty-state h3 {
    font-size: 1.15rem;
    margin-bottom: 6px;
    color: var(--text);
}

.empty-state p {
    margin-bottom: var(--space-5);
}

.results-end-sentinel {
    height: 1px;
    width: 100%;
    margin-top: var(--footer-scroll-gap);
    pointer-events: none;
}

/* Card skeletons */
.skeleton-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    height: 380px;
    position: relative;
}

.skeleton-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, var(--surface-3) 50%, transparent 100%);
    animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ===========================================================================
   Dev upload box
   =========================================================================== */

.file-upload-section {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: var(--space-6);
}

.upload-box {
    background: var(--surface);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    text-align: center;
    color: var(--text-muted);
}

.upload-box code {
    font-family: var(--font-mono);
    background: var(--surface-2);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text);
    font-size: 0.85rem;
}

#json-file-input {
    display: none;
}

#file-name {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-left: var(--space-3);
}

/* ===========================================================================
   Footer
   =========================================================================== */

.site-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 40;
    height: var(--nav-h);
    min-height: var(--nav-h);
    max-height: var(--nav-h);
    background: var(--mix-nav-bg);
    -webkit-backdrop-filter: saturate(140%) blur(12px);
    backdrop-filter: saturate(140%) blur(12px);
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.85rem;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    transform: translateY(100%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
        transform 0.22s var(--ease),
        opacity 0.22s var(--ease),
        visibility 0.22s var(--ease);
}

.site-footer.is-visible {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

@supports (scrollbar-width: thin) {
    .site-footer {
        scrollbar-width: thin;
        scrollbar-color: var(--surface-3) transparent;
    }
}

.site-footer::-webkit-scrollbar {
    height: 5px;
}

.site-footer::-webkit-scrollbar-track {
    background: transparent;
}

.site-footer::-webkit-scrollbar-thumb {
    background: var(--surface-3);
    border-radius: var(--radius-pill);
}

.site-footer::-webkit-scrollbar-thumb:hover {
    background: var(--border-strong);
}

.site-footer__inner {
    max-width: var(--max-w);
    margin: 0 auto;
    height: 100%;
    padding: 0 var(--space-6);
    box-sizing: border-box;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.site-footer__meta {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 8px;
    color: var(--text-dim);
    white-space: nowrap;
    text-align: center;
}

.site-footer__sep {
    color: var(--text-dim);
}

.site-footer__meta #footer-last-sync {
    color: var(--text-muted);
}

/* ===========================================================================
   Responsive
   =========================================================================== */

@media (max-width: 1100px) {
    .layout {
        display: block;
        padding: var(--space-6) var(--space-4) var(--space-12);
    }

    .sidebar-col {
        grid-column: auto;
    }

    .results {
        grid-column: auto;
        width: 100%;
        min-width: 0;
    }

    .layout {
        padding-bottom: var(--space-12);
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(360px, 92vw);
        height: 100dvh;
        min-height: 100dvh;
        max-height: 100dvh;
        z-index: 100;
        border-radius: 0;
        border-right: 1px solid var(--border);
        transform: translateX(-100%);
        transition: transform 0.25s var(--ease);
        overflow-y: auto;
        padding: 0;
    }

    .sidebar__inner {
        padding-bottom: max(var(--space-8), env(safe-area-inset-bottom, 0px));
    }

    .sidebar.is-open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.55);
        z-index: 99;
        -webkit-backdrop-filter: blur(2px);
        backdrop-filter: blur(2px);
    }

    .sidebar-backdrop.is-open {
        display: block;
    }

    .mobile-only {
        display: inline-flex !important;
    }
}

@media (max-width: 720px) {
    :root {
        --space-6: 16px;
    }

    .site-footer__inner {
        padding: 0 var(--space-4);
    }
}

/* Full-width cards only on narrow phones; above 520px use the default auto-fill grid */
@media (max-width: 520px) {
    .products-grid {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }

    .site-footer {
        transition: none;
    }
}
