/* Timeline section (BBG#102). Builds on learn.css; colours come from the theme variables, and the
   section colours are only used as bar fills and chip stripes, never behind text. */

.timeline {
  --tl-label: 9.5rem;
  --tl-ink: #1a1408; /* text on the section colours, which are all light */
  --tl-shelf: #7a4c12;
  /* The family line of Jesus (BBG#119): at least 3:1 against the chart panel in every theme
     (arcade 3.9, dark 5.3, light and classic 3.2). */
  --tl-line: #4f8cff;
}
@media (min-width: 640px) {
  .timeline { --tl-label: 13rem; }
}

/* The Library is a full-width board (mockup board 5: 1440px with 32px gutters); the other pages keep
   the /learn/ reading column. */
main.learn.timeline.is-wide { width: min(96vw, 1376px); }

/* Section colours (.sec-*) are written into each page from SHELF_SECTIONS in scripts/timeline-content.js. */
.timeline .lane-united { --tl-c: #f5c451; }
.timeline .lane-israel { --tl-c: #b3a4e6; } /* not blue: blue is the line of Jesus */
.timeline .lane-judah { --tl-c: #e0895a; }
.timeline .lane-prophets { --tl-c: #d98aa0; }
.timeline .is-life, .timeline .is-story { --tl-c: var(--accent); }
/* Light and dark have a blue accent, so their other people's bars go slate, leaving blue to the line. */
[data-theme="light"] .timeline .is-life, [data-theme="light"] .timeline .is-story { --tl-c: #64748b; }
[data-theme="dark"] .timeline .is-life, [data-theme="dark"] .timeline .is-story { --tl-c: #94a3b8; }
.timeline .tl-bar.is-line, .timeline .tl-key.is-line { --tl-c: var(--tl-line); }
.timeline .tl-key { display: inline-block; width: 1.4rem; height: 0.6rem; border-radius: 999px; background: var(--tl-c); margin-right: 0.45rem; vertical-align: 0.05rem; }
.timeline .tl-chart-legend { margin: 0.5rem 0 0; font-size: 0.8rem; color: var(--muted); }
.timeline .tl-line-tag { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.5rem; margin: 0.4rem 0 0; padding: 0.45rem 0.8rem; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--tl-line); font-size: 0.9rem; }
.timeline .tl-line-tag strong { color: var(--text); }
.timeline .tl-line-tag span:not(.tl-key) { color: var(--muted); }
.timeline .tl-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.timeline .tl-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--tl-c); margin-right: 0.4rem; vertical-align: 0; }

/* Hero (board 5) */
.timeline .tl-hero { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.2rem 2.5rem; }
.timeline .tl-hero-text { max-width: 44rem; }
.timeline .tl-hero h1 { font-family: var(--font-display, inherit); font-weight: 400; font-size: clamp(2.1rem, 1.4rem + 3vw, 3.25rem); line-height: 1.05; }
.timeline .tl-hero .lede { color: var(--muted); }
.timeline .tl-hero-ctas { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1rem; }
.timeline .tl-hero-ctas a { min-height: 48px; display: inline-flex; align-items: center; padding: 0 1.3rem; border-radius: 14px; font-weight: 700; text-decoration: none; }
.timeline .tl-cta-ghost { border: 1px solid var(--line); color: var(--text) !important; }
.timeline .tl-cta-ghost:hover { border-color: var(--accent); }
.timeline .tl-stats { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 0; }
.timeline .tl-stats div { display: flex; flex-direction: column-reverse; min-width: 6.5rem; padding: 0.85rem 1.1rem; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.timeline .tl-stats dd { margin: 0; font-family: var(--font-display, inherit); font-size: 1.9rem; line-height: 1; color: var(--accent); }
.timeline .tl-stats dt { font-size: 0.85rem; color: var(--muted); }
@media (max-width: 639px) {
  .timeline .tl-stats { width: 100%; flex-wrap: nowrap; gap: 0.5rem; }
  .timeline .tl-stats div { flex: 1 1 0; min-width: 0; padding: 0.7rem 0.75rem; }
  .timeline .tl-stats dd { font-size: 1.45rem; }
}

/* Board cards */
.timeline .tl-board { margin-top: 1rem; padding: 1.4rem; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-soft); }
.timeline .tl-board-flush { padding: 0; overflow: hidden; }

/* In your Bible: the bookshelf. Spine width = chapters; each spine carries its own bit of shelf so
   wrapped rows still sit on a shelf. */
.timeline .tl-shelves { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1.6rem 2.2rem; }
.timeline .tl-shelf h3 { margin: 0 0 0.6rem; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; display: flex; align-items: center; }
.timeline .tl-shelf h3 .range { margin-left: 0.4rem; letter-spacing: 0; font-size: 0.75rem; }
.timeline .tl-spines { display: flex; flex-wrap: wrap; align-items: flex-end; row-gap: 0.8rem; }
.timeline .tl-spine { display: block; padding-right: 3px; border-bottom: 4px solid var(--tl-shelf); text-decoration: none; }
.timeline .tl-spine > span { display: flex; align-items: center; justify-content: center; max-width: 150px; background: var(--tl-c); border-radius: 4px 4px 0 0; overflow: hidden; box-shadow: inset -2px 0 0 rgba(0, 0, 0, 0.18); transition: transform 0.15s; }
.timeline .tl-spine > span > span { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 12px; font-weight: 700; color: var(--tl-ink); white-space: nowrap; }
.timeline .tl-spine:hover > span, .timeline .tl-spine:focus-visible > span { transform: translateY(-6px); }
.timeline .tl-spine:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* In history: one wide strip, scrolled sideways on phones */
.timeline .tl-strip-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.timeline .tl-strip-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.timeline .tl-strip { position: relative; margin: 0 auto; }
.timeline .tl-era-band { position: absolute; top: 0; bottom: 0; }
.timeline .tl-era-band.is-alt { background: rgba(127, 127, 127, 0.07); }
.timeline .tl-era-band.is-silence { background-image: repeating-linear-gradient(135deg, rgba(127, 127, 127, 0.14) 0 6px, transparent 6px 12px); }
.timeline .tl-era-band > span { position: absolute; top: 6px; left: 6px; font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.timeline .tl-era-band > span.is-low { top: 18px; }
.timeline .tl-marker { position: absolute; top: 32px; bottom: 36px; border-left: 1px dashed var(--accent); opacity: 0.8; }
.timeline .tl-marker-label { position: absolute; top: 34px; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); white-space: nowrap; }
.timeline .tl-hbar { position: absolute; height: 20px; border-radius: 5px; background: var(--tl-c); color: var(--tl-ink); font-size: 11px; font-weight: 700; line-height: 20px; padding: 0 6px; overflow: hidden; white-space: nowrap; text-decoration: none; box-sizing: border-box; }
.timeline .tl-hbar:hover, .timeline .tl-hbar:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; z-index: 2; }
.timeline .tl-htick { position: absolute; bottom: 30px; height: 8px; border-left: 1px solid var(--muted); opacity: 0.6; }
.timeline .tl-htick-label { position: absolute; bottom: 10px; transform: translateX(-50%); font-size: 11px; color: var(--muted); white-space: nowrap; }
.timeline .tl-htick-label.is-start { transform: none; }
.timeline .tl-htick-label.is-end { transform: translateX(-100%); }
.timeline .tl-swipe { display: none; margin: 0.5rem 1rem 0.8rem; }
@media (max-width: 1340px) {
  .timeline .tl-swipe { display: block; }
}

/* By promise: six covenant cards on a gold line */
.timeline .tl-covenants { list-style: none; margin: 1.2rem 0 0; padding: 22px 0 0; border-top: 3px solid var(--accent); display: flex; flex-wrap: wrap; gap: 1rem; }
.timeline .tl-covenant { flex: 1 1 200px; min-width: 0; position: relative; display: flex; flex-direction: column; gap: 0.55rem; padding: 1.25rem 1rem 1rem; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-soft); }
.timeline .tl-covenant-dot { position: absolute; top: -33px; left: 16px; width: 18px; height: 18px; border-radius: 50%; background: var(--bg); border: 4px solid var(--accent); box-sizing: border-box; }
.timeline .tl-covenant h3 { margin: 0; font-family: var(--font-display, inherit); font-weight: 400; font-size: 1.6rem; line-height: 1; }
.timeline .tl-covenant p { margin: 0; }
.timeline .tl-cov-when { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent) !important; }
.timeline .tl-cov-promise { font-size: 0.9rem; line-height: 1.45; }
.timeline .tl-cov-ref { font-size: 0.75rem; color: var(--muted) !important; }
.timeline .tl-cov-chips { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 0.4rem; border-top: 1px solid var(--line); }
.timeline .tl-pill { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--tl-c); color: var(--tl-ink) !important; text-decoration: none; }
.timeline .tl-pill:hover, .timeline .tl-pill:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }
@media (max-width: 639px) {
  /* Stacked cards: the line runs down the left instead of across the top. */
  .timeline .tl-covenants { border-top: 0; border-left: 3px solid var(--accent); padding: 0 0 0 1.1rem; margin-left: 0.4rem; }
  .timeline .tl-covenant-dot { top: 1.3rem; left: calc(-1.1rem - 10.5px); }
}

/* Tie-in cards */
.timeline .tl-ties { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1.6rem; }
.timeline .tl-tie { flex: 1 1 280px; display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.2rem; border-radius: 18px; background: var(--accent-soft); border: 1px solid var(--line); }
.timeline .tl-tie p { margin: 0; }
.timeline .tl-tie-icon { flex: 0 0 52px; width: 52px; height: 52px; border-radius: 14px; background: var(--start-bg); box-shadow: 0 3px 0 var(--tl-shelf); color: var(--on-accent); display: flex; align-items: center; justify-content: center; }
.timeline .tl-tie-title { font-family: var(--font-display, inherit); font-size: 1.15rem; color: var(--text); }
.timeline .tl-tie-text { font-size: 0.9rem; color: var(--muted) !important; }
.timeline .tl-tie-text a { font-weight: 700; }
.timeline .tl-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; font-size: 0.78rem; color: var(--muted); margin: 0 0 0.6rem; }

/* Layout toggle (board 5) */
.timeline .tl-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1.5rem; margin: 1.6rem 0 0; }
.timeline .tl-toggle { display: flex; gap: 4px; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; max-width: 100%; overflow-x: auto; }
.timeline .tl-toggle button { height: 40px; border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 700; font-size: 0.95rem; padding: 0 1.1rem; border-radius: 10px; cursor: pointer; white-space: nowrap; }
.timeline .tl-toggle button[aria-selected="true"] { background: var(--accent); color: var(--on-accent); }
.timeline .tl-toggle button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.timeline .tl-hint { margin: 0; font-size: 0.88rem; color: var(--muted); }
.timeline .tl-panel h2 { margin-top: 1.2rem; }

/* Book chips */
.timeline .tl-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.3rem; }
.timeline .tl-chip { display: inline-flex; flex-direction: column; gap: 0.05rem; padding: 0.35rem 0.65rem 0.35rem 0.6rem; border-radius: 10px; border: 1px solid var(--line); border-left: 5px solid var(--tl-c, var(--accent)); background: var(--accent-soft); color: var(--text); text-decoration: none; line-height: 1.2; }
.timeline .tl-chip span { font-weight: 700; font-size: 0.92rem; }
.timeline .tl-chip small { color: var(--muted); font-size: 0.72rem; font-variant-numeric: tabular-nums; }
.timeline .tl-chip:hover, .timeline .tl-chip:focus-visible { border-color: var(--card-hover-border, var(--accent)); border-left-color: var(--tl-c, var(--accent)); background: var(--card-hover-bg, var(--panel)); }

/* Charts: one row per book or person, label on the left, bar on a shared axis. */
.timeline .tl-chart { margin: 0.8rem 0 0; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 0.6rem 0.7rem 0.7rem; box-shadow: var(--shadow-soft); }
.timeline .tl-axis, .timeline .tl-row { display: grid; grid-template-columns: var(--tl-label) 1fr; gap: 0.5rem; align-items: center; }
.timeline .tl-axis { position: sticky; top: 0; z-index: 1; background: var(--panel); padding: 0.2rem 0 0.35rem; border-bottom: 1px solid var(--line); }
.timeline .tl-axis-track { position: relative; height: 1.1rem; }
.timeline .tl-tick { position: absolute; top: 0; transform: translateX(-50%); font-size: 0.66rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.timeline .tl-tick:first-child { transform: none; }
.timeline .tl-tick:last-child { transform: translateX(-100%); }
@media (max-width: 639px) {
  .timeline .tl-tick.is-minor { display: none; }
}
.timeline .tl-rows { list-style: none; margin: 0; padding: 0; }
.timeline .tl-row { padding: 0.18rem 0; border-bottom: 1px dashed rgba(127, 127, 127, 0.18); transition: opacity 0.15s; }
.timeline .tl-row:last-child { border-bottom: 0; }
.timeline .tl-label { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.timeline .tl-label a, .timeline .tl-label strong { color: var(--text); font-weight: 700; font-size: 0.86rem; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeline .tl-label a:hover { color: var(--accent); text-decoration: underline; }
.timeline .tl-label small { color: var(--muted); font-size: 0.7rem; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timeline .tl-track { position: relative; height: 1.5rem; background: linear-gradient(90deg, rgba(127, 127, 127, 0.12) 1px, transparent 1px) 0 0 / 10% 100%; border-radius: 6px; }
.timeline .tl-bar { position: absolute; top: 0.25rem; bottom: 0.25rem; min-width: 6px; padding: 0; border: 0; border-radius: 999px; background: var(--tl-c, var(--accent)); cursor: pointer; }
.timeline .tl-bar.is-story { background: repeating-linear-gradient(135deg, var(--tl-c) 0 5px, transparent 5px 8px); box-shadow: inset 0 0 0 2px var(--tl-c); }
.timeline .tl-bar:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.timeline .tl-row.is-current .tl-label strong { color: var(--accent); }
.timeline .tl-row.is-current .tl-track { background-color: var(--accent-soft); }

/* Overlap view (assets/timeline/timeline.js) */
.timeline .tl-chart.has-focus .tl-row,
.timeline .has-focus .tl-chart .tl-row { opacity: 0.35; }
.timeline .tl-chart.has-focus .tl-row.is-overlap,
.timeline .has-focus .tl-chart .tl-row.is-overlap { opacity: 1; }
.timeline .tl-row.is-focus { opacity: 1 !important; }
.timeline .tl-row.is-focus .tl-bar { outline: 2px solid var(--text); outline-offset: 1px; }
.timeline .tl-row.is-focus .tl-label a, .timeline .tl-row.is-focus .tl-label strong { color: var(--accent); }
.timeline .tl-caption { margin: 0.5rem 0 0; font-size: 0.85rem; color: var(--muted); min-height: 1.3em; }

/* Era page */
.timeline .tl-lane h2 { margin-top: 1.6rem; }

/* Lists */
.timeline .tl-names { color: var(--muted); font-size: 0.92rem; }
.timeline .tl-names a { color: var(--text); }
.timeline .tl-events { list-style: none; padding: 0; margin: 0.5rem 0 0; display: grid; gap: 0.3rem; }
.timeline .tl-events li { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0.45rem 0.75rem; color: var(--text); }
.timeline .tl-year { display: inline-block; min-width: 5.5rem; color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }
.timeline .tl-attribution { font-size: 0.8rem; color: var(--muted); margin: 0 0 0.8rem; }
.timeline .tl-attribution a { color: var(--accent); }
