*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ink:       #0f0e0c;
  --ink-70:    rgba(15,14,12,0.70);
  --ink-40:    rgba(15,14,12,0.40);
  --ink-12:    rgba(15,14,12,0.12);
  --ink-06:    rgba(15,14,12,0.06);
  --cream:     #f5f2eb;
  --paper:     #faf8f3;
  --favor:     #1a6b4a;
  --favor-bg:  #eaf4ef;
  --deny:      #b03a2e;
  --deny-bg:   #fcecea;
  --dismiss:   #8a6300;
  --dismiss-bg:#fdf6e3;
  --serif:     'Playfair Display', Georgia, serif;
  --body:      'Instrument Sans', system-ui, sans-serif;
  --mono:      'Courier Prime', 'Courier New', monospace;
  --nav-h:     60px;
  --col-max:   1320px;
  --radius:    4px;
  --radius-lg: 8px;
  --shadow-sm: 0 1px 4px rgba(0,0,0,.06);
}

html { scroll-behavior: smooth; }
body {
  background: var(--cream);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* NAV */
nav {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: var(--ink);
  display: flex; align-items: center;
  padding: 0 2rem;
  border-bottom: 3px solid #c09a3c;
}
.nav-inner {
  max-width: var(--col-max); width: 100%; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-brand { display: flex; flex-direction: column; line-height: 1; text-decoration: none; }
.nav-brand-main { font-family: var(--serif); font-size: 18px; font-weight: 700; color: #f5f2eb; letter-spacing: 0.01em; }
.nav-brand-sub { font-family: var(--mono); font-size: 9px; color: #c09a3c; letter-spacing: 0.14em; text-transform: uppercase; margin-top: 1px; }

.period-tabs { display: flex; gap: 2px; }
.period-tab {
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  padding: 6px 14px; border-radius: 2px;
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(245,242,235,0.55); background: transparent;
  cursor: pointer; transition: all .15s; letter-spacing: 0.04em;
}
.period-tab.active { background: #c09a3c; border-color: #c09a3c; color: var(--ink); }
.period-tab:hover:not(.active) { border-color: rgba(255,255,255,0.35); color: #f5f2eb; }

/* HERO */
.hero {
  background: var(--ink); border-bottom: 3px solid #c09a3c;
  padding: 0; position: relative; overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 39px, rgba(255,255,255,.03) 39px, rgba(255,255,255,.03) 40px),
    repeating-linear-gradient(90deg, transparent, transparent 79px, rgba(255,255,255,.03) 79px, rgba(255,255,255,.03) 80px);
  pointer-events: none;
}
.hero::after { content: ''; position: absolute; left:0;top:0;bottom:0; width:5px; background:linear-gradient(to bottom,#c09a3c,rgba(192,154,60,.2)); }
.hero-inner { max-width: var(--col-max); margin: 0 auto; padding: 3.5rem 2.5rem 3rem; position: relative; }
.hero-eyebrow { font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: #c09a3c; margin-bottom: 0.6rem; display: flex; align-items: center; gap: 10px; }
.hero-eyebrow::before { content:''; display:block; width:24px; height:1px; background:#c09a3c; opacity:.6; }
.hero-title { font-family: var(--serif); font-size: clamp(28px,3.5vw,44px); font-weight: 700; color: #f5f2eb; line-height: 1.1; letter-spacing: -0.02em; margin-bottom: 0.5rem; }
.hero-title em { font-style: italic; color: #c09a3c; }
.hero-sub { font-size: 13px; color: rgba(245,242,235,.45); margin-bottom: 2rem; }

.hero-stats { display: flex; gap: 0; flex-wrap: wrap; border: 1px solid rgba(255,255,255,0.1); border-radius: var(--radius-lg); overflow: hidden; max-width: 860px; }
.hero-stat { flex: 1 1 130px; padding: 1rem 1.25rem; border-right: 1px solid rgba(255,255,255,0.07); position: relative; transition: background .2s; }
.hero-stat:last-child { border-right: none; }
.hero-stat-label { font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(245,242,235,.35); margin-bottom: 5px; }
.hero-stat-value { font-family: var(--serif); font-size: 24px; font-weight: 700; color: #f5f2eb; line-height: 1; transition: all .3s; }
.hero-stat-value.green { color: #4db88c; }
.hero-stat-value.red   { color: #e07070; }
.hero-stat-value.gold  { color: #c09a3c; }
.hero-stat-delta { font-family: var(--mono); font-size: 10px; color: rgba(245,242,235,.3); margin-top: 3px; }
.hero-stat-trend { font-family: var(--mono); font-size: 10px; margin-top: 2px; }
.hero-stat-trend.up   { color: #4db88c; }
.hero-stat-trend.down { color: #e07070; }
.hero-stat-trend.flat { color: rgba(245,242,235,.3); }

/* period transition */
.changing { opacity: 0; transform: translateY(4px); }
.hero-stat-value, .hero-stat-delta, .hero-stat-trend { transition: opacity .25s, transform .25s; }

/* MAIN */
.page-body { max-width: var(--col-max); margin: 0 auto; padding: 2.5rem 2rem; display: grid; grid-template-columns: 1fr 310px; gap: 2rem; align-items: start; }

.section-rule { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.section-rule h2 { font-family: var(--serif); font-size: 18px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.section-rule::after { content: ''; flex: 1; height: 1px; background: var(--ink-12); }
.section-eyebrow { font-family: var(--mono); font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-40); margin-bottom: 0.35rem; }

/* TOOLBAR */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; padding: 0.7rem 1rem; background: var(--paper); border: 1px solid var(--ink-12); border-radius: var(--radius-lg); }
.search-wrap { position: relative; flex: 1 1 200px; }
.search-wrap input { width: 100%; font-family: var(--body); font-size: 13px; padding: 7px 12px 7px 30px; background: var(--cream); border: 1px solid var(--ink-12); border-radius: var(--radius); color: var(--ink); outline: none; transition: border-color .15s; }
.search-wrap input:focus { border-color: rgba(15,14,12,0.3); }
.search-icon { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 13px; height: 13px; color: var(--ink-40); pointer-events: none; }
.toolbar select { font-family: var(--body); font-size: 12px; padding: 7px 10px; background: var(--cream); border: 1px solid var(--ink-12); border-radius: var(--radius); color: var(--ink); cursor: pointer; outline: none; }
.toolbar-count { font-family: var(--mono); font-size: 11px; color: var(--ink-40); margin-left: auto; white-space: nowrap; }

/* TABLE */
.table-card { background: var(--paper); border: 1px solid var(--ink-12); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); margin-bottom: 2rem; }
table { width: 100%; border-collapse: collapse; }
thead { background: var(--ink); }
thead th { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(245,242,235,.55); padding: 10px 13px; text-align: left; cursor: pointer; user-select: none; white-space: nowrap; transition: color .12s; }
thead th:hover { color: #f5f2eb; }
thead th.sorted { color: #c09a3c; }
thead th .arr { opacity: 0.4; font-size: 8px; margin-left: 3px; }
thead th.sorted .arr { opacity: 1; }
tbody tr { border-bottom: 1px solid var(--ink-06); transition: background .1s; cursor: pointer; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(15,14,12,.025); }
tbody tr.active-row { background: #fdf6e3; border-left: 3px solid #c09a3c; }
td { padding: 10px 13px; font-size: 13px; vertical-align: middle; }
.td-judge { font-weight: 600; font-size: 13px; }
.td-office { font-family: var(--mono); font-size: 11px; color: var(--ink-70); }
.td-num { font-family: var(--mono); font-size: 12px; text-align: right; }
.td-pct { text-align: right; }
.pct-badge { display: inline-block; font-family: var(--mono); font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 2px; letter-spacing: 0.03em; }
.pct-favor  { background: var(--favor-bg); color: var(--favor); }
.pct-deny   { background: var(--deny-bg);  color: var(--deny); }
.pct-mid    { background: var(--dismiss-bg); color: var(--dismiss); }
.outcome-bar { display: flex; height: 5px; border-radius: 3px; overflow: hidden; gap: 1px; min-width: 80px; }
.ob-seg { height: 100%; border-radius: 1px; }
.td-days { font-family: var(--mono); font-size: 12px; color: var(--ink-70); text-align: right; }

/* DELTA ARROWS in table */
.delta { font-family: var(--mono); font-size: 10px; margin-left: 4px; }
.delta.up   { color: var(--favor); }
.delta.down { color: var(--deny); }

/* DETAIL DRAWER */
.detail-drawer { display: none; background: #fdf6e3; border-top: 2px solid #c09a3c; border-bottom: 1px solid var(--ink-12); }
.detail-drawer.open { display: table-row; }
.detail-inner { padding: 1.25rem 1.5rem; display: grid; grid-template-columns: 190px 1fr 190px; gap: 1.25rem; align-items: start; position: relative; }
.detail-bio h3 { font-family: var(--serif); font-size: 16px; font-weight: 700; line-height: 1.2; margin-bottom: 3px; }
.detail-bio .office-tag { font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-40); margin-bottom: 0.8rem; }
.detail-kv { font-size: 12px; }
.detail-kv-row { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--ink-06); }
.detail-kv-row:last-child { border-bottom: none; }
.detail-kv-row .k { color: var(--ink-70); }
.detail-kv-row .v { font-family: var(--mono); font-size: 11px; font-weight: 700; }
.detail-kv-row .v.g { color: var(--favor); }
.detail-kv-row .v.r { color: var(--deny); }
.detail-kv-row .v.a { color: var(--dismiss); }
.detail-chart-wrap { position: relative; height: 150px; }
.detail-legend { margin-top: 8px; }
.dl-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--ink-70); margin-bottom: 3px; }
.dl-swatch { width: 8px; height: 8px; border-radius: 1px; flex-shrink: 0; }
.detail-close { position: absolute; top: 10px; right: 10px; font-family: var(--mono); font-size: 10px; color: var(--ink-40); background: none; border: 1px solid var(--ink-12); border-radius: 2px; padding: 3px 8px; cursor: pointer; transition: all .12s; }
.detail-close:hover { color: var(--ink); border-color: var(--ink-40); }

/* SIDEBAR */
.sidebar { display: flex; flex-direction: column; gap: 1.25rem; }
.card { background: var(--paper); border: 1px solid var(--ink-12); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.card-head { padding: 11px 15px; border-bottom: 1px solid var(--ink-12); display: flex; justify-content: space-between; align-items: center; }
.card-head h3 { font-family: var(--serif); font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.card-head-tag { font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-40); }
.card-body { padding: 13px 15px; }

/* Period change indicator */
.period-indicator {
  display: inline-block; font-family: var(--mono); font-size: 10px;
  background: #c09a3c; color: var(--ink); padding: 2px 8px; border-radius: 2px;
  margin-left: 10px; font-weight: 700; letter-spacing: 0.06em;
  vertical-align: middle;
}

.office-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--ink-06); }
.office-row:last-child { border-bottom: none; }
.office-rank { font-family: var(--mono); font-size: 10px; color: var(--ink-40); width: 14px; text-align: center; }
.office-name { font-size: 12px; font-weight: 500; flex: 1; }
.office-bar-wrap { width: 70px; height: 5px; background: var(--ink-06); border-radius: 3px; }
.office-bar-fill { height: 100%; border-radius: 3px; background: var(--favor); transition: width .4s ease; }
.office-pct { font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--favor); width: 36px; text-align: right; }

.quartile-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--ink-06); font-size: 12px; }
.quartile-row:last-child { border-bottom: none; }
.q-label { width: 75px; color: var(--ink-70); font-size: 11px; }
.q-bar-wrap { flex: 1; height: 5px; background: var(--ink-06); border-radius: 3px; }
.q-bar-fill { height: 100%; border-radius: 3px; transition: width .4s ease; }
.q-count { font-family: var(--mono); font-size: 11px; font-weight: 700; width: 18px; text-align: right; }

.appeal-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--ink-06); font-size: 12px; }
.appeal-row:last-child { border-bottom: none; }
.appeal-name { flex: 1; font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appeal-val { font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--deny); }

/* CHART */
.chart-wrap { position: relative; width: 100%; }

/* FOOTNOTE */
.footnote { max-width: var(--col-max); margin: 0 auto; padding: 0 2rem 3rem; font-family: var(--mono); font-size: 10px; color: var(--ink-40); line-height: 1.8; letter-spacing: 0.02em; border-top: 1px solid var(--ink-12); padding-top: 1.25rem; }

/* ANIMATIONS */
@keyframes fadeUp { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }
.hero-inner > * { animation: fadeUp .5s ease both; }
.hero-inner > *:nth-child(1) { animation-delay:.05s }
.hero-inner > *:nth-child(2) { animation-delay:.12s }
.hero-inner > *:nth-child(3) { animation-delay:.18s }

@keyframes statPop {
  0%   { opacity:0; transform:translateY(6px); }
  100% { opacity:1; transform:translateY(0); }
}
.stat-animating { animation: statPop .3s ease both; }

@media(max-width:960px){
  .page-body { grid-template-columns: 1fr; }
  .sidebar { grid-row: 1; }
}
