/* ─────────────────────────────────────────────────────────────
   LAWFARE TRACKER — "docket posture" presentation layer.
   Sister instrument to the AI Governance Tracker; same console
   grammar, posture-semantics palette:
     solid green   = plaintiff prevailed       (PREVAILED)
     solid amber   = live docket, glowing      (PENDING)
     solid red     = thrown out                (DISMISSED)
     solid blue    = resolved without verdict  (SETTLED)
     hatched violet= a list, not a docket      (DESIGNATION)
     gray          = orgs / methods, no posture(ORGS/OTHER)
   Scoped .lwf-*. JS contract preserved exactly: .lwf-table,
   .lwf-hidden, tr[data-lwf-status], chip classes lwf-on-<key>.
   ───────────────────────────────────────────────────────────── */

[x-cloak] { display: none !important; }

.lwf-wrap {
  --ground: #0C0C0F;
  --panel: #14141A;
  --panel2: #1B1B22;
  --line: #2A2A33;
  --tx: #E6E4DE;
  --mut: #84838F;
  --red: #CC0000;
  --red-lit: #FF2222;
  --red-dim: #881111;
  --amber: #E8A33D;
  --green: #3FB950;
  --blue: #58A6FF;
  --violet: #A371F7;
  --mono: ui-monospace, "JetBrains Mono", Consolas, monospace;
  color: var(--tx);
  margin: 1.6rem 0;
}

/* ─── Thesis lead — first paragraph of the body ──────────── */
.lwf-wrap > p:first-of-type {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.5;
  color: var(--tx);
  margin: 2.1rem 0 1.1rem;
}

/* ─── Field labels — leading <strong> in prose notes ─────── */
.lwf-wrap > p > strong:first-child {
  font-family: var(--mono);
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber);
}

/* ─── Section headers — numbered instrument panels ───────── */
.lwf-wrap { counter-reset: lwf-inst; }
.lwf-wrap h2 {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--tx);
  border-bottom: none;
  padding-bottom: 0;
  position: static;
  margin: 3.4rem 0 0.9rem;
  scroll-margin-top: 5rem;
}
.lwf-wrap h2::after {
  content: "";
  position: static;
  flex: 1 1 auto;
  width: auto;
  height: 1px;
  background: linear-gradient(90deg, var(--line) 0%, rgba(42, 42, 51, 0) 100%);
}
.lwf-wrap h2:not(.lwf-end) { counter-increment: lwf-inst; }
.lwf-wrap h2:not(.lwf-end)::before {
  content: counter(lwf-inst, decimal-leading-zero);
  flex: none;
  padding: 0.26rem 0.44rem 0.22rem;
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1;
  color: var(--red-lit);
  background: rgba(204, 0, 0, 0.07);
  border: 1px solid rgba(204, 0, 0, 0.5);
}

/* Endmatter headings (Bridges, Sources) step out of the index */
.lwf-wrap h2.lwf-end {
  margin-top: 3.8rem;
  font-size: 0.78rem;
  letter-spacing: 0.3em;
  color: var(--mut);
}
.lwf-wrap h2.lwf-end::before {
  content: "";
  flex: none;
  width: 14px;
  height: 1px;
  padding: 0;
  background: var(--mut);
  border: none;
}

/* ─── Docket-posture console ─────────────────────────────── */
.lwf-console {
  background-color: var(--panel);
  background-image: radial-gradient(rgba(230, 228, 222, 0.04) 1px, transparent 1px);
  background-size: 12px 12px;
  border: 1px solid var(--line);
  border-top: 2px solid var(--red);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  padding: 1rem 1.15rem 1.05rem;
  margin: 1.4rem 0 2rem;
}
.lwf-console-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}
.lwf-console-title {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--tx);
}
.lwf-console-stamp {
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mut);
  border: 1px solid var(--line);
  padding: 0.2rem 0.5rem;
  white-space: nowrap;
}
.lwf-console-readout {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mut);
  margin-left: auto;
}
.lwf-console-readout strong { color: var(--tx); font-weight: 700; }

.lwf-btn {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: var(--ground);
  color: var(--tx);
  border: 1px solid var(--line);
  padding: 0.3rem 0.7rem;
  cursor: pointer;
}
.lwf-btn:hover { border-color: var(--mut); background: var(--panel2); }
.lwf-btn:focus-visible,
.lwf-chip:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* ─── Posture bar — share of rows per posture ────────────── */
.lwf-bar {
  display: flex;
  gap: 2px;
  height: 10px;
  margin: 0.8rem 0 0.85rem;
  transform-origin: left center;
  animation: lwfDocket 0.7s cubic-bezier(0.25, 0.8, 0.3, 1) both;
}
@keyframes lwfDocket {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
.lwf-seg { flex: 0 1 0%; min-width: 0; transition: opacity 0.2s; }
.lwf-seg-prevailed { background: var(--green); box-shadow: 0 0 8px rgba(63, 185, 80, 0.3); }
.lwf-seg-pending { background: var(--amber); box-shadow: 0 0 8px rgba(232, 163, 61, 0.3); }
.lwf-seg-dismissed { background: var(--red); }
.lwf-seg-settled { background: var(--blue); }
.lwf-seg-designation {
  background: repeating-linear-gradient(45deg,
    rgba(163, 113, 247, 0.65) 0 3px, rgba(163, 113, 247, 0.18) 3px 6px);
}
.lwf-seg-other { background: var(--line); }
.lwf-seg-off { opacity: 0.15; }

/* ─── Posture chips — labelled LEDs ──────────────────────── */
.lwf-filterbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.lwf-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--ground);
  color: var(--mut);
  border: 1px solid var(--line);
  padding: 0.38rem 0.7rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background-color 0.15s;
}
.lwf-chip:hover { color: var(--tx); border-color: var(--mut); }
.lwf-chip-count { opacity: 0.55; }

/* LED socket — dark when the posture is filtered off */
.lwf-led {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--line);
}

/* Lit states (chip visible = posture shown) */
.lwf-chip.lwf-on-prevailed { color: var(--green); border-color: rgba(63, 185, 80, 0.5); background: rgba(63, 185, 80, 0.07); }
.lwf-chip.lwf-on-pending { color: var(--amber); border-color: rgba(232, 163, 61, 0.5); background: rgba(232, 163, 61, 0.07); }
.lwf-chip.lwf-on-dismissed { color: var(--red-lit); border-color: rgba(204, 0, 0, 0.6); background: rgba(204, 0, 0, 0.09); }
.lwf-chip.lwf-on-settled { color: var(--blue); border-color: rgba(88, 166, 255, 0.45); background: rgba(88, 166, 255, 0.06); }
.lwf-chip.lwf-on-designation { color: var(--violet); border-color: rgba(163, 113, 247, 0.45); background: rgba(163, 113, 247, 0.06); }
.lwf-chip.lwf-on-other { color: var(--tx); border-color: var(--mut); }

.lwf-on-prevailed .lwf-led { background: var(--green); border-color: transparent; box-shadow: 0 0 6px rgba(63, 185, 80, 0.6); }
.lwf-on-pending .lwf-led { background: var(--amber); border-color: transparent; box-shadow: 0 0 6px rgba(232, 163, 61, 0.6); }
.lwf-on-dismissed .lwf-led { background: var(--red-lit); border-color: transparent; box-shadow: 0 0 6px rgba(204, 0, 0, 0.7); }
.lwf-on-settled .lwf-led { background: var(--blue); border-color: transparent; box-shadow: 0 0 6px rgba(88, 166, 255, 0.55); }
.lwf-on-designation .lwf-led {
  background: transparent;
  border-color: rgba(163, 113, 247, 0.8);
  box-shadow: 0 0 6px rgba(163, 113, 247, 0.35);
}
.lwf-on-other .lwf-led { background: var(--mut); border-color: transparent; }

/* ─── Posture key — each LED state defined once ──────────── */
.lwf-key {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.35rem;
  margin: 0.95rem 0 0;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(42, 42, 51, 0.75);
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mut);
}
.lwf-key-item { display: inline-flex; align-items: center; gap: 0.45rem; }
.lwf-key-item strong { font-weight: 700; margin-right: 0.15rem; }
.lwf-key-item.lwf-on-prevailed strong { color: var(--green); }
.lwf-key-item.lwf-on-pending strong { color: var(--amber); }
.lwf-key-item.lwf-on-dismissed strong { color: var(--red-lit); }
.lwf-key-item.lwf-on-settled strong { color: var(--blue); }
.lwf-key-item.lwf-on-designation strong { color: var(--violet); }
.lwf-key-item.lwf-on-other strong { color: var(--tx); }

.lwf-legend {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  line-height: 1.7;
  color: var(--mut);
  margin: 0.85rem 0 0;
}
.lwf-legend a {
  color: var(--tx);
  text-decoration: underline;
  text-decoration-color: rgba(230, 228, 222, 0.3);
  text-underline-offset: 2px;
}
.lwf-legend a:hover { color: var(--red-lit); text-decoration-color: var(--red-lit); }

/* ─── Tables — docket readouts ───────────────────────────── */
.lwf-wrap table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  margin: 1.15rem 0 1.7rem;
}
.lwf-wrap th {
  background: var(--panel2);
  border: none;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mut);
  padding: 0.5rem 0.8rem;
  text-align: left;
}
.lwf-wrap th:first-child { border-left: 3px solid transparent; }
.lwf-wrap td {
  border: none;
  border-bottom: 1px solid var(--line);
  padding: 0.58rem 0.8rem;
  font-size: 0.88rem;
  line-height: 1.55;
  vertical-align: top;
}
.lwf-wrap tbody tr:last-child td { border-bottom: none; }
.lwf-wrap tbody tr:hover td { background: var(--panel2); }
.lwf-wrap td:first-child {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--tx);
}

/* Table links: quiet steel with underline — color stays
   reserved for posture. Prose links keep the site default. */
.lwf-wrap td a {
  color: var(--tx);
  text-decoration: underline;
  text-decoration-color: rgba(230, 228, 222, 0.3);
  text-underline-offset: 2px;
}
.lwf-wrap td a:hover { color: var(--red-lit); text-decoration-color: var(--red-lit); }

/* ─── Row posture — left edge + LED (set by JS classifier) ─ */
.lwf-table tbody tr { transition: background-color 0.15s; }
.lwf-table tbody tr td:first-child { border-left: 3px solid transparent; }
.lwf-table tbody tr[data-lwf-status="prevailed"] td:first-child { border-left-color: var(--green); }
.lwf-table tbody tr[data-lwf-status="pending"] td:first-child { border-left-color: var(--amber); }
.lwf-table tbody tr[data-lwf-status="dismissed"] td:first-child { border-left-color: var(--red); }
.lwf-table tbody tr[data-lwf-status="settled"] td:first-child { border-left-color: var(--blue); }
.lwf-table tbody tr[data-lwf-status="designation"] td:first-child { border-left-style: dashed; border-left-color: rgba(163, 113, 247, 0.65); }
.lwf-table tbody tr[data-lwf-status="other"] td:first-child { border-left-color: var(--line); }

/* Live dockets glow — the pending row is the one still moving */
.lwf-table tbody tr[data-lwf-status="pending"] {
  background: linear-gradient(90deg, rgba(232, 163, 61, 0.05), transparent 45%);
}

.lwf-table tbody tr td:first-child::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 0.55rem;
  vertical-align: 1px;
  background: var(--line);
}
.lwf-table tbody tr[data-lwf-status="prevailed"] td:first-child::before {
  background: var(--green);
  box-shadow: 0 0 6px rgba(63, 185, 80, 0.55);
}
.lwf-table tbody tr[data-lwf-status="pending"] td:first-child::before {
  background: var(--amber);
  box-shadow: 0 0 6px rgba(232, 163, 61, 0.5);
}
.lwf-table tbody tr[data-lwf-status="dismissed"] td:first-child::before {
  background: var(--red);
  box-shadow: 0 0 6px rgba(204, 0, 0, 0.6);
}
.lwf-table tbody tr[data-lwf-status="settled"] td:first-child::before {
  background: var(--blue);
  box-shadow: 0 0 6px rgba(88, 166, 255, 0.5);
}
.lwf-table tbody tr[data-lwf-status="designation"] td:first-child::before {
  background: transparent;
  border: 1px solid rgba(163, 113, 247, 0.75);
}

.lwf-table tbody tr.lwf-hidden { display: none; }

/* ─── Annotation rails — field notes hang off a hairline ─── */
.lwf-wrap > p:has(> strong:first-child) {
  border-left: 2px solid var(--line);
  padding: 0.1rem 0 0.1rem 0.95rem;
  margin: 1.2rem 0;
  font-size: 0.92rem;
  line-height: 1.65;
}
.lwf-wrap > p:has(> strong:first-child) > strong:first-child {
  display: block;
  margin-bottom: 0.2rem;
}

/* ─── Endmatter — bridges + standing sources as console tape */
.lwf-wrap h2.lwf-end ~ p { font-size: 0.86rem; color: var(--mut); }
.lwf-wrap h2.lwf-end ~ ul {
  list-style: none;
  margin: 0.9rem 0 2rem;
  padding: 0;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.6;
}
.lwf-wrap h2.lwf-end ~ ul li {
  position: relative;
  padding: 0.42rem 0 0.42rem 1.25rem;
  margin: 0;
  border-bottom: 1px solid rgba(42, 42, 51, 0.6);
}
.lwf-wrap h2.lwf-end ~ ul li:last-child { border-bottom: none; }
.lwf-wrap h2.lwf-end ~ ul li::before {
  content: "\2192";
  position: absolute;
  left: 0;
  color: var(--red-dim);
}

/* ─── Motion + small screens ─────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .lwf-bar { animation: none; }
  .lwf-chip, .lwf-seg, .lwf-table tbody tr { transition: none; }
}

@media (max-width: 768px) {
  .lwf-wrap table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .lwf-wrap > p:first-of-type { font-size: 1.1rem; }
  .lwf-wrap h2 { flex-wrap: wrap; }
  .lwf-console { padding: 0.85rem 0.9rem 0.95rem; }
  .lwf-console-readout { margin-left: 0; }
  .lwf-key { gap: 0.45rem 1rem; }
}
