/* ============================================================================
   Courts & Cases — Case Lineage / Citator (cc-citator.css)
   Precedent status + Case journey + Related cases on the judgment page.
   Uses the shared design tokens from cc-design.css. Theme-aware.
   ============================================================================ */

.cc-citator-wrap {
  display: grid;
  gap: 18px;
  margin: 4px 0 26px;
}

/* The journey is the procedural answer and belongs near the case header.
   Status and discovery links are intentionally quieter, below the judgment. */
.cc-citator-wrap--primary {
  grid-template-columns: minmax(0, 1fr);
  margin-bottom: 30px;
}

.cc-citator-wrap--secondary {
  grid-template-columns: minmax(0, 1fr);
  margin-top: 30px;
}

.cc-citator {
  background: var(--cc-surface);
  border: 1px solid var(--cc-border);
  border-radius: var(--cc-r-lg);
  padding: 22px 22px 20px;
}

.cc-citator-title {
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: 0.2px;
}

.cc-citator-sub {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--cc-text-3);
  margin-top: 2px;
}

.cc-cit-subhead {
  font-size: 13px;
  font-weight: 600;
  color: var(--cc-text-2);
  margin: 16px 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* ── Precedent status ────────────────────────────────────────── */

.cc-cit-status-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--cc-text);
  margin: 10px 0 4px;
  line-height: 1.4;
}

.cc-cit-summary {
  font-size: 13.5px;
  color: var(--cc-text-2);
  margin: 6px 0 0;
}

.cc-cit-note {
  font-size: 12.5px;
  color: var(--cc-text-3);
  margin: 10px 0 0;
}

.cc-cit-status-note {
  font-size: 12.5px;
  color: var(--cc-text-3);
  margin: 6px 0 0;
}

.cc-cit-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.cc-cit-flag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--cc-r-pill);
  font-size: 12px;
  font-weight: 600;
  background: var(--cc-ink-tint);
  color: var(--cc-ink);
}

.cc-cit-flag--neg {
  background: var(--cc-brass-tint);
  color: var(--cc-brass);
}

.cc-cit-treat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.cc-cit-treat {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13.5px;
  padding: 7px 0;
  border-bottom: 1px solid var(--cc-border);
}

.cc-cit-treat:last-child {
  border-bottom: 0;
}

.cc-cit-treat-chip {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--cc-text);
  background: var(--cc-surface-2);
  border: 1px solid var(--cc-border);
  border-radius: var(--cc-r-pill);
  padding: 2px 9px;
}

/* Evidence links ("Why is this linked?") */

.cc-cit-evidence-link {
  font-size: 12px;
  color: var(--cc-ink);
  background: var(--cc-ink-tint);
  border: 0;
  border-radius: var(--cc-r-sm);
  padding: 4px 10px;
  cursor: pointer;
  transition: background var(--cc-dur-fast), color var(--cc-dur-fast);
}

.cc-cit-evidence-link:hover {
  background: var(--cc-ink);
  color: var(--cc-text-inv);
}

/* ── Case journey: shared proceeding-chain component ─────────── */
/* One component for the illustrative chain on /case-journey.html and the real
   chain on case pages: the same cards, court chips, connectors and review
   states. Page layout and motion stay with each page (case-journey.css). */

.cj-chain {
  display: flex;
  flex-direction: column;
  max-width: 380px;
}

.cj-card {
  position: relative;
  background: var(--cc-surface);
  border: 1px solid var(--cc-border);
  border-radius: var(--cc-r-lg);
  box-shadow: var(--cc-sh-md);
  padding: 14px 16px 15px;
}

.cj-card--gap {
  background: transparent;
  border: 1.5px dashed var(--cc-border-2);
  box-shadow: none;
  padding: 10px 16px;
}

.cj-gap-text {
  font-size: 12.5px;
  color: var(--cc-text-3);
}

/* Current step: an outline, not a border swap, so the hairline underneath stays. */
.cj-card--current {
  outline: 2px solid var(--cc-brass);
  outline-offset: 2px;
}

.cj-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.cj-tier {
  display: inline-flex;
  padding: 3px 9px;
  border-radius: var(--cc-r-pill);
  font-size: 11px;
  font-weight: 600;
  background: var(--cc-surface-2);
  color: var(--cc-text-2);
}

.cj-tier--sc {
  background: var(--cc-ink-tint);
  color: var(--cc-ink);
}

.cj-meta {
  font-family: var(--cc-mono);
  font-size: 11px;
  color: var(--cc-text-3);
  white-space: nowrap;
}

.cj-line {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--cc-text-2);
}

.cj-marker {
  display: inline-block;
  margin-top: 10px;
  padding: 3px 9px;
  border-radius: var(--cc-r-pill);
  font-size: 11px;
  font-weight: 600;
  background: var(--cc-brass-tint);
  color: var(--cc-brass-deep);
}

.cj-marker--rel {
  background: var(--cc-ink-tint);
  color: var(--cc-ink);
}

/* Connectors carry the link state between two cards. The dot carries the tone;
   label text stays dark so it passes contrast at 11px. */
.cj-connector {
  position: relative;
  height: 34px;
  margin-left: 20px;
  display: flex;
  align-items: center;
}

.cj-connector::before {
  content: "";
  position: absolute;
  left: 0;
  top: -1px;
  bottom: -1px;
  width: 1.5px;
  background: var(--cc-border-2);
  transform-origin: top;
}

.cj-connector--muted::before {
  background: linear-gradient(var(--cc-border-2) 60%, transparent 0%) 0 0 / 1.5px 6px repeat-y;
}

.cj-connector--success::before {
  background: var(--cc-success);
}

.cj-connector--warn::before {
  background: var(--cc-warn);
}

.cj-connector-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 14px;
  padding: 3px 10px;
  border-radius: var(--cc-r-pill);
  font-family: var(--cc-mono);
  font-size: 11px;
  white-space: nowrap;
  color: var(--cc-text-2);
  background: var(--cc-surface);
  border: 1px solid var(--cc-border);
}

.cj-connector--warn .cj-connector-label {
  background: var(--cc-warn-bg);
  border-color: transparent;
}

.cj-connector--success .cj-connector-label {
  background: var(--cc-success-bg);
  border-color: transparent;
}

.cj-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cj-dot--success {
  background: var(--cc-success);
}

.cj-dot--warn {
  background: var(--cc-warn);
}

@media (max-width: 600px) {
  .cj-connector {
    height: auto;
    min-height: 34px;
    padding: 6px 0;
  }

  .cj-connector-label {
    white-space: normal;
  }
}

/* Case-page context: real titles, evidence buttons and a full-width column. */
.cc-citator .cj-chain {
  max-width: none;
}

.cj-title {
  display: block;
  margin-top: 9px;
  font-family: var(--cc-serif);
  font-size: 15.5px;
  line-height: 1.35;
  color: var(--cc-text);
}

a.cj-title {
  text-decoration: underline;
  text-decoration-color: var(--cc-border-2);
  text-underline-offset: 3px;
  transition: color var(--cc-dur-fast), text-decoration-color var(--cc-dur-fast);
}

a.cj-title:hover {
  color: var(--cc-ink);
  text-decoration-color: var(--cc-ink);
}

.cc-citator .cj-line {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--cc-text-3);
}

.cc-citator .cj-connector {
  height: auto;
  min-height: 34px;
  padding: 6px 0 6px 14px;
  flex-wrap: wrap;
  gap: 6px 8px;
}

.cc-citator .cj-connector-label {
  margin-left: 0;
  white-space: normal;
}

.cj-stack {
  display: grid;
  gap: 10px;
}

.cj-rel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.cj-rel .cj-marker {
  margin-top: 0;
}

.cc-cit-lit + .cc-cit-lit {
  margin-top: 18px;
  padding-top: 4px;
  border-top: 1px solid var(--cc-border);
}

.cc-cit-journey-note {
  margin: 18px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--cc-border);
  font-size: 12px;
  line-height: 1.55;
  color: var(--cc-text-3);
}

.cc-cit-journey-note a {
  color: var(--cc-text-2);
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (max-width: 520px) {
  .cc-citator .cj-card {
    padding: 12px 13px 13px;
  }

  .cc-citator .cj-meta {
    white-space: normal;
  }
}

/* ── Related cases ────────────────────────────────────────────── */

.cc-cit-related-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.cc-cit-related-card {
  border: 1px solid var(--cc-border);
  border-radius: var(--cc-r-md);
  padding: 12px 14px;
  background: var(--cc-surface-2);
  transition: border-color var(--cc-dur-fast), transform var(--cc-dur-fast);
}

.cc-cit-related-card:hover {
  border-color: var(--cc-ink);
}

.cc-cit-related-title {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--cc-ink);
  text-decoration: none;
  line-height: 1.35;
}

.cc-cit-related-title:hover {
  text-decoration: underline;
}

.cc-cit-related-meta {
  font-size: 11.5px;
  color: var(--cc-text-3);
  margin: 4px 0 0;
}

.cc-cit-related-why {
  font-size: 12px;
  color: var(--cc-text-2);
  margin: 6px 0 0;
}

/* ── Evidence modal ───────────────────────────────────────────── */

.cc-cit-evidence-modal {
  border: 0;
  padding: 0;
  background: transparent;
  width: min(560px, calc(100vw - 32px));
}

.cc-cit-evidence-modal::backdrop {
  background: rgba(8, 15, 44, 0.55);
  backdrop-filter: blur(2px);
}

.cc-cit-modal-card {
  background: var(--cc-surface);
  border: 1px solid var(--cc-border-2);
  border-radius: var(--cc-r-lg);
  padding: 22px;
  position: relative;
  box-shadow: 0 18px 50px rgba(8, 15, 44, 0.28);
}

.cc-cit-modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  border: 0;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: var(--cc-text-3);
  cursor: pointer;
}

.cc-cit-modal-close:hover {
  color: var(--cc-text);
}

.cc-cit-modal-title {
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 14px;
  padding-right: 28px;
}

.cc-cit-modal-meta {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--cc-text-2);
}

.cc-cit-modal-meta div {
  margin: 3px 0;
}

.cc-cit-modal-meta b {
  color: var(--cc-text);
  font-weight: 600;
}

.cc-cit-modal-evidence {
  font-size: 14px;
  line-height: 1.55;
  color: var(--cc-text);
  margin: 0 0 4px;
  max-height: 40vh;
  overflow: auto;
  padding-right: 6px;
  white-space: pre-wrap;
}

.cc-cit-modal-foot {
  margin: 12px 0 0;
  font-size: 12.5px;
}

.cc-cit-modal-foot a {
  color: var(--cc-ink);
}

/* ── Responsive ───────────────────────────────────────────────── */

@media (min-width: 1024px) {
  .cc-citator-wrap--secondary {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 520px) {
  .cc-citator {
    padding: 16px 15px 14px;
  }
}
