/* =========================================================================
   Call Flow styles
   -------------------------------------------------------------------------
   Dark theme, three columns on desktop (no page scrolling), one column on
   phones. Colors are defined once as custom properties below; change a
   color there and it updates everywhere.

   Color meaning (keep these consistent; callers learn them fast):
     --say   orange  lines the caller says
     --ask   green   questions the caller asks
     --fact  blue    facts and numbers
     --his   purple  the senator's own words
     --they  grey    what the staffer might say
     --fall  yellow  fallback asks, star ratings, cautions
   ========================================================================= */

:root {
  /* Surfaces */
  --bg: #0d0f13;
  --panel: #161a21;
  --panel-2: #1c212a;
  --panel-3: #232a35;
  --border: #3a4352;
  --rule: #2a303b;

  /* Text */
  --ink: #e7e9ee;
  --muted: #9aa1ad;

  /* Meaning colors (see header comment) */
  --say: #ff9d5c;
  --ask: #4fd18b;
  --fact: #6cb2ff;
  --his: #c79bff;
  --they: #a3a9b4;
  --fall: #f5c542;
  --warn: #ff6b6b;

  /* System fonts: no third-party font requests, so no tracking and faster loads. */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  color-scheme: dark;
}

/* ---------- Base ---------- */

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

[hidden] { display: none !important; }   /* make the hidden attribute win over display rules */

html, body { margin: 0; height: 100%; }

body {
  display: flex;
  flex-direction: column;
  overflow: hidden;                         /* desktop: columns scroll, page does not */
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: clamp(13px, 0.95vw, 17px);     /* scales with screen width */
  line-height: 1.35;
}

button { font: inherit; color: inherit; cursor: pointer; }

:focus-visible { outline: 2px solid var(--ask); outline-offset: 2px; }

a { color: var(--fact); }

/* ---------- Site menu and views ---------- */

.sitebar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4em 1.5em;
  padding: 0.45em 1em;
  background: var(--panel);
  border-bottom: 1px solid var(--rule);
}
.brand { color: var(--ink); font-weight: 800; text-decoration: none; }
.menu { display: flex; flex-wrap: wrap; gap: 0.3em; }
.menu a { padding: 0.25em 0.7em; border-radius: 0.35em; color: var(--muted); font-size: 0.9em; font-weight: 600; text-decoration: none; }
.menu a:hover { color: var(--ink); }
.menu a[aria-current] { background: var(--panel-3); color: var(--ink); }

/* Each view fills the space under the menu. */
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.view--about { overflow-y: auto; }

/* About view */
.about { width: 100%; max-width: 42rem; margin: 0 auto; padding: 2.5em 1.25em; font-size: 1.1em; line-height: 1.5; }
.about h1 { margin: 0 0 0.3em; font-size: 2em; }
.about h2 { margin: 2em 0 0.8em; color: var(--muted); font-size: 0.8em; letter-spacing: 0.1em; text-transform: uppercase; }
.about p { margin: 0; }
.about .lede { color: var(--muted); font-size: 1.1em; }
.campaign {
  display: block;
  padding: 1em 1.25em;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 4px solid var(--say);
  border-radius: 0.5em;
  color: var(--ink);
  text-decoration: none;
}
.campaign:hover, .campaign:focus-visible { border-color: var(--ask); outline: none; }
.campaign strong { display: block; font-size: 1.1em; }
.campaign span { color: var(--muted); }

/* ---------- Top bar (title and color key) ---------- */

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4em 1.2em;
  padding: 0.5em 1em;
  border-bottom: 1px solid var(--rule);
}
.topbar h1 { margin: 0; font-size: 1em; font-weight: 700; }

.legend { display: flex; flex-wrap: wrap; gap: 0.9em; margin: 0; padding: 0; list-style: none; font-size: 0.8em; }
.key { display: inline-flex; align-items: center; gap: 0.35em; font-weight: 600; }
.key::before { content: ""; width: 0.7em; height: 0.7em; border-radius: 0.15em; background: currentColor; }
.key--say { color: var(--say); }
.key--ask { color: var(--ask); }
.key--fact { color: var(--fact); }
.key--his { color: var(--his); }
.key--they { color: var(--they); }
.key--fall { color: var(--fall); }

/* ---------- Three-column layout ---------- */

.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(16em, 1fr) 2.1fr minmax(16em, 1fr);
  gap: 0.8em;
  padding: 0.8em;
}

/* Side panels (reference on the left, comebacks on the right) */
.panel {
  display: flex;
  flex-direction: column;
  gap: 0.45em;
  overflow-y: auto;
  padding: 0.6em;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 0.5em;
}
.panel__title {
  margin: 0.2em 0.2em 0.1em;
  color: var(--muted);
  font-size: 0.72em;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Collapsible sections inside the side panels */
details { background: var(--panel-2); border-left: 0.22em solid var(--rule); border-radius: 0.35em; }
details > summary {
  display: flex;
  align-items: baseline;
  gap: 0.5em;
  padding: 0.45em 0.6em;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸"; color: var(--muted); }
details[open] > summary::before { content: "▾"; }
details > summary small { margin-left: auto; color: var(--muted); font-size: 0.8em; font-weight: 400; }
.details__body { padding: 0.1em 0.6em 0.55em; font-size: 0.9em; }

details.is-fact { border-left-color: var(--fact); }
details.is-fact > summary { color: var(--fact); }
details.is-his { border-left-color: var(--his); }
details.is-his > summary { color: var(--his); }
details.is-they { border-left-color: var(--they); }

/* Rows inside reference sections */
.num { display: flex; justify-content: space-between; gap: 0.6em; padding: 0.12em 0; }
.num b, .dated b { color: var(--fact); }
.dated { display: grid; grid-template-columns: 3.6em 1fr; gap: 0.4em; padding: 0.22em 0; border-bottom: 1px solid var(--rule); }
.dated:last-child { border-bottom: none; }
.quote { padding: 0.18em 0; color: var(--his); }
.quote small { color: var(--muted); }
.sources a { display: block; padding: 0.1em 0; text-decoration: none; }
.sources a:hover { text-decoration: underline; }

/* A comeback: what they say (grey italic) and your answer (orange) */
.comeback { padding: 0.3em 0; border-bottom: 1px solid var(--rule); }
.comeback:last-child { border-bottom: none; }
.comeback__they { color: var(--they); font-style: italic; }
.comeback__you { color: var(--say); font-weight: 600; }

/* ---------- Center column: the decision tree ---------- */

.flow {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0.5em;
  box-shadow: 0 0 24px rgb(108 178 255 / 6%);
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3em;
  min-height: 2.6em;
  padding: 0.55em 1em;
  border-bottom: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.82em;
}
.crumbs [aria-current] { color: var(--ink); font-weight: 600; }

.stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.8em;
  overflow-y: auto;
  padding: 1.2em 1.6em;
  font-size: 1.5em;                         /* the script text is big on purpose */
}

.step { color: var(--muted); font-size: 0.62em; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.note { color: var(--muted); font-size: 0.72em; font-style: italic; }
.phone { color: var(--fact); font-weight: 700; font-style: normal; }

/* Colored script blocks */
.block { padding: 0.45em 0.8em; background: var(--panel-2); border-left: 0.2em solid; border-radius: 0 0.35em 0.35em 0; }
.block--say { border-color: var(--say); color: var(--say); font-weight: 600; }
.block--ask { border-color: var(--ask); color: var(--ask); font-weight: 600; }
.block--his { border-color: var(--his); color: var(--his); font-size: 0.78em; }
.block--his > div { padding: 0.08em 0; }
.block--fact { border-color: var(--fact); font-size: 0.78em; }
.block--fall { border-color: var(--fall); }
.block--caution { border-color: var(--fall); font-size: 0.72em; }
.block__label { display: block; margin-bottom: 0.15em; font-size: 0.62em; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.85; }
.block--fact .block__label { display: inline; margin-right: 0.3em; color: var(--fact); font-size: 1em; letter-spacing: 0; text-transform: none; opacity: 1; }
.block--caution .block__label { color: var(--fall); }

/* Choice buttons */
.options { display: grid; grid-template-columns: repeat(auto-fill, minmax(15em, 1fr)); gap: 0.5em; margin-top: 0.2em; }
.option {
  padding: 0.55em 0.75em;
  background: var(--panel-3);
  border: 1px solid var(--border);
  border-radius: 0.4em;
  font-size: 0.78em;
  font-weight: 600;
  text-align: left;
}
.option:hover, .option:focus-visible { background: #26303c; border-color: var(--ask); outline: none; }
.option--primary { border-color: var(--ask); }
.stars { color: var(--fall); letter-spacing: 0.05em; }

/* "If they push back here" list under a step */
.pushback { margin-top: 0.3em; font-size: 0.72em; }
.pushback__title { margin-bottom: 0.25em; color: var(--muted); font-size: 0.85em; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.pushback__item { margin-bottom: 0.25em; padding: 0.35em 0.6em; background: var(--panel-2); border-left: 0.2em solid var(--they); border-radius: 0 0.3em 0.3em 0; }

/* Bottom control bar */
.controls { display: flex; flex-wrap: wrap; gap: 0.5em; padding: 0.6em 1em; border-top: 1px solid var(--rule); }
.controls button { padding: 0.45em 0.8em; background: var(--panel-3); border: 1px solid var(--border); border-radius: 0.35em; font-size: 0.9em; font-weight: 600; }
.controls__spacer { flex: 1; }
.btn--warn { color: var(--warn); border-color: var(--warn) !important; }
.btn--fall { color: var(--fall); border-color: var(--fall) !important; }

/* ---------- Setup form ---------- */

.form { display: grid; gap: 0.65em; max-width: 36em; font-size: 0.72em; }
.field { display: flex; flex-direction: column; gap: 0.25em; color: var(--muted); font-size: 0.85em; font-weight: 600; }
.field input {
  padding: 0.45em 0.6em;
  background: var(--panel-3);
  border: 1px solid var(--border);
  border-radius: 0.35em;
  color: var(--ink);
  font: inherit;
  font-size: 1.15em;
  font-weight: 400;
}
.field input:focus { border-color: var(--ask); outline: none; }
.form__row { display: grid; grid-template-columns: 2fr 1fr; gap: 0.65em; }
.form fieldset { display: grid; gap: 0.4em; margin: 0; padding: 0.45em 0.75em 0.6em; border: 1px solid var(--rule); border-radius: 0.4em; }
.form legend { padding: 0 0.3em; color: var(--muted); font-size: 0.85em; font-weight: 600; }
.choice { display: flex; align-items: center; gap: 0.55em; cursor: pointer; }
.choice .phone { margin-left: auto; }
.form input[type="radio"], .form input[type="checkbox"] { width: 1.05em; height: 1.05em; accent-color: var(--ask); }
.form__actions { display: flex; gap: 0.5em; }
.form__actions .option { flex: 1; text-align: center; font-size: 1.05em; }
.form__actions .option--quiet { flex: 0 0 auto; color: var(--muted); }

.noscript { padding: 2em; text-align: center; }

/* ---------- Phones and narrow windows ----------
   Columns stack and the page scrolls normally. The decision tree comes
   first, then comebacks, then reference. */
@media (max-width: 900px) {
  body { overflow: auto; height: auto; font-size: 15px; }
  .layout { grid-template-columns: 1fr; }
  .flow { order: 1; min-height: 70vh; }
  #comebacks { order: 2; }
  #reference { order: 3; }
  .panel { overflow: visible; }
  .stage { font-size: 1.25em; padding: 1em; }
  .form__row { grid-template-columns: 1fr; }
}
