/* Lectura Sin Spoilers */

:root {
  --bg: #FAF7F2;
  --surface: #FFFFFF;
  --surface-warm: #F5F0E8;
  --border: #E0D8CC;
  --border-light: #EDE7DD;
  --text: #2C2520;
  --text-mid: #4A4038;
  --text-muted: #6B6158;
  --text-faint: #9B9188;
  --accent: #8B6914;
  --accent-bg: rgba(139,105,20,0.06);
  --shadow-sm: 0 1px 3px rgba(44,37,32,0.05);
  --shadow: 0 2px 8px rgba(44,37,32,0.07);
  --radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.inner {
  max-width: 860px;
  margin: 0 auto;
  padding-left: 2rem;
  padding-right: 2rem;
}

/* ── Page Header ── */

.page-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  padding: 1.5rem 0 1.25rem;
}
.page-header .inner {
  text-align: left;
}
.page-header--center .inner {
  text-align: center;
}
.page-header h1 {
  font-family: 'Instrument Serif', serif;
  font-size: 1.8rem;
  font-weight: 400;
  color: var(--text);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0.4rem 0 0.2rem;
}
.page-header--center h1 {
  font-size: 2rem;
  margin-bottom: 0.3rem;
}
.header-sub {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: 0.88rem;
  color: var(--text-faint);
}

/* Header row (crumbs left, nav right) */
.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Breadcrumbs (inline in header) */
.crumbs {
  font-size: 0.75rem;
  color: var(--text-faint);
}
.crumbs a {
  color: var(--text-muted);
  text-decoration: none;
}
.crumbs a:hover { color: var(--accent); }
.crumbs .sep {
  margin: 0 0.35rem;
  opacity: 0.4;
}

/* Chapter nav in header */
.ch-nav {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.ch-nav a {
  color: var(--text-faint);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: color 0.15s;
}
.ch-nav a:hover { color: var(--accent); }
.ch-pos {
  font-size: 0.72rem;
  color: var(--text-faint);
  opacity: 0.6;
}

/* ── Tabs ── */

.tabs {
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 100;
}
.tabs .inner {
  display: flex;
  gap: 0;
}
.tab {
  padding: 0.7rem 1.25rem;
  cursor: pointer;
  color: var(--text-faint);
  border-bottom: 2px solid transparent;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.15s;
  user-select: none;
  white-space: nowrap;
}
.tab:hover { color: var(--text-muted); }
.tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.tab-count {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-faint);
  background: var(--surface-warm);
  padding: 0.1rem 0.4rem;
  border-radius: 10px;
  margin-left: 0.15rem;
}
.tab.active .tab-count {
  color: var(--accent);
  background: var(--accent-bg);
}

/* ── Content Area ── */

.content {
  padding: 2rem 0 3rem;
  max-width: 860px;
  margin: 0 auto;
  padding-left: 2rem;
  padding-right: 2rem;
}
.tab-content { display: none; }
.tab-content.active {
  display: block;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Summary (Este capitulo) ── */

.summary {
  font-size: 0.95rem;
  color: var(--text-mid);
  line-height: 1.8;
  margin-bottom: 2.5rem;
  text-align: justify;
}

/* ── Sections (Este capitulo) ── */

.section {
  margin-bottom: 2rem;
}
.section-title {
  font-family: 'Instrument Serif', serif;
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-light);
}

/* Scene items */
.scene-item {
  padding: 0.45rem 0;
  font-size: 0.88rem;
  line-height: 1.6;
  border-bottom: 1px solid var(--border-light);
}
.scene-item:last-child { border-bottom: none; }
.scene-name {
  font-weight: 700;
  color: var(--text);
  margin-right: 0.4rem;
}
.scene-desc { color: var(--text-muted); }
.scene-minor .scene-name { font-weight: 600; }
.scene-minor .scene-desc { color: var(--text-faint); }

/* ── Search ── */

.search-bar { margin-bottom: 1.5rem; }
.search-bar input {
  width: 100%;
  max-width: 400px;
  padding: 0.6rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-bar input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.search-bar input::placeholder { color: var(--text-faint); }

/* ── Group Labels ── */

.group-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin: 2rem 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.group-label:first-child { margin-top: 0; }
.group-count {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-bg);
  padding: 0.1rem 0.45rem;
  border-radius: 10px;
}

/* ── Entries (characters & places) ── */

.entry {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.1rem;
  box-shadow: var(--shadow-sm);
}
.entry h3 {
  font-family: 'Instrument Serif', serif;
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 0.15rem;
}

/* Main character entries — full width, editorial layout */
.entry-main {
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border-light);
  border-radius: 0;
}
.entry-main:last-of-type { border-bottom: none; }
.entry-main h3 {
  font-size: 1.3rem;
  margin-bottom: 0.2rem;
}

.entry-aliases {
  font-size: 0.78rem;
  color: var(--text-faint);
  font-style: italic;
  margin-bottom: 0.3rem;
}
.entry-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 0.5rem;
}
.entry-meta {
  font-size: 0.75rem;
  color: var(--text-faint);
  margin-top: 0.4rem;
}

/* ── Entry Grid ── */

.entry-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.entry-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

/* Compact entry (for secondary places) */
.entry-compact {
  padding: 0.9rem;
}
.entry-compact h3 {
  font-size: 0.95rem;
}
.entry-compact .entry-desc {
  font-size: 0.8rem;
}

/* ── Relationship Pills ── */

.entry-rels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0.5rem 0 0.25rem;
}
.rel-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 0.25rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--surface-warm);
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  line-height: 1.4;
}
.rel-pill strong {
  color: var(--text-mid);
  font-weight: 600;
}
.rel-more {
  font-size: 0.7rem;
  color: var(--text-faint);
  padding: 0.2rem 0.4rem;
}

/* ── Mention List ── */

.mention-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.mention-item {
  padding: 0.5rem 0.75rem;
  font-size: 0.82rem;
  line-height: 1.5;
  border-bottom: 1px solid var(--border-light);
}
.mention-item strong {
  color: var(--text);
  margin-right: 0.3rem;
}
.mention-item span {
  color: var(--text-faint);
}

/* ── Event List (places) ── */

.entry-events {
  list-style: none;
  margin: 0.4rem 0;
  padding: 0;
}
.entry-events li {
  font-size: 0.78rem;
  color: var(--text-faint);
  line-height: 1.55;
  padding: 0.15rem 0 0.15rem 0.9rem;
  position: relative;
}
.entry-events li::before {
  content: "·";
  position: absolute;
  left: 0;
  font-weight: 700;
  color: var(--border);
}

/* ── Chapter Navigation (bottom) ── */

.chapter-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-light);
  font-size: 0.82rem;
}
.chapter-nav a {
  color: var(--text-faint);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s;
}
.chapter-nav a:hover {
  color: var(--accent);
}

/* ── About Text (landing) ── */

.about-text {
  font-family: 'Instrument Serif', serif;
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--text-muted);
  font-style: italic;
  max-width: 620px;
  margin: 0 auto 2rem;
  text-align: center;
}

/* ── Book Cards (landing) ── */

.book-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}
.book-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.15s;
}
.book-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.book-card h2 {
  font-family: 'Instrument Serif', serif;
  font-size: 1.35rem;
  font-weight: 400;
}
.book-card h2 a {
  color: var(--text);
  text-decoration: none;
}
.book-card h2 a:hover { color: var(--accent); }
.book-author {
  color: var(--text-faint);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  margin: 0.15rem 0 0.3rem;
}
.book-meta {
  font-size: 0.78rem;
  color: var(--text-faint);
}

/* ── Chapter List (book index) ── */

.content-hint {
  color: var(--text-faint);
  font-size: 0.88rem;
  margin-bottom: 0.75rem;
}
.chapter-list {
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  overflow: hidden;
}
.chapter-list li {
  border-bottom: 1px solid var(--border-light);
}
.chapter-list li:last-child { border-bottom: none; }
.chapter-list a {
  display: block;
  padding: 0.8rem 1.1rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  transition: all 0.15s;
}
.chapter-list a:hover {
  background: var(--accent-bg);
  color: var(--text);
}
.ch-num {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.8rem;
  margin-right: 0.35rem;
}

/* ── Footer ── */

.site-footer {
  text-align: center;
  padding: 2rem 0;
  font-size: 0.72rem;
  color: var(--text-faint);
  border-top: 1px solid var(--border-light);
}

/* ── Utilities ── */

.hidden { display: none !important; }

/* ── Scrollbar ── */

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* ── Responsive ── */

@media (max-width: 700px) {
  .inner, .content { padding-left: 1.25rem; padding-right: 1.25rem; }
  .page-header h1 { font-size: 1.4rem; }
  .page-header--center h1 { font-size: 1.6rem; }
  .tab { padding: 0.6rem 0.9rem; font-size: 0.78rem; }
  .entry-grid { grid-template-columns: 1fr; }
  .entry-grid-3 { grid-template-columns: 1fr 1fr; }
  .mention-list { grid-template-columns: 1fr; }
  .chapter-nav { flex-direction: column; gap: 0.6rem; }
  .ch-nav { flex-wrap: wrap; justify-content: flex-start; gap: 0.6rem; }
}
