/* Opción B — Monografía digital (Manifold) */
@import url("https://fonts.googleapis.com/css2?family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&family=Inter:wght@400;500;600&display=swap");

:root {
  --sidebar-width: 18rem;
  --text: #1c1c1c;
  --muted: #6b6b6b;
  --accent: #8b2942;
  --bg: #fff;
  --sidebar-bg: #f7f5f2;
  --border: #e0ddd8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
}

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

aside.toc {
  font-family: "Inter", system-ui, sans-serif;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  font-size: 0.8rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

aside.toc .toc-heading {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0 0 0.75rem;
  display: block;
  text-decoration: none;
  font-weight: 600;
}

aside.toc a.toc-heading:hover {
  color: var(--accent);
}

aside.toc .book-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  line-height: 1.3;
  display: block;
  color: var(--text);
  text-decoration: none;
}

aside.toc .book-title:hover {
  color: var(--accent);
}

aside.toc nav ul,
aside.toc nav .toc-tree {
  list-style: none;
  padding: 0;
  margin: 0;
}

aside.toc nav li { margin-bottom: 0.25rem; }

aside.toc nav a {
  color: var(--text);
  text-decoration: none;
  display: block;
  padding: 0.15rem 0;
  line-height: 1.35;
}

aside.toc nav a:hover { color: var(--accent); }

aside.toc nav .toc-home a {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

aside.toc nav .part {
  font-weight: 600;
  margin-top: 0.85rem;
  margin-bottom: 0.25rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

aside.toc nav .toc-chapter-group {
  margin-top: 0.35rem;
}

aside.toc nav .toc-chapter-group.current-chapter {
  background: rgba(139, 41, 66, 0.06);
  border-radius: 4px;
  padding: 0.35rem 0.5rem;
  margin-left: -0.5rem;
  margin-right: -0.5rem;
}

aside.toc nav .toc-chapter-title {
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--text);
  display: block;
  margin-bottom: 0.2rem;
}

aside.toc nav .toc-articles {
  padding-left: 0.65rem;
  margin: 0.15rem 0 0.35rem;
  border-left: 1px solid var(--border);
}

aside.toc nav .toc-articles li {
  font-size: 0.76rem;
}

aside.toc nav .current > a {
  font-weight: 600;
  color: var(--accent);
  border-left: 2px solid var(--accent);
  padding-left: 0.45rem;
  margin-left: -0.45rem;
}

main {
  padding: 2rem 3rem;
  max-width: 42rem;
}

.header-meta {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.header-meta span {
  display: inline-block;
  margin-right: 1rem;
}

h1 {
  font-size: 1.6rem;
  margin: 0 0 1.5rem;
  line-height: 1.25;
}

p { margin: 0 0 1.1rem; }

blockquote {
  margin: 1.5rem 0;
  padding-left: 1rem;
  border-left: 3px solid var(--border);
  font-style: italic;
  color: #444;
}

.footnote {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  margin-top: 2rem;
  padding-top: 1rem;
}

.seq-nav {
  font-family: "Inter", system-ui, sans-serif;
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 1.5rem;
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}

.seq-nav a {
  color: var(--accent);
  text-decoration: none;
  flex: 1 1 0;
  min-width: 0;
  line-height: 1.4;
}

.seq-nav a:hover { text-decoration: underline; }

.seq-nav .seq-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.seq-nav .seq-prev { padding-right: 0.75rem; }

.seq-nav .seq-next {
  text-align: right;
  padding-left: 0.75rem;
  border-left: 1px solid var(--border);
}

.seq-nav .seq-empty { flex: 1 1 0; }

.home-main h1 {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.home-main .book-subtitle {
  font-family: "Inter", system-ui, sans-serif;
  color: var(--muted);
  font-size: 1.1rem;
}

.home-main .home-hint {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 2rem;
}

aside.toc .book-subtitle,
aside.toc .book-author {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.25rem 0 1rem;
}

/* Portada, dedicatoria, índice impreso */
.page-portada {
  text-align: center;
  padding: 4rem 1rem;
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.page-portada .portada-author {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 1rem;
  margin-bottom: 2rem;
}

.page-portada h1 {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.page-portada .portada-subtitle {
  font-size: 1.15rem;
  color: var(--muted);
  margin-bottom: 3rem;
}

.page-portada .portada-publisher {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.95rem;
  line-height: 1.5;
}

.page-dedicatoria {
  text-align: center;
  padding: 6rem 1rem;
  font-style: italic;
  font-size: 1.1rem;
}

.print-indice {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.9rem;
}

.indice-item,
.indice-part {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  margin-bottom: 0.4rem;
  line-height: 1.4;
}

.indice-item a,
.indice-part a {
  color: var(--text);
  text-decoration: none;
  flex: 0 1 auto;
}

.indice-item a:hover,
.indice-part a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.indice-item.indice-section {
  padding-left: 1.25rem;
}

.indice-item.indice-section a {
  font-weight: 400;
}

.indice-item.indice-chapter a {
  font-weight: 600;
}

.indice-part a {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
}

.indice-dots {
  flex: 1 1 auto;
  border-bottom: 1px dotted var(--border);
  min-width: 1rem;
  margin: 0 0.25rem;
  height: 0.75em;
}

.indice-page {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.85rem;
}

.fn-ref {
  font-size: 0.75em;
  line-height: 0;
  vertical-align: super;
  margin-left: 0.05em;
}

.fn-ref a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.fn-ref a:hover {
  text-decoration: underline;
}

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

.note-item {
  margin-bottom: 1rem;
  padding-left: 2rem;
  text-indent: -2rem;
}

.note-num {
  font-weight: 600;
  margin-right: 0.35rem;
}

.part-divider {
  margin: 0 0 2rem;
  padding: 2.5rem 1rem 2rem;
  border-bottom: 2px solid var(--border);
  text-align: center;
}

.part-label {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
}

.page-home {
  max-width: 38rem;
}

.home-hero {
  text-align: center;
  padding: 2rem 0 2.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.home-author {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.95rem;
  margin: 0 0 1.25rem;
}

.home-hero h1 {
  font-size: 2rem;
  margin: 0 0 0.5rem;
}

.home-subtitle {
  font-size: 1.1rem;
  color: var(--muted);
  margin: 0 0 1.25rem;
}

.home-publisher {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
}

.home-intro {
  margin-bottom: 2rem;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  font-family: "Inter", system-ui, sans-serif;
}

.home-action {
  display: inline-block;
  padding: 0.55rem 1rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
}

.home-action:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.home-action-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.home-action-primary:hover {
  background: #6d2035;
  border-color: #6d2035;
  color: #fff;
}

.ref-links {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
  font-family: "Inter", system-ui, sans-serif;
}

.ref-links li {
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.ref-links li:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.ref-links a {
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.ref-links a:hover {
  text-decoration: underline;
}

.ref-links p {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.5;
}

.article-body a[href^="mailto:"] {
  color: var(--accent);
  text-decoration: none;
}

.article-body a[href^="mailto:"]:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; }

  aside.toc {
    position: sticky;
    top: 0;
    z-index: 100;
    height: auto;
    padding: 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
    background: var(--sidebar-bg);
  }

  aside.toc .toc-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
  }

  aside.toc .book-title {
    margin: 0;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }

  aside.toc .toc-toggle {
    flex: 0 0 auto;
    font-family: "Inter", system-ui, sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
  }

  aside.toc .toc-toggle[aria-expanded="true"] {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
  }

  aside.toc .toc-heading {
    display: none;
  }

  aside.toc.toc-collapsed nav {
    display: none;
  }

  aside.toc:not(.toc-collapsed) nav {
    display: block;
    position: fixed;
    top: 2.75rem;
    left: 0;
    right: 0;
    max-height: calc(100vh - 2.75rem);
    overflow-y: auto;
    padding: 1rem;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 99;
  }

  body.toc-open::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 98;
  }

  main { padding: 1.25rem 1rem 2rem; }

  .seq-nav {
    flex-direction: column;
    gap: 0;
  }

  .seq-nav a {
    padding: 0.9rem 0;
  }

  .seq-nav .seq-prev {
    padding-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .seq-nav .seq-next {
    padding-left: 0;
    border-left: none;
    text-align: left;
  }
}

@media (min-width: 769px) {
  aside.toc .toc-bar {
    display: block;
  }

  aside.toc .toc-toggle {
    display: none;
  }
}
