/* Stagr viewer — dark gallery frame, image-led selectors.
 *
 * Tokens from the host site: #F7EE9C accent, #033B2C deep green,
 * Forum display, Lato body, Montserrat labels, 8px radius, 0.3s.
 * Everything else is deliberate: warm near-black frame so the photography
 * reads as the content, negative tracking on display type, positive on
 * small-caps labels.
 */

.sgr {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(12, 11, 9, .9);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: sgr-in .3s ease;
}
.sgr[hidden] { display: none; }
@keyframes sgr-in { from { opacity: 0 } to { opacity: 1 } }

.sgr-box {
  width: 100%;
  max-width: 1120px;
  max-height: 100%;
  overflow-y: auto;
  background: #14120F;
  color: #EDE7DD;
  border-radius: 10px;
  padding: 22px 28px 24px;
  font-family: "Lato", sans-serif;
  box-shadow: 0 40px 90px rgba(0, 0, 0, .55);
}

/* ---------- header ---------- */

.sgr-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}
.sgr-eyebrow {
  display: block;
  font-family: "Montserrat", sans-serif;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .26em;      /* positive tracking on the tiny label */
  text-transform: uppercase;
  color: #8E8577;
  margin-bottom: 7px;
}
.sgr-h {
  margin: 0;
  font-family: "Forum", serif;
  font-size: 34px;
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -.02em;     /* negative tracking on display type */
  color: #F7F3EC;
}
.sgr-close {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(237, 231, 221, .16);
  border-radius: 50%;
  background: transparent;
  color: #EDE7DD;
  cursor: pointer;
  transition: .3s;
}
.sgr-close:hover {
  background: #F7EE9C;
  border-color: #F7EE9C;
  color: #14120F;
}

/* ---------- stage ---------- */

.sgr-stage {
  position: relative;
  aspect-ratio: 3 / 2;
  /* The controls are the product: a full-bleed 3:2 stage pushed the style
     thumbnails below the fold on a laptop, so the viewer looked like a plain
     lightbox. Cap the stage against viewport height instead. */
  max-height: calc(100vh - 520px);
  min-height: 260px;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  background: #0D0C0A;
  touch-action: pan-y;
}
.sgr-im {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;        /* never crop: the burned-in label must stay */
  display: block;
  -webkit-user-select: none;
  user-select: none;
}
.sgr-after { will-change: clip-path; }

.sgr-tag {
  position: absolute;
  top: 14px;
  font-family: "Montserrat", sans-serif;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  padding: 6px 11px;
  border-radius: 100px;
  background: rgba(12, 11, 9, .6);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #EDE7DD;
  pointer-events: none;
}
.sgr-tag-l { left: 14px; }
.sgr-tag-r { right: 14px; color: #F7EE9C; }

/* the compare handle */
.sgr-line {
  position: absolute;
  top: 0; bottom: 0;
  left: 100%;
  width: 2px;
  margin-left: -1px;
  background: rgba(247, 238, 156, .9);
  pointer-events: none;
  transition: opacity .3s;
}
.sgr-grip {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 42px; height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #F7EE9C;
  color: #14120F;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .4);
}

/* the real control, invisible but on top of the image */
.sgr-range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
}
.sgr-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 44px; height: 100%;
  cursor: ew-resize;
}
.sgr-range::-moz-range-thumb {
  width: 44px; height: 300px;
  border: 0;
  cursor: ew-resize;
}
/* keyboard focus has to be visible even though the input is transparent */
.sgr-range:focus-visible + .sgr-spin,
.sgr-range:focus-visible {
  outline: 2px solid #F7EE9C;
  outline-offset: -2px;
}

.sgr-spin {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(13, 12, 10, .55);
}
.sgr-spin.on { display: grid; }
.sgr-spin::after {
  content: "";
  width: 32px; height: 32px;
  border: 2px solid rgba(247, 238, 156, .25);
  border-top-color: #F7EE9C;
  border-radius: 50%;
  animation: sgr-rot .8s linear infinite;
}
@keyframes sgr-rot { to { transform: rotate(360deg) } }

.sgr-note {
  position: absolute;
  left: 50%; bottom: 20px;
  transform: translateX(-50%);
  display: none;
  padding: 8px 18px;
  border-radius: 100px;
  background: #033B2C;
  color: #F7F3EC;
  font-family: "Montserrat", sans-serif;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.sgr-note.on { display: block; }

.sgr-disc {
  margin: 10px 0 16px;
  font-size: 12px;
  color: #8E8577;
  letter-spacing: .01em;
}

/* ---------- thumbnail strips ---------- */

.sgr-sec { margin-bottom: 14px; }
.sgr-lab {
  display: block;
  font-family: "Montserrat", sans-serif;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: #6F675B;
  margin-bottom: 8px;
}
.sgr-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.sgr-strip::-webkit-scrollbar { height: 3px; }
.sgr-strip::-webkit-scrollbar-thumb {
  background: rgba(237, 231, 221, .2);
  border-radius: 3px;
}

/* a thumbnail IS the choice: the buyer sees the look, not its name */
.sgr-th {
  position: relative;
  flex: 0 0 auto;
  width: 132px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #0D0C0A;
  cursor: pointer;
  transition: .3s;
  text-align: left;
}
.sgr-th img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;          /* thumbnails may crop; the stage never does */
  opacity: .5;
  transition: .3s;
}
.sgr-th:hover img { opacity: .8; }
.sgr-th.on img { opacity: 1; }

.sgr-th::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  transition: .3s;
  pointer-events: none;
}
.sgr-th.on::after { border-color: #F7EE9C; }

.sgr-th-t {
  display: block;
  padding: 8px 10px 9px;
  font-family: "Montserrat", sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .04em;
  color: #9A9183;
  background: #1A1713;
  transition: .3s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sgr-th.on .sgr-th-t { color: #14120F; background: #F7EE9C; }

.sgr-th-sm { width: 86px; }
.sgr-th-sm img { aspect-ratio: 4 / 3; }
.sgr-th-sm .sgr-th-t { padding: 6px 8px; font-size: 10px; }

/* ---------- footer ---------- */

.sgr-foot { display: flex; }
.sgr-cta {
  display: inline-block;
  text-decoration: none;
  background: #F7EE9C;
  color: #14120F;
  font-family: "Montserrat", sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .02em;
  border-radius: 8px;
  padding: 13px 32px;
  transition: .3s;
}
.sgr-cta:hover, .sgr-cta:focus {
  background: #F7F3EC;
  color: #14120F;
}

.sgr-box :focus-visible {
  outline: 2px solid #F7EE9C;
  outline-offset: 2px;
}

/* ---------- mobile ---------- */

@media (max-width: 767px) {
  .sgr { padding: 0; }
  .sgr-box {
    max-width: none;
    min-height: 100%;
    border-radius: 0;
    padding: 18px 16px 24px;
  }
  .sgr-h { font-size: 25px; }
  .sgr-stage { aspect-ratio: 4 / 3; }
  .sgr-th { width: 116px; }
  .sgr-th-sm { width: 92px; }
  .sgr-cta { width: 100%; text-align: center; }
  .sgr-disc { margin-bottom: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .sgr { animation: none; }
  .sgr-spin::after { animation-duration: 2.4s; }
  .sgr-th, .sgr-th img, .sgr-th::after, .sgr-th-t,
  .sgr-close, .sgr-cta, .sgr-line { transition: none; }
}


/* ---------- desktop two-column ----------
   Image left, every control in a right rail. Rules are written once here,
   with explicit classes, because layering overrides on the mobile grid
   produced crushed style tiles and a wrapped room grid. */

@media (min-width: 900px) {
  .sgr-box {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    grid-template-areas: "head head" "stage rail";
    column-gap: 26px;
    align-content: start;
  }
  .sgr-head  { grid-area: head; }
  .sgr-stage { grid-area: stage; max-height: calc(100vh - 215px); }

  .sgr-rail {
    grid-area: rail;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
    height: calc(100vh - 215px);
  }
  .sgr-rail .sgr-disc { margin: 0; order: -1; }
  .sgr-rail .sgr-sec  { margin: 0; min-height: 0; display: flex; flex-direction: column; }

  /* styles: the product. Two across, fixed tile height, scrolls if many. */
  .sgr-rail .sgr-sec:has(.sgr-looks) { flex: 0 1 auto; }
  .sgr-rail .sgr-looks {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    align-content: start;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    scrollbar-width: thin;
    min-height: 0;
  }
  .sgr-rail .sgr-looks .sgr-th     { width: auto; }
  .sgr-rail .sgr-looks .sgr-th img { aspect-ratio: 4 / 3; }

  /* rooms: navigation. One compact horizontal row, never wraps. */
  .sgr-rail .sgr-sec:has(.sgr-rooms) { flex: 0 0 auto; }
  .sgr-rail .sgr-rooms {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 4px;
  }
  .sgr-rail .sgr-rooms .sgr-th {
    flex: 0 0 auto;
    width: 72px;
  }
  .sgr-rail .sgr-rooms .sgr-th img { aspect-ratio: 1 / 1; }
  .sgr-rail .sgr-rooms .sgr-th-t {
    padding: 5px 6px;
    font-size: 9px;
    letter-spacing: .02em;
  }

  .sgr-rail .sgr-looks::-webkit-scrollbar,
  .sgr-rail .sgr-rooms::-webkit-scrollbar { width: 3px; height: 3px; }
  .sgr-rail .sgr-looks::-webkit-scrollbar-thumb,
  .sgr-rail .sgr-rooms::-webkit-scrollbar-thumb {
    background: rgba(237, 231, 221, .2);
    border-radius: 3px;
  }

  .sgr-foot { flex: 0 0 auto; margin-top: auto; padding-top: 6px; }
  .sgr-cta  { width: 100%; text-align: center; }
}
