:root {
  --split: 47%;
  --bg-stage: #f7f3ec;
  --bg-detail: #ffffff;
  --ink: #141311;
  --ink-muted: #6e6961;
  --ink-subtle: #a39d94;
  --line: rgba(20, 19, 17, 0.09);
  --line-strong: rgba(20, 19, 17, 0.24);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --duration: 820ms;
  --font-display: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-detail);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* ── Top Navigation ─────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 72px;
  z-index: 40;
  display: grid;
  grid-template-columns: var(--split) 1fr;
  align-items: center;
  pointer-events: none;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  padding: 0 40px;
  pointer-events: auto;
}

.topbar-left {
  justify-content: space-between;
  gap: 24px;
}

.topbar-right {
  justify-content: space-between;
  padding-left: 56px;
}

.brand {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-decoration: none;
  color: var(--ink);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-link {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  text-decoration: none;
  padding-bottom: 4px;
  position: relative;
  transition: color 220ms var(--ease);
}

.nav-link:hover,
.nav-link.is-active {
  color: var(--ink);
}

.nav-link.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--ink);
}

.season-tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 22px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  transition: opacity 220ms var(--ease);
}

.icon-btn:hover {
  opacity: 0.62;
}

.bag-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1;
}

/* ── Main Split-Portal Stage ────────────────────────────────────────── */
.queue-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100svh;
  display: grid;
  grid-template-columns: var(--split) 1fr;
  overflow: hidden;
}

/* Left Pane: Model Queue Stage (strictly clipped at center seam) */
.stage-pane {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-stage);
  transition: background-color 760ms var(--ease);
  user-select: none;
}

.stage-pane::after {
  /* Whisper-thin vertical atelier seam */
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 1px;
  background: rgba(20, 19, 17, 0.05);
  z-index: 25;
  pointer-events: none;
}

.stage-ambient {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse 70% 60% at 46% 42%,
    rgba(255, 255, 255, 0.55) 0%,
    rgba(255, 255, 255, 0) 72%
  );
  pointer-events: none;
  z-index: 1;
}

.model-stack {
  position: absolute;
  inset: 0;
  z-index: 5;
  overflow: hidden;
}

.model-layer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-right: 4%;
  pointer-events: none;
  will-change: transform, opacity, filter;
  transform-origin: 48% 92%;
}

.model-layer img {
  display: block;
  height: min(87vh, 87svh);
  max-height: 920px;
  width: auto;
  max-width: 96%;
  object-fit: contain;
  object-position: bottom center;
  filter: drop-shadow(0 18px 28px rgba(20, 17, 12, 0.06));
}

/* Portal Triggers on the Stage Seam */
.portal-next {
  position: absolute;
  right: 26px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 10px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
  transition: opacity 240ms var(--ease), transform 240ms var(--ease);
}

.portal-next .arrow {
  display: inline-block;
  font-size: 13px;
  transition: transform 260ms var(--ease);
}

.portal-next:hover .arrow {
  transform: translateX(4px);
}

.portal-next:active {
  transform: translateY(-50%) scale(0.97);
}

.portal-next.is-busy {
  opacity: 0.38;
}

.portal-prev {
  position: absolute;
  left: 24px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 30;
  padding: 12px 8px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
  opacity: 0.65;
  transition: opacity 240ms var(--ease), color 240ms var(--ease), transform 240ms var(--ease);
}

.portal-prev:hover {
  opacity: 1;
  color: var(--ink);
  transform: translateY(-50%) translateX(-3px);
}

.stage-index-badge {
  position: absolute;
  left: 40px;
  bottom: 28px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
}

.runway-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(6px);
  transition: border-color 220ms var(--ease), color 220ms var(--ease), background-color 220ms var(--ease);
}

.runway-toggle:hover,
.runway-toggle[aria-pressed="true"] {
  border-color: var(--ink);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.85);
}

.runway-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-subtle);
  transition: background-color 220ms var(--ease);
}

.runway-toggle[aria-pressed="true"] .runway-dot {
  background: #8e5e32;
}

/* ── Right Pane: Editorial Product Detail Track (strictly clipped at seam) ─ */
.detail-pane {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-detail);
}

.detail-track {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.detail-card {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 88px 8% 84px 56px;
  will-change: transform, opacity;
}

.detail-inner {
  max-width: 480px;
  width: 100%;
}

.look-kicker {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 18px;
}

.look-kicker-sep {
  width: 24px;
  height: 1px;
  background: var(--line-strong);
}

.product-title {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: clamp(36px, 3.6vw, 54px);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.price-row {
  display: flex;
  align-items: baseline;
  gap: 18px;
  margin-bottom: 26px;
}

.product-price {
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.product-fit {
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

.spec-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  padding: 14px 0;
  margin-bottom: 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
}

.spec-origin {
  color: var(--ink-subtle);
}

.selector-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 36px;
  align-items: end;
  margin-bottom: 24px;
}

.selector-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 10px;
}

.selector-value {
  font-weight: 400;
  color: var(--ink);
  letter-spacing: 0.04em;
  text-transform: none;
}

.size-list {
  display: flex;
  gap: 8px;
}

.size-btn {
  min-width: 40px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-muted);
  transition: border-color 200ms var(--ease), color 200ms var(--ease), background-color 200ms var(--ease);
}

.size-btn:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.size-btn.is-selected {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.swatch-list {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
}

.swatch-btn {
  width: 24px;
  height: 24px;
  border-radius: 2px;
  border: 1px solid rgba(20, 19, 17, 0.15);
  position: relative;
  transition: transform 200ms var(--ease);
}

.swatch-btn:hover {
  transform: scale(1.08);
}

.swatch-btn.is-selected::after {
  content: "";
  position: absolute;
  inset: -4px;
  border: 1px solid var(--ink);
  border-radius: 3px;
}

.product-desc {
  margin: 0 0 30px;
  font-size: 14px;
  line-height: 1.72;
  color: var(--ink-muted);
}

.cta-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-primary {
  height: 46px;
  padding: 0 28px;
  background: var(--ink);
  color: #fff;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: background-color 220ms var(--ease), transform 220ms var(--ease);
}

.btn-primary:hover {
  background: #2b2926;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  height: 46px;
  padding: 0 22px;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transition: border-color 220ms var(--ease), background-color 220ms var(--ease);
}

.btn-secondary:hover {
  border-color: var(--ink);
  background: rgba(20, 19, 17, 0.03);
}

/* ── Bottom Queue Rail (Right Pane Footer) ──────────────────────────── */
.queue-rail {
  position: absolute;
  left: 56px;
  right: 40px;
  bottom: 26px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.rail-dots {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rail-dot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--ink-subtle);
  transition: color 220ms var(--ease);
}

.rail-dot .bar {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--line-strong);
  transition: width 320ms var(--ease), background-color 320ms var(--ease);
}

.rail-dot.is-active {
  color: var(--ink);
}

.rail-dot.is-active .bar {
  width: 44px;
  background: var(--ink);
}

.rail-hint {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  color: var(--ink-subtle);
}

/* ── Toast Feedback ─────────────────────────────────────────────────── */
.toast {
  position: fixed;
  right: 40px;
  top: 84px;
  z-index: 60;
  padding: 12px 18px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  letter-spacing: 0.04em;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 240ms var(--ease), transform 240ms var(--ease);
}

.toast.is-open {
  opacity: 1;
  transform: translateY(0);
}

/* ── Responsive Mobile Layout ───────────────────────────────────────── */
@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr auto;
    height: 58px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0));
  }
  .topbar-left {
    padding: 0 20px;
  }
  .topbar-right {
    padding: 0 20px;
  }
  .nav-links,
  .season-tag,
  .rail-hint {
    display: none;
  }

  .queue-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 52svh 48svh;
  }

  .stage-pane::after {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    height: 1px;
  }

  .model-layer {
    padding-right: 0;
  }

  .model-layer img {
    height: 44svh;
    max-height: 410px;
  }

  .portal-next {
    right: 14px;
    top: auto;
    bottom: 12px;
    transform: none;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(6px);
  }
  .portal-next:active {
    transform: scale(0.97);
  }
  .portal-prev {
    left: 14px;
    top: auto;
    bottom: 12px;
    transform: none;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(6px);
  }
  .stage-index-badge {
    left: 50%;
    top: auto;
    bottom: 12px;
    transform: translateX(-50%);
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(6px);
  }
  .runway-toggle {
    display: none;
  }

  .detail-card {
    justify-content: flex-start;
    padding: 18px 20px 76px;
    overflow-y: auto;
  }

  .look-kicker {
    margin-bottom: 8px;
  }
  .product-title {
    font-size: 27px;
    margin-bottom: 8px;
  }
  .price-row {
    margin-bottom: 12px;
  }
  .spec-bar {
    padding: 10px 0;
    margin-bottom: 14px;
  }
  .selector-row {
    gap: 14px 24px;
    margin-bottom: 14px;
  }
  .product-desc {
    font-size: 13px;
    line-height: 1.55;
    margin-bottom: 18px;
  }
  .btn-primary,
  .btn-secondary {
    height: 42px;
    padding: 0 18px;
  }
  .queue-rail {
    left: 0;
    right: 0;
    bottom: 0;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(8px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .stage-pane,
  .portal-next,
  .portal-next .arrow,
  .rail-dot .bar,
  .toast {
    transition: none !important;
  }
}
