/* ---------------------------------------------------------------
   miguelortuno.es — hoja de estilos común a todas las páginas
   --------------------------------------------------------------- */

:root {
  /* Paleta */
  --navy:      #10305c;   /* títulos */
  --navy-soft: #2a5490;   /* subtítulos y detalles */
  --link:      #1a5fa8;   /* enlaces */
  --gold:      #b07d2b;   /* acento cálido, uso muy puntual */
  --ink:       #23272d;   /* texto */
  --muted:     #5d6672;   /* texto secundario */
  --rule:      #d9e0ea;   /* líneas */
  --tint:      #f2f6fb;   /* fondos suaves */
  --bg:        #ffffff;

  --measure: 44rem;

  /* Calibri con alternativas de métrica equivalente para Linux y Mac */
  --sans: Calibri, Carlito, Candara, "Segoe UI", system-ui,
          -apple-system, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --navy:      #a9c6ef;
    --navy-soft: #8badd8;
    --link:      #7fb4e8;
    --gold:      #d8ab63;
    --ink:       #e6e8ec;
    --muted:     #9aa3b0;
    --rule:      #2c3542;
    --tint:      #1a2130;
    --bg:        #131820;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.075rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.5rem 5rem;
}

/* ----- Cabecera y navegación ----- */

.masthead {
  border-top: 4px solid var(--navy);
  padding-top: 2.25rem;
  margin-bottom: 2rem;
}

.masthead h1,
.masthead .sitetitle {
  font-size: 1.9rem;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: -0.015em;
  margin: 0 0 0.25rem;
  line-height: 1.2;
}

.masthead h1 a,
.masthead .sitetitle a { color: inherit; text-decoration: none; }

/* Título propio de una página interior (h1 real de esa página) */
h1.pagetitle {
  font-size: 1.55rem;
  font-weight: 600;
  color: var(--navy);
  margin: 0 0 1rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--rule);
}

.affiliation {
  color: var(--muted);
  font-size: 1rem;
  margin: 0;
}

nav {
  margin-top: 1.5rem;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 0.6rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.5rem;
  font-size: 0.95rem;
}

nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.15rem 0;
  border-bottom: 2px solid transparent;
}

nav a:hover { color: var(--link); }

nav a.current {
  color: var(--navy);
  font-weight: 600;
  border-bottom-color: var(--gold);
}

/* ----- Texto ----- */

main { margin-top: 2.75rem; }

h2 {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--navy);
  margin: 2.75rem 0 1rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--rule);
}

main > h2:first-child { margin-top: 0; }

h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--navy-soft);
  margin: 1.9rem 0 0.55rem;
}

p { margin: 0 0 1.05rem; }

a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

ul, ol { margin: 0 0 1.05rem; padding-left: 1.3rem; }
li { margin-bottom: 0.4rem; }

.lead { font-size: 1.15rem; color: var(--muted); }

/* ----- Bloques ----- */

.panel {
  background: var(--tint);
  border-left: 3px solid var(--navy-soft);
  padding: 1.1rem 1.3rem;
  margin: 0 0 1.6rem;
  border-radius: 0 4px 4px 0;
}

.panel p:last-child, .panel ul:last-child { margin-bottom: 0; }

.todo {
  background: rgba(176, 125, 43, 0.11);
  border-left: 3px solid var(--gold);
  padding: 0.55rem 0.9rem;
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 1.3rem;
  border-radius: 0 4px 4px 0;
}

/* ----- Publicaciones ----- */

.year {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.06em;
  margin: 2.1rem 0 0.7rem;
}

ol.pubs { list-style: none; margin: 0; padding: 0; }

ol.pubs li {
  margin-bottom: 0.85rem;
  padding-left: 1.5rem;
  text-indent: -1.5rem;
  font-size: 1rem;
}

ol.pubs .me { font-weight: 700; color: var(--navy); }
ol.pubs em { font-style: italic; }

/* ----- Libros ----- */

.book {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--rule);
}

.book:first-of-type { border-top: 1px solid var(--rule); }

.book .num {
  color: var(--gold);
  font-weight: 700;
  font-size: 0.95rem;
  min-width: 1.4rem;
}

.book .title { font-weight: 600; }
.book .meta { color: var(--muted); font-size: 0.95rem; margin: 0.1rem 0 0; }

/* ----- Docencia ----- */

dl.courses { margin: 0; }
dl.courses dt { font-weight: 600; margin-top: 1.1rem; color: var(--navy-soft); }
dl.courses dd { margin: 0.1rem 0 0; color: var(--muted); font-size: 0.97rem; }

/* ----- Contacto ----- */

.contact-list { list-style: none; margin: 0; padding: 0; }
.contact-list li { margin-bottom: 0.55rem; }
.contact-list span {
  display: inline-block;
  min-width: 6rem;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ----- Índice de temas del libro ----- */

ol.toc {
  columns: 2;
  column-gap: 2.5rem;
  padding-left: 1.4rem;
  margin-bottom: 1.4rem;
}

ol.toc li { break-inside: avoid; margin-bottom: 0.3rem; font-size: 1rem; }

@media (max-width: 34rem) {
  ol.toc { columns: 1; }
}

/* ----- Ficha de libro con portada ----- */

.bookhead {
  display: flex;
  gap: 1.75rem;
  align-items: flex-start;
  margin-bottom: 1.75rem;
}

.bookhead .cover {
  flex: 0 0 auto;
  width: 195px;
  height: auto;          /* imprescindible: si no, manda el height del HTML */
  border: 1px solid var(--rule);
  border-radius: 3px;
  box-shadow: 0 3px 16px rgba(16, 48, 92, 0.20);
  display: block;
}

.bookhead .blurb { flex: 1 1 auto; }
.bookhead .blurb > :first-child { margin-top: 0; }

@media (max-width: 38rem) {
  .bookhead { flex-direction: column; gap: 1.1rem; }
  .bookhead .cover { width: 160px; height: auto; align-self: center; }
}

/* ----- Descargas ----- */

ul.downloads { list-style: none; margin: 0 0 1.3rem; padding: 0; }

ul.downloads li {
  border-top: 1px solid var(--rule);
  padding: 0.7rem 0;
  margin: 0;
}

ul.downloads li:last-child { border-bottom: 1px solid var(--rule); }

ul.downloads .tag {
  display: inline-block;
  background: var(--navy);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  padding: 0.12rem 0.45rem;
  border-radius: 3px;
  margin-right: 0.6rem;
  vertical-align: 0.08em;
}

ul.downloads .size { color: var(--muted); font-size: 0.9rem; }

/* ----- Pie ----- */

footer {
  margin-top: 4rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
  justify-content: space-between;
}

.back { font-size: 0.95rem; margin-bottom: 1.5rem; }

@media (max-width: 34rem) {
  .wrap { padding: 0 1.15rem 3.5rem; }
  .masthead h1 { font-size: 1.6rem; }
  body { font-size: 1.03rem; }
}
