/* ============================================================
   HISTORY TIMELINE — DROP-IN UPGRADE STYLESHEET
   ------------------------------------------------------------
   Add this AFTER your existing <style> block, or as a separate
   <link rel="stylesheet"> tag, so it overrides the originals.
   It targets your existing structure: section[id], h2.collapsible,
   .menu, table, etc. — no markup changes required.
   ============================================================ */

:root {
  --bg:           #0e1420;
  --bg-elev:      #161e2e;
  --bg-elev-2:    #1d2638;
  --border:       #2a3550;
  --text:         #e8e6df;
  --text-muted:   #9aa3b8;
  --accent:       #d4a64a;
  --accent-soft:  #d4a64a33;
  --accent-dim:   #8a6a2c;
  --danger:       #c97064;
  --cool:         #6da3c4;
  --serif:        'Cormorant Garamond', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --sans:         'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono:         'JetBrains Mono', ui-monospace, Menlo, monospace;
  --radius:       8px;
  --shadow:       0 4px 14px rgba(0,0,0,0.35);

  /* Override the original --primary-color etc. so any leftover
     references inherit the new palette. */
  --primary-color:   var(--accent);
  --secondary-color: var(--cool);
  --background-color: var(--bg);
  --text-color: var(--text);
  --menu-hover-color: var(--accent);
  --menu-bg: rgba(14, 20, 32, 0.92);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  background: var(--bg) !important;
  color: var(--text) !important;
  font-family: var(--sans) !important;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  margin: 0;
  padding: 0;
}

/* Subtle parchment noise overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  z-index: 1;
}

/* ============================================================
   TYPOGRAPHY — overrides Papyrus headings
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--serif) !important;
  font-weight: 600 !important;
  letter-spacing: 0.01em;
  margin: 1.5rem 0 0.8rem;
}
h1 { font-size: clamp(2rem, 4vw, 3.2rem); color: var(--accent) !important; text-align: center; max-width: 1200px; margin-left: auto; margin-right: auto; padding: 0 1.5rem; }
h2 { font-size: clamp(1.5rem, 2.5vw, 2.1rem); color: var(--accent) !important; }
h3 { font-size: 1.25rem; color: var(--text) !important; }
h4 { font-size: 1.05rem; color: var(--text-muted) !important; font-style: italic; font-weight: 400 !important; text-align: center; max-width: 70ch; margin-left: auto; margin-right: auto; padding: 0 1.5rem; }

/* The original document has a few <h2 style="..."> top-level intro headings.
   Force them to obey our color/font instead of their inline style. */
body > h1[style], body > h2[style], body > h4[style] {
  color: var(--accent) !important;
  font-family: var(--serif) !important;
}
body > h2[style] { color: var(--text) !important; font-style: italic; font-weight: 400 !important; opacity: 0.85; font-size: 1.4rem; }

/* The original intro table sits inside a <center> outside any <section>.
   Constrain it like a section so it doesn't blow out the layout. */
body > center {
  display: block;
  max-width: 1200px;
  margin: 1.5rem auto;
  padding: 0 1.5rem;
}
body > center > table {
  width: 100% !important;
  border-collapse: collapse !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elev);
  font-size: 0.92rem;
}
body > center > table th,
body > center > table td {
  padding: 0.85rem 1rem !important;
  border: none !important;
  border-bottom: 1px solid var(--border) !important;
  text-align: left !important;
}
body > center > table thead,
body > center > table tr:first-child {
  background: var(--bg-elev-2);
}
body > center > table th,
body > center > table tr:first-child td {
  color: var(--accent) !important;
  font-weight: 600 !important;
  font-size: 0.78rem !important;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--sans) !important;
}

p { color: var(--text); }

a { color: var(--accent); text-decoration: none; border-bottom: 1px dotted var(--accent-dim); }
a:hover { color: #fff; border-bottom-color: var(--accent); }

/* ============================================================
   HIDE THE ORIGINAL NAV — replaced by topbar + side drawer
   added via JS. The original .main-nav is hidden, not removed,
   so the menu links still exist as fallback if JS fails.
   ============================================================ */
.main-nav { display: none !important; }

/* The hidden visitor counter pixel — make sure it stays hidden */
img[alt="Visitor Counter"] { display: none !important; }

/* ============================================================
   NEW TOP BAR (injected by JS)
   ============================================================ */
.tu-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(14, 20, 32, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.tu-topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.tu-brand {
  font-family: var(--serif);
  font-size: 1.15rem;
  color: var(--accent);
  font-weight: 600;
  flex-shrink: 0;
  border: none;
  white-space: nowrap;
}
.tu-brand-mark { opacity: 0.6; margin-right: 0.4em; }

.tu-search-wrap { flex: 1; position: relative; max-width: 480px; }
.tu-search {
  width: 100%;
  padding: 0.55rem 0.8rem 0.55rem 2.2rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.95rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.tu-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.tu-search-icon {
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.tu-search-count {
  position: absolute;
  right: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-family: var(--mono);
  pointer-events: none;
}

.tu-nav-toggle, .tu-filter-toggle, .tu-time-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
  white-space: nowrap;
  font-family: var(--sans);
}
.tu-nav-toggle:hover, .tu-filter-toggle:hover, .tu-time-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.tu-filter-toggle.active, .tu-time-toggle.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* ============================================================
   TIME-SLIDER BAR (sticky, under the topbar)
   ============================================================ */
.tu-timebar {
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  padding: 0.7rem 1.25rem;
  display: none;
}
.tu-timebar.open { display: block; }
.tu-timebar-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.tu-time-clear {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  flex-shrink: 0;
}
.tu-time-clear:hover { border-color: var(--accent); color: var(--accent); }
.tu-time-readout {
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--accent);
  min-width: 110px;
  flex-shrink: 0;
}
.tu-time-count {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  min-width: 80px;
  text-align: right;
  flex-shrink: 0;
}

/* Slider (shared style for both topbar and explorer) */
.tu-time-slider, .tu-explorer-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: linear-gradient(90deg, var(--bg-elev-2) 0%, var(--accent-dim) 100%);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
.tu-time-slider::-webkit-slider-thumb,
.tu-explorer-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--accent);
  border: 2px solid var(--bg);
  border-radius: 50%;
  cursor: grab;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  transition: transform 0.1s;
}
.tu-time-slider::-webkit-slider-thumb:active,
.tu-explorer-slider::-webkit-slider-thumb:active {
  transform: scale(1.2);
  cursor: grabbing;
}
.tu-time-slider::-moz-range-thumb,
.tu-explorer-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--accent);
  border: 2px solid var(--bg);
  border-radius: 50%;
  cursor: grab;
}

/* ============================================================
   TIME EXPLORER PANEL (the dedicated section at the top)
   ============================================================ */
.tu-explorer {
  max-width: 1280px;
  margin: 1rem auto 2rem;
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--bg-elev) 0%, var(--bg-elev-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: relative;
  z-index: 2;
  box-shadow: var(--shadow);
}
.tu-explorer-header h2 {
  margin: 0 !important;
  font-size: 1.4rem !important;
  text-align: left !important;
}
.tu-explorer-help {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin: 0.3rem 0 1.2rem;
  max-width: 70ch;
}
.tu-explorer-readout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  margin-bottom: 1rem;
}
.tu-explorer-year {
  font-family: var(--serif);
  font-size: 2rem;
  color: var(--accent);
  min-width: 220px;
  text-align: center;
  font-weight: 600;
}
.tu-explorer-step {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
}
.tu-explorer-step:hover { border-color: var(--accent); color: var(--accent); }

.tu-explorer-reset {
  margin-left: 0.5rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.tu-explorer-reset:hover { border-color: var(--accent); color: var(--accent); }

.tu-explorer-track-wrap {
  position: relative;
  padding: 1.4rem 0 0;
}
.tu-explorer-slider {
  display: block;
  width: 100%;
  margin: 0;
}
.tu-era-bands {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1.1rem;
  pointer-events: none;
}
.tu-era-band {
  position: absolute;
  top: 0;
  height: 1.1rem;
  border-left: 1px solid var(--accent-dim);
  padding-left: 4px;
}
.tu-era-band:last-child { border-right: 1px solid var(--accent-dim); }
.tu-era-label {
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.tu-explorer-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 0.6rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}
.tu-explorer-stats {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text);
  font-size: 0.92rem;
}
.tu-explorer-stats strong { color: var(--accent); }

/* ============================================================
   MATCHES CARD — shows events that overlap the slider's year
   right under the explorer, so the user doesn't have to scroll.
   ============================================================ */
.tu-matches {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: none;
}
.tu-matches.has-matches { display: block; }

.tu-matches-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.tu-match {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 1.25rem;
  padding: 0.85rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  align-items: start;
  animation: tu-match-in 0.18s ease;
}
@keyframes tu-match-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}

.tu-match-date {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 0.85rem;
  white-space: nowrap;
  padding-top: 0.1rem;
}
.tu-match-event {
  color: var(--text);
  line-height: 1.55;
  font-size: 0.95rem;
}
/* Inline-styled spans inside the event (Last Glacial Period etc.)
   were already converted to chips by the main CSS — they render
   correctly inside the match card too. */

/* "Nearest entries" cards when the slider hits an empty year */
.tu-match-before, .tu-match-after {
  border-left-color: var(--text-muted);
  opacity: 0.85;
}
.tu-match-before .tu-match-date::before { content: "↑ "; opacity: 0.6; }
.tu-match-after  .tu-match-date::before { content: "↓ "; opacity: 0.6; }

.tu-matches-empty {
  padding: 0.85rem 1rem;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
}
.tu-matches-context {
  margin-top: 0.85rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .tu-match { grid-template-columns: 1fr; gap: 0.3rem; }
}

/* ============================================================
   SIDE NAV DRAWER
   ============================================================ */
.tu-sidenav {
  position: fixed;
  top: 0;
  right: -360px;
  width: 340px;
  height: 100vh;
  background: var(--bg-elev);
  border-left: 1px solid var(--border);
  z-index: 200;
  transition: right 0.25s ease;
  overflow-y: auto;
  padding: 1.5rem 1.25rem 3rem;
}
.tu-sidenav.open { right: 0; }
.tu-sidenav h3 {
  font-family: var(--sans) !important;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted) !important;
  margin: 1.5rem 0 0.4rem;
  font-weight: 600 !important;
}
.tu-sidenav h3:first-of-type { margin-top: 0; }
.tu-sidenav ul { list-style: none; padding: 0; margin: 0; }
.tu-sidenav li a {
  display: block;
  padding: 0.4rem 0.6rem;
  color: var(--text);
  border: none;
  border-radius: 4px;
  font-size: 0.88rem;
}
.tu-sidenav li a:hover { background: var(--accent-soft); color: var(--accent); }
.tu-sidenav-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
}
.tu-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.tu-scrim.show { opacity: 1; pointer-events: auto; }

/* ============================================================
   FILTER PANEL (injected by JS)
   Lets the reader toggle which civilizations/themes show.
   ============================================================ */
.tu-filterbar {
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  padding: 0.9rem 1.25rem;
  display: none;
}
.tu-filterbar.open { display: block; }
.tu-filterbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.tu-filterbar-label {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-right: 0.5rem;
}
.tu-chip {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: var(--sans);
  transition: all 0.15s;
}
.tu-chip:hover { border-color: var(--accent-dim); color: var(--text); }
.tu-chip.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.tu-chip-clear {
  margin-left: auto;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  text-decoration: underline;
}

/* ============================================================
   SECTIONS — wrap your existing <section id="..."> elements
   Apply to existing markup; the JS adds .tu-section to each.

   IMPORTANT: The original file has many unclosed <section> tags,
   so sections often nest inside each other. We only apply the
   container padding/max-width to TOP-LEVEL sections — nested
   sections inherit the parent's width to avoid the compounding
   indent that crushed text deep in the page.
   ============================================================ */
.tu-section {
  position: relative;
  z-index: 2;
  margin: 0 auto 1.5rem;
}
/* Top-level sections (direct children of <body>) get the
   container width and horizontal padding. */
body > .tu-section {
  max-width: 1280px;
  padding: 0 1.5rem;
}
/* Nested sections (inside another section) reset to fill their
   parent — no extra padding, no max-width clamp. This is what
   prevents the "narrower and narrower" bug. */
.tu-section .tu-section {
  max-width: none !important;
  padding: 0 !important;
  margin-left: 0;
  margin-right: 0;
}
/* Hide hash-jump targets that aren't real sections (caption-only h2s) */
.tu-section > h2[id] {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  user-select: none;
  margin: 0;
  text-align: left !important;
}
.tu-section > h2[id]::after {
  content: "▾";
  font-family: var(--mono);
  color: var(--text-muted);
  font-size: 1.1rem;
  transition: transform 0.2s;
  flex-shrink: 0;
}
.tu-section.collapsed > h2[id]::after { transform: rotate(-90deg); }
.tu-section.collapsed > .content,
.tu-section.collapsed > *:not(h2) { display: none; }

/* The original .content wrapper gets some breathing room */
.tu-section .content { padding: 1.5rem 0; }

/* Center container that the original uses */
.center-container { text-align: left; }

/* ============================================================
   TABLES — restyle every <table> consistently, kill inline overrides
   ============================================================ */
.tu-section table,
section table {
  width: 100% !important;
  border-collapse: collapse !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius);
  overflow: hidden;
  margin: 1rem 0 !important;
  font-size: 0.92rem;
  background: var(--bg-elev);
  display: table;
}

/* Wrap tables so they scroll on mobile rather than overflow */
.tu-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 1rem 0;
}
.tu-table-wrap > table {
  margin: 0 !important;
  border: none !important;
  border-radius: 0;
}

.tu-section table thead,
section table thead {
  background: var(--bg-elev-2) !important;
}
.tu-section table th,
section table th {
  text-align: left !important;
  padding: 0.85rem 1rem !important;
  color: var(--accent) !important;
  font-family: var(--sans) !important;
  font-weight: 600 !important;
  font-size: 0.78rem !important;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: none !important;
  border-bottom: 1px solid var(--border) !important;
  background: var(--bg-elev-2) !important;
}
.tu-section table td,
section table td {
  padding: 0.85rem 1rem !important;
  border: none !important;
  border-bottom: 1px solid var(--border) !important;
  vertical-align: top !important;
  color: var(--text) !important;
  background: transparent !important;
}
.tu-section table tbody tr:nth-child(even),
section table tbody tr:nth-child(even) { background: rgba(255,255,255,0.015) !important; }
.tu-section table tbody tr:hover,
section table tbody tr:hover { background: var(--accent-soft) !important; }
.tu-section table tbody tr:last-child td,
section table tbody tr:last-child td { border-bottom: none !important; }

/* First column = date column → mono + accent */
.tu-section table td:first-child,
section table td:first-child {
  font-family: var(--mono) !important;
  color: var(--accent) !important;
  white-space: nowrap;
  font-size: 0.85rem !important;
}

/* Override inline color="white" / color="violet" / color="yellow" spans
   that the original uses for tagging events — convert to chips */
.tu-section span[style*="color:white"],
.tu-section span[style*="color: white"] {
  color: var(--cool) !important;
  background: rgba(109,163,196,0.12);
  padding: 0.1rem 0.5rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-family: var(--mono);
  display: inline-block;
}
.tu-section span[style*="color:yellow"],
.tu-section span[style*="color: yellow"],
.tu-section span[style*="color:violet"],
.tu-section span[style*="color: violet"] {
  color: var(--danger) !important;
  background: rgba(201,112,100,0.12);
  padding: 0.1rem 0.5rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-family: var(--mono);
  display: inline-block;
}

/* Override inline row backgrounds (rgb(0,0,0), #000, #222 etc.) */
.tu-section table tr[style*="background"],
section table tr[style*="background"] { background: transparent !important; }
.tu-section table tr[style*="background"]:nth-child(even),
section table tr[style*="background"]:nth-child(even) { background: rgba(255,255,255,0.015) !important; }

/* Override inline text colors inside table cells (Coral, #78DEC7, etc.) */
.tu-section table td[style*="color"],
section table td[style*="color"],
.tu-section table th[style*="color"],
section table th[style*="color"] { color: inherit !important; }

/* Caption tweaks */
.tu-section caption, caption {
  caption-side: top;
  padding: 0.5rem 0;
  color: var(--text-muted);
  font-style: italic;
  text-align: left;
}

/* ============================================================
   SEARCH HIGHLIGHTING + DIMMING
   ============================================================ */
mark.tu-hit {
  background: var(--accent);
  color: var(--bg);
  padding: 0 2px;
  border-radius: 2px;
}
.tu-dimmed { opacity: 0.18; transition: opacity 0.2s; }
.tu-hidden { display: none !important; }

/* ============================================================
   BACK TO TOP BUTTON
   ============================================================ */
.tu-to-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 50;
  background: var(--accent);
  color: var(--bg);
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  font-weight: bold;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.15s;
}
.tu-to-top.visible { opacity: 1; pointer-events: auto; }
.tu-to-top:hover { transform: translateY(-2px); }


a.tu-chart-link {
  flex-shrink: 0;
  border: none;
  border-bottom: none;
  background: var(--accent);
  color: var(--bg);
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
}
a.tu-chart-link:hover { filter: brightness(1.08); color: var(--bg); }
.tu-chart-short { display: none; }
.chart-launch-wrap { text-align: center; margin: 0.35rem 1rem 1.15rem; }
a.chart-launch {
  display: inline-block;
  background: var(--accent);
  color: #0e1420;
  border: none;
  border-bottom: none;
  border-radius: var(--radius);
  padding: 0.75rem 1.2rem;
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
}
a.chart-launch:hover { filter: brightness(1.08); color: #0e1420; }

/* ============================================================
   MOBILE
   ============================================================ */
@media (max-width: 720px) {
  .tu-topbar-inner { padding: 0.6rem 0.9rem; gap: 0.5rem; }
  .tu-brand { font-size: 1rem; }
  .tu-brand-mark, .tu-brand-text-long { display: none; }
  .tu-chart-long { display: none; }
  .tu-chart-short { display: inline; }
  .tu-search { font-size: 0.85rem; }
  .tu-section { padding: 0 1rem; }
  .tu-section table th,
  .tu-section table td,
  section table th,
  section table td { padding: 0.6rem 0.7rem !important; font-size: 0.85rem !important; }
}

/* Hasidic / Haredi subgroup table.
   Columns are group, name, date, description — not the usual date-first layout. */
table.faith-groups td.group,
table.faith-groups td.name,
table.faith-groups td.when,
table.faith-groups td.about,
.tu-section table.faith-groups td,
section table.faith-groups td {
  font-family: var(--sans) !important;
  white-space: normal !important;
  font-size: 0.92rem !important;
}
table.faith-groups td.group.hasid,
.tu-section table.faith-groups td.group.hasid,
section table.faith-groups td.group.hasid {
  color: #d4a64a !important;
  font-family: var(--serif) !important;
  font-weight: 600 !important;
  font-size: 1.05rem !important;
  letter-spacing: 0.01em;
  border-left: 3px solid #d4a64a !important;
}
table.faith-groups td.group.haredi,
.tu-section table.faith-groups td.group.haredi,
section table.faith-groups td.group.haredi {
  color: #6da3c4 !important;
  font-family: var(--serif) !important;
  font-weight: 600 !important;
  font-size: 1.05rem !important;
  border-left: 3px solid #6da3c4 !important;
}
table.faith-groups td.name.hasid,
.tu-section table.faith-groups td.name.hasid,
section table.faith-groups td.name.hasid {
  color: #e7c98a !important;
  font-weight: 600 !important;
}
table.faith-groups td.name.haredi,
.tu-section table.faith-groups td.name.haredi,
section table.faith-groups td.name.haredi {
  color: #9ec3dc !important;
  font-weight: 600 !important;
}
table.faith-groups td.when,
.tu-section table.faith-groups td.when,
section table.faith-groups td.when {
  color: #9aa3b8 !important;
  font-family: var(--mono) !important;
  font-size: 0.8rem !important;
  white-space: nowrap !important;
}
table.faith-groups td.about,
.tu-section table.faith-groups td.about,
section table.faith-groups td.about {
  color: #b7c0cf !important;
  line-height: 1.45;
}
table.faith-groups td.about .lead,
.tu-section table.faith-groups td.about .lead,
section table.faith-groups td.about .lead {
  color: #e8e6df !important;
  display: block;
  margin-bottom: 0.35rem;
}
