/* Paleta tomada de las portadas del libro y de las diapositivas:
   azul marino profundo, cian luminoso y un acento dorado cálido. */
:root {
  --primary: #0d2a4a;      /* azul marino: títulos, tablas */
  --night: #081a30;        /* fondo de la cabecera */
  --night-2: #123a63;
  --accent: #0f8fc2;       /* cian: botones y enlaces destacados */
  --accent-soft: #7dd3fc;
  --gold: #d9932b;         /* acento cálido: etiquetas, letras del hilo conductor */
  --bg: #f4f7fb;
  --text: #101a2b;
  --muted: #5b6b80;
  --card: #ffffff;
  --border: #dde5ef;
  --shadow: 0 10px 30px rgba(8, 26, 48, 0.08);
  --radius: 14px;
  --maxw: 1100px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial,
               "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.author-link { color: var(--accent); font-weight: 600; }
.author-name { font-weight: 600; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.4rem;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  letter-spacing: 0.01em;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: var(--shadow);
}
.button:hover { text-decoration: none; filter: brightness(0.94); }
.button:focus-visible { outline: 3px solid rgba(15, 143, 194, 0.35); outline-offset: 3px; }

.button-secondary {
  background: #ffffff;
  color: var(--primary);
  border: 1px solid var(--border);
}
.button-gold { background: var(--gold); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* ── CABECERA ── */
header {
  background: linear-gradient(120deg, var(--night) 0%, var(--night-2) 100%);
  border-bottom: 1px solid rgba(125, 211, 252, 0.18);
}

.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.header-brand { display: flex; align-items: center; gap: 1.1rem; }

.header-brand img {
  max-height: 64px;
  width: auto;
  height: auto;
  display: block;
  border-radius: 8px;
  box-shadow: 0 0 0 1px rgba(125, 211, 252, 0.25), 0 0 18px rgba(56, 189, 248, 0.25);
}

.header-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
}

.header-subtitle {
  font-size: 0.85rem;
  color: var(--accent-soft);
  margin-top: 0.1rem;
}

.header-nav { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.header-nav a {
  color: #e6eef8;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(125, 211, 252, 0.35);
}
.header-nav a:hover { background: rgba(125, 211, 252, 0.15); text-decoration: none; }

/* ── PORTADA ── */
main {
  max-width: var(--maxw);
  margin: 0 auto;
}

.hero {
  padding: 3rem 1.5rem 2rem 1.5rem;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2.5rem;
  align-items: start;
}

.book-cover-link {
  display: block;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 28px rgba(8, 26, 48, 0.28);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  width: 230px;
}
.book-cover-link:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 36px rgba(8, 26, 48, 0.36), 0 0 0 3px rgba(56, 189, 248, 0.35);
  text-decoration: none;
}
.book-cover-link img { width: 100%; height: auto; display: block; }

.book-cover-hint {
  text-align: center;
  margin-top: 0.6rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.hero-info h1 {
  font-size: clamp(1.9rem, 3vw, 2.6rem);
  line-height: 1.15;
  margin: 0 0 0.35rem 0;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.hero-info .subtitle {
  font-size: 1.05rem;
  color: var(--muted);
  margin: 0 0 1.25rem 0;
  font-style: italic;
}

.book-meta {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow);
  margin: 0 0 1.25rem 0;
  display: inline-grid;
  grid-template-columns: auto 1fr;
  column-gap: 0.85rem;
  row-gap: 0.3rem;
}
.book-meta dt { font-weight: 700; color: var(--primary); white-space: nowrap; }
.book-meta dd { margin: 0; color: #334155; }

.hero-desc {
  color: #334155;
  font-size: 1rem;
  max-width: 72ch;
  margin: 0 0 1.5rem 0;
}

/* ── SECCIONES ── */
section { padding: 2.2rem 1.5rem; }
section + section { border-top: 1px solid var(--border); }

section h2 {
  font-size: 1.65rem;
  margin: 0 0 0.5rem 0;
  color: var(--primary);
  letter-spacing: -0.01em;
}
section h2::after {
  content: "";
  display: block;
  width: 56px;
  height: 3px;
  margin-top: 0.35rem;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--gold));
}

section .section-intro {
  margin: 0 0 1.5rem 0;
  color: var(--muted);
  max-width: 80ch;
}

#sobre p, #lecturas p { max-width: 80ch; color: #334155; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ── HILO CONDUCTOR ── */
.method-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  padding: 0;
  margin: 0;
  list-style: none;
}
.method-steps li { padding: 1rem; }
.method-steps .letter {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  color: var(--gold);
  line-height: 1;
}
.method-steps strong { color: var(--primary); }
.method-steps p { margin: 0.35rem 0 0 0; color: #475569; font-size: 0.93rem; }

/* ── CONTENIDO ── */
.parts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
}
.parts-grid .card { padding: 1.25rem; border-top: 3px solid var(--accent); }
.parts-grid h3 { margin: 0 0 0.5rem 0; color: var(--primary); font-size: 1.02rem; }
.parts-grid ul { margin: 0; padding-left: 1.25rem; color: #475569; font-size: 0.97rem; line-height: 1.7; }

/* ── DIAPOSITIVAS ── */
.slides-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
}

.slide-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
  display: flex;
  flex-direction: column;
}
.slide-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 32px rgba(8, 26, 48, 0.14), 0 0 0 2px rgba(56, 189, 248, 0.35);
}
.slide-card a {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
  color: inherit;
}
.slide-card a:hover { text-decoration: none; }

.slide-thumbnail {
  width: 100%;
  height: auto;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
  background: #e5e7eb;
}

.slide-info {
  padding: 0.65rem 0.85rem 0.85rem 0.85rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.slide-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--gold);
}
.slide-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
  line-height: 1.3;
  margin: 0;
}
.slide-dl {
  margin-top: auto;
  padding-top: 0.5rem;
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 600;
}

/* ── PRÁCTICAS ── */
.practicas {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
}
.practica { display: flex; gap: 0.9rem; padding: 1rem; align-items: flex-start; }
.practica-num {
  flex-shrink: 0;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #ffffff;
  background: linear-gradient(135deg, var(--night-2), var(--accent));
}
.practica strong { color: var(--primary); }
.practica p { margin: 0.3rem 0 0 0; color: #475569; font-size: 0.93rem; }
.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gold);
  border: 1px solid rgba(217, 147, 43, 0.45);
  border-radius: 999px;
  padding: 0 0.5rem;
  margin-left: 0.25rem;
  vertical-align: 1px;
}

/* ── PREGUNTAS FRECUENTES ── */
.faq details {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem;
  margin-bottom: 0.75rem;
}
.faq summary { cursor: pointer; font-weight: 700; color: var(--primary); }
.faq details[open] summary { color: var(--accent); }
.faq details p { margin: 0.6rem 0 0 0; color: #334155; }

/* ── CITA ── */
.bibtex-wrapper { position: relative; }
.bibtex-block {
  background: var(--night);
  color: #e2e8f0;
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 0.85rem;
  margin: 0;
}
.bibtex-copy {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.3rem 0.7rem;
  font-weight: 600;
  cursor: pointer;
}
.bibtex-copy.copied { background: #dcfce7; }

/* ── PIE ── */
footer {
  background: linear-gradient(120deg, var(--night) 0%, var(--night-2) 100%);
  color: #c7d5e6;
}
.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.75rem 1.5rem;
  font-size: 0.92rem;
}
.footer-inner p { margin: 0.35rem 0; }
footer a, footer .author-link { color: var(--accent-soft); }
footer .author-name { color: #ffffff; }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .header-inner { flex-wrap: wrap; }
}

@media (max-width: 640px) {
  .hero { grid-template-columns: 1fr; }
  .book-cover-link { width: 170px; margin: 0 auto; }
  .book-cover-wrapper { display: flex; flex-direction: column; align-items: center; }
  .header-inner { gap: 0.75rem; }
  .header-brand img { max-height: 44px; }
  .book-meta { display: grid; }
}

.hd-note { margin: 1rem 0 0 0; font-size: 0.9rem; color: var(--muted); }
.hd-note a { color: var(--accent); font-weight: 600; }
