/* ============================================================
   Two themes. Every colour is defined exactly once in the raw
   palettes below, then mapped to a role. The mapping repeats for
   the two ways dark switches on (OS preference, explicit toggle)
   — but the hexes never repeat, so the themes cannot drift apart.
   ============================================================ */

:root {
  /* ---- raw palette: light ---- */
  --l-bg:        #ffffff;
  --l-surface:   #ffffff;
  --l-hover:     #f6f8fc;
  --l-line:      #e6e9ef;
  --l-line-soft: #eff1f5;
  --l-ink:       #1f2328;
  --l-ink-2:     #5f6570;
  --l-ink-3:     #8b919b;
  --l-blue:      #2a6df4;
  --l-red:       #e8453c;
  --l-yellow:    #f5b32b;
  --l-green:     #17a463;
  /* Chip text sits on a tinted background, so it needs to be darker than the
     brand green/red above to clear WCAG AA at 11.5px. Verified 4.5:1+. */
  --l-long:      #117d4b;
  --l-long-bg:   #e8f6ee;
  --l-short:     #c63527;
  --l-short-bg:  #fdecea;
  --l-flat:      #7f858e;
  --l-flat-bg:   #f1f3f6;
  --l-on-accent: #ffffff;
  --l-edge:      #d4d9e2;
  --l-shadow:    0 1px 2px rgba(16,24,40,.06), 0 8px 24px rgba(16,24,40,.08);

  /* ---- raw palette: dark ----
     Not pure black: a soft cool neutral reads better over long spells and
     lets the card surface sit visibly above the page background. */
  --d-bg:        #0f1216;
  --d-surface:   #161a20;
  --d-hover:     #1e232b;
  --d-line:      #2a3039;
  --d-line-soft: #212630;
  --d-ink:       #e9edf3;
  --d-ink-2:     #a7b0bd;
  --d-ink-3:     #79828f;
  --d-blue:      #6c9dff;
  --d-red:       #ff7a6b;
  --d-yellow:    #f7c04a;
  --d-green:     #45c78a;
  --d-long:      #45c78a;
  --d-long-bg:   #123021;
  --d-short:     #ff7a6b;
  --d-short-bg:  #351a15;
  --d-flat:      #79828f;
  --d-flat-bg:   #232830;
  --d-on-accent: #0f1216;   /* dark text on dark-mode's lighter blue */
  --d-edge:      #3a414b;
  --d-shadow:    0 1px 2px rgba(0,0,0,.5), 0 10px 30px rgba(0,0,0,.42);

  /* ---- role mapping: light is the default ---- */
  --bg: var(--l-bg);
  --surface: var(--l-surface);
  --hover: var(--l-hover);
  --line: var(--l-line);
  --line-soft: var(--l-line-soft);
  --ink: var(--l-ink);
  --ink-2: var(--l-ink-2);
  --ink-3: var(--l-ink-3);
  --c-blue: var(--l-blue);
  --c-red: var(--l-red);
  --c-yellow: var(--l-yellow);
  --c-green: var(--l-green);
  --long: var(--l-long);
  --long-bg: var(--l-long-bg);
  --short: var(--l-short);
  --short-bg: var(--l-short-bg);
  --flat: var(--l-flat);
  --flat-bg: var(--l-flat-bg);
  --on-accent: var(--l-on-accent);
  --edge: var(--l-edge);
  --shadow: var(--l-shadow);

  --r: 14px;
}

/* Dark via OS preference — unless the visitor explicitly chose light. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: var(--d-bg);
    --surface: var(--d-surface);
    --hover: var(--d-hover);
    --line: var(--d-line);
    --line-soft: var(--d-line-soft);
    --ink: var(--d-ink);
    --ink-2: var(--d-ink-2);
    --ink-3: var(--d-ink-3);
    --c-blue: var(--d-blue);
    --c-red: var(--d-red);
    --c-yellow: var(--d-yellow);
    --c-green: var(--d-green);
    --long: var(--d-long);
    --long-bg: var(--d-long-bg);
    --short: var(--d-short);
    --short-bg: var(--d-short-bg);
    --flat: var(--d-flat);
    --flat-bg: var(--d-flat-bg);
    --on-accent: var(--d-on-accent);
    --edge: var(--d-edge);
    --shadow: var(--d-shadow);
  }
}

/* Dark via explicit toggle — wins over OS preference in both directions. */
:root[data-theme="dark"] {
  --bg: var(--d-bg);
  --surface: var(--d-surface);
  --hover: var(--d-hover);
  --line: var(--d-line);
  --line-soft: var(--d-line-soft);
  --ink: var(--d-ink);
  --ink-2: var(--d-ink-2);
  --ink-3: var(--d-ink-3);
  --c-blue: var(--d-blue);
  --c-red: var(--d-red);
  --c-yellow: var(--d-yellow);
  --c-green: var(--d-green);
  --long: var(--d-long);
  --long-bg: var(--d-long-bg);
  --short: var(--d-short);
  --short-bg: var(--d-short-bg);
  --flat: var(--d-flat);
  --flat-bg: var(--d-flat-bg);
  --on-accent: var(--d-on-accent);
  --edge: var(--d-edge);
  --shadow: var(--d-shadow);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.65 "Helvetica Neue", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 760px; margin: 0 auto; padding: 0 24px; }

/* ---------- top ---------- */

.top { padding: 26px 0 0; }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.logo {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.6px;
  text-decoration: none;
  color: var(--ink);
}
.logo .dot { color: var(--c-blue); }

.top-right { display: flex; align-items: center; gap: 14px; }
.today { font-size: 13px; color: var(--ink-3); white-space: nowrap; }

.theme-toggle {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  flex: none;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.theme-toggle:hover { background: var(--hover); color: var(--ink); border-color: var(--edge); }
.theme-toggle:focus-visible { outline: 2px solid var(--c-blue); outline-offset: 2px; }
.theme-toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.theme-toggle .icon-moon { fill: currentColor; stroke: none; }

/* Show the icon for the theme you would switch TO. */
.icon-moon { display: block; }
.icon-sun  { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-moon { display: none; }
  :root:not([data-theme="light"]) .icon-sun  { display: block; }
}
:root[data-theme="dark"] .icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun  { display: block; }
:root[data-theme="light"] .icon-moon { display: block; }
:root[data-theme="light"] .icon-sun  { display: none; }

.lede {
  margin: 30px 0 24px;
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink-2);
}

.loading { color: var(--ink-3); padding: 30px 0; }
.loading.error { color: var(--short); }

/* ---------- collapsed list ---------- */

.list { display: flex; flex-direction: column; gap: 10px; padding-bottom: 8px; }

.q {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.q:hover { border-color: var(--edge); }

.q[data-open="true"] {
  border-color: transparent;
  box-shadow: var(--shadow);
}

.q-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
  background: none;
  border: 0;
  border-radius: var(--r);
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.q-head:hover { background: var(--hover); }
.q-head:focus-visible { outline: 2px solid var(--c-blue); outline-offset: -2px; }

.q-main { flex: 1; min-width: 0; }

.q-cat {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 7px;
}
.q-cat::before {
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--cat, var(--c-blue));
}

.q-title {
  display: block;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.2px;
}

.q-side { display: flex; align-items: center; gap: 14px; flex: none; }
.q-odds { font-size: 13px; color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }

.chev {
  width: 20px; height: 20px; flex: none;
  color: var(--ink-3);
  transition: transform .2s ease;
}
.q[data-open="true"] .chev { transform: rotate(180deg); }

/* ---------- expanding body ---------- */

.q-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .24s ease;
}
.q[data-open="true"] .q-body { grid-template-rows: 1fr; }
.q-body > .q-inner { overflow: hidden; }

.q-section { padding: 0 22px 22px; }
.q-section + .q-section { border-top: 1px solid var(--line-soft); padding-top: 20px; }

.q-label {
  font-size: 11.5px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 10px;
  font-weight: 500;
}

.q-when { font-size: 13px; color: var(--ink-3); margin: 0 0 14px; }
.state { margin: 0; color: var(--ink-2); font-size: 15px; }

/* ---------- consensus ---------- */

.bar {
  height: 8px;
  border-radius: 99px;
  background: var(--flat-bg);
  overflow: hidden;
  margin-bottom: 10px;
}
.bar > i { display: block; height: 100%; background: var(--c-blue); border-radius: 99px; }
.bar-label { font-size: 14px; color: var(--ink-2); margin: 0 0 14px; }
.bar-label b { color: var(--ink); font-weight: 600; }
.disagree { margin: 0; font-size: 15px; color: var(--ink-2); }

/* ---------- sides ---------- */

.picker { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.pick {
  flex: 1 1 180px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--surface);
  font: inherit;
  font-size: 14.5px;
  color: var(--ink-2);
  cursor: pointer;
  transition: all .14s ease;
}
.pick:hover { background: var(--hover); }
.pick[aria-pressed="true"] {
  background: var(--c-blue);
  border-color: var(--c-blue);
  color: var(--on-accent);
  font-weight: 500;
}

.thesis { margin: 0 0 18px; font-size: 15px; color: var(--ink-2); }

.rows { display: flex; flex-direction: column; }
.row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 13px 0;
  border-top: 1px solid var(--line-soft);
}
.row:first-child { border-top: 0; }

.pos {
  flex: none;
  width: 62px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 3px 0;
  text-align: center;
  border-radius: 5px;
}
.pos-long { background: var(--long-bg); color: var(--long); }
.pos-short { background: var(--short-bg); color: var(--short); }
.pos-neutral { background: var(--flat-bg); color: var(--flat); }

.row-main { flex: 1; min-width: 0; }
.sym { font-weight: 600; font-size: 15px; }
.iname { color: var(--ink-3); font-weight: 400; font-size: 14px; }
.why { display: block; color: var(--ink-2); font-size: 14px; margin-top: 2px; }

.caveat {
  margin: 16px 0 0;
  padding: 13px 15px;
  background: var(--hover);
  border-radius: 10px;
  font-size: 14px;
  color: var(--ink-2);
}
.caveat b { color: var(--ink); font-weight: 600; }

/* ---------- sources ---------- */

details.sources { border-top: 1px solid var(--line-soft); }
details.sources > summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 22px;
  font-size: 13.5px;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 8px;
}
details.sources > summary::-webkit-details-marker { display: none; }
details.sources > summary::after {
  content: "";
  width: 6px; height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  margin-left: 2px;
  opacity: .6;
}
details.sources[open] > summary::after { transform: rotate(-135deg); }
details.sources > summary:hover { color: var(--ink); }

.src { list-style: none; margin: 0; padding: 0 22px 20px; display: flex; flex-direction: column; gap: 12px; }
.src li { font-size: 14px; }
.src a { color: var(--c-blue); text-decoration: none; }
.src a:hover { text-decoration: underline; }
.lean {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  margin-right: 8px;
  vertical-align: 1px;
}
.lean-yes { background: var(--long-bg); color: var(--long); }
.lean-no { background: var(--short-bg); color: var(--short); }
.lean-mixed { background: var(--flat-bg); color: var(--flat); }
.src-note { display: block; color: var(--ink-3); font-size: 13.5px; margin-top: 2px; }

/* ---------- foot ---------- */

.foot { padding: 36px 24px 56px; }
.foot p { margin: 0 0 6px; font-size: 12.5px; color: var(--ink-3); }
.gen { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; }

@media (max-width: 560px) {
  .q-head { padding: 17px 18px; gap: 12px; }
  .q-title { font-size: 16.5px; }
  .q-odds { display: none; }
  .q-section, .src, details.sources > summary { padding-left: 18px; padding-right: 18px; }
  .lede { font-size: 16px; }
  .today { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
