/* Interactive timeline plus the textual chronology baseline. */

.graph-timeline {
  margin: 22px 0 28px;
  padding: 14px;
  border: 1px solid var(--table-border-color, #c9b894);
  border-radius: 6px;
  background: var(--sidebar-bg, #f5f5f5);
  color: var(--fg, #1a1612);
}

.bartley-light .graph-timeline {
  background: var(--paper-deep, #ebe1ce);
}

.bartley-dark .graph-timeline {
  background: var(--ink-lifted, #221d18);
}

.timeline-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 16px;
  margin-bottom: 12px;
}

.timeline-control-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

.timeline-control-label {
  margin-right: 2px;
  color: var(--whisper, #6e6354);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 18px;
  text-transform: uppercase;
}

.timeline-controls button,
.timeline-controls input[type="date"] {
  min-height: 30px;
  padding: 7px 9px 3px;
  border: 1px solid var(--rule, #c9b894);
  border-radius: 4px;
  background: var(--bg, #fff);
  color: var(--fg, #1a1612);
  font-family: inherit;
  font-size: 13px;
  line-height: 18px;
}

.timeline-controls button {
  min-width: 30px;
  cursor: pointer;
}

.timeline-controls button:hover,
.timeline-controls button:focus-visible,
.timeline-controls input[type="date"]:focus-visible,
.timeline-mark:focus-visible {
  border-color: var(--links, #6e1f1f);
  outline: 2px solid var(--links, #6e1f1f);
  outline-offset: 2px;
}

.timeline-track-toggle[aria-pressed="true"] {
  border-color: var(--links, #6e1f1f);
  background: var(--sidebar-active, #ebe1ce);
  color: var(--links, #6e1f1f);
}

.timeline-filter-cue {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 6px 9px 2px;
  border: 1px solid var(--rule, #c9b894);
  border-radius: 999px;
  color: var(--whisper, #6e6354);
  font-size: 12px;
  line-height: 18px;
  white-space: nowrap;
}

.timeline-svg {
  display: block;
  width: 100%;
  min-height: 130px;
  overflow: visible;
  touch-action: none;
  user-select: none;
}

.timeline-axis-line,
.timeline-axis-tick {
  stroke: var(--rule, #c9b894);
  stroke-width: 1;
}

.timeline-axis-tick {
  opacity: 0.42;
}

.timeline-axis-label,
.timeline-lane-label,
.timeline-date-label,
.timeline-event-label,
.timeline-sequence-number {
  fill: var(--whisper, #6e6354);
  font-family: inherit;
}

.timeline-axis-label {
  font-size: 10px;
  text-anchor: middle;
}

.timeline-lane-band {
  fill: var(--bg, #fff);
  stroke: var(--rule, #c9b894);
  stroke-width: 1;
}

.bartley-light .timeline-lane-band {
  fill: var(--paper, #f5ede0);
}

.bartley-dark .timeline-lane-band {
  fill: var(--ink-lifted, #221d18);
}

.timeline-lane-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.timeline-mark {
  color: var(--fg, #1a1612);
  cursor: pointer;
}

.timeline-mark--substantive {
  color: var(--links, #6e1f1f);
}

.timeline-mark--procedural {
  color: var(--whisper, #6e6354);
}

.timeline-mark--other {
  color: var(--fg, #1a1612);
}

.timeline-mark-shape {
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 2;
}

.timeline-mark-hit {
  fill: transparent;
  pointer-events: all;
  stroke: none;
}

.timeline-mark--procedural .timeline-mark-shape {
  fill: var(--bg, #fff);
  stroke-dasharray: 3 2;
}

.timeline-mark--ordered .timeline-mark-shape {
  fill: none;
  pointer-events: visibleStroke;
  stroke-dasharray: 2 2;
}

.timeline-mark--undated .timeline-mark-shape {
  fill: none;
  stroke-dasharray: 4 2;
}

.timeline-mark--stale {
  opacity: 0.48;
}

.timeline-mark--withheld {
  color: var(--whisper, #6e6354);
  opacity: 0.72;
}

.timeline-mark--active .timeline-mark-shape,
.timeline-mark:focus-visible .timeline-mark-shape {
  stroke-width: 4;
}

.timeline-mark:focus-visible {
  outline: none;
}

.timeline-event-label {
  font-size: 10px;
  pointer-events: visiblePainted;
}

.timeline-sequence-number {
  font-size: 9px;
  font-weight: 700;
  text-anchor: middle;
  pointer-events: none;
}

.timeline-conflict-rival,
.timeline-conflict-bracket {
  stroke: var(--links, #6e1f1f);
  stroke-width: 1.5;
}

.timeline-conflict-bracket {
  stroke-dasharray: 3 2;
}

.timeline-date-label {
  fill: var(--links, #6e1f1f);
  font-size: 9px;
  text-anchor: middle;
}

.bartley-chronology ol.chronology-events {
  margin: 20px 0 0 8px;
  padding: 0 0 0 24px;
  border-left: 1px solid var(--rule, #c9b894);
  list-style: none;
}

.bartley-chronology .chronology-event {
  position: relative;
  margin: 0;
  padding: 4px 0 22px 14px;
  transition: background-color 120ms ease, opacity 120ms ease;
}

.bartley-chronology .chronology-event::before {
  position: absolute;
  top: 10px;
  left: -29px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--links, #6e1f1f);
  border-radius: 50%;
  background: var(--bg, #fff);
  content: "";
}

.bartley-chronology .chronology-event--procedural::before {
  border-color: var(--whisper, #6e6354);
  border-radius: 1px;
  transform: rotate(45deg);
}

.bartley-chronology .chronology-event--undated::before {
  border-style: dashed;
}

.bartley-chronology .chronology-event[data-stale="true"] {
  opacity: 0.56;
}

.bartley-chronology .chronology-event--active {
  border-radius: 3px;
  background: var(--sidebar-bg, #f5f5f5);
}

.bartley-light .bartley-chronology .chronology-event--active {
  background: var(--paper-deep, #ebe1ce);
}

.bartley-dark .bartley-chronology .chronology-event--active {
  background: var(--ink-lifted, #221d18);
}

.bartley-chronology .chronology-event--offtrack {
  opacity: 0.32;
}

.bartley-chronology time {
  display: inline-block;
  min-width: 78px;
  margin-right: 8px;
  color: var(--whisper, #6e6354);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  line-height: 18px;
}

.bartley-chronology .chronology-text {
  color: var(--fg, #1a1612);
  font-size: 16px;
  line-height: 24px;
}

.bartley-chronology .chronology-sequence {
  display: inline-flex;
  align-items: center;
  margin-left: 7px;
  padding: 4px 7px 1px;
  border: 1px solid var(--rule, #c9b894);
  border-radius: 999px;
  color: var(--whisper, #6e6354);
  font-size: 11px;
  line-height: 15px;
}

.bartley-chronology .chronology-grounding {
  display: block;
  margin-top: 5px;
  color: var(--whisper, #6e6354);
  font-size: 11px;
  line-height: 16px;
}

.bartley-chronology .chronology-grounding::before {
  content: "source · ";
}

.bartley-chronology .chronology-conflict {
  display: grid;
  grid-template-columns: minmax(86px, auto) 1fr;
  gap: 4px 10px;
  margin-top: 10px;
  padding: 8px 10px 6px;
  border-left: 3px solid var(--links, #6e1f1f);
  background: var(--sidebar-bg, #f5f5f5);
  color: var(--whisper, #6e6354);
  font-size: 12px;
  line-height: 18px;
}

.bartley-light .bartley-chronology .chronology-conflict {
  background: var(--paper-deep, #ebe1ce);
}

.bartley-dark .bartley-chronology .chronology-conflict {
  background: var(--ink-lifted, #221d18);
}

.bartley-chronology .chronology-conflict-date {
  color: var(--links, #6e1f1f);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.bartley-chronology .chronology-conflict-note {
  min-width: 0;
}

@media (max-width: 768px) {
  .graph-timeline {
    margin-right: -8px;
    margin-left: -8px;
    padding: 10px;
  }

  .timeline-controls {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 8px;
  }

  .timeline-control-group {
    width: 100%;
  }

  .timeline-control-label {
    flex: 0 0 64px;
  }

  .timeline-controls input[type="date"] {
    min-width: 0;
    max-width: 145px;
  }

  .timeline-event-label {
    display: none;
  }

  .bartley-chronology ol.chronology-events {
    margin-left: 2px;
    padding-left: 18px;
  }

  .bartley-chronology .chronology-event {
    padding-left: 10px;
  }

  .bartley-chronology .chronology-event::before {
    left: -23px;
  }

  .bartley-chronology time {
    display: block;
    margin-bottom: 2px;
  }

  .bartley-chronology .chronology-conflict {
    grid-template-columns: 1fr;
  }
}

@media print {
  .graph-timeline {
    display: none;
  }

  .bartley-chronology .chronology-event--offtrack {
    opacity: 1;
  }
}
