/* ==========================================================================
   Hero banner — Óptica Sant Martí v02
   Fotos nítidas locales · pastilla de mensaje · sin overlays fríos
   ========================================================================== */

#main.wrapper:has(#opsm-hero),
#main.wrapper.wrapper--hero-page,
#main.wrapper.wrapper--hero-home {
  padding-top: 0;
}

/* Una sola diapositiva: sin hueco de scroll bajo el banner */
.opsm-hero[data-slide-count="1"] .opsm-hero__scroll-track {
  height: auto;
}

.opsm-hero[data-slide-count="1"] .opsm-hero__viewport {
  position: relative;
}

.opsm-hero--home .opsm-hero__controls,
.opsm-hero--home .opsm-hero__arrow {
  display: none;
}

.opsm-hero {
  --hero-progress: 0;
  --hero-brand: #3498db;
  --hero-brand-dark: #2980b9;
  --hero-brand-hover: #5dade2;
  position: relative;
  z-index: 1;
  margin: 0;
}

.opsm-hero__scroll-track {
  height: calc(50vh + 45vh);
  position: relative;
}

.opsm-hero__viewport {
  position: sticky;
  top: 0;
  height: 50vh;
  min-height: 300px;
  max-height: 460px;
  overflow: hidden;
  background: #1a1a1a;
}

/* —— Fotos de fondo —— */
.opsm-hero__slides {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.opsm-hero__slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.85s ease;
  pointer-events: none;
}

.opsm-hero__slide.is-active {
  opacity: 1;
  pointer-events: auto;
}

.opsm-hero__media {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.opsm-hero__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  transform: scale(calc(1.02 + var(--hero-progress) * 0.04));
  transform-origin: center center;
  image-rendering: -webkit-optimize-contrast;
  filter: contrast(1.07) saturate(1.06);
  will-change: transform;
}

/* Solo sombra neutra a la izquierda para leer el texto — sin tinte azul */
.opsm-hero__shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    95deg,
    rgba(0, 0, 0, 0.5) 0%,
    rgba(0, 0, 0, 0.22) 34%,
    rgba(0, 0, 0, 0.04) 52%,
    transparent 68%
  );
}

/* —— Pastilla de mensajes (opaca, sin blur frío) —— */
.opsm-hero__panel {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  align-items: center;
  padding-bottom: 32px;
}

.opsm-hero__glass {
  position: relative;
  max-width: 560px;
  padding: clamp(1.1rem, 2.8vw, 1.85rem);
  border-radius: 18px;
  background: rgba(24, 24, 24, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.opsm-hero__copy {
  position: absolute;
  inset: clamp(1.1rem, 2.8vw, 1.85rem);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.55s ease, transform 0.55s ease;
  pointer-events: none;
}

.opsm-hero__copy.is-active {
  position: relative;
  inset: auto;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.opsm-hero__kicker {
  margin-bottom: 12px;
}

.opsm-hero__title {
  margin: 0 0 12px;
  font-size: clamp(1.5rem, 4vw, 2.45rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.opsm-hero__title span {
  display: inline-block;
  background: linear-gradient(135deg, #a8d4f5 0%, var(--hero-brand) 55%, #7ec8f0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.opsm-hero__lead {
  margin: 0 0 18px;
  max-width: 46ch;
  font-size: clamp(1rem, 1.8vw, 1.125rem);
  line-height: 1.55;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.92) !important;
  letter-spacing: -0.015em;
}

.opsm-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.opsm-hero__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 999px;
  font-family: var(--opsm-font, "Inter", sans-serif);
  font-size: 17px;
  font-weight: 400;
  letter-spacing: -0.022em;
  text-transform: none;
  text-decoration: none;
  transition: background-color 0.28s ease, color 0.28s ease, border-color 0.28s ease;
}

.opsm-hero__btn--primary {
  color: #fff;
  background: var(--hero-brand);
  box-shadow: none;
}

.opsm-hero__btn--primary:hover,
.opsm-hero__btn--primary:focus {
  color: #fff;
  background: var(--hero-brand-hover);
  transform: none;
  box-shadow: none;
}

.opsm-hero__btn--ghost {
  color: #1d1d1f;
  background: #f5f5f7;
  border: 1px solid #1d1d1f;
  font-size: 17px;
  font-weight: 400;
  letter-spacing: -0.022em;
  text-transform: none;
  transition: background-color 0.28s ease, color 0.28s ease, border-color 0.28s ease;
}

.opsm-hero__btn--ghost:hover,
.opsm-hero__btn--ghost:focus {
  color: #fff;
  background: #1d1d1f;
  border-color: #1d1d1f;
  transform: none;
}

/* —— Controles —— */
.opsm-hero__controls {
  position: absolute;
  z-index: 3;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.opsm-hero__dot {
  position: relative;
  width: 32px;
  height: 3px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  overflow: hidden;
}

.opsm-hero__dot-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0%;
  background: var(--hero-brand);
  border-radius: inherit;
}

.opsm-hero__dot.is-active .opsm-hero__dot-fill {
  animation: opsmDotProgress 6.5s linear forwards;
}

@keyframes opsmDotProgress {
  from { width: 0%; }
  to { width: 100%; }
}

.opsm-hero__arrow {
  position: absolute;
  z-index: 3;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s, opacity 0.2s;
  opacity: 0;
}

.opsm-hero:hover .opsm-hero__arrow,
.opsm-hero:focus-within .opsm-hero__arrow {
  opacity: 1;
}

.opsm-hero__arrow:hover {
  background: rgba(52, 152, 219, 0.55);
  transform: translateY(-50%) scale(1.05);
}

.opsm-hero__arrow--prev { left: 14px; }
.opsm-hero__arrow--next { right: 14px; }

/* —— Reveal secciones —— */
.opsm-reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.75s cubic-bezier(0.22, 1, 0.36, 1), transform 0.75s cubic-bezier(0.22, 1, 0.36, 1);
}

.opsm-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.opsm-reveal--delay-1 { transition-delay: 0.1s; }
.opsm-reveal--delay-2 { transition-delay: 0.2s; }
.opsm-reveal--delay-3 { transition-delay: 0.3s; }

/* Home: contenido pegado al banner */
.wrapper--hero-home .container > .section:first-child {
  padding-top: clamp(1.25rem, 3vw, 2rem);
}

@media (max-width: 991px) {
  .opsm-hero__scroll-track {
    height: calc(50vh + 35vh);
  }

  .opsm-hero__viewport {
    max-height: 380px;
    min-height: 280px;
  }

  .opsm-hero__glass {
    max-width: 100%;
  }

  .opsm-hero__arrow {
    display: none;
  }
}

@media (max-width: 767px) {
  .opsm-hero__shade {
    background: linear-gradient(
      95deg,
      rgba(0, 0, 0, 0.58) 0%,
      rgba(0, 0, 0, 0.35) 55%,
      rgba(0, 0, 0, 0.2) 100%
    );
  }
}

@media (max-width: 575px) {
  .opsm-hero__title {
    font-size: 1.45rem;
  }

  .opsm-hero__btn {
    width: 100%;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .opsm-hero__media img {
    transform: none !important;
  }

  .opsm-hero__dot-fill {
    animation: none !important;
  }

  .opsm-reveal {
    opacity: 1;
    transform: none;
  }
}
