: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: #6a6a6a;
  --gold:       #d4af37;
  --gold-dim:   #8a7223;
  --danger:     #e05252;
  --ok:         #4caf7d;
  --radius:     2px;
  --font-serif: 'Georgia', 'Times New Roman', serif;
  --font-sans:  -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  --max:        1400px;
}

[data-theme="pearl"] {
  --bg-base:    #f5f5f0;
  --bg-surface: #ffffff;
  --bg-raised:  #ecece6;
  --line:       rgba(0,0,0,0.08);
  --line-strong:rgba(0,0,0,0.16);
  --text:       #111;
  --text-dim:   #555;
  --text-faint: #888;
  --gold:       #8a7223;
  --gold-dim:   #c0a44a;
}

* { 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;
}

/* ═══════════════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════════════ */

.page {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
}

.page-head {
  text-align: center;
  padding: 2rem 1rem 1.5rem;
}
.page-head h1 {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  margin-bottom: 0.5rem;
}
.page-head .subtitle {
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* ═══════════════════════════════════════════════════════════
   PRODUCT CARD + GRID
   ═══════════════════════════════════════════════════════════ */

.product-grid,
#product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.product-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.product-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
}
.product-card.out-of-stock { opacity: 0.55; }

.product-img {
  aspect-ratio: 1/1;
  background: var(--bg-raised);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.product-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.product-img i {
  font-size: 2rem;
  color: var(--text-faint);
}

.product-body {
  padding: 0.75rem 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.product-brand {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}

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

.product-price {
  margin-top: auto;
  padding-top: 0.4rem;
  color: var(--gold);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ═══════════════════════════════════════════════════════════
   PAGINATION / STATES
   ═══════════════════════════════════════════════════════════ */

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  padding: 2.5rem 0 0;
}
.pagination button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius);
  transition: 0.15s;
}
.pagination button:hover {
  border-color: var(--gold);
  color: var(--gold);
}
.pagination .page-info {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.loading,
.error {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-dim);
  font-style: italic;
}
.error { color: var(--danger); }

/* ═══════════════════════════════════════════════════════════
   BREADCRUMBS
   ═══════════════════════════════════════════════════════════ */

.breadcrumbs {
  font-size: 0.8rem;
  color: var(--text-dim);
  padding: 0.5rem 0 1.25rem;
}
.breadcrumbs a { color: var(--text-dim); transition: color 0.15s; }
.breadcrumbs a:hover { color: var(--gold); }

/* ═══════════════════════════════════════════════════════════
   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;
}

/* ═══════════════════════════════════════════════════════════
   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; }

@media (max-width: 720px) {
  #header-placeholder { min-height: 110px; }
}
