/* AETHER — premium 2030 PDP. Mobile-first, dark/light, WCAG AA. */

:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-2: #efeee9;
  --text: #14151a;
  --muted: #6b6e78;
  --line: #e2e0d8;
  --accent: #b08948;
  --accent-ink: #14151a;
  --ok: #2f7d52;
  --low: #b56a2a;
  --out: #b23a2e;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20, 21, 26, .06), 0 12px 30px rgba(20, 21, 26, .10);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: ui-serif, Georgia, "Times New Roman", serif;
  --maxw: 1180px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

:root[data-theme="dark"] {
  --bg: #0c0d11;
  --surface: #14151a;
  --surface-2: #1b1d22;
  --text: #ece9e0;
  --muted: #9a9ca6;
  --line: #2a2c33;
  --accent: #c79a52;
  --accent-ink: #0c0d11;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 18px 50px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg, canvas { max-width: 100%; display: block; }
.sr {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -48px;
  background: var(--accent); color: var(--accent-ink);
  padding: 10px 14px; border-radius: 8px; z-index: 100;
  transition: top .2s var(--ease);
}
.skip-link:focus { top: 12px; }

a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, canvas:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.bar { max-width: var(--maxw); margin: 0 auto; display: flex; align-items: center; gap: 16px; padding: 12px 16px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; letter-spacing: .14em; font-size: 14px; }
.brand svg { color: var(--accent); }
.primary-nav { display: none; gap: 22px; margin-left: 8px; font-size: 14px; }
.primary-nav a { color: var(--muted); transition: color .2s var(--ease); }
.primary-nav a:hover { color: var(--text); }
.bar-tools { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn {
  appearance: none; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); padding: 8px 12px; border-radius: 999px; cursor: pointer;
  font-size: 13px; display: inline-flex; align-items: center; gap: 8px;
  transition: transform .15s var(--ease), background .2s var(--ease), border-color .2s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: translateY(1px) scale(.98); }
.cart-btn { position: relative; }
.cart-count {
  background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700;
  padding: 1px 6px; border-radius: 999px; min-width: 18px; text-align: center;
}
.search { position: relative; }
.search input {
  appearance: none; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); padding: 8px 12px; border-radius: 999px; width: 150px;
  font-size: 13px; transition: width .25s var(--ease), border-color .2s var(--ease);
}
.search input:focus { width: 210px; border-color: var(--accent); }
.search-results {
  position: absolute; right: 0; top: calc(100% + 8px); width: 320px; max-width: 80vw;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: 6px; z-index: 50;
}
.search-row {
  width: 100%; display: flex; justify-content: space-between; gap: 10px;
  background: transparent; border: 0; color: var(--text); padding: 9px 10px;
  border-radius: 8px; cursor: pointer; font: inherit; text-align: left;
}
.search-row:hover { background: var(--surface-2); }
.search-name { font-weight: 500; }

/* ---------- Breadcrumb ---------- */
.breadcrumb { max-width: var(--maxw); margin: 0 auto; padding: 14px 16px 0; }
.breadcrumb ol { list-style: none; display: flex; gap: 8px; padding: 0; margin: 0; font-size: 13px; color: var(--muted); }
.breadcrumb li::after { content: "/"; margin-left: 8px; color: var(--line); }
.breadcrumb li:last-child::after { content: ""; }
.breadcrumb a:hover { color: var(--text); }

/* ---------- PDP ---------- */
main { max-width: var(--maxw); margin: 0 auto; padding: 16px 16px 64px; }
.pdp { display: grid; gap: 28px; margin-top: 8px; }

.viewer-wrap {
  position: relative; background:
    radial-gradient(120% 90% at 50% 18%, color-mix(in srgb, var(--surface) 80%, transparent), var(--surface) 70%),
    var(--surface);
  border: 1px solid var(--line); border-radius: 22px; overflow: hidden;
  aspect-ratio: 4 / 5; box-shadow: var(--shadow);
}
#viewer { width: 100%; height: 100%; touch-action: none; display: block; outline: none; }
#viewer[data-dragging] { cursor: grabbing; }
#viewer { cursor: grab; }
.viewer-fallback {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px;
  background: var(--surface);
}
.viewer-fallback[hidden] { display: none; }
.fallback-img {
  width: 60%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--sw) 70%, #fff 20%), var(--sw));
  box-shadow: var(--shadow); margin-bottom: 16px;
}
.viewer-hint {
  position: absolute; left: 12px; bottom: 12px; font-size: 12px; color: var(--muted);
  background: color-mix(in srgb, var(--bg) 60%, transparent); padding: 5px 9px; border-radius: 999px;
  border: 1px solid var(--line);
}
.config-summary {
  position: absolute; left: 12px; top: 12px; font-size: 12px; color: var(--text);
  background: color-mix(in srgb, var(--bg) 70%, transparent); padding: 6px 10px; border-radius: 999px;
  border: 1px solid var(--line);
}

.gallery-thumbs { display: flex; gap: 8px; margin-top: 10px; }
.thumb {
  width: 54px; height: 54px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; padding: 6px; transition: transform .15s var(--ease), border-color .2s var(--ease);
}
.thumb:hover { transform: translateY(-2px); }
.thumb.is-active { border-color: var(--accent); }
.thumb-swatch {
  display: block; width: 100%; height: 100%; border-radius: 8px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--sw) 80%, #fff 18%), var(--sw));
}

/* Info column */
.pdp-info { display: flex; flex-direction: column; gap: 16px; }
.eyebrow { text-transform: uppercase; letter-spacing: .16em; font-size: 12px; color: var(--muted); margin: 0; }
h1 { font-family: var(--serif); font-size: clamp(28px, 6vw, 40px); line-height: 1.08; margin: 0; letter-spacing: -.01em; }
.tagline { color: var(--muted); margin: 0; font-size: 16px; }
.stars {
  --r: 0; position: relative; display: inline-block; color: var(--line); letter-spacing: 2px;
  font-size: 14px;
}
.stars::after {
  content: "★★★★★"; position: absolute; left: 0; top: 0; color: var(--accent);
  width: calc(var(--r) / 5 * 100%); overflow: hidden; white-space: nowrap;
}
.rating { display: flex; align-items: center; gap: 10px; font-size: 13px; }

.price-block { padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.price-now { font-size: 28px; font-weight: 600; letter-spacing: -.01em; }
.price-compare { margin-left: 10px; font-size: 16px; }
.discount-badge {
  margin-left: 10px; background: var(--accent); color: var(--accent-ink);
  padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700;
}
.variant-summary { margin: 8px 0 0; font-size: 13px; }
.stock-status { font-size: 13px; margin: 4px 0 0; }
.stock-status[data-state="ok"] { color: var(--ok); }
.stock-status[data-state="low"] { color: var(--low); }
.stock-status[data-state="out"] { color: var(--out); }

/* Options */
.options { display: flex; flex-direction: column; gap: 14px; }
.ogroup { border: 0; padding: 0; margin: 0; }
.ogroup legend { font-size: 13px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: 8px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt {
  appearance: none; cursor: pointer; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); padding: 9px 12px; border-radius: 10px; font: inherit; font-size: 13px;
  display: inline-flex; align-items: center; gap: 8px; transition: transform .12s var(--ease), border-color .2s var(--ease), background .2s var(--ease);
}
.opt:hover { background: var(--surface-2); }
.opt:active { transform: translateY(1px); }
.opt.is-selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.opt.is-disabled { opacity: .45; cursor: not-allowed; text-decoration: line-through; }
.opt[style*="--sw"] { padding: 6px; width: 38px; height: 38px; border-radius: 999px; }
.opt[style*="--sw"]::before {
  content: ""; width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, color-mix(in srgb, var(--sw) 78%, #fff 22%), var(--sw));
  display: block;
}
.opt-price { color: var(--muted); font-size: 12px; }
.engr-field { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.engr-field input {
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit;
}

/* Quantity + add to cart */
.qty-row { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.qty input { width: 56px; text-align: center; border: 0; background: transparent; color: var(--text); font: inherit; padding: 10px 0; -moz-appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-btn {
  appearance: none; border: 0; background: transparent; color: var(--text);
  width: 38px; height: 100%; font-size: 18px; cursor: pointer;
}
.qty-btn:hover { background: var(--surface-2); }

.btn {
  appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  padding: 13px 18px; border-radius: 12px; font: inherit; font-weight: 600; cursor: pointer;
  transition: transform .12s var(--ease), background .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease);
  font-size: 14px;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); flex: 1; min-width: 200px; }
.btn-primary:hover { filter: brightness(1.06); background: var(--accent); }
.btn-primary[disabled] { opacity: .5; cursor: not-allowed; }
.btn-secondary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn-ghost { background: transparent; }
.link-btn { appearance: none; border: 0; background: transparent; color: var(--muted); cursor: pointer; font: inherit; text-decoration: underline; padding: 0; }
.link-btn:hover { color: var(--text); }

.qty-breaks { display: flex; flex-wrap: wrap; gap: 8px; }
.qb {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  padding: 8px 12px; border-radius: 10px; cursor: pointer; display: flex; flex-direction: column;
  align-items: flex-start; gap: 2px; font: inherit; transition: border-color .2s var(--ease), background .2s var(--ease);
}
.qb:hover { background: var(--surface-2); }
.qb.is-active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.qb-min { font-weight: 700; font-size: 13px; }
.qb-price { font-size: 13px; }
.qb-save { font-size: 11px; color: var(--ok); }

/* Fit advisor */
.fit { border: 1px solid var(--line); border-radius: 16px; padding: 16px; background: var(--surface); }
.fit h2 { font-size: 18px; margin: 0 0 4px; }
.fit-form { display: grid; gap: 12px; margin-top: 10px; }
.fit-form label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 4px; }
.fit-form input[type="range"] { width: 100%; accent-color: var(--accent); }
.fit-form select {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit;
}
.fit-result { margin: 4px 0 0; color: var(--ok); font-weight: 500; }

.details { border-top: 1px solid var(--line); padding: 12px 0; }
.details summary { cursor: pointer; font-weight: 600; list-style: none; }
.details summary::-webkit-details-marker { display: none; }
.details summary::before { content: "+"; display: inline-block; width: 1.2em; color: var(--muted); }
.details[open] summary::before { content: "–"; }
.prose p { margin: 8px 0; color: var(--text); }
.specs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; margin: 10px 0 0; }
.specs dt { color: var(--muted); font-size: 13px; }
.specs dd { margin: 0; font-size: 14px; }

/* ---------- Bundle ---------- */
.bundle { margin-top: 56px; border: 1px solid var(--line); border-radius: 20px; padding: 22px; background: var(--surface); }
.bundle h2 { font-family: var(--serif); font-size: 24px; margin: 0 0 4px; }
.bundle-items { display: grid; gap: 12px; margin: 16px 0; }
.bundle-item { display: flex; gap: 14px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 14px; }
.bundle-img { width: 56px; height: 56px; border-radius: 12px; background: linear-gradient(135deg, color-mix(in srgb, var(--sw) 80%, #fff 18%), var(--sw)); flex: 0 0 auto; }
.bundle-meta h3 { margin: 0; font-size: 15px; }
.bundle-meta .price { margin: 4px 0 0; font-weight: 600; }
.bundle-foot { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 16px; }
.bundle-prices { display: flex; align-items: baseline; gap: 10px; }
.bundle-price-new { font-size: 22px; font-weight: 600; }
.bundle-save { color: var(--ok); font-weight: 600; font-size: 13px; }

/* ---------- Related ---------- */
.related { margin-top: 56px; }
.related h2 { font-family: var(--serif); font-size: 24px; }
.grid { display: grid; gap: 16px; grid-template-columns: 1fr; margin-top: 16px; }
.card { border: 1px solid var(--line); border-radius: 16px; padding: 16px; background: var(--surface); transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease); }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card.is-highlight { border-color: var(--accent); animation: pulse 1.2s var(--ease); }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 40%, transparent); } 50% { box-shadow: 0 0 0 8px transparent; } }
.card-img { aspect-ratio: 4/3; border-radius: 12px; background: linear-gradient(135deg, color-mix(in srgb, var(--sw) 80%, #fff 16%), var(--sw)); margin-bottom: 12px; }
.card-body h3 { margin: 0; font-size: 16px; }
.card .price { font-weight: 600; margin: 6px 0 10px; }
.card .rating { margin: 6px 0; }

/* ---------- Assistant ---------- */
.assistant { margin-top: 56px; border: 1px solid var(--line); border-radius: 20px; padding: 22px; background: var(--surface); }
.assistant h2 { font-family: var(--serif); font-size: 24px; margin: 0 0 4px; }
.assistant-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.assistant-input input {
  width: 100%; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font: inherit;
}
.assistant-log { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 6px; min-height: 40px; }
.assistant-intent { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.assistant-step {
  display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: baseline;
  padding: 7px 10px; border-radius: 10px; background: var(--surface-2); font-size: 13px;
  animation: stepin .25s var(--ease);
}
@keyframes stepin { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.assistant-step.is-running { border-left: 3px solid var(--accent); }
.assistant-step.is-done { border-left: 3px solid var(--ok); }
.assistant-step.is-error { border-left: 3px solid var(--out); }
.step-icon { font-weight: 700; }
.step-result { font-size: 11px; }

/* ---------- Cart drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); opacity: 0; pointer-events: none; transition: opacity .25s var(--ease); z-index: 60; }
.scrim.is-open { opacity: 1; pointer-events: auto; }
.cart-drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: min(420px, 92vw);
  background: var(--surface); border-left: 1px solid var(--line);
  transform: translateX(100%); transition: transform .3s var(--ease); z-index: 70;
  display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.cart-drawer.is-open { transform: translateX(0); }
.cart-head { display: flex; justify-content: space-between; align-items: center; padding: 16px; border-bottom: 1px solid var(--line); }
.cart-head h2 { margin: 0; font-size: 18px; }
.cart-lines { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 12px; }
.cart-empty { color: var(--muted); text-align: center; margin-top: 30px; }
.cart-line { display: flex; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; animation: stepin .25s var(--ease); }
.cart-line-main h3 { margin: 0; font-size: 14px; }
.cart-variant { margin: 2px 0 8px; font-size: 12px; color: var(--muted); }
.cart-tag { font-size: 11px; color: var(--ok); margin: 0 0 6px; }
.cart-qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.cart-qty span { padding: 0 10px; font-size: 13px; }
.cart-line-aside { text-align: right; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.cart-line-price { font-weight: 600; }
.cart-line-save { font-size: 11px; color: var(--ok); }
.free-ship { padding: 0 16px 8px; }
.free-ship-bar { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-bottom: 6px; }
.free-ship-bar span { display: block; height: 100%; background: var(--accent); transition: width .4s var(--ease); }
.cart-foot { border-top: 1px solid var(--line); padding: 16px; }
.cart-totals { display: grid; gap: 6px; font-size: 14px; }
.cart-totals > div { display: flex; justify-content: space-between; }
.cart-total-row { font-weight: 700; font-size: 16px; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 4px; }
.cart-note { font-size: 12px; margin-top: 10px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 24px 16px; text-align: center; }
.muted { color: var(--muted); }

/* ---------- Responsive ---------- */
@media (min-width: 760px) {
  .primary-nav { display: flex; }
  .pdp { grid-template-columns: 1.1fr 1fr; align-items: start; }
  .grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .bundle-items { grid-template-columns: 1fr 1fr; }
}

/* Reduced motion: disable animations and auto-rotate hint */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .viewer-hint { display: none; }
}
