/* Shared timeline styles — used by sugar_timeline.html (standalone) and index.html (map + timeline). */
:root {
  --bg: #faf6f0; --ink: #2b2520; --muted: #6b5f52; --line: #d8cdbe;
  --card: #fffdf9; --accent: #9d2235;
}
* { box-sizing: border-box; }

/* The timeline is a self-contained flex column; its parent just needs a height. */
.timeline-app {
  display: flex; flex-direction: column; height: 100%; min-height: 0;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink); background: var(--bg);
}
.timeline-app header { padding: 12px 20px 8px; border-bottom: 1px solid var(--line); flex: none; }
.timeline-app header h1 { margin: 0 0 2px; font-size: 18px; }
.timeline-app header p { margin: 0; color: var(--muted); font-size: 13px; }
.controls { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 8px; }
.controls label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.hint { font-size: 12px; color: var(--muted); font-style: italic; }

/* The scrolling time band */
#scroller { flex: 1; min-height: 0; overflow: auto; cursor: grab; position: relative; }
#scroller.dragging { cursor: grabbing; user-select: none; }
#canvas { position: relative; height: 100%; min-height: 200px; }
.gridline { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.gridlabel { position: absolute; top: 6px; transform: translateX(-50%); font-size: 12px;
             color: var(--muted); white-space: nowrap; background: var(--bg); padding: 0 4px; }

.marker { position: absolute; border: none; padding: 0; cursor: pointer; font: inherit;
          color: #fff; border-radius: 5px; height: 26px; display: flex; align-items: center;
          overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.18); transition: filter .12s, outline .12s; }
.marker:hover, .marker:focus-visible { filter: brightness(1.08); outline: 2px solid var(--ink); outline-offset: 1px; }
.marker.active { outline: 3px solid var(--accent); outline-offset: 1px; box-shadow: 0 0 0 3px rgba(157,34,53,.25); }
.marker .lbl { padding: 0 8px; font-size: 12px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.marker.point { width: 26px; justify-content: center; }
.marker.point .dot { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.9); }
.marker.point .lbl { position: absolute; left: 30px; color: var(--ink); text-shadow: 0 0 3px var(--bg); }

/* Source bubble — z-index sits ABOVE Leaflet panes/controls (which top out ~1000). */
#scrim { position: fixed; inset: 0; background: rgba(20,15,10,.18); display: none; z-index: 10000; }
#bubble { position: fixed; max-width: 360px; width: calc(100vw - 32px); background: var(--card);
          border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 34px rgba(40,25,10,.28);
          padding: 16px 18px; display: none; z-index: 10001; }
#bubble img { max-width: 100%; border-radius: 6px; margin-bottom: 10px; display: block; }
#bubble h2 { margin: 0 0 4px; font-size: 16px; line-height: 1.3; }
#bubble h2 a { color: var(--accent); text-decoration: none; }
#bubble h2 a:hover { text-decoration: underline; }
#bubble .when { font-size: 12.5px; color: var(--muted); margin: 0 0 10px; font-weight: 600; }
#bubble .body { font-size: 14px; }
#bubble .framing { font-size: 13px; color: var(--muted); margin: 0 0 10px; }
#bubble .source { margin: 0; padding: 12px 14px; border-left: 4px solid var(--accent);
          color: #2b2017; background: #f3ece1; border-radius: 0 5px 5px 0;
          font-size: 15px; line-height: 1.5; white-space: pre-line; }
#bubble .source.audio { font-style: italic; color: #5a4f42; }
#bubble .attr { margin: 7px 0 0; font-size: 12px; color: var(--muted); }
#bubble .body blockquote { margin: 8px 0; padding: 6px 12px; border-left: 3px solid var(--accent);
          color: #443a2e; font-style: italic; background: #f3ece1; border-radius: 0 4px 4px 0; }
#bubble .meta { margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line);
          font-size: 12px; color: var(--muted); }
#bubble .meta div { margin: 2px 0; }
#bubble .src-link { display: inline-block; margin-top: 8px; font-size: 13px; color: var(--accent); font-weight: 600; }
#bubble .era-chip { display: inline-block; font-size: 11px; color: #fff; padding: 1px 8px;
          border-radius: 10px; margin-bottom: 8px; }
#bubble .map-place { display:inline-block; margin-bottom: 8px; margin-left: 6px; font-size: 11px;
          color: var(--muted); }
#bubble .close { position: absolute; top: 8px; right: 10px; border: none; background: none;
          font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; }
#bubble .close:hover { color: var(--ink); }
