/* Timeline Visualizer 1.13.0 — scrolling settings on EVERY tool page.
 * Desktop: the settings column has the height of the free screen and scrolls INSIDE itself; the map / preview stays in view
 * beside it, so choosing a setting never means scrolling the whole page away from the map.
 * Tablet / phone: long settings lists get their own scroll box so the page is not endless.
 * --tvs-h is set by assets/js/tv-layout.js (exact free height). The calc() below is the no-JS fallback.
 * Loaded after tv-content.css, only on tool pages. */
body { --tvs-h: calc(100vh - 160px); }
@supports (height: 100dvh) { body { --tvs-h: calc(100dvh - 160px); } }

/* a clear, slim scroll bar in the gold theme */
.tvx-tool .tvx-left, .tvx-tool .tvx-right, .tv-tool .tv-tool-inputs { scrollbar-width: thin; scrollbar-color: #ffb400 transparent; }
.tvx-tool .tvx-left::-webkit-scrollbar, .tvx-tool .tvx-right::-webkit-scrollbar, .tv-tool .tv-tool-inputs::-webkit-scrollbar, .tv-tool .tv-tool-inputs::-webkit-scrollbar { width: 8px; }
.tvx-tool .tvx-left::-webkit-scrollbar-thumb, .tvx-tool .tvx-right::-webkit-scrollbar-thumb, .tv-tool .tv-tool-inputs::-webkit-scrollbar-thumb, .tv-tool .tv-tool-inputs::-webkit-scrollbar-thumb { background: #ffb400; border-radius: 8px; }

/* ================= desktop ================= */
@media (min-width: 961px) {
  /* ---- map tools: Timeline viewer, Countries, States, Photo map ---- */
  .tvx-tool .tvx-ws:not(.tvx-ws-image) { height: var(--tvs-h); min-height: 440px; max-height: 1000px; grid-template-columns: minmax(340px, 440px) minmax(0, 1fr); gap: 16px; align-items: stretch; }
  .tvx-tool .tvx-ws:not(.tvx-ws-image) > .tvx-left { min-height: 0; max-height: 100%; overflow-y: auto; overscroll-behavior: contain; padding: 2px 10px 18px 2px; }
  .tvx-tool .tvx-ws:not(.tvx-ws-image) > .tvx-right { position: static; min-height: 0; height: 100%; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 8px; padding-right: 2px; }
  .tvx-tool .tvx-ws:not(.tvx-ws-image) > .tvx-right > * { flex: 0 0 auto; }
  /* viewer: the map takes all free height */
  .tvx-viewer .tvx-mapwrap2 { flex: 1 1 auto !important; min-height: 0; }
  .tvx-viewer .tvx-map { height: 100% !important; min-height: 0; }
  /* photo map: the map keeps a good size, the gallery and timeline scroll below it */
  .tvx-photomap .tvx-mapwrap2 { flex: 1 0 min(60%, 520px) !important; min-height: 340px; }
  .tvx-photomap .tvx-map { height: 100% !important; min-height: 340px; }
  /* countries / states: the map stays at the top of its column */
  .tvx-regions .tvx-mapwrap { position: sticky; top: 0; z-index: 3; background: var(--tvx-bg); }
  .tvx-regions .tvx-svg { max-height: calc(var(--tvs-h) - 120px); width: 100%; }

  /* ---- video tool (home) and every other tool with a settings panel: ONE scroller = the whole settings column ---- */
  .tv-tool:not(.tvx-tool):not([data-tv-step="start"]) .tv-tool-workspace { align-items: start; }
  .tv-tool:not(.tvx-tool):not([data-tv-step="start"]) .tv-tool-inputs { max-height: var(--tvs-h); overflow-y: auto; overscroll-behavior: contain; padding-right: 6px; }
  .tv-tool:not(.tvx-tool):not([data-tv-step="start"]) .tv-settings { overflow: visible; }
  .tv-tool:not(.tvx-tool):not([data-tv-step="start"]) .tv-tabpanel { height: auto !important; max-height: none !important; overflow: visible !important; }
  /* tabs stay in view while the column scrolls */
  .tv-tool:not(.tvx-tool):not([data-tv-step="start"]) .tv-settings-head { position: sticky; top: 0; z-index: 3; background: var(--tv-card, #fffff0); }
  /* preview stays beside the settings */
  .tv-tool:not(.tvx-tool):not([data-tv-step="start"]) .tv-tool-visuals { position: sticky; top: 76px; align-self: start; }
  /* no second scroll boxes inside the map-tool column */
  .tvx-tool .tvx-ws:not(.tvx-ws-image) .tvx-list, .tvx-tool .tvx-ws:not(.tvx-ws-image) .tvx-grid, .tvx-tool .tvx-ws:not(.tvx-ws-image) .tvx-tl, .tvx-tool .tvx-ws:not(.tvx-ws-image) .tvx-nolist { max-height: none; overflow: visible; }
}

/* ================= tablet and phone ================= */
@media (max-width: 960px) {
  .tvx-tool .tvx-ws:not(.tvx-ws-image) > .tvx-left { max-height: min(72vh, 620px); overflow-y: auto; overscroll-behavior: contain; padding-right: 6px; }
  .tv-tool:not(.tvx-tool):not([data-tv-step="start"]) .tv-tabpanel { height: auto !important; max-height: none !important; overflow: visible !important; }
}

/* ================= Timeline viewer page: slim title, first screen = settings + map ================= */
body.tv-page-viewer .tv-studio-title { margin: 0; padding: 4px 0 8px; font-size: clamp(1.05rem, 1.7vw, 1.45rem); line-height: 1.2; letter-spacing: -.01em; }
body.tv-page-viewer .tv-studio-content > .tv-tool-section { margin: 0; }
body.tv-page-viewer .tv-studio-content > p:first-of-type { margin-top: 28px; }

/* ================= 1.13.2 home hero ================= */
/* the small "TIMELINE VISUALIZER" tag above the H1 is gone (the home gap is NOT increased) */
.tv-start-copy::before, body.tv-body .tv-start-copy::before, html:not([data-theme="dark"]) body.tv-body .tv-start-copy::before, html[data-theme="dark"] body.tv-body .tv-start-copy::before { content: none !important; display: none !important; }
.tv-start-copy { gap: 14px; }
/* the intro paragraph sits directly under the H1 */
.tv-start-copy .tv-lede { font-size: clamp(1rem, 1.5vw, 1.125rem); line-height: 1.6; margin: 0; max-width: 52ch; }
@media (max-width: 700px) {
  .tv-tool[data-tv-step="start"] .tv-start-copy .tv-lede { order: 2; font-size: 0.95rem; margin: 0 auto; padding: 0 4px; }
  .tv-tool[data-tv-step="start"] .tv-tool-visuals { order: 3; }
  .tv-tool[data-tv-step="start"] .tv-start-copy > :not(.tv-start-title):not(.tv-lede) { order: 4; }
}
