/* Small, final layout corrections for the public archive. */

/* Topic colour is separate from actor tags and evidence status. */
.topic-protest { --topic-ink: #9b3e12; --topic-paper: #fff3e8; }
.topic-digital { --topic-ink: #17616a; --topic-paper: #edf8f9; }
.topic-health { --topic-ink: #24663e; --topic-paper: #eef8f0; }
.topic-safety { --topic-ink: #7a5711; --topic-paper: #fcf7e7; }
.topic-economy { --topic-ink: #205e91; --topic-paper: #edf5fc; }
.topic-rights { --topic-ink: #933d67; --topic-paper: #fceff5; }
.topic-justice { --topic-ink: #644294; --topic-paper: #f4effb; }
.topic-security { --topic-ink: #68513d; --topic-paper: #f6f1eb; }
.topic-governance { --topic-ink: #42536c; --topic-paper: #eff2f7; }

.timeline-share { margin-top: 10px; }
.timeline-share > summary { width: fit-content; min-height: 36px; padding: 8px 0; font-size: 13px; font-weight: 700; cursor: pointer; }
.timeline-share > summary:focus-visible { outline: 3px solid #215c5c; outline-offset: 3px; }
.filter-summary-badge[hidden] { display: none; }

.topic-filter-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 5px 12px;
  margin-top: 14px;
  font-size: 13px;
  font-weight: 800;
}
.topic-filter-heading span { color: var(--muted); font-size: 12px; font-weight: 400; }
#categoryQuickFilters { flex-wrap: wrap; overflow: visible; margin-top: 7px; gap: 6px; }
#categoryQuickFilters .category-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  max-width: 100%;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--topic-ink, #354258);
  background: #fff;
  border-color: #cbd2d8;
  font-weight: 750;
  font-size: 12px;
}
.category-chip i { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: var(--topic-ink); }
.category-chip span { font-variant-numeric: tabular-nums; font-size: 11px; }
#categoryQuickFilters .category-chip:hover,
#categoryQuickFilters .category-chip.active {
  color: var(--topic-ink, #354258);
  background: var(--topic-paper, #eaf0f7);
  border-color: var(--topic-ink, #354258);
}
#categoryQuickFilters .category-chip.active { box-shadow: inset 0 -2px var(--topic-ink, #354258); }
#categoryQuickFilters .category-chip:focus-visible { outline: 3px solid #215c5c; outline-offset: 3px; }

.timeline-section .year-heading h3 {
  margin: 0;
  color: var(--ink);
  font-family: Newsreader, Georgia, serif;
  font-size: clamp(23px, 3vw, 30px);
  line-height: 1.15;
}
.timeline-section .event-card {
  padding: 0;
  border-left-color: var(--topic-ink);
  box-shadow: 0 2px 7px rgb(21 29 38 / 4%);
}
.timeline-section .event-card::before,
.timeline-section .event-card:hover::before { border-color: var(--topic-ink); }
.timeline-section .event-body { padding: 20px 22px; }
.timeline-section .event-meta { gap: 8px 14px; align-items: center; margin-bottom: 10px; }
.timeline-section .event-date { color: #343e4b; font-size: 12px; font-variant-numeric: tabular-nums; }
.timeline-section .topic-label { color: var(--topic-ink); background: var(--topic-paper); border-radius: 4px; padding: 3px 7px; font-size: 12px; }
.timeline-section .event-title-row h4 { margin: 0 0 12px; max-width: 52ch; font-size: clamp(19px, 2vw, 25px); line-height: 1.25; }
.timeline-section .event-title-link { font-size: inherit; line-height: inherit; }
.timeline-section .event-title-link:hover,
.timeline-section .event-title-link:focus-visible { color: var(--topic-ink); }
.timeline-section .chips { margin-bottom: 12px; }
.timeline-section .category-detail { color: var(--topic-ink); border-color: var(--topic-ink); background: #fff; }
.timeline-section .event-summary { margin: 0 0 15px; max-width: 88ch; font-size: 15px; line-height: 1.65; }
.timeline-section .event-outcome { padding: 12px 14px; border-left: 2px solid #aeb8c3; background: #f7f8fa; }
.timeline-section .outcome-label { display: block; margin-bottom: 7px; color: #354258; font-size: 11px; font-weight: 850; text-transform: uppercase; letter-spacing: .05em; }
.timeline-section .event-outcome .status-pill { white-space: normal; line-height: 1.5; font-size: 11px; }
.timeline-section .event-body .outcome { border: 0; padding: 0; margin: 8px 0 0; max-width: 88ch; line-height: 1.65; color: #414b57; }
.timeline-section .event-footer { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid #e5e9ed; }
.timeline-section .source-inline { margin: 0; padding: 0; border: 0; background: none; }
.timeline-section .source-label { font-size: 11px; font-weight: 800; color: var(--muted); }
.timeline-section .source-links a { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 719px) {
  .hero[data-page="timeline"] { padding-top: 16px; padding-bottom: 10px; }
  .hero[data-page="timeline"] h1 { font-size: 30px; }
  .hero[data-page="timeline"] .lede { font-size: 13px; line-height: 1.5; }
  .hero[data-page="timeline"] .hero-actions { gap: 6px; margin-top: 12px; }
  .hero[data-page="timeline"] .hero-actions a { padding: 10px 12px; font-size: 12px; }
  .timeline-share > summary { min-height: 44px; }
  #categoryQuickFilters .category-chip { min-height: 44px; font-size: 11px; }
  .timeline-section .event-body { padding: 15px 13px; }
  .timeline-section .event-summary { font-size: 14px; }
  .timeline-section .event-outcome { padding: 10px; }
  .timeline-section .year-heading b { font-size: 10px; white-space: nowrap; }
}

.search-wrap {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.search-wrap > label {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.search-control-row {
  display: flex;
  min-width: 0;
  gap: 8px;
}

.search-control-row input {
  min-width: 0;
  flex: 1 1 auto;
}

.search-control-row .clear-filters-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 104px;
  margin: 0;
  white-space: nowrap;
}

.clear-filter-icon {
  display: none;
  flex: 0 0 auto;
}

/* Keep the issue index useful without making the voices route begin with a wall
   of chips on a narrow screen. */
.voice-issue-spotlight {
  margin-bottom: 12px;
  padding: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.voice-issue-spotlight-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 12px;
}

.voice-issue-spotlight-head span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.voice-issue-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.voice-issue-chip {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 1 auto;
  min-height: 36px;
  max-width: 100%;
  gap: 7px;
  padding: 6px 7px 6px 10px;
  border: 1px solid #e0d8ca;
  border-radius: 999px;
  background: #f8f5ee;
  color: var(--ink);
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.voice-issue-chip span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-issue-chip img {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  margin-left: -3px;
  border: 1px solid #fff;
  border-radius: 999px;
  background: #e6e0d6;
  object-fit: cover;
}

.voice-avatar {
  position: relative;
  overflow: hidden;
  text-decoration: none;
}

.voice-avatar-linked {
  cursor: zoom-in;
}

.voice-avatar-linked:focus-visible {
  outline: 2px solid var(--bjp);
  outline-offset: 2px;
}

.voice-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.voice-issue-chip strong {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 999px;
  background: #6b7680;
  color: #fff;
  font-size: 10px;
}

.voice-issue-chip:hover,
.voice-issue-chip:focus-visible,
.voice-issue-chip.is-active {
  border-color: var(--bjp);
  background: #fff2e8;
}

.voice-issue-chip:focus-visible {
  outline: 2px solid rgba(255, 103, 31, .55);
  outline-offset: 2px;
}

.voices-filter-bar > .clear-filters-button {
  align-self: end;
  height: 46px !important;
  min-height: 46px !important;
  margin: 0;
}

@media (max-width: 559px) {
  .record-share .share-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    overflow: visible;
    padding-bottom: 0;
  }

  .record-share .share-button {
    width: 100%;
    min-width: 0;
  }

  .voice-issue-spotlight-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .voice-issue-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 18px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 18px), transparent);
  }

  .voice-issue-chips::-webkit-scrollbar {
    display: none;
  }

  .voice-issue-chip {
    flex: 0 0 auto;
    max-width: 260px;
  }
}

@media (min-width: 720px) {
  .toolbar {
    grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.9fr) minmax(180px, 0.55fr);
  }

  .search-control-row .clear-filters-button:disabled {
    width: 0;
    min-width: 0 !important;
    min-height: 0 !important;
    padding-right: 0;
    padding-left: 0;
    overflow: hidden;
    border-width: 0;
    border-color: transparent;
    opacity: 0;
    pointer-events: none;
  }
}

@media (min-width: 1040px) {
  .toolbar {
    grid-template-columns: minmax(320px, 0.95fr) minmax(0, 2fr) minmax(200px, 0.6fr);
  }
}

/* The axis is a shared coordinate: every year node, event node, and line uses
   its centre instead of relying on separate left offsets. */
.timeline-list {
  --timeline-axis: 9px;
}

.year-heading::before {
  left: calc(var(--timeline-axis) - 6.5px);
}

.year-heading::after,
.year-records::before {
  left: calc(var(--timeline-axis) - 1px);
}

.event-card::before {
  left: calc(var(--timeline-axis) - 32.5px);
}

@media (max-width: 719px) {
  .search-control-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 46px;
    gap: 7px;
  }

  .search-control-row .clear-filters-button {
    width: 46px;
    min-width: 46px;
    padding: 8px;
  }

  .clear-filter-icon {
    display: block;
  }

  .clear-filter-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}
