/* AETHER — Premium Commerce 2030
   Single-file offline experience. No external dependencies.
   Design principles: restraint, material honesty, quiet delight.
*/

:root {
  /* Palette */
  --bg: #0A0A0B;
  --surface: #121214;
  --elev: #1A1A1D;
  --elev-2: #222225;
  --text: #F5F5F6;
  --text-2: #A1A1A6;
  --text-3: #6B6B70;
  --gold: #C5A26F;
  --gold-dim: #A07F52;
  --success: #3DDC97;
  --warn: #E07A5F;
  --focus: #8AB4FF;

  /* Spacing */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sp-8: 64px;

  /* Radius */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 24px;

  /* Type */
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Motion */
  --dur-fast: 120ms;
  --dur-med: 220ms;
  --dur-slow: 420ms;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-fast: 0ms;
    --dur-med: 0ms;
    --dur-slow: 0ms;
  }
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

h1, h2, h3, h4 {
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin: 0;
}

h1 { font-size: clamp(28px, 4vw, 42px); }
h2 { font-size: clamp(22px, 3vw, 28px); }
h3 { font-size: 17px; }

button {
  font: inherit;
  color: inherit;
  background: var(--elev);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 10px 16px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
  min-height: 44px;
  min-width: 44px;
}
button:hover { background: var(--elev-2); }
button:active { transform: translateY(0.5px); }
button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
button.primary {
  background: var(--gold);
  color: #111;
  border-color: transparent;
  font-weight: 600;
  letter-spacing: 0.01em;
}
button.primary:hover { background: #d4b17e; }
button.ghost {
  background: transparent;
  border-color: rgba(255,255,255,0.12);
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

input, select, textarea {
  font: inherit;
  background: var(--surface);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--r-md);
  padding: 10px 12px;
  min-height: 44px;
  width: 100%;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-color: var(--focus);
}
label {
  display: block;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 6px;
}

.error {
  color: var(--warn);
  font-size: 13px;
  margin-top: 4px;
}
.error[hidden] { display: none; }

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

/* Layout */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10,10,11,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px var(--sp-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  font-size: 15px;
}
.brand-mark {
  width: 22px; height: 22px;
  border: 1.5px solid var(--gold);
  border-radius: 999px;
  display: inline-block;
  position: relative;
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid var(--gold);
  border-radius: 999px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.locale-switch {
  display: flex;
  gap: 4px;
}
.locale-switch button {
  padding: 6px 10px;
  font-size: 12px;
  min-height: 32px;
  min-width: 32px;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--sp-5);
}

/* Hero */
.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: var(--sp-7);
  align-items: start;
  padding-top: var(--sp-7);
  padding-bottom: var(--sp-8);
}
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
}

.hero-copy h1 {
  margin-bottom: var(--sp-3);
}
.hero-copy .tag {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid rgba(197,162,111,0.3);
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: var(--sp-4);
}
.hero-copy .lead {
  color: var(--text-2);
  max-width: 42ch;
  margin-bottom: var(--sp-5);
}

.meta {
  display: flex;
  gap: var(--sp-5);
  color: var(--text-2);
  font-size: 13px;
}
.meta div { display: flex; align-items: center; gap: 6px; }

/* 3D Configurator */
.configurator {
  position: relative;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,0.45);
}
#webgl-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1.05 / 1;
  touch-action: none;
  background: #0C0C0E;
}
.config-fallback {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  padding: var(--sp-6);
  text-align: center;
}
.configurator.no-webgl .config-fallback { display: flex; }
.configurator.no-webgl #webgl-canvas { display: none; }

.config-toolbar {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
  z-index: 10;
}
.config-toolbar button {
  padding: 8px 12px;
  font-size: 12px;
  background: rgba(18,18,20,0.85);
  border-color: rgba(255,255,255,0.1);
  backdrop-filter: blur(6px);
}

.config-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-5);
  padding: var(--sp-5);
  border-top: 1px solid rgba(255,255,255,0.06);
}
@media (max-width: 720px) {
  .config-body { grid-template-columns: 1fr; }
}

.config-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.config-group label { margin-bottom: 2px; }
.config-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
  gap: 8px;
}
.config-option {
  background: var(--elev);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--r-md);
  padding: 10px 12px;
  text-align: left;
  font-size: 13px;
  transition: border-color var(--dur-fast), background var(--dur-fast);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.config-option[aria-pressed="true"] {
  border-color: var(--gold);
  background: rgba(197,162,111,0.08);
}
.config-option .name { font-weight: 500; }
.config-option .price { font-size: 11px; color: var(--gold); }
.config-option:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.config-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px var(--sp-5);
  border-top: 1px solid rgba(255,255,255,0.06);
  background: var(--elev);
  font-size: 14px;
}
.config-summary .price {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.config-summary .price .was {
  font-size: 14px;
  color: var(--text-3);
  text-decoration: line-through;
  margin-right: 8px;
}

/* Catalog */
.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: var(--sp-7) 0 var(--sp-4);
}
.section-title h2 { font-size: 20px; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: var(--sp-4);
}
.filters input[type="search"] {
  flex: 1 1 240px;
  max-width: 320px;
}
.filters select { width: auto; min-width: 140px; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--sp-5);
}
.product-card {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.product-card .visual {
  aspect-ratio: 1.1 / 1;
  background: linear-gradient(145deg, #141416, #0C0C0E);
  display: grid;
  place-items: center;
  position: relative;
}
.product-card .visual svg { width: 62%; height: 62%; opacity: 0.9; }
.product-card .meta {
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.product-card .name { font-weight: 600; }
.product-card .ref { font-size: 12px; color: var(--text-3); letter-spacing: 0.06em; }
.product-card .price-row {
  display: flex; align-items: baseline; gap: 8px; margin-top: auto;
}
.product-card .price { font-weight: 600; }
.product-card .rating {
  font-size: 12px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 4px;
}
.product-card .actions {
  display: flex;
  gap: 8px;
  padding: 0 var(--sp-4) var(--sp-4);
  padding-bottom: var(--sp-4);
}
.product-card .stock {
  font-size: 12px;
  color: var(--success);
}
.product-card .stock.low { color: #E8B36B; }
.product-card .stock.out { color: var(--warn); }

/* Bundle */
.bundle {
  background: var(--elev);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--r-xl);
  padding: var(--sp-5);
  margin: var(--sp-6) 0;
}
.bundle-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--sp-4);
}
.bundle-items {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.bundle-price {
  font-size: 20px;
  font-weight: 600;
}
.bundle .savings { color: var(--success); font-size: 13px; }

/* Cart Drawer */
#cart-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(420px, 100%);
  background: var(--elev);
  border-left: 1px solid rgba(255,255,255,0.08);
  z-index: 200;
  transform: translateX(100%);
  transition: transform var(--dur-med) var(--ease);
  display: flex;
  flex-direction: column;
}
#cart-drawer.open { transform: translateX(0); }
.cart-header {
  padding: var(--sp-5);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cart-body { flex: 1; overflow: auto; padding: var(--sp-4); }
.cart-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.cart-line .title { font-weight: 500; }
.cart-line .attrs { font-size: 12px; color: var(--text-2); }
.cart-line .controls { display: flex; align-items: center; gap: 6px; }
.cart-line input[type="number"] { width: 64px; text-align: center; padding: 4px; }
.cart-line .line-total { font-variant-numeric: tabular-nums; }

.cart-summary {
  padding: var(--sp-5);
  border-top: 1px solid rgba(255,255,255,0.06);
  background: var(--surface);
}
.cart-summary .row {
  display: flex; justify-content: space-between; margin: 6px 0;
}
.cart-summary .row.total { font-weight: 600; font-size: 17px; margin-top: 10px; }
.cart-summary .free { color: var(--success); }

.cart-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: var(--sp-4);
}

/* Checkout */
#checkout-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
}
#checkout-modal[aria-hidden="false"] { display: flex; }

.checkout-panel {
  width: min(860px, 100%);
  background: var(--elev);
  border-radius: var(--r-xl);
  border: 1px solid rgba(255,255,255,0.06);
  overflow: hidden;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}
.checkout-header {
  padding: var(--sp-5);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.stepper {
  display: flex;
  gap: 8px;
  padding: 0 var(--sp-5) var(--sp-4);
}
.step {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,0.1);
  border-radius: 999px;
  position: relative;
}
.step.active { background: var(--gold); }
.step.done { background: var(--gold-dim); }

.checkout-body {
  padding: var(--sp-5);
  overflow: auto;
}
.checkout-footer {
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  gap: 10px;
  justify-content: space-between;
  background: var(--surface);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
}

.order-review {
  background: var(--surface);
  border-radius: var(--r-md);
  padding: var(--sp-4);
}
.order-review .line { display: flex; justify-content: space-between; padding: 4px 0; }
.order-review .total { font-size: 18px; font-weight: 600; border-top: 1px solid rgba(255,255,255,0.08); margin-top: 8px; padding-top: 10px; }

/* Confirmation */
.confirmation {
  text-align: center;
  padding: var(--sp-7) var(--sp-5);
}
.confirmation .order-num {
  font-family: var(--font-mono);
  font-size: 21px;
  letter-spacing: 0.08em;
  color: var(--gold);
}

/* Assistant */
#assistant {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 150;
  width: min(380px, calc(100% - 40px));
  background: var(--elev);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--r-xl);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  overflow: hidden;
}
#assistant.collapsed .assistant-body,
#assistant.collapsed .assistant-input { display: none; }
.assistant-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--surface);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
}
.assistant-header .title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.04em;
}
.assistant-header .title .dot {
  width: 8px; height: 8px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(61,220,151,0.2);
}
.assistant-body {
  max-height: 260px;
  overflow: auto;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
  background: var(--elev);
}
.assistant-step {
  padding: 6px 0;
  border-left: 2px solid rgba(197,162,111,0.3);
  padding-left: 10px;
  margin-left: 4px;
  color: var(--text-2);
}
.assistant-step.done { color: var(--text); border-color: var(--gold); }
.assistant-step.error { color: var(--warn); border-color: var(--warn); }
.assistant-input {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: var(--surface);
}
.assistant-input input {
  flex: 1;
  min-height: 36px;
  padding: 6px 10px;
}
.assistant-input button { padding: 6px 14px; min-height: 36px; }

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 12px 10px;
}
.quick-actions button {
  font-size: 11px;
  padding: 4px 8px;
  min-height: 28px;
}

/* Gamification */
.loyalty {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--r-lg);
  padding: 12px var(--sp-4);
  margin: var(--sp-5) 0;
}
.loyalty .bar {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  overflow: hidden;
}
.loyalty .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), #E8D2A3);
  width: 0%;
  transition: width var(--dur-slow) var(--ease);
}
.loyalty .tier { font-size: 12px; color: var(--gold); font-weight: 600; }

/* Trust & Misc */
.trust {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--sp-4);
  margin: var(--sp-7) 0;
}
.trust-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 13px;
  color: var(--text-2);
}
.trust-item svg { flex-shrink: 0; margin-top: 2px; }

.reviews {
  margin: var(--sp-7) 0;
}
.review {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  margin-bottom: 12px;
}
.review-header { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.review-stars { color: var(--gold); }

.badge {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 0.08em;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(197,162,111,0.15);
  color: var(--gold);
  border: 1px solid rgba(197,162,111,0.25);
}

/* Size advisor */
.size-advisor {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  margin-top: var(--sp-4);
}
.size-advisor .result {
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--elev);
  border-radius: var(--r-md);
  font-size: 13px;
}

/* Coupon */
.coupon-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.coupon-row input { flex: 1; }

/* Print styles for order receipt */
@media print {
  .site-header, .assistant, #cart-drawer, button { display: none !important; }
  .checkout-panel { box-shadow: none; border: none; }
}

/* Focus visible for keyboard users */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Scrollbars (subtle) */
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }

/* Reduced motion calm */
@media (prefers-reduced-motion: reduce) {
  .config-toolbar, .product-card, button { transition: none; }
}