:root {
  --bg: #f6f1ea;
  --surface: #fffaf3;
  --surface-2: #eee3d6;
  --ink: #17130f;
  --muted: #685f54;
  --line: rgba(23, 19, 15, .14);
  --gold: #b8873d;
  --gold-2: #f4d28a;
  --accent: #153d36;
  --danger: #9d241c;
  --success: #247244;
  --shadow: 0 24px 70px rgba(44, 31, 16, .16);
  --radius: 28px;
  --fallback-shell: #1a423b;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  --bg: #0c0b0a;
  --surface: #171411;
  --surface-2: #24201b;
  --ink: #f8efe4;
  --muted: #c7b9a6;
  --line: rgba(248, 239, 228, .16);
  --gold: #d4a858;
  --gold-2: #ffe1a0;
  --accent: #7cd0bd;
  --danger: #ff887e;
  --success: #8de0a9;
  --shadow: 0 24px 70px rgba(0, 0, 0, .38);
}

* { box-sizing: border-box; }

html {
  color: var(--ink);
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 10% 0%, rgba(212, 168, 88, .22), transparent 32rem),
    linear-gradient(135deg, rgba(21, 61, 54, .08), transparent 42rem),
    var(--bg);
}

body, button, input, select {
  font: inherit;
}

button, select, input {
  color: inherit;
}

button, a, input, select {
  outline-offset: 4px;
}

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--gold-2);
}

a { color: inherit; }

img, canvas, svg { max-width: 100%; }

.skip-link {
  position: fixed;
  z-index: 20;
  top: .75rem;
  left: .75rem;
  transform: translateY(-160%);
  padding: .8rem 1rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
}

.skip-link:focus { transform: translateY(0); }

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

.site-header {
  position: sticky;
  z-index: 10;
  top: 0;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(22px);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
}

.nav, main, .site-footer {
  width: min(1180px, calc(100% - 1.5rem));
  margin-inline: auto;
}

.nav {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  text-decoration: none;
  letter-spacing: .04em;
}

.brand span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-2), var(--gold));
  color: #17130f;
  font-weight: 900;
}

.nav-actions, .product-actions, .assistant-actions, .checkout-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  align-items: center;
}

select, input {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: .75rem .9rem;
}

button, .primary-link {
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  padding: .8rem 1.05rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

button:hover, .primary-link:hover { transform: translateY(-1px); }

button:disabled {
  cursor: not-allowed;
  opacity: .55;
  transform: none;
}

.primary-button, .primary-link {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, var(--ink), color-mix(in srgb, var(--ink), var(--accent) 25%));
  color: var(--bg);
  box-shadow: 0 14px 30px rgba(0, 0, 0, .2);
  font-weight: 800;
}

.secondary-button {
  border: 1px solid color-mix(in srgb, var(--gold), var(--ink) 18%);
  background: color-mix(in srgb, var(--gold-2) 24%, var(--surface));
  font-weight: 750;
}

.ghost-button, .cart-button {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
}

.cart-button {
  display: inline-flex;
  gap: .5rem;
  align-items: center;
}

#cart-count {
  display: grid;
  min-width: 1.6rem;
  height: 1.6rem;
  place-items: center;
  border-radius: 999px;
  background: var(--gold);
  color: #17130f;
  font-size: .85rem;
  font-weight: 900;
}

.breadcrumbs {
  padding: 1.1rem 0 .4rem;
  font-size: .9rem;
  color: var(--muted);
}

.breadcrumbs ol {
  display: flex;
  gap: .5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.breadcrumbs li + li::before {
  content: "/";
  margin-right: .5rem;
}

section {
  margin: clamp(1.5rem, 5vw, 4.5rem) 0;
}

.hero {
  display: grid;
  gap: 1.25rem;
}

.viewer-card, .product-info, .bundle-card, .assistant-card, .checkout-section, .cart-drawer, .catalog-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: var(--shadow);
}

.viewer-card, .product-info, .assistant-card, .checkout-section {
  padding: clamp(1rem, 3vw, 1.6rem);
}

.viewer-toolbar, .section-heading, .bundle-section {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.pill, .save-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--accent);
  padding: .42rem .72rem;
  font-size: .82rem;
  font-weight: 800;
}

.canvas-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: 5 / 4;
  margin-top: 1rem;
  border-radius: calc(var(--radius) - 8px);
  background:
    radial-gradient(circle at 70% 24%, rgba(244, 210, 138, .28), transparent 12rem),
    linear-gradient(145deg, #0d1614, #2e251a 60%, #151311);
  color: #e8d9c2;
}

#product-canvas, .fallback-art {
  display: block;
  width: 100%;
  height: 100%;
}

.fallback-art { display: none; padding: 1rem; }

.canvas-help {
  color: var(--muted);
  font-size: .92rem;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .65rem;
  margin-top: .8rem;
}

.gallery button {
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--thumb);
}

.eyebrow {
  margin: 0 0 .5rem;
  color: var(--gold);
  font-size: .82rem;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
}

h1, h2, h3, p { text-wrap: pretty; }

h1 {
  margin: 0;
  font-size: clamp(2.45rem, 8vw, 5.6rem);
  letter-spacing: -.07em;
  line-height: .92;
}

h2 {
  margin: 0;
  font-size: clamp(1.65rem, 4vw, 3rem);
  letter-spacing: -.04em;
  line-height: 1;
}

h3 { margin-top: 0; }

.lede {
  color: var(--muted);
  font-size: clamp(1.05rem, 2.2vw, 1.35rem);
  line-height: 1.55;
}

.rating-row, .price-block {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  align-items: center;
}

.rating-row {
  color: var(--gold);
  margin: 1rem 0;
}

.current-price {
  font-size: clamp(2rem, 6vw, 3.3rem);
  font-weight: 900;
  letter-spacing: -.05em;
}

.was-price {
  color: var(--muted);
  font-size: 1.2rem;
  text-decoration: line-through;
}

.availability {
  font-weight: 800;
}

.availability.ok { color: var(--success); }
.availability.low { color: var(--gold); }
.availability.out { color: var(--danger); }

.configurator {
  display: grid;
  gap: 1rem;
  margin: 1.4rem 0;
}

fieldset {
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 1rem;
}

legend {
  padding-inline: .35rem;
  font-weight: 850;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .65rem;
}

.option {
  position: relative;
}

.option input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.option span {
  display: grid;
  gap: .25rem;
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: .85rem;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
}

.option small { color: var(--muted); }

.option input:checked + span {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 2px var(--gold);
}

.option input:disabled + span {
  opacity: .5;
  text-decoration: line-through;
}

.fit-inputs, .form-grid, .method-grid {
  display: grid;
  gap: .8rem;
}

.fit-inputs {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.microcopy, .form-error, #coupon-message {
  color: var(--muted);
  font-size: .92rem;
}

.bundle-section {
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1rem, 3vw, 1.5rem);
  background: linear-gradient(135deg, color-mix(in srgb, var(--surface) 86%, transparent), color-mix(in srgb, var(--gold-2) 18%, var(--surface)));
}

.bundle-card {
  min-width: min(100%, 360px);
  padding: 1rem;
}

.bundle-item, .cart-line, .summary-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .5rem;
  padding: .75rem 0;
  border-bottom: 1px solid var(--line);
}

.bundle-total {
  display: flex;
  gap: .6rem;
  justify-content: flex-end;
  align-items: baseline;
  margin: 1rem 0;
}

#bundle-regular {
  color: var(--muted);
  text-decoration: line-through;
}

.section-heading {
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.search-label {
  display: grid;
  gap: .35rem;
  min-width: min(100%, 320px);
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.catalog-card {
  display: grid;
  gap: .75rem;
  padding: 1rem;
}

.product-swatch {
  min-height: 140px;
  border-radius: 20px;
  background: var(--swatch);
}

.assistant-panel {
  display: grid;
  gap: 1rem;
}

.assistant-card {
  display: grid;
  gap: .75rem;
}

.agent-steps {
  display: grid;
  gap: .55rem;
  padding-left: 1.2rem;
}

.agent-steps li {
  padding: .5rem .7rem;
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
}

.checkout-section {
  display: grid;
  gap: 1rem;
}

#checkout-form {
  display: grid;
  gap: 1rem;
}

.stepper {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
}

.stepper button {
  min-height: 36px;
  padding: .45rem .65rem;
}

.stepper [aria-current="step"] {
  background: var(--ink);
  color: var(--bg);
}

.checkout-step {
  display: none;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 1rem;
}

.checkout-step.active { display: block; }

.form-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.form-grid label, .method-grid label, .coupon-label {
  display: grid;
  gap: .35rem;
}

.method-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.method-grid label {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem;
}

.order-summary {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 1rem;
  background: color-mix(in srgb, var(--surface-2) 42%, transparent);
}

.coupon-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .5rem;
}

.totals {
  display: grid;
  gap: .55rem;
}

.totals div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.totals .grand {
  padding-top: .7rem;
  border-top: 1px solid var(--line);
  font-size: 1.25rem;
  font-weight: 900;
}

.checkout-actions {
  justify-content: flex-end;
}

.confirmation {
  display: grid;
  gap: .65rem;
  border-radius: 20px;
  padding: 1rem;
  background: color-mix(in srgb, var(--success) 11%, var(--surface));
}

.cart-drawer {
  width: min(460px, calc(100% - 1rem));
  max-height: calc(100dvh - 2rem);
  margin: auto .5rem auto auto;
  border: 1px solid var(--line);
  color: var(--ink);
}

.cart-drawer::backdrop {
  background: rgba(0, 0, 0, .45);
  backdrop-filter: blur(8px);
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.quantity-row {
  display: inline-flex;
  gap: .4rem;
  align-items: center;
}

.quantity-row button {
  min-width: 36px;
  min-height: 36px;
  padding: .2rem;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  padding: 2rem 0 3rem;
  color: var(--muted);
}

@media (min-width: 860px) {
  .hero {
    grid-template-columns: minmax(0, 1.08fr) minmax(360px, .92fr);
    align-items: start;
  }

  .viewer-card {
    position: sticky;
    top: 92px;
  }

  .assistant-panel {
    grid-template-columns: .78fr 1.22fr;
    align-items: start;
  }

  #checkout-form {
    grid-template-columns: minmax(0, 1fr) 360px;
    align-items: start;
  }

  .checkout-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .nav {
    align-items: flex-start;
    flex-direction: column;
    padding: .8rem 0;
  }

  .nav-actions {
    width: 100%;
  }

  .nav-actions > * {
    flex: 1 1 auto;
  }

  .bundle-section {
    display: grid;
  }

  .coupon-row {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}

.no-webgl #product-canvas,
.reduced-motion #product-canvas {
  display: none;
}

.no-webgl .fallback-art,
.reduced-motion .fallback-art {
  display: block;
}
