/* ==========================================================================
   GALERÍA 3 — STAIRCASE CAROUSEL (PANTALLA COMPLETA · FOTOS + MINIVIDEOCLIPS)
   Adaptado de 21st.dev (staircase-carousel.tsx) a HTML + CSS + JS puro
   P7 Barber Master Studio · Mobile-First (320px -> 640px -> 1024px -> 1440px)
   ========================================================================== */

:root {
  --gal-bg-deep: #0b0b0c;
  --gal-bg-main: #111112;
  --gal-bg-elevated: #171719;
  --gal-ink-100: #f5f3ee;
  --gal-ink-muted: rgba(245, 243, 238, 0.68);
  --gal-ink-soft: rgba(245, 243, 238, 0.48);
  --p7-gold-300: #f1d592;
  --p7-gold-500: #c9a45c;
  --gal-hairline: rgba(255, 255, 255, 0.09);
  --gal-header-h: 72px;
}

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

html,
body {
  margin: 0;
  padding: 0;
  background-color: var(--gal-bg-main);
  color: var(--gal-ink-100);
  font-family: var(--font-sans, 'General Sans', sans-serif);
  -webkit-font-smoothing: antialiased;
}

/* --------------------------------------------------------------------------
   1. Header Fijo Superior (Marca P7 + Botón Volver Liquid Glass)
   -------------------------------------------------------------------------- */
.gal-header {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--gal-header-h);
  background-color: rgba(17, 17, 18, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--gal-hairline);
}

.gal-header-inner {
  height: 100%;
  max-width: 1360px;
  margin-inline: auto;
  padding-inline: clamp(14px, 3.5vw, 36px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.gal-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--gal-ink-100);
  min-width: 0;
}

.gal-brand img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex-shrink: 0;
}

.gal-brand-name {
  font-family: var(--font-display, 'Boska', serif);
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* Botón Liquid Glass compacto para "Volver al estudio" */
.liquid-glass-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 9999px;
  background-color: transparent;
  color: var(--gal-ink-100);
  font-family: var(--font-sans, 'General Sans', sans-serif);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  isolation: isolate;
  transition:
    transform 280ms cubic-bezier(0.16, 1, 0.3, 1),
    color 240ms ease;
}

@media (min-width: 640px) {
  .liquid-glass-btn {
    min-height: 46px;
    padding: 0 24px;
    font-size: 0.9375rem;
  }
}

.liquid-glass-btn:hover {
  transform: scale(1.04);
  color: var(--p7-gold-300);
}

.liquid-glass-btn:active {
  transform: scale(0.97);
}

.liquid-glass-btn:focus-visible {
  outline: 2px solid var(--p7-gold-500);
  outline-offset: 4px;
}

.liquid-glass-surface {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.07);
  box-shadow:
    0 0 8px rgba(0, 0, 0, 0.08),
    0 2px 6px rgba(0, 0, 0, 0.18),
    inset 3px 3px 0.5px -3.5px rgba(255, 255, 255, 0.14),
    inset -3px -3px 0.5px -3.5px rgba(255, 255, 255, 0.85),
    inset 1px 1px 1px -0.5px rgba(255, 255, 255, 0.6),
    inset -1px -1px 1px -0.5px rgba(255, 255, 255, 0.6),
    inset 0 0 6px 6px rgba(255, 255, 255, 0.12),
    inset 0 0 2px 2px rgba(255, 255, 255, 0.06),
    0 0 12px rgba(0, 0, 0, 0.2);
  transition: background-color 280ms ease;
}

.liquid-glass-btn:hover .liquid-glass-surface {
  background: rgba(255, 255, 255, 0.14);
}

.liquid-glass-blur {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 9999px;
  overflow: hidden;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: url("#container-glass") blur(6px);
}

.liquid-glass-label {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.liquid-glass-svg {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   2. Staircase Carousel (Fiel a 21st.dev staircase-carousel.tsx)
   - Fotos 3:4 + Minivideoclips en bucle con autoplay
   - Título a la derecha con animación pop-in/out (debajo centrado en móvil)
   -------------------------------------------------------------------------- */
.stc-root {
  --stc-w: clamp(188px, 52vw, 240px);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  place-items: center;
  width: 100%;
  height: calc(100svh - var(--gal-header-h));
  min-height: 540px;
  background-color: var(--gal-bg-main);
  color: var(--gal-ink-100);
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

@media (min-width: 641px) {
  .stc-root {
    --stc-w: clamp(220px, min(25vw, 41svh), 340px);
  }
}

.stc-root:focus-visible {
  box-shadow: inset 0 0 0 2px var(--p7-gold-300);
}

.stc-stage {
  position: relative;
  width: var(--stc-w);
}

.stc-strip {
  display: flex;
  width: max-content;
  will-change: transform;
}

.stc-slide {
  position: relative;
  flex-shrink: 0;
  display: block;
  width: var(--stc-w);
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  cursor: pointer;
  will-change: transform;
  background-color: var(--gal-bg-elevated);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  -webkit-tap-highlight-color: transparent;
}

.stc-slide[aria-current="true"] {
  border-color: rgba(245, 243, 238, 0.24);
}

.stc-slide:focus-visible {
  outline: 2px solid var(--p7-gold-300);
  outline-offset: 4px;
}

.stc-slide > img,
.stc-slide > video {
  width: 100%;
  height: 100%;
  max-width: none;
  display: block;
  object-fit: cover;
  object-position: center 20%;
  pointer-events: none;
}

/* Título junto a la derecha de la foto activa (con animación suave stc-in / stc-out) */
.stc-titles {
  position: absolute;
  left: 100%;
  top: 0;
  bottom: 0;
  margin-left: 18px;
  z-index: -1;
  pointer-events: none;
  font-family: var(--font-display, 'Boska', serif);
  font-size: clamp(1.25rem, 2.2vw, 1.75rem);
  letter-spacing: -0.01em;
  color: var(--gal-ink-100);
}

.stc-title {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  white-space: nowrap;
  font-weight: 400;
  transform-origin: 0 50%;
}

/* En móvil (<= 640px): el título baja debajo de la foto activa, donde queda espacio libre */
@media (max-width: 640px) {
  .stc-titles {
    left: 0;
    right: 0;
    top: 100%;
    bottom: auto;
    height: 32px;
    margin: 12px 0 0;
    z-index: 1;
    font-size: 1.125rem;
  }

  .stc-title {
    left: 0;
    right: 0;
    justify-content: center;
    transform-origin: 50% 50%;
  }

  .stc-root {
    touch-action: none;
  }

  .stc-controls {
    display: none;
  }
}

@keyframes stc-in {
  from {
    opacity: 0;
    transform: scale(0.5);
    filter: blur(2px);
  }
  to {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
}

@keyframes stc-out {
  from {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
  to {
    opacity: 0;
    transform: scale(0.5);
    filter: blur(2px);
  }
}

/* Controles inferiores flotantes */
.stc-controls {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 10px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

@media (max-width: 640px) {
  .stc-controls {
    display: none;
  }
}

.stc-btn {
  display: grid;
  place-items: center;
  margin: 0;
  padding: 8px;
  border: 0;
  border-radius: 9999px;
  background: none;
  color: var(--gal-ink-100);
  cursor: pointer;
  transition: opacity 200ms ease, transform 200ms ease, color 200ms ease;
}

.stc-btn:hover:not(:disabled) {
  color: var(--p7-gold-300);
}

.stc-btn:disabled {
  opacity: 0.28;
  cursor: default;
}

.stc-btn:not(:disabled):active {
  transform: scale(0.88);
}

.stc-btn:focus-visible,
.stc-dot:focus-visible {
  outline: 2px solid var(--p7-gold-300);
  outline-offset: 2px;
}

.stc-dots {
  min-width: 72px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.stc-count {
  font-family: var(--font-sans, 'General Sans', sans-serif);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  color: var(--gal-ink-100);
  padding-inline: 8px;
}

.stc-dot {
  position: relative;
  width: 8px;
  height: 8px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 9999px;
  background: var(--gal-ink-100);
  opacity: 0.28;
  cursor: pointer;
  transition: width 300ms ease, opacity 300ms ease, background-color 300ms ease;
}

.stc-dot::after {
  content: "";
  position: absolute;
  inset: -10px -4px;
}

.stc-dot[aria-current="true"] {
  width: 28px;
  opacity: 1;
  background: var(--p7-gold-300);
}

.stc-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   3. Lightbox Modal Flotante Sin Caja (Foto y Vídeo en bucle limpio sin controles)
   -------------------------------------------------------------------------- */
.gal-dialog {
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--gal-ink-100);
  box-shadow: none;
  overflow: hidden;
}

.gal-dialog::backdrop {
  background: rgba(8, 8, 9, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.gal-dialog-inner {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 16px 76px;
}

.gal-dialog-close {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 20;
  width: 44px;
  height: 44px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--gal-ink-100);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 200ms ease, color 200ms ease, transform 200ms ease;
}

.gal-dialog-close:hover {
  background: var(--gal-ink-100);
  color: var(--gal-bg-deep);
  transform: scale(1.06);
}

.gal-dialog-media {
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gal-dialog-media img,
.gal-dialog-media video {
  display: block;
  width: auto;
  height: auto;
  max-width: min(92vw, 900px);
  max-height: calc(100dvh - 150px);
  border-radius: 14px;
  object-fit: contain;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.65);
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.gal-dialog-foot {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  padding: 8px 20px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.gal-dialog-title {
  margin: 0;
  font-family: var(--font-display, 'Boska', serif);
  font-size: 1.15rem;
  font-weight: 400;
  color: var(--gal-ink-100);
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   4. Footer Simulado (Provisional · Datos oficiales verificados P7)
   -------------------------------------------------------------------------- */
.gal-footer {
  background-color: var(--gal-bg-deep);
  border-top: 1px solid var(--gal-hairline);
  padding-block: clamp(44px, 6vw, 72px) clamp(28px, 4vw, 40px);
  padding-inline: clamp(16px, 4vw, 40px);
  color: var(--gal-ink-muted);
}

.gal-footer-shell {
  max-width: 1200px;
  margin-inline: auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}

@media (min-width: 768px) {
  .gal-footer-shell {
    grid-template-columns: 1.3fr 1fr 1fr;
    gap: 40px;
    align-items: start;
  }
}

.gal-footer-brand {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gal-footer-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--gal-ink-100);
  text-decoration: none;
}

.gal-footer-logo img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.gal-footer-logo span {
  font-family: var(--font-display, 'Boska', serif);
  font-size: 1.25rem;
}

.gal-footer-copy {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.6;
  max-width: 36ch;
}

.gal-footer-col-title {
  margin: 0 0 12px;
  font-family: var(--font-display, 'Boska', serif);
  font-size: 1.125rem;
  font-weight: 400;
  color: var(--gal-ink-100);
}

.gal-footer-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.875rem;
  line-height: 1.5;
}

.gal-footer-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 14px;
  min-height: 44px;
  padding: 0 24px;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--gal-bg-deep);
  background: linear-gradient(135deg, #9a7838, #f1d592 45%, #c9a45c 70%, #9a7838);
}

.gal-footer-bottom {
  max-width: 1200px;
  margin: 36px auto 0;
  padding-top: 20px;
  border-top: 1px solid var(--gal-hairline);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.8125rem;
  color: var(--gal-ink-soft);
}

.gal-footer-back {
  color: var(--p7-gold-300);
  text-decoration: none;
}

.gal-footer-back:hover {
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   5. Accesibilidad: prefers-reduced-motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .stc-strip,
  .stc-slide {
    transition: none !important;
  }

  .stc-title {
    animation: none !important;
  }

  .stc-title[data-out] {
    display: none;
  }

  .stc-dot,
  .stc-btn,
  .liquid-glass-btn,
  .liquid-glass-surface {
    transition: none;
  }
}
