/* =============================================
   ENSOCLIM — Portada
   Solo la carga index.html, encima de styles.css (que sigue llevando la
   barra, el pie y los botones flotantes del resto de páginas).
   ============================================= */

:root {
  --gut: clamp(20px, 4vw, 56px);
  --night: #100E0C;
  --amber: #F0A02A;

  --t-display: clamp(38px, 5.8vw, 92px);
  --t-h2: clamp(30px, 3.4vw, 52px);
  --t-lead: clamp(19px, 1.6vw, 24px);
  --t-body: 17px;
  --t-small: 14px;

  --pad: clamp(72px, 8vw, 120px);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

.home { background: var(--bg); }
.home main { display: block; }
.home h1, .home h2, .home h3 { letter-spacing: -0.035em; }
.wrap { max-width: 1400px; margin: 0 auto; padding: 0 var(--gut); }

/* =============================================
   1 · PORTADA EN VÍDEO
   Un clip por capítulo; cada uno se funde con el siguiente. home.js carga
   solo el activo y el siguiente, a 480p en móvil y 720p en escritorio.
   ============================================= */
.reel {
  --dur: 6.5s;
  position: relative;
  height: 100vh; height: 100svh;
  min-height: 620px; max-height: 1100px;
  background: var(--night);
  color: #fff;
  overflow: hidden;
  isolation: isolate;
}
.reel__media { position: absolute; inset: 0; z-index: -2; }
.reel__slide {
  position: absolute; inset: 0; margin: 0;
  opacity: 0;
  transition: opacity 1.4s ease;
}
.reel__slide.is-active { opacity: 1; }
.reel__slide video {
  display: block; width: 100%; height: 100%;
  object-fit: cover;
  background: var(--night);
}

.reel::before,
.reel::after { content: ''; position: absolute; left: 0; right: 0; z-index: -1; pointer-events: none; }
.reel::before { top: 0; height: 24%; background: linear-gradient(rgba(8,7,6,.55), rgba(8,7,6,0)); }
.reel::after  { bottom: 0; height: 75%; background: linear-gradient(rgba(8,7,6,0), rgba(8,7,6,.5) 45%, rgba(8,7,6,.88)); }

.reel__content {
  position: absolute;
  left: var(--gut); right: var(--gut);
  bottom: clamp(120px, 17vh, 170px);
}
.reel__title {
  font-size: var(--t-display);
  line-height: .95;
  font-weight: 800;
  letter-spacing: -0.045em;
  color: #fff;
  margin-bottom: 22px;
}
.reel__title span { display: block; white-space: nowrap; }
.reel__sub {
  font-size: 18px; line-height: 1.55;
  max-width: 44ch;
  color: rgba(255,255,255,.9);
  margin-bottom: 28px;
}
.reel__actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* Las cifras, dentro de la portada */
.reel__stats {
  position: absolute; right: 0; bottom: 0;
  display: flex; gap: clamp(24px, 3vw, 48px);
  list-style: none;
}
.reel__stat { display: flex; flex-direction: column; gap: 4px; }
.reel__stat strong {
  font-size: clamp(34px, 3.2vw, 50px); line-height: 1; font-weight: 800; letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
}
.reel__stat span { font-size: var(--t-small); line-height: 1.35; color: rgba(255,255,255,.85); max-width: 13ch; }

/* Capítulos con barra de progreso */
.reel__chapters {
  position: absolute;
  /* A la derecha del botón flotante de WhatsApp y a la izquierda del chat */
  left: max(var(--gut), 112px); right: max(var(--gut), 104px); bottom: 34px;
  display: flex; align-items: flex-end; gap: 18px;
}
.reel__chaplist {
  flex: 1;
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px;
  list-style: none;
}
.reel__chap {
  width: 100%;
  display: flex; flex-direction: column; gap: 12px;
  padding: 10px 0 4px;
  background: none; border: 0; cursor: pointer;
  font: 600 var(--t-small)/1.2 'Manrope', sans-serif;
  color: rgba(255,255,255,.62);
  text-align: left;
  transition: color .3s;
}
.reel__chap:hover, .reel__chap.is-active { color: #fff; }
.reel__track {
  position: relative; display: block;
  height: 3px; border-radius: 3px;
  background: rgba(255,255,255,.26);
  overflow: hidden;
}
.reel__fill {
  position: absolute; inset: 0;
  background: #fff;
  transform: scaleX(0); transform-origin: left center;
}
.reel__chap.is-done .reel__fill { transform: scaleX(1); }
.reel__chap.is-active .reel__fill { animation: reel-fill var(--dur) linear forwards; }
.reel.is-paused .reel__chap.is-active .reel__fill { animation-play-state: paused; }
.reel.is-static .reel__chap.is-active .reel__fill { animation: none; transform: scaleX(1); }
@keyframes reel-fill { to { transform: scaleX(1); } }

.reel__toggle {
  flex-shrink: 0;
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255,255,255,.14); color: #fff;
  border: 0; cursor: pointer;
  transition: background-color .25s, transform .25s var(--ease-out);
}
.reel__toggle:hover { background: rgba(255,255,255,.26); transform: scale(1.06); }
.reel__toggle svg { width: 16px; height: 16px; }
.reel__toggle .i-play { display: none; }
.reel.is-paused .reel__toggle .i-play,
.reel.is-static .reel__toggle .i-play { display: block; }
.reel.is-paused .reel__toggle .i-pause,
.reel.is-static .reel__toggle .i-pause { display: none; }

.reel__now {
  display: none;
  position: absolute; left: var(--gut); top: 136px;
  font-size: 13px; font-weight: 600; color: rgba(255,255,255,.85);
}

@media (max-width: 1100px) {
  .reel__stats { position: static; margin-top: 32px; }
}
@media (max-width: 760px) {
  .reel { min-height: 600px; }
  .reel__title { font-size: 9.6vw; margin-bottom: 16px; }
  .reel__sub { font-size: 16px; margin-bottom: 22px; }
  .reel__content { bottom: 112px; }
  .reel__actions .hbtn { flex: 1 1 100%; }
  .reel__stats { margin-top: 26px; gap: 20px; justify-content: space-between; }
  .reel__stat strong { font-size: 28px; }
  .reel__stat span { font-size: 13px; }
  /* En el móvil los capítulos son segmentos tipo «historias», arriba */
  .reel__chapters { top: 90px; bottom: auto; left: var(--gut); right: var(--gut); gap: 12px; align-items: center; }
  .reel__toggle { width: 36px; height: 36px; }
  .reel__chaplist { gap: 6px; }
  .reel__chap { font-size: 0; gap: 0; padding: 14px 0; }
  .reel__chap-label { display: none; }
  .reel__now { display: block; }
}
@media (max-height: 760px) and (min-width: 761px) {
  .reel__title { font-size: clamp(38px, 5vw, 76px); }
  .reel__content { bottom: 104px; }
  .reel__sub { margin-bottom: 20px; }
}

/* =============================================
   2 · SERVICIOS — todos en una pantalla
   ============================================= */
.svc { background: var(--surface-2); padding: var(--pad) 0; }
.svc__head {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 24px 48px; flex-wrap: wrap;
  margin-bottom: clamp(32px, 4vw, 52px);
}
.svc__title { font-size: var(--t-h2); line-height: 1.02; }
.svc__intro { font-size: var(--t-body); line-height: 1.55; max-width: 44ch; }
.svc__grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  list-style: none;
}
.svc__item a {
  display: flex; flex-direction: column; height: 100%;
  background: rgba(255,255,255,.55);
  border-radius: 18px; overflow: hidden;
  transition: background-color .3s, transform .45s var(--ease-out);
}
.svc__item a:hover, .svc__item a:focus-visible { background: #fff; transform: translateY(-4px); }
.svc__pic { aspect-ratio: 16 / 9; overflow: hidden; background: #C9D3D8; }
.svc__pic img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .9s var(--ease-out); }
.svc__item a:hover .svc__pic img { transform: scale(1.06); }
.svc__body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.svc__name {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  font-size: 19px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2;
}
.svc__name svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--red); transition: transform .4s var(--ease-out); }
.svc__item a:hover .svc__name svg { transform: translateX(4px); }
.svc__desc { font-size: 15px; line-height: 1.45; color: var(--ink); }
.svc__more { margin-top: 32px; }

@media (max-width: 1100px) { .svc__grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) {
  .svc__grid { gap: 12px; }
  .svc__body { padding: 12px 12px 14px; }
  .svc__name { font-size: 16px; }
  .svc__name svg { display: none; }
  .svc__desc { display: none; }
}

/* =============================================
   3 · OBRA REAL
   ============================================= */
.work { padding: var(--pad) 0; }
.work__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px 48px; flex-wrap: wrap; margin-bottom: clamp(32px, 4vw, 52px); }
.work__title { font-size: var(--t-h2); line-height: 1.02; max-width: 14ch; }
.work__intro { font-size: var(--t-body); line-height: 1.55; max-width: 40ch; }
.work__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, clamp(200px, 19vw, 290px));
  gap: 14px;
}
.work__item { margin: 0; position: relative; overflow: hidden; border-radius: 18px; background: #CFC9BD; }
.work__item--a { grid-column: span 2; grid-row: span 2; }
.work__item a { display: block; height: 100%; color: #fff; }
.work__pic { position: absolute; inset: 0; }
.work__pic img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 1.1s var(--ease-out); }
.work__item a:hover .work__pic img { transform: scale(1.05); }
.work__item a::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(rgba(8,7,6,0) 45%, rgba(8,7,6,.78));
  pointer-events: none;
}
.work__item figcaption { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding: 18px 20px; }
.work__name { display: block; font-size: 18px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.work__desc { display: block; font-size: 14px; line-height: 1.45; color: rgba(255,255,255,.88); margin-top: 4px; max-width: 46ch; }
.work__item--a .work__name { font-size: 24px; }
.work__item--a .work__desc { font-size: 16px; }
.work__more { margin-top: 32px; }

@media (max-width: 900px) {
  .work__grid { grid-template-columns: 1fr 1fr; grid-template-rows: none; grid-auto-rows: clamp(170px, 42vw, 260px); gap: 10px; }
  .work__item--a { grid-column: 1 / -1; grid-row: span 1; }
}
@media (max-width: 480px) {
  .work__item figcaption { padding: 12px 14px; }
  .work__name { font-size: 15px; }
  .work__item--a .work__name { font-size: 19px; }
  .work__desc { display: none; }
  .work__item--a .work__desc { display: block; font-size: 14px; }
}

/* =============================================
   4 · ZONAS
   ============================================= */
.zones { padding: var(--pad) 0; }
.zones__grid { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px; row-gap: 32px; }
.zones__copy { grid-column: 1 / span 5; }
.zones__title { font-size: var(--t-h2); line-height: 1.02; margin-bottom: 18px; max-width: 12ch; }
.zones__text { font-size: var(--t-body); line-height: 1.6; max-width: 36ch; }
.zones__list {
  grid-column: 7 / -1; list-style: none;
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px;
  align-content: start;
}
.zones__list a {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 16px; margin: 0 -16px;
  border-radius: 12px;
  font-size: 18px; font-weight: 700; letter-spacing: -0.015em;
  transition: background-color .25s, color .25s;
}
.zones__list a::after { content: '→'; color: var(--red-ink); transition: transform .3s var(--ease-out); }
.zones__list a:hover { background: var(--surface-2); }
.zones__list a:hover::after { transform: translateX(4px); }
@media (max-width: 900px) {
  .zones__copy, .zones__list { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .zones__list { gap: 2px 20px; }
  .zones__list a { font-size: 16px; padding: 12px 12px; margin: 0 -12px; }
}

/* =============================================
   5 · CIERRE — sencillo, sin foto
   ============================================= */
.closing { background: var(--night); color: #fff; padding: clamp(64px, 7vw, 104px) 0; }
.closing__inner { display: flex; justify-content: space-between; align-items: center; gap: 32px 48px; flex-wrap: wrap; }
.closing__title { font-size: var(--t-h2); line-height: 1.02; color: #fff; margin-bottom: 12px; }
.closing__text { font-size: 18px; line-height: 1.55; color: rgba(255,255,255,.88); max-width: 46ch; }
.closing__actions { display: flex; flex-wrap: wrap; gap: 12px; }
@media (max-width: 560px) {
  .closing__actions { width: 100%; }
  .closing__actions .hbtn { flex: 1 1 100%; }
}

/* =============================================
   MOVIMIENTO — entradas por partes
   Solo se ocultan si home.js ha arrancado (.js-rise): sin script, todo visible.
   ============================================= */
.js-rise [data-rise] {
  opacity: 0;
  transform: translate3d(0, 24px, 0);
  transition: opacity .9s var(--ease-out), transform .9s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 70ms);
}
.js-rise [data-rise].is-in { opacity: 1; transform: none; }

.js-rise .reel__title span,
.js-rise .reel__sub,
.js-rise .reel__actions,
.js-rise .reel__stats {
  opacity: 0; transform: translate3d(0, 30px, 0);
  animation: reel-in 1.1s var(--ease-out) forwards;
}
.js-rise .reel__title span:nth-child(2) { animation-delay: .1s; }
.js-rise .reel__sub { animation-delay: .25s; }
.js-rise .reel__actions { animation-delay: .38s; }
.js-rise .reel__stats { animation-delay: .5s; }
@keyframes reel-in { to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .reel__slide { transition: none; }
  .js-rise [data-rise], .js-rise .reel__title span, .js-rise .reel__sub,
  .js-rise .reel__actions, .js-rise .reel__stats {
    opacity: 1; transform: none; animation: none; transition: none;
  }
  .hbtn, .svc__item a, .svc__pic img, .work__pic img { transition: none; }
}
