/* vto_modal.css — full-screen Virtual Try-On modal (public product page).
 * Scoped under #vtoModal so it does not leak into the rest of the product page.
 * Dark-gold visual identity to match the Alamastr site.
 */

#vtoModal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  background: rgba(8, 8, 10, 0.96);
}
#vtoModal.is-visible { display: block; }
body.vto-open { overflow: hidden; }

#vtoModal .vto-modal__close {
  position: absolute;
  top: 16px;
  right: 20px;
  z-index: 6;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(200, 168, 108, 0.5);
  border-radius: 50%;
  background: rgba(20, 20, 24, 0.7);
  color: #e9d8b0;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
#vtoModal .vto-modal__close:hover { background: rgba(40, 40, 46, 0.9); }

/* --- Webcam consent step (shown first, before getUserMedia) --------------- */
#vtoModal .vto-consent {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  padding: 24px;
}
#vtoModal .vto-consent__panel {
  max-width: 460px;
  width: 100%;
  text-align: center;
  background: #14141a;
  border: 1px solid rgba(200, 168, 108, 0.28);
  border-radius: 14px;
  padding: 32px 28px;
  color: #ece3cf;
}
#vtoModal .vto-consent__panel h2 {
  margin: 0 0 12px;
  font-size: 1.4rem;
  color: #d8b978;
}
#vtoModal .vto-consent__panel p {
  margin: 0 0 18px;
  font-size: 0.95rem;
  line-height: 1.5;
  opacity: 0.9;
}
#vtoModal .vto-consent__panel a { color: #d8b978; }
#vtoModal .vto-consent__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#vtoModal .vto-btn {
  display: inline-block;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  border: 1px solid transparent;
}
#vtoModal .vto-btn--primary {
  background: linear-gradient(180deg, #d8b978, #b7924e);
  color: #1a1408;
  font-weight: 600;
}
#vtoModal .vto-btn--primary:hover { filter: brightness(1.05); }
#vtoModal .vto-btn--ghost {
  background: transparent;
  border-color: rgba(200, 168, 108, 0.45);
  color: #ece3cf;
}
#vtoModal .vto-error {
  margin-top: 14px;
  color: #ff8f8f;
  font-size: 0.9rem;
  min-height: 1em;
}

/* --- Stage (video + canvas), hidden until consent ------------------------- */
#vtoModal .vto-stage {
  position: absolute;
  inset: 0;
  display: none;
  overflow: hidden;
  background: #000;
}
#vtoModal .vto-stage.is-active { display: block; }
#vtoModal .vto-stage video,
#vtoModal .vto-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Mirror so the try-on feels like a mirror (VTOScene renders un-mirrored). */
  transform: scaleX(-1);
}
#vtoModal .vto-stage video { z-index: 1; }
#vtoModal .vto-stage canvas { z-index: 2; }

/* --- Lens-style selector (bottom overlay) --------------------------------- */
#vtoModal .vto-lens-panel {
  position: absolute;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 4;
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(16, 16, 20, 0.72);
  border: 1px solid rgba(200, 168, 108, 0.3);
  border-radius: 999px;
}
#vtoModal .vto-lens-panel button {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: #ece3cf;
  font-size: 0.85rem;
  cursor: pointer;
}
#vtoModal .vto-lens-panel button.is-active {
  background: rgba(200, 168, 108, 0.22);
  border-color: rgba(200, 168, 108, 0.5);
  color: #f2e6c8;
}

#vtoModal .vto-status {
  position: absolute;
  top: 16px;
  left: 20px;
  z-index: 4;
  font-size: 0.8rem;
  color: rgba(236, 227, 207, 0.7);
}

/* --- Frame colour / material swatch panel (above the lens panel) ----------- */
#vtoModal .vto-mat-panel {
  position: absolute;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  z-index: 4;
  max-width: 92vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(16, 16, 20, 0.72);
  border: 1px solid rgba(200, 168, 108, 0.3);
  border-radius: 16px;
}
#vtoModal .vto-panel-label {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(236, 227, 207, 0.7);
}
#vtoModal .vto-swatches {
  display: flex;
  gap: 10px;
  max-width: 88vw;
  overflow-x: auto;
  padding-bottom: 2px;
}
#vtoModal .vto-swatch {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 64px;
  padding: 2px;
  overflow: hidden;              /* keep the label inside its own column */
  background: transparent;
  border: 0;
  color: rgba(236, 227, 207, 0.8);
  cursor: pointer;
}
#vtoModal .vto-swatch__chip {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  border: 2px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
#vtoModal .vto-swatch__label {
  font-size: 0.68rem;
  line-height: 1.12;
  text-align: center;
  width: 100%;
  white-space: normal;          /* wrap instead of overflowing onto neighbours */
  overflow-wrap: anywhere;
  word-break: break-word;
  max-height: 2.3em;            /* ~2 lines */
  overflow: hidden;
}
#vtoModal .vto-swatch.is-active .vto-swatch__chip {
  border-color: #d8b978;
  box-shadow: 0 0 0 2px rgba(200, 168, 108, 0.5);
}
#vtoModal .vto-swatch.is-active .vto-swatch__label { color: #f2e6c8; }

/* --- CTA button on the product page --------------------------------------- */
.btn-vto {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  padding: 12px 20px;
  width: 100%;
  border-radius: 8px;
  border: 1px solid rgba(200, 168, 108, 0.55);
  background: transparent;
  color: #b7924e;
  font-size: 0.95rem;
  cursor: pointer;
}
.btn-vto:hover { background: rgba(200, 168, 108, 0.1); }

/* --- Founder fit-adjustment panel (?fit=1) -------------------------------- */
#vtoModal .vto-fit-panel {
  position: absolute;
  top: 12px; left: 12px;
  z-index: 6;
  width: 232px;
  max-height: calc(100% - 24px);
  overflow-y: auto;
  padding: 10px 12px;
  background: rgba(12, 13, 17, 0.86);
  border: 1px solid rgba(200, 168, 108, 0.35);
  border-radius: 10px;
  color: #ece3cf;
  font-size: 12px;
}
#vtoModal .vto-fit-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 8px; font-weight: 600;
}
#vtoModal .vto-fit-head button {
  padding: 5px 9px; border-radius: 6px; border: 1px solid rgba(200,168,108,.5);
  background: rgba(200,168,108,.16); color: #f2e6c8; font-size: 11px; cursor: pointer;
}
#vtoModal .vto-fit-group {
  margin: 8px 0 4px; font-size: 11px; letter-spacing: .05em; text-transform: uppercase;
  color: #d8b978;
}
#vtoModal .vto-fit-row {
  display: grid; grid-template-columns: 42px 1fr 46px; align-items: center; gap: 6px;
  margin: 3px 0;
}
#vtoModal .vto-fit-row input[type="range"] { width: 100%; }
#vtoModal .vto-fit-val { text-align: right; opacity: .8; font-variant-numeric: tabular-nums; }
