/*
 * Sitio Pro pone overflow-x:hidden en html/body → overflow-y pasa a auto y
 * position:sticky del player deja de anclarse al viewport (canvas se va con el scroll).
 * clip en X evita ese efecto colateral sin tocar el reproductor aprobado.
 */
html:has(body.m6-sitio-cinematic),
body.m6-sitio-cinematic {
  overflow-x: clip;
  overflow-y: visible;
}

html:has(body.m6-sitio-cinematic) {
  scroll-behavior: auto;
}

.m6-hero-shell {
  position: relative;
  width: 100%;
  background: var(--m6-scene-bg, #f6ede2);
  overflow: visible;
}

.m6-hero-shell .m6-scene {
  position: relative;
  width: 100%;
  /* min-height lo fija CinematicPlayer en .m6-scene (scrollHeightVh) */
}

.m6-hero-shell .m6-scene__sticky {
  background: var(--m6-scene-bg, #f6ede2);
}

/* Transición hacia secciones Sitio Pro: mismo tono crema → blanco comercial */
body.m6-sitio-cinematic {
  background: var(--m6-bg, #f6ede2);
}

body.m6-sitio-cinematic .header {
  transition: background 0.3s, box-shadow 0.3s;
}

body.m6-sitio-cinematic:not([data-m6-scene-tone]).is-scrolled .header,
body.m6-sitio-cinematic:not([data-m6-scene-tone]) .header.scrolled {
  background: rgba(246, 237, 226, 0.92);
  backdrop-filter: blur(8px);
}

.m6-hero-shell + main,
.m6-hero-shell + #main-content,
.m6-hero-shell ~ main {
  position: relative;
  z-index: 1;
}

.m6-hero-shell + main > .section:first-child,
.m6-hero-shell ~ main > .section:first-child {
  margin-top: 0;
}

/* Overlay: una sola etapa visible (evita titulares fantasma superpuestos) */
.m6-hero-shell .m6-overlay {
  position: absolute;
  z-index: 3;
  max-width: min(36rem, 50vw);
  min-height: clamp(8rem, 22vh, 14rem);
  padding: 0;
  pointer-events: none;
  text-wrap: balance;
}

/* Zona editorial izquierda — NO anclar al borde inferior (regresión premium) */
body.m6-sitio-cinematic .m6-hero-shell .m6-overlay.m6-overlay--left {
  left: clamp(1.5rem, 6vw, 5rem);
  right: auto;
  top: clamp(5rem, 20vh, 11.5rem);
  bottom: auto;
  transform: none;
  width: min(32rem, calc(var(--m6-editorial-max-vw, 36) * 1vw));
  max-width: min(32rem, calc(var(--m6-editorial-max-vw, 36) * 1vw));
  box-sizing: border-box;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: min(48vh, 34rem);
  max-height: min(70vh, 40rem);
}

/* Zona editorial estrecha (paridad Pollo Guard) — escenas oscuras con producto derecha */
body.m6-sitio-cinematic[data-m6-scene-tone='dark'] .m6-hero-shell .m6-overlay.m6-overlay--left {
  width: min(34rem, calc(var(--m6-editorial-max-vw, 36) * 1vw));
  max-width: min(34rem, calc(var(--m6-editorial-max-vw, 36) * 1vw));
  padding-right: clamp(0.85rem, 3vw, 2.5rem);
  box-sizing: border-box;
}

body.m6-sitio-cinematic[data-m6-editorial-max-vw] .m6-hero-shell .m6-overlay.m6-overlay--left,
#m6-hero-shell[data-m6-editorial-max-vw] .m6-overlay.m6-overlay--left {
  width: min(32rem, calc(var(--m6-editorial-max-vw, 36) * 1vw));
  max-width: min(32rem, calc(var(--m6-editorial-max-vw, 36) * 1vw));
}

.m6-hero-shell .m6-stage-copy:not(.m6-on) {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  position: absolute;
  inset: 0;
  max-height: 0;
  overflow: hidden;
}

.m6-hero-shell .m6-stage-copy {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  margin: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(0.85rem);
  transition:
    opacity 0.5s ease,
    transform 0.5s ease,
    visibility 0s linear 0.5s;
  pointer-events: none;
  max-width: 100%;
}

.m6-hero-shell .m6-stage-copy.m6-on {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition:
    opacity 0.5s ease,
    transform 0.5s ease,
    visibility 0s;
  z-index: 1;
}

.m6-overlay--type-spectacular .m6-stage-copy {
  transition-duration: 0.52s;
  transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}

.m6-overlay--type-elegant .m6-stage-copy {
  transition-duration: 0.72s;
  transition-timing-function: cubic-bezier(0.33, 1, 0.68, 1);
  transform: translateY(0.6rem);
}

.m6-overlay--type-dynamic .m6-stage-copy {
  transition-duration: 0.36s;
  transition-timing-function: cubic-bezier(0.22, 1.12, 0.42, 1);
  transform: translate3d(-0.35rem, 0.5rem, 0);
}

.m6-overlay--type-dynamic .m6-stage-copy.m6-on {
  transform: none;
}

.m6-hero-shell .m6-overlay h1,
.m6-hero-shell .m6-overlay .m6-headline {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: var(--m6-headline-fit, clamp(1.875rem, 3.4vw + 0.55rem, 4.75rem));
  line-height: 1.06;
  margin: 0.15rem 0 0.65rem;
  color: var(--m6-ink, #2b1a10);
  text-shadow: 0 1px 0 rgba(246, 237, 226, 0.92), 0 10px 32px rgba(246, 237, 226, 0.72);
  max-width: 32ch;
  text-wrap: balance;
}

body.m6-sitio-cinematic[data-m6-scene-tone='dark'] .m6-hero-shell .m6-overlay h1,
body.m6-sitio-cinematic[data-m6-scene-tone='dark'] .m6-hero-shell .m6-overlay .m6-headline {
  max-width: 24ch;
  line-height: 1.1;
}

.m6-hero-shell .m6-overlay .m6-headline-accent {
  color: var(--m6-headline-accent-color, var(--m6-accent, #c48a3a));
  font-weight: inherit;
  text-shadow: 0 1px 16px rgba(0, 0, 0, 0.42);
}

body.m6-sitio-cinematic[data-m6-scene-tone='dark'] .m6-hero-shell .m6-overlay .m6-headline-accent {
  color: var(--m6-headline-accent-color, var(--m6-accent, #f1b979));
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.55);
}

.m6-hero-shell .m6-overlay .m6-kicker {
  display: inline-block;
  margin-bottom: 0.45rem;
  letter-spacing: 0.2em;
  font-size: clamp(0.62rem, 1.2vw, 0.72rem);
  font-weight: 600;
  text-transform: uppercase;
  color: var(--m6-accent, #8a4b22);
}

.m6-hero-shell .m6-overlay .m6-btn,
.m6-hero-shell .m6-overlay .m6-btn--cta {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1.05rem;
  min-height: clamp(3.25rem, 4.2vw, 3.75rem);
  padding: 0.9rem 2rem;
  font-size: clamp(0.98rem, 1.35vw, 1.08rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--m6-ink, #2b1a10);
  color: var(--m6-bg, #f6ede2);
  border: none;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 10px 28px rgba(43, 26, 16, 0.18);
}

.m6-hero-shell .m6-overlay .m6-btn:hover,
.m6-hero-shell .m6-overlay .m6-btn--cta:hover {
  filter: brightness(1.06);
}

.m6-hero-shell .m6-overlay .m6-btn:focus-visible,
.m6-hero-shell .m6-overlay .m6-btn--cta:focus-visible {
  outline: 2px solid var(--m6-accent, #8a4b22);
  outline-offset: 3px;
}

.m6-hero-shell .m6-overlay .m6-sub {
  font-size: clamp(1.05rem, 1.45vw, 1.22rem);
  line-height: 1.52;
  color: var(--m6-soft, #7a6655);
  margin: 0.25rem 0 0.85rem;
  max-width: 42ch;
  text-shadow: 0 1px 0 rgba(246, 237, 226, 0.88);
  text-wrap: pretty;
}

.m6-presentation--minimal .m6-overlay .m6-headline {
  font-size: clamp(1.65rem, 6vw, 2.75rem);
}

.m6-presentation--editorial .m6-overlay .m6-sub--lead {
  font-size: clamp(1rem, 2vw, 1.2rem);
}

.m6-overlay--type-spectacular .m6-headline,
body[data-m6-typography='spectacular'] .m6-overlay .m6-headline {
  font-size: var(--m6-headline-fit, clamp(2.35rem, 5vw, 4.35rem));
  font-weight: 700;
  letter-spacing: -0.025em;
  max-width: 30ch;
}

.m6-overlay--type-elegant .m6-headline,
body[data-m6-typography='elegant'] .m6-overlay .m6-headline {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: var(--m6-headline-fit, clamp(2.1rem, 3.6vw + 0.55rem, 3.85rem));
  font-weight: 500;
  font-style: italic;
  letter-spacing: 0.01em;
  max-width: 34ch;
}

.m6-overlay--type-dynamic .m6-headline,
body[data-m6-typography='dynamic'] .m6-overlay .m6-headline {
  font-family: Inter, system-ui, sans-serif;
  font-size: var(--m6-headline-fit, clamp(1.75rem, 4.2vw, 3.1rem));
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Cabecera comercial: en demo café, no forzar azul del tema Pro sobre el hero */
body.m6-sitio-cinematic.m6-theme-cafe .header .logo,
body.m6-sitio-cinematic.m6-theme-cafe .header .nav a {
  color: var(--m6-ink, #2b1a10) !important;
}

body.m6-sitio-cinematic.m6-theme-cafe .header .hamburger span {
  background: var(--m6-ink, #2b1a10);
}

.m6-hero-shell .m6-scene__progress > span {
  background: var(--m6-progress, #8a4b22);
}

body.m6-sitio-cinematic #hero.m6-hero-fallback[hidden],
body.m6-sitio-cinematic section.m6-hero-fallback[hidden] {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
}

body[data-m6-intensity='spectacular'] .fade-in {
  transition-duration: 1.1s;
}

body[data-m6-intensity='elegant'] .fade-in {
  transition-duration: 0.55s;
}

@media (prefers-reduced-motion: reduce) {
  .m6-hero-shell {
    display: none;
  }
}

/* Desktop: zonas editoriales universales (3D) — sin alterar player ni scroll */
@media (min-width: 761px) {
  body.m6-sitio-cinematic:not([data-m6-review-composition='la-paquita'])
    #m6-hero-shell[data-m6-editorial-compose='1']
    .m6-overlay.m6-overlay--left {
    left: calc(var(--m6-editorial-left-px) * 1px);
    right: auto;
    top: calc(var(--m6-editorial-top-px) * 1px);
    bottom: auto;
    transform: none;
    justify-content: flex-start;
    width: calc(var(--m6-editorial-block-width-px) * 1px);
    max-width: calc(var(--m6-editorial-block-width-px) * 1px);
    min-height: calc(var(--m6-editorial-est-h-px, 18rem) * 1px);
    max-height: min(58vh, calc(var(--m6-editorial-est-h-px, 18rem) * 1px + 2rem));
    box-sizing: border-box;
  }

  body.m6-sitio-cinematic:not([data-m6-review-composition='la-paquita'])
    #m6-hero-shell[data-m6-editorial-compose='1']
    .m6-overlay
    .m6-btn,
  body.m6-sitio-cinematic:not([data-m6-review-composition='la-paquita'])
    #m6-hero-shell[data-m6-editorial-compose='1']
    .m6-overlay
    .m6-btn--cta {
    margin-top: 1.2rem;
    min-height: clamp(3.4rem, 4.6vw, 4.05rem);
    padding: 1rem 2.35rem;
    font-size: clamp(1.02rem, 1.45vw, 1.16rem);
    box-shadow: 0 12px 32px rgba(43, 26, 16, 0.22);
  }

  #m6-hero-shell[data-m6-editorial-zone='right']:not([data-m6-editorial-compose='1']) .m6-overlay.m6-overlay--left,
  body.m6-sitio-cinematic
    #m6-hero-shell[data-m6-editorial-zone='right']:not([data-m6-editorial-compose='1'])
    .m6-overlay.m6-overlay--left {
    left: auto;
    right: clamp(1.5rem, 6vw, 5rem);
    text-align: left;
  }

  #m6-hero-shell[data-m6-editorial-zone='below'] .m6-overlay.m6-overlay--left,
  body.m6-sitio-cinematic #m6-hero-shell[data-m6-editorial-zone='below'] .m6-overlay.m6-overlay--left {
    left: clamp(1.15rem, 4vw, 2.5rem);
    right: clamp(1.15rem, 4vw, 2.5rem);
    width: auto;
    max-width: min(36rem, 92vw);
    top: auto;
    bottom: clamp(4.5rem, 14vh, 8rem);
    text-align: center;
    min-height: 0;
    max-height: min(42vh, 26rem);
    justify-content: flex-end;
  }

  #m6-hero-shell[data-m6-editorial-zone='below'] .m6-overlay .m6-headline,
  #m6-hero-shell[data-m6-editorial-zone='below'] .m6-overlay h1 {
    margin-left: auto;
    margin-right: auto;
    max-width: 28ch;
  }

  #m6-hero-shell[data-m6-editorial-zone='below'] .m6-overlay .m6-sub {
    margin-left: auto;
    margin-right: auto;
    max-width: 36ch;
  }

  #m6-hero-shell[data-m6-editorial-zone='below'] .m6-overlay .m6-btn,
  #m6-hero-shell[data-m6-editorial-zone='below'] .m6-overlay .m6-btn--cta {
    margin-left: auto;
    margin-right: auto;
  }

  #m6-hero-shell[data-m6-editorial-tight='1'][data-m6-editorial-zone='left'] .m6-overlay.m6-overlay--left,
  #m6-hero-shell[data-m6-editorial-tight='1'][data-m6-editorial-zone='right'] .m6-overlay.m6-overlay--left {
    min-height: 0;
    max-height: min(56vh, 32rem);
  }

  #m6-hero-shell[style*='--m6-editorial-max-px'] .m6-overlay.m6-overlay--left {
    width: min(32rem, calc(var(--m6-editorial-max-px) * 1px));
    max-width: min(32rem, calc(var(--m6-editorial-max-px) * 1px));
  }
}

@media (max-width: 760px) {
  body.m6-sitio-cinematic .m6-hero-shell .m6-overlay.m6-overlay--left,
  .m6-hero-shell .m6-overlay {
    max-width: none;
    left: 1.15rem;
    right: 1.15rem;
    width: auto;
    top: auto;
    bottom: clamp(4.5rem, 12vh, 7rem);
    text-align: center;
    padding-bottom: 0;
  }

  .m6-hero-shell .m6-overlay h1,
  .m6-hero-shell .m6-overlay .m6-headline {
    font-size: clamp(1.875rem, 7.2vw, 2.625rem);
    max-width: 20ch;
    margin-left: auto;
    margin-right: auto;
  }

  .m6-hero-shell .m6-overlay .m6-sub {
    font-size: clamp(1rem, 4.2vw, 1.12rem);
    max-width: 36ch;
    margin-left: auto;
    margin-right: auto;
  }

  .m6-hero-shell .m6-overlay .m6-btn,
  .m6-hero-shell .m6-overlay .m6-btn--cta {
    min-height: clamp(3.25rem, 10vw, 3.75rem);
    min-width: 11.5rem;
    padding-inline: 1.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .m6-hero-shell .m6-overlay [data-stage] {
    transition: none;
  }
}