/* ============================================================
   TX Judge Stats — judges.css
   Millennial-grey palette: warm greige surface, dusty slate blue accent.
   Loaded only on judge CPT pages and page templates.
   ============================================================ */

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

/* ── Typography ──────────────────────────────────────────────────────────── */

.judges-wrap {
  font-family: var(--font-body);
  background:  var(--surface);
  color:       var(--ink);
  font-size:   15px;
  line-height: 1.6;
}

/* ── Hero ────────────────────────────────────────────────────────────────── */

.judges-hero {
  background:    var(--ink);
  color:         #fff;
  padding:       4rem 2rem 3.5rem;
  text-align:    center;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.judges-hero__eyebrow {
  font-family:    var(--font-mono);
  font-size:      11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color:          var(--accent-light);
  margin-bottom:  1rem;
}

.judges-hero h1 {
  font-family:    var(--font-display);
  font-size:      clamp(2.2rem, 5vw, 3.8rem);
  line-height:    1.1;
  letter-spacing: -0.02em;
  margin-bottom:  1rem;
  color:          #fff;
}

.judges-hero h1 em {
  font-style: italic;
  color:       rgba(255,255,255,0.5);
}

.judges-hero p {
  color:         rgba(255,255,255,0.55);
  max-width:     520px;
  margin:        0 auto 2rem;
  font-size:     16px;
}

.judges-hero__stats {
  display:         flex;
  justify-content: center;
  gap:             3rem;
  flex-wrap:       wrap;
}

.judges-hero__stat-num {
  font-family:  var(--font-display);
  font-size:    2.2rem;
  color:        #fff;
  line-height:  1;
  display:      block;
}

.judges-hero__stat-label {
  font-size:      12px;
  color:          rgba(255,255,255,0.4);
  font-family:    var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top:     4px;
  display:        block;
}

/* ── Page wrapper ────────────────────────────────────────────────────────── */

.judges-page {
  max-width: 1200px;
  margin:    0 auto;
  padding:   2.5rem 2rem;
}

/* ── Section header ─────────────────────────────────────────────────────── */

.judges-section__header {
  display:         flex;
  align-items:     baseline;
  justify-content: space-between;
  margin-bottom:   1.5rem;
  padding-bottom:  0.75rem;
  border-bottom:   2px solid var(--ink);
}

.judges-section__title {
  font-family:    var(--font-display);
  font-size:      1.5rem;
  letter-spacing: -0.02em;
}

.judges-section__meta {
  font-size:   12px;
  color:       var(--ink-faint);
  font-family: var(--font-mono);
}

/* ── Filter bar ──────────────────────────────────────────────────────────── */

.judges-filters {
  display:     flex;
  gap:         8px;
  margin-bottom: 10px;
  flex-wrap:   wrap;
  align-items: center;
}

.judges-filters__label {
  font-size:      12px;
  font-family:    var(--font-mono);
  color:          var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-right:   4px;
}

.judges-filter-btn {
  padding:       5px 14px;
  border-radius: 20px;
  border:        1px solid var(--border);
  background:    var(--surface-card);
  color:         var(--ink-muted);
  font-size:     12px;
  font-family:   var(--font-body);
  font-weight:   500;
  cursor:        pointer;
  transition:    all 0.15s;
}

.judges-filter-btn:hover {
  border-color: var(--ink-muted);
  color:        var(--ink);
}

.judges-filter-btn.is-active {
  background:   var(--ink);
  color:        #fff;
  border-color: var(--ink);
}

/* ── Search ──────────────────────────────────────────────────────────────── */

.judges-search {
  position:   relative;
  margin-bottom: 1.5rem;
  max-width:  320px;
}

.judges-search__icon {
  position:   absolute;
  left:       10px;
  top:        50%;
  transform:  translateY(-50%);
  opacity:    0.4;
  pointer-events: none;
}

.judges-search input {
  width:         100%;
  padding:       8px 12px 8px 34px;
  border:        1px solid var(--border);
  border-radius: 6px;
  background:    var(--surface-card);
  color:         var(--ink);
  font-family:   var(--font-body);
  font-size:     13px;
  outline:       none;
  transition:    border-color 0.15s;
}

.judges-search input:focus { border-color: var(--accent); }
.judges-search input::placeholder { color: var(--ink-faint); }

/* ── Judge grid ──────────────────────────────────────────────────────────── */

.judges-grid {
  display:               grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap:                   1.25rem;
}

.judges-grid__empty {
  grid-column:  1 / -1;
  text-align:   center;
  color:        var(--ink-faint);
  font-family:  var(--font-mono);
  font-size:    13px;
  padding:      3rem 0;
}

/* ── Judge card ──────────────────────────────────────────────────────────── */

.judge-card {
  background:     var(--surface-card);
  border:         1px solid var(--border);
  border-radius:  10px;
  padding:        1.25rem;
  display:        flex;
  flex-direction: column;
  gap:            0;
  text-decoration: none;
  color:          inherit;
  transition:     border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.judge-card:hover {
  border-color: var(--ink);
  transform:    translateY(-2px);
  box-shadow:   0 6px 20px rgba(0,0,0,0.07);
  text-decoration: none;
  color:        inherit;
}

.judge-card__top {
  display:       flex;
  align-items:   flex-start;
  gap:           14px;
  margin-bottom: 1rem;
}

.judge-avatar {
  width:         48px;
  height:        48px;
  border-radius: 50%;
  display:       flex;
  align-items:   center;
  justify-content: center;
  font-family:   var(--font-display);
  font-size:     17px;
  flex-shrink:   0;
  color:         #fff;
  overflow:      hidden;
}

.judge-avatar img {
  width:       100%;
  height:      100%;
  object-fit:  cover;
}

.judge-card__info { flex: 1; min-width: 0; }

.judge-card__name {
  font-family:    var(--font-display);
  font-size:      1.1rem;
  letter-spacing: -0.01em;
  line-height:    1.2;
  margin-bottom:  2px;
}

.judge-card__court {
  font-size:     12px;
  color:         var(--ink-muted);
  white-space:   nowrap;
  overflow:      hidden;
  text-overflow: ellipsis;
}

.party-badge {
  font-size:   10px;
  font-family: var(--font-mono);
  font-weight: 500;
  padding:     2px 7px;
  border-radius: 3px;
  flex-shrink: 0;
  margin-top:  2px;
}

.party-badge--r { background: #f0e2e2; color: #8a1f1f; }
.party-badge--d { background: #e2eaf5; color: #1e3a7b; }
.party-badge--i { background: #eeedf0; color: #4a4a54; }

/* ── Ruling stats ────────────────────────────────────────────────────────── */

.judge-card__stats {
  display:               grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap:                   8px;
  margin-bottom:         1rem;
}

.judge-card__stat-label {
  font-size:      10px;
  font-family:    var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color:          var(--ink-faint);
  margin-bottom:  3px;
}

.judge-card__stat-val {
  font-size:   1.2rem;
  font-family: var(--font-display);
  line-height: 1;
}

.judge-card__stat-val--affirmed  { color: var(--green); }
.judge-card__stat-val--reversed  { color: var(--red); }
.judge-card__stat-val--rate      { color: var(--amber); }

/* ── Affirmance bar ──────────────────────────────────────────────────────── */

.judge-card__bar-label {
  font-size:      10px;
  font-family:    var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color:          var(--ink-faint);
  margin-bottom:  4px;
}

.bar-track {
  height:        5px;
  background:    var(--border);
  border-radius: 3px;
  overflow:      hidden;
  margin-bottom: 12px;
}

.bar-fill {
  height:        100%;
  border-radius: 3px;
  background:    var(--green);
  transition:    width 0.4s ease;
}

/* ── Area tags ───────────────────────────────────────────────────────────── */

.judge-card__tags {
  display:    flex;
  gap:        5px;
  flex-wrap:  wrap;
  margin-top: 4px;
}

.tag {
  font-size:      10px;
  font-family:    var(--font-mono);
  padding:        2px 7px;
  border-radius:  3px;
  font-weight:    500;
  letter-spacing: 0.04em;
}

.tag--criminal   { background: #dce8f5; color: var(--tag-criminal); }
.tag--civil      { background: #dff2e8; color: var(--tag-civil); }
.tag--family     { background: #f5dcf3; color: var(--tag-family); }
.tag--appeal     { background: #fceedd; color: var(--tag-appeal); }
.tag--election   { background: #f0e8fa; color: #5a2d87; }
.tag--immigration { background: #fdf5dc; color: #7a5a00; }

/* ── Card footer ─────────────────────────────────────────────────────────── */

.judge-card__footer {
  border-top:      1px solid var(--border);
  margin-top:      1rem;
  padding-top:     0.75rem;
  display:         flex;
  justify-content: space-between;
  align-items:     center;
}

.judge-card__election {
  font-size:   11px;
  color:       var(--ink-faint);
  font-family: var(--font-mono);
}

.judge-card__election strong { color: var(--accent); }

.judge-card__link {
  font-size:   12px;
  font-weight: 600;
  color:       var(--blue);
}

/* ── Data note ───────────────────────────────────────────────────────────── */

.judges-data-note {
  background:    var(--amber-bg);
  border:        1px solid #ddd0b0;
  border-radius: 8px;
  padding:       1rem 1.25rem;
  margin-bottom: 2rem;
  font-size:     13px;
  color:         var(--amber);
  display:       flex;
  gap:           10px;
  align-items:   flex-start;
}

/* ── Single judge — layout ───────────────────────────────────────────────── */

.judge-single {
  max-width: 860px;
  margin:    0 auto;
  padding:   2.5rem 2rem;
}

.judge-single__back {
  display:         inline-flex;
  align-items:     center;
  gap:             6px;
  font-size:       13px;
  font-weight:     500;
  color:           var(--ink-muted);
  text-decoration: none;
  margin-bottom:   1.5rem;
}

.judge-single__back:hover { color: var(--ink); }

/* ── Single judge — header ───────────────────────────────────────────────── */

.judge-single__header {
  background:    var(--ink);
  color:         #fff;
  padding:       1.75rem 2rem;
  border-radius: 12px 12px 0 0;
  display:       flex;
  gap:           16px;
  align-items:   flex-start;
  margin-bottom: 0;
}

.judge-single__avatar {
  width:         72px;
  height:        72px;
  border-radius: 50%;
  display:       flex;
  align-items:   center;
  justify-content: center;
  font-family:   var(--font-display);
  font-size:     24px;
  flex-shrink:   0;
  color:         #fff;
  overflow:      hidden;
}

.judge-single__avatar img {
  width:      100%;
  height:     100%;
  object-fit: cover;
}

.judge-single__title { flex: 1; }

.judge-single__name {
  font-family:    var(--font-display);
  font-size:      1.8rem;
  line-height:    1.15;
  margin-bottom:  4px;
}

.judge-single__sub {
  color:     rgba(255,255,255,0.55);
  font-size: 14px;
}

/* ── Single judge — body ─────────────────────────────────────────────────── */

.judge-single__body {
  background:    var(--surface-card);
  border:        1px solid var(--border);
  border-top:    none;
  border-radius: 0 0 12px 12px;
  padding:       1.75rem 2rem;
}

/* ── Credentials strip ───────────────────────────────────────────────────── */

.judge-single__creds {
  display:       flex;
  flex-wrap:     wrap;
  gap:           8px;
  margin-bottom: 1.25rem;
}

.cred-chip {
  font-size:     12px;
  padding:       4px 10px;
  border-radius: 5px;
  font-weight:   500;
}

.cred-chip--school  { background: var(--blue-bg);   color: var(--blue); }
.cred-chip--cert    { background: var(--green-bg);  color: var(--green); }
.cred-chip--bar     { background: var(--surface);   color: var(--ink-muted); border: 1px solid var(--border); }

/* ── Stat row ────────────────────────────────────────────────────────────── */

.judge-single__stats {
  display:               grid;
  grid-template-columns: repeat(4, 1fr);
  gap:                   12px;
  margin-bottom:         1.75rem;
}

.stat-box {
  background:    var(--surface);
  border-radius: 8px;
  padding:       12px;
  text-align:    center;
}

.stat-box__num {
  font-family:  var(--font-display);
  font-size:    1.5rem;
  line-height:  1;
  display:      block;
  margin-bottom: 4px;
}

.stat-box__label {
  font-size:      10px;
  font-family:    var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color:          var(--ink-faint);
}

/* ── Ruling distribution bar ─────────────────────────────────────────────── */

.ruling-dist { margin-bottom: 1.5rem; }

.ruling-dist__label {
  font-size:      10px;
  font-family:    var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color:          var(--ink-faint);
  margin-bottom:  6px;
}

.ruling-dist__bar {
  display:       flex;
  height:        10px;
  border-radius: 5px;
  overflow:      hidden;
  gap:           2px;
}

.ruling-dist__bar-seg { opacity: 0.85; }

.ruling-dist__legend {
  display:    flex;
  gap:        1rem;
  margin-top: 6px;
}

.ruling-dist__legend-item { font-size: 11px; }

/* ── Bar poll ────────────────────────────────────────────────────────────── */

.bar-poll {
  background:    var(--surface);
  border-radius: 8px;
  padding:       12px 14px;
  margin-bottom: 1.25rem;
  border-left:   3px solid var(--accent);
}

.bar-poll__header {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  margin-bottom:   6px;
}

.bar-poll__label {
  font-size:      10px;
  font-family:    var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color:          var(--ink-faint);
}

.bar-poll__body {
  display:     flex;
  align-items: center;
  gap:         12px;
}

.bar-poll__pct {
  font-family: var(--font-display);
  font-size:   1.8rem;
  color:       var(--accent);
}

.bar-poll__detail { font-size: 13px; color: var(--ink-muted); }
.bar-poll__detail small { font-size: 11px; color: var(--ink-faint); display: block; }

/* ── Judicial philosophy ─────────────────────────────────────────────────── */

.philosophy-block {
  background:    var(--amber-bg);
  border:        1px solid #ddd0b0;
  border-radius: 8px;
  padding:       12px 14px;
  margin-bottom: 1.25rem;
}

.philosophy-block__label {
  font-size:      10px;
  font-family:    var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color:          var(--amber);
  margin-bottom:  5px;
}

.philosophy-block p {
  font-size:   13px;
  color:       var(--ink);
  line-height: 1.6;
  font-style:  italic;
  margin:      0;
}

/* ── Section sub-heading ─────────────────────────────────────────────────── */

.judge-single__subheading {
  font-family:    var(--font-display);
  font-size:      1rem;
  letter-spacing: -0.01em;
  margin-bottom:  0.75rem;
  margin-top:     0;
}

/* ── Prior roles list ────────────────────────────────────────────────────── */

.prior-roles { list-style: none; padding: 0; margin: 0 0 1.25rem; display: flex; flex-direction: column; gap: 5px; }

.prior-roles li {
  font-size:   13px;
  color:       var(--ink-muted);
  padding-left: 14px;
  position:    relative;
}

.prior-roles li::before {
  content:   '›';
  position:  absolute;
  left:      0;
  color:     var(--accent);
}

/* ── Endorsement + honor chips ───────────────────────────────────────────── */

.chip-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 1.25rem; }

.chip {
  font-size:     12px;
  padding:       3px 9px;
  border-radius: 4px;
}

.chip--endorsement { background: var(--surface); border: 1px solid var(--border); color: var(--ink-muted); }
.chip--honor       { background: var(--amber-bg); border: 1px solid #ddd0b0;       color: var(--amber); }

/* ── Notable rulings table ───────────────────────────────────────────────── */

.rulings-table-wrap {
  overflow-x:    auto;
  margin-bottom: 1.5rem;
}

.rulings-table {
  width:           100%;
  border-collapse: collapse;
  font-size:       13px;
}

.rulings-table thead th {
  text-align:     left;
  font-size:      10px;
  font-family:    var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color:          var(--ink-faint);
  padding:        0 10px 8px;
  border-bottom:  1px solid var(--border);
}

.rulings-table tbody td {
  padding:        9px 10px;
  border-bottom:  1px solid var(--border);
  vertical-align: middle;
}

.rulings-table tbody tr:last-child td { border-bottom: none; }
.rulings-table tbody tr:hover td      { background: var(--surface); }

.rulings-table .col-year {
  color:       var(--ink-faint);
  font-family: var(--font-mono);
  font-size:   12px;
  white-space: nowrap;
}

.outcome-pill {
  display:      inline-block;
  font-size:    10px;
  font-family:  var(--font-mono);
  font-weight:  500;
  padding:      2px 8px;
  border-radius: 10px;
  white-space:  nowrap;
}

.outcome-pill--affirmed  { background: var(--green-bg); color: var(--green); }
.outcome-pill--reversed  { background: var(--red-bg);   color: var(--red); }
.outcome-pill--dismissed { background: var(--amber-bg); color: var(--amber); }
.outcome-pill--settled   { background: var(--blue-bg);  color: var(--blue); }

/* ── Election info grid ──────────────────────────────────────────────────── */

.election-grid {
  display:       grid;
  grid-template-columns: repeat(3, 1fr);
  gap:           12px;
  background:    var(--surface);
  border-radius: 8px;
  padding:       14px;
  margin-bottom: 1.5rem;
  font-size:     13px;
}

.election-grid__label {
  font-size:      10px;
  font-family:    var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color:          var(--ink-faint);
  display:        block;
  margin-bottom:  3px;
}

.election-grid__val { font-weight: 600; }
.election-grid__val--accent { color: var(--accent); }

/* ── External links ──────────────────────────────────────────────────────── */

.judge-single__links-title {
  font-size:      11px;
  font-family:    var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color:          var(--ink-faint);
  margin-bottom:  8px;
}

.judge-single__links {
  display:   flex;
  flex-wrap: wrap;
  gap:       8px;
}

.judge-single__ext-link {
  display:         flex;
  align-items:     center;
  gap:             6px;
  font-size:       12px;
  font-weight:     500;
  color:           var(--blue);
  text-decoration: none;
  background:      var(--blue-bg);
  padding:         5px 10px;
  border-radius:   5px;
}

.judge-single__ext-link:hover { text-decoration: underline; }

/* ── Leaderboard ─────────────────────────────────────────────────────────── */

.lb-table {
  width:           100%;
  border-collapse: collapse;
}

.lb-table thead th {
  font-size:      10px;
  font-family:    var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color:          var(--ink-faint);
  text-align:     left;
  padding:        0 12px 8px;
  border-bottom:  2px solid var(--ink);
}

.lb-table thead th:not(:first-child):not(:nth-child(2)):not(:nth-child(3)) {
  text-align: center;
}

.lb-table tbody tr {
  cursor:     pointer;
  transition: background 0.1s;
}

.lb-table tbody tr:hover td { background: var(--surface-hover); }

.lb-table tbody td {
  padding:       10px 12px;
  border-bottom: 1px solid var(--border);
  font-size:     13px;
}

.lb-table tbody td:not(:first-child):not(:nth-child(2)):not(:nth-child(3)) {
  text-align: center;
}

.lb-rank {
  font-family: var(--font-mono);
  color:       var(--ink-faint);
  font-size:   12px;
  width:       30px;
}

.lb-name {
  font-weight: 500;
  display:     flex;
  align-items: center;
  gap:         8px;
}

.mini-avatar {
  width:           30px;
  height:          30px;
  border-radius:   50%;
  display:         flex;
  align-items:     center;
  justify-content: center;
  font-size:       11px;
  font-family:     var(--font-display);
  color:           #fff;
  flex-shrink:     0;
  overflow:        hidden;
}

.mini-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ── Source cards ────────────────────────────────────────────────────────── */

.source-grid {
  display:               grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap:                   10px;
}

.source-card {
  border:         1px solid var(--border);
  border-radius:  8px;
  padding:        12px 14px;
  text-decoration: none;
  color:          var(--ink);
  transition:     all 0.15s;
  display:        block;
  background:     var(--surface-card);
}

.source-card:hover { border-color: var(--blue); background: var(--blue-bg); }

.source-card__title {
  font-size:     13px;
  font-weight:   600;
  margin-bottom: 3px;
  color:         var(--blue);
}

.source-card__desc {
  font-size: 11px;
  color:     var(--ink-faint);
}

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

@media (max-width: 680px) {
  .judges-grid                { grid-template-columns: 1fr; }
  .judge-single__stats        { grid-template-columns: repeat(2, 1fr); }
  .judge-card__stats          { grid-template-columns: 1fr 1fr; }
  .judges-hero__stats         { gap: 1.5rem; }
  .election-grid              { grid-template-columns: 1fr 1fr; }
  .judges-hero h1             { font-size: 2rem; }
}

@media (max-width: 420px) {
  .judges-hero__stats         { flex-direction: column; gap: 1rem; }
  .judge-single__header       { flex-direction: column; }
}
