/* Eco Electric · Hero «Plano solar»
   Estado por defecto = estado final de la narrativa (sin JS o con movimiento reducido).
   La narrativa corre una sola vez cuando hero.js añade .is-run; su duración --T
   se iguala a la duración real del video que se esté mostrando. */

.hero { --T: 12s; --V: 2.4s; position: relative; isolation: isolate; overflow: hidden; min-height: max(640px, 100svh); display: flex; flex-direction: column;
  padding: clamp(132px, 20vh, 196px) var(--pad) 56px; background: var(--ink); color: var(--paper); }

.hero__media { position: absolute; top: 0; right: 0; bottom: 0; width: 64%; z-index: -1; overflow: hidden; background: var(--ink-2); }
.hero__poster img, .hero__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: saturate(1.08) contrast(1.06); }
.hero__video { opacity: 0; transition: opacity .6s ease; }
.hero__video.is-ready { opacity: 1; }

/* Velo: la imagen empieza apagada y la luz le devuelve el color (escritorio) */
.hero__veil { position: absolute; inset: 0; background: rgba(8, 29, 61, .62);
  -webkit-backdrop-filter: grayscale(1) brightness(.62) contrast(1.1); backdrop-filter: grayscale(1) brightness(.62) contrast(1.1);
  -webkit-mask-image: linear-gradient(100deg, transparent 0 42%, #000 58% 100%); mask-image: linear-gradient(100deg, transparent 0 42%, #000 58% 100%);
  -webkit-mask-size: 320% 100%; mask-size: 320% 100%; -webkit-mask-position: 0 0; mask-position: 0 0; }
@supports not ((backdrop-filter: grayscale(1)) or (-webkit-backdrop-filter: grayscale(1))) {
  .hero__veil { background: #0b1a33; mix-blend-mode: color; }
}

.hero__edge-track { position: absolute; inset: -40px 0; transform: translateX(110%); pointer-events: none; }
.hero__edge { position: absolute; top: 0; bottom: 0; left: -60px; width: 120px; transform: skewX(-10deg); opacity: 0; filter: blur(6px); mix-blend-mode: screen;
  background: linear-gradient(90deg, rgba(243,181,72,0), rgba(243,181,72,.55) 45%, rgba(255,236,190,.95) 50%, rgba(243,181,72,.55) 55%, rgba(243,181,72,0)); }

.hero__sun { position: absolute; top: -260px; right: -220px; width: 720px; height: 720px; border-radius: 50%; opacity: .5; transform: scale(1.1); mix-blend-mode: screen; pointer-events: none;
  background: radial-gradient(circle, rgba(255,226,160,.75) 0%, rgba(243,181,72,.28) 32%, rgba(243,181,72,0) 68%); }

.hero__grid { position: absolute; inset: 13% 9% 22% 15%; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(5, 1fr); opacity: 0;
  border-top: 1px solid rgba(247,249,246,.35); border-left: 1px solid rgba(247,249,246,.35); }
.hero__grid span { position: relative; border-right: 1px solid rgba(247,249,246,.35); border-bottom: 1px solid rgba(247,249,246,.35); }
.hero__grid .is-lit::after { content: ""; position: absolute; inset: 0; background: rgba(243,181,72,.38); opacity: 0; }

.hero__shade { position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(10,27,46,.78) 0, rgba(10,27,46,0) 150px), linear-gradient(90deg, var(--ink) 0%, rgba(10,27,46,.55) 22%, rgba(10,27,46,0) 46%), linear-gradient(0deg, rgba(10,27,46,.88) 0%, rgba(10,27,46,0) 32%); }

.hero__caption { position: absolute; left: 15%; bottom: 150px; margin: 0; font: 600 12px/1.3 var(--f-label); letter-spacing: .1em; text-transform: uppercase; color: rgba(247,249,246,.82); }

.hero__content { position: relative; z-index: 1; max-width: 820px; display: flex; flex-direction: column; gap: 28px; }
.hero__eyebrow { margin: 0; font: 600 13px/1.2 var(--f-label); letter-spacing: .16em; text-transform: uppercase; color: var(--lime); }
.hero__title { margin: 0; font-family: var(--f-display); font-weight: 700; font-size: clamp(54px, min(7.6vw, 12.5svh), 116px); line-height: .9; letter-spacing: -.01em; }
.hero__accent { position: relative; white-space: nowrap; color: var(--gold); text-shadow: 0 0 28px rgba(243,181,72,.4); }
.hero__wire { position: absolute; top: 56%; left: calc(100% + 16px); width: min(28vw, 420px); height: 2px; transform-origin: right center; opacity: .55; pointer-events: none;
  background: linear-gradient(90deg, var(--gold), rgba(243,181,72,.15)); box-shadow: 0 0 12px rgba(243,181,72,.6); }
.hero__lead { margin: 0; max-width: 460px; font-size: clamp(17px, 1.4vw, 20px); line-height: 1.55; color: var(--muted); }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* Esquema ilustrativo: nunca representa una medición */
.hero__meter { position: absolute; z-index: 1; margin: 0; left: calc(36% + 15% * .64); right: 5.5%; bottom: 56px; display: flex; flex-direction: column; gap: 10px; }
.hero__meter-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; font: 600 12px/1.3 var(--f-label); letter-spacing: .08em; text-transform: uppercase; }
.hero__meter-head span { white-space: nowrap; }
.hero__meter-note { color: var(--gold); }
.hero__meter-bar { position: relative; height: 8px; border-radius: 8px; background: var(--lime); overflow: hidden; }
.hero__meter-grid { position: absolute; inset: 0; background: var(--grey); transform-origin: right center; transform: scaleX(.38); }
.hero__meter-legend { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 12px; color: rgba(247,249,246,.85); }
.hero__meter-legend span { display: inline-flex; align-items: center; gap: 8px; }
.sw { width: 10px; height: 10px; display: inline-block; flex-shrink: 0; }
.sw--solar { background: var(--green); }
.sw--grid { background: var(--grey); }

.hero__steps { position: relative; z-index: 1; margin: auto 0 0; padding: 48px 0 0; width: min(380px, 100%); list-style: none; display: flex; flex-direction: column; gap: 14px; }
.hero__steps li { display: grid; grid-template-columns: 32px 1fr; gap: 12px; align-items: center; }
.hero__step-n { font: 600 13px/1 var(--f-label); color: var(--lime); }
.hero__step-t { display: flex; flex-direction: column; gap: 6px; font-size: 15px; font-weight: 600; }
.hero__step-bar { position: relative; display: block; height: 1px; background: rgba(247,249,246,.2); }
.hero__step-bar::before { content: ""; position: absolute; inset: 0; background: var(--gold); transform-origin: left; transform: scaleX(1); opacity: .5; }

.hero__controls { position: absolute; z-index: 2; top: 108px; right: 24px; display: flex; gap: 8px; }
.hero:not(.has-video) [data-hero-toggle] { display: none; }

/* ---------- Narrativa (solo con .is-run). Tiempos relativos a --T ---------- */
.is-run .hero__veil { animation: heroVeil var(--V) var(--ease) both; } /* Fase 4.2: aclarado inicial rápido, independiente de la duración del video */
.is-run .hero__edge-track { animation: heroEdgeTrack var(--V) var(--ease) both; }
.is-run .hero__edge { animation: heroEdge var(--V) linear both; }
.is-run .hero__sun { animation: heroSun var(--T) ease-in-out both; }
.is-run .hero__grid { animation: heroGrid var(--T) ease-in-out both; }
.is-run .hero__grid .is-lit::after { animation: heroCell var(--T) ease-in-out calc(var(--T) * var(--d)) both; }
.is-run .hero__wire { animation: heroWire var(--T) var(--ease) both; }
.is-run .hero__accent { animation: heroAccent var(--T) ease both; }
.is-run .hero__meter { animation: heroMeter var(--T) ease both; }
.is-run .hero__meter-grid { animation: heroMeterGrid var(--T) var(--ease) both; }
.is-run .hero__steps li { animation: heroStepOn .4s ease calc(var(--T) * var(--d)) both; }
.is-run .hero__step-bar::before { animation: heroStepBar calc(var(--T) * var(--dur)) linear calc(var(--T) * var(--d)) both; }

@keyframes heroVeil { 0%, 10% { -webkit-mask-position: 100% 0; mask-position: 100% 0; } 100% { -webkit-mask-position: 0 0; mask-position: 0 0; } }
@keyframes heroEdgeTrack { 0%, 10% { transform: translateX(-10%); } 100% { transform: translateX(110%); } }
@keyframes heroEdge { 0%, 9% { opacity: 0; } 16%, 90% { opacity: 1; } 100% { opacity: 0; } }
@keyframes heroSun { 0% { opacity: 0; transform: scale(.6); } 14% { opacity: 1; transform: scale(1); } 44%, 100% { opacity: .5; transform: scale(1.1); } }
@keyframes heroGrid { 0%, 18% { opacity: 0; } 26%, 44% { opacity: 1; } 54%, 100% { opacity: 0; } }
@keyframes heroCell { 0%, 20% { opacity: 0; } 23% { opacity: .85; } 30%, 100% { opacity: 0; } }
@keyframes heroWire { 0%, 44% { transform: scaleX(0); opacity: 1; } 62% { transform: scaleX(1); opacity: 1; } 80%, 100% { transform: scaleX(1); opacity: .55; } }
@keyframes heroAccent { 0%, 56% { color: var(--paper); text-shadow: none; } 64%, 100% { color: var(--gold); text-shadow: 0 0 28px rgba(243,181,72,.4); } }
@keyframes heroMeter { 0%, 62% { opacity: 0; transform: translateY(8px); } 68%, 100% { opacity: 1; transform: none; } }
@keyframes heroMeterGrid { 0%, 66% { transform: scaleX(1); } 88%, 100% { transform: scaleX(.38); } }
@keyframes heroStepOn { from { opacity: .86; } to { opacity: 1; } } /* .86 mantiene contraste AA en los pasos pendientes con el verde corporativo */
@keyframes heroStepBar { from { transform: scaleX(0); opacity: 1; } 90% { opacity: 1; } to { transform: scaleX(1); opacity: .5; } }
@keyframes heroVeilFade { 0%, 10% { opacity: 1; } 100% { opacity: .18; } }

.hero.is-paused *, .hero.is-offscreen * { animation-play-state: paused !important; }

/* ---------- Tableta (768–1023) y móvil: sin backdrop-filter, sin retícula ---------- */
@media (max-width: 1023px) {
  .hero__media { width: 100%; }
  .hero__veil { -webkit-backdrop-filter: none; backdrop-filter: none; -webkit-mask-image: none; mask-image: none; background: #0b1a33; mix-blend-mode: color; opacity: .18; }
  .is-run .hero__veil { animation: heroVeilFade var(--V) ease-in-out both; }
  .hero__grid, .hero__edge-track, .hero__wire, .hero__caption { display: none; }
  .hero__sun { width: 520px; height: 520px; top: -200px; right: -200px; }
  .hero__content { margin-top: auto; }
  .hero__meter { position: relative; left: auto; right: auto; bottom: auto; margin-top: 36px; max-width: 520px; }
  .hero__steps { margin-top: 0; padding-top: 28px; }
  .hero__shade { background: linear-gradient(180deg, rgba(10,27,46,.75) 0, rgba(10,27,46,0) 160px), linear-gradient(90deg, rgba(10,27,46,.9) 0%, rgba(10,27,46,.55) 50%, rgba(10,27,46,.25) 100%), linear-gradient(0deg, rgba(10,27,46,.95) 0%, rgba(10,27,46,0) 55%); }
  .hero__controls { top: calc(var(--header-h) + 12px); }
}
@media (max-width: 767px) {
  .hero { padding: 96px 20px 32px; min-height: max(600px, 100svh); }
  .hero__content { gap: 18px; }
  .hero__title { font-size: clamp(46px, 13.5vw, 60px); line-height: .92; }
  .hero__lead { font-size: 15px; }
  .hero__actions .btn { flex: 1 1 100%; }
  .hero__actions .btn--ghost { display: none; }
  .hero__shade { background: linear-gradient(180deg, rgba(10,27,46,.75) 0%, rgba(10,27,46,0) 22%, rgba(10,27,46,0) 36%, rgba(10,27,46,.92) 66%, var(--ink) 100%); }
  .hero__sun { width: 460px; height: 460px; top: -180px; right: -180px; }
  .hero__meter { margin-top: 24px; gap: 8px; }
  .hero__meter-head { font-size: 10px; }
  .hero__meter-legend { font-size: 11px; gap: 6px 14px; }
  .hero__steps { display: none; }
  .hero__controls { right: 16px; }
}
.hero__controls .media-ctl { position: static; }

/* Tableta apaisada (poca altura): se prioriza el esquema y se omiten los pasos numerados */
@media (max-width: 1023px) and (orientation: landscape) {
  .hero { padding-top: 112px; }
  .hero__steps { display: none; }
  .hero__meter { margin-top: 28px; }
}
