/* ==========================================================================
   Debate index (homepage) — layered ON TOP of engine/template/style.css.
   That file owns every colour token and all 14 themes; this file adds only
   the index grid. Never declare a literal colour here: use the tokens, or a
   theme will break. rem-only font sizes, same rule as the template.
   ========================================================================== */

/* ---- Banner ----------------------------------------------------------- */
.banner { position: relative; display: block; margin: 0 0 1rem; }
.banner img {
  display: block; width: 100%; height: auto; max-height: 13rem;
  object-fit: cover; object-position: center 62%;
  border-radius: .6rem; border: 1px solid var(--border);
}
.banner::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 2.5rem;
  background: linear-gradient(to bottom, transparent, var(--bg));
  border-radius: 0 0 .6rem .6rem; pointer-events: none;
}

/* ---- Head + filters --------------------------------------------------- */
.index-head h1 { font-size: 2rem; margin: .2rem 0; }
.index-head .lede { color: var(--muted); font-size: 1.05rem; margin: .2rem 0 1rem; }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: 0 0 1rem; }
.filters button {
  font-family: inherit; font-size: .78rem; cursor: pointer; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 1rem;
  padding: .25rem .7rem;
}
.filters button:hover { border-color: var(--link); }
.filters button[aria-pressed="true"] { background: var(--surface-2); border-color: var(--link); font-weight: 700; }
.filters input {
  font-family: inherit; font-size: .82rem; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: .4rem; padding: .3rem .6rem; min-width: 12rem;
  margin-left: auto;
}
.filters input:focus { outline: none; border-color: var(--link); }

/* ---- Card grid -------------------------------------------------------- */
.debate-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(24rem, 1fr)); gap: 1rem; }
.debate-card {
  display: flex; flex-direction: column; gap: .5rem;
  background: var(--surface); border: 1px solid var(--border); border-left: .28rem solid var(--border);
  border-radius: .6rem; padding: .9rem 1rem; color: inherit; text-decoration: none;
}
a.debate-card:hover { border-color: var(--link); text-decoration: none; box-shadow: 0 0 0 .12rem var(--glow); }
.debate-card.is-unpublished { opacity: .92; border-left-style: dashed; }
.debate-card.state-active { border-left-color: var(--aff); }
.debate-card.state-archived { border-left-color: var(--muted); }
.debate-card.state-paused { border-left-color: var(--flag); }

.card-top { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.card-topic { font-size: 1.2rem; font-weight: 700; margin: 0; flex: 1 1 12rem; }
.state-chip {
  font-size: .66rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  border: 1px solid currentColor; border-radius: .9rem; padding: .1rem .5rem; white-space: nowrap;
}
.state-chip.s-active { color: var(--cat-science); }
.state-chip.s-published { color: var(--cat-scholar); }
.state-chip.s-paused { color: var(--flag); }
.state-chip.s-archived { color: var(--muted); }
.round-chip { font-size: .7rem; color: var(--muted); }

.card-res { font-style: italic; font-size: .88rem; margin: 0; color: var(--text);
            border-left: .18rem solid var(--border); padding-left: .55rem; text-align: left; }
.card-desc { font-size: .85rem; color: var(--muted); margin: 0; text-align: left; }

/* ---- Mini score bar --------------------------------------------------- */
.mini-score { display: flex; align-items: center; gap: .5rem; }
.mini-score .ms-num { font-size: .95rem; font-weight: 700; min-width: 2.8rem; text-align: center; }
.mini-score .ms-aff { color: var(--aff); }
.mini-score .ms-neg { color: var(--neg); }
.mini-bar { flex: 1; display: flex; height: .6rem; border-radius: .3rem; overflow: hidden; border: 1px solid var(--border); }
.mini-bar .b-aff { background: var(--aff); }
.mini-bar .b-neg { background: var(--neg); }
.pending { font-size: .82rem; color: var(--muted); font-style: italic; }

/* ---- Deliberation row ------------------------------------------------- */
.delib { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; font-size: .8rem; color: var(--muted); }
.delib b { color: var(--text); font-weight: 700; }
.depth-chip {
  font-size: .66rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  border: 1px solid currentColor; border-radius: .9rem; padding: .1rem .5rem; white-space: nowrap;
  color: var(--flag);
}
.depth-chip.d-met { color: var(--cat-science); }

.card-foot { display: flex; flex-wrap: wrap; gap: .3rem .8rem; font-size: .76rem; color: var(--muted);
             border-top: 1px solid var(--border); padding-top: .45rem; margin-top: auto; }

.empty { color: var(--muted); font-style: italic; padding: 2rem 0; }
.index-foot { color: var(--muted); font-size: .85rem; margin: 2rem 0 3rem; text-align: center; }

@media (max-width: 52rem) {
  .banner img { max-height: 7rem; object-position: center 70%; }
  .debate-grid { grid-template-columns: 1fr; }
  .filters input { margin-left: 0; width: 100%; }
}

/* Per-point average beside the sum: a bare total rewards volume, so never show it alone
   (engine invariant — see verdict.standing). Absent on debates published before it existed. */
.per-point { font-size: .78rem; color: var(--muted); margin: -.2rem 0 0; text-align: left; }
.per-point b { font-size: .85rem; }

/* ---- Category sections (CATEGORIES_SPEC.md) --------------------------- */
/* Operator feedback 2026-08-20: a chevron alone didn't read as a distinct container. Each
   section now gets its own tinted background + a real accent-colored frame + lift, so it
   reads as a container at a glance, not just a collapsible list item. color-mix() keeps
   this theme-safe (never a literal colour -- every one of the 14 themes tints itself off
   its own --link, so this never needs a per-theme value). */
.cat-section {
  background: color-mix(in srgb, var(--link) 13%, var(--surface));
  border: .12rem solid color-mix(in srgb, var(--link) 42%, var(--border));
  border-radius: .8rem; margin: 0 0 1.1rem; overflow: hidden; scroll-margin-top: 1rem;
  box-shadow: 0 .15rem .55rem color-mix(in srgb, var(--link) 16%, transparent);
}
/* Collapsed must never read as "empty" or go unnoticed: dashed + de-tinted (still visibly
   part of the same family of boxes, just visibly "closed"), plus an explicit "N hidden"
   line rendered right in the header (not just the chevron). */
.cat-section:not([open]) {
  border-style: dashed;
  background: color-mix(in srgb, var(--link) 5%, var(--surface-2));
  box-shadow: none;
}

.cat-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .7rem; cursor: pointer;
  list-style: none; padding: .9rem 1.1rem; user-select: none;
}
.cat-head::-webkit-details-marker { display: none; }
.cat-chev {
  flex: none; width: 0; height: 0; margin-top: .2rem;
  border-left: .4rem solid transparent; border-right: .4rem solid transparent;
  border-top: .55rem solid var(--link); transition: transform .15s ease;
}
.cat-section[open] > .cat-head .cat-chev { transform: rotate(180deg); }
/* Same display font as the page's own <h1> (index.php loads Gabriela already; nothing
   extra to fetch here) -- titles are the strongest signal a container carries, so they
   read as headings in their own right, not list-item labels. */
.cat-name {
  font-family: 'Gabriela', serif; font-size: 1.7rem; font-weight: 700;
  letter-spacing: .01em; color: var(--text);
}
.cat-count { font-size: .8rem; color: var(--muted); white-space: nowrap; margin-left: auto; }
.cat-action {
  font-size: .74rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--link); white-space: nowrap;
}
.cat-action-open, .cat-action-closed { display: none; }
.cat-section[open] > .cat-head .cat-action-open { display: inline; }
.cat-section:not([open]) > .cat-head .cat-action-closed { display: inline; }
.cat-hidden-line { display: none; flex-basis: 100%; font-size: .8rem; color: var(--muted); }
.cat-section:not([open]) > .cat-head .cat-hidden-line { display: block; }

.cat-blurb { color: var(--muted); font-size: .85rem; margin: -.3rem 1.1rem .8rem; text-align: left; }
/* A container containing containers: the body sits in its own inset panel, closer to --bg
   than the bold outer frame, so the individual debate cards read as boxes nested one level
   further inside the category's box -- not just a flat list under a coloured header. */
.cat-body {
  background: color-mix(in srgb, var(--bg) 55%, var(--surface));
  margin: 0 .7rem .7rem; padding: 1rem .9rem; border-radius: .55rem;
  border: 1px solid color-mix(in srgb, var(--link) 12%, var(--border));
}
.cat-body .debate-grid { margin: 0 0 1rem; }
.cat-body .debate-grid:last-child { margin-bottom: 0; }
/* Operator feedback 2026-08-20: inside a category, every card was the same flat --surface,
   so a run of debates read as one undifferentiated block. Zebra-tint every other card, just
   off --link like the section framing above -- close enough to --surface to stay calm, far
   enough to separate one card from its neighbour at a glance. Scoped to .cat-body so the
   cards outside any category (there are none left, but belt-and-suspenders) stay plain. */
.cat-body .debate-card:nth-child(even) {
  background: color-mix(in srgb, var(--link) 7%, var(--surface));
}
.subcat-head {
  font-size: .92rem; font-weight: 700; color: var(--muted); text-transform: uppercase;
  letter-spacing: .03em; margin: 0 0 .5rem; scroll-margin-top: 1rem;
}
