/* Results timeline inside the expanded results bar (owner request, November 19, 2026).
 * Mounted with results-timeline.js; uses the race page's existing tokens and candidate colors.
 */
.results-timeline {
  min-width: 0;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #cbd7dc;
}

/* Wide screens: vote totals on the left, the chart on the right, so the expanded (and
   pinned) results bar is roughly half as tall. Narrower screens keep them stacked. */
@media (min-width: 1000px) {
  .results-timeline-layout {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  }

  .results-timeline-layout > .results-detail-list {
    align-self: start;
  }

  .results-timeline-layout > .results-timeline {
    margin: 20px 0 0 32px;
    padding: 0 0 0 32px;
    border-top: 0;
    border-left: 1px solid #cbd7dc;
  }
}

.results-timeline-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 20px;
  margin-bottom: 12px;
}

.results-timeline-heading h3 {
  margin: 0;
  color: var(--navy-deep);
  font-size: 0.95rem;
  line-height: 1.3;
}

.results-timeline-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.results-timeline-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin-bottom: 6px;
  font-size: 0.75rem;
}

.results-timeline-key {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
}

.results-timeline-key svg {
  flex: 0 0 auto;
}

.results-timeline-key span {
  min-width: 0;
  color: var(--ink);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.results-timeline-chart {
  position: relative;
  min-width: 0;
  border-radius: 4px;
}

.results-timeline-chart:focus {
  outline: none;
}

.results-timeline-chart:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 4px;
}

.results-timeline-chart > svg {
  display: block;
  overflow: visible;
  touch-action: pan-y;
  font-family: inherit;
}

.results-timeline-tick {
  fill: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.results-timeline-marker {
  fill: var(--navy-deep);
  font-size: 11px;
  font-weight: 800;
}

.results-timeline-end {
  fill: var(--ink);
  font-size: 11.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.results-timeline-tip {
  position: absolute;
  z-index: 2;
  display: grid;
  width: max-content;
  max-width: min(280px, 100%);
  gap: 6px;
  padding: 9px 11px;
  border: 1px solid #cbd7dc;
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 4px 14px #122f3f24;
  font-size: 0.74rem;
  line-height: 1.3;
  pointer-events: none;
}

.results-timeline-tip[hidden] {
  display: none;
}

.results-timeline-tip-title {
  color: var(--navy-deep);
  font-size: 0.72rem;
}

.results-timeline-tip-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.results-timeline-tip-row {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto minmax(38px, auto);
  align-items: center;
  gap: 8px;
}

.results-timeline-tip-row span {
  min-width: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.results-timeline-tip-row strong {
  color: var(--navy-deep);
  font-variant-numeric: tabular-nums;
}

.results-timeline-tip-row small,
.results-timeline-tip-total {
  color: var(--muted);
  font-size: 0.69rem;
  font-variant-numeric: tabular-nums;
}

.results-timeline-tip-row small {
  text-align: right;
}

.results-timeline-chart.is-docked .results-timeline-tip {
  position: static;
  width: auto;
  max-width: none;
  margin-top: 8px;
  box-shadow: none;
}

.results-timeline-table {
  margin-top: 12px;
}

.results-timeline-table > summary {
  display: flex;
  min-height: 36px;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  color: var(--navy);
  font-size: 0.76rem;
  font-weight: 850;
  cursor: pointer;
}

.results-timeline-table > summary .ptp-disclosure-icon {
  order: -1;
}

.results-timeline-scroll {
  max-width: 100%;
  margin-top: 8px;
  overflow-x: auto;
  border: 1px solid #cbd7dc;
  border-radius: 4px;
  background: #fff;
}

.results-timeline-scroll:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 2px;
}

/* The race page turns every table into stacked cards on phones (td::before labels). This table
   stays a real table that scrolls sideways inside its frame, with the update column pinned. */
.results-timeline-scroll table {
  display: table;
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
}

.results-timeline-scroll thead {
  display: table-header-group;
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
}

.results-timeline-scroll tbody {
  display: table-row-group;
}

.results-timeline-scroll thead tr,
.results-timeline-scroll tbody tr {
  display: table-row;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.results-timeline-scroll thead th,
.results-timeline-scroll tbody th,
.results-timeline-scroll tbody td {
  display: table-cell;
  padding: 7px 12px;
  border-bottom: 1px solid #e1e8eb;
  text-align: right;
  vertical-align: middle;
  white-space: nowrap;
}

.results-timeline-scroll tbody td::before {
  content: none;
}

.results-timeline-scroll thead th {
  color: var(--navy-deep);
  background: #f5f7f8;
  font-size: 0.68rem;
  vertical-align: bottom;
  white-space: normal;
}

.results-timeline-scroll thead th:first-child,
.results-timeline-scroll tbody th {
  position: sticky;
  left: 0;
  z-index: 1;
  text-align: left;
}

.results-timeline-scroll tbody th {
  color: var(--navy-deep);
  background: #fff;
  box-shadow: 1px 0 0 #e1e8eb;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: none;
}

.results-timeline-scroll tbody th a {
  color: var(--navy);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.results-timeline-scroll tbody th small,
.results-timeline-scroll tbody td small {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 500;
}

.results-timeline-scroll tbody td strong {
  color: var(--navy-deep);
}

.results-timeline-scroll tbody tr:last-child > * {
  border-bottom: 0;
}

.results-timeline-scroll tbody .results-timeline-night-row td {
  padding: 4px 12px;
  border-bottom: 2px dashed #9fb0b8;
  color: var(--navy-deep);
  background: #f5f7f8;
  font-size: 0.68rem;
  font-weight: 800;
  text-align: left;
}
