:root {
  color-scheme: light dark;
  --bg: #f6f1e8;
  --panel: rgba(255, 252, 245, 0.88);
  --panel-strong: #fffaf0;
  --ink: #171411;
  --muted: #675f55;
  --line: rgba(32, 27, 21, 0.16);
  --gold: #b5813d;
  --gold-2: #f3d08a;
  --night: #10100e;
  --danger: #a5362f;
  --success: #277049;
  --shadow: 0 24px 80px rgba(31, 24, 15, 0.18);
  --radius: 28px;
  --touch: 46px;
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif;
}

:root[data-theme="dark"] {
  --bg: #10100e;
  --panel: rgba(29, 28, 25, 0.9);
  --panel-strong: #1f1d1a;
  --ink: #fff8ea;
  --muted: #c6b9a3;
  --line: rgba(255, 248, 234, 0.16);
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 15% 5%, rgba(243, 208, 138, 0.25), transparent 32rem),
    radial-gradient(circle at 90% 15%, rgba(82, 118, 116, 0.2), transparent 30rem),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.055;
  background-image: linear-gradient(90deg, var(--ink) 1px, transparent 1px), linear-gradient(var(--ink) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, #000, transparent 80%);
}

button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--gold-2);
  outline-offset: 4px;
}

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

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

.nav {
  width: min(1180px, calc(100% - 1rem));
  min-height: 72px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}

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

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: conic-gradient(from 130deg, var(--gold), var(--gold-2), #193836, var(--gold));
  box-shadow: inset 0 0 0 7px color-mix(in srgb, var(--bg) 72%, transparent);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: .45rem;
  overflow-x: auto;
  padding-block: .5rem;
}

.select-label {
  display: grid;
  gap: .1rem;
  color: var(--muted);
  font-size: .72rem;
  min-width: 5.5rem;
}

select, input {
  min-height: var(--touch);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-strong);
  color: var(--ink);
  padding: .65rem .8rem;
}

.icon-button, .cart-button, .primary, .secondary {
  min-height: var(--touch);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: var(--panel-strong);
  padding: .75rem 1rem;
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}
.icon-button:hover, .cart-button:hover, .primary:hover, .secondary:hover { transform: translateY(-1px); }
.primary {
  border: 0;
  background: linear-gradient(135deg, var(--ink), #3b2b18 58%, var(--gold));
  color: #fff8ea;
  font-weight: 800;
  box-shadow: 0 15px 36px rgba(116, 78, 35, 0.28);
}
.secondary { font-weight: 700; }
.cart-button { display: inline-flex; align-items: center; gap: .5rem; font-weight: 800; }
.cart-button strong {
  display: grid;
  place-items: center;
  min-width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--gold);
  color: #160f08;
}

main {
  width: min(1180px, calc(100% - 1rem));
  margin: auto;
}

.hero {
  display: grid;
  gap: 1rem;
  padding: clamp(2rem, 6vw, 6rem) 0 1rem;
}

.hero-copy, .hero-panel, .viewer-card, .purchase-card, .commerce-section, .bundle-card, .story, .drawer, .checkout-panel, .assistant-card {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.hero-copy, .hero-panel, .purchase-card, .commerce-section, .bundle-card, .story, .assistant-card {
  padding: clamp(1rem, 3vw, 2rem);
}

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

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 {
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif;
  letter-spacing: -.045em;
  line-height: 1.02;
}
h1 { font-size: clamp(2.4rem, 12vw, 6.8rem); max-width: 11ch; margin-bottom: 1rem; }
h2 { font-size: clamp(1.6rem, 5vw, 3.2rem); }
h3 { font-size: 1.2rem; }
.lede { color: var(--muted); font-size: clamp(1rem, 2vw, 1.25rem); max-width: 55ch; }
.muted { color: var(--muted); }

.trust-row {
  display: flex;
  gap: .55rem;
  flex-wrap: wrap;
}
.trust-row span, .stock, .product-meta p, .option-meta, .badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .45rem .7rem;
  background: color-mix(in srgb, var(--panel-strong) 84%, transparent);
  color: var(--muted);
  font-size: .86rem;
}

.hero-panel {
  align-self: end;
}
.product-meta {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.price-row {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  flex-wrap: wrap;
}
#current-price { font-size: clamp(2rem, 8vw, 4.3rem); letter-spacing: -.06em; }
.compare-price {
  color: var(--muted);
  font-size: 1.1rem;
  text-decoration: line-through;
}
.stock.good { color: var(--success); }
.stock.low { color: var(--gold); }
.stock.out { color: var(--danger); }

.experience-grid {
  display: grid;
  gap: 1rem;
  margin: 1rem 0;
}

.viewer-card {
  overflow: clip;
}
.canvas-wrap {
  position: relative;
  min-height: min(80vh, 520px);
  border-radius: calc(var(--radius) - 2px);
  overflow: hidden;
  background:
    radial-gradient(circle at var(--light-x, 60%) var(--light-y, 30%), rgba(243, 208, 138, .45), transparent 16rem),
    linear-gradient(135deg, #15130f, #293330 62%, #c29456);
}
canvas, .webgl-fallback {
  width: 100%;
  height: clamp(360px, 70vh, 640px);
  display: block;
  touch-action: none;
}
.webgl-fallback {
  display: grid;
  place-items: center;
  padding: 2rem;
  color: #fff8ea;
  text-align: center;
}
.fallback-jacket {
  width: min(55vw, 250px);
  aspect-ratio: 3/4;
  border-radius: 42% 42% 22% 22%;
  background: linear-gradient(135deg, var(--variant-a, #293330), var(--variant-b, #b5813d));
  box-shadow: inset 0 0 0 12px rgba(255,255,255,.12), 0 24px 60px rgba(0,0,0,.3);
}
.viewer-hint {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  color: #fff8ea;
  background: rgba(15, 13, 10, .56);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  padding: .7rem 1rem;
  text-align: center;
}
.viewer-card h2, .viewer-card p:not(.viewer-hint) { padding-inline: 1rem; }
.viewer-card h2 { margin-top: 1rem; }

.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .6rem;
  padding: 0 1rem 1rem;
}
.gallery button {
  min-height: 82px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, var(--g1), var(--g2));
}
.gallery button[aria-current="true"] { outline: 3px solid var(--gold-2); }

fieldset { border: 0; padding: 0; margin: 1.2rem 0; }
legend { font-weight: 900; margin-bottom: .65rem; }
.option-grid {
  display: grid;
  gap: .6rem;
}
.option-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .25rem .7rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: .75rem;
  background: var(--panel-strong);
}
.option-card input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}
.option-card:has(input:checked) {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--gold) 36%, transparent);
}
.option-card:has(input:disabled) { opacity: .48; }
.option-swatch {
  grid-row: span 2;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--swatch, var(--gold));
  border: 1px solid var(--line);
}
.option-name { font-weight: 900; }
.option-meta { justify-self: start; padding: .24rem .5rem; font-size: .76rem; }

.text-field, .search-field, .coupon-row label, .fit-grid label {
  display: grid;
  gap: .35rem;
  color: var(--muted);
  font-weight: 700;
}
.text-field { margin-top: .8rem; }
.fit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .7rem;
}
.fit-grid input { width: 100%; }
.size-card, .perks {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 1rem;
  background: color-mix(in srgb, var(--panel-strong) 70%, transparent);
}
.perk-meter {
  height: 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 18%, transparent);
  overflow: hidden;
}
.perk-meter span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-2));
  transition: width .5s ease;
}
.purchase-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: .7rem;
  margin-top: 1rem;
}

.section-heading {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}
.product-grid {
  display: grid;
  gap: .85rem;
}
.product-card {
  display: grid;
  gap: .75rem;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel-strong);
  padding: 1rem;
}
.product-art {
  min-height: 140px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 65% 30%, rgba(255,255,255,.34), transparent 3rem),
    linear-gradient(135deg, var(--a), var(--b));
}
.card-row, .line-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .7rem;
}
.bundle-card {
  display: grid;
  gap: 1rem;
  margin: 1rem 0;
}
.bundle-price { font-size: 1.35rem; font-weight: 900; }
.story { margin: 1rem 0 5rem; }
.story-grid { display: grid; gap: .85rem; }
.story article {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 1rem;
  background: var(--panel-strong);
}

.drawer-backdrop, .checkout, .assistant-panel {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.48);
  z-index: 30;
}
.drawer {
  position: fixed;
  z-index: 31;
  inset: auto .5rem .5rem .5rem;
  max-height: min(88vh, 760px);
  overflow: auto;
  padding: 1rem;
}
.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.cart-lines {
  display: grid;
  gap: .7rem;
}
.cart-line {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: .85rem;
  background: var(--panel-strong);
}
.qty-row {
  display: flex;
  gap: .45rem;
  align-items: center;
}
.qty-row button {
  width: 42px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  color: var(--ink);
}
.coupon-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .5rem;
  align-items: end;
  margin: 1rem 0;
}
.totals {
  display: grid;
  gap: .45rem;
}
.totals div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}
.totals .grand { font-size: 1.25rem; font-weight: 900; border-top: 1px solid var(--line); padding-top: .65rem; }

.checkout, .assistant-panel {
  display: grid;
  place-items: end center;
  padding: .5rem;
}
.checkout[hidden], .assistant-panel[hidden], .drawer[hidden], .drawer-backdrop[hidden] { display: none; }
.checkout-panel, .assistant-card {
  width: min(760px, 100%);
  max-height: 92vh;
  overflow: auto;
  padding: 1rem;
}
.stepper {
  display: flex;
  gap: .5rem;
  padding: 0;
  margin: 0 0 1rem;
  list-style: none;
  overflow-x: auto;
}
.stepper li {
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .5rem .75rem;
  color: var(--muted);
}
.stepper li[aria-current="step"] {
  background: var(--ink);
  color: var(--bg);
}
.checkout-form {
  display: grid;
  gap: .8rem;
}
.checkout-form label {
  display: grid;
  gap: .25rem;
  color: var(--muted);
  font-weight: 800;
}
.error {
  color: var(--danger);
  font-weight: 800;
}
.method {
  display: block;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: .85rem;
  background: var(--panel-strong);
}
.assistant-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: .7rem;
}
.assistant-steps {
  margin: 1rem 0 0;
  padding-left: 1.25rem;
}
.assistant-steps li {
  margin-bottom: .45rem;
  padding: .5rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--gold) 12%, transparent);
}

@media (min-width: 700px) {
  .hero { grid-template-columns: 1.35fr .65fr; align-items: end; }
  .experience-grid { grid-template-columns: minmax(0, 1.2fr) minmax(330px, .8fr); align-items: start; }
  .purchase-card { position: sticky; top: 88px; }
  .option-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .section-heading, .bundle-card { grid-template-columns: 1fr auto; align-items: end; }
  .story-grid { grid-template-columns: repeat(3, 1fr); }
  .purchase-actions, .assistant-actions { grid-template-columns: 1fr 1fr; }
  .drawer {
    inset: 1rem 1rem 1rem auto;
    width: min(440px, calc(100% - 2rem));
  }
  .checkout, .assistant-panel { place-items: center; }
}

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