/* SpreadFront base styles — themes provide the CSS variables. */
@font-face {
  font-family: 'Bricolage';
  src: url('/fonts/bricolage.woff2') format('woff2');
  font-weight: 200 800;
  font-display: swap;
}
*, *::before, *::after { box-sizing: border-box; }
/* The hidden attribute must always win, even over classes that set display
   (e.g. .btn's inline-flex) — without this, "hidden" buttons render. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
.page-links { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; flex-wrap: wrap; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg, #fafafa);
  color: var(--fg, #1a1a1a);
  line-height: 1.55;
}
a { color: var(--accent, #2563eb); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.2; font-family: 'Bricolage', system-ui, sans-serif; letter-spacing: -0.02em; }
.icon { vertical-align: -0.18em; flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--accent, #2563eb); outline-offset: 2px; border-radius: 4px; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.container.narrow { max-width: 640px; }
.center-page { padding-top: 15vh; text-align: center; }

/* Buttons & forms */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--border, #ddd); background: var(--card, #fff); color: var(--fg, #1a1a1a);
  font-size: 15px; font-weight: 600; text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}
.btn:hover { text-decoration: none; filter: brightness(0.97); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--accent, #2563eb); border-color: var(--accent, #2563eb); color: #fff; }
.btn-small { padding: 4px 10px; font-size: 13px; }
.btn-big { padding: 14px 28px; font-size: 18px; }
.inline-form { display: inline; }

input, select, textarea {
  width: 100%; padding: 9px 10px; margin-top: 4px;
  border: 1px solid var(--border, #ccc); border-radius: 8px;
  background: var(--card, #fff); color: var(--fg, #1a1a1a); font: inherit;
}
textarea { min-height: 70px; resize: vertical; }
/* Placeholders must read as hints, never as prefilled values. */
::placeholder { color: color-mix(in srgb, var(--fg, #1a1a1a) 45%, var(--bg, #fff)); font-style: italic; opacity: 1; }

/* Toggle-switch styling for checkboxes with .switch */
input[type='checkbox'].switch {
  appearance: none; width: 42px; height: 24px; border-radius: 999px; position: relative;
  background: var(--border, #ccc); cursor: pointer; transition: background 0.15s ease; margin: 0; flex-shrink: 0;
}
input[type='checkbox'].switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: left 0.15s ease;
}
input[type='checkbox'].switch:checked { background: var(--accent, #16a34a); }
input[type='checkbox'].switch:checked::after { left: 21px; }
.switch-row { display: flex; align-items: center; gap: 10px; }
label { display: block; margin: 12px 0; font-size: 14px; font-weight: 600; }
label.radio { font-weight: 400; display: flex; gap: 8px; align-items: center; }
label.radio input { width: auto; margin: 0; }
fieldset { border: 1px solid var(--border, #ddd); border-radius: 8px; margin: 14px 0; padding: 6px 14px 12px; }
legend { font-size: 14px; font-weight: 700; padding: 0 6px; }

.card { background: var(--card, #fff); border: 1px solid var(--border, #e5e5e5); border-radius: 12px; padding: 18px; }
.form-card { max-width: 560px; }

/* Storefront header/footer */
.store-header {
  background: var(--card, #fff); border-bottom: 1px solid var(--border, #e5e5e5);
  position: sticky; top: 0; z-index: 20;
}
/* Horizontal padding comes from .container; adding it here too inset the header
   from the page content below it (misaligned left/right edges on all widths). */
.header-row {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  /* horizontal padding must survive (the 0 here once glued the logo to the screen edge) */
  padding: 12px max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left));
}
.search-form { position: relative; }
.search-form .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); opacity: 0.45; pointer-events: none; }
.search-form input { padding-left: 36px; border-radius: 999px; }
.cart-link { display: inline-flex; align-items: center; gap: 6px; }
.store-brand { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 800; color: var(--fg); }
.store-brand:hover { text-decoration: none; }
.store-logo { height: 34px; width: 34px; object-fit: cover; border-radius: 8px; }
.search-form { flex: 1; min-width: 140px; }
.search-form input { margin: 0; }
.cart-link { font-weight: 700; white-space: nowrap; }
.cart-badge:not(:empty) {
  background: var(--accent, #2563eb); color: #fff; border-radius: 999px;
  padding: 1px 8px; font-size: 13px; margin-left: 2px;
}
.store-banner { width: 100%; border-radius: 12px; margin-top: 16px; max-height: 280px; object-fit: cover; }
.store-title { font-size: 28px; margin: 22px 0 6px; }
.store-title + .store-description { margin-top: 0; }
.store-description { max-width: 720px; opacity: 0.85; }
.not-found .not-found-code { font-size: 64px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; margin: 0 0 8px; opacity: 0.25; }
.not-found h1 { margin: 0 0 8px; }
.not-found .btn { margin-top: 12px; }
.store-footer {
  margin-top: 48px; border-top: 1px solid var(--border, #e5e5e5); padding: 18px 0 30px;
  font-size: 14px; color: color-mix(in srgb, var(--fg) 80%, var(--bg));
}
.store-footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.powered-by { font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }

/* Filters */
.results-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--card, #fff); border: 1px solid var(--border, #e5e5e5); border-radius: 10px;
  padding: 10px 14px; margin: 16px 0 4px; font-size: 14.5px;
}
.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 6px; }
.chip {
  padding: 5px 13px; border-radius: 999px; font-size: 14px;
  border: 1px solid var(--border, #ddd); background: var(--card, #fff); color: var(--fg);
}
.chip.active { background: var(--accent, #2563eb); border-color: var(--accent); color: #fff; }
.chip:hover { text-decoration: none; }
.brand-filter { display: flex; gap: 8px; align-items: center; margin: 8px 0 4px; max-width: 320px; }
.brand-filter select { margin: 0; }

/* Product grid */
.product-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px; margin: 20px 0;
}
.product-card {
  background: var(--card, #fff); border: 1px solid var(--border, #e5e5e5);
  border-radius: 14px; overflow: hidden; display: flex; flex-direction: column;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.product-card:hover { transform: translateY(-3px); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1); }
/* Sold-out: signal via grayscale photo, never by fading text below WCAG contrast. */
.product-card.unavailable .card-media img { filter: grayscale(1); opacity: 0.7; }
.product-card.unavailable .card-title { opacity: 0.85; }
.card-media { position: relative; display: block; aspect-ratio: 1; background: var(--bg-soft, #f0f0f0); overflow: hidden; }
.card-media img, .card-media video { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.25s ease; }
.product-card:hover .card-media img, .product-card:hover .card-media video { transform: scale(1.04); }
.card-tag {
  /* fg-on-bg inversion: guaranteed WCAG-passing contrast in every theme */
  position: absolute; top: 8px; left: 8px; background: var(--fg, #1a1a1a);
  color: var(--bg, #fff); font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px;
}
.img-placeholder { width: 100%; height: 100%; background: var(--bg-soft, #eee); }
/* Test Mode: fixed-position-free banner above the header on every page. */
.test-banner {
  background: #b45309; color: #fff; text-align: center; font-weight: 700;
  font-size: 14.5px; padding: 8px 14px; letter-spacing: 0.01em;
}
.img-placeholder.large { aspect-ratio: 1; border-radius: 12px; }
.img-placeholder.small { width: 44px; height: 44px; border-radius: 8px; display: inline-block; }
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-title {
  font-weight: 700; color: var(--fg);
  padding-bottom: 8px; border-bottom: 1px solid var(--border, #e5e5e5);
}
.card-brand { font-size: 13px; color: color-mix(in srgb, var(--fg) 78%, var(--bg)); }
.card-price { display: flex; align-items: baseline; gap: 8px; margin-top: auto; }
.card-price.big { font-size: 24px; margin: 10px 0; }
.price { font-weight: 800; }
.price-was { text-decoration: line-through; color: color-mix(in srgb, var(--fg) 75%, var(--bg)); font-size: 0.85em; }
.btn-add {
  margin-top: 4px; justify-content: center;
  background: var(--fg, #1a1a1a); color: var(--bg, #fff); border-color: var(--fg, #1a1a1a);
}
.btn-add:disabled { background: var(--bg-soft, #eee); color: var(--fg, #1a1a1a); border-color: var(--border, #ddd); opacity: 1; }

/* Product page */
.product-page { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; margin-top: 24px; }
@media (max-width: 720px) { .product-page { grid-template-columns: 1fr; } }
.gallery-main { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; background: var(--bg-soft, #f0f0f0); }
.gallery-thumbs { display: flex; gap: 8px; margin-top: 8px; }
.gallery-thumbs img, .gallery-thumbs video { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; cursor: pointer; border: 1px solid var(--border, #ddd); }
.opt-selects { display: flex; gap: 14px; flex-wrap: wrap; margin: 4px 0 16px; }
.opt-select { display: flex; align-items: center; gap: 8px; font-size: 14.5px; font-weight: 600; }
.opt-select select { margin: 0; width: auto; min-width: 90px; }
.product-meta { display: flex; gap: 12px; font-size: 14px; opacity: 0.75; }
.product-description { line-height: 1.6; margin-top: 20px; }
.product-description p { margin: 0 0 10px; }
.product-description ul, .product-description ol { margin: 0 0 12px; padding-left: 22px; }
.product-description li { margin: 4px 0; }
.product-description h3, .product-description h4, .product-description h5, .product-description h6 { margin: 16px 0 6px; }
.product-description code {
  background: var(--bg-soft, #eee); border-radius: 5px; padding: 1px 6px; font-size: 0.9em;
}
.back-link { display: inline-block; margin-top: 18px; }
.share-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 22px; }
.share-label { font-size: 13px; opacity: 0.7; margin-right: 2px; }
.share-btn {
  width: 36px; height: 36px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border, #e5e5e5); background: var(--card, #fff); color: var(--fg, #111);
  cursor: pointer; padding: 0; font: inherit; text-decoration: none; transition: border-color 0.15s, color 0.15s;
}
.share-btn:hover { border-color: var(--accent, #2563eb); color: var(--accent, #2563eb); text-decoration: none; }
.share-copied { font-size: 13px; color: var(--accent, #2563eb); font-weight: 600; }

/* Cart & checkout */
.cart-items { margin: 18px 0; }
.cart-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--border, #eee);
}
.cart-row img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; }
.cart-name { flex: 1; font-weight: 600; }
.cart-opts { display: block; font-size: 13px; font-weight: 400; opacity: 0.7; }
.cart-qty { display: flex; align-items: center; gap: 8px; }
.cart-line-total { min-width: 90px; text-align: right; font-weight: 700; }
.cart-sub { text-align: right; font-size: 14.5px; padding: 3px 0; opacity: 0.8; }
.cart-discount { color: var(--accent); opacity: 1; }
.cart-total { text-align: right; font-size: 20px; padding: 10px 0 14px; }
.coupon-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0 18px; }
.coupon-row input { max-width: 200px; margin: 0; text-transform: uppercase; }
.coupon-toggle { margin: 6px 0 14px; font-size: 14px; }
.checkout-form { max-width: 560px; }
/* Checkout layout: summary beside the form on wide screens, above it on phones. */
.checkout-layout { display: grid; gap: 24px; }
@media (min-width: 900px) {
  .checkout-layout { grid-template-columns: minmax(0, 1fr) 360px; column-gap: 40px; align-items: start; }
  .checkout-aside { order: 2; position: sticky; top: 16px; }
  .checkout-main { order: 1; }
}
.checkout-aside .cart-items { margin-top: 0; }
.cart-hint { text-align: right; font-size: 13.5px; padding: 2px 0; color: var(--accent); }
.field-grid { display: grid; grid-template-columns: minmax(110px, 1fr) 2fr; gap: 0 12px; }
.linklike { background: none; border: 0; padding: 0; color: var(--accent, #2563eb); cursor: pointer; font: inherit; font-size: 14px; text-decoration: underline; }
.field-hint { font-size: 13px; opacity: 0.7; font-weight: 400; }
.field-msg { display: block; color: #dc2626; font-size: 12.5px; font-weight: 500; margin-top: 2px; }
.checkout-form label.invalid input, .checkout-form label.invalid select, .checkout-form label.invalid textarea { border-color: #dc2626; }
.pay-secure { margin: 8px 0 0; }
.remember-row { font-size: 14px; margin: 6px 0 10px; }
/* Cart recovery: return-visit bar, "email me my cart", resume-payment page */
.cart-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center;
  padding: 10px 16px; font-size: 14.5px; background: var(--bg-soft, #f3f4f6); border-bottom: 1px solid var(--border, #e5e5e5);
}
.cart-bar .cart-bar-x { background: none; border: 0; cursor: pointer; font-size: 16px; opacity: 0.6; padding: 2px 6px; color: inherit; }
.cart-bar .cart-bar-x:hover { opacity: 1; }
#cart-email-row input { max-width: 240px; margin: 0; }
/* NBS IPS QR / payment slip */
.pay-ips .ips-mark { height: 22px; width: auto; vertical-align: middle; margin-left: 8px; }
.ips-box { max-width: 560px; margin: 18px auto 6px; text-align: left; }
.ips-qr-wrap { display: flex; align-items: center; justify-content: center; gap: 22px; flex-wrap: wrap; }
.ips-qr svg { display: block; padding: 10px; background: #fff; border: 1px solid var(--border, #e5e5e5); border-radius: 10px; }
.ips-table { margin-top: 10px; }
.pay-page { max-width: 560px; margin: 0 auto; }
.pay-page .pay-items { margin: 14px 0; padding: 12px 16px; border: 1px solid var(--border, #e5e5e5); border-radius: 12px; font-size: 14.5px; }
.pay-page .pay-items div { padding: 3px 0; }
.turnstile-slot { margin: 14px 0 4px; }
.turnstile-slot .muted-note { display: block; margin-bottom: 6px; }
/* The order action must visually dominate the Turnstile "Success" box. */
.btn-place-order {
  width: 100%; justify-content: center; padding: 15px 20px; font-size: 19px;
  font-weight: 800; margin-top: 12px; border-radius: 12px;
}
.checkout-error { color: #dc2626; font-weight: 600; }
.order-confirmation { background: var(--card, #fff); border: 1px solid var(--border, #e5e5e5); border-radius: 12px; padding: 22px; margin: 18px 0; }
.pay-methods label.radio { margin: 8px 0; }
.fulfil-methods { margin-bottom: 4px; }

.empty-state { text-align: center; padding: 60px 0; opacity: 0.85; }
.muted-note { font-size: 13px; opacity: 0.7; font-weight: 400; }

/* v3: buyer-facing language switcher (Business multi-language storefronts) */
.lang-switch {
  font-size: 13px; padding: 4px 8px; border-radius: 8px;
  border: 1px solid var(--border, #ddd); background: var(--card, #fff); color: var(--fg, #1a1a1a);
}

/* Catalog pagination (home + filtered category/brand/search views). */
.pager { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 26px 0 8px; }
.pager-link, .pager-current { min-width: 34px; text-align: center; padding: 5px 8px; border-radius: 8px; text-decoration: none; }
.pager-link { border: 1px solid var(--border, #ddd); }
.pager-link:hover { background: var(--bg-soft, #f0f0f0); }
.pager-current { background: var(--fg, #1a1a1a); color: var(--bg, #fff); font-weight: 700; }
.pager-gap { opacity: 0.5; }

/* Pickup locations (checkout picker, thank-you page) */
.pickup-locations { margin: 10px 0 14px; }
.pickup-loc { border: 1px solid var(--border, #e5e7eb); border-radius: 10px; padding: 10px 14px; margin: 8px 0; font-size: 14px; }
.pickup-loc .pickup-address { white-space: pre-line; margin: 4px 0 8px; }
.pickup-loc iframe { display: block; width: 100%; height: 220px; border: 0; border-radius: 8px; margin: 6px 0 8px; }
.pickup-thanks { text-align: left; max-width: 520px; margin: 14px auto; }
.pickup-note { margin-top: 8px; }

/* Legal identity + bank trust block (stores taking card payments through a bank) */
.store-legal { display: block !important; padding-bottom: 14px; margin-bottom: 10px; border-bottom: 1px dashed var(--border, #e5e5e5); font-size: 13px; }
.store-legal p { margin: 4px 0; }
.store-legal .legal-links span { margin-right: 6px; opacity: .75; }
.store-legal .legal-links a { margin-right: 12px; }
.trust-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 18px 48px; margin-top: 12px; }
.trust-accept, .trust-program { display: flex; align-items: center; gap: 10px; }
/* Acceptance marks: equal boxes within the 37x23–180x113 px band the banks allow. */
.trust-accept img { width: 60px; height: 38px; object-fit: contain; background: #fff; border-radius: 4px; padding: 2px; }
/* Programme marks (Visa Secure, Mastercard ID Check): equal boxes, ≥60 px wide, kept apart from the acceptance group. */
.trust-program img { width: 72px; height: 44px; object-fit: contain; background: #fff; border-radius: 4px; padding: 2px; }
.trust-program { margin-left: auto; }
.trust-bank { display: flex; align-items: center; gap: 10px; font-size: 12.5px; opacity: .9; }
.trust-bank img { height: 26px; width: auto; max-width: 160px; object-fit: contain; }
@media (max-width: 720px) { .trust-bar { gap: 14px; } .trust-program { margin-left: 0; } }
/* Checkout: bank radio with mini card marks + terms consent */
.pay-bank .pay-cards { display: inline-flex; gap: 4px; margin-left: 8px; vertical-align: middle; }
.pay-bank .pay-cards img { width: 30px; height: 19px; object-fit: contain; background: #fff; border-radius: 3px; }
.consent-row { align-items: flex-start; font-size: 14px; margin: 6px 0 10px; }
.consent-row input { margin-top: 3px; }
/* Thank-you page receipt */
.bank-receipt { margin: 14px auto 6px; border-collapse: collapse; font-size: 14px; text-align: left; max-width: 520px; width: 100%; }
.bank-receipt caption { font-weight: 700; text-align: left; padding: 0 0 6px; }
.bank-receipt th, .bank-receipt td { padding: 5px 8px; border-top: 1px solid var(--border, #e5e5e5); vertical-align: top; }
.bank-receipt th { font-weight: 600; white-space: nowrap; width: 38%; }

.cart-vat { margin: 6px 0 0; font-size: 13.5px; }
.bank-receipt .receipt-outcome.fail td { color: #b91c1c; }
.bank-receipt .receipt-outcome.ok td, .bank-receipt .receipt-outcome.reserved td { color: #166534; }
.bank-receipt td div { margin: 0 0 2px; }

/* Facebook / Instagram Shop hand-off summary on the cart page (/meta-checkout) */
.handoff-notice { border: 1px solid var(--border, #e5e7eb); border-radius: 10px; padding: 10px 14px; margin: 0 0 12px; font-size: 14px; background: var(--card, #fff); }
.handoff-notice p { margin: 6px 0 0; }
.handoff-notice ul { margin: 4px 0 0; padding-left: 18px; }
.handoff-notice .warn { color: #b45309; }
