:root {
  --mateo: #2e7d32;
  --marcos: #c0392b;
  --lucas: #1565c0;
  --juan: #7b1fa2;
  --bg: #fef9f1;
  --card: #fffdf8;
  --text: #4a3520;
  --muted: #8b7355;
  --border: #e8d5b0;
  --timeline: #c9a84c;
  --header-bg: #7c5a28;
  --header-bg2: #9e7040;
  --filter-bg: #a07840;
  --filter-bg2: #b88e52;
}

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

body {
  font-family: 'Georgia', serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
}

/* HEADER */
header {
  background: linear-gradient(135deg, var(--header-bg) 0%, var(--header-bg2) 60%, #c89a50 100%);
  color: #fdf3e0;
  text-align: center;
  padding: 3rem 1rem 2rem;
  border-bottom: 4px solid var(--timeline);
  position: relative;
}

header h1 {
  font-size: 2.4rem;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

header p {
  font-size: 1.05rem;
  color: #f0ddb0;
  font-style: italic;
}

.legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.5rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: #f0ddb0;
}

.legend-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  display: inline-block;
}

/* SITE BACK LINK */
.site-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  position: absolute;
  top: 1rem;
  left: 1.2rem;
  color: rgba(253,243,224,0.75);
  font-size: 0.78rem;
  font-family: Georgia, serif;
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: color 0.2s;
}

.site-link:hover {
  color: #fdf3e0;
}

/* LANGUAGE LINK */
.lang-link {
  position: absolute;
  top: 1rem;
  right: 1.2rem;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.5);
  color: #fdf3e0;
  padding: 0.3rem 0.9rem;
  border-radius: 16px;
  font-size: 0.82rem;
  font-family: Georgia, serif;
  font-weight: bold;
  letter-spacing: 0.05em;
  text-decoration: none;
  transition: all 0.2s;
}

.lang-link:hover {
  background: var(--timeline);
  border-color: var(--timeline);
  color: #2a1800;
}

/* LANGUAGE SWITCHER */
.lang-switcher {
  position: absolute;
  top: 1rem;
  right: 1.2rem;
  display: flex;
  gap: 0.3rem;
}

.lang-btn {
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.5);
  color: #fdf3e0;
  padding: 0.25rem 0.75rem;
  border-radius: 16px;
  cursor: pointer;
  font-size: 0.82rem;
  font-family: inherit;
  font-weight: bold;
  letter-spacing: 0.05em;
  transition: all 0.2s;
}

.lang-btn:hover {
  background: rgba(255,255,255,0.32);
}

.lang-btn.active {
  background: var(--timeline);
  border-color: var(--timeline);
  color: #2a1800;
}

/* LANGUAGE VISIBILITY */
html[lang="en"] .lang-es { display: none !important; }
html[lang="es"] .lang-en { display: none !important; }

/* FILTERS */
.filters {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--filter-bg);
  padding: 0.7rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  border-bottom: 2px solid var(--timeline);
}

.filter-btn {
  background: transparent;
  border: 1px solid #f0d898;
  color: #f0d898;
  padding: 0.3rem 0.9rem;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.82rem;
  transition: all 0.2s;
  font-family: inherit;
}

.filter-btn:hover, .filter-btn.active {
  background: var(--timeline);
  color: #2a1800;
  font-weight: bold;
  border-color: var(--timeline);
}

/* TIMELINE */
main {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}

.period {
  margin-bottom: 3rem;
}

.period-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  cursor: pointer;
  user-select: none;
}

.period-number {
  background: var(--timeline);
  color: #2a1800;
  font-weight: bold;
  font-size: 1rem;
  width: 42px; height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(180,140,60,0.35);
}

.period-info h2 {
  font-size: 1.3rem;
  color: var(--text);
}

.period-info .period-date {
  font-size: 0.82rem;
  color: var(--muted);
  font-style: italic;
}

.period-toggle {
  margin-left: auto;
  font-size: 1.2rem;
  color: var(--timeline);
  transition: transform 0.3s;
}

.period-body {
  padding-left: 2.5rem;
  border-left: 3px solid var(--border);
  margin-left: 21px;
}

.event {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 1.2rem;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(120,80,20,0.07);
  transition: box-shadow 0.2s;
}

.event:hover {
  box-shadow: 0 3px 12px rgba(120,80,20,0.13);
}

.event-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  background: #fdf6e8;
  border-bottom: 1px solid var(--border);
}

.event-title {
  font-weight: bold;
  font-size: 0.97rem;
  flex: 1;
}

.refs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.ref-badge {
  font-size: 0.72rem;
  padding: 0.15rem 0.55rem;
  border-radius: 12px;
  font-weight: bold;
  color: white;
  white-space: nowrap;
}

.ref-mateo   { background: var(--mateo); }
.ref-marcos  { background: var(--marcos); }
.ref-lucas   { background: var(--lucas); }
.ref-juan    { background: var(--juan); }

.event-body {
  display: none;
  padding: 1rem;
}

.event-body.open {
  display: block;
}

.verse-block {
  margin-bottom: 1rem;
  padding: 0.8rem 1rem;
  border-left: 4px solid;
  background: #fdfaf3;
  border-radius: 0 6px 6px 0;
}

.verse-block.mateo  { border-color: var(--mateo); }
.verse-block.marcos { border-color: var(--marcos); }
.verse-block.lucas  { border-color: var(--lucas); }
.verse-block.juan   { border-color: var(--juan); }

.verse-book {
  font-size: 0.78rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.4rem;
}

.verse-book.mateo  { color: var(--mateo); }
.verse-book.marcos { color: var(--marcos); }
.verse-book.lucas  { color: var(--lucas); }
.verse-book.juan   { color: var(--juan); }

.verse-text {
  font-size: 0.94rem;
  line-height: 1.8;
  color: var(--text);
}

.verse-num {
  font-size: 0.7rem;
  font-weight: bold;
  vertical-align: super;
  margin-right: 2px;
  color: var(--muted);
}

.event-note {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border);
}

/* INTRO */
.intro-box {
  background: #fff8e4;
  border: 1px solid var(--timeline);
  border-radius: 10px;
  padding: 1.2rem 1.5rem;
  margin-bottom: 2.5rem;
  font-size: 0.93rem;
  color: var(--muted);
}

.intro-box strong { color: var(--text); }

/* FOOTER */
footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  padding: 2rem 1rem;
  border-top: 1px solid var(--border);
}

/* HARMONIZATION NOTE (for resurrection analysis) */
.harmonization-note {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
  margin-bottom: 0.9rem;
  padding: 0.6rem 0.9rem;
  border-left: 3px solid var(--border);
  background: #faf8f2;
  border-radius: 0 4px 4px 0;
}

.note-label {
  font-style: normal;
  font-weight: bold;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  display: block;
  margin-bottom: 0.2rem;
}

/* ANALYSIS BOX (for resurrection analysis) */
.event-analysis {
  margin-bottom: 1rem;
  padding: 1rem 1.1rem;
  background: #f0ece0;
  border: 1px solid #d8cc9a;
  border-radius: 6px;
  font-size: 0.91rem;
  line-height: 1.8;
  color: var(--text);
}

.analysis-label {
  font-weight: bold;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #8a6e1a;
  display: block;
  margin-bottom: 0.5rem;
}

.event-analysis p { margin-bottom: 0.6rem; }
.event-analysis p:last-child { margin-bottom: 0; }

/* HARMONY TABLE (for resurrection summary) */
.harmony-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; margin: 1rem 0; }
.harmony-table th { padding: 0.4rem 0.6rem; text-align: left; color: white; font-weight: bold; }
.harmony-table td { padding: 0.4rem 0.6rem; border: 1px solid var(--border); vertical-align: top; }
.harmony-table tr:nth-child(even) td { background: #f5f0e8; }
.harmony-table .period-row td { background: #e8dfc8; font-size: 0.85rem; padding: 0.5rem 0.6rem; border-bottom: 2px solid #c0b08a; }
.th-event  { background: #5a4a2a; }
.th-mateo  { background: var(--mateo); }
.th-marcos { background: var(--marcos); }
.th-lucas  { background: var(--lucas); }
.th-juan   { background: var(--juan); }

/* PROJECT NAV (switch between full gospels and resurrection) */
.project-nav {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.project-link {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.4);
  color: #f0ddb0;
  padding: 0.3rem 0.9rem;
  border-radius: 16px;
  font-size: 0.82rem;
  font-family: Georgia, serif;
  text-decoration: none;
  letter-spacing: 0.05em;
  transition: all 0.2s;
}

.project-link:hover, .project-link.active {
  background: var(--timeline);
  border-color: var(--timeline);
  color: #2a1800;
}

/* LAST VERSE BLOCK NO MARGIN */
.verse-block:last-child { margin-bottom: 0; }

@media (max-width: 600px) {
  header h1 { font-size: 1.6rem; }
  .period-body { padding-left: 1rem; }
  .lang-switcher { top: 0.5rem; right: 0.6rem; }
  .harmony-table { font-size: 0.75rem; }
}
