/* The Fly for Congress — poster system. Source of truth: design/SYSTEM.md. */

:root {
  --navy: #0b2545; --red: #c8102e; --red-dark: #a30c25; --cream: #f3efe4; --white: #fff;
  --ink: #111; --ink-soft: #4b4f58; --ink-muted: #7a7e87; --rule: #d8d2c4;
  --prog: #2a78d6; --cons: #e34948; --neutral: #e9e5da; --meter: #8a7f66;
  --display: 'League Gothic', 'Oswald', 'Arial Narrow', Impact, sans-serif;
  --text: 'Archivo', 'Franklin Gothic Medium', 'Helvetica Neue', Arial, sans-serif;
  --pad-y: clamp(2.5rem, 6vw, 5rem); --pad-x: clamp(1.25rem, 5vw, 4rem); --max: 88rem;
  color-scheme: light;
}
* { box-sizing: border-box; border-radius: 0 !important; }
html { scroll-behavior: smooth; }
body { margin: 0; overflow-x: hidden; background: var(--cream); --talk-w: 26rem; --drawer-h: 4.75rem; color: var(--ink); font-family: var(--text); font-size: 1.0625rem; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -999px; top: .5rem; background: var(--red); color: var(--white); padding: .5rem .9rem; font-family: var(--display); text-transform: uppercase; z-index: 10; }
.skip:focus { left: .5rem; }

/* ---- voices ------------------------------------------------------------ */
.display, h1, h2, .composer button, .nav-cta, .payer-line, .strip, .wordmark {
  font-family: var(--display); font-weight: 400; text-transform: uppercase;
  letter-spacing: .02em; line-height: .88;
}
/* Multi-line display settings breathe a little more than a single line. */
h1, h2 { line-height: .94; }
/* Deliberate breaks: a sentence stays together, and falls to its own line as a unit. */
.keep { display: inline-block; }
.mark, .label, .primary a, .legend, table.platform thead th, .record time, .stance-value {
  font-family: var(--text); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; font-size: .75rem; line-height: 1.3;
}
.mark { font-weight: 900; font-stretch: 125%; letter-spacing: .14em; font-size: .8rem; color: var(--red); margin: 0 0 1rem; }

/* ---- bands ------------------------------------------------------------- */
.band { padding: var(--pad-y) var(--pad-x); }
.band > .inner { max-width: var(--max); margin: 0 auto; }
.band-navy { background: var(--navy); color: var(--white); }
.band-red { background: var(--red); color: var(--white); }
.band-white { background: var(--white); }

.page { container-type: inline-size; container-name: page; }

/* ---- masthead ---------------------------------------------------------- */
.masthead { padding: 1rem var(--pad-x); }
.masthead .inner { display: flex; align-items: center; justify-content: space-between; gap: 2rem; }
.wordmark { text-decoration: none; font-size: 2rem; display: inline-flex; align-items: baseline; gap: .55rem; color: var(--white); white-space: nowrap; }
.wordmark .star { color: var(--red); font-size: .8em; }
.wordmark-office { font-size: .72em; opacity: .9; }
.primary { display: flex; align-items: center; gap: 1.75rem; }
.primary a { text-decoration: none; color: var(--white); opacity: .85; padding: .35rem 0; border-bottom: 2px solid transparent; }
.primary a:hover, .primary a[aria-current] { opacity: 1; border-bottom-color: var(--white); }
.primary a.nav-cta, .nav-cta { white-space: nowrap; opacity: 1; font-size: 1.05rem; padding: .7rem 1.25rem; background: var(--red); color: var(--white); border: 0; letter-spacing: .04em; }
.primary a.nav-cta:hover { background: var(--red-dark); }

/* ---- hero: a poster. Portrait on top, dominant; headline beneath; one ask. ---- */
.hero-band { padding-top: 0; padding-bottom: 0; overflow: hidden; }
.hero-band .inner { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; }
.hero > * { max-width: 100%; min-width: 0; }
.candidate { margin: 0; width: 100%; max-width: 64rem; position: relative; }
#candidate { display: block; width: 100%; height: clamp(16rem, 44vh, 30rem); cursor: pointer; outline-offset: -10px; -webkit-tap-highlight-color: transparent; opacity: 0; transition: opacity .4s ease; }
#candidate[data-ready] { opacity: 1; }
#candidate:focus-visible { outline: 3px solid var(--red); }
.hero { text-align: center; padding: .75rem 0 var(--pad-y); display: grid; justify-items: center; gap: 0; }
.hero .mark { margin-bottom: .5rem; }
.hero h1 { font-size: clamp(3.5rem, 7.5vw, 7rem); color: var(--navy); margin: 0 0 1.1rem; max-width: 16ch; overflow-wrap: anywhere; }
.hero h1 em { font-style: normal; color: var(--red); }
.why { text-wrap: pretty; font-size: clamp(1.05rem, 1.5vw, 1.25rem); line-height: 1.45; color: var(--ink); width: 100%; max-width: 40rem; margin: 0; font-weight: 500; }

/* ---- the ask panel: the one CTA ---------------------------------------- */
#chat { background: var(--white); border: 3px solid var(--navy); padding: .75rem; display: grid; gap: .75rem; }
.thread { list-style: none; margin: 0; padding: 0; display: grid; align-content: start; gap: .6rem; max-height: 22rem; overflow-y: auto; scrollbar-width: thin; }
.thread:empty { display: none; }
.turn { padding: .7rem .9rem; max-width: 48ch; font-size: 1rem; line-height: 1.5; }
.turn-you { background: var(--cream); justify-self: end; color: var(--ink-soft); }
.turn-fly { border-left: 3px solid var(--navy); padding-left: 1rem; justify-self: start; font-size: 1.08rem; }
.turn-note { justify-self: stretch; max-width: none; border-top: 2px solid var(--red); border-bottom: 2px solid var(--red); text-align: center; font-family: var(--text); font-weight: 700; font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--red); }
.is-waiting { color: var(--ink-muted); font-style: italic; }
.is-error { border-left-color: var(--red); color: var(--red); }
.composer { display: flex; flex-wrap: wrap; gap: .75rem; }
.doorman { flex: 1 1 100%; }
.notice { flex: 1 1 100%; margin: 0; font-size: .78rem; color: var(--ink-muted); line-height: 1.4; }
.doorman:empty { display: none; }
.composer input { flex: 1; min-width: 0; padding: .8rem .9rem; font: inherit; font-size: 1.05rem; color: var(--ink); background: var(--cream); border: 0; }
.composer input::placeholder { color: var(--ink-muted); }
.composer input:focus-visible, .composer button:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.composer button { font-size: 1.15rem; padding: .8rem 1.5rem; cursor: pointer; white-space: nowrap; color: var(--white); background: var(--red); border: 0; }
.composer button:hover { background: var(--red-dark); }
.composer button[disabled] { opacity: .55; cursor: progress; }


/* ---- app shell: the page scrolls beside a persistent conversation ------ */
@media (min-width: 64rem) {
  body { display: grid; grid-template-columns: minmax(0, 1fr) var(--talk-w); align-items: start; }
  .page { min-width: 0; }
  @media (max-width: 80rem) { body { --talk-w: 22rem; } }
  body:has(.talk):not(.talk-collapsed) .masthead .nav-cta { display: none; }   /* the open sidebar IS the call to action */
  body.talk-collapsed { --talk-w: 3.25rem; }
  .talk-toggle { position: absolute; top: .9rem; right: .9rem; width: 2rem; height: 2rem; border: 2px solid var(--navy); background: var(--white); color: var(--navy); cursor: pointer; font-family: var(--display); font-size: 1.1rem; line-height: 1; display: grid; place-items: center; }
  .talk-toggle:hover { background: var(--navy); color: var(--white); }
  .talk-toggle:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
  .talk-toggle-closed { display: none; }
  .talk { position: sticky; }
  .talk-collapsed .talk-inner > *:not(.talk-head), .talk-collapsed .talk-head > :not(.talk-toggle) { display: none; }
  .talk-collapsed .talk-inner { padding: 0; }
  .talk-collapsed .talk-toggle { position: static; width: 100%; height: 100%; border: 0; background: var(--red); color: var(--white); }
  .talk-collapsed .talk-toggle:hover { background: var(--red-dark); }
  .talk-collapsed .talk-toggle-open { display: none; }
  .talk-collapsed .talk-toggle-closed { display: block; writing-mode: vertical-rl; transform: rotate(180deg); text-transform: uppercase; letter-spacing: .06em; font-size: 1.35rem; }
  .talk { position: sticky; top: 0; height: 100vh; height: 100svh; display: flex; flex-direction: column; background: var(--white); border-left: 3px solid var(--navy); }
  .drawer-handle { display: none; }
  .talk-inner { display: flex; flex-direction: column; flex: 1; min-height: 0; padding: 1.5rem 1.25rem 1.25rem; position: relative; }
  .talk-head { flex: none; margin-bottom: 1rem; padding-right: 2.5rem; }
  .talk-head h2 { font-size: 2.6rem; margin: 0 0 .35rem; }
  .talk-head p { margin: 0; font-size: .95rem; color: var(--ink-soft); line-height: 1.45; }
  #chat { flex: 1; min-height: 0; display: flex; flex-direction: column; border: 0; padding: 0; background: transparent; }
  .thread { flex: 1; min-height: 0; max-height: none; }
  .thread:empty { display: block; }
  .composer { flex: none; margin-top: .75rem; border-top: 3px solid var(--navy); padding-top: .75rem; flex-wrap: wrap; }
  .composer input { background: var(--cream); flex: 1 1 100%; }
  .composer button { flex: 1 1 100%; }
}
@media (max-width: 63.98rem) {
  .talk-toggle { display: none; }
  .page { padding-bottom: var(--drawer-h); }
  .talk { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--white); border-top: 3px solid var(--navy); transform: translateY(calc(100% - var(--drawer-h))); transition: transform .28s ease; max-height: 82svh; display: flex; flex-direction: column; box-shadow: none; }
  .talk.is-open { transform: translateY(0); }
  .drawer-handle { flex: none; height: var(--drawer-h); width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0 1.25rem; background: var(--red); color: var(--white); border: 0; cursor: pointer; text-align: left; }
  .drawer-handle:focus-visible { outline: 3px solid var(--navy); outline-offset: -3px; }
  .drawer-title { font-family: var(--display); font-size: 1.5rem; text-transform: uppercase; letter-spacing: .02em; }
  .drawer-hint { font-size: .8rem; opacity: .9; }
  .talk.is-open .drawer-hint { display: none; }
  .talk.is-open .drawer-title::after { content: ' \2193'; }
  .talk-inner { display: flex; flex-direction: column; flex: 1; min-height: 0; padding: 1rem 1.25rem 1.25rem; }
  .talk-head h2 { font-size: 2rem; margin: 0 0 .25rem; }
  .talk-head p { margin: 0 0 .75rem; font-size: .9rem; color: var(--ink-soft); }
  #chat { flex: 1; min-height: 0; display: flex; flex-direction: column; border: 0; padding: 0; background: transparent; }
  .thread { flex: 1; min-height: 0; max-height: none; }
  .composer { flex: none; margin-top: .75rem; }
  .composer input { background: var(--cream); }
}

/* ---- slogan strip ------------------------------------------------------ */
.strip { padding: 1.1rem var(--pad-x); font-size: clamp(1.4rem, 3vw, 2.25rem); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strip .star { margin: 0 .5em; opacity: .9; }

/* ---- sections ---------------------------------------------------------- */
h2 { font-size: clamp(3rem, 6vw, 4.5rem); color: var(--navy); margin: 0 0 1.1rem; max-width: 24ch; }
.band-white h2 { color: var(--navy); }
.lede { text-wrap: pretty; max-width: 38rem; font-size: 1.15rem; line-height: 1.5; color: var(--ink-soft); margin: 0 0 2.5rem; }

/* ---- platform rows ----------------------------------------------------- */
.legend { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: center; color: var(--ink-soft); margin-bottom: .75rem; }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.legend-note { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--ink-muted); }
.swatch { width: .8rem; height: .8rem; display: inline-block; }
.swatch-prog { background: var(--prog); } .swatch-cons { background: var(--cons); }
table.platform { width: 100%; border-collapse: collapse; border-top: 3px solid var(--navy); }
table.platform thead th { text-align: left; color: var(--ink-muted); padding: .8rem .5rem; border-bottom: 1px solid var(--rule); }
.stance th, .stance td { padding: 1.1rem .5rem; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.stance-label { text-align: left; width: 50%; font-weight: 400; }
.stance-name { display: block; font-weight: 800; font-size: 1.15rem; line-height: 1.2; color: var(--navy); }
.stance-line { display: block; color: var(--ink-soft); font-size: .95rem; margin-top: .2rem; }
.stance-bar { width: 34%; } .stance-appetite { width: 20%; }
.cell { display: flex; align-items: center; gap: .6rem; }
.track { position: relative; flex: 1; height: .8rem; min-width: 6rem; background: var(--neutral); }
.zero { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 2px; background: var(--navy); opacity: .5; }
.fill { position: absolute; top: 0; bottom: 0; }
.is-prog .fill { background: var(--prog); } .is-cons .fill { background: var(--cons); } .is-torn .fill { background: var(--ink-muted); }
.meter { flex: 1; height: .45rem; min-width: 3.5rem; background: var(--neutral); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--meter); }
.stance-value { font-stretch: 80%; font-variant-numeric: tabular-nums; letter-spacing: 0; font-size: .8rem; color: var(--ink-soft); min-width: 3.2ch; font-weight: 500; }
.provenance { color: var(--ink-muted); font-size: .92rem; margin-top: 1.1rem; max-width: 40rem; }

/* ---- ledger ------------------------------------------------------------ */
.record { list-style: none; margin: 0; padding: 0; border-top: 3px solid var(--navy); }
.record li { padding: 1.1rem 0; border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: 8rem 1fr; gap: .3rem 1.5rem; }
.record li.is-crossed { border-left: 4px solid var(--red); padding-left: 1rem; }
.record time { color: var(--ink-muted); padding-top: .2rem; }
.shift { margin: 0; font-variant-numeric: tabular-nums; }
.shift strong { text-transform: capitalize; font-weight: 800; color: var(--navy); }
.shift em { color: var(--red); font-style: normal; font-weight: 700; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; }
.record blockquote { grid-column: 2; margin: 0; padding-left: .9rem; border-left: 3px solid var(--navy); color: var(--ink-soft); }
.loading, .empty, .error { color: var(--ink-muted); max-width: 40rem; }
.error { color: var(--red); }

/* ---- colophon ---------------------------------------------------------- */
.colophon .inner { display: grid; gap: 1.5rem; }
.payer { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.25rem; }
.payer-line { border: 2px solid var(--white); padding: .55rem .9rem; font-size: 1.3rem; }
.payer-note { opacity: .85; font-style: italic; }
.directory { display: flex; flex-wrap: wrap; gap: 1.75rem; }
.directory a { text-decoration: none; opacity: .8; }
.directory a:hover { opacity: 1; text-decoration: underline; }
.disclosure { margin: 0; font-size: .9rem; opacity: .7; }

/* ---- about ------------------------------------------------------------- */
.prose h1 { font-size: clamp(3.5rem, 8vw, 6.5rem); color: var(--navy); margin: 0 0 .75rem; }
.prose h2 { font-size: clamp(2rem, 4vw, 2.75rem); margin-top: 3rem; }
.prose ul { padding-left: 1.2rem; max-width: 40rem; } .prose li { margin-bottom: .5rem; }
.prose code { font-family: ui-monospace, Menlo, monospace; font-size: .85em; background: var(--neutral); padding: .1em .35em; }
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; margin-top: 2rem; }
.about-grid h2 { margin-top: 0; font-size: 2.25rem; }
.colophon-note { color: var(--ink-muted); font-size: .95rem; margin-top: 2.5rem; }

/* ---- responsive -------------------------------------------------------- */
/* ---- narrow main column (phone, or a desktop beside the sidebar) ----------- */
@container page (max-width: 60rem) {
  .strip-more { display: none; }
  .strip { white-space: normal; }
  h2 { font-size: clamp(2.5rem, 8cqw, 3.5rem); }
  .hero h1 { font-size: clamp(3.25rem, 13cqw, 6rem); }
  /* the platform table stacks: name and stance on top, bars beneath */
  table.platform, table.platform tbody, table.platform tr, table.platform th, table.platform td { display: block; width: auto; }
  table.platform thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.platform tr.stance { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem 1.25rem; padding: 1rem 0; border-bottom: 1px solid var(--rule); }
  .stance th, .stance td { padding: 0; border: 0; }
  .stance-label { grid-column: 1 / -1; }
  .stance-name { font-size: 1.05rem; }
  .stance-line { font-size: .9rem; }
  .track { min-width: 0; } .meter { min-width: 0; }
  .record li { grid-template-columns: 1fr; } .record blockquote { grid-column: 1; }
  .about-grid { grid-template-columns: 1fr; gap: 1.5rem; }
}
@container page (max-width: 48rem) {
  .masthead .inner { gap: .75rem; }
  .primary { gap: 1rem; }
  .primary a.nav-cta { font-size: .95rem; padding: .6rem .9rem; }
  .wordmark { font-size: 1.6rem; } .wordmark-office { display: none; }
}
/* Narrow with the drawer button present: the section links go; the button never wraps. */
@container page (max-width: 40rem) {
  .primary a:not(.nav-cta) { display: none; }
}
@container page (max-width: 30rem) {
  table.platform tr.stance { grid-template-columns: 1fr; gap: .4rem; }
}
@media (max-width: 63.98rem) {
  #candidate { height: clamp(18rem, 70vw, 26rem); }
}
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition-duration: .01ms !important; animation-duration: .01ms !important; } }
