/* ── CSS Variables (injected dynamically from config via shop_vars.php) ── */
/* Fallbacks defined here; actual values set by PHP */
:root {
  --color-primary:     #1a1a1a;
  --color-secondary:   #f5f0eb;
  --color-accent:      #c8a96e;
  --color-text:        #1a1a1a;
  --color-text-muted:  #6b6b6b;
  --color-border:      #e0d9d0;
  --color-success:     #2d6a4f;
  --color-error:       #c1121f;
  --color-warning:     #e76f51;
  --border-radius:     4px;
  --border-width:      1px;
  --container-width:   1200px;
  --font-family:         system-ui, -apple-system, sans-serif;  /* legacy alias */
  --font-body:           system-ui, -apple-system, sans-serif;
  --font-heading:        system-ui, -apple-system, sans-serif;
  --font-price:          system-ui, -apple-system, sans-serif;
  --font-ui:             system-ui, -apple-system, sans-serif;
  --font-weight-body:    400;
  --font-weight-heading: 700;
  --font-weight-price:   700;
  --font-weight-ui:      500;
  --font-size-base:      16px;
  --font-size-heading:   1.6rem;

  /* Grid columns — set by PHP */
  --grid-cols-mobile:  2;
  --grid-cols-tablet:  3;
  --grid-cols-desktop: 4;
}

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

html {
  font-size: var(--font-size-base);
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  color: var(--color-text);
  background: var(--color-secondary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-heading);
  line-height: 1.2;
}

/* ── Layout ──────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 16px;
}

main { flex: 1; }

/* ── Header / Nav ────────────────────────────────────────── */
.site-header {
  background: var(--color-menu-bg, var(--color-primary));
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-menu-text-hover, #fff);
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  text-decoration: none;
}

.site-logo img { height: 36px; width: auto; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  list-style: none;
}

.site-nav a {
  color: var(--color-menu-text, rgba(255,255,255,.85));
  font-size: .9rem;
  letter-spacing: .03em;
  transition: color .2s;
}
.site-nav a:hover { color: var(--color-menu-text-hover, #fff); text-decoration: none; }

.cart-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.cart-count {
  position: absolute;
  top: -8px;
  right: -10px;
  background: var(--color-cart-count-bg, var(--color-accent));
  color: var(--color-cart-count-text, #fff);
  font-size: .65rem;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ── Mobile nav controls (hidden on desktop) ─────────────── */
.site-nav-mobile-controls {
  display: none;
  align-items: center;
  gap: 16px;
}

/* ── Hamburger button ─────────────────────────────────────── */
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 24px;
  height: 18px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
  flex-shrink: 0;
}

.hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: opacity .2s;
}

.hamburger:hover span { opacity: .75; }

/* ── Mobile full-screen overlay menu ─────────────────────── */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0,0,0,.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}

.mobile-menu.is-open {
  opacity: 1;
  pointer-events: auto;
}

.mobile-menu__inner {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--color-mobile-menu-bg, var(--color-primary));
  display: flex;
  flex-direction: column;
  transform: translateY(-100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}

.mobile-menu.is-open .mobile-menu__inner {
  transform: translateY(0);
}

.mobile-menu__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 60px;
  border-bottom: 1px solid rgba(255,255,255,.12);
  flex-shrink: 0;
}

.mobile-menu__title {
  color: var(--color-mobile-menu-heading, #fff);
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--font-heading);
}

.mobile-menu__close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-mobile-menu-heading, #fff);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-appearance: none;
  appearance: none;
  opacity: .85;
  transition: opacity .2s;
}

.mobile-menu__close:hover { opacity: 1; }

.mobile-menu__nav {
  display: flex;
  flex-direction: column;
  padding: 16px 0;
  overflow-y: auto;
  flex: 1;
}

.mobile-menu__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 24px;
  background: var(--color-mobile-item-bg, transparent);
  color: var(--color-mobile-item-text, rgba(255,255,255,.9));
  font-size: 1.15rem;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,.08);
  transition: background .15s, color .15s;
}

.mobile-menu__link:hover,
.mobile-menu__link:active {
  background: color-mix(in srgb, var(--color-mobile-item-bg, transparent) 100%, rgba(255,255,255,.08));
  filter: brightness(1.1);
  color: var(--color-mobile-menu-heading, #fff);
}

.mobile-menu__cart-count {
  background: var(--color-cart-count-bg, var(--color-accent));
  color: var(--color-cart-count-text, #fff);
  font-size: .7rem;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* ── Responsive: show mobile controls, hide desktop nav ───── */
@media (max-width: 640px) {
  .site-nav-desktop { display: none; }
  .site-nav-mobile-controls { display: flex; }
}

@media (min-width: 641px) {
  .mobile-menu { display: none !important; }
}

/* ── Product Grid ────────────────────────────────────────── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-cols-mobile), 1fr);
  gap: 16px;
  padding: 24px 0;
}

@media (min-width: 768px) {
  .product-grid {
    grid-template-columns: repeat(var(--grid-cols-tablet), 1fr);
    gap: 24px;
  }
}

@media (min-width: 1024px) {
  .product-grid {
    grid-template-columns: repeat(var(--grid-cols-desktop), 1fr);
  }
}

/* ── Product Card ────────────────────────────────────────── */
.product-card {
  background: #fff;
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--border-radius);
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
}

.product-card__image {
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--color-secondary);
}

.product-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s;
}

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

.product-card__body {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.product-card__name {
  font-size: .9rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-text);
}

.product-card__price {
  font-size: .95rem;
  color: var(--color-accent);
  font-weight: 700;
  margin-top: auto;
}

.product-card__vat {
  font-size: .72rem;
  color: var(--color-text-muted);
}

.product-card__out-of-stock {
  font-size: .75rem;
  color: var(--color-error);
  font-weight: 500;
}

/* ── Product Detail ──────────────────────────────────────── */
.product-detail {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  padding: 32px 0;
}

@media (min-width: 768px) {
  .product-detail {
    grid-template-columns: 1fr 1fr;
    gap: 48px;
  }
}

.product-gallery {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.product-gallery__main {
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--border-radius);
  background: var(--color-secondary);
  border: var(--border-width) solid var(--color-border);
}

.product-gallery__main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-gallery__thumbs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.product-gallery__thumb {
  width: 64px;
  height: 64px;
  border-radius: calc(var(--border-radius) / 2);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color .2s;
}

.product-gallery__thumb.active,
.product-gallery__thumb:hover {
  border-color: var(--color-accent);
}

.product-gallery__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-info__name {
  font-size: 1.6rem;
  font-family: var(--font-heading);
  margin-bottom: 8px;
}

.product-info__price {
  font-size: 1.3rem;
  color: var(--color-accent);
  font-weight: 700;
  margin-bottom: 16px;
}

.product-info__description {
  color: var(--color-text-muted);
  margin-bottom: 24px;
  line-height: 1.7;
}

/* ── Size Selector ───────────────────────────────────────── */
.size-selector {
  margin-bottom: 20px;
}

.size-selector__label {
  font-size: .85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 10px;
  display: block;
}

.size-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.size-btn {
  padding: 8px 16px;
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--border-radius);
  background: var(--color-size-bg, #fff);
  color: var(--color-size-text, var(--color-text));
  cursor: pointer;
  font-size: .85rem;
  transition: all .15s;
  font-family: var(--font-family);
}

.size-btn:hover:not(:disabled) {
  border-color: var(--color-size-selected-bg, var(--color-accent));
  color: var(--color-size-selected-bg, var(--color-accent));
}

.size-btn.selected {
  background: var(--color-size-selected-bg, var(--color-primary));
  border-color: var(--color-size-selected-bg, var(--color-primary));
  color: var(--color-size-selected-text, #fff);
}

.size-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
  text-decoration: line-through;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--border-radius);
  font-family: var(--font-family);
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  border: var(--border-width) solid transparent;
  transition: all .2s;
  text-decoration: none;
  line-height: 1;
}

.btn-primary {
  background: var(--color-accent);
  color: var(--color-btn-text, #fff);
  border-color: var(--color-accent);
}
.btn-primary:hover {
  filter: brightness(.9);
  text-decoration: none;
  color: var(--color-btn-text, #fff);
}

.btn-secondary {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-border);
}
.btn-secondary:hover {
  border-color: var(--color-primary);
  text-decoration: none;
}

.btn-danger {
  background: var(--color-error);
  color: #fff;
  border-color: var(--color-error);
}

.btn--full { width: 100%; }
.btn--sm { padding: 8px 16px; font-size: .85rem; }

/* ── Cart ────────────────────────────────────────────────── */
.cart-table-wrap {
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--border-radius);
  overflow: hidden;
}

.cart-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.cart-table th {
  background: var(--color-cart-header-bg, var(--color-secondary));
  padding: 12px 16px;
  text-align: left;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--color-cart-header-text, var(--color-text-muted));
  font-weight: 600;
}

.cart-table td {
  padding: 16px;
  border-top: var(--border-width) solid var(--color-border);
  vertical-align: middle;
}

.cart-item__thumb {
  display: block;
  width: 64px;
  height: 64px;
  min-width: 64px;   /* prevents table from squeezing it */
  object-fit: cover;
  object-position: center;
  border-radius: calc(var(--border-radius) / 2);
  flex-shrink: 0;
}

.cart-item__name { font-weight: 600; font-size: .9rem; }
.cart-item__size { font-size: .8rem; color: var(--color-text-muted); }

.qty-input {
  width: 60px;
  padding: 6px;
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--border-radius);
  text-align: center;
  font-family: var(--font-family);
  font-size: .9rem;
}

.cart-summary {
  background: #fff;
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--border-radius);
  padding: 24px;
  margin-top: 24px;
}

.cart-summary__row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: .95rem;
}

.cart-summary__row--total {
  border-top: 2px solid var(--color-border);
  margin-top: 8px;
  padding-top: 16px;
  font-weight: 700;
  font-size: 1.1rem;
}

/* ── Checkout Form ───────────────────────────────────────── */
.checkout-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  padding: 32px 0;
}

@media (min-width: 768px) {
  .checkout-layout {
    grid-template-columns: 1fr 380px;
  }
}

.form-card {
  background: #fff;
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--border-radius);
  padding: 24px;
}

.form-card h2 {
  font-size: 1.1rem;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: var(--border-width) solid var(--color-border);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 480px) {
  .form-row { grid-template-columns: 1fr; }
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--color-text);
}

.form-input,
.form-select {
  width: 100%;
  padding: 10px 14px;
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--border-radius);
  font-family: var(--font-family);
  font-size: .95rem;
  color: var(--color-text);
  background: #fff;
  transition: border-color .15s;
  appearance: none;
}

/* Select wrapper — adds consistent chevron across all browsers */
.select-wrapper {
  position: relative;
  display: block;
}

.select-wrapper select {
  width: 100%;
  padding-right: 36px; /* room for chevron */
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.select-wrapper::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--color-text-muted);
  pointer-events: none;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 15%, transparent);
}

.form-input.error { border-color: var(--color-error); }

/* Shop category filter */
.shop-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 16px 0 24px;
}

.shop-filter__tag {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--color-border);
  background: #fff;
  color: var(--color-text-muted);
  font-size: .85rem;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  font-family: var(--font-ui, var(--font-body, inherit));
  white-space: nowrap;
}

.shop-filter__tag--active {
  background: var(--color-filter-bg, var(--color-primary));
  border-color: var(--color-filter-bg, var(--color-primary));
  color: var(--color-filter-text, #fff);
}

.shop-filter__tag:hover:not(.shop-filter__tag--active) {
  border-color: var(--color-accent);
  color: var(--color-text);
}

.shop-filter__clear {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  background: none;
  color: var(--color-text-muted);
  font-size: .85rem;
  cursor: pointer;
  font-family: var(--font-ui, var(--font-body, inherit));
  text-decoration: underline;
  white-space: nowrap;
  transition: color .15s;
}

.shop-filter__clear:hover {
  color: var(--color-text);
}

/* B2B section toggle */
.b2b-toggle {
  width: 100%;
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  font-family: var(--font-ui, var(--font-body, inherit));
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  text-align: left;
  -webkit-appearance: none;
  appearance: none;
  box-shadow: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.b2b-toggle:hover,
.b2b-toggle:active {
  color: var(--color-accent);
  background: none;
  border: none;
}

/* Delivery options */
.delivery-options { display: flex; flex-direction: column; gap: 12px; }

.delivery-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: border-color .15s;
}

.delivery-option:hover,
.delivery-option:has(input:checked) {
  border-color: var(--color-accent);
}

.delivery-option input[type="radio"] { margin-top: 2px; accent-color: var(--color-accent); }

.delivery-option__name { font-weight: 600; font-size: .9rem; }
.delivery-option__zone-hint {
  font-size: .78rem;
  color: var(--color-text-muted);
  margin-top: 4px;
  font-style: italic;
}
.delivery-option__detail { font-size: .8rem; color: var(--color-text-muted); margin-top: 2px; }
.delivery-option__price { margin-left: auto; font-weight: 700; color: var(--color-accent); }

/* ── Order summary sidebar ───────────────────────────────── */
.order-sidebar { position: sticky; top: 80px; }
.order-sidebar-items { margin-bottom: 16px; }

.order-sidebar-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: var(--border-width) solid var(--color-border);
  font-size: .875rem;
}

.order-sidebar-item:last-child { border-bottom: none; }

.order-sidebar-item__thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: calc(var(--border-radius) / 2);
  flex-shrink: 0;
}

.order-sidebar-item__name { font-weight: 600; }
.order-sidebar-item__meta { color: var(--color-text-muted); font-size: .8rem; }
.order-sidebar-item__price { margin-left: auto; font-weight: 600; }

/* ── Checkout address row (postal + city) ───────────────── */
.checkout-address-row {
  grid-template-columns: 1fr !important; /* stack on mobile */
}
@media (min-width: 480px) {
  .checkout-address-row { grid-template-columns: 1fr 2fr !important; }
}

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--border-radius);
  font-size: .9rem;
  margin-bottom: 16px;
  border: var(--border-width) solid transparent;
}
.alert-success { background: color-mix(in srgb, var(--color-success) 10%, #fff); border-color: var(--color-success); color: var(--color-success); }
.alert-error   { background: color-mix(in srgb, var(--color-error) 10%, #fff); border-color: var(--color-error); color: var(--color-error); }

/* ── Cookie notice ───────────────────────────────────────── */
.cookie-notice {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--color-primary);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: .85rem;
  z-index: 200;
  transform: translateY(0);
  transition: transform .3s;
}

.cookie-notice.hidden { transform: translateY(100%); }
.cookie-notice__btn { flex-shrink: 0; }

/* ── Footer ──────────────────────────────────────────────── */
.site-footer {
  background: var(--color-primary);
  color: rgba(255,255,255,.7);
  padding: 24px 0;
  font-size: .85rem;
  margin-top: auto;
}

.site-footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.site-footer a { color: rgba(255,255,255,.85); }
.site-footer a:hover { color: #fff; }

/* ── Page headings ───────────────────────────────────────── */
.page-header {
  padding: 32px 0 8px;
}
.page-header h1 {
  font-family: var(--font-heading);
  font-size: 1.8rem;
}

/* ── Thank you page ──────────────────────────────────────── */
.thankyou-box {
  max-width: 560px;
  margin: 64px auto;
  background: #fff;
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--border-radius);
  padding: 48px;
  text-align: center;
}

.thankyou-box__icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.thankyou-box h1 {
  font-size: 1.5rem;
  margin-bottom: 12px;
}

/* ── Utilities ───────────────────────────────────────────── */
.text-muted  { color: var(--color-text-muted); }
.text-center { text-align: center; }
.mt-8  { margin-top:  8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-8  { margin-bottom:  8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.hidden { display: none !important; }
