/* Rafael Vázquez — web personal. Estilo "editorial académico". */

:root {
  --bg: #FAF8F3;
  --surface: #FFFFFF;
  --ink: #1B1F24;
  --ink-2: #39404A;
  --muted: #6A717B;
  --rule: #E4DFD3;
  --rule-strong: #CFC8B8;
  --accent: #1F3A5F;
  --accent-ink: #FFFFFF;
  --accent-soft: #E9EEF4;
  --highlight: #8A5A1F;
  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  --wrap: 1080px;
  --gutter: 24px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14171C;
    --surface: #1B2027;
    --ink: #E9E6DF;
    --ink-2: #C9C6BF;
    --muted: #98A0AA;
    --rule: #2B313A;
    --rule-strong: #3A424D;
    --accent: #9DB8DA;
    --accent-ink: #14171C;
    --accent-soft: #212A36;
    --highlight: #D7AE72;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14171C;
  --surface: #1B2027;
  --ink: #E9E6DF;
  --ink-2: #C9C6BF;
  --muted: #98A0AA;
  --rule: #2B313A;
  --rule-strong: #3A424D;
  --accent: #9DB8DA;
  --accent-ink: #14171C;
  --accent-soft: #212A36;
  --highlight: #D7AE72;
  color-scheme: dark;
}

/* Bilingüe: el <html data-lang> decide qué bloques se ven */
html[data-lang="es"] [lang="en"]:not(html),
html[data-lang="en"] [lang="es"]:not(html) { display: none !important; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

.skip {
  position: absolute; left: 12px; top: -48px; z-index: 20;
  background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 4px;
  font: 500 14px var(--sans); text-decoration: none;
}
.skip:focus { top: 12px; }

/* ---------- Cabecera ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--rule);
}
.site-header .wrap { display: flex; align-items: center; gap: 24px; height: 60px; }
.brand { font-family: var(--serif); font-weight: 600; font-size: 19px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.nav { display: flex; gap: 22px; margin-left: auto; font-family: var(--sans); font-size: 14px; }
.nav a { color: var(--ink-2); text-decoration: none; padding: 4px 0; border-bottom: 1px solid transparent; }
.nav a:hover, .nav a[aria-current] { color: var(--ink); border-bottom-color: var(--ink); }
.tools { display: flex; gap: 6px; font-family: var(--sans); }
.tool-btn {
  font: 500 12px/1 var(--sans); letter-spacing: .04em;
  color: var(--ink-2); background: transparent;
  border: 1px solid var(--rule-strong); border-radius: 999px;
  padding: 7px 10px; cursor: pointer;
}
.tool-btn:hover { color: var(--ink); border-color: var(--ink-2); }
.menu-btn { display: none; }

@media (max-width: 900px) {
  .nav {
    display: none; position: absolute; top: 60px; left: 0; right: 0;
    flex-direction: column; gap: 0; background: var(--bg);
    border-bottom: 1px solid var(--rule); padding: 8px var(--gutter) 16px;
  }
  .nav.open { display: flex; }
  .nav a { padding: 10px 0; border-bottom: 1px solid var(--rule); }
  .menu-btn { display: inline-block; }
  .tools { margin-left: auto; }
}

/* ---------- Tipografía de secciones ---------- */
section { padding: 72px 0; border-top: 1px solid var(--rule); }
section:first-of-type { border-top: 0; }
.eyebrow {
  font: 600 12px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 14px;
}
.eyebrow .num { color: var(--accent); margin-right: 10px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0; color: var(--ink); }
h2 { font-size: clamp(28px, 4vw, 36px); letter-spacing: -.01em; margin-bottom: 18px; }
h3 { font-size: 21px; margin-bottom: 6px; }
.lede { font-size: 19px; color: var(--ink-2); max-width: 64ch; margin: 0 0 36px; }
.meta { font-family: var(--sans); font-size: 13px; color: var(--muted); }

/* ---------- Portada ---------- */
.hero { padding: 64px 0 56px; }
.hero-grid { display: grid; grid-template-columns: 1fr 280px; gap: 56px; align-items: start; }
.hero h1 { font-size: clamp(38px, 6vw, 58px); letter-spacing: -.02em; line-height: 1.05; }
.hero .rule { width: 56px; height: 2px; background: var(--accent); margin: 22px 0 18px; }
.hero-role { font-family: var(--sans); font-size: 15px; color: var(--ink-2); line-height: 1.55; margin: 0 0 24px; }
.hero-role strong { color: var(--ink); font-weight: 600; }
.hero .bio { max-width: 62ch; margin: 0 0 28px; color: var(--ink-2); }
.portrait {
  aspect-ratio: 1; overflow: hidden; border-radius: 2px;
  border: 1px solid var(--rule-strong); background: var(--surface);
}
.portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 40%; }
.links { display: flex; flex-wrap: wrap; gap: 8px 10px; font-family: var(--sans); font-size: 13.5px; }
.links a {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ink); text-decoration: none;
  border: 1px solid var(--rule-strong); border-radius: 999px; padding: 6px 12px;
  background: var(--surface);
}
.links a:hover { border-color: var(--accent); color: var(--accent); }
.links a.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 48px;
  border-top: 1px solid var(--rule-strong); border-bottom: 1px solid var(--rule);
}
.stat { padding: 18px 18px 16px 0; }
.stat + .stat { padding-left: 18px; border-left: 1px solid var(--rule); }
.stat b { display: block; font-family: var(--serif); font-weight: 600; font-size: 32px; line-height: 1.1; color: var(--ink); }
.stat span { font-family: var(--sans); font-size: 12.5px; color: var(--muted); }
.stats-note { margin-top: 8px; }

@media (max-width: 760px) {
  .hero-grid { grid-template-columns: 1fr; gap: 28px; }
  .portrait { max-width: 200px; order: -1; aspect-ratio: 1; border-radius: 50%; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3) { padding-left: 0; border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--rule); }
}

/* ---------- Novedades ---------- */
.news { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0 48px; }
.news li { display: grid; grid-template-columns: 84px 1fr; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--rule); font-size: 16.5px; }
.news time { font-family: var(--sans); font-size: 12.5px; color: var(--accent); font-weight: 600; padding-top: 4px; letter-spacing: .02em; }
@media (max-width: 760px) { .news { grid-template-columns: 1fr; } }

/* ---------- Líneas de investigación ---------- */
.lines { counter-reset: line; display: grid; gap: 0; }
.line {
  display: grid; grid-template-columns: 64px 1fr 1fr; gap: 28px;
  padding: 30px 0; border-top: 1px solid var(--rule);
}
.line:last-child { border-bottom: 1px solid var(--rule); }
.line::before {
  counter-increment: line; content: counter(line, decimal-leading-zero);
  font-family: var(--serif); font-size: 28px; color: var(--accent); line-height: 1;
}
.line p { margin: 0; color: var(--ink-2); font-size: 16.5px; }
.line .keywords { margin-top: 10px; font-family: var(--sans); font-size: 12.5px; color: var(--muted); }
.line-pubs { list-style: none; margin: 0; padding: 0; font-size: 14.5px; line-height: 1.45; }
.line-pubs li { padding: 0 0 10px; }
.line-pubs .t { color: var(--ink); }
.line-pubs .v { display: block; font-family: var(--sans); font-size: 12px; color: var(--muted); margin-top: 2px; }
.line .line-pubs-label { font: 600 11px/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 2px 0 12px; }
@media (max-width: 860px) {
  .line { grid-template-columns: 44px 1fr; }
  .line .line-side { grid-column: 2; }
}

/* ---------- Publicaciones (lista) ---------- */
.pub-list { list-style: none; padding: 0; margin: 0; }
.pub { padding: 16px 0; border-bottom: 1px solid var(--rule); }
.pub .title { font-size: 17.5px; color: var(--ink); line-height: 1.4; }
.pub .authors { font-family: var(--sans); font-size: 13.5px; color: var(--ink-2); margin-top: 4px; }
.pub .authors b { color: var(--ink); font-weight: 600; }
.pub .venue { font-size: 15px; font-style: italic; color: var(--muted); margin-top: 2px; }
.pub .actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.tag {
  font: 600 10.5px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase;
  padding: 4px 7px; border-radius: 3px; border: 1px solid var(--rule-strong); color: var(--muted);
}
.tag.status { color: var(--highlight); border-color: currentColor; }
.tag.line-tag { color: var(--accent); border-color: transparent; background: var(--accent-soft); }
.pub .actions a {
  font: 500 12px/1 var(--sans); text-decoration: none;
  padding: 5px 9px; border-radius: 3px; border: 1px solid var(--rule-strong); color: var(--ink-2); background: var(--surface);
}
.pub .actions a:hover { color: var(--accent); border-color: var(--accent); }
.more { margin-top: 24px; font-family: var(--sans); font-size: 14px; }

/* ---------- Filtros publicaciones ---------- */
.filters { position: sticky; top: 60px; z-index: 5; background: var(--bg); padding: 16px 0 12px; border-bottom: 1px solid var(--rule-strong); margin-bottom: 8px; }
.filters-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.search {
  flex: 1 1 260px; min-width: 0;
  font: 16px var(--sans); color: var(--ink);
  background: var(--surface); border: 1px solid var(--rule-strong); border-radius: 4px; padding: 9px 12px;
}
.select {
  font: 14px var(--sans); color: var(--ink); background: var(--surface);
  border: 1px solid var(--rule-strong); border-radius: 4px; padding: 9px 10px; max-width: 100%;
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.chip {
  font: 500 13px/1 var(--sans); color: var(--ink-2); background: transparent;
  border: 1px solid var(--rule-strong); border-radius: 999px; padding: 7px 12px; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip .n { opacity: .65; margin-left: 4px; font-variant-numeric: tabular-nums; }
.count { margin-top: 10px; }
.year-head {
  font-family: var(--serif); font-size: 26px; font-weight: 600; color: var(--accent);
  margin: 36px 0 4px; padding-bottom: 6px; border-bottom: 1px solid var(--rule-strong);
}
@media (max-width: 760px) { .filters { position: static; } }
.empty { padding: 48px 0; color: var(--muted); font-family: var(--sans); }

/* ---------- Proyectos ---------- */
.proj-tabs { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.proj { display: grid; grid-template-columns: 120px 1fr auto; gap: 20px; padding: 18px 0; border-bottom: 1px solid var(--rule); align-items: baseline; }
.proj:first-child { border-top: 1px solid var(--rule-strong); }
.proj .years { font-family: var(--sans); font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.proj .name { font-size: 17px; color: var(--ink); line-height: 1.4; }
.proj .name .acr { font-weight: 600; }
.proj .funder { font-family: var(--sans); font-size: 13px; color: var(--muted); margin-top: 3px; }
.role { font: 600 10.5px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); padding: 5px 8px; border-radius: 3px; white-space: nowrap; }
.role:empty { display: none; }
@media (max-width: 680px) {
  .proj { grid-template-columns: 1fr; gap: 4px; }
  .proj .role { justify-self: start; margin-top: 6px; }
}

/* ---------- Equipo ---------- */
.team-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; }
.team-grid h3 { font-size: 15px; font-family: var(--sans); font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--rule-strong); }
.people { list-style: none; padding: 0; margin: 0; }
.people li { padding: 10px 0; border-bottom: 1px solid var(--rule); font-size: 16.5px; line-height: 1.4; }
.people .sub { display: block; font-family: var(--sans); font-size: 12.5px; color: var(--muted); margin-top: 3px; }
@media (max-width: 860px) { .team-grid { grid-template-columns: 1fr; gap: 28px; } }

/* ---------- IA y formación / Docencia ---------- */
.two-col { display: grid; grid-template-columns: 1.1fr .9fr; gap: 56px; align-items: start; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; gap: 32px; } }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: 12px 0; border-bottom: 1px solid var(--rule); font-size: 16.5px; line-height: 1.45; }
.plain li:first-child { border-top: 1px solid var(--rule-strong); }
.plain .sub { display: block; font-family: var(--sans); font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.callout {
  background: var(--surface); border: 1px solid var(--rule); border-left: 3px solid var(--accent);
  padding: 22px 24px; font-size: 16.5px; color: var(--ink-2);
}
.callout p { margin: 0 0 12px; }
.callout p:last-child { margin: 0; }

/* ---------- Contacto / pie ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }
.contact-grid address { font-style: normal; color: var(--ink-2); }
.id-list { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-family: var(--sans); font-size: 14px; margin: 0; }
.id-list dt { color: var(--muted); }
.id-list dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 760px) { .contact-grid { grid-template-columns: 1fr; gap: 28px; } }

.site-footer { border-top: 1px solid var(--rule-strong); padding: 28px 0 40px; font-family: var(--sans); font-size: 13px; color: var(--muted); }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ---------- Cabecera de página interior ---------- */
.page-head { padding: 56px 0 8px; }
.page-head h1 { font-size: clamp(34px, 5vw, 46px); letter-spacing: -.015em; }
.page-head p { color: var(--ink-2); max-width: 64ch; }

@media (max-width: 480px) {
  :root { --gutter: 16px; }
  body { font-size: 17px; }
  section { padding: 52px 0; }
  .news li { grid-template-columns: 1fr; gap: 2px; }
}

@media print {
  .site-header, .filters, .tools, .site-footer { display: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  section { padding: 16px 0; }
}
