/* ==========================================================================
   Optienergy · sistema de diseño (prefijo .o-)
   Fase 1: tokens + cabecera + menú + barra inferior + pie.
   Animaciones solo con transform/opacity y dentro de prefers-reduced-motion.
   ========================================================================== */

:root {
  /* Color */
  --o-green: #2ECC71;        /* fondo de CTA, dato sobre oscuro, líneas */
  --o-green-ink: #1B7A43;    /* verde para texto sobre claro (AA ≥ 4,9) */
  --o-green-tint: #E9F8F0;
  --o-blue: #2980B9;         /* foco, decoración (no texto) */
  --o-blue-ink: #1F6391;     /* enlaces azules */
  --o-dark: #2C3E50;
  --o-dark-2: #34495E;
  --o-bg: #F5F7FA;
  --o-surface: #FFFFFF;
  --o-text: #2C3E50;
  --o-muted: #5D6D7E;
  --o-line: #DDE3EA;
  --o-line-dark: rgba(255, 255, 255, .08);
  --o-on-dark: rgba(255, 255, 255, .75);
  --o-yellow: #F1C40F;       /* solo acento puntual */

  /* Espacio (base 4) */
  --o-s1: 4px; --o-s2: 8px; --o-s3: 12px; --o-s4: 16px; --o-s5: 24px; --o-s6: 32px; --o-s7: 48px; --o-s8: 64px;
  --o-gutter: clamp(16px, 4vw, 32px);
  --o-section: clamp(48px, 8vw, 96px);
  --o-max: 1200px;

  /* Radios */
  --o-r-sm: 6px; --o-r: 10px; --o-r-lg: 14px;

  /* Sombras cortas y neutras */
  --o-sh-1: 0 1px 2px rgba(44, 62, 80, .08);
  --o-sh-2: 0 2px 8px rgba(44, 62, 80, .10);

  /* Tipografía */
  --o-font-h: 'Poppins', system-ui, sans-serif;
  --o-font-b: 'Inter', system-ui, sans-serif;
  --o-fs-h1: clamp(1.75rem, 1.2rem + 2.6vw, 3rem);
  --o-fs-h2: clamp(1.4rem, 1.1rem + 1.6vw, 2.25rem);
  --o-fs-h3: clamp(1.15rem, 1rem + .6vw, 1.4rem);
  --o-fs-body: 1rem;
  --o-fs-sm: .875rem;
  --o-fs-num-xl: clamp(2.25rem, 1.5rem + 4vw, 4rem);

  /* Movimiento */
  --o-dur: 200ms;
  --o-ease: cubic-bezier(.2, .8, .2, 1);

  /* Alturas */
  --o-hd-h: 56px;
  --o-bar-h: 64px;

  /* Compatibilidad con el CSS antiguo (home.css usa estas variables) */
  --nav-height-mobile: 56px;
  --nav-height-desktop: 72px;
}

/* Hueco reservado para la cabecera fija y la barra (sin CLS) */
body:has(> .o-hd) { padding-top: var(--o-hd-h); }
@media (max-width: 767.98px) { body:has(> .o-bar) { padding-bottom: calc(var(--o-bar-h) + env(safe-area-inset-bottom)); } }
/* Páginas legales: su CSS da padding al body; se pasa al contenedor */
body:has(> .o-hd) > .legal_wrap { padding: var(--o-s6) var(--o-s4) var(--o-s7); }
body:has(> .o-hd):has(> .legal_wrap) { padding-left: 0; padding-right: 0; padding-bottom: 0; }
@media (max-width: 767.98px) { body:has(> .o-bar):has(> .legal_wrap) { padding-bottom: calc(var(--o-bar-h) + env(safe-area-inset-bottom)); } }

.o-num { font-variant-numeric: tabular-nums; }
.o-ico { width: 20px; height: 20px; flex: none; }
.o-chev { width: 16px; height: 16px; flex: none; }

/* Foco visible */
.o-hd a:focus-visible, .o-hd button:focus-visible, .o-bar a:focus-visible, .o-ft a:focus-visible, .o-ft summary:focus-visible {
  outline: 3px solid var(--o-blue); outline-offset: 2px; border-radius: var(--o-r-sm);
}

/* ---------- Botones ---------- */
.o-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--o-s2);
  min-height: 44px; padding: 0 var(--o-s5); border-radius: var(--o-r);
  font: 600 .95rem/1 var(--o-font-h); text-decoration: none; white-space: nowrap;
  border: 2px solid transparent; transition: background-color var(--o-dur) var(--o-ease), color var(--o-dur), box-shadow var(--o-dur);
}
.o-btn--fill { background: var(--o-green); color: var(--o-dark); box-shadow: var(--o-sh-1); }
.o-btn--fill:hover { background: #29B765; }
.o-btn--line { background: transparent; color: var(--o-dark); border-color: var(--o-green-ink); }
.o-btn--line:hover { background: var(--o-green-tint); }
.o-hd__cta.is-solid { background: var(--o-green); border-color: var(--o-green); box-shadow: var(--o-sh-1); }

/* ==========================================================================
   Cabecera
   ========================================================================== */
.o-hd {
  position: fixed; inset: 0 0 auto; z-index: 1000; height: var(--o-hd-h);
  font-family: var(--o-font-b); color: var(--o-text);
  transition: transform var(--o-dur) var(--o-ease);
}
.o-hd::before { /* fondo blanco + sombra: aparece al compactar */
  content: ''; position: absolute; inset: 0; background: var(--o-surface); box-shadow: var(--o-sh-2);
  opacity: 1; transition: opacity var(--o-dur) var(--o-ease); pointer-events: none;
}
.o-hd__in {
  position: relative; height: 100%; max-width: var(--o-max); margin: 0 auto; padding: 0 var(--o-gutter);
  display: flex; align-items: center; gap: var(--o-s4);
  transition: transform var(--o-dur) var(--o-ease);
}
.o-hd__logo { display: flex; align-items: center; min-height: 44px; flex: none; position: relative; z-index: 2; }
.o-hd__logo img { display: block; height: 40px; width: auto; }
.o-hd.is-hidden { transform: translateY(-100%); }

/* Línea de energía: progreso de lectura */
.o-hd__prog {
  position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--o-green);
  transform: scaleX(var(--o-p, 0)); transform-origin: left; pointer-events: none;
}

.o-hd__act { display: flex; align-items: center; gap: var(--o-s3); margin-left: auto; }
.o-hd__act > .o-chip, .o-hd__act > .o-seg, .o-hd__cta, .o-hd__wa { display: none; }

/* Hamburguesa → X */
.o-burger {
  position: relative; width: 44px; height: 44px; border: 0; border-radius: var(--o-r-sm);
  background: transparent; color: var(--o-dark); cursor: pointer; z-index: 2;
}
.o-burger span {
  position: absolute; left: 11px; width: 22px; height: 2px; border-radius: 2px; background: currentColor;
  transition: transform var(--o-dur) var(--o-ease), opacity var(--o-dur);
}
.o-burger span:nth-child(1) { top: 15px; }
.o-burger span:nth-child(2) { top: 21px; }
.o-burger span:nth-child(3) { top: 27px; }
.o-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.o-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; transform: scaleX(.2); }
.o-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Chip OMIE: UN solo componente (barra de escritorio y menú móvil). Lo pinta el módulo OMIE de opti-ui.js.
   Estados (data-omie-state): horas · media → se ve; cargando · antiguo · sin-datos → no se ve (el atributo se queda). */
.o-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px;
  border: 1px solid #CDEBDA; border-radius: 10px; background: var(--o-green-tint);
  color: var(--o-dark); font: 500 .8125rem/1 var(--o-font-b); text-decoration: none; white-space: nowrap;
}
.o-chip[hidden], [data-omie="chip"]:not([data-omie-state="horas"]):not([data-omie-state="media"]) { display: none !important; }
.o-chip__k { color: var(--o-muted); }
.o-chip__v { font: 700 .9375rem/1 var(--o-font-h); font-variant-numeric: tabular-nums; }
/* Tendencia frente a la hora siguiente: icono + color (+ aria-label en el chip), nunca solo color */
.o-tr { font: 700 .75rem/1 var(--o-font-b); }
.o-tr:empty { display: none; }
[data-omie-trend="sube"] .o-tr { color: #A0520C; }      /* ámbar, 5,2:1 */
[data-omie-trend="baja"] .o-tr { color: var(--o-green-ink); }
[data-omie-trend="estable"] .o-tr { color: var(--o-muted); }
/* Mini gráfica de 24 barras: se adapta al chip (alto ≈ 55 %, ancho 64–80 px); pasadas atenuadas, actual resaltada */
.o-spark { width: 80px; height: 55%; display: block; flex: none; }
.o-spark:empty { display: none; }
.o-spark rect { fill: var(--o-green); opacity: .6; transform-box: fill-box; transform-origin: 50% 100%; }
.o-spark rect.is-past { opacity: .25; }
.o-spark rect.is-now { fill: var(--o-green-ink); opacity: 1; }
.o-chip:hover { border-color: var(--o-green-ink); }
/* Enlace al artículo «¿Por qué sube la luz?» en el menú móvil (siempre en el HTML) */
.o-nav__why { display: inline-flex; align-items: center; min-height: 44px; color: var(--o-green-ink); font: 500 .9375rem/1.2 var(--o-font-b); text-decoration: underline; text-underline-offset: 3px; }

/* Selector ES | CA (segmented control) */
.o-seg { display: inline-flex; padding: 3px; border-radius: var(--o-r); background: var(--o-bg); border: 1px solid var(--o-line); }
.o-seg a {
  display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 38px;
  padding: 0 var(--o-s3); border-radius: 7px; color: var(--o-muted); font: 600 .875rem/1 var(--o-font-h); text-decoration: none;
}
.o-seg a[aria-current] { background: var(--o-surface); color: var(--o-dark); box-shadow: var(--o-sh-1); }

/* ---------- Menú: móvil (pantalla completa, desde arriba) ---------- */
.o-nav {
  position: fixed; inset: 0; z-index: 1; overflow-y: auto; overscroll-behavior: contain;
  padding: calc(var(--o-hd-h) + var(--o-s4)) var(--o-gutter) calc(var(--o-s4) + env(safe-area-inset-bottom));
  background: var(--o-surface); display: flex; flex-direction: column; gap: var(--o-s5);
  visibility: hidden; clip-path: inset(0 0 100% 0);
}
.o-nav.is-open { visibility: visible; clip-path: inset(0 0 0 0); }
.o-nav__top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--o-s3); }
.o-nav__list { list-style: none; margin: 0; padding: 0; }
.o-nav__it { border-bottom: 1px solid var(--o-line); }
.o-nav__a {
  display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 52px;
  padding: 0; border: 0; background: none; cursor: pointer; text-align: left;
  font: 600 1.0625rem/1.2 var(--o-font-h); color: var(--o-dark); text-decoration: none;
}
.o-nav__a[aria-current="page"], .o-dd.is-current > .o-dd__btn { color: var(--o-green-ink); }
.o-dd__btn[aria-expanded="true"] .o-chev { transform: rotate(180deg); }
.o-chev { transition: transform var(--o-dur) var(--o-ease); }
.o-nav__ink { display: none; }

/* Acordeón móvil: altura animada (grid 0fr → 1fr) */
.o-dd__panel { display: grid; grid-template-rows: 0fr; }
.o-dd__panel > .o-dd__list { overflow: hidden; min-height: 0; }
.o-dd__btn[aria-expanded="true"] + .o-dd__panel { grid-template-rows: 1fr; }
/* Acordeón cerrado: sus enlaces no reciben foco (siguen en el HTML) */
@media (max-width: 1023.98px) {
  .o-dd__panel > * { visibility: hidden; transition: visibility 0s linear var(--o-dur); }
  .o-dd__btn[aria-expanded="true"] + .o-dd__panel > * { visibility: visible; transition: none; }
}
.o-dd__list { list-style: none; margin: 0; padding: 0; position: relative; }
.o-dd__a { display: flex; flex-direction: column; gap: 2px; min-height: 44px; padding: 10px var(--o-s3); border-radius: var(--o-r-sm); text-decoration: none; position: relative; z-index: 1; }
.o-dd__t { font: 500 1rem/1.3 var(--o-font-b); color: var(--o-dark); }
.o-dd__d { font: 400 .875rem/1.35 var(--o-font-b); color: var(--o-muted); }
.o-dd__a[aria-current="page"] .o-dd__t { color: var(--o-green-ink); font-weight: 600; }
.o-dd__list > li:last-child { padding-bottom: var(--o-s3); }

/* Canales (menú y pie) */
.o-nav__ch { margin-top: auto; display: grid; gap: var(--o-s2); position: sticky; bottom: 0; padding-top: var(--o-s3); background: var(--o-surface); }
.o-ch {
  display: flex; align-items: center; justify-content: center; gap: var(--o-s2); min-height: 52px; padding: 0 var(--o-s4);
  border: 1px solid var(--o-line); border-radius: var(--o-r); background: var(--o-surface);
  color: var(--o-dark); font: 600 1rem/1.2 var(--o-font-h); text-decoration: none;
}
.o-ch.o-btn--fill { background: var(--o-green); border-color: var(--o-green); }

/* ---------- Disponibilidad: punto verde «en línea» (sin pulso) ---------- */
.o-live { display: inline-flex; align-items: center; gap: 4px; font: 500 .8125rem/1 var(--o-font-b); color: var(--o-green-ink); white-space: nowrap; }
.o-live[hidden] { display: none; }
.o-live i { width: 8px; height: 8px; border-radius: 50%; background: var(--o-green); box-shadow: 0 0 0 2px rgba(46, 204, 113, .25); }
.o-ch .o-live { margin-left: auto; }
.o-ch.o-ch--dark .o-live { color: var(--o-green); }

/* El widget flotante antiguo «Disponible ahora» tapaba la barra: fuera en móvil (la barra lo sustituye) */
@media (max-width: 767.98px) { .disp-widget { display: none !important; } }

/* Mega-menú en móvil: grupos con subtítulo, sin pestañas ni tarjeta */
.o-mm__tabs, .o-mm__card, .o-hd__top { display: none; }
.o-mm__h { margin: var(--o-s3) 0 var(--o-s1); padding: 0 var(--o-s3); font: 600 .8125rem/1.2 var(--o-font-h); color: var(--o-green-ink); text-transform: uppercase; letter-spacing: .06em; }
.o-mm__panes { overflow: hidden; min-height: 0; }
.o-dd__panel.o-mm { display: grid; grid-template-rows: 0fr; }
.o-dd__btn[aria-expanded="true"] + .o-dd__panel.o-mm { grid-template-rows: 1fr; }

/* Franja de canales del mega-menú: solo escritorio */
.o-mm__foot { display: none; }

/* ---------- Escritorio (≥ 1024 px): barra de cristal a todo el ancho + mega-menú ----------
   Barra pegada arriba, de borde a borde: 72 px → compacta 60 px (200 ms). Contenido interior máx. 1440 px. */
@media (min-width: 1024px) {
  :root { --o-hd-h: 72px; --nav-height-desktop: 72px; }
  .o-hd {
    --o-isl-h: 72px;
    height: auto; padding: 0;
  }
  .o-hd.is-compact { --o-isl-h: 60px; }
  .o-hd::before { display: none; }
  .o-hd.is-hidden { transform: translateY(calc(-100% - 8px)); }

  /* Cristal: degradado verde de la cabecera antigua + blur 14 px / saturate 160 % + borde 1 px blanco → verde */
  .o-glass { position: relative; isolation: isolate; border-radius: 16px;
    box-shadow: 0 6px 20px -8px rgba(44, 62, 80, .18), 0 1px 2px rgba(44, 62, 80, .06); }
  .o-glass::before, .o-glass::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1; }
  .o-glass::before {
    background:
      radial-gradient(ellipse 800px 400px at 85% 50%, rgba(144, 238, 144, .20) 0%, rgba(173, 255, 173, .10) 50%, transparent 70%),
      radial-gradient(ellipse 600px 300px at 75% 30%, rgba(152, 251, 152, .16) 0%, rgba(176, 224, 230, .10) 30%, transparent 60%),
      radial-gradient(ellipse 500px 250px at 65% 60%, rgba(176, 224, 230, .12) 0%, transparent 70%),
      rgba(255, 255, 255, var(--o-glass-a, .93));
    -webkit-backdrop-filter: blur(14px) saturate(160%); backdrop-filter: blur(14px) saturate(160%);
  }
  .o-glass::after {
    padding: 1px; background: linear-gradient(105deg, rgba(255, 255, 255, .95), rgba(255, 255, 255, .7) 50%, rgba(46, 204, 113, .45));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  }
  @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .o-glass::before { background: rgba(255, 255, 255, .95); }
  }

  /* La barra es .o-hd__in a todo el ancho: el relleno lateral centra el contenido en 1440 px.
     overflow-x: clip recorta el destello de la «corriente» sin afectar a los desplegables (eje Y visible). */
  .o-hd__in {
    width: 100%; max-width: none; margin: 0; height: var(--o-isl-h); gap: 24px; overflow-x: clip;
    padding-inline: calc(max(0px, (100% - 1440px) / 2) + clamp(24px, 3vw, 48px));
  }
  .o-hd__in.o-glass { border-radius: 0; box-shadow: 0 1px 3px rgba(44, 62, 80, .06); }
  /* Cristal + regla de horas 0–23 h al pie (1 px, #2C3E50 al 7 %; 0·6·12·18 h más altas) */
  .o-hd__in.o-glass::before {
    background:
      linear-gradient(90deg, rgba(44, 62, 80, .07) 1px, transparent 1px) 0 calc(100% - 2px) / calc(100% / 24) 6px repeat-x,
      linear-gradient(90deg, rgba(44, 62, 80, .07) 1px, transparent 1px) 0 calc(100% - 2px) / 25% 11px repeat-x,
      radial-gradient(ellipse 800px 400px at 85% 50%, rgba(144, 238, 144, .20) 0%, rgba(173, 255, 173, .10) 50%, transparent 70%),
      radial-gradient(ellipse 600px 300px at 75% 30%, rgba(152, 251, 152, .16) 0%, rgba(176, 224, 230, .10) 30%, transparent 60%),
      radial-gradient(ellipse 500px 250px at 65% 60%, rgba(176, 224, 230, .12) 0%, transparent 70%),
      rgba(255, 255, 255, var(--o-glass-a, .93));
  }
  /* «Corriente»: línea de 2 px verde → azul al 35 % */
  .o-hd__in.o-glass::after {
    top: auto; height: 2px; padding: 0; -webkit-mask: none; mask: none;
    background: linear-gradient(90deg, rgba(46, 204, 113, .35), rgba(41, 128, 185, .35));
  }
  .o-hd__logo { margin-right: 8px; }   /* logo → enlaces: 8 + 24 = 32 px */
  .o-hd__logo img { height: 40px; }
  .o-hd__prog { left: 0; right: 0; bottom: 0; z-index: 2; }   /* progreso de scroll, verde sólido, encima */

  .o-burger, .o-nav__top, .o-nav__ch { display: none; }
  .o-nav__a, .o-btn { white-space: nowrap; }

  /* Navegación: Poppins 600 · 15 px · 0,01em · una línea, alineada a la izquierda tras el logo */
  .o-nav { position: static; inset: auto; overflow: visible; padding: 0; background: none; display: block; visibility: visible; clip-path: none; flex: 0 0 auto; min-width: 0; }   /* enlaces justo tras el logo */
  .o-nav__list { display: flex; align-items: center; justify-content: flex-start; gap: 2px; }
  .o-nav__it { border: 0; }
  .o-nav__it.o-dd:not(.o-dd--mega) { position: relative; }
  .o-nav__a {
    position: relative; width: auto; min-height: 40px; padding: 0 12px; gap: 4px; border-radius: 10px;
    font: 600 .9375rem/1 var(--o-font-h); letter-spacing: .01em; color: var(--o-dark);
  }
  .o-nav__a[aria-current="page"], .o-dd.is-current > .o-dd__btn { color: var(--o-green-ink); }
  .o-nav__a:focus-visible { outline-offset: -2px; }
  /* Subrayado de 2 px que se «carga» de izquierda a derecha; fijo (con brillo) en la página activa */
  .o-nav__a::after {
    content: ''; position: absolute; left: 12px; right: 12px; bottom: 4px; height: 2px; border-radius: 2px;
    background: var(--o-green); transform: scaleX(0); transform-origin: left; pointer-events: none;
  }
  .o-nav__a:hover::after, .o-nav__a:focus-visible::after, .o-dd__btn[aria-expanded="true"]::after { transform: scaleX(1); }
  .o-nav__a[aria-current="page"]::after, .o-dd.is-current > .o-dd__btn::after { transform: scaleX(1); box-shadow: 0 0 6px rgba(46, 204, 113, .55); }
  .o-dd__btn .o-chev { margin-right: -2px; }
  /* Puente de hover entre el botón y su panel (::before; el ::after es el subrayado) */
  .o-dd__btn[aria-expanded="true"]::before { content: ''; position: absolute; left: -8px; right: -8px; top: 100%; height: calc((var(--o-isl-h) - 40px) / 2 + 12px); }
  /* Destello de la «corriente»: segmento de ~120 px que recorre el borde inferior (animado abajo) */
  .o-nav__ink {
    display: block; position: absolute; left: 0; bottom: 0; width: 120px; height: 2px; z-index: 1; pointer-events: none;
    background: linear-gradient(90deg, rgba(46, 204, 113, 0), rgba(220, 255, 235, .95) 55%, rgba(46, 204, 113, .9) 75%, rgba(46, 204, 113, 0));
    transform: translateX(-120px); opacity: 0;
  }

  /* Derecha: chip OMIE (≥ 1366) · WhatsApp (≥ 1280) · ES|CA · Estudio gratis */
  .o-hd__act { gap: 8px; margin-left: auto; }   /* espacio flexible; mín. 24 px (gap de la barra) desde el último enlace */
  .o-hd__act > .o-chip { position: relative; height: 34px; padding: 0 8px; }   /* mismo componente que en móvil; solo cambia el tamaño */

  /* WhatsApp: botón redondo de 40 px con punto «en línea» */
  .o-hd__wa {
    position: relative; width: 40px; height: 40px; flex: none; align-items: center; justify-content: center; border-radius: 50%;
    border: 1px solid var(--o-line); background: rgba(255, 255, 255, .7); color: var(--o-dark);
  }
  .o-hd__wa:hover { border-color: rgba(46, 204, 113, .6); color: var(--o-green-ink); }
  .o-hd__dot { position: absolute; top: 1px; right: 1px; width: 10px; height: 10px; border-radius: 50%; background: var(--o-green); box-shadow: 0 0 0 2px #fff; }
  .o-hd__dot[hidden] { display: none; }

  /* ES|CA: la pastilla blanca se desliza al idioma activo o al que está bajo el ratón */
  .o-hd__act > .o-seg { position: relative; display: inline-flex; padding: 2px; border-radius: 8px; background: rgba(245, 247, 250, .8); }
  .o-hd__act > .o-seg a { position: relative; z-index: 1; width: 32px; min-width: 0; min-height: 28px; padding: 0; border-radius: 6px; font-size: .75rem; }
  .o-hd__act > .o-seg a[aria-current] { background: none; box-shadow: none; }
  .o-hd__act > .o-seg a:hover { color: var(--o-dark); }
  .o-hd__act > .o-seg::before {
    content: ''; position: absolute; top: 2px; left: 2px; width: 32px; bottom: 2px; border-radius: 6px;
    background: var(--o-surface); box-shadow: var(--o-sh-1); transform: translateX(0);
  }
  .o-hd__act > .o-seg:has(a[hreflang="ca"][aria-current])::before,
  .o-hd__act > .o-seg:has(a[hreflang="ca"]:hover)::before { transform: translateX(32px); }
  .o-hd__act > .o-seg:has(a[hreflang="es"]:hover)::before { transform: translateX(0); }
  .o-hd__act > .o-seg:has(a:hover) a[aria-current]:not(:hover) { color: var(--o-muted); }

  /* CTA: rayo + destello diagonal en hover */
  .o-hd__cta {
    display: inline-flex; position: relative; overflow: hidden; margin-left: 4px; min-height: 40px; height: 40px; padding: 0 16px 0 12px; gap: 6px;
    border-radius: 10px; border: 0; font-size: .9375rem;
  }
  .o-ray { width: 18px; height: 18px; flex: none; }
  .o-hd__cta::after {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .55) 50%, transparent 70%);
    transform: translateX(-120%);
  }

  /* Tooltips (chip OMIE, WhatsApp) */
  [data-o-tip]::before {
    content: attr(data-o-tip); position: absolute; top: calc(100% + 8px); left: 50%; z-index: 3; transform: translate(-50%, -2px);
    padding: 6px 10px; border-radius: 8px; background: var(--o-dark); color: #fff; font: 500 .8125rem/1.2 var(--o-font-b); white-space: nowrap;
    opacity: 0; pointer-events: none; box-shadow: var(--o-sh-2);
  }
  [data-o-tip]:hover::before, [data-o-tip]:focus-visible::before { opacity: 1; transform: translate(-50%, 0); }
  /* Tooltip del chip: alineado a su borde derecho y en 2 líneas como máximo */
  .o-hd__act > .o-chip[data-o-tip]::before { left: auto; right: 0; transform: translateY(-2px); white-space: normal; width: max-content; max-width: 340px; line-height: 1.4; }
  .o-hd__act > .o-chip[data-o-tip]:hover::before, .o-hd__act > .o-chip[data-o-tip]:focus-visible::before { transform: translateY(0); }

  /* Filas de enlace (mega y Sostenibilidad): título 15/600 · descripción 13,5 · máx. 2 líneas cada uno */
  .o-dd__list > li:last-child { padding-bottom: 0; }
  .o-dd__a { gap: 2px; min-height: 44px; padding: 10px 12px 10px 16px; border-radius: 10px; }
  .o-dd__t { font: 600 .9375rem/1.3 var(--o-font-h); color: var(--o-dark); }
  .o-dd__d { font: 400 .84375rem/1.4 var(--o-font-b); color: var(--o-muted); }
  .o-dd__t, .o-dd__d { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
  .o-dd__a[aria-current="page"] .o-dd__t { color: var(--o-green-ink); }
  .o-dd__a:focus-visible { outline: 3px solid var(--o-blue); outline-offset: -3px; border-radius: 10px; }
  .o-dd__hl {
    position: absolute; left: 0; top: 0; width: var(--o-hl-w, 100%); height: var(--o-hl-h, 0); border-radius: 10px;
    background: var(--o-bg); transform: translate(var(--o-hl-x, 0), var(--o-hl-y, 0)); opacity: var(--o-hl-o, 0); pointer-events: none;
  }
  .o-dd__hl::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 2px 2px 0; background: var(--o-green); }

  /* Paneles: mismo cristal, a 8 px bajo la barra */
  .o-dd__panel {
    display: block; position: absolute; z-index: 2; opacity: 0; visibility: hidden;
    top: calc(100% + (var(--o-isl-h) - 40px) / 2 + 8px); left: 50%; width: 320px; padding: 8px;
    transform: translate(-50%, 6px);
  }
  .o-dd__panel > .o-dd__list { overflow: visible; }
  .o-dd__panel.o-glass { --o-glass-a: .95; }   /* paneles casi opacos: legibles sobre el hero oscuro */
  .o-dd__btn[aria-expanded="true"] + .o-dd__panel { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

  /* Mega-menú «Soluciones»: pestañas 180 · enlaces (2 col. ≥ 240) · tarjeta OMIE 260 · franja de canales */
  .o-dd--mega { position: static; }
  .o-dd__panel.o-mm {
    top: calc(100% + 8px); width: min(1040px, 100vw - 2 * var(--o-gutter)); padding: 20px 20px 0;
    display: grid; grid-template-columns: 180px minmax(0, 1fr) 260px; grid-template-rows: auto auto; column-gap: 20px; align-items: start;
    max-height: calc(100vh - 100px); overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
  }
  .o-mm__tabs { display: flex; flex-direction: column; gap: 2px; position: relative; padding-left: 6px; }
  .o-mm__tabs::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 1px; background: var(--o-line); }
  .o-mm__tab {
    min-height: 44px; padding: 0 var(--o-s3); border: 0; border-radius: 10px; background: none; cursor: pointer; text-align: left;
    font: 600 .9375rem/1 var(--o-font-h); color: var(--o-muted); white-space: nowrap;
  }
  .o-mm__tab:hover { color: var(--o-dark); }
  .o-mm__tab[aria-selected="true"] { color: var(--o-dark); background: rgba(44, 62, 80, .06); }
  .o-mm__tab:focus-visible { outline: 3px solid var(--o-blue); outline-offset: -3px; }
  .o-mm__ink {
    position: absolute; left: -1px; top: 0; width: 3px; height: var(--o-tab-h, 44px); border-radius: 2px; background: var(--o-green);
    transform: translateY(var(--o-tab-y, 0)); pointer-events: none;
  }
  .o-mm__panes { overflow: visible; min-width: 0; }
  .o-mm__pane { display: none; }
  .o-mm__pane.is-active { display: block; }
  .o-mm__h { display: none; }
  .o-mm__pane .o-dd__list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 2px 12px; align-items: start; }

  /* Tarjeta OMIE (≈ 260 px, no se estira) */
  .o-mm__card {
    display: flex; flex-direction: column; align-self: start; padding: 14px var(--o-s4); border-radius: 12px;
    background: var(--o-dark); color: #fff;
  }
  /* Estados de la tarjeta: horas (precio de la hora + curva) · media (solo media) · resto: solo CTA y enlace */
  [data-omie="card"]:not([data-omie-state="horas"]):not([data-omie-state="media"]) .o-mm__data { display: none; }
  [data-omie="card"][data-omie-state="media"] [data-omie-plot], [data-omie="card"][data-omie-state="media"] [data-omie-mm] { display: none; }
  [data-omie="card"] .o-tr { font-size: .875rem; vertical-align: middle; }
  [data-omie="card"][data-omie-trend="sube"] .o-tr { color: #F5B041; }
  [data-omie="card"][data-omie-trend="baja"] .o-tr { color: var(--o-green); }
  [data-omie="card"][data-omie-trend="estable"] .o-tr { color: #BDC3C7; }
  .o-mm__why { display: inline-flex; align-items: center; justify-content: center; min-height: 24px; margin-top: 6px; color: var(--o-on-dark); font: 500 .8125rem/1.2 var(--o-font-b); text-decoration: underline; text-underline-offset: 3px; }
  .o-mm__why:hover { color: #fff; }
  .o-mm__why:focus-visible { outline: 3px solid var(--o-blue); outline-offset: 2px; border-radius: 4px; }
  .o-mm__k { margin: 0; font: 500 .8125rem/1 var(--o-font-b); color: var(--o-on-dark); }
  .o-mm__v { margin: 6px 0 0; font: 700 2rem/1 var(--o-font-h); color: var(--o-green); font-variant-numeric: tabular-nums; }
  .o-mm__v span { font: 500 .875rem/1 var(--o-font-b); color: var(--o-on-dark); }
  .o-mm__plot { position: relative; margin-top: var(--o-s2); }
  .o-curve { width: 100%; height: 80px; display: block; overflow: visible; }
  .o-curve .ax { stroke: rgba(255, 255, 255, .10); stroke-width: 1; vector-effect: non-scaling-stroke; }
  .o-curve .ar { fill: rgba(46, 204, 113, .12); }
  .o-curve .ln { fill: none; stroke: var(--o-green); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
  .o-curve .nw { stroke: rgba(255, 255, 255, .45); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
  .o-mm__dot { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px var(--o-green); pointer-events: none; }
  .o-mm__mm { display: flex; justify-content: space-between; margin: var(--o-s2) 0 0; font: 400 .8125rem/1 var(--o-font-b); color: var(--o-on-dark); }
  .o-mm__mm b { color: #fff; font-weight: 500; }
  .o-mm__q { margin: var(--o-s3) 0 var(--o-s2); font: 500 .875rem/1.3 var(--o-font-b); color: #fff; }
  .o-mm__cta { min-height: 40px; height: 40px; border: 0; margin-top: var(--o-s3); }
  [data-omie-state="horas"] > .o-mm__cta, [data-omie-state="media"] > .o-mm__cta { margin-top: 0; }

  /* Franja inferior: «¿No sabes por dónde empezar?» + 3 canales */
  .o-mm__foot {
    grid-column: 1 / -1; display: flex; align-items: center; gap: var(--o-s3);
    margin: var(--o-s4) -20px 0; padding: 12px 20px; border-top: 1px solid var(--o-line); background: rgba(245, 247, 250, .75);
    border-radius: 0 0 16px 16px;
  }
  .o-mm__foot p { margin: 0 auto 0 0; font: 600 .9375rem/1.2 var(--o-font-h); color: var(--o-dark); white-space: nowrap; }
  .o-mm__foot .o-btn { min-height: 40px; height: 40px; padding: 0 18px; border: 0; font-size: .9375rem; }
  .o-mm__ch {
    display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 1px solid var(--o-line); border-radius: 10px;
    background: var(--o-surface); color: var(--o-dark); font: 500 .9375rem/1 var(--o-font-b); text-decoration: none; white-space: nowrap;
  }
  .o-mm__ch:hover { background: var(--o-bg); border-color: #C9D2DC; }
  .o-mm__ch .o-ico { width: 18px; height: 18px; }
  .o-mm__ch:focus-visible { outline: 3px solid var(--o-blue); outline-offset: 2px; }
}
/* ---------- Escritorio: el chip OMIE se adapta al ancho (no depende de una resolución) ----------
   1024–1199: solo en el mega-menú · 1200–1439: compacto («0,123 €/kWh ▲» + gráfica corta; la franja va en el tooltip)
   ≥ 1440: completo («Ahora · 19–20 h  0,123 €/kWh ▲» + gráfica).
   Para que quepa (por este orden): relleno de enlaces con clamp() → logo a 36 px (< 1366) → sin WhatsApp redondo (< 1280). */
@media (min-width: 1024px) {
  .o-nav__a { padding-inline: var(--o-na-p, 12px); }
  .o-nav__a::after { left: var(--o-na-p, 12px); right: var(--o-na-p, 12px); }
  :root { --o-na-p: clamp(6px, calc(1.1vw - 7px), 10px); }
}
@media (min-width: 1200px) { .o-hd__act > .o-chip { display: inline-flex; } }
@media (min-width: 1200px) and (max-width: 1439.98px) {
  .o-hd__act > .o-chip .o-chip__k { display: none; }
  .o-hd__act > .o-chip .o-spark { width: 64px; }
}
@media (min-width: 1024px) and (max-width: 1365.98px) { .o-hd__logo img { height: 36px; } }
@media (min-width: 1280px) { .o-hd__act > .o-hd__wa { display: inline-flex; } }
@media (min-width: 1440px) { .o-hd__act > .o-chip .o-spark { width: 72px; } }


/* ==========================================================================
   Barra inferior (móvil)
   ========================================================================== */
.o-bar { display: none; }
@media (max-width: 767.98px) {
  .o-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 990; display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--o-s2);
    min-height: var(--o-bar-h); padding: var(--o-s2) var(--o-s3) calc(var(--o-s2) + env(safe-area-inset-bottom));
    background: var(--o-surface); border-top: 1px solid var(--o-line); box-shadow: 0 -1px 4px rgba(44, 62, 80, .06);
    transition: transform var(--o-dur) var(--o-ease);
  }
  .o-bar.is-off { transform: translateY(110%); }
  /* Mientras el aviso de cookies está abierto, la barra no se muestra (no se solapan) */
  body:has(#cookie-banner:not([hidden])) .o-bar { transform: translateY(110%); }
  .o-bar__b {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 48px;
    border-radius: var(--o-r); color: var(--o-dark); background: var(--o-bg);
    font: 600 .8125rem/1.1 var(--o-font-h); text-decoration: none; text-align: center;
  }
  .o-bar__b.o-btn--fill { background: var(--o-green); }
}

/* ==========================================================================
   Pie: panel oscuro plano con eje horizontal y marcas 0–23 h
   ========================================================================== */
.o-ft { position: relative; background: var(--o-dark); color: #fff; font-family: var(--o-font-b); overflow: hidden; }
.o-ft__axis { position: absolute; inset: 0; pointer-events: none; }
.o-ft__axis span { position: absolute; left: 0; right: 0; height: 1px; background: var(--o-line-dark); }
.o-ft__axis span:nth-child(1) { top: 25%; }
.o-ft__axis span:nth-child(2) { top: 50%; }
.o-ft__axis span:nth-child(3) { top: 75%; }
.o-ft__axis i { position: absolute; bottom: var(--o-s2); font: 500 .6875rem/1 var(--o-font-b); font-style: normal; color: rgba(255, 255, 255, .6); font-variant-numeric: tabular-nums; }
.o-ft__axis i:nth-of-type(1) { left: 2%; } .o-ft__axis i:nth-of-type(2) { left: 26%; } .o-ft__axis i:nth-of-type(3) { left: 50%; }
.o-ft__axis i:nth-of-type(4) { left: 74%; } .o-ft__axis i:nth-of-type(5) { right: 2%; }
.o-ft__in { position: relative; max-width: var(--o-max); margin: 0 auto; padding: var(--o-s7) var(--o-gutter) var(--o-s7); display: grid; gap: var(--o-s5); }
.o-ft__logo { display: inline-flex; min-height: 44px; align-items: center; }
.o-ft__logo img { height: 40px; width: auto; display: block; }
.o-ft__desc { margin: var(--o-s3) 0 0; color: var(--o-on-dark); font-size: .9375rem; line-height: 1.6; max-width: 46ch; }
.o-ft__ch { display: grid; gap: var(--o-s2); }
.o-ch--dark { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .14); color: #fff; justify-content: flex-start; }
.o-ch--dark.o-btn--fill { background: var(--o-green); border-color: var(--o-green); color: var(--o-dark); justify-content: center; }
.o-ft__grp { border-top: 1px solid rgba(255, 255, 255, .14); }
.o-ft__grp summary {
  display: flex; align-items: center; justify-content: space-between; min-height: 48px; cursor: pointer; list-style: none;
  font: 600 1rem/1.2 var(--o-font-h); color: #fff;
}
.o-ft__grp summary::-webkit-details-marker { display: none; }
.o-ft__grp[open] summary .o-chev { transform: rotate(180deg); }
.o-ft__list { list-style: none; margin: 0 0 var(--o-s3); padding: 0; }
.o-ft__a { display: flex; align-items: center; min-height: 44px; color: var(--o-on-dark); text-decoration: none; }
.o-ft__a:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.o-ft__social { display: flex; gap: var(--o-s2); }
.o-ft__social a { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: var(--o-r); color: #fff; background: rgba(255, 255, 255, .06); }
.o-ft__copy { margin: 0; padding-bottom: var(--o-s4); font-size: var(--o-fs-sm); color: var(--o-on-dark); }
@media (min-width: 768px) {
  .o-ft__in { grid-template-columns: 1.4fr 1fr 1fr 1fr; align-items: start; }
  .o-ft__brand { grid-column: 1; grid-row: 1 / span 2; }
  .o-ft__grp { border: 0; }
  .o-ft__grp summary { pointer-events: none; }
  .o-ft__grp summary .o-chev { display: none; }
  .o-ft__social, .o-ft__copy { grid-column: 2 / -1; }
}

/* Bloqueo de scroll con el menú abierto */
html.o-lock, html.o-lock body { overflow: hidden; }

/* ==========================================================================
   Movimiento (solo si el usuario no pide reducirlo)
   ========================================================================== */
@media (prefers-reduced-motion: no-preference) {
  .o-hd__prog { will-change: transform; }
  .o-nav { transition: clip-path var(--o-dur) var(--o-ease), visibility 0s linear var(--o-dur); }
  .o-nav.is-open { transition: clip-path var(--o-dur) var(--o-ease), visibility 0s; }
  .o-nav.is-open .o-nav__top, .o-nav.is-open .o-nav__it, .o-nav.is-open .o-nav__ch {
    animation: o-in 150ms var(--o-ease) both; animation-delay: calc(var(--i, 0) * 25ms);
  }
  .o-dd__panel { transition: grid-template-rows var(--o-dur) var(--o-ease); }
  .o-dd__hl { transition: transform 150ms var(--o-ease), opacity 150ms; }
  /* Barras del chip OMIE (escritorio y móvil): crecen de abajo arriba, escalonadas (600 ms en total) */
  .o-chip .o-spark rect { animation: o-bar 300ms var(--o-ease) both; animation-delay: calc(var(--i, 0) * 12.5ms); }
  @media (min-width: 1024px) {
    .o-nav.is-open .o-nav__top, .o-nav.is-open .o-nav__it, .o-nav.is-open .o-nav__ch { animation: none; }
    .o-dd__panel, .o-dd__panel.o-mm { transition: opacity var(--o-dur) var(--o-ease), transform var(--o-dur) var(--o-ease), height var(--o-dur) var(--o-ease), visibility 0s linear var(--o-dur); }
    .o-dd__btn[aria-expanded="true"] + .o-dd__panel { transition: opacity var(--o-dur) var(--o-ease), transform var(--o-dur) var(--o-ease), height var(--o-dur) var(--o-ease), visibility 0s; }
    .o-mm__ink { transition: transform var(--o-dur) var(--o-ease), height var(--o-dur) var(--o-ease); }
    .o-mm__tab, .o-nav__a, .o-mm__ch { transition: background-color 150ms, color 150ms, border-color 150ms; }
    .o-mm__pane.is-active { animation: o-fade 150ms var(--o-ease) both; }
    /* Barra: compactación 72 → 60 px en 200 ms */
    .o-hd__in { transition: height var(--o-dur) var(--o-ease); }
    /* Subrayado que se carga (220 ms) · destello de corriente cada 6 s (1,6 s de recorrido) */
    .o-nav__a::after { transition: transform 220ms var(--o-ease); }
    .o-nav__ink { animation: o-current 6s linear 1s infinite; }
    /* ES|CA, CTA y tooltips */
    .o-hd__act > .o-seg::before { transition: transform 200ms var(--o-ease); }
    .o-hd__act > .o-seg a { transition: color 150ms; }
    .o-hd__cta { transition: background-color 150ms, transform 150ms var(--o-ease); }
    .o-hd__cta:hover { transform: translateY(-1px); }
    .o-hd__cta:hover::after { transform: translateX(120%); transition: transform 400ms var(--o-ease); }
    .o-hd__wa { transition: border-color 150ms, color 150ms; }
    [data-o-tip]::before { transition: opacity 150ms, transform 150ms var(--o-ease); }
  }
}
@keyframes o-in { from { opacity: 0; transform: translateY(-6px); } }
@keyframes o-fade { from { opacity: 0; } }
@keyframes o-bar { from { transform: scaleY(0); } }
@keyframes o-current {
  0% { transform: translateX(-120px); opacity: 1; }
  26.6% { transform: translateX(100vw); opacity: 1; }
  26.7%, 100% { transform: translateX(100vw); opacity: 0; }
}
