/* Tanach Charts - tabbed layout.
   Everything Meir asked: tabs locked at the top while scrolling,
   one chart at a time, a tab per chart (no dropdown, no page-picker,
   no long intro section), a tab for each Yom Tov, click-through
   person charts, roomier fonts, calm colors. */
:root {
  --bg: #f7f4ec;
  --card: #fffdf7;
  --ink: #2b2b26;
  --muted: #6f6a5c;
  --accent: #1f3a5f;
  --line: #e3dcc9;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Frank Ruhl Libre", "David Libre", "Times New Roman", serif;
  font-size: 19px;
  line-height: 1.7;
}
/* The header with both tab rows stays locked at the top while the
   chart scrolls underneath. */
.site-head {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 14px 16px 0;
  box-shadow: 0 2px 8px rgba(43, 43, 38, 0.06);
}
h1 {
  margin: 0 0 10px;
  font-size: 27px;
  text-align: center;
  color: var(--accent);
}
.tab-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 0 10px;
  -webkit-overflow-scrolling: touch;
}
.tab-row::-webkit-scrollbar { display: none; }
.tab-row button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 18px;
  padding: 9px 18px;
  border-radius: 999px;
  cursor: pointer;
}
.tab-row button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.tab-row.sub button { font-size: 17px; padding: 7px 15px; }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
.viewer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
#item-title { font-size: 23px; margin: 0; }
.pdf-btn {
  flex: 0 0 auto;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-size: 17px;
  padding: 8px 20px;
  border-radius: 8px;
}
.chart-frame {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.chart-frame iframe {
  display: block;
  width: 100%;
  height: 78vh;
  border: 0;
}
.chart-frame .empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
}
/* Folded periods kept only if ever needed again. */
details.period {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 0 0 12px;
  overflow: hidden;
}
details.period > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  font-size: 20px;
}
details.period > summary::-webkit-details-marker { display: none; }
details.period > summary::after {
  content: "+";
  margin-inline-start: auto;
  font-size: 26px;
  color: var(--accent);
}
details.period[open] > summary::after { content: "\2212"; }
details.period ul { margin: 0; padding: 0 18px 14px; list-style: none; }
details.period li button {
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font: inherit;
  font-size: 18px;
  width: 100%;
  text-align: start;
  padding: 11px 4px;
  cursor: pointer;
}
details.period li:last-child button { border-bottom: 0; }
details.period li button:hover { color: var(--accent); }
/* Click-through person charts: main people as pills, each opens
   that person's own tree. */
.person-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0 12px;
}
.person-pills button {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 18px;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
}
.person-pills button.red { border-color: #b3564d; color: #b3564d; }
.person-pills button.green { border-color: #4d7c55; color: #4d7c55; }
.person-pills button.blue { border-color: #3f5f8a; color: #3f5f8a; }
.person-pills button.purple { border-color: #6b4d8a; color: #6b4d8a; }
.person-pills button.on {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.tree-list { list-style: none; margin: 0; padding: 0; }
.tree-list button {
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font: inherit;
  font-size: 18px;
  width: 100%;
  text-align: start;
  padding: 11px 4px;
  cursor: pointer;
}
.tree-list button:hover { color: var(--accent); }
@media (max-width: 640px) {
  body { font-size: 17px; }
  h1 { font-size: 21px; margin-bottom: 8px; }
  #item-title { font-size: 20px; }
  .tab-row button { font-size: 16px; padding: 8px 14px; }
  .tab-row.sub button { font-size: 15px; padding: 6px 12px; }
  details.period > summary { font-size: 18px; }
}
