/* SCOTUS Analytics — Justices Heatmap Styles */

/* ── Legend ── */
.heatmap-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
}

.legend-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.legend-bar {
  display: flex;
  height: 16px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  width: 280px;
}

.legend-segment {
  flex: 1;
}

/* ── Heatmap Table ── */
.heatmap-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.heatmap-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 3px;
  min-width: 700px;
}

.heatmap-corner {
  width: 110px;
  min-width: 110px;
}

.heatmap-col-header {
  text-align: center;
  vertical-align: bottom;
  padding: 0 2px var(--space-sm);
  position: relative;
  height: 70px;
}

.heatmap-col-label {
  font-family: var(--font-headline);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-tertiary);
  writing-mode: vertical-lr;
  transform: rotate(180deg);
  white-space: nowrap;
  display: inline-block;
}

.heatmap-total-header .heatmap-col-label {
  color: var(--text-secondary);
}

.heatmap-row-label {
  font-family: var(--font-headline);
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-primary);
  padding-right: var(--space-md);
  white-space: nowrap;
  width: 110px;
  min-width: 110px;
}

/* ── Cells ── */
.heatmap-cell {
  text-align: center;
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-xs);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
  min-width: 48px;
}

.heatmap-cell:hover {
  transform: scale(1.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  z-index: 2;
}

.heatmap-cell.selected {
  outline: 3px solid var(--text-primary);
  outline-offset: -1px;
  transform: scale(1.05);
  z-index: 3;
}

.heatmap-cell-empty {
  background: #f5f5f5;
  color: #ccc;
  cursor: default;
  font-size: 0.8rem;
}

.heatmap-cell-empty:hover {
  transform: none;
  box-shadow: none;
}

.heatmap-cell-count {
  font-family: var(--font-data);
  font-size: 0.75rem;
  font-weight: 700;
}

.heatmap-total-cell {
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-family: var(--font-data);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: default;
}

.heatmap-total-cell:hover {
  transform: none;
  box-shadow: none;
}

/* ── Case Panel ── */
.case-panel-card {
  border-top: 4px solid var(--accent-red);
  animation: panelSlide 0.3s ease;
}

@keyframes panelSlide {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.case-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-lg);
}

.case-panel-close {
  background: none;
  border: none;
  font-size: 1.8rem;
  line-height: 1;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 0 var(--space-xs);
  transition: color 0.2s;
}

.case-panel-close:hover {
  color: var(--text-primary);
}

.case-panel-table {
  max-height: 500px;
  overflow-y: auto;
  display: block;
}

.case-panel-table thead,
.case-panel-table tbody,
.case-panel-table tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

.case-panel-table thead {
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}

.text-nowrap {
  white-space: nowrap;
}

/* ── Opinion Links in Case Panel ── */
.case-opinion-link {
  color: var(--accent-blue);
  text-decoration: none;
  transition: opacity 0.2s;
}

.case-opinion-link:hover {
  opacity: 0.7;
  text-decoration: underline;
}

/* ── Justice profile pages (/justices/<slug>/) ── */
.jp-header p { max-width: 720px; }
.jp-mq-chip { display: inline-block; vertical-align: middle; margin-left: 8px; padding: 2px 10px;
  border-radius: 12px; font-size: 0.85rem; font-weight: 700; color: #fff; font-family: 'Roboto Mono', monospace; }
.jp-mq-cons { background: var(--color-respondent); }
.jp-mq-lib { background: var(--color-petitioner); }

/* two-tone conservative/liberal split inside the standard bar track.
   display:block/flex is required — inline spans collapse to 0×0 (see database.css). */
.jp-split-track { display: flex; }
.jp-split-cons, .jp-split-lib { display: block; height: 100%; }
.jp-split-cons { background: var(--color-respondent); }
.jp-split-lib { background: var(--color-petitioner); }

.jp-agree-list { list-style: none; padding: 0; margin: 0; font-size: 0.85rem; }
.jp-agree-list li { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0;
  border-bottom: 1px solid var(--border-light); max-width: 260px; }

.jp-filters { display: flex; flex-wrap: wrap; gap: var(--space-sm); align-items: center; margin-bottom: var(--space-md); }
.jp-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.jp-pill { padding: 4px 12px; font-size: 0.78rem; font-weight: 600; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--border-light); background: var(--bg-card); color: var(--text-secondary); }
.jp-pill.active { background: var(--bg-dark); color: var(--text-on-dark); border-color: var(--bg-dark); }
.jp-filters select { padding: 5px 10px; font-size: 0.8rem; border: 1px solid var(--border-light);
  border-radius: var(--radius-sm, 4px); background: var(--bg-card); color: var(--text-secondary); max-width: 240px; }

.jp-item { padding: var(--space-sm) 0; border-bottom: 1px solid var(--border-light); }
.jp-item:last-child { border-bottom: none; }
.jp-item-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.jp-date { font-family: 'Roboto Mono', monospace; font-size: 0.75rem; color: var(--text-tertiary); white-space: nowrap; }
.jp-badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 0.72rem; font-weight: 700;
  color: #fff; background: var(--color-neutral); text-transform: uppercase; letter-spacing: 0.03em; }
.jp-badge-book { background: #8e44ad; }
.jp-badge-article { background: #2d7dd2; }
.jp-badge-testimony { background: #c0392b; }
.jp-badge-speech, .jp-badge-lecture { background: #e67e22; }
.jp-badge-interview { background: #16a085; }
.jp-title { font-weight: 600; color: var(--accent-blue); text-decoration: none; }
.jp-title:hover { text-decoration: underline; }
.jp-venue { font-size: 0.78rem; color: var(--text-tertiary); margin-top: 2px; }
.jp-summary { font-size: 0.88rem; margin: 6px 0 4px; max-width: 760px; }
.jp-summary q { color: var(--text-secondary); font-style: italic; }
.jp-signal { font-size: 0.82rem; margin: 4px 0; padding: 6px 10px; border-left: 3px solid var(--accent-blue);
  background: var(--bg-primary); border-radius: 0 var(--radius-sm, 4px) var(--radius-sm, 4px) 0; max-width: 760px; }
.jp-signal-tag { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--accent-blue); margin-right: 6px; }
.jp-topics { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.jp-topic { font-size: 0.7rem; padding: 1px 8px; border-radius: 9px; background: var(--bg-primary);
  color: var(--text-tertiary); border: 1px solid var(--border-light); }

/* profile cards strip on /justices/ */
.jp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--space-sm);
  margin-bottom: var(--space-lg); }
.jp-card { display: block; padding: var(--space-sm) var(--space-md); background: var(--bg-card);
  border: 1px solid var(--border-light); border-radius: var(--radius-sm, 6px); text-decoration: none; }
.jp-card:hover { border-color: var(--accent-blue); }
.jp-card .jp-card-name { font-weight: 700; color: var(--text-primary); }
.jp-card .jp-card-sub { font-size: 0.75rem; color: var(--text-tertiary); margin-top: 2px; }

@media (max-width: 640px) {
  .jp-item-head { gap: 6px; }
  .jp-summary, .jp-signal { max-width: none; }
}

/* "search their words" box */
.jp-search { display: flex; gap: 8px; margin-bottom: var(--space-md); }
.jp-search input { flex: 1 1 280px; min-width: 180px; padding: 8px 12px; font-size: 0.9rem;
  border: 1px solid var(--border-medium, #ccc); border-radius: var(--radius-sm, 6px); background: var(--bg-card); }
.jp-search button { border: none; }
.jp-summary mark { background: #fff3b0; padding: 0 2px; border-radius: 2px; }

/* document reader panel */
#jp-panel { position: fixed; top: 0; right: 0; height: 100vh; width: min(680px, 94vw);
  background: var(--bg-card); box-shadow: -6px 0 24px rgba(0,0,0,0.18); z-index: 1000;
  display: flex; flex-direction: column; }
.jp-panel-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  border-bottom: 1px solid var(--border-light); }
.jp-panel-title { flex: 1; font-weight: 700; font-size: 0.85rem; line-height: 1.25; }
.jp-panel-body { flex: 1; overflow-y: auto; padding: 12px 16px; }
.jp-panel-text { font-size: 0.86rem; line-height: 1.65; white-space: pre-wrap;
  font-family: Georgia, 'Times New Roman', serif; }
.jp-panel-text mark { background: #fff3b0; padding: 0 2px; border-radius: 2px; }
.jp-panel-navrow { display: flex; justify-content: space-between; align-items: center;
  gap: 8px; margin: 8px 0; }
.jp-panel-video { width: 100%; aspect-ratio: 16/9; border: 0; border-radius: var(--radius-sm, 6px); }
.jp-read { white-space: nowrap; }
.jp-read-click { cursor: pointer; }
.jp-read-click:hover { background: var(--bg-primary); border-radius: var(--radius-sm, 4px); }
body.jp-panel-open { overflow: hidden; }
@media (max-width: 900px) { #jp-panel { width: 100vw; } }
.jp-video-link { color: var(--accent-blue); text-decoration: none; font-weight: 600; }
.jp-video-link:hover { text-decoration: underline; }

/* Server-rendered appearance timeline (the crawler / no-JS fallback inside
   #justice-profile, before justice-profile.js hydrates the interactive view). */
.ap-timeline { list-style: none; padding: 0; margin: var(--space-md) 0; }
.ap-timeline > li {
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border-light, #e5e5e5);
}
.ap-timeline .ap-meta { font-weight: 600; color: var(--text-secondary); }
.ap-timeline .ap-venue { color: var(--text-tertiary); font-size: 0.9em; }
.ap-timeline .ap-summary { margin: 6px 0 0; color: var(--text-secondary); line-height: 1.55; }
.ap-timeline .ap-quote {
  margin: 8px 0 0; padding-left: var(--space-md);
  border-left: 3px solid var(--accent-red); color: var(--text-primary); font-style: italic;
}
.ap-timeline .ap-topics { margin: 6px 0 0; font-size: 0.8rem; color: var(--text-tertiary); }

/* compare page columns */
.cmp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-sm); align-items: start; }
.cmp-col h3 { margin-bottom: 4px; }

/* Issue-by-issue evolution (justice profile + /justices/issues/) */
.jp-pills { display: flex; flex-wrap: wrap; gap: 6px; margin: var(--space-sm) 0; }
.jp-pill { font: inherit; font-size: 0.8rem; padding: 4px 10px; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--border-medium); background: var(--bg-card); color: var(--text-primary); }
.jp-pill.active { background: var(--accent-blue); border-color: var(--accent-blue); color: #fff; }
.jp-pill.active .text-tertiary { color: rgba(255,255,255,0.8); }
#jp-issue-chart, .iss-chart { width: 100%; display: block; }
.iss-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.8rem; margin-top: var(--space-xs); }
.iss-legend span::before { content: ''; display: inline-block; width: 14px; height: 3px; margin-right: 5px; vertical-align: middle; background: var(--c); }
.iss-shift { font-size: 0.9rem; margin: var(--space-xs) 0; }
.iss-grid { margin-top: var(--space-md); }
.iss-card { display: block; text-decoration: none; color: inherit; }
.iss-card:hover { border-color: var(--accent-blue); }
.iss-lib { color: var(--color-petitioner); font-weight: 700; }
.iss-con { color: var(--color-respondent); font-weight: 700; }
/* In their own words */
.jw-block { margin-top: var(--space-md); border-top: 1px solid var(--border-light); padding-top: var(--space-sm); }
.jw-title { font-family: var(--font-headline); text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.95rem; margin: 0 0 var(--space-sm); }
.jw-list { list-style: none; padding: 0; margin: 0; }
.jw-item { padding: var(--space-sm) 0; border-bottom: 1px solid var(--border-light); }
.jw-meta { font-size: 0.8rem; color: var(--text-tertiary); }
.jw-kind { font-weight: 600; color: var(--text-secondary); }
.jw-badge { display: inline-block; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; padding: 1px 6px; border-radius: 3px; background: var(--bg-tertiary, rgba(127,127,127,0.15)); color: var(--text-secondary); }
.jw-pre .jw-quote { border-left-style: dashed; }
.jw-quote { margin: 4px 0; padding-left: 12px; border-left: 3px solid var(--accent-blue); font-size: 0.95rem; line-height: 1.5; }
.jw-context { font-size: 0.82rem; color: var(--text-secondary); }
.jw-speeches { margin: 0 0 var(--space-sm); padding-left: 1.1rem; font-size: 0.85rem; }
/* Hearing excerpts: who is speaking */
.hr-turn { display: block; margin-top: 2px; }
.hr-who { font-weight: 700; font-size: 0.8em; }
.hr-other { color: var(--text-tertiary); font-style: italic; }
.hr-other .hr-who { font-style: normal; }
.jw-q { margin: 4px 0 2px; padding-left: 12px; border-left: 3px solid var(--border-light); font-size: 0.82rem; color: var(--text-tertiary); }
.jw-q-who { font-weight: 700; font-style: normal; color: var(--text-secondary); font-size: 0.78rem; }
/* "On this page" jump links on profiles */
.jp-toc { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; margin: var(--space-sm) 0 0; font-size: 0.85rem; }
.jp-toc a { color: var(--accent-blue); text-decoration: none; white-space: nowrap; }
.jp-toc a:hover { text-decoration: underline; }
[id^="jp-sec-"], #jp-issues, #jp-themes, #jp-timeline { scroll-margin-top: 70px; }
/* Visible keyboard focus on filter/issue buttons */
.jp-pill:focus-visible, .jp-toc a:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 2px; }

/* ── /justices/methods/ — interpretive-methods explainer ── */
.mt-page h1 { margin-bottom: var(--space-xs); }
.mt-lede { font-size: 1.02rem; max-width: 760px; }
.mt-caveat { max-width: 760px; margin: var(--space-md) 0; padding: 10px 14px; font-size: 0.88rem;
  background: var(--bg-primary); border-left: 3px solid var(--color-neutral); border-radius: 0 var(--radius-sm, 4px) var(--radius-sm, 4px) 0; }
.mt-toc { font-size: 0.85rem; margin: var(--space-md) 0; line-height: 1.9; }
.mt-toc a { color: var(--accent-blue); text-decoration: none; }
.mt-toc a:hover { text-decoration: underline; }
.mt-h2 { margin-top: var(--space-xl, 2.5rem); }
.mt-method, .mt-justice { margin-top: var(--space-md); scroll-margin-top: 80px; }
.mt-method p, .mt-justice p { max-width: 780px; }
.mt-oneline { font-weight: 600; color: var(--text-secondary); }
.mt-variants { font-size: 0.9rem; max-width: 760px; }
.mt-variants li { margin: 4px 0; }
.mt-contrast, .mt-ownwords, .mt-contested { font-size: 0.88rem; }
.mt-contested { color: var(--text-secondary); }
.mt-who { font-size: 0.85rem; }
.mt-who a, .mt-justice h3 a { color: var(--accent-blue); text-decoration: none; }
.mt-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.mt-chip { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 700;
  background: var(--bg-dark); color: var(--text-on-dark); text-decoration: none; }
.mt-chip:hover { opacity: 0.85; }
.mt-cite { font-size: 0.72rem; text-decoration: none; color: var(--accent-blue); margin-left: 1px; }
.mt-own { margin-top: var(--space-sm); padding-top: var(--space-sm); border-top: 1px solid var(--border-light); }
.mt-own-h { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-tertiary); margin: 0 0 4px; }
.mt-own ul { list-style: none; padding: 0; margin: 0; font-size: 0.86rem; }
.mt-own li { margin: 4px 0; }
.mt-own a { color: var(--accent-blue); text-decoration: none; }
.mt-more { font-size: 0.8rem; margin: 6px 0 0; }
.mt-sources { font-size: 0.85rem; max-width: 820px; }
.mt-sources li { margin: 6px 0; scroll-margin-top: 80px; }
.mt-sources li:target { background: #fff3b0; }
.mt-srcn { font-weight: 700; color: var(--text-tertiary); }
