/* ============================================================
   IN-STORE SIZE FINDER — Zara-style editorial kiosk
   Landscape-first. Monochrome. Lots of negative space.
   Paging = native scroll-snap carousel (smooth + free swipe).
   ============================================================ */

:root {
  --paper: #ffffff;
  --ink: #111111;
  --ink-soft: #6b6b6b;
  --ink-faint: #a8a8a8;
  --hairline: #e4e4e4;
  --garment-bg: #e7e9eb;      /* matches the studio grey in the photos */
  --sold: #c2c2c2;
  --low: #b8860b;             /* discreet amber for "last few" */
  --pad: clamp(16px, 2.2vw, 40px);
  --font-serif: "Bodoni Moda", "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { overflow: hidden; }
body.modal-open { overflow: hidden; }   /* lock background while overlay is open */

/* ---------- screen frame ---------- */
.screen {
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  padding: var(--pad) var(--pad) calc(var(--pad) * 0.6);
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: clamp(10px, 1.4vh, 18px);
  border-bottom: 1px solid var(--ink);
}
.brand { display: flex; align-items: baseline; gap: clamp(14px, 1.6vw, 28px); }
.rack-label {
  font-size: clamp(12px, 1.15vw, 17px);
  letter-spacing: 0.34em;
  color: var(--ink);
  font-weight: 600;
  text-transform: uppercase;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: clamp(12px, 1.6vw, 22px);
  font-size: clamp(9px, 0.8vw, 12px);
  letter-spacing: 0.28em;
  color: var(--ink-soft);
}

/* per-view toggle (2 / 4 / 8) */
.view-toggle { display: flex; align-items: center; gap: clamp(4px, 0.6vw, 8px); }
.view-label {
  font-size: clamp(8px, 0.72vw, 11px);
  letter-spacing: 0.26em;
  color: var(--ink-faint);
  margin-right: 2px;
}
.view-opt {
  font-family: var(--font-sans);
  font-size: clamp(11px, 0.92vw, 14px);
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 7px 5px;
  line-height: 1;
  border-bottom: 1.5px solid transparent;
  transition: color 0.2s, border-color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.view-opt:hover { color: var(--ink); }
.view-opt.is-active {
  color: var(--ink);
  border-bottom-color: var(--ink);
  font-weight: 600;
}

.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #18a558; display: inline-block;
  box-shadow: 0 0 0 0 rgba(24,165,88,0.5);
  animation: pulse 2.4s infinite;
}
.live-text { white-space: nowrap; }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(24,165,88,0.45); }
  70%  { box-shadow: 0 0 0 6px rgba(24,165,88,0); }
  100% { box-shadow: 0 0 0 0 rgba(24,165,88,0); }
}

/* ---------- rack carousel ---------- */
.rack {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.rack::-webkit-scrollbar { display: none; }

.rack-page {
  flex: 0 0 100%;
  min-width: 0;
  scroll-snap-align: start;
  display: grid;
  grid-template-columns: repeat(var(--cols, 4), 1fr);
  grid-template-rows: 1fr;
  gap: clamp(12px, 1.6vw, 30px);
  padding: clamp(12px, 1.8vh, 26px) 0;
}

.card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.card-img-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  background: var(--garment-bg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.card:hover .card-img-wrap img { transform: scale(1.025); }

.card-zoom {
  position: absolute;
  top: 12px; right: 12px;
  width: 30px; height: 30px;
  border: 1px solid rgba(17,17,17,0.18);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--ink);
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.3s;
}
.card:hover .card-zoom { opacity: 1; }

/* item meta */
.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: clamp(8px, 1vh, 14px) 2px clamp(6px, 0.8vh, 10px);
}
.card-name {
  font-size: clamp(10px, 0.92vw, 14px);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  line-height: 1.25;
}
.card-price {
  font-size: clamp(10px, 0.9vw, 13px);
  color: var(--ink);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* size strip */
.sizes {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  border-top: 1px solid var(--ink);
  border-left: 1px solid var(--hairline);
}
.size {
  border-right: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  text-align: center;
  padding: clamp(5px, 0.8vh, 9px) 2px clamp(4px, 0.7vh, 8px);
  position: relative;
}
.size-label {
  font-size: clamp(9px, 0.82vw, 13px);
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  text-transform: uppercase;
}
.size-qty {
  margin-top: 4px;
  font-size: clamp(17px, 1.75vw, 27px);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  line-height: 1;
}
.size.in .size-qty { color: var(--ink); }
.size.low .size-qty { color: var(--low); }
.size.out {
  background: repeating-linear-gradient(
    -45deg, #fafafa, #fafafa 4px, #f1f1f1 4px, #f1f1f1 8px
  );
}
.size.out .size-label { color: var(--ink-faint); }
.size.out .size-qty { color: var(--sold); font-weight: 500; }
.size.low::after {
  content: "";
  position: absolute;
  top: 5px; right: 5px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--low);
}

/* ---------- pager ---------- */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: clamp(8px, 1.2vh, 16px);
  border-top: 1px solid var(--ink);
}
.pager-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: clamp(10px, 0.85vw, 13px);
  letter-spacing: 0.26em;
  color: var(--ink);
  padding: 10px 6px;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.2s;
}
.pager-btn:disabled { opacity: 0.25; cursor: default; }
.pager-btn:not(:disabled):active { opacity: 0.5; }
.pager-btn .arrow { font-size: 1.3em; line-height: 1; }
.pager-center { text-align: center; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.pager-count {
  font-size: clamp(9px, 0.82vw, 12px);
  letter-spacing: 0.28em;
  color: var(--ink-soft);
}
.pager-dots { display: flex; gap: 7px; }
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  border: 1px solid var(--ink);
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: background 0.25s;
}
.dot.active { background: var(--ink); }

.hint {
  text-align: center;
  font-size: clamp(8px, 0.72vw, 11px);
  letter-spacing: 0.24em;
  color: var(--ink-faint);
  text-transform: uppercase;
  padding-top: clamp(6px, 1vh, 12px);
}

/* ============================================================
   OVERLAY (tap-to-enlarge detail)
   ============================================================ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.98);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade 0.28s ease;
}
.overlay[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.overlay-close {
  position: fixed;
  top: clamp(14px, 2vw, 34px);
  right: clamp(16px, 2.2vw, 38px);
  width: 46px; height: 46px;
  border: 1px solid var(--ink);
  background: var(--paper);
  border-radius: 50%;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  z-index: 60;                 /* always above scrolling overlay content */
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}
.overlay-inner {
  display: flex;
  gap: clamp(24px, 4vw, 72px);
  align-items: stretch;
  width: min(92vw, 1100px);
  height: min(86vh, 760px);
  padding: 0 24px;
}
.overlay-figure {
  flex: 1.1;
  background: var(--garment-bg);
  position: relative;
  cursor: pointer;
  overflow: hidden;
}
.ov-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.45s ease;   /* smooth front <-> back crossfade */
}
.ov-img.is-on { opacity: 1; }
.overlay-flip {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  letter-spacing: 0.24em;
  color: var(--ink-soft);
  background: rgba(255,255,255,0.7);
  padding: 6px 14px;
  border-radius: 999px;
  white-space: nowrap;
  z-index: 2;
}
.overlay-info {
  flex: 0.9;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.overlay-eyebrow {
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--ink-faint);
  text-transform: uppercase;
  margin-bottom: 14px;
}
.overlay-name {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(26px, 3vw, 44px);
  line-height: 1.05;
  letter-spacing: -0.01em;
}
.overlay-detail {
  margin-top: 10px;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  text-transform: uppercase;
}
.overlay-price {
  margin-top: 16px;
  font-size: 20px;
  letter-spacing: 0.02em;
}
.overlay-sizes {
  margin-top: clamp(20px, 3vh, 38px);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  border-top: 1px solid var(--ink);
  border-left: 1px solid var(--hairline);
}
.overlay-sizes .size { padding: 14px 4px 12px; }
.overlay-sizes .size-qty { font-size: 28px; margin-top: 7px; }
.overlay-foot {
  margin-top: 18px;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
  text-transform: uppercase;
}

/* ============================================================
   RESPONSIVE
   - Landscape (kiosk, tablet landscape, phone landscape):
     the scroll-snap carousel with 2/4/8 columns per page.
   - Portrait (tablet/phone upright): one long vertical scroll.
   ============================================================ */

/* ---- PORTRAIT: stacked, page scrolls vertically ---- */
@media (orientation: portrait) {
  body { overflow: auto; }
  .screen { height: auto; min-height: 100vh; padding-bottom: 26px; }
  .rack {
    display: block;
    flex: none;
    overflow: visible;
    scroll-snap-type: none;
  }
  .rack-page {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: auto;
    gap: clamp(14px, 3vw, 26px);
    padding: 0;
    margin-bottom: clamp(14px, 3vw, 26px);
  }
  .card-img-wrap { aspect-ratio: 3 / 4; flex: none; }
  .hint, .pager, .view-toggle { display: none; }
  .overlay-inner {
    flex-direction: column;
    height: auto;
    max-height: 92vh;
    overflow: auto;
    width: min(94vw, 560px);
    padding: 78px 18px 28px;
  }
  .overlay-figure { aspect-ratio: 3 / 4; flex: none; }
}
@media (orientation: portrait) and (max-width: 560px) {
  .rack-page { grid-template-columns: 1fr; }
  .card-img-wrap { aspect-ratio: 4 / 5; }
}

/* ---- SHORT LANDSCAPE (phones / small tablets sideways): tighten chrome ---- */
@media (orientation: landscape) and (max-height: 640px) {
  :root { --pad: clamp(9px, 1.6vw, 16px); }
  .topbar { padding-bottom: 8px; }
  .rack-page { gap: clamp(8px, 1.4vw, 16px); padding: clamp(8px, 1.4vh, 14px) 0; }
  .card-meta { padding: 6px 2px 4px; }
  .size { padding: 4px 2px; }
  .hint { display: none; }
  .pager { padding-top: 8px; }
  .pager-btn { padding: 6px 4px; }
  .pager-center { gap: 5px; }
  .view-label { display: none; }
  /* overlay: let it breathe on a short screen */
  .overlay-inner { height: min(94vh, 460px); gap: clamp(18px, 3vw, 40px); }
  .overlay-name { font-size: clamp(20px, 3.6vw, 32px); }
  .overlay-sizes { margin-top: 14px; }
  .overlay-sizes .size { padding: 9px 3px; }
  .overlay-sizes .size-qty { font-size: 22px; margin-top: 5px; }
  .overlay-foot { margin-top: 12px; }
}
@media (orientation: landscape) and (max-height: 430px) {
  .card-name { font-size: 10px; letter-spacing: 0.04em; }
  .card-price { font-size: 10px; }
  .card-zoom { display: none; }
}
