/* ==========================================================================
   Congress tracker showpiece, "the Capitol docket" (src/features/congress/capitol.js):
   the Capitol, drawn in white lines on the deep-purple panel, whose steps
   carry the tracked bills; the weekly digest and the item cards (light).
   Animation is CSS only; congress-capitol.js pauses it off screen.
   ========================================================================== */

.cgd {
  --cgd-hi: #DCCFEE; /* light lilac accents on the night panel */
  --cgd-line: rgba(255, 255, 255, 0.92);
  --cgd-fine: rgba(255, 255, 255, 0.42);
  position: relative; overflow: hidden; color: var(--on-ink);
  padding: clamp(2.2rem, 5vw, 4rem) 0 clamp(1.8rem, 4vw, 3rem);
  background:
    radial-gradient(120% 70% at 50% 0%, #3B2762 0%, rgba(42, 27, 69, 0) 60%),
    linear-gradient(180deg, #1C1131 0%, #2A1B45 58%, #22163A 100%);
  border-bottom: 1px solid #3F2C60;
}
.cgd-inner { position: relative; }
.cgd-head { max-width: 46rem; margin: 0 auto; text-align: center; }
.cgd-kicker { margin: 0 0 0.6rem; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.24em; text-transform: uppercase; color: var(--cgd-hi); }
.cgd-h2 { margin: 0 0 0.6rem; font-family: var(--font-serif); font-weight: 400; font-size: clamp(1.8rem, 3.6vw, 2.9rem); line-height: 1.12; letter-spacing: -0.015em; color: #fff; }
.cgd-sub { margin: 0 auto; max-width: 40rem; font-family: var(--font-serif); font-size: clamp(1rem, 1.3vw, 1.14rem); line-height: 1.55; color: #fff; }

.cgd-figure { margin: clamp(1rem, 2.5vw, 1.8rem) 0 0; }
.cgd-stage-wrap { position: relative; max-width: 1180px; margin: 0 auto; }
.cgd-svg { display: block; width: 100%; height: auto; aspect-ratio: 1200 / 720; overflow: visible; }
.cgd-line { fill: none; stroke: var(--cgd-line); stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.cgd-fine { fill: none; stroke: var(--cgd-fine); stroke-width: 0.8; vector-effect: non-scaling-stroke; }
.cgd-col { fill: none; stroke: var(--cgd-line); stroke-width: 0.95; vector-effect: non-scaling-stroke; }
.cgd-fill { fill: #241638; }
.cgd-shade { fill: url(#cgd-hatch); }
.cgd-hatch-line { stroke: rgba(255, 255, 255, 0.16); stroke-width: 1; }
.cgd-joint { fill: none; stroke: rgba(255, 255, 255, 0.14); stroke-width: 0.8; vector-effect: non-scaling-stroke; }
.cgd-frieze { font: 600 9px var(--font); letter-spacing: 0.5em; fill: rgba(255, 255, 255, 0.7); }
.cgd-dome-shell { fill: #261840; }

/* The steps */
.cgd-riser { fill: #2E1F4B; stroke: rgba(255, 255, 255, 0.5); stroke-width: 0.9; vector-effect: non-scaling-stroke; transition: fill 0.25s ease; }
.cgd-tread { stroke: rgba(255, 255, 255, 0.92); stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.cgd-step.has-bills .cgd-riser { fill: #35245A; }
.cgd-riser-link { outline: none; cursor: pointer; }
.cgd-step.is-active .cgd-riser, .cgd-riser-link:hover .cgd-riser { fill: #45306F; }
.cgd-riser-link:focus-visible .cgd-riser { fill: #45306F; stroke: #fff; stroke-width: 2; }
.cgd-label { font: 500 14px var(--font-serif); letter-spacing: 0.06em; fill: #fff; }
.cgd-num { font: 600 11px var(--font); letter-spacing: 0.14em; fill: var(--cgd-hi); }
.cgd-count { font: 500 20px var(--font-serif); font-variant-numeric: lining-nums tabular-nums; fill: #fff; }
.cgd-step:not(.has-bills) .cgd-count { fill: rgba(255, 255, 255, 0.55); }
.cgd-step:not(.has-bills) .cgd-label { fill: rgba(255, 255, 255, 0.7); }
.cgd-more { font: 600 10px var(--font); fill: var(--cgd-hi); }

/* Bills: a white dot with a soft lilac halo. */
.cgd-bill { cursor: pointer; }
.cgd-dot { fill: #fff; }
.cgd-halo { fill: url(#cgd-glow); transform-box: fill-box; transform-origin: center; animation: cgd-breathe 4s ease-in-out infinite; animation-delay: var(--d, 0s); }
.cgd-bill:hover .cgd-dot, .cgd-bill.is-on .cgd-dot { fill: #fff; }
.cgd-bill:hover .cgd-halo, .cgd-bill.is-on .cgd-halo { animation: none; opacity: 1; transform: scale(1.5); }
@keyframes cgd-breathe { 0%, 100% { opacity: 0.45; transform: scale(0.82); } 50% { opacity: 1; transform: scale(1.12); } }

.cgd-sheen { display: none; }
.cgd.is-paused .cgd-halo { animation-play-state: paused; }

/* Hover / focus card */
.cgd-card {
  position: absolute; z-index: 2; width: min(22rem, calc(100% - 1rem)); padding: 0.85rem 1rem 0.9rem;
  background: #FFFFFF; border: 1px solid #C9B8DE; border-radius: 6px;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.6); color: #2A1B45; font-size: 0.85rem; line-height: 1.4;
  pointer-events: none;
}
.cgd-card[hidden] { display: none; }
.cgd-card-k { display: block; margin-bottom: 0.25rem; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: #5A3689; }
.cgd-card-h { display: block; margin-bottom: 0.45rem; font-family: var(--font-serif); font-size: 1.12rem; color: #2A1B45; }
.cgd-card ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; }
.cgd-card li { display: grid; grid-template-columns: auto 1fr; gap: 0.6rem; }
.cgd-card li.is-on { color: #000; font-weight: 600; }
.cgd-card b { font-weight: 700; color: #5A3689; white-space: nowrap; }
.cgd-card .cgd-card-t { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cgd-card small { display: block; margin-top: 0.45rem; color: #5D5B54; font-size: 0.75rem; }

.cgd-caption { margin: 0.6rem auto 0; max-width: 52rem; text-align: center; font-size: 0.76rem; letter-spacing: 0.03em; color: #DCCFEE; }

/* Legend: the text version of the drawing. */
.cgd-legend {
  list-style: none; margin: clamp(1.2rem, 3vw, 2rem) auto 0; padding: 0; max-width: 64rem;
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border-top: 1px solid rgba(255, 255, 255, 0.3);
}
.cgd-legend-item { display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 0.15rem 0.5rem; padding: 0.8rem 0.75rem 0.2rem; border-left: 1px solid rgba(255, 255, 255, 0.16); min-width: 0; }
.cgd-legend-item:first-child { border-left: 0; }
.cgd-legend-num { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.14em; color: var(--cgd-hi); }
.cgd-legend-name { font-size: 0.8rem; line-height: 1.25; color: #fff; }
.cgd-legend-count { font-family: var(--font-serif); font-size: 1.35rem; line-height: 1; color: #fff; font-variant-numeric: lining-nums tabular-nums; }
.cgd-legend-item.is-zero .cgd-legend-count { color: rgba(255, 255, 255, 0.55); }
.cgd-legend-bills { grid-column: 1 / -1; font-size: 0.74rem; line-height: 1.45; color: #DCCFEE; overflow-wrap: anywhere; }
.cgd-legend-bills a { color: #fff; text-decoration: underline; text-decoration-color: rgba(255, 255, 255, 0.4); text-underline-offset: 2px; }
.cgd-legend-bills a:hover, .cgd-legend-bills a:focus-visible { text-decoration-color: #fff; }
.cgd-legend-item:target { background: rgba(255, 255, 255, 0.08); }
.cgd-pending { margin: 1rem auto 0; text-align: center; font-size: 0.82rem; color: #DCCFEE; }

/* ----------------------------------------- "What changed this week" */

.cgr {
  margin: 0 0 var(--s-4); padding: clamp(1.1rem, 3vw, 1.75rem) clamp(1rem, 3vw, 2rem) 1rem;
  background: var(--paper); color: var(--text); border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: 8px;
}
.cgr-mast { margin-bottom: 1rem; }
.cgr-mast-top { display: flex; justify-content: space-between; gap: 1rem; margin: 0 0 0.35rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-text); }
.cgr-h2 { margin: 0; font-family: var(--font-serif); font-weight: 500; font-size: clamp(1.45rem, 2.2vw, 1.85rem); line-height: 1.2; letter-spacing: -0.01em; color: var(--ink); }
.cgr-mast-sub { margin: 0.2rem 0 0; font-size: 0.9rem; color: var(--muted); }
.cgr-body { columns: 2 22rem; column-gap: 2.4rem; column-rule: 1px solid var(--line); }
.cgr-group { break-inside: avoid-column; margin-bottom: 1rem; }
.cgr-chamber { margin: 0 0 0.5rem; padding-bottom: 0.3rem; border-bottom: 1px solid var(--line); font-size: 0.74rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); }
.cgr-list { list-style: none; margin: 0; padding: 0; }
.cgr-entry { margin: 0 0 0.65rem; font-size: 0.92rem; line-height: 1.5; color: var(--text); }
.cgr-id { font-weight: 700; color: var(--ink); }
a.cgr-id, a.cgr-title { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent-soft); text-underline-offset: 2px; }
a.cgr-id:hover, a.cgr-title:hover { color: var(--accent-text); text-decoration-color: currentColor; }
.cgr-date { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.cgr-notice { margin: 0 0 1rem; font-size: 0.9rem; color: var(--muted); }
.cgr-foot { margin: 0.4rem 0 0; padding-top: 0.5rem; border-top: 1px solid var(--line); font-size: 0.75rem; color: var(--muted); }

/* ------------------------------------------------------ Item cards */

.cg-items { gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 30rem), 1fr)); }
.cg-items .cg-item, .cg-item.is-featured {
  position: relative; padding: 1.1rem 1.25rem 1rem; border: 1px solid var(--line); border-left: 3px solid var(--accent);
  background: var(--paper); border-radius: 6px;
}
.cg-items .cg-item:first-child { padding-top: 1.1rem; }
.cg-items .cg-item .cg-id, .cg-item.is-featured .cg-id {
  padding: 0.1rem 0.45rem; border: 1px solid var(--line); border-radius: 3px; font-size: 0.74rem; letter-spacing: 0.04em; color: var(--ink); background: var(--tint);
}
.cg-items .cg-item .cg-steps { max-width: none; }
.cg-items .cg-item-foot { padding-top: 0.6rem; border-top: 1px solid var(--line); }

/* ------------------------------------------------------------ Narrow */

@media (max-width: 960px) {
  .cgd-legend { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cgd-legend-item:nth-child(4) { border-left: 0; }
  .cgd-legend-item:nth-child(n + 4) { border-top: 1px solid rgba(255, 255, 255, 0.16); }
}
@media (max-width: 640px) {
  /* Too small to read on the drawing: the legend below carries the words. */
  .cgd-label, .cgd-more, .cgd-frieze { display: none; }
  .cgd-count { font-size: 30px; }
  .cgd-halo { r: 14px; }
  .cgd-dot { r: 5px; }
  /* Closer in: the wings run off the edges, the steps and dome fill the width. */
  .cgd-stage-wrap { overflow: hidden; margin: 0 -16px; }
  .cgd-svg { width: 140%; margin-left: -20%; }
  .cgd-legend { grid-template-columns: minmax(0, 1fr); }
  .cgd-legend-item { border-left: 0; border-top: 1px solid rgba(255, 255, 255, 0.16); padding: 0.6rem 0.2rem; }
  .cgd-legend-item:first-child { border-top: 0; }
  .cgr-mast-top { flex-direction: column; gap: 0.15rem; }
}

@media (prefers-reduced-motion: reduce) {
  .cgd-halo { animation: none; opacity: 0.85; transform: none; }
  .cgd-riser { transition: none; }
}
@media (forced-colors: active) {
  .cgd-line, .cgd-col, .cgd-fine, .cgd-riser { stroke: CanvasText; }
  .cgd-dot { fill: Highlight; }
  .cgd-halo, .cgd-sheen { display: none; }
}
@media print {
  .cgd { background: none; color: #000; }
  .cgd-halo, .cgd-sheen, .cgd-card { display: none; }
}
