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

ul,
ol {
    padding-left: 1.25rem;
}

/* ----------------------
   SW-COMPONENTS
----------------------- */

/* Buttons */
.sw-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border-radius: var(--sw-radius-md, 8px);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
    gap: 0.5rem;
    font-family: inherit;
    text-decoration: none;
    color: var(--sw-color-text-main, #0f172a);
}

.sw-btn-primary {
    background: var(--sw-color-primary, #3b82f6);
    color: #ffffff;
    border-color: var(--sw-color-primary, #3b82f6);
}

.sw-btn-primary:hover {
    background: var(--sw-color-primary-hover, #2563eb);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: var(--sw-shadow-sm, 0 1px 3px rgba(0,0,0,0.1));
}

.sw-btn:focus-visible {
    outline: 2px solid var(--sw-color-primary, #3b82f6);
    outline-offset: 2px;
}

.sw-btn-secondary {
    background: var(--sw-color-surface, #ffffff);
    color: var(--sw-color-text-main, #0f172a);
    border-color: var(--sw-border, #e5e7eb);
}

.sw-btn-secondary:hover {
    background: var(--sw-border, #e5e7eb);
    color: var(--sw-color-text-main, #0f172a);
}

.sw-btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

.sw-btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

.sw-btn-ghost {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--sw-color-error, #ef4444);
    padding: 0.375rem 0.75rem;
}
.sw-btn-ghost:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Disabled state. A disabled button still has to LOOK unavailable: without this
   it kept the primary fill, the pointer cursor and the hover lift, so a shopper
   whose order was still processing saw a button that answered to the mouse and
   clicked it again. State is carried by opacity AND cursor, never by colour
   alone. */
.sw-btn:disabled,
.sw-btn[aria-disabled="true"] {
    opacity: 0.6;
    cursor: not-allowed;
}
.sw-btn:disabled:hover,
.sw-btn[aria-disabled="true"]:hover {
    transform: none;
    box-shadow: none;
}

/* Loading state — any .sw-btn.is-loading (e.g. the "View More" pagination
   trigger in js/main.js) shows a spinner in the button's own text color and
   stops further clicks. .sw-btn is inline-flex with a gap, so the ::before
   spinner sits naturally before the label. */
.sw-btn.is-loading {
    pointer-events: none;
    opacity: 0.7;
}
.sw-btn.is-loading::before {
    content: "";
    flex: none;
    width: 0.9em;
    height: 0.9em;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: sw-spin 0.6s linear infinite;
}
@keyframes sw-spin {
    to { transform: rotate(360deg); }
}

/* Forms */
.sw-form-group {
    margin-bottom: 1rem;
}

.sw-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.375rem;
    color: var(--sw-color-text-main, #0f172a);
}

.sw-input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--sw-border, #e5e7eb);
    border-radius: var(--sw-radius-md, 8px);
    font-family: inherit;
    font-size: 0.95rem;
    background-color: var(--sw-color-surface, #ffffff);
    transition: border-color 0.2s;
    color: var(--sw-color-text-main, #0f172a);
}

.sw-input:focus {
    outline: 2px solid var(--sw-color-primary, #3b82f6);
    outline-offset: -1px;
    border-color: var(--sw-color-primary, #3b82f6);
}

/* A checkbox or radio next to its label text. Tops are aligned rather than
   centred so a label that wraps stays indented under itself, and the control is
   then nudged to the optical centre of the FIRST line — without that, a
   single-line label leaves the box floating above the text. line-height is fixed
   here so the nudge stays correct wherever the component is used. */
.sw-check {
    display: flex;
    align-items: flex-start;
    gap: var(--sw-space-sm, 0.5rem);
    line-height: 1.5;
    cursor: pointer;
}

.sw-check > input[type="checkbox"],
.sw-check > input[type="radio"] {
    flex: 0 0 auto;
    width: 1rem;
    height: 1rem;
    margin: calc((1.5em - 1rem) / 2) 0 0;
    font-size: inherit;
    accent-color: var(--sw-color-primary, #3b82f6);
    cursor: pointer;
}

.sw-check > input:disabled,
.sw-check:has(> input:disabled) {
    cursor: not-allowed;
}

/* Cards */
.sw-card {
    background: var(--sw-color-surface, #ffffff);
    border-radius: var(--sw-radius-md, 8px);
    padding: 1.5rem;
    border: 1px solid var(--sw-border, #e5e7eb);
}

.sw-card-interactive {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sw-card-interactive:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

.sw-card-sticky {
    position: sticky;
    top: 5rem;
}

.sw-card-bordered {
    border: 1px solid var(--sw-border, #e5e7eb);
    border-radius: var(--sw-radius-md, 8px);
    overflow: hidden;
}

/* Alerts */
.sw-alert {
    padding: 0.875rem 1rem;
    border-radius: var(--sw-radius-md, 8px);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.sw-alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--sw-color-error, #ef4444);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.sw-alert-success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--sw-color-success, #22c55e);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.sw-alert-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--sw-color-primary, #3b82f6);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Badges / Tags */
.sw-badge {
    font-size: 0.8rem;
    padding: 0.25rem 0.625rem;
    background: var(--sw-color-surface, #ffffff);
    border-radius: 9999px;
    color: var(--sw-color-text-muted, #64748b);
    border: 1px solid var(--sw-border, #e5e7eb);
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.sw-badge:hover {
    color: var(--sw-color-text-main, #0f172a);
    border-color: var(--sw-color-primary, #3b82f6);
}

/* Accordion */
.sw-accordion {
    border: 1px solid var(--sw-border, #e5e7eb);
    border-radius: var(--sw-radius-md, 8px);
    overflow: hidden;
}

.sw-accordion-item {
    border-bottom: 1px solid var(--sw-border, #e5e7eb);
}

.sw-accordion-item:last-child {
    border-bottom: none;
}

.sw-accordion-header {
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    background: var(--sw-color-surface, #ffffff);
    margin: 0;
    transition: background 0.15s ease;
}

.sw-accordion-header:hover {
    background: var(--sw-color-bg, #f8fafc);
}

.sw-accordion-radio {
    margin: 0;
    cursor: pointer;
    width: 1.2rem;
    height: 1.2rem;
    accent-color: var(--sw-color-primary, #3b82f6);
}

.sw-accordion-label {
    font-weight: 500;
    cursor: pointer;
    flex: 1;
    margin: 0;
}

.sw-accordion-content {
    padding: 1rem 1rem 0.25rem 1rem;
    display: none;
    background: var(--sw-color-bg, #f8fafc);
    border-top: 1px solid var(--sw-border, #e5e7eb);
}

.sw-accordion-item.active .sw-accordion-content {
    display: block;
}

/* Heading size scale — variable-driven so an inheriting theme can restyle
   every heading via tokens (or these rules) without cloning page templates.
   Sizes mirror the fs-*/fw-700 combos they replace. Font, weight, tracking
   and line-height are shared tokens; size is per step. Defaults are chosen
   so unset tokens reproduce the previous bare-<h1> rendering (font/tracking
   inherit). Pair with margin utilities (mb-*) and text-center as needed. */
.sw-head-2xl,
.sw-head-xl,
.sw-head-lg,
.sw-head-md {
    font-family: var(--sw-head-font, inherit);
    font-weight: var(--sw-head-weight, 700);
    letter-spacing: var(--sw-head-tracking, normal);
    line-height: var(--sw-head-leading, 1.2);
}

.sw-head-2xl {
    font-size: var(--sw-head-2xl, 3rem);
}

.sw-head-xl {
    font-size: var(--sw-head-xl, 2rem);
}

.sw-head-lg {
    font-size: var(--sw-head-lg, 1.75rem);
}

.sw-head-md {
    font-size: var(--sw-head-md, 1.5rem);
}

/* Secondary section/card heading scale — the "Order Summary" / "Digital
   Downloads" / "Details" titles that sit below a page's .sw-head-* title.
   Mirrors the .sw-head-* scale: weight is a shared token, size is per step.
   Steps map 1:1 onto the fs-*/fw-600 utility pairs they replace, so rendering
   is unchanged — while a child theme can now restyle every section heading via
   --sw-title-* tokens instead of cloning templates. */
.sw-title-lg,
.sw-title-md {
    font-weight: var(--sw-title-weight, 600);
}

.sw-title-lg {
    font-size: var(--sw-title-lg, 1.125rem); /* was fs-lg fw-600 */
}

.sw-title-md {
    font-size: var(--sw-title-md, 0.9rem); /* was fs-md fw-600 */
}

/* ----------------------
   SW-LAYOUT (layout_render)
----------------------- */
.sw-layout-row {
    width: 100%;
}

.sw-layout-container,
.sw-layout-full {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
    gap: var(--sw-layout-gap, 2rem);
}

.sw-layout-container {
    max-width: var(--sw-max-w, 1200px);
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    width: 100%;
}

.sw-layout-full {
    width: 100%;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.sw-layout-col {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sw-layout-img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.sw-layout-text-sm {
    font-size: var(--sw-text-sm, 0.875rem);
    margin: 0;
}

.sw-layout-text-md {
    font-size: var(--sw-text-base, 1rem);
    margin: 0;
}

.sw-layout-text-lg {
    font-size: var(--sw-text-lg, 1.25rem);
    margin: 0;
}

.sw-layout-title {
    font-size: var(--sw-text-xl, 1.75rem);
    font-weight: 600;
    margin-bottom: 2rem;
    margin-top: 0;
}

.sw-layout-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}


/* Skip to content (a11y) */
.skip-to-content {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--sw-color-primary);
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 0 0 var(--sw-radius-sm) var(--sw-radius-sm);
    z-index: 9999;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: top 0.2s;
}

.skip-to-content:focus {
    top: 0;
    color: #fff;
}

/* Global focus-visible styles (WCAG 2.4.7) */
:focus-visible {
    outline: 2px solid var(--sw-color-primary, #3b82f6);
    outline-offset: 2px;
}

:focus:not(:focus-visible) {
    outline: none;
}

/* Screen-reader only (a11y) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Inline display helper */
.inline {
    display: inline;
}

/* Account tabs */
.account-tabs {
    display: flex;
    gap: 2rem;
    border-bottom: 1px solid var(--sw-border);
    margin-bottom: 2rem;
}

.account-tab {
    font-size: var(--sw-text-lg);
    text-decoration: none;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}

.account-tab[aria-selected="true"] {
    font-weight: 700;
    color: var(--sw-color-primary, #3b82f6);
    border-bottom-color: var(--sw-color-primary, #3b82f6);
}

/* Account layout: sidebar nav + content on desktop, stacked with a
   horizontal scrolling nav on small screens. */
.account-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 2.5rem;
    align-items: start;
}

.account-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    border-right: 1px solid var(--sw-border);
    padding-right: 1.5rem;
}

.account-nav-link {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: var(--sw-radius-sm, 6px);
    text-decoration: none;
    color: var(--sw-color-text-muted, #555);
    transition: color 0.15s, background-color 0.15s;
}

.account-nav-link:hover {
    color: var(--sw-color-text-main, #111);
}

.account-nav-link[aria-current="page"] {
    font-weight: 700;
    color: var(--sw-color-primary, #3b82f6);
    background: color-mix(in srgb, var(--sw-color-primary, #3b82f6) 8%, transparent);
}

.account-nav-logout {
    margin-top: 0.75rem;
    border-top: 1px solid var(--sw-border);
    padding-top: 0.75rem;
    border-radius: 0;
}

@media (max-width: 768px) {
    .account-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 1.5rem;
    }

    .account-nav {
        flex-direction: row;
        overflow-x: auto;
        gap: 0.5rem;
        border-right: none;
        border-bottom: 1px solid var(--sw-border);
        padding-right: 0;
        padding-bottom: 0.5rem;
    }

    .account-nav-link {
        white-space: nowrap;
    }

    .account-nav-logout {
        margin-top: 0;
        margin-left: auto;
        border-top: none;
        padding-top: 0.5rem;
    }
}

body {
    font-family: var(--sw-font, sans-serif);
    background: var(--sw-color-bg, #ffffff);
    color: var(--sw-color-text-main, #0f172a);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--sw-color-primary, #3b82f6);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--sw-color-primary-hover, #2563eb);
}

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

/* Layout */
.container {
    max-width: var(--sw-max-w);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.container-sm {
    max-width: 440px;
}

.container-md {
    max-width: 700px;
}

.container-lg {
    max-width: 900px;
}

.section {
    padding-top: 2rem;
    padding-bottom: 3rem;
}

.section-hero {
    padding-top: 3rem;
    padding-bottom: 3rem;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.grid-product {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: start;
}

.grid-product > div {
    min-width: 0; /* Prevents grid blowout from flex children */
}

.grid-cart {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 2rem;
    align-items: start;
}

.grid-checkout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 2rem;
    align-items: start;
}

/* the whole column sticks, so anything added around the card travels with it */
.checkout-summary-col {
    position: sticky;
    top: 5rem;
    min-width: 0;
}

.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.flex-wrap {
    flex-wrap: wrap;
}

.items-center {
    align-items: center;
}

.items-start {
    align-items: flex-start;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.gap-xs {
    gap: 0.25rem;
}

.gap-sm {
    gap: 0.5rem;
}

.gap-md {
    gap: 1rem;
}

.gap-lg {
    gap: 1.5rem;
}

.gap-xl {
    gap: 2rem;
}

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

.text-center {
    text-align: center;
}

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

.text-light {
    color: var(--sw-color-text-muted);
}

.text-primary {
    color: var(--sw-color-primary);
}

.text-danger {
    color: var(--sw-color-error);
}

.fw-500 {
    font-weight: 500;
}

.fw-600 {
    font-weight: 600;
}

.fw-700 {
    font-weight: 700;
}

.fs-xs {
    font-size: 0.75rem;
}

.fs-sm {
    font-size: 0.8rem;
}

.fs-body {
    font-size: 0.875rem;
}

.fs-md {
    font-size: 0.9rem;
}

.fs-lg {
    font-size: 1.125rem;
}

.fs-xl {
    font-size: 1.25rem;
}

.fs-2xl {
    font-size: 1.5rem;
}

.fs-3xl {
    font-size: 1.75rem;
}

.fs-4xl {
    font-size: 2rem;
}

.fs-5xl {
    font-size: 2.5rem;
}

.fs-hero {
    font-size: 3rem;
}

.mt-xs {
    margin-top: 0.25rem;
}

.mt-sm {
    margin-top: 0.5rem;
}

.mt-md {
    margin-top: 1rem;
}

.mt-lg {
    margin-top: 1.5rem;
}

.mt-xl {
    margin-top: 2rem;
}

.mb-sm {
    margin-bottom: 0.5rem;
}

.mb-md {
    margin-bottom: 1rem;
}

.mb-lg {
    margin-bottom: 1.5rem;
}

.mb-xl {
    margin-bottom: 2rem;
}

.pt-md {
    padding-top: 1rem;
}

.pt-lg {
    padding-top: 1.5rem;
}

.pt-xl {
    padding-top: 2rem;
}

.py-md {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.py-lg {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}

.py-xl {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.p-md {
    padding: 1rem;
}

.p-lg {
    padding: 1.5rem;
}

.p-xl {
    padding: 2rem;
}

.w-full {
    width: 100%;
}

.aspect-video {
    aspect-ratio: 16 / 9;
}

.aspect-square {
    aspect-ratio: 1 / 1;
}

.block {
    display: block;
}

.uppercase {
    text-transform: uppercase;
}

.capitalize {
    text-transform: capitalize;
}

.tracking {
    letter-spacing: 0.05em;
}

.lh-relaxed {
    line-height: 1.8;
}

/* Header */
.site-header {
    border-bottom: 1px solid var(--sw-border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    background: var(--sw-color-bg);
    z-index: 100;
    backdrop-filter: blur(8px);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.site-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--sw-color-text-main);
    text-decoration: none;
    display: flex;
    align-items: center;
    text-wrap: nowrap;
}

.site-logo img {
    height: 40px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
    margin-right: 1rem;
}

.site-nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    /* Absorbs the free space so the nav and the actions beside it stay right-
       aligned against the logo, as they did when the nav was the only sibling. */
    margin-left: auto;
}

.site-nav a {
    color: var(--sw-color-text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}

.site-nav a:hover {
    color: var(--sw-color-text-main);
}

/* The cart lives beside the nav, not inside it, so it survives the nav
   collapsing on mobile and stays one tap away from every page. */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-action {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--sw-color-text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}

.header-action:hover {
    color: var(--sw-color-text-main);
}

.header-action-icon {
    flex: none;
}

.cart-link {
    position: relative;
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -10px;
    background: var(--sw-color-primary);
    color: white;
    font-size: 0.7rem;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* A cart link that carries a label anchors its badge to the icon — pinned to
   the link's right edge it would float off past the word. */
.header-actions .cart-count,
.checkout-header-cart .cart-count {
    top: -6px;
    left: 10px;
    right: auto;
}

.cart-count[hidden] {
    display: none;
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--sw-border);
    padding: 3rem 0;
    margin-top: 4rem;
    color: var(--sw-color-text-muted);
    font-size: 0.875rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
    align-items: start;
}

.footer-col {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.footer-col-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--sw-color-text-main);
    margin-bottom: 0.5rem;
}

.footer-info {
    font-size: 0.85rem;
    line-height: 1.5;
    max-width: 250px;
}

.footer-copyright {
    font-size: 0.8rem;
    margin-top: auto;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Focused checkout chrome (the "Focused Checkout" setting). A pared-back
   header/footer shown only on the checkout page: store name, cart link, and a
   single row of policy links. Both reuse .site-header / .site-footer so brand
   colors and borders stay in sync with the rest of the storefront. */
.checkout-header {
    position: static;
    backdrop-filter: none;
}

.checkout-header-cart {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--sw-color-text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.checkout-header-cart:hover {
    color: var(--sw-color-text-main);
}

.checkout-footer {
    padding: 2rem 0;
    margin-top: 3rem;
}

.checkout-footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.checkout-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.checkout-footer-links a {
    color: var(--sw-color-text-muted);
}

.checkout-footer-links a:hover {
    color: var(--sw-color-text-main);
    text-decoration: underline;
}

.checkout-footer .footer-copyright {
    margin: 0;
}


/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
}

/* Product Card */
.product-card {
    border-radius: var(--sw-radius-sm);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    background-color: var(--sw-color-bg); /* Match page background */
    transform: translateY(0); /* Force stacking context always */
    text-decoration: none;
    color: var(--sw-color-text-main);
}

.product-card:hover {
    box-shadow: var(--sw-shadow);
    transform: translateY(-2px);
    background: var(--sw-color-surface);
    color: var(--sw-color-text-main);
}

.product-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    mix-blend-mode: multiply;
}

.product-card-body {
    padding: 1rem;
}

.product-card-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--sw-color-text-main);
}

.product-card-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--sw-color-primary);
}

/* Image placeholders */
.img-placeholder {
    width: 100%;
    aspect-ratio: 1;
    background: var(--sw-color-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sw-color-text-muted);
}

.img-placeholder-lg {
    font-size: 1.25rem;
    border-radius: var(--sw-radius);
}

/* Product page */
.product-main-image {
    width: 100%;
    border-radius: var(--sw-radius);
    aspect-ratio: 1;
    object-fit: cover;
}

.product-thumbnails {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.product-thumbnail {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid var(--sw-border);
    transition: border-color 0.2s;
}

.product-thumbnail.active,
.product-thumbnail:hover {
    border-color: var(--sw-color-primary);
}

.product-price {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--sw-color-primary);
    margin-bottom: 1.5rem;
}

.compare-price {
    text-decoration: line-through;
    color: var(--sw-color-text-muted);
    font-weight: 500;
    font-size: 0.85em;
    margin-right: 0.35rem;
}

.product-description {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--sw-border);
}

.product-tags {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}


/* Quantity input */
.qty-input {
    width: 70px;
    text-align: center;
}

.qty-input-sm {
    width: 100px;
}

/* Card / Panel */

/* Cart item */
.cart-item {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--sw-border);
    align-items: center;
}

.cart-item > .flex-1 {
    min-width: 150px;
}

.cart-item-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
}

/* Order summary row */
.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

/* Emphasized value in a summary row. Weight is token-driven so an inheriting
   theme can restyle it via --sw-summary-value-weight without cloning markup. */
.summary-value {
    font-weight: var(--sw-summary-value-weight, 700);
}

.summary-total {
    display: flex;
    justify-content: space-between;
    padding-top: 1rem;
    border-top: 1px solid var(--sw-border);
    margin-top: 1rem;
}

/* Checkout order item row */
.checkout-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.checkout-divider {
    border-top: 1px solid var(--sw-border);
    margin-top: 0.75rem;
    padding-top: 0.75rem;
}

/* Shipping method selector */
.shipping-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border: 1px solid var(--sw-border);
    border-radius: var(--sw-radius);
    cursor: pointer;
    margin-bottom: 0.5rem;
    transition: all 0.2s;
}

.shipping-option:hover {
    border-color: var(--sw-color-primary);
}

.shipping-option.selected {
    border-color: var(--sw-color-primary);
    background: rgba(37, 99, 235, 0.04);
}

.shipping-option input[type="radio"] {
    accent-color: var(--sw-color-primary);
}

/* Delivery switch (Ship / Pickup). Real radios, visually presented as two
   segmented tabs: the label carries the styling and the input stays focusable
   for keyboard/AT users. */
.delivery-switch {
    display: flex;
    border: 0;
    padding: 0;
    margin: 0 0 1rem;
    gap: 0.5rem;
}

.delivery-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    border: 1px solid var(--sw-border, #e5e7eb);
    border-radius: var(--sw-radius-md, 8px);
    background: var(--sw-color-surface, #ffffff);
    color: var(--sw-color-text-main, #0f172a);
    cursor: pointer;
    font-size: 0.95rem;
    transition: border-color 0.2s, background 0.2s;
}

.delivery-tab:hover {
    border-color: var(--sw-color-primary, #3b82f6);
}

/* A tab that doesn't apply (Pay in store while shipping, when the store offers
   it for pickup only) is hidden; the display: flex above would otherwise win. */
.delivery-tab[hidden] {
    display: none;
}

/* Selected state is border + fill + weight, never color alone. */
.delivery-tab.selected {
    border-color: var(--sw-color-primary, #3b82f6);
    border-width: 2px;
    padding: calc(0.875rem - 1px) calc(1rem - 1px);
    font-weight: 600;
}

.delivery-tab:focus-within {
    outline: 2px solid var(--sw-color-primary, #3b82f6);
    outline-offset: 2px;
}

/* The radio itself is hidden from sight but stays in the tab order. */
.delivery-tab input[type="radio"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    margin: 0;
    pointer-events: none;
}

/* Inline note standing in for a list that isn't available yet (e.g. shipping
   methods before the address is complete). */
.checkout-note {
    padding: 1rem;
    border-radius: var(--sw-radius-md, 8px);
    background: var(--sw-color-bg, #f8fafc);
    border: 1px solid var(--sw-border, #e5e7eb);
    color: var(--sw-color-text-muted, #64748b);
    font-size: 0.9rem;
    text-align: center;
}

.ml-auto {
    margin-left: auto;
}

/* Coupon badges (checkout) */
.coupon-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--surface, #f0f0f0);
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: monospace;
    font-weight: 600;
}
.coupon-remove {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.7rem;
    color: var(--danger, #c0392b);
    padding: 0 2px;
    line-height: 1;
}
.coupon-remove:hover {
    opacity: 0.7;
}

/* Account list */
.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
}

.list-item:not(:last-child) {
    border-bottom: 1px solid var(--sw-border);
}

/* Subscription rows: the subscription summary and its (optional) address editor
   read as one block, with the divider between subscriptions rather than between
   a subscription and its own editor. */
.subscription-row:not(:last-child) {
    border-bottom: 1px solid var(--sw-border);
}
.subscription-row .list-item {
    border-bottom: none;
}
.subscription-address {
    padding: 0 1.25rem 1rem;
    margin-top: -0.35rem;
}
.subscription-address > summary {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--sw-color-text-muted, #64748b);
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.subscription-address > summary::-webkit-details-marker {
    display: none;
}
.subscription-address > summary::before {
    content: "\25B8"; /* ▸ */
    font-size: 0.7rem;
    transition: transform 0.15s ease;
}
.subscription-address[open] > summary::before {
    transform: rotate(90deg);
}
.subscription-address > summary:hover {
    color: var(--sw-color-primary, #3b82f6);
}
.subscription-address-form {
    margin-top: 0.75rem;
    display: grid;
    gap: 0.5rem;
    max-width: 420px;
}
.subscription-address-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

/* Filter toggle on the subscriptions list. A link styled as a checkbox: the
   state lives in the URL, so it survives a reload and works with no JS. */
.subscription-filter {
    text-decoration: none;
}
.subscription-filter-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    flex: none;
    border: 1px solid var(--sw-color-border, #d1d5db);
    border-radius: 3px;
    font-size: 0.7rem;
    line-height: 1;
}
.subscription-filter[aria-checked="true"] .subscription-filter-box {
    border-color: var(--sw-color-primary, #3b82f6);
    background: var(--sw-color-primary, #3b82f6);
    color: #fff;
}
.subscription-filter:hover,
.subscription-filter:focus-visible {
    color: var(--sw-color-primary, #3b82f6);
}

/* Search / Facets */
.search-layout {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.search-sidebar {
    width: 240px;
    flex-shrink: 0;
}

.search-sidebar-inner {
    position: sticky;
    top: 1rem;
}

.facet-group {
    margin-bottom: 1.5rem;
}

.facet-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--sw-color-text-muted);
    margin-bottom: 0.625rem;
    cursor: pointer;
}

.facet-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.375rem 0.5rem;
    border-radius: 6px;
    text-decoration: none;
    color: var(--sw-color-text-main);
    font-size: 0.875rem;
    transition: background 0.15s;
}

.facet-link:hover {
    background: var(--sw-color-surface);
    color: var(--sw-color-text-main);
}

.facet-count {
    font-size: 0.75rem;
    color: var(--sw-color-text-muted);
    background: var(--sw-color-surface);
    padding: 0.125rem 0.375rem;
    border-radius: 10px;
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    font-size: 0.8rem;
    background: var(--sw-color-primary);
    color: white;
    text-decoration: none;
    transition: background 0.15s;
}

.filter-pill:hover {
    background: var(--sw-color-primary-hover);
    color: white;
}

.filter-pill-x {
    font-size: 1rem;
    line-height: 1;
    opacity: 0.7;
}

.filter-pill:hover .filter-pill-x {
    opacity: 1;
}

/* Search bar */
.search-bar {
    display: flex;
    gap: 0.5rem;
    max-width: 600px;
}

.search-input {
    flex: 1;
    padding: 0.625rem 1rem;
    border: 1px solid var(--sw-border);
    border-radius: var(--sw-radius);
    font-size: 0.95rem;
    background: var(--sw-color-bg);
    color: var(--sw-color-text-main);
    font-family: var(--sw-font);
}

.search-input:focus {
    outline: 2px solid var(--sw-color-primary);
    outline-offset: -1px;
    border-color: var(--sw-color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Banner */
.hero-banner {
    border-radius: var(--sw-radius);
    overflow: hidden;
    margin-bottom: 2rem;
}

.hero-banner img {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 4rem 0;
    color: var(--sw-color-text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}


/* Product attribute table */
.attr-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.attr-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--sw-border);
}

.attr-table td:first-child {
    font-weight: 500;
    color: var(--sw-color-text-muted);
    width: 40%;
}

/* Volume pricing tiers (qty breaks) */
.price-tiers-table {
    width: auto;
    min-width: 220px;
    border-collapse: collapse;
    margin: 0.5rem 0 1rem;
    font-size: 0.875rem;
}
.price-tiers-table thead th {
    text-align: left;
    padding: 0.25rem 0.75rem 0.25rem 0;
    font-weight: 500;
    color: var(--sw-color-text-muted);
    border-bottom: 1px solid var(--sw-border);
}
.price-tiers-table tbody td {
    padding: 0.3rem 0.75rem 0.3rem 0;
}
.price-tiers-table tbody tr.active td {
    font-weight: 600;
    color: var(--sw-color-primary, #3b82f6);
}

/* Offer badge — the automatic-discount tag on a product photo. Its default
   colour is pinned rather than tied to --sw-color-primary so the white label
   keeps its contrast whatever palette the merchant picks. */
.product-card-media,
.product-media {
    position: relative;
}

.sw-offer-badge {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 1;
    padding: 0.2rem 0.5rem;
    border-radius: var(--sw-radius-sm, 4px);
    background: var(--sw-color-sale, #b91c1c);
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: 0.01em;
}

.product-offer-note {
    margin: 0.25rem 0 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--sw-color-sale, #b91c1c);
}

/* Promo bar — featured coupon codes, above the header. The colours here are
   only the fallback: the snippet writes the merchant's chosen background and
   text colour inline, so changing them needs no theme edit. */
.sw-promo-bar {
    background: var(--sw-color-sale, #b91c1c);
    color: #ffffff;
    text-align: center;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.sw-promo-bar-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 1.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.sw-promo-code {
    font-weight: 700;
    letter-spacing: 0.04em;
    /* currentColor so the underline follows the merchant's text colour rather
       than assuming a light-on-dark bar. */
    border-bottom: 1px dotted currentColor;
}

/* Out of stock badge */
.out-of-stock {
    color: var(--sw-color-error);
    font-size: 0.8rem;
}

/* Dropdown menus */
.nav-item {
    position: relative;
}

.nav-item>a {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.dropdown-arrow {
    font-size: 0.6em;
    opacity: 0.6;
}

.nav-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    background: var(--sw-color-bg, #fff);
    border: 1px solid var(--sw-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 0.5rem 0;
    z-index: 100;
    animation: dropdownIn 0.15s ease;
}

.nav-dropdown.dropdown-right {
    left: auto;
    right: 0;
}

.nav-item:hover .nav-dropdown,
.nav-item:focus-within .nav-dropdown {
    display: block;
}

.nav-dropdown a {
    display: block;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: background 0.15s;
}

.nav-dropdown a:hover {
    background: var(--sw-color-surface);
}

/* Tag index (/tag) — a grid of tag cards, each linking to its landing page.

   The whole cell is the card, not just the link: a tag's sub-tags can't live
   inside its anchor (links don't nest), so they sit beside it and the cell
   carries the surface, the hover lift and the focus ring for both. Cells
   stretch to a shared height per row, so one tag with a deep tree doesn't
   leave its neighbours looking clipped.

   Images are optional at every level, so each card and sub-item has a designed
   image-less state rather than a gap where a picture would be. */
.tags-header {
    margin-bottom: 1.75rem;
}

.tags-intro {
    margin-top: 0.5rem;
    max-width: 60ch;
}

.tag-card-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    /* min() so a card can still shrink below the track floor on narrow phones
       instead of forcing a horizontal scroll. */
    grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
    gap: 1.75rem 1.25rem;
    /* Cards hug their content instead of stretching to the tallest in the row,
       so a tag with a deep tree doesn't leave its neighbours holding a tall
       empty panel on hover. Media boxes still line up: the tracks are equal
       width and the image has a fixed ratio. */
    align-items: start;
}

.tag-card-cell {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 0.5rem;
    border-radius: var(--sw-radius-md);
    background-color: transparent;
    transform: translateY(0);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

/* Matches .product-card: flat on the canvas, lifting onto a surface on hover.
   :focus-within so keyboard users get the same affordance — it covers both the
   card link and any sub-tag link inside. */
.tag-card-cell:hover,
.tag-card-cell:focus-within {
    background-color: var(--sw-color-surface);
    box-shadow: var(--sw-shadow);
    transform: translateY(-2px);
}

.tag-card {
    display: block;
    color: var(--sw-color-text-main);
    text-decoration: none;
}

.tag-card:focus-visible {
    outline: 2px solid var(--sw-color-primary);
    outline-offset: 2px;
    border-radius: var(--sw-radius-sm);
}

.tag-card-media {
    display: block;
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border-radius: var(--sw-radius-sm);
    background: var(--sw-color-surface);
}

.tag-card-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.tag-card-cell:hover .tag-card-media img {
    transform: scale(1.04);
}

/* Image-less card: the tag's initial on a panel tinted from the brand colour,
   so it reads as a deliberate monogram rather than a missing image. Tinting
   from --sw-color-primary (rather than fixed pastels) keeps it in key with
   whatever palette the merchant picked. The flat declarations come first as
   the fallback for engines without color-mix(). */
.tag-card-initial {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--sw-color-primary);
    background: var(--sw-color-surface);
    color: color-mix(in srgb, var(--sw-color-primary) 72%, var(--sw-color-text-main));
    background: linear-gradient(135deg,
            color-mix(in srgb, var(--sw-color-primary) 18%, var(--sw-color-surface)),
            color-mix(in srgb, var(--sw-color-primary) 5%, var(--sw-color-surface)));
}

/* Rotate the tint by position so a grid of image-less tags doesn't read as one
   repeated tile. Decorative only — nothing is conveyed by the colour. */
.tag-card-cell:nth-child(3n+2) .tag-card-initial {
    background: linear-gradient(160deg,
            color-mix(in srgb, var(--sw-color-primary) 10%, var(--sw-color-surface)),
            color-mix(in srgb, var(--sw-color-primary) 24%, var(--sw-color-surface)));
}

.tag-card-cell:nth-child(3n+3) .tag-card-initial {
    background: linear-gradient(210deg,
            color-mix(in srgb, var(--sw-color-primary) 22%, var(--sw-color-surface)),
            color-mix(in srgb, var(--sw-color-primary) 8%, var(--sw-color-surface)));
}

.tag-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.8rem 0.25rem 0.35rem;
}

.tag-card-title {
    font-weight: var(--sw-title-weight, 600);
    line-height: 1.3;
}

.tag-card-desc {
    display: -webkit-box;
    font-size: 0.85rem;
    line-height: 1.45;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Sub-tags: nested lists at any depth, indented by real markup (not padding on
   a flat list) so the hierarchy is exposed to assistive technology and not just
   drawn. A single rule separates them from the card above; depth is carried by
   indent and weight rather than tree lines, which crowd a narrow card. */
.tag-card-sub {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--sw-border);
    font-size: 0.85rem;
}

.tag-card-sub ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tag-card-sub ul ul {
    margin-left: 0.85rem;
}

.tag-card-sub a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.35rem;
    border-radius: var(--sw-radius-sm);
    color: var(--sw-color-text-muted);
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

/* First level reads as the card's own sub-headings; deeper levels recede. */
.tag-card-sub>ul>li>a {
    color: var(--sw-color-text-main);
}

.tag-card-sub a:hover,
.tag-card-sub a:focus-visible {
    background: var(--sw-color-bg);
    color: var(--sw-color-primary);
}

/* A background swap alone is a weak focus indicator on a tinted card. */
.tag-card-sub a:focus-visible {
    outline: 2px solid var(--sw-color-primary);
    outline-offset: -2px;
}

.tag-sub-thumb {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border-radius: var(--sw-radius-sm);
    object-fit: cover;
}

/* Stands in for a thumbnail so names align whether or not a tag has an image. */
.tag-sub-dot {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border-radius: var(--sw-radius-sm);
    background: var(--sw-color-bg);
    background: color-mix(in srgb, var(--sw-color-primary) 12%, var(--sw-color-surface));
}

.tag-sub-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {

    .tag-card-cell,
    .tag-card-cell:hover,
    .tag-card-cell:focus-within,
    .tag-card-media img,
    .tag-card-cell:hover .tag-card-media img {
        transition: none;
        transform: none;
    }
}

/* Tag menu — every level with sub-tags opens its own panel.

   Desktop: flyout panels beside the parent, opened by :hover / :focus-within.
   :focus-within is what makes that keyboard-operable without scripting —
   tabbing to a link deep in the tree keeps every ancestor open, because it
   matches all the way up the chain.

   Mobile: no hover and no room beside the parent, so panels stack inline and
   start collapsed. The row splits into two targets — the name navigates to the
   tag, a separate button opens its sub-tags — because a parent tag is a real
   destination and shouldn't be sacrificed to act as a toggle. */
.tag-menu-list,
.tag-menu-panel {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tag-menu-group {
    position: relative;
}

.tag-menu-group+.tag-menu-group {
    margin-top: 0.15rem;
    padding-top: 0.15rem;
    border-top: 1px solid var(--sw-border);
}

/* One row = link + (arrow | toggle). The link keeps the dropdown's own padding
   so rows line up with the rest of the menu. */
.tag-menu-row {
    display: flex;
    align-items: center;
}

.tag-menu-row>a {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-dropdown a.tag-menu-root {
    font-weight: 600;
}

.tag-sub-arrow {
    flex: none;
    padding-right: 0.85rem;
    font-size: 1.1em;
    line-height: 1;
    opacity: 0.5;
}

.has-sub:hover>.tag-menu-row>.tag-sub-arrow,
.has-sub:focus-within>.tag-menu-row>.tag-sub-arrow {
    opacity: 1;
}

/* The toggle is a mobile control; on desktop the flyout opens on hover/focus,
   so it is removed from the page (and the accessibility tree) entirely rather
   than left as a control that does nothing. */
.nav-submenu-toggle {
    display: none;
}

/* A flyout panel: same chrome as the top-level dropdown, offset to sit beside
   the item it belongs to. */
.tag-menu-panel {
    display: none;
    position: absolute;
    top: -0.5rem;
    left: 100%;
    min-width: 190px;
    padding: 0.5rem 0;
    background: var(--sw-color-bg, #fff);
    border: 1px solid var(--sw-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 1;
}

.tag-menu-panel li {
    position: relative;
}

.tag-menu-group:hover>.tag-menu-panel,
.tag-menu-group:focus-within>.tag-menu-panel,
.tag-menu-panel li:hover>.tag-menu-panel,
.tag-menu-panel li:focus-within>.tag-menu-panel {
    display: block;
}

/* Flipped by main.js when a panel would run past the right edge of the window. */
.tag-menu-panel.flip {
    left: auto;
    right: 100%;
}

/* Panels are absolutely positioned, so any scroll container on an ancestor
   would clip them — the top-level tag dropdown deliberately has none. */
.nav-tag-dropdown {
    overflow: visible;
}

@media (max-width: 768px) {

    /* Stacked, indented by padding alone. Guide lines down each level read as
       clutter once more than one branch is open. */
    .tag-menu-panel {
        position: static;
        min-width: 0;
        margin: 0;
        padding: 0 0 0 0.85rem;
        border: none;
        border-radius: 0;
        box-shadow: none;
        background: transparent;
    }

    /* Collapsed until its toggle is pressed. Hover/focus must not open it here:
       a tap registers as a hover on touch, so the whole tree would unfold from
       one stray press. */
    .tag-menu-group:hover>.tag-menu-panel,
    .tag-menu-group:focus-within>.tag-menu-panel,
    .tag-menu-panel li:hover>.tag-menu-panel,
    .tag-menu-panel li:focus-within>.tag-menu-panel {
        display: none;
    }

    .tag-menu-group.open>.tag-menu-panel,
    .tag-menu-panel li.open>.tag-menu-panel {
        display: block;
    }

    .tag-sub-arrow {
        display: none;
    }

    /* The link is only as wide as its text, so tapping the name goes to the tag
       and everything to the right of it expands the sub-tags. That keeps both
       actions reachable one-handed without a small icon-sized target. */
    .tag-menu-row {
        align-items: stretch;
    }

    .tag-menu-row>a {
        flex: 0 1 auto;
    }

    .nav-submenu-toggle {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        flex: 1 1 auto;
        /* A long tag name shrinks; the toggle must not shrink with it or the
           target disappears exactly where names are hardest to tap around. */
        min-width: 44px;
        min-height: 44px;
        padding: 0 1rem 0 0;
        border: none;
        background: none;
        color: inherit;
        font: inherit;
        font-size: 1.2rem;
        line-height: 1;
        cursor: pointer;
    }

    .nav-submenu-toggle>span {
        display: block;
        transition: transform 0.15s ease;
    }

    .nav-submenu-toggle[aria-expanded="true"]>span {
        transform: rotate(90deg);
    }

    .nav-submenu-toggle:focus-visible {
        outline: 2px solid var(--sw-color-primary);
        outline-offset: -2px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .nav-submenu-toggle>span {
        transition: none;
    }
}

@keyframes dropdownIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Filter Toggle */
.mobile-filter-toggle-container {
    display: none;
    width: 100%;
    margin-bottom: 1rem;
}

/* Mobile Nav Toggle */
.mobile-nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--sw-color-text-main);
    padding: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .mobile-nav-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
        padding: 0;
    }

    .product-grid,
    .sw-layout-product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .grid-product,
    .grid-cart,
    .grid-checkout,
    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }

    .site-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--sw-color-bg);
        flex-direction: column;
        /* stretch, not flex-start: every entry is a full-width row, so the nav
           reads as one list instead of tight links above padded sub-rows. */
        align-items: stretch;
        padding: 0.5rem 0 1rem;
        border-bottom: 1px solid var(--sw-border);
        box-shadow: var(--sw-shadow-sm);
        gap: 0;
    }

    .site-nav.active {
        display: flex;
    }

    /* One row per entry: label left, any arrow hard right, 44px tall so the
       top-level links are as tappable as the tag rows nested under them. */
    .site-nav>a,
    .nav-item>a {
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 44px;
        padding: 0.5rem 1rem;
    }

    .site-nav>*+* {
        border-top: 1px solid var(--sw-border);
    }

    /* Every menu works the same way: the label stays a link to its own page and
       a separate button opens the submenu, with the panel wrapping onto the line
       below. Letting the label double as the toggle is what makes a menu's own
       page unreachable on touch. */
    .nav-item {
        display: flex;
        flex-wrap: wrap;
        align-items: stretch;
    }

    .nav-item>a {
        flex: 0 1 auto;
    }

    .nav-item>a .dropdown-arrow {
        display: none;
    }

    .nav-item>.nav-dropdown {
        width: 100%;
    }

    /* Keep the non-link entries on the same left edge as the rows above them. */
    .site-nav>.header-search-form {
        padding: 0.75rem 1rem;
    }

    /* Back-compat: a customised header that still keeps the cart inside the nav
       gets it as a full-width row rather than a bare icon. */
    .site-nav>.cart-link {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        min-height: 44px;
        padding: 0.5rem 1rem;
    }

    .nav-dropdown {
        display: none;
        position: static;
        box-shadow: none;
        border: none;
        padding: 0;
        padding-left: 1rem;
        background: transparent;
    }

    /* Collapsed until its toggle is pressed, exactly like the panels nested
       below it. Hover/focus must not open it here: a tap registers as a hover
       and leaves focus on the toggle, so the desktop openers would hold the
       panel open the moment the toggle closed it. */
    .nav-item:hover>.nav-dropdown,
    .nav-item:focus-within>.nav-dropdown {
        display: none;
    }

    .nav-item.active .nav-dropdown {
        display: block;
    }

    /* The cart is the one thing a shopper reaches for on every page, and it's a
       plain link — no menu — so it stays in the bar beside the toggle instead of
       being buried in the collapsed panel. Everything that opens a menu, account
       included, stays in the panel where the nav's own submenus live. */
    .header-actions {
        gap: 0;
    }

    .header-actions .header-action-label {
        display: none;
    }

    .header-actions .header-action {
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
        padding: 0;
    }

    /* Badge follows the icon as it centres in the larger tap target. */
    .header-actions .cart-count {
        top: 6px;
        left: 22px;
    }

    .footer-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .checkout-footer-inner {
        flex-direction: column;
        text-align: center;
    }

    .footer-col {
        align-items: center;
    }

    .footer-info {
        margin: 0 auto;
    }

    .search-layout {
        flex-direction: column;
        align-items: stretch;
    }

    .search-results {
        width: 100%;
    }

    .search-sidebar {
        width: 100%;
        display: none;
    }

    .search-sidebar.active {
        display: block;
    }

    .mobile-filter-toggle-container {
        display: block;
    }
}

@media (max-width: 480px) {
    .product-grid,
    .sw-layout-product-grid {
        grid-template-columns: 1fr;
    }

    .list-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* Newsletter Section */
.newsletter-wrapper {
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.newsletter-blob-1, .newsletter-blob-2, .newsletter-icon {
    display: none;
}

.newsletter-content {
    position: relative;
}

.newsletter-heading {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--sw-color-text-main);
}

.newsletter-text {
    font-size: 0.85rem;
    color: var(--sw-color-text-muted);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.newsletter-form-container {
    display: flex;
    max-width: 100%;
}

.newsletter-input {
    border-radius: 4px 0 0 4px;
    border: 1px solid var(--sw-border);
    border-right: none;
    padding: 0.5rem 0.75rem;
    flex: 1;
    outline: none;
    background: var(--sw-color-surface);
    color: var(--sw-color-text-main);
    font-size: 0.85rem;
}

.newsletter-btn {
    border-radius: 0 4px 4px 0;
    padding: 0.5rem 1rem;
    font-weight: 500;
    font-size: 0.85rem;
    white-space: nowrap;
    border: none;
    cursor: pointer;
}

/* Lightbox & Modals */
.lightbox-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}

.lightbox-img {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    border-radius: var(--sw-radius-sm);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.modal-close-btn {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--sw-color-text-muted);
    padding: 10px;
}

.lightbox-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 10px;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--sw-color-surface);
    padding: 1.5rem;
    border-radius: var(--sw-radius-md);
    max-width: 400px;
    width: 90%;
    position: relative;
    box-shadow: var(--sw-shadow-lg);
}

.cursor-zoom-in {
    cursor: zoom-in;
}

.hidden {
    display: none !important;
}

/* Generic Layouts */
.layout-reading {
    max-width: 800px;
    margin: 0 auto;
    background: var(--sw-color-surface);
    border-radius: var(--sw-radius);
    border: 1px solid var(--sw-border);
    overflow: hidden;
}

/* Prose (Rich Text Typography) */
.prose {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--sw-color-text-main);
}
.prose h1, .prose h2, .prose h3, .prose h4 {
    color: var(--sw-color-text-main, #0f172a);
    font-weight: 700;
    line-height: 1.3;
}
.prose h1 { font-size: 2.25rem; margin: 2rem 0 1rem; }
.prose h2 { font-size: 1.875rem; margin: 2.5rem 0 1rem; }
.prose h3 { font-size: 1.5rem; margin: 2rem 0 1rem; }
.prose p { margin-bottom: 1.5rem; }
.prose img {
    max-width: 100%;
    height: auto;
    border-radius: var(--sw-radius);
    margin: 2rem 0;
    box-shadow: var(--sw-shadow-sm);
}
.prose a {
    color: var(--sw-color-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.prose a:hover {
    color: var(--sw-color-primary-hover);
    text-decoration-thickness: 2px;
}
.prose blockquote {
    border-left: 4px solid var(--sw-color-primary);
    padding: 1rem 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    color: var(--sw-color-text-muted);
    background: var(--sw-color-bg);
    border-radius: 0 var(--sw-radius) var(--sw-radius) 0;
}
.prose ul, .prose ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}
.prose li {
    margin-bottom: 0.5rem;
}

/* Breadcrumb (SEO + a11y) */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--sw-color-text-muted);
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--sw-color-text-muted);
    text-decoration: none;
    transition: color 0.15s;
}

.breadcrumb a:hover {
    color: var(--sw-color-primary);
}

.breadcrumb-sep {
    color: var(--sw-border);
    font-size: 0.75rem;
    user-select: none;
}

/* Reduced motion (WCAG 2.3.3) */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Full-width section (search page) */
.section-full-width {
    padding-left: 2rem;
    padding-right: 2rem;
}

/* Search toolbar (heading + count row) */
.search-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

/* A tag's image and description share the toolbar row with the heading and the
   product count, so both are sized to sit on that line rather than grow it. */
.tag-header-image {
    flex: none;
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 50%;
}

/* The description takes the space left between heading and count. min-width:0
   lets it shrink below its text width (a flex item won't otherwise), which is
   what makes the ellipsis engage instead of the heading being squeezed. */
.tag-desc {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0 1.5rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Too little room to clamp on a phone — drop to a full-width line and show the
   whole description rather than three words and an ellipsis. */
@media (max-width: 640px) {
    .tag-desc {
        flex-basis: 100%;
        margin: 0.25rem 0 0;
        text-align: left;
        white-space: normal;
        overflow: visible;
    }
}

/* Sidebar sort select */
.sort-select-sidebar {
    width: 100%;
    padding: 0.4rem 0.5rem;
    font-size: 0.85rem;
}

/* Sidebar price filter */
.filter-form,
.sidebar-filter-form {
    width: 100%;
}

.sidebar-price-form {
    width: 100%;
}

.sidebar-price-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.price-input-sidebar {
    flex: 1;
    min-width: 0;
    padding: 0.4rem 0.5rem;
    font-size: 0.85rem;
}

/* In-stock availability filter */
.stock-filter-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.stock-filter-checkbox {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    cursor: pointer;
}

/* Multi-select facet values */
.facet-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.5rem;
    border-radius: 6px;
    color: var(--sw-color-text-main);
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.15s;
}

.facet-option:hover {
    background: var(--sw-color-surface);
}

.facet-checkbox {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    cursor: pointer;
}

.facet-option-label {
    flex: 1;
    min-width: 0;
}

@media (prefers-reduced-motion: reduce) {
    .facet-option {
        transition: none;
    }
}

/* Values past the "Values Shown Per Filter" limit, revealed by .facet-more.
   The display rules above would otherwise override the hidden attribute. */
.facet-option[hidden],
.facet-link[hidden] {
    display: none;
}

.facet-more {
    align-self: flex-start;
    margin-top: 0.25rem;
    padding: 0.25rem 0.5rem;
    border: 0;
    background: none;
    color: var(--sw-color-primary);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: underline;
    cursor: pointer;
}

/* Sidebar apply bar, pinned to the bottom of the viewport while the filters
   scroll past and resting above "Clear All Filters". Without JS it is always
   shown; with JS it appears only while a filter change is waiting to be
   applied (button mode, or apply-on-click on narrow screens). */
.filter-apply {
    position: sticky;
    bottom: 0;
    z-index: 1;
    padding: 0.75rem 0;
    background: var(--sw-color-bg, #ffffff);
}

.filter-form-js .filter-apply {
    display: none;
}

.filter-form-js.is-dirty .filter-apply {
    display: block;
}

/* Facet arrow toggle */
.facet-arrow {
    font-size: 0.7em;
}

/* Facet content (collapsed by default, shown via JS) */
.facet-content {
    display: none;
}

.facet-content.open {
    display: flex;
}

/* Header nav search bar */
.header-search-form {
    margin-left: 1rem;
    margin-right: 1rem;
}

.header-search-input {
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    min-width: 150px;
}

.header-search-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--sw-color-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    margin-left: 0.25rem;
}

.header-search-btn:hover {
    color: var(--sw-color-text-main);
}
/* Currency switcher (header). Native <details> keeps it keyboard-operable
   without script; each option is a real button. */
.currency-switcher {
    position: relative;
}
.currency-switcher > summary {
    cursor: pointer;
    list-style: none;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--sw-color-border, #d1d5db);
    border-radius: 6px;
    font-size: 0.85rem;
}
.currency-switcher > summary::-webkit-details-marker {
    display: none;
}
.currency-switcher-list {
    position: absolute;
    right: 0;
    z-index: 50;
    margin: 0.25rem 0 0;
    padding: 0.25rem;
    list-style: none;
    background: var(--sw-color-surface, #fff);
    border: 1px solid var(--sw-color-border, #d1d5db);
    border-radius: 6px;
    min-width: 5rem;
}
.currency-switcher-list button {
    display: block;
    width: 100%;
    padding: 0.35rem 0.5rem;
    background: none;
    border: 0;
    text-align: left;
    color: inherit;
    font: inherit;
    cursor: pointer;
}
.currency-switcher-list button[aria-current="true"],
.currency-switcher-list a[aria-current="true"] {
    font-weight: 700;
}
.currency-switcher-list a {
    display: block;
    padding: 0.35rem 0.5rem;
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
}
.currency-switcher-list a:hover,
.currency-switcher-list button:hover {
    text-decoration: underline;
}
[dir="rtl"] .currency-switcher-list {
    right: auto;
    left: 0;
}
