/* Dark is the base theme; light applies via system setting or the toggle (data-theme on <html>). */
:root {
  --bg: #0b0a09;
  --bg-rgb: 11 10 9;
  --bg-raised: #15130f;
  --bg-panel: rgb(21 19 15 / 0.82);
  --text: #ece6dc;
  --text-muted: #9c9488;
  --gold: #c9a46a;
  --gold-soft: #e3c99a;
  --line: rgb(236 230 220 / 0.12);
  --stage-glow: #2a2219;
  --overlay: rgb(0 0 0 / 0.55);
  --banner-fade: linear-gradient(var(--bg), transparent 25%, transparent 70%, var(--bg));
  /* Brand colours (provisional, final brand colours still open) */
  --wordmark: #e3c99a;
  --logo-mono: #d9b778;
  --font-display: 'Cormorant Garamond', 'Times New Roman', serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --gutter: clamp(1rem, 4vw, 3rem);
  --header-h: 4rem;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f6f1e9;
    --bg-rgb: 246 241 233;
    --bg-raised: #fffdf9;
    --bg-panel: rgb(255 253 249 / 0.86);
    --text: #1d1a16;
    --text-muted: #6b6358;
    --gold: #8a6a2f;
    --gold-soft: #6f5322;
    --line: rgb(29 26 22 / 0.13);
    --stage-glow: #ffffff;
    --overlay: rgb(29 26 22 / 0.35);
    --banner-fade: linear-gradient(rgb(0 0 0 / 0.12), transparent 30%, transparent 62%, rgb(0 0 0 / 0.3));
    --wordmark: #1f4a52;
    --logo-mono: #8a6a2f;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f6f1e9;
  --bg-rgb: 246 241 233;
  --bg-raised: #fffdf9;
  --bg-panel: rgb(255 253 249 / 0.86);
  --text: #1d1a16;
  --text-muted: #6b6358;
  --gold: #8a6a2f;
  --gold-soft: #6f5322;
  --line: rgb(29 26 22 / 0.13);
  --stage-glow: #ffffff;
  --overlay: rgb(29 26 22 / 0.35);
  --banner-fade: linear-gradient(rgb(0 0 0 / 0.12), transparent 30%, transparent 62%, rgb(0 0 0 / 0.3));
  --wordmark: #1f4a52;
  --logo-mono: #8a6a2f;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }
/* Open cart or 3D lightbox: page behind stays put */
html.no-scroll, html.no-scroll body { overflow: hidden; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 300 1rem/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.1; margin: 0 0 0.5em; }
a { color: inherit; }
.container { max-width: 76rem; margin: 0 auto; }
.center { text-align: center; }

.eyebrow {
  margin: 0 0 0.75rem;
  font-size: 0.72rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
}

.button {
  display: inline-block;
  padding: 0.9rem 2rem;
  border: 1px solid var(--gold);
  background: transparent;
  color: var(--gold-soft);
  font: 400 0.78rem var(--font-body);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.3s, color 0.3s;
}
.button:hover:not(:disabled) { background: var(--gold); color: var(--bg); }
.button-solid { background: var(--gold); color: var(--bg); }
.button-solid:hover:not(:disabled) { background: var(--gold-soft); }
.button:disabled { opacity: 0.4; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 3px; }

/* Product stills: rendered with a transparent background, the studio glow comes from CSS (works in both themes) */
.product-shot { margin: 0; background: radial-gradient(ellipse at 50% 45%, var(--stage-glow) 0%, transparent 68%); }
.product-shot img { width: 100%; aspect-ratio: 4 / 5; object-fit: contain; }

main, .site-footer { position: relative; z-index: 1; }
main { overflow-x: clip; }

/* Header */
.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 10;
  height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) var(--gutter) 0;
  display: flex;
  align-items: center;
  gap: 2rem;
  background: linear-gradient(rgb(var(--bg-rgb) / 0.85), rgb(var(--bg-rgb) / 0));
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--gold-soft);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: 0.35em;
}
/* Brand lockup: crystal emblem (colour+shimmer or single colour) and the wordmark in its own colour */
.brand { color: var(--wordmark); }
.brand-mark { display: block; flex: none; color: var(--logo-mono); }
.brand-mark svg { display: block; height: 1.8rem; width: auto; }
.brand-mark:empty { width: 0.9rem; height: 1.8rem; }
.brand-mark-color { display: none; }
.brand-word { letter-spacing: 0.35em; margin-right: -0.35em; }
.logo-sheen { animation: logo-sheen 7s var(--ease) 1.2s infinite; }
@keyframes logo-sheen {
  0% { transform: translateX(0); }
  40%, 100% { transform: translateX(1.8px); }
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: 1px solid var(--line);
  color: var(--text-muted);
  padding: 0.45rem 0.6rem;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--text-muted); }
.theme-toggle svg { width: 1rem; height: 1rem; }
.theme-toggle .icon-moon { display: none; }
.theme-toggle[aria-pressed="true"] .icon-sun { display: none; }
.theme-toggle[aria-pressed="true"] .icon-moon { display: block; }
.theme-toggle [data-theme-label] { display: none; }
.site-nav { display: flex; gap: 1.5rem; margin-left: auto; font-size: 0.85rem; }
.site-nav a { text-decoration: none; color: var(--text-muted); transition: color 0.2s; }
.site-nav a:hover { color: var(--text); }
.cart-button {
  background: rgb(var(--bg-rgb) / 0.4);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 0.5rem 1rem;
  font: inherit;
  font-size: 0.85rem;
  white-space: nowrap;
  cursor: pointer;
}
.cart-count { color: var(--gold); margin-left: 0.3rem; }

/* Nav icons: only shown in the mobile tab bar */
.nav-icon { display: none; width: 1.4rem; height: 1.4rem; }

/* Hero: copy left, watch right */
.hero {
  max-width: 76rem;
  min-height: 100svh;
  margin: 0 auto;
  padding: calc(var(--header-h) + 2rem) var(--gutter) 3rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 2rem;
}
.hero-media { order: 2; }
.hero-copy { order: 1; }
.hero h1 { font-size: clamp(3rem, 9vw, 5.5rem); font-weight: 300; letter-spacing: 0.05em; margin: 0; }
.lead { font-family: var(--font-display); font-size: clamp(1.2rem, 2.5vw, 1.6rem); color: var(--text-muted); margin: 0.25rem 0 1.5rem; }
/* Story: image and text side by side, alternating */
.story-step {
  max-width: 76rem;
  margin: 0 auto;
  padding: 4rem var(--gutter);
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 3rem;
}
.story-step:nth-child(even) .story-media { order: 2; }
.story-text { max-width: 26rem; }
.story-step h2 { font-size: clamp(2.2rem, 5vw, 3.8rem); }
.story-step p:last-child { color: var(--text-muted); font-size: 1.05rem; }

/* Banner */
.banner { position: relative; height: 85svh; min-height: 26rem; overflow: hidden; background: var(--bg); }
.banner-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* Dark: image fades into the page. Light: crisp edge with an inner vignette (fading dark into ivory looks muddy). */
.banner::after { content: ''; position: absolute; inset: 0; background: var(--banner-fade); }
.banner-quote {
  position: relative;
  z-index: 1;
  height: 100%;
  margin: 0;
  display: grid;
  place-items: center;
  padding: 0 var(--gutter);
  text-align: center;
}
.banner-quote p { font-family: var(--font-display); font-size: clamp(2rem, 5.5vw, 4.2rem); font-weight: 300; font-style: italic; line-height: 1.15; max-width: 18ch; margin: 0;
  /* The image is always dark, so the quote stays light in both themes */
  color: #f6efe3; text-shadow: 0 2px 28px rgb(0 0 0 / 0.45); }

/* Details */
.details, .collection { background: var(--bg); padding: 8rem var(--gutter); }
.section-title { font-size: clamp(2.2rem, 6vw, 4rem); text-align: center; margin-bottom: 4rem; }

.stats {
  list-style: none;
  padding: 0;
  margin: 0 0 6rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 2rem 1rem;
  text-align: center;
}
.stat-value { display: block; font-family: var(--font-display); font-size: clamp(3rem, 7vw, 5rem); font-weight: 300; line-height: 1; color: var(--gold-soft); }
.stat-value small { font-size: 0.35em; margin-left: 0.15em; color: var(--text-muted); }
.stat-label { font-size: 0.75rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--text-muted); }

.details-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: start; }
.details-figure { margin: 0; }
.details-figure img { aspect-ratio: 1; }
.details-figure figcaption { margin-top: 0.75rem; font-size: 0.8rem; color: var(--text-muted); }
.details-grid { display: grid; gap: 1.5rem; }
.detail-card { padding: 2rem; border: 1px solid var(--line); background: var(--bg-raised); }
.detail-card h3 { font-size: 1.6rem; color: var(--gold-soft); }
.detail-card dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 0.6rem 1.2rem; font-size: 0.9rem; }
.detail-card dt { color: var(--text-muted); }
.detail-card dd { margin: 0; }

/* Configurator: still of the chosen variant left, options right */
.configure {
  max-width: 76rem;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  align-items: center;
  gap: 2rem;
  padding: 6rem var(--gutter);
}
.configure-panel {
  padding: clamp(1.5rem, 3vw, 2.5rem);
  background: var(--bg-raised);
  border: 1px solid var(--line);
}
.configure-panel h2 { font-size: clamp(2rem, 4vw, 3rem); margin-bottom: 1.5rem; }
/* 3D view over the still: same box, so the swap does not move anything */
.configure-media { position: relative; }
.configure-stage { position: absolute; inset: 0; cursor: grab; }
.configure-stage:active { cursor: grabbing; }
.configure-stage canvas { display: block; width: 100%; height: 100%; }
.configure-media.is-3d img { visibility: hidden; }
.configure-hint {
  position: absolute;
  left: 50%;
  bottom: 0.5rem;
  translate: -50% 0;
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  pointer-events: none;
}
/* Full screen (phones and desktop): the stage covers the window; the mouse wheel zooms instead of scrolling */
.configure-expand, .configure-close { display: none; }
.configure-media.is-3d .configure-expand:not([hidden]) {
  display: block;
  position: absolute;
  right: 0;
  bottom: 0.5rem;
  padding: 0.55rem 0.9rem;
  background: rgb(var(--bg-rgb) / 0.6);
  border: 1px solid var(--line);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.2s;
}
.configure-media.is-3d .configure-expand:hover { border-color: var(--text-muted); }
.configure-media.is-fullview .configure-stage {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: auto;
  background: radial-gradient(ellipse at 50% 45%, var(--stage-glow) 0%, var(--bg) 70%);
}
/* One finger turns the watch in every direction, two fingers zoom */
.configure-media.is-fullview .configure-stage canvas { touch-action: none !important; }
.configure-media.is-fullview .configure-hint {
  display: block;
  position: fixed;
  z-index: 31;
  bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
}
.configure-media.is-fullview .configure-close {
  display: block;
  position: fixed;
  z-index: 31;
  top: calc(0.75rem + env(safe-area-inset-top, 0px));
  right: var(--gutter);
  width: 2.75rem;
  height: 2.75rem;
  background: rgb(var(--bg-rgb) / 0.6);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}
.configure-media.is-fullview .configure-expand { display: none !important; }
@media (max-width: 860px) {
  /* Inline the watch is only shown: the page scrolls freely, turning happens in full screen */
  .configure-stage { pointer-events: none; }
  .configure-hint { display: none; }
}
.configure-model { display: grid; gap: 0.9rem; margin-bottom: 1.75rem; }
.configure-model span { font-size: 0.72rem; letter-spacing: 0.25em; text-transform: uppercase; color: var(--text-muted); }
.configure-model select {
  appearance: none;
  width: 100%;
  padding: 0.8rem 2.5rem 0.8rem 0.9rem;
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none' stroke='%239c9488' stroke-width='1.4'%3E%3Cpath d='M1 1.5 6 6.5l5-5'/%3E%3C/svg%3E") no-repeat right 0.9rem center / 0.75rem;
  border: 1px solid var(--line);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  transition: border-color 0.2s;
}
.configure-model select:hover { border-color: var(--text-muted); }
.configure-model select:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 3px; }
.configure-panel fieldset { border: 0; padding: 0; margin: 0 0 1.75rem; }
.configure-panel legend { font-size: 0.72rem; letter-spacing: 0.25em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.9rem; }
.configure-panel legend span { color: var(--text); letter-spacing: 0.1em; margin-left: 0.5rem; text-transform: none; }
.swatches { display: flex; flex-wrap: wrap; gap: 0.9rem; }
.swatch { position: relative; }
.swatch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.swatch span {
  display: block;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25), 0 0 0 3px var(--bg-raised), 0 0 0 4px transparent;
  transition: box-shadow 0.2s;
}
.swatch input:checked + span { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25), 0 0 0 3px var(--bg-raised), 0 0 0 4px var(--gold); }
.swatch input:focus-visible + span { outline: 2px solid var(--gold-soft); outline-offset: 6px; }
.price { font-family: var(--font-display); font-size: 2.2rem; margin: 0 0 1.25rem; }
.configure-panel .button { width: 100%; }
.fine-print { font-size: 0.75rem; color: var(--text-muted); margin: 0.75rem 0 0; }

/* Collection */
.collection-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1.5rem; }
.product-card { display: flex; flex-direction: column; border: 1px solid var(--line); background: var(--bg-raised); }
.product-card img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; transition: transform 0.8s var(--ease); }
.product-media { overflow: hidden; }
.product-card:hover img { transform: scale(1.04); }
.product-body { padding: 1.25rem 1.25rem 1.5rem; display: flex; flex-direction: column; gap: 0.25rem; flex: 1; }
.product-body h3 { font-size: 1.7rem; margin: 0; }
.product-variant { font-size: 0.85rem; color: var(--text-muted); margin: 0; }
.product-price { margin: 0.75rem 0 1rem; font-size: 1rem; color: var(--gold-soft); }
.product-body .button { margin-top: auto; padding: 0.75rem 1rem; }

/* Cart */
.cart-backdrop { position: fixed; inset: 0; z-index: 19; background: var(--overlay); }
.cart {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 20;
  width: min(26rem, 100%);
  padding: calc(1.5rem + env(safe-area-inset-top, 0px)) 1.5rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
  background: var(--bg-raised);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.cart-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); padding-bottom: 1rem; }
.cart-header h2 { margin: 0; font-size: 1.8rem; }
.cart-close { background: none; border: 0; color: var(--text); font-size: 1.8rem; line-height: 1; cursor: pointer; }
.cart-items { list-style: none; padding: 0; margin: 1rem 0; flex: 1; overflow-y: auto; }
.cart-item { display: grid; grid-template-columns: 4rem 1fr auto; gap: 1rem; align-items: center; padding: 0.75rem 0; border-bottom: 1px solid var(--line); }
.cart-item img { width: 4rem; aspect-ratio: 4 / 5; object-fit: cover; }
.cart-item h3 { font-size: 1.2rem; margin: 0; }
.cart-item p { margin: 0; font-size: 0.8rem; color: var(--text-muted); }
.cart-qty { display: flex; flex-direction: column; align-items: flex-end; gap: 0.4rem; }
.qty-controls { display: flex; align-items: center; gap: 0.5rem; border: 1px solid var(--line); }
.qty-controls button { background: none; border: 0; color: var(--text); width: 1.8rem; height: 1.8rem; cursor: pointer; font: inherit; }
.qty-controls span { min-width: 1ch; text-align: center; font-size: 0.85rem; }
.cart-remove { background: none; border: 0; color: var(--text-muted); font: inherit; font-size: 0.75rem; text-decoration: underline; cursor: pointer; }
.cart-items:empty { display: none; }
.cart-empty { color: var(--text-muted); flex: 1; margin-top: 1.5rem; }
.cart-footer { border-top: 1px solid var(--line); padding-top: 1rem; }
.cart-total { display: flex; justify-content: space-between; margin: 0 0 1rem; font-size: 1.1rem; }
.cart-footer .button { width: 100%; }

/* Footer */
.site-footer { background: var(--bg-raised); border-top: 1px solid var(--line); padding: 4rem var(--gutter) calc(2rem + env(safe-area-inset-bottom, 0px)); color: var(--text-muted); font-size: 0.85rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem; }
.footer-grid nav { display: flex; flex-direction: column; gap: 0.5rem; }
.footer-grid h3 { font-family: var(--font-body); font-size: 0.72rem; letter-spacing: 0.25em; text-transform: uppercase; color: var(--text); margin-bottom: 0.5rem; }
.footer-grid a:not(.brand) { text-decoration: none; }
.footer-grid a:not(.brand):hover { color: var(--text); }
.footer-note { margin: 1rem 0 0; max-width: 22rem; }
.footer-copy { margin-top: 3rem; font-size: 0.75rem; }
.footer-copy .footer-author { white-space: nowrap; color: var(--gold-soft); text-decoration: none; border-bottom: 1px solid var(--line); transition: border-color 0.2s; }
.footer-copy .footer-author:hover { border-color: var(--gold); }

/* Version history page */
.history { min-height: 100svh; padding-top: var(--header-h); }
.history-grid-view { max-width: 80rem; margin: 0 auto; padding: 4rem var(--gutter) 6rem; }
.history-grid-view h1 { font-size: clamp(2.6rem, 6vw, 4rem); margin-bottom: 0.25rem; }
.history-intro, .history-empty { color: var(--text-muted); font-size: 0.9rem; margin: 0 0 2.5rem; }
.model-filter { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: -1rem 0 2rem; }
.filter-chip {
  background: none;
  border: 1px solid var(--line);
  color: var(--text-muted);
  padding: 0.45rem 0.9rem;
  font: inherit;
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.filter-chip span { margin-left: 0.3rem; letter-spacing: 0; color: var(--gold); }
.filter-chip:hover { color: var(--text); border-color: var(--text-muted); }
.filter-chip[aria-pressed="true"] { color: var(--gold-soft); border-color: var(--gold); }
.version-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 1.25rem; }
.version-card { display: flex; flex-direction: column; height: 100%; border: 1px solid var(--line); background: var(--bg-raised); text-decoration: none; transition: border-color 0.25s, transform 0.4s var(--ease); }
.version-card:hover, .version-card:focus-visible { border-color: var(--gold); transform: translateY(-3px); }
.version-thumb { display: block; aspect-ratio: 4 / 5; background: radial-gradient(ellipse at 50% 45%, var(--stage-glow) 0%, var(--bg) 75%); overflow: hidden; }
.version-thumb img { width: 100%; height: 100%; object-fit: cover; }
.version-thumb img.is-placeholder { object-fit: none; opacity: 0.4; filter: invert(78%) sepia(28%) saturate(520%) hue-rotate(358deg); }
.version-body { display: grid; gap: 0.2rem; padding: 1rem 1.1rem 1.25rem; }
.version-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.version-id { font-family: var(--font-display); font-size: 1.6rem; color: var(--gold-soft); line-height: 1; }
.version-date { font-size: 0.72rem; color: var(--text-muted); }
.version-note { font-size: 0.85rem; margin-top: 0.4rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.history-detail { display: grid; grid-template-columns: 1fr minmax(18rem, 24rem); min-height: calc(100svh - var(--header-h)); }
.detail-stage { position: relative; min-height: 60svh; background: radial-gradient(ellipse at 50% 45%, var(--stage-glow) 0%, var(--bg) 70%); }
.detail-stage canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.detail-loading { position: absolute; left: 1.5rem; top: calc(var(--header-h) + 1.5rem); margin: 0; font-size: 0.8rem; color: var(--text-muted); }
.detail-panel { display: flex; flex-direction: column; padding: 2.5rem var(--gutter); border-left: 1px solid var(--line); background: var(--bg-raised); }
.detail-back { font-size: 0.85rem; color: var(--text-muted); text-decoration: none; margin-bottom: 2.5rem; }
.detail-back:hover { color: var(--text); }
.detail-panel h2 { font-size: 3.2rem; margin: 0; color: var(--gold-soft); }
.detail-date { color: var(--text-muted); font-size: 0.85rem; margin: 0.25rem 0 1.5rem; }
.detail-note { font-family: var(--font-display); font-size: 1.45rem; line-height: 1.35; margin: 0 0 2rem; }
.detail-facts { display: grid; grid-template-columns: auto 1fr; gap: 0.5rem 1rem; font-size: 0.8rem; margin: 0 0 2rem; }
.detail-facts dt { color: var(--text-muted); }
.detail-facts dd { margin: 0; overflow-wrap: anywhere; }
.detail-facts code { color: var(--gold-soft); font-size: 0.78rem; }
.detail-nav { display: flex; gap: 0.75rem; margin-top: auto; }
.detail-nav .button { flex: 1; padding-inline: 0.75rem; }
.detail-hint { font-size: 0.72rem; color: var(--text-muted); margin: 1rem 0 0; }

/* Lightbox (phones): stage covers the screen, title + close on top, arrows left and right */
.history-detail { position: relative; }
/* main is its own stacking context below the header; lift it while the lightbox is open */
.lightbox-open main { z-index: 40; }
.stage-expand, .lightbox-bar, .lightbox-arrow { display: none; }
.lightbox-bar, .lightbox-arrow { z-index: 31; position: fixed; }
.history-detail.is-lightbox .detail-stage { position: fixed; inset: 0; z-index: 30; min-height: 0; }
/* Full screen: one finger rotates in every direction, the page no longer needs the vertical pan */
.history-detail.is-lightbox .detail-stage canvas { touch-action: none !important; }
.history-detail.is-lightbox .detail-loading { position: fixed; z-index: 31; top: calc(4.5rem + env(safe-area-inset-top, 0px)); }
.history-detail.is-lightbox .stage-expand { display: none; }
.history-detail.is-lightbox .lightbox-bar {
  display: flex;
  align-items: center;
  inset: 0 0 auto;
  padding: calc(0.75rem + env(safe-area-inset-top, 0px)) var(--gutter) 0.75rem;
  background: linear-gradient(rgb(var(--bg-rgb) / 0.85), rgb(var(--bg-rgb) / 0));
}
.lightbox-title { margin: 0; font-family: var(--font-display); font-size: 1.4rem; color: var(--gold-soft); }
.lightbox-close { margin-left: auto; width: 2.75rem; height: 2.75rem; background: rgb(var(--bg-rgb) / 0.6); border: 1px solid var(--line); color: var(--text); font-size: 1.6rem; line-height: 1; cursor: pointer; }
.history-detail.is-lightbox .lightbox-arrow {
  display: grid;
  place-items: center;
  top: 50%;
  translate: 0 -50%;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  border: 1px solid var(--gold);
  background: rgb(var(--bg-rgb) / 0.6);
  color: var(--gold-soft);
  font-size: 1.2rem;
  cursor: pointer;
}
.lightbox-prev { left: max(0.75rem, env(safe-area-inset-left, 0px)); }
.lightbox-next { right: max(0.75rem, env(safe-area-inset-right, 0px)); }
.lightbox-arrow:disabled { opacity: 0.3; cursor: default; }

@media (max-width: 860px) {
  .history-detail { grid-template-columns: 1fr; }
  .detail-stage { min-height: 62svh; }
  .stage-expand {
    display: block;
    position: absolute;
    top: calc(62svh - 3.5rem);
    right: var(--gutter);
    z-index: 2;
    padding: 0.55rem 0.9rem;
    background: rgb(var(--bg-rgb) / 0.6);
    border: 1px solid var(--line);
    color: var(--text);
    font: inherit;
    font-size: 0.8rem;
    cursor: pointer;
  }
  .detail-panel { border-left: 0; border-top: 1px solid var(--line); }
  .detail-hint { display: none; }
}

@media (max-width: 860px) {
  /* Tab bar at the bottom: the nav leaves the header and sits fixed above the home indicator */
  :root { --tabbar-h: 4.25rem; }
  body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); }
  .site-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 15;
    display: grid;
    grid-auto-columns: 1fr;
    grid-auto-flow: column;
    gap: 0.15rem;
    margin: 0;
    padding: 0.4rem 0.4rem calc(0.4rem + env(safe-area-inset-bottom, 0px));
    background: var(--bg-raised);
    border-top: 1px solid var(--line);
    font-size: 0.64rem;
  }
  .site-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    min-width: 0;
    height: calc(var(--tabbar-h) - 0.8rem);
    border-radius: 0.9rem;
    color: var(--text);
    font-weight: 400;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s;
  }
  .site-nav a span { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .site-nav a[aria-current] { background: rgb(201 164 106 / 0.14); color: var(--gold-soft); }
  .nav-icon { display: block; }
  .theme-toggle { margin-left: auto; }
  .site-header { gap: 0.6rem; }
  /* Brand, theme and cart have to fit next to each other on a 320 px phone */
  .site-header { gap: 0.45rem; }
  .site-header .brand { font-size: 1.1rem; }
  .site-header .brand-word { letter-spacing: 0.22em; margin-right: -0.22em; }
  .cart-button { padding-inline: 0.7rem; }

  .hero { grid-template-columns: 1fr; min-height: 0; padding-top: calc(var(--header-h) + 1rem); gap: 0; text-align: center; }
  .hero-media { order: 0; }
  .hero-media img { max-height: 62svh; }
  .story-step { grid-template-columns: 1fr; gap: 0; padding-block: 2.5rem; }
  .story-step:nth-child(even) .story-media { order: 0; }
  .story-media img { max-height: 55svh; }
  .details-layout { grid-template-columns: 1fr; }
  .configure { grid-template-columns: 1fr; gap: 0; padding-block: 4rem; }
  .configure-media img { max-height: 55svh; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > div { grid-column: 1 / -1; }
}

/* Desktop: navigation as a fixed sidebar on the left */
@media (min-width: 861px) {
  :root { --sidebar-w: 13.5rem; --header-h: 0rem; }
  .site-header {
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    height: auto;
    flex-direction: column;
    align-items: stretch;
    gap: 3rem;
    padding: calc(2rem + env(safe-area-inset-top, 0px)) 1.75rem calc(2rem + env(safe-area-inset-bottom, 0px));
    background: rgb(var(--bg-rgb) / 0.72);
    backdrop-filter: blur(14px);
    border-right: 1px solid var(--line);
  }
  .site-nav { flex-direction: column; gap: 1.1rem; margin-left: 0; font-size: 0.9rem; }
  .site-nav a { position: relative; padding-left: 1rem; }
  .site-nav a::before { content: ''; position: absolute; left: 0; top: 50%; width: 0.4rem; height: 1px; background: var(--gold); transform: scaleX(0); transform-origin: left; transition: transform 0.3s var(--ease); }
  .site-nav a[aria-current]::before, .site-nav a:hover::before { transform: scaleX(1); }
  .site-nav a[aria-current] { color: var(--gold-soft); }
  .site-nav .nav-secondary { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
  .site-nav .nav-secondary::before { top: calc(50% + 0.5rem); }
  .cart-button { text-align: left; }
  .theme-toggle { margin-top: auto; align-self: flex-start; }
  .theme-toggle [data-theme-label] { display: inline; }
  .site-header .brand { flex-direction: column; align-self: center; gap: 0.8rem; font-size: 1.15rem; }
  .site-header .brand-mark-color { display: block; }
  .site-header .brand-mark-mono { display: none; }
  .site-header .brand-mark svg { height: 3.2rem; }
  main, .site-footer { margin-left: var(--sidebar-w); }
}

@media (prefers-reduced-motion: reduce) {
  .logo-sheen { display: none; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
