/* ============================================================
   Enersoc — sistema de diseño compartido
   Tokens de color/tipografía + componentes base.
   Ver docs/DESIGN.md
   ============================================================ */

:root {
  --coral: #ED6A5A;
  --amber: #F2C14E;
  --sky:   #6FB7DE;
  --leaf:  #9CC65B;
  --ink:      #2C3540;
  --ink-soft: #566170;
  --muted:    #8A8F97;
  --ground:   #FBFAF8;
  --surface:  #FFFFFF;
  --surface-2:#F4F1EC;
  --line:     #E7E2DA;
  --shadow:   0 1px 2px rgba(44,53,64,.04), 0 8px 24px rgba(44,53,64,.06);
  --accent:   var(--coral);
  --radius:   16px;
  --maxw:     1120px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
:root[data-theme="light"] {
  --ink:#2C3540; --ink-soft:#566170; --muted:#8A8F97;
  --ground:#FBFAF8; --surface:#FFFFFF; --surface-2:#F4F1EC; --line:#E7E2DA;
  --shadow: 0 1px 2px rgba(44,53,64,.04), 0 8px 24px rgba(44,53,64,.06);
}
:root[data-theme="dark"] {
  --ink:#E7EAEE; --ink-soft:#AEB6C0; --muted:#7E868F;
  --ground:#12161B; --surface:#191F26; --surface-2:#1F262F; --line:#2A323C;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 12px 30px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
img { max-width: 100%; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font-family: var(--font); line-height: 1.6; -webkit-font-smoothing: antialiased;
}
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
a { color: inherit; text-decoration: none; }
h1,h2,h3 { text-wrap: balance; margin: 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .72rem; font-weight: 700; color: var(--muted); }

/* ---- Marca ---- */
.brand { display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-logo { height: 32px; width: auto; max-width: none; display: block; }
.footer-logo { height: 34px; width: auto; display: block; margin-bottom: 12px; }

/* ---- Botones ---- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font-weight: 700; font-size: .93rem; border-radius: 999px;
  padding: 11px 20px; border: 1px solid transparent;
  transition: transform .12s ease, box-shadow .12s ease, background .12s;
  font-family: inherit;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--ink); color: var(--ground); }
.btn-primary:hover { box-shadow: var(--shadow); }
.btn-ghost { border-color: var(--line); color: var(--ink); background: var(--surface); }
.btn-accent { background: var(--coral); color: #fff; }

/* ---- Nav ---- */
header.nav {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--ground) 86%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 12px; }
.nav-links { display: flex; align-items: center; gap: 22px; }
.nav-links a { color: var(--ink-soft); font-weight: 600; font-size: .93rem; white-space: nowrap; }
.nav-links a:hover { color: var(--ink); }
.theme-toggle { background: var(--surface); border: 1px solid var(--line); color: var(--ink-soft); border-radius: 999px; width: 38px; height: 38px; cursor: pointer; display: grid; place-items: center; flex-shrink: 0; }
.theme-toggle:hover { color: var(--ink); }

/* Menú móvil: por debajo de 760px la nav no cabe en una sola fila, así que se
   pasa a un botón de hamburguesa + panel desplegable con TODO lo que había
   dentro de .nav-links (antes simplemente se ocultaban los enlaces con
   "display:none" y no quedaba ninguna forma de llegar a ellos desde el
   móvil — bug real detectado 2026-11-02). */
.nav-menu-toggle {
  display: none; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; width: 40px; height: 40px; cursor: pointer;
  align-items: center; justify-content: center; flex-shrink: 0; color: var(--ink);
}
@media (max-width: 760px) {
  .nav-menu-toggle { display: flex; }
  .nav-links {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: var(--surface); border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow); padding: 10px 24px 18px;
    max-height: 0; overflow: hidden; transition: max-height .2s ease;
  }
  .nav-links.mobile-open { max-height: 70vh; overflow-y: auto; }
  .nav-links a { padding: 12px 4px; border-bottom: 1px solid var(--line); }
  .nav-links .theme-toggle, .nav-links .nav-acceder-mini { align-self: flex-start; margin-top: 10px; }
  .nav-links .lang-selector { margin-top: 10px; }
  .nav-links .btn { justify-content: center; margin-top: 10px; }
}

/* Selector de idioma en desplegable (en vez de un enlace por idioma en la nav, que
   ocupaba mucho sitio y era la principal causa de que la nav se apretara y el texto
   de los enlaces se partiera en dos líneas). */
.lang-selector { position: relative; flex-shrink: 0; }
.lang-current {
  display: flex; align-items: center; gap: 4px; padding: 7px 10px;
  font-size: .8rem; font-weight: 700; color: var(--ink-soft); text-transform: uppercase;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  cursor: pointer; font-family: inherit;
}
.lang-current:hover { color: var(--ink); border-color: var(--ink-soft); }
.lang-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0; min-width: 130px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: 4px; display: none; z-index: 30;
}
.lang-dropdown.show { display: block; }
.lang-dropdown a { display: block; padding: 8px 12px; font-size: .85rem; font-weight: 600; border-radius: 8px; color: var(--ink-soft); white-space: nowrap; }
.lang-dropdown a:hover { background: var(--surface-2); color: var(--ink); }
.lang-dropdown a.active { color: var(--coral); }

/* Acceso profesional (login de la plataforma privada): discreto a propósito — el
   protagonismo de la nav lo tiene "Cómo ahorrar", pensado para el público general
   que llega a hacerse el autodiagnóstico, no para el acceso de técnicos/as. */
.nav-acceder-mini {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; font-size: 1rem;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  flex-shrink: 0;
}
.nav-acceder-mini:hover { color: var(--ink); border-color: var(--ink-soft); }

/* Modal "¿ya tienes cuenta?" antes de entrar al autodiagnóstico — dispara desde
   cualquier CTA con la clase .js-ahorrar-cta (nav y botones de dentro de la
   página); sin JS, el href de cada CTA sigue funcionando como enlace normal a
   /autodiagnostico. */
.gate-overlay {
  position: fixed; inset: 0; background: rgba(20,24,29,.55); backdrop-filter: blur(2px);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.gate-overlay.show { display: flex; }
.gate-modal {
  background: var(--surface); border-radius: var(--radius); padding: 32px;
  max-width: 380px; width: 100%; text-align: center; box-shadow: var(--shadow);
  position: relative;
}
.gate-modal h3 { font-size: 1.15rem; margin-bottom: 10px; }
.gate-modal p { color: var(--ink-soft); font-size: .92rem; margin: 0 0 22px; }
.gate-actions { display: flex; flex-direction: column; gap: 10px; }
.gate-actions .btn { width: 100%; justify-content: center; }
.gate-close {
  position: absolute; top: 10px; right: 12px; background: none; border: none;
  font-size: 1.3rem; line-height: 1; color: var(--muted); cursor: pointer; padding: 4px;
}
.gate-close:hover { color: var(--ink); }

/* ---- Secciones ---- */
section { padding: 72px 0; }
.sec-head { max-width: 60ch; margin-bottom: 40px; }
.sec-head h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); letter-spacing: -0.02em; font-weight: 800; text-transform: lowercase; margin-top: 10px; }
.sec-head p { color: var(--ink-soft); font-size: 1.05rem; margin: 12px 0 0; }

/* ---- Hero ---- */
.hero { position: relative; overflow: hidden; padding: 84px 0 72px; }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; gap: 40px; } }
/* El motivo decorativo (logo grande + blob) solo tiene sentido como columna
   junto al texto del hero en pantallas anchas; en una sola columna (móvil) se
   veía como un logo enorme después del texto, dando la sensación de que ahí
   se acababa la landing (detectado 2026-11-02). */
@media (max-width: 760px) { .motif { display: none; } }
.hero h1 { font-size: clamp(2.4rem, 5.2vw, 4rem); line-height: 1.02; letter-spacing: -0.03em; font-weight: 800; text-transform: lowercase; }
.hero h1 em { font-style: normal; color: var(--coral); }
.hero p.lead { font-size: 1.16rem; color: var(--ink-soft); max-width: 34ch; margin: 22px 0 30px; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.hero-note { font-size: .86rem; color: var(--muted); margin-top: 18px; }
.motif { position: relative; aspect-ratio: 1; max-width: 380px; margin: 0 auto; width: 100%; }
.motif svg { width: 100%; height: 100%; display: block; }
.blob { position: absolute; inset: 0; z-index: -1; filter: blur(60px); opacity: .5; }

/* ---- Impacto ---- */
.impact { background: var(--ink); color: var(--ground); }
.impact .stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
@media (max-width: 760px) { .impact .stats { grid-template-columns: 1fr; } }
.stat .num { font-size: clamp(2.1rem, 4.6vw, 3.1rem); font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1; }
.stat .num .u { color: var(--amber); }
.stat .lbl { color: color-mix(in srgb, var(--ground) 70%, transparent); font-size: .92rem; margin-top: 10px; }
.stat .bar { height: 3px; width: 34px; border-radius: 3px; margin-bottom: 16px; }

/* ---- Pasos ---- */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
@media (max-width: 820px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .steps { grid-template-columns: 1fr; } }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.step .ic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 18px; }
.step h3 { font-size: 1.18rem; letter-spacing: -0.01em; }
.step p { color: var(--ink-soft); font-size: .97rem; margin: 10px 0 0; }
.step .n { float: right; font-weight: 800; color: var(--line); font-size: 1.4rem; font-variant-numeric: tabular-nums; }

/* ---- Dashboard de datos ---- */
.data { background: var(--surface-2); }
.dash { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .dash { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.card h3 { font-size: 1.02rem; letter-spacing: -0.01em; }
.card .sub { color: var(--muted); font-size: .82rem; margin: 4px 0 18px; }
.legend { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.legend .row { display: flex; align-items: center; gap: 10px; font-size: .9rem; color: var(--ink-soft); }
.legend .row b { margin-left: auto; color: var(--ink); font-variant-numeric: tabular-nums; }
.dot { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.donut { width: 150px; height: 150px; border-radius: 50%; margin: 0 auto 6px; display: grid; place-items: center; }
.donut .hole { width: 92px; height: 92px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; text-align: center; }
.donut .hole b { font-size: 1.5rem; font-weight: 800; }
.donut .hole span { font-size: .72rem; color: var(--muted); display: block; }
.bars { display: flex; flex-direction: column; gap: 14px; margin-top: 6px; }
.bars .b .t { display: flex; justify-content: space-between; font-size: .88rem; margin-bottom: 6px; color: var(--ink-soft); }
.bars .b .t b { color: var(--ink); font-variant-numeric: tabular-nums; }
.track { height: 9px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.fill { height: 100%; border-radius: 6px; }
.spark { display: flex; align-items: flex-end; gap: 6px; height: 96px; margin-top: 8px; }
.spark .col { flex: 1; background: linear-gradient(var(--sky), color-mix(in srgb, var(--sky) 40%, transparent)); border-radius: 5px 5px 0 0; min-height: 6px; }
.data-note { text-align: center; color: var(--muted); font-size: .82rem; margin-top: 26px; }

/* ---- Quién lo usa ---- */
.users .chips { display: flex; flex-wrap: wrap; gap: 12px; }
.chip { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 10px 18px; font-weight: 600; color: var(--ink-soft); font-size: .95rem; }

/* ---- Noticias ---- */
.news-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
@media (max-width: 820px) { .news-grid { grid-template-columns: 1fr; } }
.news { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .14s ease; }
.news:hover { transform: translateY(-3px); }
.news .top { height: 8px; }
.news .body { padding: 22px 24px 26px; }
.news .tag { font-size: .74rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: var(--muted); }
.news h3 { font-size: 1.1rem; letter-spacing: -0.01em; margin: 10px 0; line-height: 1.25; }
.news p { color: var(--ink-soft); font-size: .93rem; margin: 0; }
.news .more { color: var(--coral); font-weight: 700; font-size: .9rem; margin-top: 14px; display: inline-block; }

/* ---- CTA + footer ---- */
.cta { text-align: center; }
.cta .box { background: linear-gradient(135deg, var(--coral), var(--amber)); border-radius: 24px; padding: 56px 32px; color: #fff; }
.cta h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); text-transform: lowercase; letter-spacing: -0.02em; font-weight: 800; }
.cta p { max-width: 52ch; margin: 14px auto 28px; font-size: 1.08rem; opacity: .96; }
.cta .btn-primary { background: #fff; color: var(--ink); }

footer.site { border-top: 1px solid var(--line); background: var(--surface); padding: 46px 0 30px; }
.foot { display: flex; justify-content: space-between; gap: 30px; flex-wrap: wrap; }
.foot .col p, .foot .col a { color: var(--ink-soft); font-size: .92rem; display: block; margin: 4px 0; }
.foot .col h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 12px; }
.foot-bottom { margin-top: 34px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: .84rem; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.umbrella { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink); }
