/* ============================================================
   HUB DE ENERGÍA — Sistema de diseño (escritorio)
   Tokens de marca, tipografía, componentes base.
   Fuente: Guidelines.pdf + Contexto Maestro.
   ============================================================ */

/* ---- Reset ligero ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; }
a { color: inherit; }
h1, h2, h3, h4, h5, h6, p, ul, ol, figure { margin: 0; }
ul { list-style: none; padding: 0; }

/* ---- Tokens ---- */
:root {
  /* Marca / componentes UI */
  --teal:        #025E73;  /* institucional, logo, footer */
  --yellow:      #FBBA13;  /* acento, menú activo, barra */
  --blue:        #007BA5;  /* CTA primario, links, H2 */
  --blue-light:  #00A4D8;  /* H1 alternativo (texto grande) */
  --blue-bright: #00A3FF;
  --ink:         #333333;  /* texto principal */
  --ink-2:       #5F5F5F;  /* texto secundario */
  --surface:     #F4F4F4;  /* fondo neutro */
  --white:       #FFFFFF;
  --line:        #EEEEEE;  /* bordes neutros */
  --line-2:      #DDDDDD;

  /* 14 colores temáticos (categorías) */
  --t-ffb538: #FFB538; /* Eficiencia */
  --t-50b18e: #50B18E; /* Renovables */
  --t-167894: #167894; /* Acceso */
  --t-8e489f: #8E489F; /* Género */
  --t-6784e2: #6784E2; /* Política */
  --t-4ed3a5: #4ED3A5; /* Solar */
  --t-b5477f: #B5477F; /* Mercados */
  --t-f75053: #F75053; /* Emisiones */
  --t-ed862a: #ED862A; /* Combustibles */
  --t-5b6c76: #5B6C76; /* Infraestructura */
  --t-8e5900: #8E5900; /* Indicadores */
  --t-145d86: #145D86; /* Integración */
  --t-2d8952: #2D8952; /* Eólica */
  --t-a9b252: #A9B252; /* Innovación */

  /* Estado */
  --ok:    #2D8952;
  --warn:  #ED862A;
  --error: #F75053;

  /* Tipografía */
  --font-title: 'Lato', system-ui, sans-serif;
  --font-body:  'Open Sans', system-ui, sans-serif;

  /* Layout */
  --container: 1140px;
  --radius: 2px;
  --shadow-tile: 2px 2px 2px rgba(0,0,0,.18);
  --shadow-tile-hover: 2px 2px 8px rgba(0,0,0,.28);
  --shadow-header: 0 2px 8px rgba(0,0,0,.12);
  --gutter: 24px;
}

/* ---- Base ---- */
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;        /* desviación AA justificada: el guideline marca 1.1; subimos para lectura larga */
  color: var(--ink-2);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.container-wide { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 24px; }

/* ---- Tipografía ---- */
.h1, h1 {
  font-family: var(--font-title); font-weight: 700;
  font-size: 46px; line-height: 1.08; color: var(--blue-light);
  letter-spacing: -.01em;
}
.h1--ink { color: var(--ink); }
.h2, h2 { font-family: var(--font-title); font-weight: 700; font-size: 35px; line-height: 1.15; color: var(--blue); }
.h3 { font-family: var(--font-title); font-weight: 400; font-size: 18px; line-height: 1.3; color: var(--blue); text-transform: uppercase; letter-spacing: .04em; }
.h4 { font-family: var(--font-title); font-weight: 700; font-size: 16px; line-height: 1.25; color: var(--ink-2); text-transform: uppercase; letter-spacing: .03em; }
.h5 { font-family: var(--font-title); font-weight: 700; font-size: 18px; line-height: 1.3; color: var(--ink); }
.h6 { font-family: var(--font-title); font-weight: 400; font-size: 11px; line-height: 1.3; color: var(--ink); text-transform: uppercase; letter-spacing: .08em; }
.p1 { font-size: 16px; color: var(--ink-2); line-height: 1.55; }
.p2 { font-size: 14px; color: var(--ink); line-height: 1.5; }
.eyebrow { font-family: var(--font-title); font-weight: 700; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.muted { color: var(--ink-2); }
.mono { font-family: 'Roboto Mono', ui-monospace, monospace; }

/* ---- Barra multicolor (firma visual junto a cada H1 interno) ---- */
.brandbar {
  width: 8px; flex: 0 0 8px; align-self: stretch; min-height: 48px;
  border-radius: 2px;
  background: linear-gradient(180deg,
    var(--teal) 0%, var(--teal) 16%,
    var(--blue-bright) 16%, var(--blue-bright) 33%,
    var(--t-2d8952) 33%, var(--t-2d8952) 50%,
    var(--t-a9b252) 50%, var(--t-a9b252) 66%,
    var(--yellow) 66%, var(--yellow) 83%,
    var(--t-ed862a) 83%, var(--t-ed862a) 100%);
}
.brandbar--h { /* horizontal, para sliders / bloques */
  width: 120px; height: 6px; flex: none; min-height: 0;
  background: linear-gradient(90deg,
    var(--teal) 0 16%, var(--blue-bright) 16% 33%, var(--t-2d8952) 33% 50%,
    var(--t-a9b252) 50% 66%, var(--yellow) 66% 83%, var(--t-ed862a) 83% 100%);
}
.pagehead { display: flex; gap: 18px; align-items: flex-start; }
.pagehead__body { flex: 1; }

/* ---- Botones ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-title); font-weight: 700; font-size: 16px; line-height: 1;
  padding: 12px 20px; border-radius: var(--radius); border: 1px solid transparent;
  text-decoration: none; transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
  min-height: 44px;
}
.btn:focus-visible { outline: 3px solid var(--blue-light); outline-offset: 2px; }
.btn--primary { background: var(--blue); color: #fff; }
.btn--primary:hover { background: #006a90; }
.btn--secondary { background: #fff; color: var(--blue); border-color: var(--blue); }
.btn--secondary:hover { background: rgba(0,123,165,.07); }
.btn--alt { background: transparent; color: #fff; border-color: #fff; text-shadow: 1px 1px 2px rgba(0,0,0,.25); }
.btn--alt:hover { background: rgba(255,255,255,.14); }
.btn--sm { padding: 8px 14px; font-size: 14px; min-height: 38px; }
.btn--block { width: 100%; }
.btn--ghost { background: transparent; color: var(--blue); border-color: transparent; padding-left: 0; padding-right: 0; }
.linkcta { color: var(--blue); font-weight: 700; text-decoration: none; font-family: var(--font-title); }
.linkcta:hover { text-decoration: underline; }

/* ---- Tags de tema ---- */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-title); font-weight: 700; font-size: 11px; letter-spacing: .06em;
  text-transform: uppercase; padding: 4px 9px; border-radius: var(--radius);
  border: 1px solid currentColor; line-height: 1.3; white-space: nowrap;
}
.tag i { font-size: 12px; }

/* ---- Chips ---- */
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 14px; font-family: var(--font-body); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 999px;
  padding: 7px 14px; text-decoration: none; transition: .14s; cursor: pointer;
}
.chip:hover { border-color: var(--blue); color: var(--blue); }
.chip--active { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip--remove i { opacity: .7; }
.chip--remove:hover { border-color: var(--error); color: var(--error); }

/* ---- Cards / tiles ---- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.tile {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  transition: box-shadow .16s, transform .16s; display: flex; flex-direction: column;
}
.tile:hover { box-shadow: var(--shadow-tile-hover); transform: translateY(-2px); }
.tile--top { border-top: 4px solid var(--blue); }

/* ---- Inputs ---- */
.field { position: relative; }
.input, .select, textarea.input {
  width: 100%; font-family: var(--font-body); font-size: 16px; color: var(--ink);
  background: #fff; border: 1px solid var(--line-2); border-radius: var(--radius);
  padding: 12px 14px; min-height: 46px; transition: border-color .15s, box-shadow .15s, filter .15s;
}
.input::placeholder { color: #9a9a9a; }
.input:focus, .select:focus, textarea.input:focus {
  outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,123,165,.15);
}
/* focus blur (guideline): al escribir, borde desenfocado + texto italic */
.input.is-typing { font-style: italic; color: #555; border-color: transparent; box-shadow: 0 0 0 3px rgba(0,123,165,.10); filter: blur(.15px); }
.input.is-typing::after { filter: none; }
.label { display: block; font-family: var(--font-title); font-weight: 700; font-size: 13px; color: var(--ink); margin-bottom: 6px; }

/* search field on hero (transparente sobre imagen) */
.search-hero {
  background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.85);
  box-shadow: 2px 2px 2px rgba(0,0,0,.25); color: #fff; backdrop-filter: blur(2px);
}
.search-hero::placeholder { color: rgba(255,255,255,.8); }
.search-hero:focus { border-color:#fff; box-shadow: 0 0 0 3px rgba(255,255,255,.3); }

/* ---- Accordion ---- */
.acc { border: 1px solid transparent; border-radius: var(--radius); overflow: hidden; margin-bottom: 10px; }
.acc__head {
  width: 100%; text-align: left; background: rgba(0,123,165,.7); color: #fff;
  padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-family: var(--font-title); font-weight: 400; font-size: 18px; border: none;
}
.acc__head .chev { transition: transform .2s; }
.acc.is-open { border-color: var(--blue); }
.acc.is-open .chev { transform: rotate(180deg); }
.acc__body { display: none; padding: 16px 18px; background: #fff; }
.acc.is-open .acc__body { display: block; }

/* ---- Tablas ---- */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-family: var(--font-title); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); padding: 10px 12px; border-bottom: 2px solid var(--line); }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--ink); }
.tbl tr:hover td { background: #fafafa; }

/* ---- Utilidades ---- */
.section { padding: 64px 0; }
.section--surface { background: var(--surface); }
.section--teal { background: var(--teal); color: #fff; }
.grid { display: grid; gap: var(--gutter); }
.cols-2 { grid-template-columns: repeat(2,1fr); }
.cols-3 { grid-template-columns: repeat(3,1fr); }
.cols-4 { grid-template-columns: repeat(4,1fr); }
.flex { display: flex; }
.between { justify-content: space-between; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.wrap { flex-wrap: wrap; }
.mt-8{margin-top:8px}.mt-12{margin-top:12px}.mt-16{margin-top:16px}.mt-24{margin-top:24px}.mt-32{margin-top:32px}.mt-48{margin-top:48px}
.mb-8{margin-bottom:8px}.mb-12{margin-bottom:12px}.mb-16{margin-bottom:16px}.mb-24{margin-bottom:24px}.mb-32{margin-bottom:32px}
.text-center { text-align: center; }
.divider { height: 1px; background: var(--line); border: 0; margin: 0; }

/* placeholder de imagen (estilo iconográfico) */
.ph {
  background:
    repeating-linear-gradient(45deg, #f0f2f4 0 10px, #e8ebee 10px 20px);
  border: 1px solid var(--line-2); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; text-align: center;
  color: #9aa3a9; font-family: 'Roboto Mono', monospace; font-size: 12px; letter-spacing: .04em;
}

/* tendencia */
.trend { font-family: var(--font-title); font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; gap: 4px; }
.trend--up { color: var(--ok); }
.trend--down { color: var(--error); }
.trend--neutral { color: var(--ink-2); }

/* skeleton */
@keyframes shimmer { 0%{background-position:-400px 0} 100%{background-position:400px 0} }
.sk { background: linear-gradient(90deg,#eee 0,#f5f5f5 40px,#eee 80px); background-size: 600px 100%; animation: shimmer 1.2s infinite linear; border-radius: var(--radius); }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; background: #eee; } }

/* sparkline */
.spark { width: 100%; height: 38px; display: block; }

/* badges */
.badge { display:inline-flex; align-items:center; gap:5px; font-size:12px; font-weight:700; font-family:var(--font-title); padding:2px 8px; border-radius:999px; }
.badge--new { background: rgba(45,137,82,.12); color: var(--ok); }

/* focus visible global */
a:focus-visible, button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--blue-light); outline-offset: 2px; border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
