/* Judy the Judge — a legal pad, a margin rule, and rubber stamps. */
:root {
  --pad: #f6e98c;
  --pad-deep: #efdc6a;
  --rule: #8bb8d9;
  --margin: #d2453b;
  --ink: #1c2541;
  --ink-soft: #46506f;
  --bench: #1f4d3a;
  --brass: #a8771f;
  --grey: #6e6a5a;
  --paper: #fffbe3;
  --line: 32px;
  --gutter: 96px;
  --display: "Libre Caslon Display", "Libre Caslon Text", Georgia, serif;
  --text: "Libre Caslon Text", Georgia, serif;
  --hand: "Caveat", "Bradley Hand", cursive;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background-color: var(--pad);
  background-image:
    linear-gradient(90deg, transparent calc(var(--gutter) - 2px), var(--margin) calc(var(--gutter) - 2px), var(--margin) var(--gutter), transparent var(--gutter)),
    repeating-linear-gradient(180deg, transparent 0, transparent calc(var(--line) - 1px), var(--rule) calc(var(--line) - 1px), var(--rule) var(--line));
  background-attachment: local;
  font-family: var(--text);
  font-size: 18px;
  line-height: var(--line);
  font-variant-numeric: lining-nums;
  min-height: 100vh;
}
a { color: var(--bench); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--margin);
  outline-offset: 2px;
}

.binding {
  background: var(--bench);
  color: var(--pad);
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px 0 var(--gutter);
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.18);
  position: relative;
}
.binding a { color: var(--pad); text-decoration: none; font-family: var(--display); font-size: 22px; }
.binding nav { display: flex; gap: 20px; font-size: 16px; }
.binding nav a { font-family: var(--text); font-size: 16px; opacity: 0.85; }
.binding nav a:hover { opacity: 1; text-decoration: underline; }

main { padding: var(--line) 24px calc(var(--line) * 3) calc(var(--gutter) + 24px); max-width: 1180px; }
section { margin-top: calc(var(--line) * 2); }

h1, h2, h3 { font-family: var(--display); font-weight: 400; margin: 0; }
h1 { font-size: clamp(56px, 9vw, 112px); line-height: calc(var(--line) * 3); letter-spacing: -0.01em; }
h2 { font-size: 40px; line-height: calc(var(--line) * 2); }
h3 { font-size: 24px; line-height: var(--line); }
p { margin: 0 0 var(--line); max-width: 68ch; }
.lede { font-size: 22px; max-width: 46ch; }

/* Margin notes: Judy's handwriting, hung in the red-ruled gutter on wide screens. */
.note {
  font-family: var(--hand);
  font-size: 24px;
  color: var(--margin);
  line-height: var(--line);
}
.margin-note {
  position: absolute;
  left: 8px;
  width: calc(var(--gutter) - 16px);
  text-align: right;
  font-family: var(--hand);
  font-size: 20px;
  color: var(--margin);
  line-height: 1.1;
  transform: rotate(-4deg);
}
.with-margin { position: relative; }
.with-margin > .margin-note { left: calc(-1 * var(--gutter) - 16px); }

/* Hero: the gavel strike. */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: center; margin-top: var(--line); }
.hero .gavel { width: 100%; max-width: 300px; overflow: visible; }
.hero .session { margin-top: var(--line); display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }

/* Stamps: the one place caps belong. */
.stamp {
  display: inline-block;
  font-family: var(--text);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 3px solid currentColor;
  border-radius: 6px;
  padding: 0 10px;
  line-height: 26px;
  font-size: 14px;
  transform: rotate(-3deg);
  mix-blend-mode: multiply;
  white-space: nowrap;
  opacity: 0.92;
}
.stamp.big { font-size: 34px; line-height: 52px; padding: 0 18px; border-width: 5px; transform: rotate(-6deg); }
.s-confirmed, .s-sound { color: var(--bench); }
.s-overturned, .s-unsound { color: var(--margin); }
.s-remanded, .s-undecided { color: var(--brass); }
.s-none, .s-pending { color: var(--grey); border-style: dashed; }

/* Buttons and fields: ink on paper. */
button, .button {
  font: inherit;
  font-size: 17px;
  color: var(--paper);
  background: var(--ink);
  border: 0;
  border-radius: 4px;
  padding: 0 18px;
  height: 44px;
  line-height: 44px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover, .button:hover { background: var(--bench); }
button.quiet { background: transparent; color: var(--ink); border: 2px solid var(--ink); line-height: 40px; }
button.quiet:hover { background: var(--ink); color: var(--paper); }
button[disabled] { opacity: 0.5; cursor: wait; }
label { display: block; font-size: 16px; color: var(--ink-soft); }
input, textarea, select {
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 4px;
  padding: 6px 10px;
  width: 100%;
  margin-top: 4px;
}
textarea { min-height: 160px; line-height: 26px; resize: vertical; }
.field { margin-bottom: calc(var(--line) / 2); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* The bench: leaderboard as a docket ledger. */
.ledger { width: 100%; border-collapse: collapse; margin-top: var(--line); }
.ledger th { text-align: left; font-weight: 400; color: var(--ink-soft); font-size: 15px; padding: 0 8px; height: var(--line); }
.ledger td { padding: 0 8px; height: calc(var(--line) * 2); vertical-align: middle; border-top: 1px solid var(--rule); }
.ledger tr:hover td { background: rgba(255, 251, 227, 0.55); }
.ledger .rank { font-family: var(--display); font-size: 28px; width: 48px; }
.ledger .score { font-family: var(--display); font-size: 30px; text-align: right; width: 90px; font-variant-numeric: tabular-nums lining-nums; }
.ledger .who b { font-weight: 700; display: block; line-height: 24px; }
.ledger .who span { font-size: 14px; color: var(--ink-soft); line-height: 20px; }
.charges { display: grid; grid-template-columns: repeat(6, 28px); gap: 6px; align-items: end; height: 40px; }
.charges i { display: block; background: var(--ink); border-radius: 2px 2px 0 0; min-height: 2px; position: relative; }
.charges i.null { background: transparent; border: 1px dashed var(--grey); height: 40px; }
.empty { font-family: var(--hand); font-size: 26px; color: var(--ink-soft); padding: var(--line) 0; }

/* Charges list: statutes. */
.statutes { list-style: none; padding: 0; margin: var(--line) 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 32px; }
.statutes li { padding: calc(var(--line) / 2) 0; border-top: 1px solid var(--rule); }
.statutes .sec { font-family: var(--display); font-size: 22px; }
.statutes .weight { float: right; font-family: var(--display); font-size: 22px; color: var(--ink-soft); }
.statutes p { font-size: 16px; line-height: 24px; margin: 4px 0 0; }

.tabs { display: inline-flex; border: 2px solid var(--ink); border-radius: 4px; overflow: hidden; margin-bottom: calc(var(--line) / 2); }
.tabs button { border-radius: 0; background: transparent; color: var(--ink); height: 40px; line-height: 40px; }
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); }

.file-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 32px; margin-top: var(--line); }
pre.exhibit {
  background: var(--paper);
  border-left: 4px solid var(--bench);
  padding: 12px 16px;
  margin: 0 0 var(--line);
  overflow-x: auto;
  font-size: 14px;
  line-height: 22px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.status { font-family: var(--hand); font-size: 24px; color: var(--margin); min-height: var(--line); }

.self-check { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; margin-top: var(--line); }
.self-check .fig { font-family: var(--display); font-size: 48px; line-height: calc(var(--line) * 2); }
.self-check .cap { font-size: 16px; color: var(--ink-soft); line-height: 24px; }

/* Trial page */
.trial-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.progress { height: 6px; background: rgba(28, 37, 65, 0.12); border-radius: 3px; margin: var(--line) 0; overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--ink); }
.verdict-panel { display: none; grid-template-columns: auto 1fr; gap: 32px; align-items: center; background: var(--paper); border: 2px solid var(--ink); border-radius: 6px; padding: 24px; margin: var(--line) 0; }
.verdict-panel.on { display: grid; }
.verdict-panel .total { font-family: var(--display); font-size: 96px; line-height: 96px; font-variant-numeric: tabular-nums lining-nums; }
.verdict-panel .total small { font-size: 28px; color: var(--ink-soft); }
.charge-bars { display: grid; gap: 6px; margin-top: 12px; }
.charge-bars div { display: grid; grid-template-columns: 200px 1fr 56px; gap: 12px; align-items: center; font-size: 15px; line-height: 22px; }
.charge-bars span.bar { height: 10px; background: rgba(28, 37, 65, 0.12); border-radius: 5px; overflow: hidden; }
.charge-bars span.bar > i { display: block; height: 100%; background: var(--ink); width: 0; }
.charge-bars b { text-align: right; font-weight: 400; font-variant-numeric: tabular-nums; }
.flags { margin: 12px 0 0; padding: 0; list-style: none; }
.flags li { font-family: var(--hand); font-size: 22px; color: var(--margin); line-height: 26px; }

.probe-group { margin-top: calc(var(--line) * 1.5); }
.probe-group > p { font-size: 16px; color: var(--ink-soft); }
.hearing {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--rule);
  line-height: 24px;
}
.hearing .task { font-size: 16px; color: var(--ink-soft); }
.hearing .cand { font-size: 17px; white-space: pre-wrap; word-break: break-word; }
.hearing .cand::before { content: "\201C"; }
.hearing .cand::after { content: "\201D"; }
.hearing .said { margin-top: 6px; font-size: 16px; }
.hearing .said .v { font-weight: 700; }
.hearing .said .ok { color: var(--bench); }
.hearing .said .bad { color: var(--margin); }
.hearing .reason { font-family: var(--hand); font-size: 21px; color: var(--ink); line-height: 24px; }
.hearing .side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.hearing .appeal { display: flex; gap: 6px; }
.hearing .appeal button { height: 30px; line-height: 26px; font-size: 13px; padding: 0 8px; }
.hearing .err { color: var(--margin); font-size: 14px; }

.fine { font-size: 14px; color: var(--ink-soft); line-height: 22px; }
footer { padding: var(--line) 24px var(--line) calc(var(--gutter) + 24px); font-size: 15px; color: var(--ink-soft); }

@media (max-width: 860px) {
  :root { --gutter: 28px; }
  main { padding-left: calc(var(--gutter) + 16px); padding-right: 16px; }
  .binding { padding-left: calc(var(--gutter) + 16px); padding-right: 16px; }
  .binding nav { display: none; }
  .hero { grid-template-columns: 1fr; }
  .hero .gavel { max-width: 200px; order: -1; }
  .margin-note, .with-margin > .margin-note { position: static; transform: none; text-align: left; width: auto; display: block; }
  .file-grid, .row { grid-template-columns: 1fr; }
  .ledger .charges, .ledger th.c { display: none; }
  .hearing { grid-template-columns: 1fr; }
  .hearing .side { align-items: flex-start; }
  .verdict-panel { grid-template-columns: 1fr; }
  .charge-bars div { grid-template-columns: 120px 1fr 48px; }
  footer { padding-left: calc(var(--gutter) + 16px); }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
