:root {
  --bg-base:    #0a0a0a;
  --bg-surface: #121212;
  --bg-raised:  #1a1a1a;
  --line:       rgba(255,255,255,0.08);
  --line-strong:rgba(255,255,255,0.14);
  --text:       #e6e6e6;
  --text-dim:   #9a9a9a;
  --text-faint: #9a9a9a;   /* bumped from #8a8a8a for extra headroom */
  --gold:       #d4af37;
  --gold-dim:   #a8842b;   /* was #8a7223 — now ~5.0:1 on raised bg */
  --danger:     #e05252;   /* optionally #e56b6b for more headroom */
  --ok:         #4caf7d;
  --radius:     2px;
  --font-serif: 'Georgia', 'Times New Roman', serif;
  --font-sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  --max:        1400px;
}

[data-theme="pearl"] {
  --bg-base:    #FBF8F4;          /* Luxury Pearl — warm cream            */
  --bg-surface: #FFFFFF;          /* keep pure white: cards lift off base */
  --bg-raised:  #F1EDE5;          /* warmed (was #ecece6, slightly olive) */
  --line:       rgba(0,0,0,0.08);
  --line-strong:rgba(0,0,0,0.16);
  --text:       #111;             /* ✓ 16.1:1 on bg — AAA                 */
  --text-dim:   #555;             /* ✓ 7.2:1 — AAA even for body text     */
  --text-faint: #888;             /* ⚠ 3.3:1 — decorative/large only      */
  --gold:       #8A7223;          /* ⚠ 4.4:1 — borderline for small text  */
  --gold-dim:   #C0A44A;          /* decorative accents only              */
}

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

html, body { height: 100%; }

body {
  background: var(--bg-base);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, select { font: inherit; }

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

/* ═══════════════════════════════════════════════════════════
   TOPBAR
   ═══════════════════════════════════════════════════════════ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.75rem 1.5rem;
  background: rgba(10,10,10,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

[data-theme="pearl"] .topbar { background: rgba(245,245,240,0.85); }

.brand-mark {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  white-space: nowrap;
}

.topbar-search {
  flex: 1;
  display: flex;
  max-width: 520px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-surface);
}

.topbar-search input {
  flex: 1;
  padding: 0.55rem 0.9rem;
  background: transparent;
  border: 0;
  color: var(--text);
  outline: none;
}

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

.topbar-search button {
  padding: 0 1rem;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  transition: color 0.15s;
}
.topbar-search button:hover { color: var(--gold); }

#lang-dropdown,
#currency-dropdown {
  background: var(--bg-surface);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  outline: none;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
}

#topbar-location {
  font-size: 0.8rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.topbar-right a {
  position: relative;
  display: flex;
  align-items: center;
  font-size: 1.2rem;
  color: var(--text);
}

.cart-badge {
  position: absolute;
  top: -6px;
  right: -8px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--gold);
  color: #111;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ═══════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════ */

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 4rem;
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--text-faint);
  font-size: 0.8rem;
}
/* ─── Footer: PWA install button (leftmost) ────────────── */
.footer-links--primary {
  justify-content: center;   /* keep the rest centered */
}

/* Pin the install button to the left edge of the row */
.footer-pwa {
  margin-right: auto;
}

.footer-link-btn.footer-pwa {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .35rem .7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-dim);
  font-size: .78rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  transition: color .15s, border-color .15s, background .15s;
}

.footer-link-btn.footer-pwa:hover {
  color: var(--gold);
  border-color: var(--gold);
  background: rgba(212, 175, 55, .08);
}

.footer-pwa-icon {
  font-size: 1rem;
  line-height: 1;
}

/* On very narrow screens, drop the label, keep the icon */
@media (max-width: 480px) {
  .footer-pwa span:not(.footer-pwa-icon) { display: none; }
  .footer-pwa { padding: .35rem .5rem; }
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 0.75rem; padding: 0.6rem 1rem; }
  .topbar-search { order: 3; flex-basis: 100%; max-width: none; }
  .brand-mark { font-size: 1.05rem; }
  #topbar-location { display: none; }
  .product-grid, #product-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
    padding: 0 0.75rem;
  }
  .page { padding: 1rem 0.75rem 4rem; }
}

/* CLS-skydd — reservera plats för dynamiskt innehåll */
#header-placeholder { display: block; min-height: 62px; }
.site-footer         { display: block; min-height: 84px; }

#header-placeholder { display: block; min-height: 120px; }
@media (max-width: 720px) {
  #header-placeholder { min-height: 160px; }
}

/* The shop-aside is injected by header.js on every page. On desktop
   it's hidden; on mobile (≤860px) sidebar.css un-hides it as a drawer. */
.shop-aside[data-mode="offcanvas"] { display: none; }

/* ═══════════════════════════════════════════════════════════
   LEGACY ALIASES — map the old --metal-* naming onto the
   canonical design tokens so about/contact/faq/news render
   correctly under the unified theme.
   ═══════════════════════════════════════════════════════════ */
:root {
  --metal-text:   var(--text);
  --metal-muted:  var(--text-dim);
  --metal-hint:   var(--text-faint);
  --metal-border: var(--line);
  --metal-panel:  var(--bg-surface);
  --radius-sm:    var(--radius);
  --radius-md:    var(--radius);
  --radius-pill:  999px;
}

/* ─── Global promise banner (used by index/about/faq/news/...) ─── */
.promise {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: 3rem auto;
  padding: 2.25rem 1.5rem;
  text-align: center;
  max-width: 720px;
}
.promise p { color: var(--text-dim); font-size: .95rem; line-height: 1.7; }
.promise strong {
  color: var(--text);
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.15rem;
  letter-spacing: .02em;
}
.promise-sub {
  display: inline-block;
  margin-top: .5rem;
  font-size: .72rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ═══════════════════════════════════════════════════════════
   MOBILE OPTIMIZATION
   Touch targets, iOS quirks, safe-area, narrow layouts.
   ═══════════════════════════════════════════════════════════ */

/* ─── Global baseline ────────────────────────────────────── */
html {
  -webkit-text-size-adjust: 100%;     /* iOS: no auto-inflate */
  scroll-behavior: smooth;
}
body {
  /* iPhone notch / home indicator clearance */
  padding-left:   env(safe-area-inset-left);
  padding-right:  env(safe-area-inset-right);
  overflow-x: hidden;                  /* kill any stray overflow */
}
a, button { -webkit-tap-highlight-color: rgba(212,175,55,.18); }

/* ─── iOS auto-zoom fix ──────────────────────────────────
   Any input/select/textarea with font-size < 16px makes iOS
   zoom in on focus and NOT zoom back out — the page stays
   scrolled and cropped until the user pinches. Force 16px
   on touch-capable viewports. Desktop is untouched.        */
@media (max-width: 860px), (hover: none) {
  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* ─── Touch targets — Apple HIG: 44×44 minimum ────────── */
@media (max-width: 860px), (hover: none) {
  button,
  .btn-primary, .btn-secondary, .btn-gold,
  .btn-cart, .btn-buy, .btn-auth, .btn-inquire,
  .sort-toggle, .filter-reset,
  .pagination button,
  .qty-btn, .cat-toggle,
  .aside-toggle, .aside-close {
    min-height: 44px;
  }
  .qty-btn, .cat-toggle, .aside-close {
    min-width: 44px;
  }
  .cart-item-remove,
  .variant-btn,
  .filter-switch {
    min-height: 40px;
  }
}

/* ─── Tables — always scroll horizontally ──────────────── */
.prose-block { overflow-x: auto; }
.ship-table { min-width: 520px; }
.ship-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1rem -1rem 2rem;
  padding: 0 1rem;
}

/* ─── Long words / URLs / emails ───────────────────────── */
.cart-item-name, .product-name, .prose-block p,
.info-list dd, .news-list p, .confirm-facts dd,
.checkout-item .ck-name, .faq-a {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ─── Topbar — compact on phones ───────────────────────── */
@media (max-width: 720px) {
  .topbar {
    padding: calc(0.5rem + env(safe-area-inset-top)) 0.75rem 0.5rem;
    gap: 0.4rem;
    flex-wrap: nowrap;
  }
  .brand-mark { font-size: 1rem; letter-spacing: 0.14em; }
  .topbar-search {
    order: 3;
    flex-basis: 100%;
    max-width: none;
    margin-top: 0.4rem;
  }
  .topbar-search input { padding: 0.55rem 0.75rem; }
  #topbar-location { display: none; }
  #lang-dropdown {
    font-size: 0.75rem;
    padding: 0.4rem 0.5rem;
    max-width: 84px;
  }
}
@media (max-width: 400px) {
  #lang-dropdown { display: none; }   /* move to drawer only */
}

/* ─── Product grid — 2 cols on phones ──────────────────── */
@media (max-width: 480px) {
  .product-grid, #product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
    padding: 0 0.65rem;
  }
  .product-body { padding: 0.6rem 0.7rem 0.9rem; }
  .product-brand { font-size: 0.62rem; }
  .product-name { font-size: 0.85rem; line-height: 1.3; }
  .product-price { font-size: 0.9rem; }
}

/* ─── Hero — scale down ────────────────────────────────── */
@media (max-width: 480px) {
  .hero { padding: 1.75rem 1rem 1.25rem; }
  .hero h1 { font-size: clamp(1.75rem, 7vw, 2.25rem); line-height: 1.1; }
  .hero-lead { font-size: 0.88rem; }
  .hero-search { margin-bottom: 1.25rem; }
  .hero-search input { padding: 0.75rem 0.85rem; font-size: 16px; }
  .hero-stats { font-size: 0.62rem; letter-spacing: 0.1em; gap: 0.35rem; }
}
@media (max-width: 360px) {
  .hero-stats { display: none; }
}

/* ─── Category strip — tighter tiles ───────────────────── */
@media (max-width: 720px) {
  .cat-strip { gap: 0.5rem; padding: 0.25rem 0.75rem 0.85rem; }
  .cat-tile { min-width: 104px; padding: 0.6rem 0.75rem; font-size: 0.78rem; }
  .cat-tile .cat-name { max-width: 140px; }
}

/* ─── Filter bar — stack on phones ─────────────────────── */
@media (max-width: 720px) {
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
    padding: 0.6rem 0.75rem 0.85rem;
  }
  .filter-group {
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
  }
  .filter-group-right { margin-left: 0; }
  .filter-switch { padding: 0.35rem 0; }
  .filter-price { flex-wrap: wrap; gap: 0.4rem; }
  .filter-price input { flex: 1 1 40%; width: auto; min-width: 84px; }
  .filter-select { flex-direction: column; align-items: stretch; gap: 0.3rem; }
  .filter-select select { width: 100%; }
}

/* ─── Sidebar (drawer) — better touch + scroll ─────────── */
@media (max-width: 860px) {
  .shop-aside[data-mode="offcanvas"] {
    width: min(320px, 88vw);
    padding: calc(0.9rem + env(safe-area-inset-top))
             1rem
             calc(1.25rem + env(safe-area-inset-bottom));
  }
  .aside-close {
    font-size: 1.9rem;
    line-height: 1;
    padding: 0 0.6rem;
    color: var(--text);
  }
  .aside-section { padding: 0.9rem 0; }
  .aside-select { font-size: 16px; }   /* iOS: no zoom on the drawer's selects */
  .filter-attr-list label { padding: 0.6rem 0.55rem; }
  .filter-cat-list a, .filter-cat-list button { padding: 0.6rem 0.55rem; }
}

/* ─── Cart — restructured for narrow ───────────────────── */
@media (max-width: 620px) {
  .cart-layout { gap: 1rem; }
  .cart-summary {
    position: static;              /* stop sticking on mobile */
    margin-top: 0.5rem;
  }
  .cart-item {
    grid-template-columns: 60px 1fr auto;
    grid-template-areas:
      "img info remove"
      "img qty  total";
    gap: 0.45rem 0.65rem;
    padding: 0.75rem 0.7rem;
  }
  .cart-item-img { grid-area: img; width: 60px; height: 60px; }
  .cart-item-info { grid-area: info; }
  .cart-item-qty { grid-area: qty; justify-self: start; padding: 0.15rem; }
  .cart-item-total { grid-area: total; justify-self: end; align-self: center; }
  .cart-item-remove { grid-area: remove; font-size: 1.35rem; }
  .cart-item-name { font-size: 0.92rem; }
  .cart-actions { flex-direction: column-reverse; gap: 0.5rem; }
  .cart-actions .btn-secondary { width: 100%; }
  .btn-checkout { font-size: 0.95rem; padding: 1rem; }
}

/* ─── Checkout ─────────────────────────────────────────── */
@media (max-width: 620px) {
  .checkout-section { padding: 1.15rem; }
  .form-grid { grid-template-columns: 1fr; gap: 0.75rem; }
  .form-row input, .form-grid input { font-size: 16px; padding: 0.85rem 0.9rem; }
}

/* ─── Product detail — stack the grid ──────────────────── */
@media (max-width: 720px) {
  .product-detail { padding: 0.5rem 0 2rem; }
  .product-detail-grid { gap: 1.25rem; }
  .gallery-thumbs { grid-template-columns: repeat(4, 1fr); gap: 0.4rem; }
  .gallery-main { aspect-ratio: 1/1; }
  .product-info-title { font-size: 1.4rem; }
  .product-info-price { font-size: 1.4rem; }
  .purchase-row { flex-direction: column; gap: 0.6rem; }
  .qty-control { align-self: stretch; }
  .qty-input { flex: 1; width: auto; font-size: 16px; }
  .btn-cart, .btn-buy { width: 100%; min-height: 48px; }
  .product-description { font-size: 0.88rem; }
}

/* ─── Content pages (about / contact / faq / news / shipping) */
@media (max-width: 720px) {
  .content-page { padding: 2rem 1rem 3rem; }
  .content-page .lead { margin-bottom: 2rem; }
  .prose-block { padding: 1.25rem; }
  .value-grid { gap: 0.75rem; }
  .partner-grid { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
  .partner-card { padding: 1rem 0.6rem; font-size: 0.85rem; }
  .contact-grid { gap: 1.5rem; }
  .faq-list summary { font-size: 0.98rem; padding: 1rem 0; }
  .faq-list .faq-a { padding: 0 0 1rem 1.7rem; font-size: 0.9rem; }
}
@media (max-width: 480px) {
  .content-page h1 { font-size: 1.6rem; }
  .value-grid { grid-template-columns: 1fr; }
  .news-list article { grid-template-columns: 1fr; gap: 0.4rem; padding: 1.25rem 0; }
  .news-list time { padding-top: 0; }
  .news-list h2 { font-size: 1.05rem; }
  .news-list p { font-size: 0.88rem; }
  .confirm-facts > div { grid-template-columns: 1fr; gap: 0.15rem; }
  .confirm-actions .btn-primary,
  .confirm-actions .btn-secondary { min-width: 0; flex: 1 1 100%; }
  .confirmation { padding: 1.25rem 1rem; margin: 1rem auto; }
}

/* ─── Categories tree ──────────────────────────────────── */
@media (max-width: 560px) {
  .cat-tree { padding: 0.4rem 0.6rem 0.85rem; margin: 0 0.4rem; }
  .cat-row { padding: 0.55rem 0; gap: 0.55rem; }
  .cat-link { font-size: 0.92rem; }
  .cat-children { padding-left: 0.7rem; }
}

/* ─── Brands / Tags grids ──────────────────────────────── */
@media (max-width: 560px) {
  .brands-section, .tags-section { padding: 2rem 1rem; }
  .brands-header h1 { font-size: 1.6rem; }
  .brands-grid { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
  .brand-item { padding: 0.8rem 0.65rem; }
  .brand-item .brand-name { font-size: 0.85rem; }
  .tags-grid { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
  .tag-item { padding: 0.85rem 0.65rem; font-size: 0.85rem; }
  .tags-controls { flex-direction: column; align-items: stretch; }
  #tag-search, #brand-search { min-width: 0; width: 100%; font-size: 16px; }
  .brands-controls { flex-direction: column; align-items: stretch; gap: 0.6rem; }
  .sort-toggle { justify-content: center; }
}

/* ─── Pagination ───────────────────────────────────────── */
@media (max-width: 560px) {
  .pagination { gap: 0.25rem; padding: 1.5rem 0 0; }
  .pagination button {
    min-width: 38px;
    padding: 0.4rem 0.55rem;
    font-size: 0.78rem;
  }
  .pagination .page-info { display: none; }   /* hide ellipses on phones */
}

/* ─── Auth ─────────────────────────────────────────────── */
@media (max-width: 480px) {
  .auth-section { padding: 1.5rem 1rem; }
  .auth-card { padding: 1.25rem; }
  .auth-section h1 { font-size: 1.6rem; }
}

/* ─── Footer ───────────────────────────────────────────── */
@media (max-width: 720px) {
  .site-footer {
    padding: 1.5rem 1rem calc(1.5rem + env(safe-area-inset-bottom));
    font-size: 0.75rem;
  }
  .footer-links { gap: 0.45rem; line-height: 2; }
}

/* ═══════════════════════════════════════════════════════════
   FOOTER LEGAL LINK ROW
   ═══════════════════════════════════════════════════════════ */
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.25rem;
  justify-content: center;
  margin-bottom: .85rem;
}
.footer-links--legal {
  padding-top: .85rem;
  border-top: 1px solid var(--line);
  margin-bottom: .85rem;
}
.footer-links--legal a,
.footer-link-btn {
  font-size: .78rem;
  color: var(--text-faint);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.footer-link-btn {
  background: transparent;
  border: 0;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  transition: color .15s;
}
.footer-links--legal a:hover,
.footer-link-btn:hover {
  color: var(--gold);
}

/* ═══════════════════════════════════════════════════════════
   BROWSER AWARENESS
   Native UI theming, a11y, motion, print, contrast.
   ═══════════════════════════════════════════════════════════ */

:root {
  color-scheme: dark;
  accent-color: var(--gold);
}
[data-theme="pearl"] { color-scheme: light; }

input, select, textarea, button { caret-color: var(--gold); }

::selection { background: rgba(212,175,55,.28); color: var(--text); }
[data-theme="pearl"] ::selection { background: rgba(138,114,35,.22); color: #111; }

/* Scrollbar — Firefox + WebKit */
html {
  scrollbar-gutter: stable;
  scrollbar-color: rgba(212,175,55,.35) transparent;
  scrollbar-width: thin;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: rgba(212,175,55,.22);
  border-radius: 5px;
  border: 2px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: rgba(212,175,55,.45);
  background-clip: content-box;
}

/* Keyboard focus ring */
:focus { outline: none; }
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible,
summary:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Anchor jumps land below the sticky topbar */
[id] { scroll-margin-top: 90px; }

/* Modern typography */
h1, h2, h3, h4 { text-wrap: balance; }
p, li, dd      { text-wrap: pretty; }

/* Disable hover transforms on touch-only devices */
@media (hover: none) {
  .product-card:hover,
  .brand-logo:hover,
  .cat-tile:hover,
  .partner-card:hover,
  .tag-item:hover,
  .brand-item:hover {
    transform: none;
    box-shadow: none;
  }
}

/* Respect reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .orb-ring, .orb-body,
  .cat-tile.is-skeleton,
  .cookie-banner, .cookie-modal-panel,
  .cookie-modal-backdrop { animation: none !important; }
  html { scroll-behavior: auto; }
}

/* Higher contrast preference */
@media (prefers-contrast: more) {
  :root {
    --line:        rgba(255,255,255,.22);
    --line-strong: rgba(255,255,255,.38);
    --text-dim:    #d4d4d4;
    --text-faint:  #b4b4b4;
  }
  .product-card, .cart-item, .prose-block,
  .value-card, .partner-card, .brand-item, .tag-item,
  .cookie-banner, .cookie-modal-panel { border-width: 2px; }
}

/* Windows High Contrast / forced-colors */
@media (forced-colors: active) {
  a { color: LinkText; }
  a:visited { color: VisitedText; }
  ::selection { background: Highlight; color: HighlightText; }
  .btn-primary, .btn-secondary, .btn-gold,
  .btn-cart, .btn-buy, .btn-auth, .btn-inquire,
  .cookie-btn, .btn-checkout {
    border: 1px solid ButtonText;
    forced-color-adjust: none;
  }
  .product-card, .cart-item, .prose-block,
  .value-card, .partner-card, .brand-item, .tag-item,
  .cookie-banner, .cookie-modal-panel { border: 1px solid CanvasText; }
  input, select, textarea { border: 1px solid ButtonText; }
}

/* Print */
@media print {
  :root {
    --bg-base: #fff; --bg-surface: #fff; --bg-raised: #f5f5f5;
    --text: #000; --text-dim: #333; --text-faint: #666;
    --line: #ccc; --line-strong: #999; --gold: #8a7223;
  }
  body { background: #fff !important; color: #000 !important; font-size: 11pt; padding: 0 !important; }
  .topbar, .shop-aside, .aside-backdrop, .aside-toggle,
  .cookie-banner, .cookie-modal, .site-footer .footer-links,
  .hero-search, .filter-bar, .pagination, .grid-more,
  .cart-item-img, .cart-item-qty, .cart-item-remove,
  .btn-cart, .btn-buy, .btn-checkout, .confirm-actions,
  .product-card .product-img { display: none !important; }
  a { color: #000 !important; text-decoration: underline; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #555; }
  .content-page, .prose-block, .product-detail, .confirmation,
  .about-section, .contact-section, .faq-section, .news-section {
    padding: 0 !important; margin: 0 !important; max-width: none !important;
    border: 0 !important; box-shadow: none !important; background: transparent !important;
  }
  .product-detail-grid { grid-template-columns: 1fr !important; gap: 1rem; }
  img { max-width: 100% !important; height: auto !important; }
  @page { margin: 15mm; }
}

/* Progressive enhancement */
@supports (color: color-mix(in srgb, red 50%, blue)) {
  .btn-primary:hover { background: color-mix(in srgb, var(--gold) 88%, white); }
  .btn-secondary:hover { border-color: color-mix(in srgb, var(--gold) 70%, transparent); }
}
@supports selector(:has(*)) {
  .filter-switch:has(input:checked) { color: var(--text); }
}

/* Reduced-data preference */
@media (prefers-reduced-data: reduce) {
  .orb-ring, .orb-body, .cat-tile.is-skeleton { animation: none !important; }
}

#product-grid { overflow-anchor: auto; }


/* ═══════════════════════════════════════════════════════════
   TOPBAR ACCOUNT LINK
   ═══════════════════════════════════════════════════════════ */
#topbar-account {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  color: var(--text);
  font-size: .82rem;
  letter-spacing: .02em;
  padding: .35rem .6rem;
  border-radius: var(--radius);
  transition: color .15s, background .15s;
  white-space: nowrap;
}
#topbar-account:hover { color: var(--gold); }
#topbar-account.is-logged-in {
  color: var(--gold);
  background: rgba(212,175,55,.08);
}
#topbar-account-label {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 720px) {
  #topbar-account-label { display: none; }
  #topbar-account { padding: .35rem; }
}

/* ═══════════════════════════════════════════════════════════
   THEME TOGGLE — Onyx / Pearl mode switch
   ═══════════════════════════════════════════════════════════ */

.topbar-theme {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-width: 34px;
  height: 34px;
  padding: 0 .7rem;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-dim);
  font-family: inherit;
  cursor: pointer;
  transition: color .15s, background .15s, border-color .15s;
  flex-shrink: 0;
  margin-right: .5rem;
}
.topbar-theme:hover {
  color: var(--gold);
  background: rgba(212, 175, 55, .08);
  border-color: rgba(212, 175, 55, .3);
}
.topbar-theme .theme-icon { display: inline-flex; line-height: 0; }
.topbar-theme .theme-icon svg { display: block; }

/* Icon swap: show the icon of the mode you'll switch TO */
.topbar-theme .theme-icon-light { display: none; }
.topbar-theme .theme-icon-dark  { display: inline-flex; }
html[data-theme="pearl"] .topbar-theme .theme-icon-dark  { display: none; }
html[data-theme="pearl"] .topbar-theme .theme-icon-light { display: inline-flex; }

.theme-label {
  font-size: .7rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  font-weight: 600;
  color: inherit;
  white-space: nowrap;
  min-width: 3.4em;
  text-align: left;
}

/* Mobile: icon-only circle */
@media (max-width: 720px) {
  .theme-label { display: none; }
  .topbar-theme {
    width: 32px;
    min-width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    margin-right: .25rem;
  }
}

/* ═══════════════════════════════════════════════════════════
   ASIDE-TOGGLE-BASE-RULE
   The button is injected by js/header.js with class
   .aside-toggle. Prior to this block the only rules matching
   it were inside @media (max-width:860px) (min-height) and
   @media print (display:none) — so on desktop it rendered as
   an unstyled UA button. This restores the intended look.
   ═══════════════════════════════════════════════════════════ */

.aside-toggle,
.aside-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  margin: 0;
  background: transparent;
  border: 0;
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
  border-radius: var(--radius);
  -webkit-tap-highlight-color: transparent;
  transition: color .15s, background .15s;
}

.aside-toggle:hover,
.aside-close:hover {
  color: var(--gold);
  background: rgba(212, 175, 55, .08);
}

.aside-toggle:focus-visible,
.aside-close:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════
   PWA INSTALL EXPERIENCE — LTD.KIM
   ═══════════════════════════════════════════════════════════ */

#pwa-install[hidden],
.footer-pwa[hidden],
button[hidden] {
  display: none !important;
}

.footer-link-btn.footer-pwa {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-height: 36px;
  padding: .42rem .82rem;
  border: 1px solid rgba(212, 175, 55, .28);
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(212,175,55,.12), rgba(212,175,55,.03));
  color: var(--text);
  font-size: .72rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}

.footer-link-btn.footer-pwa::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(212,175,55,.36), transparent 45%, rgba(255,255,255,.06));
  opacity: .35;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  padding: 1px;
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.footer-link-btn.footer-pwa:hover {
  color: var(--gold);
  border-color: rgba(212, 175, 55, .55);
  background:
    linear-gradient(135deg, rgba(212,175,55,.18), rgba(212,175,55,.06));
}

.footer-pwa-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  color: var(--gold);
  font-size: .85rem;
  line-height: 1;
}

.footer-pwa-label {
  display: inline;
}

.footer-pwa.is-installed {
  opacity: .72;
}

/* Modal */
.pwa-modal[hidden] {
  display: none !important;
}

body.pwa-modal-open {
  overflow: hidden;
}

.pwa-modal {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.pwa-modal-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 0%, rgba(212,175,55,.16), transparent 38%),
    rgba(0,0,0,.74);
  backdrop-filter: blur(10px);
}

.pwa-modal-panel {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: min(760px, calc(100dvh - 2.5rem));
  overflow-y: auto;
  padding: 2rem;
  border: 1px solid rgba(212,175,55,.26);
  border-radius: 2px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.035), transparent 28%),
    var(--bg-surface);
  color: var(--text);
  box-shadow:
    0 28px 80px rgba(0,0,0,.58),
    inset 0 1px 0 rgba(255,255,255,.04);
}

[data-theme="pearl"] .pwa-modal-panel {
  box-shadow:
    0 28px 80px rgba(0,0,0,.18),
    inset 0 1px 0 rgba(255,255,255,.7);
}

.pwa-modal-close {
  position: absolute;
  top: .75rem;
  right: .75rem;
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font-size: 1.7rem;
  line-height: 1;
}

.pwa-modal-close:hover {
  color: var(--gold);
}

.pwa-modal-kicker {
  margin-bottom: .55rem;
  color: var(--gold);
  font-size: .68rem;
  letter-spacing: .24em;
  text-transform: uppercase;
}

.pwa-modal-panel h2 {
  margin: 0 2rem .75rem 0;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(1.65rem, 4vw, 2.35rem);
  letter-spacing: .02em;
  color: var(--text);
}

.pwa-modal-lead {
  margin: 0 0 1.35rem;
  color: var(--text-dim);
  line-height: 1.7;
}

.pwa-platform-current {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: .9rem;
  align-items: start;
  margin: 1.25rem 0;
  padding: 1rem;
  border: 1px solid var(--line);
  background: rgba(212,175,55,.055);
}

.pwa-platform-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(212,175,55,.35);
  border-radius: 50%;
  color: var(--gold);
  font-size: 1.1rem;
}

.pwa-platform-current strong {
  display: block;
  margin-bottom: .25rem;
  color: var(--text);
  font-size: .95rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.pwa-platform-current p {
  margin: 0;
  color: var(--text-dim);
  font-size: .9rem;
  line-height: 1.6;
}

.pwa-install-steps {
  margin: 1rem 0 1.25rem;
  padding-left: 1.25rem;
  color: var(--text);
}

.pwa-install-steps li {
  margin: .45rem 0;
  padding-left: .25rem;
  color: var(--text-dim);
}

.pwa-install-steps li::marker {
  color: var(--gold);
}

.pwa-platform-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .6rem;
  margin: 1.25rem 0;
}

.pwa-platform-grid div {
  padding: .85rem;
  border: 1px solid var(--line);
  background: var(--bg-raised);
}

.pwa-platform-grid span {
  display: block;
  margin-bottom: .2rem;
  color: var(--text);
  font-size: .78rem;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.pwa-platform-grid small {
  color: var(--text-faint);
  font-size: .76rem;
}

.pwa-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem;
  margin-top: 1.35rem;
}

.pwa-install-primary,
.pwa-install-secondary {
  min-height: 44px;
  padding: .8rem 1.05rem;
  border-radius: 2px;
  font-family: var(--font-sans);
  font-size: .78rem;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.pwa-install-primary {
  border: 1px solid var(--gold);
  background: var(--gold);
  color: #111;
  font-weight: 700;
}

.pwa-install-primary:disabled {
  cursor: default;
  opacity: .72;
  border-color: var(--line-strong);
  background: var(--bg-raised);
  color: var(--text-dim);
}

.pwa-install-secondary {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-dim);
}

.pwa-install-secondary:hover {
  color: var(--gold);
  border-color: rgba(212,175,55,.4);
}

.pwa-modal-note {
  margin: 1rem 0 0;
  color: var(--text-faint);
  font-size: .78rem;
  line-height: 1.6;
}

@media (max-width: 560px) {
  .pwa-modal {
    align-items: flex-end;
    padding: .75rem;
  }

  .pwa-modal-panel {
    width: 100%;
    max-height: calc(100dvh - 1.5rem);
    padding: 1.45rem;
  }

  .pwa-platform-grid {
    grid-template-columns: 1fr;
  }

  .pwa-modal-actions {
    flex-direction: column;
  }

  .pwa-install-primary,
  .pwa-install-secondary {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .footer-pwa-label {
    display: none;
  }

  .footer-link-btn.footer-pwa {
    padding: .42rem .58rem;
  }
}


/* ===============================
   Global Button Base Styles
   =============================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  cursor: pointer;
}

.btn-primary {
  background: var(--gold);
  color: #111;
  border: 1px solid var(--gold);
}

.btn-primary:hover {
  filter: brightness(1.1);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--text);
}

.btn-secondary:hover {
  border-color: var(--gold);
  color: var(--gold);
}

/* Apply .btn base to existing button classes */
.button, .btn-auth, .btn-cart, .btn-buy, .btn-gold {
  /* replicate .btn styles if needed */
}

/* ===============================
   Card Enhancements
   =============================== */

.product-card, .partner-card, .brand-item, .tag-item, .value-card, .cart-item, .checkout-item {
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  transition: transform 0.15s, box-shadow 0.15s;
}

.product-card:hover, .partner-card:hover, .brand-item:hover, .tag-item:hover, .value-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}

.product-card:focus-visible, .partner-card:focus-visible, .brand-item:focus-visible, .tag-item:focus-visible, .value-card:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════
   HEADER FLOW — the "goldthread" header (js/header.js)
   ───────────────────────────────────────────────────────────
   body.header-flow            → controller active
   body.header-flow.thread-on  → header hidden, 2px gold thread
   ═══════════════════════════════════════════════════════════ */

/* Controller active → topbar becomes a fixed, spring-driven layer.
   (Without JS this rule never matches and the bar stays sticky.) */
body.header-flow .topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  transform: translate3d(0, 0, 0);
}
body.header-flow { scroll-behavior: auto; }
/* JS reserves the header's exact height on the placeholder */
body.header-flow #header-placeholder { min-height: 0; }

/* Anchor jumps still land below the floating header */
body.header-flow [id] { scroll-margin-top: calc(var(--header-h, 90px) + 16px); }

/* ─── The goldthread ─────────────────────────────────────── */
#topbar-thread {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 99;
  display: block;
  height: 2px;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity .45s ease, visibility 0s linear .45s;
  -webkit-tap-highlight-color: transparent;
}

/* invisible reach zone — thin to the eye, reachable to the hand */
#topbar-thread::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 16px;
}
@media (hover: none) {
  #topbar-thread::after { height: 24px; }
}

body.header-flow.thread-on #topbar-thread {
  opacity: 1;
  visibility: visible;
  transition: opacity .3s ease .1s, visibility 0s;
}

#topbar-thread .thread-line {
  position: absolute;
  inset: 0;
  background: var(--line-strong);
  opacity: .45;
}

/* reading progress — the thread weaves itself as you descend */
#topbar-thread .thread-fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: filter .2s ease;
}

/* the bead — the LTD.KIM diamond ◇ resting on the thread */
#topbar-thread .thread-bead {
  position: absolute;
  top: -2.5px;
  left: 50%;
  width: 7px;
  height: 7px;
  margin-left: -3.5px;
  background: var(--gold);
  transform: rotate(45deg) scale(.55);
  opacity: .5;
  box-shadow: 0 0 8px rgba(212,175,55,.5);
  transition: transform .28s ease, opacity .28s ease, box-shadow .28s ease;
  animation: thread-breathe 3.4s ease-in-out infinite;
}
[data-theme="pearl"] #topbar-thread .thread-bead {
  box-shadow: 0 0 8px rgba(138,114,35,.45);
}

@keyframes thread-breathe {
  0%, 100% { opacity: .38; }
  50%      { opacity: .72; }
}

#topbar-thread:hover .thread-bead,
#topbar-thread:focus-visible .thread-bead {
  animation: none;
  transform: rotate(45deg) scale(1);
  opacity: 1;
  box-shadow: 0 0 16px rgba(212,175,55,.85);
}
#topbar-thread:hover .thread-fill { filter: brightness(1.12); }

#topbar-thread:focus-visible { outline: none; }
#topbar-thread:focus-visible .thread-line { background: var(--gold); opacity: .9; }

/* cart feedback — the bead acknowledges with a single gold ping */
#topbar-thread .thread-bead.is-pulsing {
  animation: thread-ping .9s cubic-bezier(.2,.7,.3,1) 1;
}
@keyframes thread-ping {
  0%   { transform: rotate(45deg) scale(1.25); opacity: 1; box-shadow: 0 0 0 0 rgba(212,175,55,.75); }
  100% { transform: rotate(45deg) scale(.55);  opacity: .5; box-shadow: 0 0 18px 14px rgba(212,175,55,0); }
}

@media (prefers-reduced-motion: reduce) {
  #topbar-thread { transition: none; }
  #topbar-thread .thread-bead { animation: none; }
}

@media print {
  #topbar-thread { display: none !important; }
  body.header-flow #header-placeholder { height: 0 !important; }
}

/* ═══════════════════════════════════════════════════════════
   HOTFIX: HeaderFlow goldthread mobile button reset
   Prevent global mobile button min-height from turning the
   2px thread into a large gold rectangle.
   ═══════════════════════════════════════════════════════════ */

#topbar-thread {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;

  height: 2px !important;
  min-height: 0 !important;
  max-height: 2px !important;

  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;

  background: transparent !important;
  box-shadow: none !important;

  overflow: visible !important;
  z-index: 1001 !important;
  line-height: 0 !important;
}

/* keep the touch area large, but invisible */
#topbar-thread::after {
  content: '' !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  height: 24px !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

/* the visible line must stay 2px, never full button height */
#topbar-thread .thread-line,
#topbar-thread .thread-fill {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: auto !important;
  bottom: auto !important;

  width: 100% !important;
  height: 2px !important;
  min-height: 0 !important;
  max-height: 2px !important;

  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
}

#topbar-thread .thread-line {
  background: var(--line-strong) !important;
  opacity: .45;
}

#topbar-thread .thread-fill {
  background: linear-gradient(90deg, var(--gold-dim), var(--gold)) !important;
  transform-origin: 0 50% !important;
}

#topbar-thread .thread-bead {
  position: absolute !important;
  top: -2.5px !important;
  left: 50% !important;

  width: 7px !important;
  height: 7px !important;
  min-width: 0 !important;
  min-height: 0 !important;

  padding: 0 !important;
  margin: 0 0 0 -3.5px !important;
  border: 0 !important;

  background: var(--gold) !important;
  border-radius: 0 !important;
}


/* ═══════════════════════════════════════════════════════════
   BACK TO TOP BUTTON — theme-aware floating control
   ═══════════════════════════════════════════════════════════ */

#back-to-top {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 950;

  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 0;
  margin: 0;
  border: 1px solid rgba(212, 175, 55, .34);
  border-radius: 50%;

  background:
    radial-gradient(circle at 35% 20%, rgba(255,255,255,.10), transparent 38%),
    rgba(18, 18, 18, .82);

  color: var(--gold);
  box-shadow:
    0 12px 34px rgba(0,0,0,.38),
    inset 0 1px 0 rgba(255,255,255,.06);

  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);

  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  transform: translateY(12px) scale(.94);
  transition:
    opacity .22s ease,
    visibility .22s ease,
    transform .22s ease,
    border-color .16s ease,
    background .16s ease,
    color .16s ease;
}

#back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

#back-to-top:hover {
  color: #111;
  border-color: var(--gold);
  background:
    radial-gradient(circle at 35% 20%, rgba(255,255,255,.22), transparent 38%),
    var(--gold);
}

#back-to-top:active {
  transform: translateY(1px) scale(.98);
}

#back-to-top svg {
  width: 19px;
  height: 19px;
  display: block;
  stroke: currentColor;
}

/* Pearl theme */
[data-theme="pearl"] #back-to-top {
  background:
    radial-gradient(circle at 35% 20%, rgba(255,255,255,.75), transparent 38%),
    rgba(255, 255, 255, .82);

  color: var(--gold);
  border-color: rgba(138, 114, 35, .34);
  box-shadow:
    0 12px 30px rgba(0,0,0,.16),
    inset 0 1px 0 rgba(255,255,255,.9);
}

[data-theme="pearl"] #back-to-top:hover {
  color: #fff;
  background: var(--gold);
  border-color: var(--gold);
}

/* keep it above product cards but below modals */
body.pwa-modal-open #back-to-top,
body.aside-open #back-to-top {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Avoid cart/footer overlap on very small screens */
@media (max-width: 560px) {
  #back-to-top {
    right: max(.85rem, env(safe-area-inset-right));
    bottom: max(.85rem, env(safe-area-inset-bottom));
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #back-to-top {
    transition: none;
  }
}

@media print {
  #back-to-top {
    display: none !important;
  }
}

