/* MENKHET — vanilla port of 21st.dev ClothingRailHero (product-rail-gallery). */

.cr-hero,
.cr-detail {
  --color-foreground: var(--fg);
  --color-background: var(--bg, #eef0f1);
  --color-muted-foreground: var(--muted);
  --color-card: var(--panel, #fff);
  --color-card-foreground: var(--fg);
  --color-border: var(--line);
  --color-ring: var(--focus, var(--fg));
}

.cr-hero {
  position: relative;
  isolation: isolate;
  width: 100%;
  overflow: hidden;
  background: transparent;
  color: var(--fg);
}

.cr-hero svg,
.cr-detail svg {
  max-width: none;
}

.cr-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.cr-wash {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(120% 70% at 18% 0%, color-mix(in oklab, var(--color-foreground) 7%, transparent), transparent 62%),
    linear-gradient(to bottom, transparent 55%, color-mix(in oklab, var(--color-foreground) 5%, transparent));
}

.cr-head {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 32px 24px 0;
  text-align: center;
}

.cr-eyebrow {
  margin: 0;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
}

html[lang="ar"] .cr-eyebrow {
  letter-spacing: 0;
  font-size: 13px;
}

.cr-heading {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 1.875rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.cr-stage {
  position: relative;
  margin-top: 20px;
  width: 100%;
  touch-action: pan-y;
  user-select: none;
  overflow-x: clip;
}

.cr-rail {
  pointer-events: none;
  position: absolute;
  inset-inline: 0;
  z-index: 0;
}

.cr-rail-shadow {
  position: absolute;
  inset-inline: 0;
  height: 12px;
  border-radius: 999px;
  background: color-mix(in oklab, var(--color-foreground) 10%, transparent);
  filter: blur(5px);
}

.cr-rail-bar {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: linear-gradient(
    to bottom,
    color-mix(in oklab, var(--color-muted-foreground) 35%, white) 0%,
    white 18%,
    color-mix(in oklab, var(--color-muted-foreground) 70%, white) 38%,
    var(--color-muted-foreground) 62%,
    color-mix(in oklab, var(--color-muted-foreground) 55%, black) 100%
  );
  box-shadow: 0 1px 0 color-mix(in oklab, var(--color-foreground) 18%, transparent);
}

.cr-rail-grain {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  opacity: 0.4;
  mix-blend-mode: overlay;
  background: repeating-linear-gradient(
    90deg,
    transparent 0 2px,
    color-mix(in oklab, white 40%, transparent) 2px 3px,
    transparent 3px 7px
  );
}

.cr-rail-mount {
  position: absolute;
  top: 50%;
  height: 28px;
  width: 16px;
  translate: 0 -50%;
  border-radius: 3px;
  background: linear-gradient(
    to right,
    color-mix(in oklab, var(--color-muted-foreground) 60%, white),
    var(--color-muted-foreground) 55%,
    color-mix(in oklab, var(--color-muted-foreground) 60%, black)
  );
  box-shadow: 0 3px 6px color-mix(in oklab, var(--color-foreground) 18%, transparent);
}

.cr-rail-mount.is-start { left: 6px; }
.cr-rail-mount.is-end { right: 6px; }

.cr-rail-mount i {
  position: absolute;
  left: 50%;
  width: 4px;
  height: 4px;
  translate: -50% 0;
  border-radius: 50%;
  background: color-mix(in oklab, var(--color-foreground) 35%, transparent);
  display: block;
}

.cr-rail-mount i:first-child { top: 4px; }
.cr-rail-mount i:last-child { bottom: 4px; }

.cr-garment {
  position: absolute;
  left: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  border-radius: 12px;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.cr-garment:focus { outline: none; }
.cr-garment:focus-visible {
  outline: 2px solid var(--color-ring);
  outline-offset: 4px;
}

.cr-swing,
.cr-shadow-wrap,
.cr-side,
.cr-turn,
.cr-face,
.cr-drape {
  position: absolute;
  inset: 0;
}

.cr-turn {
  border-radius: 8px;
  transform-style: preserve-3d;
}

.cr-face {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.cr-drape {
  transform-origin: top center;
  transform: skewX(var(--drape, 0deg));
}

.cr-face[data-face="back"] .cr-drape {
  transform: skewX(calc(var(--drape, 0deg) * -1));
}

.cr-hanger,
.cr-fabric,
.cr-side-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.cr-hanger.is-matte { color: color-mix(in oklab, var(--color-foreground) 85%, transparent); }

.cr-photo {
  pointer-events: none;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: auto;
  max-width: none;
  object-fit: contain;
  object-position: top;
  user-select: none;
}

.cr-photo.is-full { top: 0; height: 100%; }
.cr-photo:not(.is-full) { top: 8%; height: 92%; }

.cr-shadow-wrap { pointer-events: none; }

.cr-shadow {
  position: absolute;
  display: block;
  background: #000;
  opacity: 0.16;
}

.cr-shade {
  pointer-events: none;
  position: absolute;
  background: #000;
  opacity: var(--shade, 0.2);
}

.cr-tag {
  pointer-events: none;
  position: absolute;
  left: 50%;
  transform-origin: top center;
}

.cr-tag-string {
  display: block;
  height: 14px;
  width: 1px;
  margin-inline-start: 3px;
  background: color-mix(in oklab, var(--color-foreground) 35%, transparent);
}

.cr-tag-label {
  position: relative;
  display: block;
  width: max-content;
  margin-inline-start: 3px;
  translate: -50% 0;
  white-space: nowrap;
  border-radius: 3px;
  border: 1px solid color-mix(in oklab, var(--color-foreground) 10%, transparent);
  background: var(--color-card);
  color: var(--color-card-foreground);
  padding: 8px 6px 4px;
  font-size: 9px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.04em;
  box-shadow: 0 2px 6px color-mix(in oklab, var(--color-foreground) 18%, transparent);
}

.cr-tag-dot {
  position: absolute;
  left: 50%;
  top: 3px;
  width: 3px;
  height: 3px;
  translate: -50% 0;
  border-radius: 50%;
  background: color-mix(in oklab, var(--color-foreground) 30%, transparent);
}

.cr-dots {
  position: relative;
  z-index: 10;
  margin-top: 4px;
  display: none;
  justify-content: center;
  gap: 6px;
}

.cr-hero[data-mode="carousel"] .cr-dots { display: flex; }

.cr-dot {
  height: 6px;
  width: 6px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: color-mix(in oklab, var(--color-foreground) 25%, transparent);
  cursor: pointer;
  transition: width 0.3s, background-color 0.3s;
}

.cr-dot:hover { background: color-mix(in oklab, var(--color-foreground) 45%, transparent); }
.cr-dot.is-on { width: 24px; background: var(--color-foreground); }
.cr-dot:focus { outline: none; }
.cr-dot:focus-visible { outline: 2px solid var(--color-ring); outline-offset: 2px; }

.cr-foot {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 16px 24px 32px;
  text-align: center;
}

.cr-caption { min-height: 3.25rem; }

.cr-caption-name {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  animation: cr-fade 300ms ease;
}

.cr-caption-desc {
  margin: 4px auto 0;
  max-width: 42ch;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

.cr-action { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

@keyframes cr-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .cr-caption-name,
  .cr-dot,
  .cr-detail-scrim,
  .cr-detail-close,
  .cr-detail-copy,
  .cr-face-bar { animation: none; transition: none; }
}

/* ---------- detail modal ---------- */

.cr-detail {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 24px;
  color: var(--fg);
}

.cr-detail-scrim {
  position: absolute;
  inset: 0;
  background: color-mix(in oklab, var(--color-background) 90%, transparent);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  opacity: 0;
  transition: opacity 0.3s;
}

.cr-detail.is-shown .cr-detail-scrim { opacity: 1; }

.cr-detail-close {
  position: absolute;
  inset-inline-end: 20px;
  top: 20px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  padding: 6px 12px;
  background: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s, color 0.3s;
}

.cr-detail.is-shown .cr-detail-close { opacity: 1; }
.cr-detail-close:hover { color: var(--fg); }
.cr-detail-close:focus { outline: none; }
.cr-detail-close:focus-visible { outline: 2px solid var(--color-ring); outline-offset: 2px; }
.cr-detail-close svg { width: 14px; height: 14px; }

.cr-detail-grid {
  position: relative;
  display: grid;
  width: 100%;
  max-width: 64rem;
  align-items: center;
  gap: 40px;
  padding-top: 40px;
}

@media (min-width: 768px) {
  .cr-detail-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 22rem); }
}

.cr-detail-figure {
  position: relative;
  margin: 0 auto;
  aspect-ratio: 200 / 310;
  height: min(62vh, 560px);
  max-height: 100%;
  transform-origin: top center;
}

.cr-detail-line {
  position: absolute;
  left: 50%;
  width: 3px;
  height: 40vh;
  translate: -50% 0;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    color-mix(in oklab, var(--color-muted-foreground) 50%, white),
    var(--color-muted-foreground),
    color-mix(in oklab, var(--color-muted-foreground) 50%, black)
  );
}

.cr-detail-spin-wrap {
  position: absolute;
  inset: 0;
  cursor: grab;
  touch-action: pan-y;
  perspective: 1400px;
}

.cr-detail-spin-wrap:active { cursor: grabbing; }

.cr-detail-spin {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}

.cr-detail-copy {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: center;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s 0.15s, transform 0.5s 0.15s;
}

.cr-detail.is-shown .cr-detail-copy {
  opacity: 1;
  transform: none;
}

@media (min-width: 768px) {
  .cr-detail-copy { text-align: start; }
}

.cr-detail-idx {
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.cr-detail-copy h3 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 1.875rem);
  font-weight: 500;
  letter-spacing: -0.02em;
}

.cr-detail-copy .cr-blurb {
  margin: 0;
  font-size: 14px;
  line-height: 1.65;
  color: var(--muted);
}

.cr-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

@media (min-width: 768px) {
  .cr-chips { justify-content: flex-start; }
}

.cr-chips li {
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 4px 12px;
  font-size: 12px;
  color: var(--muted);
}

.cr-faces {
  margin-top: 8px;
  display: inline-flex;
  justify-content: center;
  gap: 24px;
}

@media (min-width: 768px) {
  .cr-faces { justify-content: flex-start; }
}

.cr-face-btn {
  position: relative;
  padding: 0 0 6px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}

.cr-face-btn:hover,
.cr-face-btn[aria-pressed="true"] { color: var(--fg); }

.cr-face-btn:focus { outline: none; }
.cr-face-btn:focus-visible { outline: 2px solid var(--color-ring); outline-offset: 2px; }

.cr-face-bar {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 1px;
  background: var(--fg);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s;
}

html[dir="rtl"] .cr-face-bar { transform-origin: right; }

.cr-face-btn[aria-pressed="true"] .cr-face-bar { transform: scaleX(1); }

.cr-detail-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
@media (min-width: 768px) {
  .cr-detail-actions { justify-content: flex-start; }
}

/* Room wrapping the hero: fill the viewport, keep the aluminum wall. */
.room:has(.cr-hero) {
  min-height: calc(100svh - var(--header-h));
  display: flex;
  flex-direction: column;
}

.room .cr-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
