/* Ley de Nietos — hoja de estilo única. Sin dependencias, sin build. */
:root {
  --bg: #10141a;
  --panel: #19202a;
  --panel-2: #212a36;
  --border: #2d3846;
  --txt: #dde5ef;
  --muted: #8b9aad;
  --accent: #e8b33c;
  --ok: #4fb477;
  --warn: #d4823f;
  --bad: #d3564f;
  --f-dis: "Iowan Old Style", Georgia, "Times New Roman", serif;
  --f-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --f-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f3eb; --panel: #fff; --panel-2: #eef1f5;
    --border: #d5dbe3; --txt: #1d2530; --muted: #5d6b7d;
    --accent: #a06b00; --ok: #2f7a4f; --warn: #a05c14; --bad: #b03b34;
  }
}

/* tema.js fija data-theme en <html> antes del primer pintado, con el valor por defecto
   según si hay luz de día en España; estas reglas, de mayor especificidad que :root,
   prevalecen tanto sobre el :root por defecto como sobre prefers-color-scheme. */
html[data-theme="dark"] {
  --bg: #10141a; --panel: #19202a; --panel-2: #212a36;
  --border: #2d3846; --txt: #dde5ef; --muted: #8b9aad;
  --accent: #e8b33c; --ok: #4fb477; --warn: #d4823f; --bad: #d3564f;
}
html[data-theme="light"] {
  --bg: #f6f3eb; --panel: #fff; --panel-2: #eef1f5;
  --border: #d5dbe3; --txt: #1d2530; --muted: #5d6b7d;
  --accent: #a06b00; --ok: #2f7a4f; --warn: #a05c14; --bad: #b03b34;
}

* { box-sizing: border-box; }

body {
  margin: 0; background: var(--bg); color: var(--txt);
  font-family: var(--f-ui); font-size: 17px; line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

.wrap { max-width: 780px; margin: 0 auto; padding: 0 22px 96px; }

/* ---- nav ---- */
nav {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  margin-bottom: 44px;
}
nav .wrap { padding-top: 0; padding-bottom: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
nav .brand {
  flex: none;
  font-family: var(--f-dis); font-weight: 700; font-size: 16px;
  color: var(--accent); text-decoration: none; margin-right: 18px; padding: 14px 0;
}
nav a {
  flex: none;
  color: var(--muted); text-decoration: none; font-size: 14px;
  padding: 16px 11px; border-bottom: 2px solid transparent; white-space: nowrap;
}
nav a:hover { color: var(--txt); }
nav a[aria-current="page"] { color: var(--txt); border-bottom-color: var(--accent); }

.theme-toggle {
  margin-left: auto; flex: none; display: inline-flex;
  align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0;
  border: 1px solid var(--border); border-radius: 50%;
  background: var(--panel); color: var(--muted); cursor: pointer;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .i-sol { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; display: none; }
.theme-toggle .i-luna { fill: currentColor; stroke: none; display: none; }
html[data-theme="dark"] .theme-toggle .i-sol { display: block; }
html[data-theme="light"] .theme-toggle .i-luna { display: block; }

.lang-toggle {
  flex: none; display: inline-flex; margin-left: 6px;
  align-items: center; justify-content: center;
  height: 32px; padding: 0 11px; border-radius: 16px;
  border: 1px solid var(--border); background: var(--panel);
  color: var(--muted); text-decoration: none;
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em;
}
.lang-toggle:hover { color: var(--accent); border-color: var(--accent); }

/* ---- tipografía ---- */
h1 {
  font-family: var(--f-dis); font-size: clamp(25px, 5.4vw, 44px);
  line-height: 1.15; margin: 12px 0 10px; letter-spacing: -0.01em;
}
h2 {
  font-family: var(--f-dis); font-size: 25px; line-height: 1.25;
  margin: 52px 0 14px; padding-top: 22px; border-top: 1px solid var(--border);
}
.h-psoe { color: var(--bad); }
h2.h-psoe { border-top-color: var(--bad); }
h3 { font-size: 18px; margin: 30px 0 8px; letter-spacing: 0.01em; }
p { margin: 0 0 17px; }
a { color: var(--accent); }
strong { color: #fff; font-weight: 650; }
@media (prefers-color-scheme: light) { strong { color: #000; } }
html[data-theme="dark"] strong { color: #fff; }
html[data-theme="light"] strong { color: #000; }
code { font-family: var(--f-mono); font-size: 0.86em; background: var(--panel-2); padding: 1px 5px; border-radius: 3px; }

.kicker {
  font-family: var(--f-ui); font-size: 12.5px; font-weight: 700;
  letter-spacing: 0.13em; text-transform: uppercase; color: var(--accent);
  margin: 30px 0 4px;
}
.lede { font-size: 19.5px; color: var(--muted); margin-bottom: 26px; line-height: 1.55; }

.foto { margin: 22px 0 30px; }
.foto img { display: block; width: 100%; height: auto; border-radius: 9px; border: 1px solid var(--border); }
.foto figcaption { font-size: 13px; color: var(--muted); margin-top: 8px; line-height: 1.5; }

/* ---- bloques ---- */
blockquote {
  margin: 22px 0; padding: 2px 0 2px 20px;
  border-left: 3px solid var(--accent);
  font-family: var(--f-dis); font-size: 18.5px; font-style: italic;
  color: var(--txt); line-height: 1.5;
}
blockquote cite { display: block; font-size: 13.5px; font-style: normal; color: var(--muted); margin-top: 9px; font-family: var(--f-ui); }

.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 9px; padding: 20px 22px; margin: 22px 0;
}
.card h3 { margin-top: 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 13px; margin: 24px 0; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: 9px; padding: 15px 16px; }
.stat b { display: block; font-family: var(--f-dis); font-size: 27px; line-height: 1.15; color: var(--accent); }
.stat span { font-size: 13px; color: var(--muted); display: block; margin-top: 5px; }

.tag {
  display: inline-block; font-size: 11.5px; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 20px; vertical-align: 2px; margin-right: 6px;
}
.t-warn { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }

/* tablas de datos: envueltas en .tabla-scroll para no estrujarse en pantalla estrecha */
.tabla-scroll { overflow-x: auto; margin: 22px 0; -webkit-overflow-scrolling: touch; }
.tabla-scroll table { margin: 0; min-width: 540px; }
table { width: 100%; border-collapse: collapse; margin: 22px 0; font-size: 15.5px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); font-weight: 700; }
td.n { font-family: var(--f-mono); white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }

/* ---- timeline ---- */
.tl { list-style: none; margin: 26px 0; padding: 0; position: relative; }
.tl::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl li { position: relative; padding: 0 0 24px 32px; }
.tl li::before {
  content: ""; position: absolute; left: 0; top: 7px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--panel); border: 2px solid var(--muted);
}
.tl li.key::before { background: var(--accent); border-color: var(--accent); }
.tl li.h-psoe::before { background: var(--bad); border-color: var(--bad); }
.tl li.h-psoe .t em { color: var(--bad); }
.tl .d { font-family: var(--f-mono); font-size: 13px; color: var(--accent); display: block; margin-bottom: 2px; }
.tl .t { font-size: 16px; }
.tl .t em { color: var(--muted); font-style: normal; display: block; font-size: 14.5px; margin-top: 3px; }

/* ---- choque de fechas (elemento central del caso) ---- */
.choque {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch;
  gap: 0; margin: 32px 0 0;
}
.choque .hito {
  background: var(--panel); border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 9px; padding: 18px 20px;
}
.choque .hito.alerta { border-left-color: var(--bad); }
.choque .hito .f {
  display: block; font-family: var(--f-mono); font-size: 15px; font-weight: 700;
  color: var(--accent); margin-bottom: 6px;
}
.choque .hito.alerta .f { color: var(--bad); }
.choque .hito .t {
  display: block; font-family: var(--f-dis); font-size: 19px; line-height: 1.25;
  margin-bottom: 7px; color: var(--txt);
}
.choque .hito .d { display: block; font-size: 14px; color: var(--muted); line-height: 1.5; }
.choque .flecha {
  display: flex; align-items: center; justify-content: center;
  font-family: var(--f-mono); font-size: 12.5px; color: var(--muted);
  padding: 0 12px; white-space: nowrap;
}
.cierre-choque {
  font-family: var(--f-dis); font-size: 20px; line-height: 1.45;
  text-align: center; margin: 22px auto 0; max-width: 620px;
}

@media (max-width: 640px) {
  .choque { grid-template-columns: 1fr; }
  .choque .flecha { padding: 12px 0; }
  .choque .flecha::after { content: ""; }
}

/* ---- navegación entre páginas ---- */
.pager { display: flex; justify-content: space-between; gap: 14px; margin-top: 56px; padding-top: 22px; border-top: 1px solid var(--border); }
.pager a {
  flex: 1; background: var(--panel); border: 1px solid var(--border);
  border-radius: 9px; padding: 14px 17px; text-decoration: none; color: var(--txt);
}
.pager a:hover { border-color: var(--accent); }
.pager small { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 3px; }
.pager .next { text-align: right; }

.src { font-size: 14px; color: var(--muted); }
.src li { margin-bottom: 7px; }
ul.clean { list-style: none; padding-left: 0; }

footer { margin-top: 60px; padding-top: 22px; border-top: 1px solid var(--border); font-size: 13.5px; color: var(--muted); }

@media (max-width: 620px) {
  body { font-size: 16.5px; }
  nav .brand { width: 100%; padding-bottom: 0; margin-right: 0; }
  nav a { padding: 11px 9px; font-size: 13.5px; }
  nav .wrap { padding-bottom: 4px; }
  .pager { flex-direction: column; }
  .pager .next { text-align: left; }
}

/* ---- referencias (inspirado en Wikipedia) ---- */
sup.cite { font-size: 0.72em; line-height: 0; vertical-align: super; }
sup.cite a {
  color: var(--accent); text-decoration: none;
  font-family: var(--f-ui); font-weight: 600;
}
sup.cite a:hover { text-decoration: underline; }

.referencias { margin-top: 56px; padding-top: 22px; border-top: 1px solid var(--border); }
.referencias > h2 { margin-top: 0; }
.referencias ol {
  padding-left: 26px; margin: 16px 0 0;
  font-size: 14px; line-height: 1.55; color: var(--muted);
}
.referencias li { margin-bottom: 9px; padding: 2px 4px; border-radius: 4px; }
.referencias li:target { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.referencias li em { color: var(--txt); }
.referencias a { color: var(--accent); word-break: break-word; }
.referencias .nota { display: block; font-size: 12.5px; color: var(--muted); margin-top: 10px; }

