/* ==========================================================================
   AURONIXIA — Imágenes y efectos (parallax, fondos difuminados, scroll horizontal)
   Comportamiento en js/media-fx.js. Con prefers-reduced-motion no hay movimiento.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Base: marcos con imagen sobredimensionada para el parallax
   La imagen mide 130% del marco; el JS la desplaza ±14%.
   -------------------------------------------------------------------------- */
.parallax-frame {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  background: var(--surface);
}
.parallax-frame img,
.img-band-media img,
.section-bg-media img {
  position: absolute;
  left: 0;
  top: -15%;
  width: 100%;
  height: 130%;
  max-width: none;
  object-fit: cover;
  will-change: transform;
}

/* --------------------------------------------------------------------------
   Banda de imagen a pantalla completa
   -------------------------------------------------------------------------- */
.img-band {
  position: relative;
  min-height: 92vh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  isolation: isolate;
  border-bottom: 1px solid var(--line);
}
.img-band-media { position: absolute; inset: 0; z-index: -2; }
.img-band-media img { filter: saturate(0.85) contrast(1.05); }
.img-band-overlay {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, var(--bg) 0%, rgba(20, 14, 11, 0.15) 22%, rgba(20, 14, 11, 0.35) 55%, var(--bg) 100%),
    linear-gradient(90deg, rgba(20, 14, 11, 0.85) 0%, rgba(20, 14, 11, 0.2) 60%, transparent 100%);
}
.img-band-content { padding-top: 160px; padding-bottom: 110px; }
.img-band-title {
  font-family: var(--font-display);
  font-size: clamp(34px, 5.4vw, 84px);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.03em;
  color: var(--c-cream);
  max-width: 16ch;
  margin-bottom: 24px;
}
.img-band-text {
  max-width: 560px;
  font-size: clamp(16px, 1.4vw, 19px);
  color: var(--text-75);
}

/* --------------------------------------------------------------------------
   Fondos de sección: imagen difuminada al 60% + overlay
   -------------------------------------------------------------------------- */
.has-bg-media {
  position: relative;
  isolation: isolate;
  overflow: clip; /* recorta sin romper position: sticky de los hijos */
}
.section-bg-media {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.section-bg-media img {
  opacity: 0.6;
  filter: blur(10px) saturate(0.7);
  transform: scale(1.06);
}
.section-bg-media::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, var(--bg) 0%, rgba(20, 14, 11, 0.74) 18%, rgba(20, 14, 11, 0.74) 82%, var(--bg) 100%);
}
/* Variante nítida para CTA (menos blur, overlay radial) */
.section-bg-media--strong img { filter: blur(2px) saturate(0.8); opacity: 0.6; }
.section-bg-media--strong::after {
  background:
    radial-gradient(ellipse at center, rgba(20, 14, 11, 0.55) 0%, rgba(20, 14, 11, 0.86) 70%),
    linear-gradient(180deg, var(--bg) 0%, transparent 20%, transparent 80%, var(--bg) 100%);
}
/* Variante muy sutil para secciones con mucho texto */
.section-bg-media--soft img { opacity: 0.35; filter: blur(16px) saturate(0.6); }

/* Cuando la sección tiene fondo propio, dejar ver la imagen */
.manifesto-section.has-bg-media .manifesto-glow { z-index: 0; }
.manifesto-section.has-bg-media .container { position: relative; z-index: 1; }

/* --------------------------------------------------------------------------
   Casos de uso: sección fijada con desplazamiento horizontal
   -------------------------------------------------------------------------- */
.hscroll {
  position: relative;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.hscroll-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}
.hscroll-track {
  display: flex;
  height: 100%;
  will-change: transform;
}
.hcase-intro {
  flex: 0 0 min(44vw, 620px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 110px 56px 90px;
}
.hcase-intro-title {
  font-family: var(--font-display);
  font-size: clamp(34px, 4.4vw, 68px);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.03em;
  color: var(--c-cream);
  margin-bottom: 20px;
}
.hcase-intro-text { color: var(--text-75); max-width: 460px; }
.hcase-intro-hint {
  margin-top: 36px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-light);
}
.hcase-intro-hint span { display: inline-block; animation: hint-nudge 1.6s ease-in-out infinite; }
@keyframes hint-nudge { 50% { transform: translateX(6px); } }

.hcase {
  position: relative;
  flex: 0 0 100vw;
  height: 100%;
  overflow: hidden;
  isolation: isolate;
  display: flex;
  align-items: flex-end;
}
.hcase + .hcase { border-left: 1px solid var(--line); }
.hcase-media { position: absolute; inset: 0; z-index: -2; overflow: hidden; }
.hcase-media img {
  width: 112%;
  height: 100%;
  max-width: none;
  margin-left: -6%;
  object-fit: cover;
  will-change: transform;
  filter: saturate(0.85);
}
.hcase-overlay {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(20, 14, 11, 0.92) 0%, rgba(20, 14, 11, 0.72) 42%, rgba(20, 14, 11, 0.2) 100%),
    linear-gradient(0deg, rgba(20, 14, 11, 0.9) 0%, transparent 45%);
}
.hcase-content {
  max-width: 820px;
  padding: 0 56px 120px;
}
.hcase-index {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--text-75);
  margin-bottom: 14px;
}
.hcase-sector {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-dark);
  background: var(--accent-light);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  margin-bottom: 18px;
}
.hcase-title {
  font-family: var(--font-display);
  font-size: clamp(30px, 3.8vw, 58px);
  font-weight: 400;
  line-height: 1.04;
  letter-spacing: -0.03em;
  color: var(--c-cream);
  margin-bottom: 28px;
}
.hcase-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line-strong);
  margin-bottom: 26px;
}
.hcase-grid dt {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-light);
  margin-bottom: 8px;
}
.hcase-grid dd { font-size: 14.5px; line-height: 1.55; color: var(--text-75); }
.hcase-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--c-cream);
  border-bottom: 1px solid var(--line-strong);
}
.hcase-link:hover { border-color: var(--accent-light); }

.hscroll-hud {
  position: absolute;
  left: 56px;
  bottom: 40px;
  display: flex;
  align-items: center;
  gap: 18px;
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--text-75);
  z-index: 3;
}
.hscroll-counter-current { color: var(--c-cream); font-weight: 600; }
.hscroll-progress {
  width: 220px;
  height: 2px;
  background: var(--line-strong);
  overflow: hidden;
}
.hscroll-progress-fill {
  display: block;
  height: 100%;
  background: var(--c-cream);
  transform: scaleX(0);
  transform-origin: left;
}

/* Variante carrusel táctil: móvil (<768px) o prefers-reduced-motion */
.hscroll--swipe { height: auto !important; padding: 90px 0 70px; }
.hscroll--swipe .hscroll-sticky { position: relative; height: auto; overflow: visible; }
.hscroll--swipe .hscroll-track {
  height: auto;
  transform: none !important;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  gap: 14px;
  padding: 0 var(--gutter-mobile) 18px;
  scroll-padding-left: var(--gutter-mobile);
  scrollbar-width: none;
}
.hscroll--swipe .hscroll-track::-webkit-scrollbar { display: none; }
.hscroll--swipe .hcase-intro {
  flex: 0 0 86%;
  padding: 24px 4px;
  scroll-snap-align: start;
}
.hscroll--swipe .hcase {
  flex: 0 0 86%;
  height: auto;
  min-height: 600px;
  border: 1px solid var(--line);
  border-radius: 20px;
  scroll-snap-align: start;
}
.hscroll--swipe .hcase-media img { transform: none !important; width: 100%; margin-left: 0; }
.hscroll--swipe .hcase-overlay {
  background: linear-gradient(0deg, rgba(20, 14, 11, 0.96) 0%, rgba(20, 14, 11, 0.85) 55%, rgba(20, 14, 11, 0.35) 100%);
}
.hscroll--swipe .hcase-content { padding: 28px 22px; }
.hscroll--swipe .hcase-grid { grid-template-columns: 1fr; gap: 14px; }
.hscroll--swipe .hscroll-hud { display: none; }
.hscroll--swipe .hcase-intro-hint span { animation: none; }

@media (max-width: 1100px) and (min-width: 768px) {
  .hcase-grid { grid-template-columns: 1fr 1fr; }
  .hcase-grid > div:last-child { grid-column: span 2; }
}

/* --------------------------------------------------------------------------
   Preview flotante en la lista de servicios (solo puntero fino)
   -------------------------------------------------------------------------- */
.services-section { position: relative; z-index: 2; }
.service-preview {
  position: fixed;
  top: 0;
  left: 0;
  width: 340px;
  aspect-ratio: 16 / 10;
  border-radius: 18px;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.3s ease;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6);
}
.service-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.15);
  transition: transform 0.6s var(--ease-editorial);
}
.service-preview.is-visible { opacity: 0.92; }
.service-preview.is-visible img { transform: scale(1); }

/* --------------------------------------------------------------------------
   Bloque IA: imagen con parallax, glow y chips
   -------------------------------------------------------------------------- */
/* La columna de imagen se estira a la altura del texto (del kicker al CTA) */
.ai-block-grid:has(.ai-visual-media) { align-items: stretch; }
.ai-visual-media {
  aspect-ratio: auto;
  align-self: stretch;
  min-height: 520px;
  padding: 0;
  display: block;
}
.ai-visual-media .parallax-frame {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--c-dark);
}
/* Parallax más amplio para esta imagen vertical: mide 140% del marco */
.ai-visual-media .parallax-frame img {
  top: -20%;
  height: 140%;
  object-position: center;
}
.ai-visual-media .parallax-frame::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(20, 14, 11, 0.85) 0%, rgba(20, 14, 11, 0.1) 55%, rgba(131, 148, 166, 0.15) 100%);
}
.ai-visual-media .ai-glow { z-index: 1; mix-blend-mode: screen; }
.ai-chips {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 24px;
  z-index: 2;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ai-chips li {
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: rgba(20, 14, 11, 0.6);
  border: 1px solid var(--line-strong);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-cream);
}

/* --------------------------------------------------------------------------
   Mosaico "Cómo trabajamos"
   -------------------------------------------------------------------------- */
.mosaic-section {
  padding: 130px 0 170px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.mosaic-header { margin-bottom: 60px; max-width: 760px; }
.mosaic-title {
  font-family: var(--font-display);
  font-size: clamp(30px, 3.8vw, 56px);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--c-cream);
}
.mosaic-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  align-items: start;
}
.mosaic-col { display: flex; flex-direction: column; gap: 20px; will-change: transform; }
.mosaic-col--offset { margin-top: 110px; }
.mosaic-tile {
  position: relative;
  margin: 0;
  border-radius: 20px;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  background: var(--surface);
}
.mosaic-col:nth-child(odd) .mosaic-tile:last-child,
.mosaic-col--offset .mosaic-tile:first-child { aspect-ratio: 1 / 1; }
.mosaic-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.9s var(--ease-editorial), filter 0.5s ease;
  filter: saturate(0.8);
}
.mosaic-tile::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(20, 14, 11, 0.7) 0%, transparent 45%);
  pointer-events: none;
}
.mosaic-tile:hover img { transform: scale(1.05); filter: saturate(1); }
.mosaic-tile figcaption {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 1;
  padding: 7px 13px;
  border-radius: var(--radius-pill);
  background: rgba(20, 14, 11, 0.6);
  border: 1px solid var(--line-strong);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--c-cream);
}

@media (max-width: 768px) {
  .img-band { min-height: 78vh; }
  .img-band-content { padding-bottom: 72px; }
  .mosaic-section { padding: 90px 0; }
  .mosaic-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .mosaic-col { gap: 12px; transform: none !important; }
  .mosaic-col--offset { margin-top: 48px; }
  .mosaic-col:nth-child(3) { grid-column: span 2; flex-direction: row; }
  .mosaic-col:nth-child(3) .mosaic-tile { flex: 1; aspect-ratio: 1 / 1; }
  .mosaic-tile figcaption { left: 10px; bottom: 10px; font-size: 11px; padding: 6px 10px; }
  .ai-visual-media { aspect-ratio: 4 / 5; min-height: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .parallax-frame img, .img-band-media img, .section-bg-media img,
  .mosaic-col, .hcase-media img { transform: none !important; }
  .mosaic-tile img { transition: none; }
}
