/* Presentation only. The same page templates feed every screen size. */
.sheet { visibility: hidden; overscroll-behavior: contain; gap: 0; }
.sheet.open { visibility: visible; }
.sheet .sheet-top { flex: none; margin-bottom: 8px; }
.sheet a.big {
  display: flex; align-items: center; min-height: 44px; font-size: clamp(1.13rem, 2.7vh, 1.45rem);
  line-height: 1.2; border-bottom: 1px solid var(--line);
}
.sheet .sheet-theme { min-height: 44px; margin: 16px 0 22px; flex: none; }
.sheet .btn { margin-bottom: env(safe-area-inset-bottom); }
.foot-col a:hover, .textlink:hover { text-underline-offset: 4px; }
:where(main) :is(h1,h2,h3) { text-wrap: balance; }
:where(main) p { text-wrap: pretty; }
.page-hero h1 { letter-spacing: -.04em; line-height: 1.06; }
.page-hero .lede { max-width: 57ch; line-height: 1.5; }
:where(.panel,.route,.layer,.step,.person,.story-grid) p { line-height: 1.56; }
:where(.panel,.route,.layer,.step,.person,.story-grid,.form-card) { min-width: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
button, a, summary { touch-action: manipulation; }

.hp-work-list p, .hp-uses-head .lede { display: block; }
.hp-uses-grid article { border: 0; border-radius: 0; border-top: 1px solid var(--line-2); padding: 22px 0; background: transparent; }
.hp-uses-grid article p, .hp-work-list p { font-size: 1rem; line-height: 1.52; }
.hp-uses-grid { gap: 18px 34px; }

@media (max-width: 720px) {
  .page-hero h1, .page-hero .ph-grid h1 { font-size: clamp(2rem,9vw,2.8rem); margin-block: 14px 18px; overflow-wrap: anywhere; }
  .hp-uses-grid, .layers, .steps, .pipeline, .asks {
    display: grid; grid-template-columns: minmax(0,1fr); gap: 16px;
    margin-inline: 0; padding-inline: 0; overflow: visible; scroll-snap-type: none;
  }
  .hp-uses-grid { gap: 0; }
  .hp-uses-grid article { padding: 17px 0; }
  .steps > .step, .steps > .step:first-child { min-width: 0; padding: 16px; grid-template-columns: minmax(0,1fr); }
  .step .viz { padding: 0; border: 0; grid-template-columns: minmax(0,1fr); }
  .step .dist-row { grid-template-columns: minmax(0,7em) 1fr 3em; gap: 6px; }
  .step .seg-row .top { flex-wrap: wrap; gap: 2px 8px; }
  input, select, textarea { font-size: max(16px,1rem); }
}
@media (max-width: 360px) {
  .nav-in { gap: 6px; }
  .nav-in .logo svg { height: 21px; }
  .nav-right { gap: 4px; }
  .nav-right .btn { padding-inline: 10px; }
}

/* Keep the original questions readable on phones and the section labels
   legible now that the home page also has a light palette. */
.hp-statement .q-list { display: grid; }
.hp-num, .hp-uses-grid span, .hp-uses .textlink, .hp-secure .ph { color: var(--accent-ink); }
.hp-statement .stat-row > div:first-child b { color: var(--resist-ink) !important; }
.hp-work { background: var(--bg-2); color: var(--ink); }
.hp-work-head h2 span, .hp-work-head a { color: var(--accent-ink); }
.hp-work-head p, .hp-work-list li:not(.first) p { color: var(--ink-2); }
.hp-work-list li:not(.first) { background: var(--surface); border-color: var(--line); }
.hp-work-list li:not(.first) .n { color: var(--accent-ink); }
.hp-work-list li.first { background: var(--deep); border-color: var(--deep); }
.hp-statement .q-list p { line-height: 1.42; }
@media (max-width: 40em) {
  .hp-statement .q-list { margin-top: 26px; }
  .hp-statement .q-list p { font-size: 1rem; padding-block: 14px; }
  .hp-uses-head .lede, .hp-work-head p { font-size: 1rem; }
  .foot-col a { display: inline-flex; min-height: 44px; align-items: center; }
}
/* The original examples, with one point per percentage point in MarketLab. */
.lab-dots { grid-template-columns: repeat(50,minmax(0,1fr)); grid-template-rows: repeat(2,auto); grid-auto-flow: column; gap: 2px; }
.lab-dots i { transition: background-color .2s; }
.lab-dots i.on { transform: none; }
.lab-seg { min-height: 44px; }
.lab-live b { animation: none; }
.lab-demo .stim.is-lead, .lab-demo .stim[aria-pressed="true"] { box-shadow: 0 0 0 1px var(--accent); }
.nl-body .nl-fig { max-width: 100%; min-width: 0; }
.nv-bar .nv-seg { justify-content: center; padding-left: 0; }
.nv-layer.nv-sim .nv-seg { background-image: repeating-linear-gradient(135deg,rgba(255,255,255,.10) 0 5px,transparent 5px 11px); }
.nl-fig .nv-seg.a { background-color: #24577f; color: white; }
:root .nl-fig .nv-seg.n { background-color: #aebcc6; color: #0b1d2a; }
.gate { overflow-y: auto; }
html.gated .gate, .gate.out, .gate-card { grid-template-columns: minmax(0,1fr); }
.gate-card, .gate-row { min-width: 0; }
@media (max-width: 32em) {
  .lab-dots { grid-template-columns: repeat(25,minmax(0,1fr)); grid-template-rows: repeat(4,auto); }
  .gate-row { flex-direction: column; }
  .gate-row input { min-height: 48px; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .sheet, .sheet.open, .lab-dots i { transition: none; }
}

/* Full-size report sources and image viewer. */
.report-open { display: block; position: relative; cursor: zoom-in; }
.report-open:focus-visible { outline-offset: -4px; }
.report-expand, .viewer-tools button, .issue-return {
  width: 44px; height: 44px; display: grid; place-items: center; padding: 0;
  border: 1px solid var(--line-2); border-radius: 50%; color: var(--ink); background: var(--surface); cursor: pointer;
}
.report-expand { position: absolute; top: 8px; right: 8px; box-shadow: 0 2px 8px #071d301c; cursor: zoom-in; }
.report-open:hover .report-expand, .viewer-tools button:hover, .issue-return:hover { color: var(--on-ink); background: var(--ink); }
html.viewing-report { overflow: hidden; }
.report-viewer {
  width: min(96vw,1500px); max-width: none; max-height: none;
  padding: 0; border: 0; background: transparent; color: var(--ink); overflow: visible;
}
.report-viewer::backdrop { background: rgb(4 13 21 / .84); }
.viewer-tools { display: flex; gap: 10px; justify-content: flex-end; padding-bottom: 12px; }
.viewer-pane { overflow: auto; max-height: calc(94vh - 60px); max-height: calc(94dvh - 60px); overscroll-behavior: contain; background: white; border-radius: 10px; }
.viewer-pane img { width: 100%; max-width: none; height: auto; cursor: zoom-in; }
.viewer-pane.magnified img { width: max(165%,1600px); cursor: zoom-out; }
.report-viewer :focus-visible { outline: 2px solid white; outline-offset: 3px; }

/* The same links and their original reading order in a shorter mobile menu. */
.sheet {
  display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-content: start;
  gap: 0 18px; padding-inline: max(var(--gutter), calc((100vw - 560px) / 2));
}
.sheet > * { grid-column: 1 / -1; }
.sheet a.big { font-size: clamp(1.08rem,2.55vh,1.4rem); min-height: 46px; }
.sheet a.big:is([href="marketlab.html"],[href="politiclab.html"],[href="about.html"],[href="news.html"]) { grid-column: auto; }
.sheet a.big[href^="https"] { font-size: 1rem !important; color: var(--ink-2) !important; }
.sheet a.big[aria-current="page"] { color: var(--accent-ink); font-weight: 610; }
.sheet a.big[aria-current="page"]::after { content: ""; width: 6px; height: 6px; background: currentColor; border-radius: 50%; margin-left: 10px; }
.sheet .sheet-theme { justify-self: start; }
.sheet .btn { margin-top: 0; }
@media (max-height: 660px) {
  .sheet { padding-block: 6px 14px; }
  .sheet .sheet-top { margin-bottom: 0; }
  .sheet a.big { min-height: 44px; }
  .sheet .sheet-theme { margin-block: 9px; }
}
.nl-issue { scroll-margin-top: 0; }
.nl-issue .issue-return { justify-self: end; color: var(--accent-ink); }
.nl-issue .issue-return:hover { color: var(--on-ink); }
.nl-issue .nl-fig { max-width: 100%; min-width: 0; }
#formCard { scroll-margin-top: 12px; }

/* Equal-length percentage scales keep comparisons aligned. */
.race .race-row {
  padding: 21px 0; border: 0; border-top: 1px solid var(--line-2); border-radius: 0;
  background: transparent; box-shadow: none;
}
.race .point-bar { display: grid; grid-template-columns: minmax(0,1fr) 3.6em; align-items: center; gap: 15px; height: auto; }
.race .point-bar .fill {
  position: static; width: auto; height: auto; padding: 0; display: block;
  color: var(--ink); background: none; text-align: right; border: 0; transition: none;
  font: 500 1.4rem/1.2 var(--font-display); letter-spacing: -.025em; font-variant-numeric: tabular-nums;
}
.race .support-points { display: grid; grid-template-columns: repeat(50,1fr); grid-template-rows: repeat(2,auto); grid-auto-flow: column; gap: 2px; }
.support-points i { display: block; aspect-ratio: 1; border-radius: 50%; background: var(--line-2); }
.support-points i.filled { background: var(--support); }
.race .race-row .risk { text-transform: none; letter-spacing: 0; }
.race-legend { flex-wrap: wrap; gap: 6px 16px; }
@media (max-width: 40em) {
  .race .race-row { grid-template-columns: minmax(0,1fr); gap: 12px; padding-block: 16px; }
  .race .race-row .risk { justify-self: start; grid-row: 3; }
  .race .point-bar { gap: 6px; }
  .race .support-points { grid-template-columns: repeat(25,1fr); grid-template-rows: repeat(4,auto); }
}
@media (forced-colors: active) {
  .support-points i { border: 1px solid CanvasText; }
  .support-points i.filled { forced-color-adjust: none; background: CanvasText; }
  .scenario[aria-pressed="true"] { outline: 2px solid Highlight; outline-offset: -3px; }
}

/* The existing case title names the link. Its full row is a touch target. */
.hp-uses-grid article { position: relative; padding-right: 32px; }
.case-link { color: inherit; text-decoration: none; }
.case-link::after { content: ""; position: absolute; inset: 0; border-radius: 4px; }
.case-link .ph { position: absolute; top: 24px; right: 1px; color: var(--accent-ink); font-size: 21px; }
.case-link:is(:hover,:focus-visible) { color: var(--accent-ink); text-decoration: underline; text-underline-offset: .2em; }
.case-link:focus-visible { outline: none; }
.case-link:focus-visible::after { outline: 2px solid var(--accent-ink); outline-offset: 4px; }
@media (max-width: 720px) { .case-link .ph { top: 18px; } }

.fields, .field { min-width: 0; }
.field textarea { min-width: 0; min-height: 6.3em; height: auto; padding: 11px 14px; resize: vertical; line-height: 1.45; }
.field .optional, .field small { font-weight: 400; font-size: .875rem; color: var(--ink-2); }
.privacy-link, .foot-base .privacy-link, .privacy-notice a {
  color: var(--accent-ink); text-decoration: underline; text-underline-offset: .18em;
}
.consent-wrap .privacy-link { display: inline-block; margin-left: 30px; padding-block: 8px; font-size: .9rem; }
.privacy-notice { max-width: 68ch; }
.privacy-notice h1 { margin-bottom: 12px; }
.privacy-notice .updated { font-size: .9rem; margin-bottom: 24px; }
.privacy-notice a { overflow-wrap: anywhere; }
.privacy-notice li + li { margin-top: .35em; }
.privacy-notice p, .privacy-notice li { line-height: 1.65; }
.privacy-notice h2 { scroll-margin-top: 6rem; }

/* Use the narrower group chart in the phone viewer. */
.report-viewer:has(img[src*="report-groups-mobile"]) { width: min(96vw, 600px); }
.viewer-pane.magnified img[src*="report-groups-mobile"] { width: 170%; }

/* Reading width and controls shared by the public pages. */
.page-hero > .wrap > h1 { max-width: 24ch; }
.page-hero .lede, .story-grid .first { text-wrap: pretty; }
.cta-row .textlink { min-height: 44px; }
.net-legend { gap: 6px 14px; color: var(--ink-2); font-size: .875rem; }
.lab-seg { min-height: 44px; font-size: .9rem; }
.lab-live, .lab-tally-t, .lab-tally-t :is(.lab-yes,.lab-turnout,.lab-verdict),
.lab-demo .stim span, .ex-table th, .nw-pill, .nv-head span, .nv-small, .nv-row .o {
  font-size: .8125rem; letter-spacing: .015em;
}
.hp-secure, .cta-secure, .fineprint { font-size: .9rem; line-height: 1.5; }
.foot-col .foot-h { font-weight: 600; color: var(--ink); font-size: .9375rem; }
.foot-col a:hover, .textlink:hover { text-decoration: underline; }
.foot-base { align-items: center; }
.deep :focus-visible { outline-color: var(--on-deep); }
:where(.fields) :is(input,select,textarea,button) { scroll-margin-block: 20px; }
@media (max-width: 62.5em) {
  .wrap.contact-grid { max-width: 44rem; gap: 0; }
  .contact-grid > div:first-child { display: contents; }
  .contact-grid > .form-card { order: 1; margin-top: 28px; }
  .contact-grid .meta-list { order: 2; margin-top: 36px; }
  .contact-grid .pre-call { order: 3; }
}
@media (max-width: 720px) {
  .nav-right .btn { --h: 44px; min-height: 44px; }
  .page-hero .lede, .hp-steps p, .hp-statement .stat-row p { font-size: 1rem; line-height: 1.52; }
  .hp-statement .stat-row { gap: 0; }
  .hp-statement .stat-row > div, .hp-statement .stat-row > div + div { align-items: start; }
  .hp-work-list li { padding: 20px; gap: 6px; }
  .hp-work-list p { margin-top: 0; }
  .nl-body .lab-more { margin-top: 0; padding-inline: 14px; }
  .nl-body .nl-fig { margin-block: 0 4px; }
  .nl-body .issue-return { min-width: 44px; min-height: 44px; }
  .page-hero .cta-row { row-gap: 6px; }
  .net-card { padding: 14px; }
  .net-legend { justify-content: space-between; column-gap: 6px; }
  .net-legend span { gap: 5px; }
  .form-card { padding: clamp(16px,5vw,24px); }
}
@media (max-width: 32em) {
  .cta-row:has(.btn + .btn) { display: grid; grid-template-columns: minmax(0,1fr); gap: 12px; }
  .cta-row:has(.btn + .btn) .btn { width: 100%; }
  .page-hero .ph-grid .cta-row, .pilot .cta-row { flex-direction: column; align-items: flex-start; row-gap: 6px; }
  .pilot ol { grid-template-columns: 1fr; gap: 18px; }
}

/* Keep the close control within reach when a phone is turned sideways. */
@media (max-height: 34em) {
  .sheet .sheet-top { position: sticky; top: -6px; z-index: 1; background: var(--bg); }
  .sheet { scroll-padding-top: 60px; }
}
@media (min-width: 36em) and (max-height: 34em) {
  .sheet > :is(a,.sheet-theme) { grid-column: auto; }
  .sheet > .btn { margin-block: 8px; }
}
@media (max-width: 26em) {
  .nv-plan .nv-row { grid-template-columns: minmax(0,1fr); grid-template-areas: "k" "v" "o"; }
  .nv-plan .nv-row .o { justify-self: start; white-space: normal; }
}
