/* Layout */

.site-header {
  text-align: center;
  padding: 2.5rem 1rem 0.75rem;
}

.site-logo {
  display: block;
  margin: 0 auto 0.5rem;
  border-radius: 16px;
}

.logo-link,
.title-link {
  text-decoration: none;
  color: inherit;
}

.logo-link:hover,
.title-link:hover {
  opacity: 0.8;
}

.site-header h1 {
  font-size: 2.4rem;
  margin: 0;
  letter-spacing: 0.04em;
}

.motto {
  font-size: 1rem;
  color: var(--fg-muted);
  max-width: 50ch;
  margin: 0.5rem auto 0;
  line-height: 1.5;
}

.header-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.schedule-link,
.current-book-link,
.apply-link {
  display: inline-block;
  padding: 0.4rem 1.2rem;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  border: 2px solid var(--border);
  border-radius: 2rem;
  text-decoration: none;
  transition: all 0.15s;
}

.schedule-link {
  color: var(--fg-muted);
}

.schedule-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.current-book-link {
  color: var(--accent);
  border-color: var(--accent);
}

.current-book-link:hover {
  background: var(--accent);
  color: var(--bg);
  text-decoration: none;
}

.apply-link {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.apply-link:hover {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
  text-decoration: none;
}

main {
  max-width: 70ch;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--fg-muted);
  font-size: 0.85em;
  border-top: 1px solid var(--border);
}
footer .image-credit {
  margin-top: 0.25rem;
  font-size: 0.9em;
  font-style: italic;
}

/* Unified navigation bar */

.navbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  border-bottom: 2px solid var(--border);
  max-width: 70ch;
  margin: 0 auto;
  padding: 0 1.25rem;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.88rem;
}

/* Text tabs */

.tab {
  padding: 0.35rem 0.75rem;
  text-decoration: none;
  color: var(--fg-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}

.tab:hover {
  color: var(--fg);
  text-decoration: none;
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.tab.current {
  position: relative;
}

.tab.current::after {
  content: "";
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  position: absolute;
  top: 0.3rem;
  right: 0.1rem;
}

/* Nav segments — hidden by default, visible groups when active */

.nav-segment {
  display: none;
}

.nav-segment.active {
  display: contents;
}

.nav-divider {
  display: none;
}

/* Segment children get a background to visually group them */
.nav-segment.active > .tab {
  background: var(--tab-bg);
  margin: 0.15rem 0;
}

.nav-segment.active > .pill {
  background-color: var(--tab-bg);
  margin: 0.15rem 0.1rem;
}

/* Override: active/past pills keep their own backgrounds */
.nav-segment.active > .pill.active {
  background: var(--pill-active-bg);
}

.nav-segment.active > .pill.past:not(.active) {
  background: var(--accent-light);
}

/* First item in segment gets left margin for spacing from previous group */
.nav-segment.active > .nav-divider + * {
  margin-left: 0.5rem;
}

/* Pill items inside nav */

.pill {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--pill-bg);
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 600;
  margin: 0.25rem 0.15rem;
  transition: all 0.15s;
}

.pill:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.pill.active {
  background: var(--pill-active-bg);
  color: var(--pill-active-fg);
  border-color: var(--pill-active-bg);
}

.pill.current {
  box-shadow: 0 0 0 3px var(--pill-current-ring);
}

.pill-about {
  width: auto;
  padding: 0 0.6rem;
  border-radius: 0.9rem;
  font-size: 0.7rem;
}

/* Past books: filled */
.pill.past {
  background: var(--accent-light);
  border-color: var(--accent-light);
  color: var(--bg);
}

.pill.past.active {
  background: var(--pill-active-bg);
  border-color: var(--pill-active-bg);
  color: var(--pill-active-fg);
}

/* Panels */

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.main-panel {
  padding-top: 1.5rem;
}

.cycle-panel {
  padding-top: 1rem;
}

#cycle-arc-0 table {
  margin: 1.5rem 0;
}

#cycle-arc-0 table a {
  color: inherit;
  text-decoration: none;
  font-weight: inherit;
}

#cycle-arc-0 table a:hover {
  text-decoration: underline;
  color: var(--accent);
}

/* Book cards & Arc cards */

.book-card,
.arc-card {
  display: none;
  padding: 1.5rem 0;
}

.book-card.active,
.arc-card.active {
  display: block;
}

.book-card.current {
  border-left: 3px solid var(--accent);
  padding-left: 1.25rem;
}

.book-card h3,
.arc-card h3 {
  font-size: 1.5rem;
  margin: 0 0 0.25rem;
}

.book-meta {
  color: var(--fg-muted);
  font-size: 0.9rem;
  margin: 0 0 1rem;
  font-family: system-ui, -apple-system, sans-serif;
}

.book-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.85rem;
}

.book-links a {
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  text-decoration: none;
  color: var(--fg-muted);
  transition: all 0.15s;
}

.book-links a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Scripture epigraph — classical chapter-opening style */
.section-epigraph {
  margin: 0 0 2.25rem;
  padding: 0 1.5rem;
  font-size: 0.96rem;
  line-height: 1.6;
}

.section-epigraph .epigraph-text {
  font-style: italic;
  color: var(--fg);
  margin: 0 0 0.5rem;
}

.section-epigraph .epigraph-text::before {
  content: "\201C";
  margin-right: 0.05em;
}

.section-epigraph .epigraph-text::after {
  content: "\201D";
  margin-left: 0.05em;
}

.section-epigraph .epigraph-ref {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
  margin: 0;
  text-transform: uppercase;
  font-weight: 600;
  text-align: right;
}

/* Epigraph size 2 (cycle-about card) */
.arc-card .section-epigraph {
  padding: 0 1rem;
  font-size: 0.9rem;
}

/* Hero images: size 3 (top-level tabs) */
.section-hero {
  width: 100%;
  max-height: 350px;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 1.5rem;
}

/* Hero images: size 2 (year about cards, cycle about) */
.year-about-card .section-hero,
.arc-card .section-hero {
  max-height: 250px;
}

/* Founders: full-width photo between paragraphs */
.founders-photo {
  width: 100%;
  border-radius: 4px;
  margin: 1.5rem 0;
}

.book-cover {
  float: right;
  width: 120px;
  height: 170px;
  object-fit: cover;
  margin: 0 0 0.75rem 1.25rem;
  border-radius: 3px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.book-covers {
  float: right;
  display: flex;
  gap: 0.5rem;
  margin: 0 0 0.75rem 1.25rem;
}

.book-covers .book-cover {
  float: none;
  margin: 0;
  width: 90px;
  height: 128px;
}

@media (max-width: 500px) {
  .book-cover { width: 90px; height: 128px; }
  .book-covers .book-cover { width: 70px; height: 100px; }
}

.book-description {
  margin-bottom: 1.5rem;
}

.book-virtues {
  margin-bottom: 1.5rem;
  font-size: 0.95em;
}

.virtue {
  display: inline;
  color: var(--fg-muted);
}

.book-find-it {
  font-size: 0.9em;
  color: var(--fg-muted);
  margin-bottom: 1.5rem;
}

.book-find-it p {
  margin: 0.2em 0;
}

.book-find-it a {
  color: var(--accent);
}

.book-essays {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.book-essays h4 {
  font-size: 1rem;
  margin: 0 0 0.75rem;
  font-family: system-ui, -apple-system, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-muted);
}

.book-essays ol {
  padding-left: 1.5rem;
}

.book-essays li {
  margin-bottom: 0.75rem;
}

/* Next button */

.book-next,
.arc-next {
  display: none;
  padding-top: 1rem;
}

.book-next.active,
.arc-next.active {
  display: block;
}

.next-button {
  display: inline-block;
  padding: 0.5rem 1.2rem;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.88rem;
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 4px;
  text-decoration: none;
  transition: all 0.15s;
}

.next-button:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

/* Year intro (inside About card) */

.year-intro {
  color: var(--fg-muted);
  font-style: italic;
}

/* Arc cards */

.arc-card h3 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
}

/* Word cloud */

.word-cloud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.4rem 0.8rem;
  padding: 1.5rem 0;
  line-height: 1.8;
}

.theme-word {
  position: relative;
  color: var(--fg-muted);
  cursor: default;
  transition: color 0.15s;
  white-space: nowrap;
}

.theme-word:hover {
  color: var(--accent);
}

.theme-tooltip {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  min-width: 14rem;
  max-width: 20rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 10;
  font-size: 0.82rem;
  line-height: 1.5;
  font-family: system-ui, -apple-system, sans-serif;
}

@media (max-width: 600px) {
  .theme-tooltip {
    position: fixed;
    top: 50%;
    bottom: auto;
    left: 1rem;
    right: 1rem;
    transform: translateY(-50%);
    min-width: 0;
    max-width: none;
    width: auto;
  }
}

.theme-word:hover .theme-tooltip {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.theme-tooltip a {
  display: block;
  color: var(--link);
  text-decoration: none;
  padding: 0.15rem 0;
}

.theme-tooltip a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

.theme-year {
  color: var(--fg-muted);
  font-size: 0.75rem;
}

/* Schedule table */

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.92rem;
}

.schedule-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid var(--border);
  font-weight: 600;
  color: var(--fg-muted);
}

.schedule-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.schedule-table a {
  text-decoration: none;
  color: var(--link);
}

.schedule-table a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

.schedule-past td {
  color: var(--fg-muted);
}

.schedule-past a {
  color: var(--fg-muted);
}

.schedule-current {
  background: var(--highlight);
}

.schedule-current td {
  font-weight: 600;
}

.schedule-event td {
  font-style: italic;
  text-align: center;
  font-size: 1.05rem;
}

.schedule-event td:first-child {
  border-left: 3px solid var(--link);
}

.schedule-event.schedule-past td:first-child {
  border-left-color: var(--border);
}

/* Private tab */

.private-lock {
  text-align: center;
  padding: 3rem 1rem;
}

.private-form {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.private-input-wrap {
  position: relative;
  display: inline-block;
}

.private-input {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.5rem 2.25rem 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--fg);
  width: 16rem;
  max-width: 60vw;
}

.private-reveal {
  position: absolute;
  right: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0.2rem;
  cursor: pointer;
  color: var(--fg-muted);
  display: flex;
  align-items: center;
}

.private-reveal:hover {
  color: var(--fg);
}

.private-reveal .eye-closed {
  display: none;
}

.private-submit {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--accent);
  color: var(--bg);
  cursor: pointer;
}

.private-submit:hover {
  opacity: 0.85;
}

.private-error {
  color: var(--accent);
  margin-top: 0.75rem;
}

.private-content {
  max-width: 65ch;
  margin: 0 auto;
}

/* Event Planner */

.ep-header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.ep-header h1 {
  font-size: 2rem;
  margin: 0;
}

.ep-subtitle {
  font-style: italic;
  color: var(--fg-muted);
  font-size: 1.05rem;
}

.event-planner h2 {
  font-size: 1.2rem;
  color: var(--accent);
  margin: 1.8rem 0 0.6rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
}

.event-planner h2:first-of-type {
  margin-top: 0;
}

.ep-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.92rem;
  margin: 0.5rem 0 1.5rem;
}

.ep-grid-single {
  grid-template-columns: 1fr;
}

.ep-field {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.ep-grid:not(.ep-grid-single) .ep-field:nth-child(odd) {
  border-right: 1px solid var(--border);
}

.ep-label {
  font-weight: 600;
  color: var(--fg);
  padding: 0.5rem 0.65rem;
  background: var(--bg-hover);
  white-space: nowrap;
  min-width: 7rem;
}

.ep-value {
  flex: 1;
  padding: 0.5rem 0.65rem;
  background: var(--bg-card);
  min-height: 1.8em;
}

.ep-intro {
  font-style: italic;
  color: var(--fg-muted);
  margin-bottom: 0.8rem;
  font-size: 0.95rem;
}

.ep-label-cell {
  font-weight: 600;
  background: var(--bg-hover);
  white-space: nowrap;
  width: 35%;
}

.ep-when {
  display: inline-block;
  font-family: system-ui, -apple-system, sans-serif;
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--accent);
  background: var(--virtue-bg);
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  letter-spacing: 0.02em;
}

.ep-check {
  text-align: center;
  width: 3rem;
  font-size: 1.1rem;
  color: var(--fg-muted);
}

.ep-footer {
  margin-top: 2rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-style: italic;
  color: var(--fg-muted);
  font-size: 0.9rem;
}

@media (max-width: 600px) {
  .ep-grid {
    grid-template-columns: 1fr;
  }
  .ep-grid .ep-field:nth-child(odd) {
    border-right: none;
  }
  .ep-header h1 {
    font-size: 1.6rem;
  }
}

@media print {
  @page { size: letter; margin: 0.5in 0.55in; }
  .event-planner * { color: #000 !important; background: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .event-planner { font-size: 8.2pt; line-height: 1.32; }
  .event-planner .ep-header { text-align: left; margin-bottom: 0.3rem; padding-bottom: 0.25rem; border-bottom: 1.5pt solid #000 !important; }
  .event-planner .ep-header h1 { font-size: 15pt; display: inline; }
  .event-planner .ep-subtitle { font-size: 8.5pt; display: inline; margin-left: 0.5em; }
  .event-planner h2 { font-size: 9.5pt; font-weight: 700; margin: 0.35rem 0 0.15rem; padding-bottom: 0; border-bottom: 0.5pt solid #888 !important; page-break-after: avoid; }
  .event-planner table { font-size: 7.8pt; margin: 0.1rem 0 0.3rem; }
  .event-planner thead th { background: #333 !important; color: #fff !important; padding: 0.2rem 0.35rem; font-size: 7pt; border-color: #333 !important; }
  .event-planner tbody td { padding: 0.18rem 0.35rem; border-color: #ccc !important; line-height: 1.25; background: #fff !important; }
  .event-planner tbody tr:nth-child(even) td { background: #f4f4f4 !important; }
  .event-planner .ep-label-cell { background: #f0f0f0 !important; }
  .event-planner .ep-when { font-size: 7pt; padding: 0.05rem 0.25rem; background: #eee !important; border: 0.5pt solid #bbb; }
  .event-planner .ep-check { font-size: 9pt; }
  .event-planner .ep-grid { font-size: 7.8pt; margin: 0.1rem 0 0.3rem; border-radius: 0; border-color: #999 !important; }
  .event-planner .ep-field { border-color: #ccc !important; }
  .event-planner .ep-label { padding: 0.18rem 0.35rem; background: #f0f0f0 !important; }
  .event-planner .ep-value { padding: 0.18rem 0.35rem; min-height: 1.2em; }
  .event-planner .ep-footer { margin-top: 0.3rem; padding-top: 0.2rem; font-size: 7.5pt; border-color: #888 !important; }
  .event-planner table, .event-planner tr, .event-planner .ep-grid { page-break-inside: avoid; }

  /* Hide everything else when printing event planner */
  body:has(.event-planner.active) .site-header,
  body:has(.event-planner.active) .navbar,
  body:has(.event-planner.active) footer,
  body:has(.event-planner.active) .tab-panel:not(.event-planner) { display: none !important; }
}

/* Responsive */

@media (max-width: 600px) {
  .site-header h1 {
    font-size: 1.8rem;
  }

  .navbar {
    padding: 0 0.75rem;
  }

  .tab {
    padding: 0.5rem 0.5rem;
    font-size: 0.8rem;
  }

  .pill {
    width: 1.6rem;
    height: 1.6rem;
    font-size: 0.7rem;
  }

  main {
    padding: 0 0.75rem 2rem;
  }

  .book-card h3 {
    font-size: 1.25rem;
  }

  .current-book-link {
    font-size: 0.82rem;
    padding: 0.3rem 0.9rem;
  }
}
