/* ============================================================
   styles.css · Sistema de diseño · DIEGUIA · Diego Parrás
   Dark-first + tema claro · Space Grotesk / Inter / JetBrains Mono
   ============================================================ */

/* ---------- Tokens base ---------- */
:root {
  --f-display: 'Space Grotesk', system-ui, sans-serif;
  --f-body: 'Inter', system-ui, sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Marca */
  --orange: #ff7a18;
  --orange-2: #ff9d4d;
  /* El naranja de los botones rellenos baja un escalón. Sobre el naranja
     de marca el texto blanco queda en 2,6:1 y se lava; sobre este da
     4,6:1 y se lee. El naranja pleno sigue siendo el de la marca en
     títulos, líneas y acentos: acá cambia solo lo que lleva letra encima. */
  --orange-btn: #c94d0b;
  --orange-btn-2: #b8410a;
  --orange-soft: rgba(255, 122, 24, 0.14);

  --radius: 20px;
  --radius-lg: 28px;
  --maxw: 1180px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

/* ---------- Tema oscuro (default) ---------- */
:root,
:root[data-theme="dark"] {
  --bg: #08080b;
  --bg-2: #0d0d12;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.06);
  --surface-hover: rgba(255, 255, 255, 0.08);
  --text: #ece7de;
  --text-strong: #ffffff;
  --muted: #9a9488;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 122, 24, 0.30);
  --glow: rgba(255, 122, 24, 0.16);
  --grid-line: rgba(255, 255, 255, 0.022);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  --header-bg: rgba(8, 8, 11, 0.72);
  color-scheme: dark;
}

/* ---------- Tema claro ---------- */
:root[data-theme="light"] {
  --bg: #f5f4f0;
  --bg-2: #efece6;
  --surface: rgba(20, 16, 12, 0.025);
  --surface-2: rgba(20, 16, 12, 0.045);
  --surface-hover: rgba(20, 16, 12, 0.06);
  --text: #2a251f;
  --text-strong: #14110d;
  --muted: #6e675c;
  --line: rgba(20, 16, 12, 0.12);
  --line-strong: rgba(255, 122, 24, 0.45);
  --glow: rgba(255, 122, 24, 0.12);
  --grid-line: rgba(20, 16, 12, 0.03);
  --shadow: 0 20px 50px rgba(60, 40, 20, 0.12);
  --header-bg: rgba(245, 244, 240, 0.78);
  color-scheme: light;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--f-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
  letter-spacing: -0.003em;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* Fondo: grilla técnica + halos suaves */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
  pointer-events: none;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(60% 50% at 85% -5%, var(--glow), transparent 60%),
    radial-gradient(50% 40% at 0% 100%, var(--glow), transparent 55%);
  pointer-events: none;
}

img { max-width: 100%; display: block; }
a { color: inherit; }
::selection { background: var(--orange); color: #0b0b0b; }

/* Scrollbar */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 20px; border: 3px solid transparent; background-clip: padding-box; }

/* ---------- Layout helpers ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.section { padding: clamp(56px, 9vw, 104px) 0; }
.section--tight { padding: clamp(40px, 6vw, 68px) 0; }

/* Etiqueta mono superior (kicker) */
.kicker {
  font-family: var(--f-mono);
  font-size: .72rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--orange-2);
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
.kicker::before {
  content: "";
  width: 26px;
  height: 1px;
  background: var(--orange);
  display: inline-block;
}

/* Cabecera de sección */
.section-head { max-width: 760px; margin-bottom: 38px; }
.section-head h2 {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: clamp(1.7rem, 3.6vw, 2.7rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--text-strong);
  margin-top: 14px;
}
.section-head h2 em { color: var(--orange); font-style: normal; }
.section-head p { color: var(--muted); margin-top: 14px; font-size: 1.02rem; line-height: 1.7; }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.nav {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
  min-height: 66px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--text-strong);
  font-family: var(--f-display);
  font-weight: 600;
  font-size: .96rem;
  letter-spacing: -0.01em;
  flex: 0 0 auto;
}
.brand .mark {
  width: 34px; height: 34px; border-radius: 11px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: linear-gradient(140deg, #ffc187, #ff4d00);
  color: #1b0e04;
  box-shadow: 0 6px 18px rgba(255, 92, 0, 0.32);
  transition: transform .25s ease, box-shadow .25s ease;
}
.brand .mark .logo { width: 21px; height: 21px; display: block; }
/* El haz se enciende al pasar por la marca. */
.brand:hover .mark { transform: rotate(-6deg) scale(1.05); box-shadow: 0 8px 24px rgba(255, 92, 0, 0.45); }
.brand:hover .mark .logo path[opacity] { opacity: .95; }
.brand .mark .logo path[opacity] { transition: opacity .25s ease; }

/* El IA de DIEGUIA: el juego de palabras se ve. */
.ia {
  font-weight: inherit;
  background: linear-gradient(135deg, #ffb066, #ff4d00);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .ia { background: none; -webkit-text-fill-color: currentColor; color: var(--orange); }
}

.brand small { display: block; color: var(--muted); font-weight: 400; font-size: .72rem; font-family: var(--f-body); }

.navlinks {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.navlinks a {
  position: relative;
  text-decoration: none;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 500;
  padding: 8px 11px;
  border-radius: 10px;
  transition: color .2s, background .2s;
  white-space: nowrap;
}
.navlinks a:hover { color: var(--text-strong); background: var(--surface-2); }
.navlinks a[aria-current="page"] { color: var(--orange-2); }
.navlinks a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 11px; right: 11px; bottom: 2px;
  height: 2px; border-radius: 2px;
  background: var(--orange);
}

/* Grupos desplegables (dropdown) */
.navgroup { position: relative; display: inline-flex; }
.navgroup-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--f-body);
  font-size: .86rem;
  font-weight: 500;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 8px 11px;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: color .2s, background .2s;
}
.navgroup-btn:hover { color: var(--text-strong); background: var(--surface-2); }
.navgroup-btn .chev { width: 13px; height: 13px; opacity: .8; transition: transform .25s var(--ease); }
.navgroup:hover .navgroup-btn .chev,
.navgroup.open .navgroup-btn .chev { transform: rotate(180deg); }
.navgroup.active > .navgroup-btn { color: var(--orange-2); }
/* puente invisible para no perder el hover en el espacio botón→menú */
.navgroup::after { content: ""; position: absolute; top: 100%; left: 0; right: 0; height: 10px; }
.submenu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  display: flex;
  flex-direction: column;
  min-width: 200px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 7px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .2s var(--ease), transform .2s var(--ease), visibility .2s;
  z-index: 120;
}
.navgroup:hover .submenu,
.navgroup:focus-within .submenu,
.navgroup.open .submenu { opacity: 1; visibility: visible; transform: translateY(0); }
.submenu a {
  display: block;
  padding: 9px 12px;
  border-radius: 9px;
  color: var(--muted);
  font-size: .88rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color .2s, background .2s;
}
.submenu a:hover { color: var(--text-strong); background: var(--surface-2); }
.submenu a[aria-current="page"] { color: var(--orange-2); background: var(--orange-soft); }

/* Botón de tema */
.theme-toggle {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .2s;
  margin-left: 6px;
}
.theme-toggle:hover { border-color: var(--line-strong); background: var(--surface-hover); transform: translateY(-1px); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* Hamburguesa */
.hamburger {
  display: none;
  flex: 0 0 auto;
  width: 40px; height: 38px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
  cursor: pointer;
  padding: 0;
  position: relative;
}
.hamburger span {
  position: absolute; left: 10px; right: 10px; height: 2px;
  background: var(--text); border-radius: 2px; transition: .26s var(--ease);
}
.hamburger span:nth-child(1) { top: 13px; }
.hamburger span:nth-child(2) { top: 18px; }
.hamburger span:nth-child(3) { top: 23px; }
.nav.open .hamburger span:nth-child(1) { top: 18px; transform: rotate(45deg); }
.nav.open .hamburger span:nth-child(2) { opacity: 0; }
.nav.open .hamburger span:nth-child(3) { top: 18px; transform: rotate(-45deg); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-family: var(--f-body);
  font-weight: 500;
  font-size: .92rem;
  padding: 11px 18px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  color: var(--text-strong);
  background: var(--surface-2);
  cursor: pointer;
  transition: transform .2s var(--ease), background .2s, border-color .2s, box-shadow .2s;
}
.btn:hover { transform: translateY(-2px); background: var(--surface-hover); }
.btn.primary {
  background: linear-gradient(135deg, var(--orange-btn), var(--orange-btn-2));
  border-color: transparent;
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 10px 28px rgba(255, 92, 0, 0.24);
}
.btn.primary:hover { box-shadow: 0 16px 36px rgba(255, 92, 0, 0.4); }
.btn.ghost { background: transparent; }

/* ---------- Hero ---------- */
.hero { padding: clamp(54px, 8vw, 96px) 0 clamp(40px, 6vw, 72px); position: relative; }
.hero h1 {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: clamp(2.3rem, 6.4vw, 4.6rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  color: var(--text-strong);
  margin-top: 22px;
  max-width: 16ch;
}
.hero h1 .grad {
  background: linear-gradient(110deg, var(--orange-2), var(--orange) 45%, #ff4d00);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.hero .lead {
  margin-top: 24px;
  max-width: 60ch;
  font-size: clamp(1.02rem, 1.6vw, 1.18rem);
  color: var(--muted);
  line-height: 1.7;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 52px;
}
.stat {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 20px;
  background: var(--surface);
  backdrop-filter: blur(8px);
}
.stat b {
  font-family: var(--f-display);
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  color: var(--orange-2);
  display: block;
  letter-spacing: -0.02em;
  line-height: 1;
}
.stat span { color: var(--muted); font-size: .86rem; display: block; margin-top: 10px; line-height: 1.5; }

/* ---------- Tarjetas / paneles ---------- */
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 30px;
  background: var(--surface);
  backdrop-filter: blur(8px);
}
.panel h2, .panel h3 { font-family: var(--f-display); color: var(--text-strong); letter-spacing: -0.01em; }
.panel h3 { font-size: 1.18rem; }
.panel p, .panel li { color: var(--text); line-height: 1.7; }
.panel p + p { margin-top: 14px; }
.panel ul { margin: 14px 0 0; padding-left: 20px; }
.panel ul li { margin-bottom: 8px; color: var(--muted); }
.panel strong { color: var(--orange-2); font-weight: 600; }

/* Grilla genérica de paneles */
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }

/* Grilla auto-ajustable (módulos compactos) */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
}
.module {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  background: var(--surface);
  transition: border-color .25s, transform .25s, background .25s;
}
.module:hover { border-color: var(--line-strong); transform: translateY(-3px); background: var(--surface-2); }
.module b {
  color: var(--text-strong);
  display: block;
  margin-bottom: 8px;
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 1.04rem;
  letter-spacing: -0.01em;
}
.module > span { color: var(--muted); line-height: 1.6; font-size: .92rem; display: block; }
.module strong { color: var(--orange-2); font-weight: 600; }
.module .meta-line {
  margin-top: 12px;
  color: var(--orange);
  font-family: var(--f-mono);
  font-size: .74rem;
  font-weight: 500;
  letter-spacing: .01em;
}
.module .pill {
  display: inline-block;
  margin-bottom: 12px;
  padding: 3px 11px;
  border-radius: 999px;
  background: var(--orange-soft);
  border: 1px solid var(--line-strong);
  color: var(--orange-2);
  font-family: var(--f-mono);
  font-size: .66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .12em;
}
/* Tarjeta módulo clicleable hacia su fuente */
a.module { text-decoration: none; color: inherit; cursor: pointer; position: relative; }
a.module::after {
  content: "↗";
  position: absolute;
  top: 16px; right: 16px;
  color: var(--muted);
  font-size: .82rem;
  transition: color .2s, transform .2s;
}
a.module:hover::after { color: var(--orange-2); transform: translate(2px, -2px); }
a.module .meta-line { padding-right: 18px; }
/* Enlaces dentro de prosa (timeline, etc.) */
.era-body a { color: var(--orange-2); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color .2s; }
.era-body a:hover { border-bottom-color: var(--orange-2); }

/* Nota / callout */
.map-note {
  border: 1px solid var(--line-strong);
  background: var(--orange-soft);
  border-radius: var(--radius);
  padding: 18px 22px;
  color: var(--text);
  line-height: 1.65;
  margin-bottom: 22px;
  font-size: .95rem;
}
.map-note strong { color: var(--orange-2); }

/* Caja de actualidad destacada */
.flash {
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, var(--orange-soft), transparent);
  border-radius: var(--radius-lg);
  padding: 28px 30px;
  line-height: 1.7;
  position: relative;
  overflow: hidden;
}
.flash::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(var(--orange), #ff4d00);
}
.flash .flash-tag {
  display: inline-block;
  margin-bottom: 12px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--orange);
  color: #0b0b0b;
  font-family: var(--f-mono);
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
}
.flash h3 { margin: 4px 0 10px; font-family: var(--f-display); color: var(--text-strong); font-size: 1.34rem; letter-spacing: -0.01em; }
.flash p { color: var(--text); }
.flash p + p { margin-top: 13px; }
.flash strong { color: var(--orange-2); }
.flash a { color: var(--orange-2); font-weight: 600; }

/* ---------- Cards de navegación (hub) ---------- */
.nav-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 16px; }
.nav-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 26px;
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color .25s, transform .25s, background .25s, box-shadow .25s;
  position: relative;
}
.nav-card:hover { border-color: var(--line-strong); transform: translateY(-4px); background: var(--surface-2); box-shadow: var(--shadow); }
.nav-card .nc-idx { font-family: var(--f-mono); font-size: .74rem; color: var(--orange); letter-spacing: .1em; }
.nav-card h3 { font-family: var(--f-display); font-weight: 600; font-size: 1.28rem; color: var(--text-strong); letter-spacing: -0.01em; }
.nav-card p { color: var(--muted); font-size: .92rem; line-height: 1.6; }
.nav-card .nc-go { margin-top: auto; color: var(--orange-2); font-weight: 600; font-size: .9rem; display: inline-flex; align-items: center; gap: 6px; transition: gap .2s; }
.nav-card:hover .nc-go { gap: 11px; }

/* ---------- Filtros (search + selects) ---------- */
.filters {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 10px;
  margin-bottom: 18px;
}
.filters input, .filters select {
  font-family: var(--f-body);
  font-size: .92rem;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  width: 100%;
}
.filters input::placeholder { color: var(--muted); }
.filters input:focus, .filters select:focus { outline: none; border-color: var(--orange); }
.clear-btn {
  font-family: var(--f-body);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  border-radius: 12px;
  padding: 11px 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: color .2s, border-color .2s;
}
.clear-btn:hover { color: var(--text-strong); border-color: var(--line-strong); }
.counter { font-family: var(--f-mono); font-size: .78rem; color: var(--muted); margin-bottom: 16px; }

/* ---------- Grilla de papers ---------- */
.repo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.paper {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color .25s, transform .25s, background .25s;
}
.paper:hover { border-color: var(--line-strong); transform: translateY(-3px); background: var(--surface-2); }
.paper-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.paper .year { font-family: var(--f-mono); font-size: .72rem; color: var(--orange); font-weight: 600; }
.paper .ptype {
  font-family: var(--f-mono);
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 9px;
}
.paper h3 { font-family: var(--f-display); font-size: 1.05rem; color: var(--text-strong); line-height: 1.25; letter-spacing: -0.01em; }
.paper .authors { font-size: .82rem; color: var(--orange-2); font-weight: 500; }
.paper .why { font-size: .9rem; color: var(--muted); line-height: 1.6; }
.paper a.paper-link { margin-top: auto; font-size: .85rem; color: var(--orange-2); font-weight: 600; text-decoration: none; }
.paper a.paper-link:hover { text-decoration: underline; }

/* ---------- Grilla de plataformas ---------- */
.platform-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.platform-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color .25s, transform .25s, background .25s;
}
.platform-card:hover { border-color: var(--line-strong); transform: translateY(-3px); background: var(--surface-2); }
.platform-card .pc-head { display: flex; justify-content: space-between; align-items: start; gap: 10px; }
.platform-card h3 { font-family: var(--f-display); font-size: 1.12rem; color: var(--text-strong); letter-spacing: -0.01em; }
.platform-card .company { font-size: .82rem; color: var(--orange-2); }
.platform-card .region {
  font-family: var(--f-mono); font-size: .62rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; white-space: nowrap;
}
.platform-card .access { font-size: .8rem; color: var(--muted); font-family: var(--f-mono); }
.platform-card .note { font-size: .9rem; color: var(--text); line-height: 1.6; }
.platform-card .links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 6px; }
.platform-card .links a {
  font-size: .78rem; color: var(--orange-2); text-decoration: none; font-weight: 500;
  border: 1px solid var(--line); border-radius: 9px; padding: 5px 10px; transition: border-color .2s, background .2s;
}
.platform-card .links a:hover { border-color: var(--line-strong); background: var(--surface-2); }

/* ---------- Grilla de sitios ---------- */
.sites-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.site-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color .25s, transform .25s, background .25s;
}
.site-card:hover { border-color: var(--line-strong); transform: translateY(-3px); background: var(--surface-2); }
.site-card .cat { font-family: var(--f-mono); font-size: .64rem; text-transform: uppercase; letter-spacing: .1em; color: var(--orange); }
.site-card h3 { font-family: var(--f-display); font-size: 1.06rem; color: var(--text-strong); }
.site-card p { font-size: .88rem; color: var(--muted); line-height: 1.55; }
.site-card .go { margin-top: auto; font-size: .82rem; color: var(--orange-2); font-weight: 600; }

/* ---------- Timeline (historia) ---------- */
.timeline { display: flex; flex-direction: column; gap: 0; position: relative; }
.era-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 24px;
  padding: 26px 0;
  border-top: 1px solid var(--line);
  position: relative;
}
.era-row:last-child { border-bottom: 1px solid var(--line); }
.era-row .era-year { font-family: var(--f-mono); color: var(--orange); font-size: .92rem; font-weight: 600; letter-spacing: .02em; }
.era-row .era-body h3 { font-family: var(--f-display); font-size: 1.3rem; color: var(--text-strong); margin-bottom: 8px; letter-spacing: -0.01em; }
.era-row .era-body p { color: var(--muted); line-height: 1.7; }
.era-row:hover .era-year { color: var(--orange-2); }

/* ---------- Módulos de diplomatura ---------- */
.module-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }

/* Author / frameworks */
.author { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; }
.author-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.author-tag {
  font-family: var(--f-mono); font-size: .68rem; color: var(--orange-2);
  border: 1px solid var(--line-strong); border-radius: 999px; padding: 4px 11px; background: var(--orange-soft);
}
.author-cta { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.framework-list { display: flex; flex-direction: column; gap: 14px; margin-top: 4px; }
.framework b { display: block; color: var(--orange-2); font-family: var(--f-display); font-weight: 600; margin-bottom: 4px; }
.framework span { color: var(--muted); font-size: .9rem; line-height: 1.55; }

/* ---------- CTA ---------- */
.cta {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: clamp(32px, 5vw, 56px);
  background: linear-gradient(150deg, var(--orange-soft), transparent 70%);
  text-align: center;
}
.cta h2 { font-family: var(--f-display); font-weight: 600; font-size: clamp(1.5rem, 3.4vw, 2.3rem); color: var(--text-strong); margin: 14px auto; max-width: 22ch; line-height: 1.12; letter-spacing: -0.02em; }
.cta h2 em { color: var(--orange); font-style: normal; }
.cta p { color: var(--muted); max-width: 62ch; margin: 0 auto; line-height: 1.7; }
.cta .hero-actions { justify-content: center; }

/* ---------- Notice institucional ---------- */
.notice {
  border: 1px solid var(--line);
  border-left: 3px solid var(--orange);
  border-radius: 14px;
  padding: 16px 20px;
  background: var(--surface);
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.6;
  margin-top: 26px;
}
.notice strong { color: var(--orange-2); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-2); margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 30px; padding: 52px 0 28px; }
.site-footer h3 { font-family: var(--f-display); font-size: 1.02rem; color: var(--text-strong); margin-bottom: 14px; }
.site-footer p { color: var(--muted); font-size: .9rem; line-height: 1.6; }
.site-footer p.small { font-size: .82rem; margin-top: 10px; }
.site-footer a { display: block; color: var(--muted); text-decoration: none; font-size: .9rem; padding: 5px 0; transition: color .2s; }
.site-footer a:hover { color: var(--orange-2); }
.footer-meta {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  padding: 20px 0; border-top: 1px solid var(--line);
  font-family: var(--f-mono); font-size: .76rem; color: var(--muted);
}

/* ---------- To-top ---------- */
.to-top {
  position: fixed; bottom: 24px; right: 24px;
  width: 46px; height: 46px; border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  color: var(--text);
  cursor: pointer; font-size: 1.1rem;
  opacity: 0; pointer-events: none;
  transition: opacity .3s, transform .2s, background .2s;
  z-index: 90;
}
.to-top.show { opacity: 1; pointer-events: auto; }
.to-top:hover { background: var(--orange-btn); color: #ffffff; transform: translateY(-3px); }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; }
  .author { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 22px; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters input { grid-column: 1 / -1; }
  .era-row { grid-template-columns: 1fr; gap: 8px; }

  .hamburger { display: block; order: 3; }
  .theme-toggle { order: 2; margin-left: auto; }
  .navlinks {
    order: 4;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height .34s var(--ease), opacity .26s, padding .26s;
    margin: 0 -24px;
    padding: 0 24px;
  }
  .nav.open .navlinks { max-height: 80vh; overflow-y: auto; opacity: 1; padding: 8px 24px 16px; }
  .navlinks a { padding: 14px 6px; font-size: 1rem; border-bottom: 1px solid var(--line); border-radius: 0; }
  .navlinks a[aria-current="page"]::after { display: none; }
  .navlinks a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--orange); padding-left: 14px; }

  /* Grupos como acordeón (no hay hover en touch) */
  .navgroup { display: block; width: 100%; }
  .navgroup::after { display: none; }
  .navgroup-btn {
    width: 100%;
    justify-content: space-between;
    padding: 14px 6px;
    font-size: 1rem;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
  }
  .navgroup.active > .navgroup-btn { box-shadow: inset 3px 0 0 var(--orange); padding-left: 12px; }
  .submenu {
    position: static;
    min-width: 0;
    background: none;
    border: 0;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    opacity: 1;
    visibility: visible;
    transform: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s var(--ease);
  }
  .navgroup.open .submenu { max-height: 360px; }
  .navlinks .submenu a { padding: 13px 6px 13px 24px; font-size: .96rem; color: var(--muted); }
  .navlinks .submenu a[aria-current="page"] { color: var(--orange-2); background: none; box-shadow: inset 3px 0 0 var(--orange); padding-left: 22px; }
}
@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr; }
  .hero-actions .btn { width: 100%; justify-content: center; }
  .panel { padding: 22px; }
  .footer-meta { flex-direction: column; }
}

/* ---------- Print ---------- */
@media print {
  .site-header, .to-top, .filters, .hero-actions, .theme-toggle { display: none !important; }
  body::before, body::after { display: none; }
  * { color: #000 !important; background: #fff !important; }
}

/* ============================================================
   DIEGUIA · capa viva
   Datos que el motor mantiene al día. Siempre identificados
   como automáticos, para no confundirlos con lo curado.
   ============================================================ */

/* Sello de frescura en el footer */
.vivo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--orange-2);
}
.vivo i {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 0 rgba(255, 122, 24, 0.6);
  animation: latido 2.4s ease-out infinite;
}
@keyframes latido {
  0%   { box-shadow: 0 0 0 0 rgba(255, 122, 24, 0.55); }
  70%  { box-shadow: 0 0 0 7px rgba(255, 122, 24, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 122, 24, 0); }
}

/* Grilla del radar */
.radar-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 16px;
}
.radar-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  background: var(--surface);
  backdrop-filter: blur(8px);
  min-width: 0;
}
.radar-panel h3 {
  font-family: var(--f-display);
  font-size: 1.06rem;
  color: var(--text-strong);
  margin-bottom: 14px;
  letter-spacing: -0.01em;
}
.radar-panel .r-pie {
  margin-top: 14px;
  font-size: .78rem;
  color: var(--muted);
  font-family: var(--f-mono);
}

/* Tabla de modelos */
.radar-tabla { width: 100%; border-collapse: collapse; font-size: .9rem; }
.radar-tabla th {
  text-align: left;
  font-family: var(--f-mono);
  font-size: .66rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  font-weight: 600;
  padding: 0 8px 9px;
  border-bottom: 1px solid var(--line);
}
.radar-tabla td { padding: 9px 8px; border-bottom: 1px solid var(--line); }
.radar-tabla tr:last-child td { border-bottom: none; }
.radar-tabla .r-pos { color: var(--muted); font-family: var(--f-mono); font-size: .76rem; width: 22px; }
.radar-tabla .r-nom { color: var(--text-strong); font-weight: 500; }
.radar-tabla .r-idx { color: var(--orange-2); font-family: var(--f-mono); font-weight: 600; text-align: right; }
.radar-tabla .r-pre { color: var(--muted); font-family: var(--f-mono); font-size: .78rem; text-align: right; white-space: nowrap; }
.radar-tabla tbody tr:hover td { background: var(--surface-2); }

/* Papers del día */
.r-papers { display: flex; flex-direction: column; gap: 2px; }
.r-paper {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 9px 8px;
  border-radius: 10px;
  text-decoration: none;
  transition: background .2s;
}
.r-paper:hover { background: var(--surface-2); }
.r-votos {
  flex: 0 0 auto;
  min-width: 30px;
  text-align: center;
  font-family: var(--f-mono);
  font-size: .72rem;
  font-weight: 600;
  color: var(--orange-2);
  background: var(--orange-soft);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 2px 5px;
}
.r-tit { color: var(--text); font-size: .88rem; line-height: 1.45; }
.r-paper:hover .r-tit { color: var(--text-strong); }

/* Estado de carga */
.radar-cargando {
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  padding: 34px;
  text-align: center;
  color: var(--muted);
  font-family: var(--f-mono);
  font-size: .84rem;
}

@media (max-width: 860px) {
  .radar-grid { grid-template-columns: 1fr; }
  .radar-tabla .r-pre { display: none; }
  .radar-tabla th:last-child { display: none; }
}

/* ---------- Entradas aprobadas (capa amarilla de DIEGUIA) ---------- */
.entradas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.entrada {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(8px);
  padding: 20px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color .2s ease, transform .2s ease;
}
.entrada:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.entrada .e-meta {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: .74rem; font-family: var(--f-mono); color: var(--muted);
}
.entrada .e-fuente {
  padding: 2px 8px; border-radius: 99px;
  border: 1px solid var(--line); color: var(--muted);
}
.entrada h3 {
  margin: 0; font-family: var(--f-display); font-size: 1.05rem;
  font-weight: 600; color: var(--text-strong); line-height: 1.3; letter-spacing: -0.01em;
}
.entrada p { margin: 0; font-size: .92rem; line-height: 1.6; color: var(--text); }
.entrada a {
  margin-top: auto; font-size: .82rem; font-family: var(--f-mono);
  color: var(--orange); text-decoration: none;
}
.entrada a:hover { text-decoration: underline; }

/* ---------- Entradas aprobadas (capa amarilla de DIEGUIA) ---------- */
.entradas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.entrada {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(8px);
  padding: 20px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color .2s ease, transform .2s ease;
}
.entrada:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.entrada .e-meta {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: .74rem; font-family: var(--f-mono); color: var(--muted);
}
.entrada .e-fuente {
  padding: 2px 8px; border-radius: 99px;
  border: 1px solid var(--line); color: var(--muted);
}
.entrada h3 {
  margin: 0; font-family: var(--f-display); font-size: 1.05rem;
  font-weight: 600; color: var(--text-strong); line-height: 1.3; letter-spacing: -0.01em;
}
.entrada p { margin: 0; font-size: .92rem; line-height: 1.6; color: var(--text); }
.entrada a {
  margin-top: auto; font-size: .82rem; font-family: var(--f-mono);
  color: var(--orange); text-decoration: none;
}
.entrada a:hover { text-decoration: underline; }

/* ---------- Encabezado de mes en las grillas cronológicas ---------- */
.mes-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin: 44px 0 18px;
}
/* El primero va pegado a su encabezado de sección. Se apunta por el
   hermano previo: :first-of-type mira el tipo de elemento, no la clase,
   y antes de la grilla hay otro div. */
.section-head + .mes-head { margin-top: 0; }
.mes-head h3 {
  margin: 0;
  font-family: var(--f-display);
  font-size: 1.32rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text-strong);
  white-space: nowrap;
}
/* El año pesa menos que el mes: dentro de una misma página casi
   siempre es el mismo, y repetirlo con fuerza cansa la lectura. */
.mes-head h3 span {
  font-family: var(--f-mono);
  font-size: .82rem;
  font-weight: 400;
  color: var(--muted);
  margin-left: 4px;
}
.mes-linea {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line-strong), var(--line) 45%, transparent);
}
/* auto-fill en vez de auto-fit: con auto-fit las columnas vacías se
   colapsan y las tarjetas se estiran, así que un mes con una sola
   novedad la mostraba de 1132 px y otro de tres las hacía más anchas
   que las del mes siguiente. Con auto-fill todos los meses miden igual. */
.mes-head + .info-grid {
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.mes-cuenta {
  flex: 0 0 auto;
  font-family: var(--f-mono);
  font-size: .72rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 3px 10px;
}
@media (max-width: 560px) {
  .mes-head { gap: 12px; }
  .mes-head + .info-grid + .mes-head { margin-top: 34px; }
  .mes-head h3 { font-size: 1.14rem; }
}

/* ---------- Línea de tiempo con filtros ---------- */
.filtros {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 30px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-family: var(--f-mono);
  font-size: .78rem;
  cursor: pointer;
  transition: color .18s ease, border-color .18s ease, background .18s ease;
}
.chip:hover:not(:disabled) { color: var(--text-strong); border-color: var(--line-strong); }
.chip:disabled { opacity: .4; cursor: default; }
.chip[aria-pressed="true"] {
  color: #1b0e04;
  background: linear-gradient(140deg, #ffc187, #ff7a18);
  border-color: transparent;
  font-weight: 600;
}
.chip-n {
  font-size: .7rem;
  opacity: .72;
  font-variant-numeric: tabular-nums;
}

.lt-mes {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 26px;
  padding: 26px 0;
  border-top: 1px solid var(--line);
}
.lt-mes:first-child { border-top: 0; padding-top: 0; }
.lt-mes[hidden] { display: none; }

/* La marca del mes acompaña el scroll de sus propias novedades: en julio
   hay diecisiete y sin esto se pierde de vista a la tercera fila.
   El desplazamiento arranca debajo del encabezado del sitio. */
.lt-marca {
  position: sticky;
  top: 96px;
  align-self: start;
}
.lt-marca h3 {
  margin: 0;
  font-family: var(--f-display);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--text-strong);
}
.lt-marca h3 span {
  display: block;
  font-family: var(--f-mono);
  font-size: .78rem;
  font-weight: 400;
  color: var(--orange);
  margin-top: 4px;
}
.lt-cuenta {
  display: block;
  margin-top: 10px;
  font-family: var(--f-mono);
  font-size: .72rem;
  color: var(--muted);
}
.lt-cuenta b { color: var(--text-strong); font-weight: 600; }

.lt-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
  gap: 14px;
  align-content: start;
}
.lt-items .module[hidden] { display: none; }
.lt-vacio {
  padding: 40px 0;
  text-align: center;
  color: var(--muted);
  font-size: .92rem;
}

@media (max-width: 820px) {
  /* En una columna la marca deja de ser columna y pasa a ser rótulo:
     pegada arriba estorbaría la lectura en una pantalla angosta. */
  .lt-mes { grid-template-columns: 1fr; gap: 14px; padding: 22px 0; }
  .lt-marca { position: static; display: flex; align-items: baseline; gap: 12px; }
  .lt-marca h3 { font-size: 1.24rem; }
  .lt-marca h3 span { display: inline; margin-left: 6px; }
  .lt-cuenta { margin-top: 0; }
  .filtros { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; margin-bottom: 22px; }
  .chip { flex: 0 0 auto; }
}

/* ---------- Gráficos en vivo ---------- */
.grafico {
  position: relative;
  margin: 0;
  padding: 22px 20px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(8px);
}
.g-cargando { color: var(--muted); font-family: var(--f-mono); font-size: .82rem; padding: 40px 0; text-align: center; }
.g-svg { width: 100%; height: auto; display: block; overflow: visible; }

/* Grilla y ejes recesivos: hairlines sólidas, un tono sobre el fondo. */
.g-grid { stroke: var(--line); stroke-width: 1; }
.g-tick { fill: var(--muted); font-family: var(--f-mono); font-size: 11px; text-anchor: middle; font-variant-numeric: tabular-nums; }
.g-tick-y { text-anchor: end; }
.g-eje { fill: var(--muted); font-family: var(--f-body); font-size: 12px; text-anchor: middle; }

.g-frontera-linea { fill: none; stroke: var(--orange); stroke-width: 1.5; stroke-opacity: .38; }

/* El punto destacado lleva el naranja de marca; el resto queda de
   contexto. Separación verificada para daltonismo (ΔE 12,6). */
.g-dot { fill: #8b8781; stroke: var(--bg); stroke-width: 2; transition: r .15s ease; }
.g-punto.es-clave .g-dot { fill: var(--orange); }
.g-hit { fill: transparent; }
.g-punto { cursor: pointer; outline: none; }
.g-punto.activo .g-dot, .g-punto:focus-visible .g-dot { r: 9; }
.g-manta { cursor: crosshair; }
.g-punto:focus-visible .g-dot { stroke: var(--orange-2); stroke-width: 2.5; }
.g-etiqueta { fill: var(--text-strong); font-family: var(--f-display); font-size: 12px; font-weight: 600; pointer-events: none; }

.g-tip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  min-width: 150px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--bg-2);
  box-shadow: var(--shadow);
}
.g-tip-tit { font-family: var(--f-display); font-size: .88rem; font-weight: 600; color: var(--text-strong); margin-bottom: 6px; }
/* El número manda y la etiqueta acompaña: quien mira ya sabe qué modelo es. */
.g-tip-fila { display: flex; justify-content: space-between; gap: 14px; font-size: .78rem; line-height: 1.7; }
.g-tip-fila b { color: var(--text-strong); font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.g-tip-fila span { color: var(--muted); }

.g-leyenda { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 14px; font-size: .76rem; color: var(--muted); }
.g-lg { display: inline-flex; align-items: center; gap: 7px; }
.g-lg i { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.lg-clave { background: var(--orange); }
.lg-resto { background: #8b8781; }

.g-barras { display: flex; flex-direction: column; gap: 7px; }
.g-barra {
  display: grid;
  grid-template-columns: minmax(96px, 190px) 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 5px 6px;
  border-radius: 10px;
  outline: none;
  transition: background .15s ease;
}
.g-barra:hover, .g-barra:focus-visible { background: var(--surface-2); }
.g-barra:focus-visible { box-shadow: 0 0 0 2px var(--orange-2); }
.gb-nombre { font-size: .84rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gb-pista { height: 9px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.gb-pista i { display: block; height: 100%; border-radius: 99px; background: #c25200; }
.g-barra.es-clave .gb-pista i { background: linear-gradient(90deg, #ffab5c, var(--orange)); }
.g-barra.es-clave .gb-nombre { color: var(--text-strong); font-weight: 600; }
.gb-valor { font-family: var(--f-mono); font-size: .82rem; color: var(--text-strong); font-variant-numeric: tabular-nums; }

.g-pie, .g-fuente { margin: 14px 0 0; font-size: .74rem; color: var(--muted); font-family: var(--f-mono); }
.g-fuente a { color: var(--orange); text-decoration: none; }
.g-fuente a:hover { text-decoration: underline; }

.g-tabla { margin-top: 16px; }
.g-tabla summary { cursor: pointer; font-family: var(--f-mono); font-size: .76rem; color: var(--muted); }
.g-tabla summary:hover { color: var(--text-strong); }
.g-tabla table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: .8rem; }
.g-tabla th, .g-tabla td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--line); }
.g-tabla th { font-family: var(--f-mono); font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.g-tabla td:nth-child(n+3) { font-family: var(--f-mono); text-align: right; font-variant-numeric: tabular-nums; }
.g-tabla th:nth-child(n+3) { text-align: right; }

@media (max-width: 620px) {
  .grafico { padding: 16px 12px 14px; }
  .g-barra { grid-template-columns: minmax(84px, 1fr) 1.1fr auto; gap: 8px; }
  .gb-nombre { font-size: .78rem; }
}

/* ---------- Análisis anteriores, guardados sin perderse ---------- */
.mas-analisis { margin-top: 20px; }
.mas-analisis > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: var(--f-mono);
  font-size: .82rem;
  color: var(--muted);
  list-style: none;
  transition: color .18s ease, border-color .18s ease;
}
.mas-analisis > summary::-webkit-details-marker { display: none; }
.mas-analisis > summary:hover { color: var(--text-strong); border-color: var(--line-strong); }
.mas-analisis > summary b {
  margin-left: auto;
  font-size: .72rem;
  color: var(--orange);
  border: 1px solid var(--line-strong);
  border-radius: 99px;
  padding: 2px 9px;
}
/* La flecha gira al abrir: el signo de que hay algo debajo. */
.mas-analisis > summary::before {
  content: '';
  width: 8px; height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform .2s var(--ease);
  flex: 0 0 auto;
}
.mas-analisis[open] > summary::before { transform: rotate(45deg); }
.mas-cuerpo { padding-top: 18px; }

/* ---------- Rápido y al pie ---------- */
.rap-cifras {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.rap-tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(8px);
}
.rap-et { font-family: var(--f-mono); font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
/* Cifra grande con figuras proporcionales: tabulares se ven flojas a este tamaño. */
.rap-v {
  font-family: var(--f-display);
  font-size: 2.3rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text-strong);
  margin-top: 6px;
}
.rap-n { font-size: .92rem; color: var(--text-strong); font-weight: 600; }
.rap-p { font-size: .78rem; color: var(--muted); line-height: 1.5; }

.rap-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 14px; }
.rap-panel {
  padding: 22px 20px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(8px);
}
.rap-panel h3 {
  margin: 0 0 16px;
  font-family: var(--f-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-strong);
}
.rap-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.rap-lista li { display: flex; flex-direction: column; gap: 2px; padding-left: 14px; position: relative; }
.rap-lista li::before {
  content: '';
  position: absolute; left: 0; top: 8px;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--orange);
}
.rap-lista a { color: var(--text-strong); text-decoration: none; font-size: .92rem; line-height: 1.45; }
.rap-lista a:hover { color: var(--orange); }
.rap-cuando { font-family: var(--f-mono); font-size: .68rem; color: var(--muted); }
.rap-vacio { color: var(--muted); font-size: .88rem; margin: 0; }

@media (max-width: 860px) {
  .rap-grid { grid-template-columns: 1fr; }
  .rap-v { font-size: 2rem; }
}

/* Las que trajo DIEGUIA se distinguen de las escritas a mano. */
.module.es-nueva { border-color: var(--line-strong); }
.module.es-nueva .pill { background: var(--orange-soft); color: var(--orange-2); }

.papers-sello { margin: 6px 0 0; font-family: var(--f-mono); font-size: .74rem; color: var(--orange); }

/* ---------- El archivo ---------- */
.arch-dias { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 26px; }
.arch-mes { width: 100%; margin: 12px 0 4px; font-family: var(--f-mono); font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.arch-dia { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 64px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--muted); font-family: var(--f-mono); cursor: pointer; transition: border-color .16s ease, color .16s ease; }
.arch-dia b { font-size: 1.05rem; color: var(--text-strong); font-weight: 600; }
.arch-dia span { font-size: .62rem; }
.arch-dia:hover { border-color: var(--line-strong); color: var(--text-strong); }
.arch-dia.activo { border-color: var(--orange); box-shadow: 0 0 0 1px var(--orange) inset; }
/* Un dia sin novedades se ve distinto, no ausente: tambien es archivo. */
.arch-dia.tranquilo b { color: var(--muted); font-weight: 400; }
.arch-detalle { padding: 26px 24px 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); backdrop-filter: blur(8px); }
.arch-detalle h2 { margin: 0; font-family: var(--f-display); font-size: 1.5rem; color: var(--text-strong); letter-spacing: -0.02em; }
.arch-lider { margin: 6px 0 18px; font-size: .88rem; color: var(--muted); }
.arch-tranquilo { margin: 0; font-size: 1rem; color: var(--text); line-height: 1.7; max-width: 56ch; }
.arch-sub { margin: 24px 0 12px; font-family: var(--f-display); font-size: 1rem; color: var(--text-strong); }

/* ============================================================
   La imagen del día
   Una ilustración generada por DIEGUIA con lo que pasó ese día.
   El epígrafe va al lado y no debajo: leído en columna, un pie de
   foto compite con la imagen; al costado, la acompaña.
   ============================================================ */
.imgdia { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 0; margin: 0 auto; max-width: 960px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.imgdia img { display: block; width: 100%; height: 100%; object-fit: cover; aspect-ratio: 1 / 1; background: var(--bg-2); }
.imgdia figcaption { display: flex; flex-direction: column; justify-content: center; gap: 12px; padding: 34px 32px; border-left: 1px solid var(--line); }
.imgdia figcaption p { margin: 0; font-family: var(--f-display); font-size: 1.32rem; line-height: 1.45; color: var(--text-strong); letter-spacing: -0.015em; text-wrap: balance; }
.imgdia-firma { font-family: var(--f-mono); font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; line-height: 1.6; }

/* En el archivo la imagen es una pieza más del día, no la portada. */
.imgdia--arch { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); margin: 0 0 22px; border-radius: var(--radius); }
.imgdia--arch figcaption { padding: 22px 24px; }
.imgdia--arch figcaption p { font-size: 1.06rem; }

/* Un día ilustrado se distingue en la grilla sin gritar. */
.arch-dia.con-imagen { border-color: var(--line-strong); }

@media (max-width: 780px) {
  .imgdia, .imgdia--arch { grid-template-columns: 1fr; }
  .imgdia img { aspect-ratio: 4 / 3; }
  .imgdia figcaption { border-left: 0; border-top: 1px solid var(--line); padding: 22px 20px; }
  .imgdia figcaption p { font-size: 1.1rem; }
}
