/* Community Input Project Intelligence: shared tokens, shell, panels and chart primitives.
   Light is the default; dark follows the OS or the Settings choice (html[data-theme]). */

:root {
  --page: #f4f5f9;
  --surface: #ffffff;
  --ink: #020D39;
  --ink-2: #3d4566;
  --muted: #767d99;
  --hairline: #e3e6ef;
  --header: #020D39;
  --header-ink: #ffffff;
  --header-sub: #aab3d6;
  --accent: #FA4617;          /* orange: fills, focus, the "input" in the wordmark */
  --link: #c9370e;            /* orange stepped darker so text links clear 4.5:1 on white */
  --series-1: #2b47c4;        /* navy stepped lighter so a chart series clears the lightness band */
  --series-2: #FA4617;
  --band-opposed: #d73027;
  --band-neutral: #fee050;
  --band-supportive: #1a8448;
  --grid: #e8eaf2;
  --axis: #c5c9d8;
  --shadow: 0 1px 2px rgba(2, 13, 57, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #070c22; --surface: #0f1633; --ink: #eef0f8; --ink-2: #b9bfd8; --muted: #7f87a8; --hairline: #232b4d;
    --header: #020D39; --header-sub: #9aa5d0; --link: #ff8a5c; --series-1: #4f6de0; --series-2: #e8562c;
    --grid: #1c244a; --axis: #3a4370; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --page: #070c22; --surface: #0f1633; --ink: #eef0f8; --ink-2: #b9bfd8; --muted: #7f87a8; --hairline: #232b4d;
  --header: #020D39; --header-sub: #9aa5d0; --link: #ff8a5c; --series-1: #4f6de0; --series-2: #e8562c;
  --grid: #1c244a; --axis: #3a4370; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font: 400 14px/1.55 Poppins, system-ui, sans-serif; }
a { color: var(--link); }
b, strong { font-weight: 600; }
.mono, .num, td.num, .value, .tick, .axis { font-family: "Geist Mono", ui-monospace, monospace; }
td.num, .tick { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- header ---- */
header.top { background: var(--header); color: var(--header-ink); padding: 10px 24px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; border-bottom: 1px solid rgba(255,255,255,.08); }
header.top .mark .c { fill: #ffffff; }
.mark .c { fill: var(--ink); } /* navy on light, white on dark: the brand file has both versions */
.mark .i { fill: #FA4617; }
.lockup { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.lockup svg.mark { height: 38px; width: auto; flex: none; }
.lockup .wordmark { font-weight: 700; font-size: 19px; letter-spacing: -.01em; line-height: 1.1; }
.lockup .wordmark b { color: var(--accent); font-weight: 700; }
.lockup .tagline { font-style: italic; font-weight: 500; font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--header-sub); margin-top: 3px; }
.lockup .app { border-left: 1px solid rgba(255,255,255,.18); padding-left: 12px; margin-left: 2px; color: var(--header-sub); font-size: 12.5px; font-weight: 500; line-height: 1.2; }
.tabs { display: flex; gap: 4px; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { color: var(--header-sub); text-decoration: none; font-size: 13px; font-weight: 500; padding: 6px 14px; border-radius: 999px; white-space: nowrap; flex: none; }
.tabs a.active { background: rgba(255,255,255,.12); color: var(--header-ink); }
.tabs a:hover:not(.active) { background: rgba(255,255,255,.07); }
.gm-badge { display: inline-flex; flex: none; align-items: center; gap: 7px; color: var(--header-sub); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; text-decoration: none; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; padding: 5px 12px; white-space: nowrap; }
.gm-badge svg { height: 14px; width: 14px; }
.gm-badge b { color: #33cdb8; font-weight: 600; }
@media (max-width: 860px) {
  .lockup .app { display: none; }
  .tabs { order: 9; width: 100%; }
  .gm-badge { display: none; }
}

/* ---- filter bar ---- */
.filters { background: var(--surface); border-bottom: 1px solid var(--hairline); padding: 8px 24px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12.5px; }
.filters label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.filters select, .filters input { font: inherit; color: var(--ink); background: var(--page); border: 1px solid var(--hairline); border-radius: 8px; padding: 5px 8px; max-width: 200px; }
.filters .seg { display: inline-flex; border: 1px solid var(--hairline); border-radius: 999px; overflow: hidden; }
.filters .seg button { border: 0; background: transparent; color: var(--ink-2); font: inherit; font-weight: 500; padding: 5px 12px; cursor: pointer; }
.filters .seg button.active { background: var(--ink); color: var(--surface); }
.filters .clear { margin-left: auto; color: var(--link); background: none; border: 0; font: inherit; cursor: pointer; padding: 4px 6px; }
.filters .count { color: var(--muted); }

/* ---- layout ---- */
main { max-width: 1240px; margin: 0 auto; padding: 22px 24px 48px; }
main.narrow { max-width: 900px; }
h1 { font-weight: 700; font-size: 24px; letter-spacing: -.01em; margin: 0 0 4px; }
p.lede { color: var(--ink-2); margin: 0 0 20px; max-width: 64ch; }
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.cards { grid-template-columns: repeat(2, 1fr); margin-bottom: 16px; }
@media (min-width: 760px) { .cards { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1100px) { .cards.six { grid-template-columns: repeat(6, 1fr); } }
.cols { grid-template-columns: 1fr; align-items: start; }
@media (min-width: 980px) { .cols { grid-template-columns: 3fr 2fr; } .cols.even { grid-template-columns: 1fr 1fr; } }
.card, section.panel { background: var(--surface); border: 1px solid var(--hairline); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); }
.card .label { color: var(--ink-2); font-size: 12.5px; }
.card .value { font-size: 28px; font-weight: 500; line-height: 1.15; margin-top: 4px; }
.card .hint { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.card.hero .value { font-size: 44px; }
@media (min-width: 760px) { .card.hero { grid-column: span 2; } }
section.panel h2 { font-weight: 600; font-size: 16px; margin: 0 0 2px; text-wrap: balance; }
section.panel .note { color: var(--muted); font-size: 11.5px; margin: 0 0 12px; }
section.panel + section.panel { margin-top: 16px; }
.empty { color: var(--muted); font-size: 13px; padding: 10px 0; }

/* ---- band stacks (0-10 scale as opposed / neutral / supportive) ---- */
.scale-row { display: grid; grid-template-columns: minmax(120px, 190px) 1fr 44px 44px; gap: 10px; align-items: center; padding: 6px 0; cursor: pointer; border-radius: 6px; }
.scale-row:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.scale-row .name { font-size: 13px; }
.scale-row .mean { text-align: right; font-size: 13px; }
.scale-row .n { text-align: right; color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.stack { display: flex; height: 20px; border-radius: 4px; overflow: hidden; background: var(--grid); }
.stack .seg { position: relative; min-width: 0; display: flex; align-items: center; justify-content: center; font-family: "Geist Mono", monospace; font-size: 11px; font-weight: 500; color: #fff; }
.stack .seg + .seg { margin-left: 2px; }
.stack .seg.neutral { color: #1e241f; }
.hist { display: none; grid-column: 1 / -1; padding: 6px 0 10px; }
.scale-row.open + .hist { display: block; }
.hist svg { width: 100%; height: 88px; display: block; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; }
.legend .key { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend .sw.round { border-radius: 50%; }
@media (max-width: 560px) { .scale-row { grid-template-columns: 1fr 40px 56px; } .scale-row .stack { grid-column: 1 / -1; order: 9; } }

/* ---- horizontal bars ---- */
.hbars .row { display: grid; grid-template-columns: minmax(140px, 240px) 1fr 40px; gap: 10px; align-items: center; padding: 4px 0; }
.hbars .row .lbl { font-size: 12.5px; color: var(--ink-2); }
.hbars .row .bar { height: 14px; border-radius: 0 4px 4px 0; background: var(--series-1); min-width: 2px; }
.hbars .row .bar.s2 { background: var(--series-2); }
.hbars .row .val { text-align: right; font-size: 12.5px; }
@media (max-width: 560px) { .hbars .row { grid-template-columns: 1fr 40px; } .hbars .row .bar { grid-column: 1 / -1; } }

/* ---- pairs (two series per label) ---- */
.pairs .row { display: grid; grid-template-columns: minmax(120px, 190px) 1fr; gap: 10px; align-items: center; padding: 6px 0; }
.pairs .row .lbl { font-size: 13px; }
.pairs .track { display: grid; gap: 3px; }
.pairs .line { display: grid; grid-template-columns: 1fr 96px; gap: 8px; align-items: center; }
.pairs .line .bar { height: 10px; border-radius: 0 4px 4px 0; min-width: 2px; }
.pairs .line .bar.s1 { background: var(--series-1); }
.pairs .line .bar.s2 { background: var(--series-2); }
.pairs .line .val { font-size: 12px; color: var(--ink-2); white-space: nowrap; }

/* ---- svg charts ---- */
.chart svg { width: 100%; display: block; overflow: visible; }
.chart .col { fill: var(--series-1); }
.chart .col.s2 { fill: var(--series-2); }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart text { font-family: "Geist Mono", monospace; font-size: 10px; fill: var(--muted); }
.chart .hit { fill: transparent; }
.chart .hit:hover ~ .col, .chart g:hover .col { filter: brightness(1.12); }

/* ---- tables ---- */
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th { text-align: left; color: var(--ink-2); font-weight: 500; font-size: 12px; white-space: nowrap; }
th, td { padding: 7px 8px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
th.num, td.num { text-align: right; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--link); }
th.sorted::after { content: " \25BE"; }
th.sorted.asc::after { content: " \25B4"; }
tbody tr:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.scroll { overflow-x: auto; }
td .sub { color: var(--muted); font-size: 11.5px; }
.pill { display: inline-block; font-size: 11px; font-weight: 500; border-radius: 999px; padding: 1px 8px; background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink-2); }

/* ---- tooltip ---- */
#tip { position: fixed; pointer-events: none; background: var(--ink); color: var(--page); padding: 7px 10px; border-radius: 8px; font-size: 12px; opacity: 0; transition: opacity .08s; z-index: 10; max-width: 300px; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
#tip.open { opacity: 1; }
#tip .mono { font-size: 11.5px; }
@media (prefers-reduced-motion: reduce) { #tip { transition: none; } }

/* ---- buttons ---- */
button.primary { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer; }
button.primary:hover { filter: brightness(1.06); }
button.primary:disabled { opacity: .6; cursor: default; }
button.ghost { background: transparent; color: var(--ink-2); border: 1px solid var(--hairline); border-radius: 8px; padding: 8px 14px; font: inherit; font-weight: 500; cursor: pointer; }
button.ghost:hover { border-color: var(--accent); color: var(--link); }

footer.site { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 12px; margin-top: 28px; }
footer.site .gm { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-weight: 500; text-decoration: none; }
footer.site .gm svg { height: 13px; width: 13px; }

/* ---- band fills, column chart, sub-headings ---- */
.stack .seg.opposed { background: var(--band-opposed); }
.stack .seg.neutral { background: var(--band-neutral); }
.stack .seg.supportive { background: var(--band-supportive); }
.colchart { display: flex; align-items: flex-end; gap: 2px; border-bottom: 1px solid var(--axis); background: repeating-linear-gradient(to top, transparent 0 24%, var(--grid) 24% calc(24% + 1px)); }
.colchart .colwrap { flex: 1; height: 100%; display: flex; align-items: flex-end; min-width: 0; }
.colchart .col { width: 100%; max-width: 24px; margin: 0 auto; background: var(--series-1); border-radius: 4px 4px 0 0; position: relative; min-height: 1px; }
.colchart .col .inner { position: absolute; left: 0; right: 0; bottom: 0; background: var(--series-2); border-radius: 4px 4px 0 0; }
.colchart .colwrap:hover .col { filter: brightness(1.12); }
.colaxis { position: relative; height: 16px; margin-top: 4px; }
.colaxis span { position: absolute; top: 0; transform: translateX(-50%); font-family: "Geist Mono", monospace; font-size: 10px; color: var(--muted); white-space: nowrap; }
h3.sub-h { font-size: 12.5px; font-weight: 500; color: var(--ink-2); margin: 12px 0 4px; }
h3.sub-h:first-child { margin-top: 0; }
