/* civic-research.com homepage.
 *
 * Motion contract: demo.js adds .armed to <html>. Every rule that HIDES demo
 * content is scoped under .armed, so with JS disabled the whole thing — every
 * question, every source card, both answers in full — renders as static
 * content. Animation only ever reveals what is already in the markup.
 *
 * CSP forbids inline styles. The only values JS writes directly are the ones
 * that must be computed at runtime: the scene transform, the stage height, the
 * source-list max-height, the answer min-height, and the counter/caption text.
 */

:root {
    --navy: #003a70;
    --navy-hover: #00294f;
    --navy-deep: #062f57;
    --teal: #00809e;
    --teal-link: #00607a;
    --teal-ink: #00506b;
    --page-bg: #edf3f9;
    --surface: #ffffff;
    --surface-tint: #f6fafd;
    --bd: #cbdcec;
    --rule: #cfdfee;
    --divider: #dbe7f2;
    --card-bd: #d8e5f0;
    --chip-bg: #dceaf6;
    --chip-bd: #a9c6e0;
    --chip-hover: #e7f1fa;
    --cite-bg: #e4eff9;
    --cite-bd: #aec9e2;
    --track: #cddeee;
    --ink: #0d2338;
    --ink-body: #112a3d;
    --ink-quote: #14293b;
    --ink-sub: #3a5670;
    --ink-muted: #3f5c76;
    --ink-soft: #4a6480;
    --ink-ph: #5c7a96;
    --ring: rgba(0, 128, 158, .16);
    --sh-card: 0 1px 1px rgba(16, 33, 48, .04);
    --sh-panel: 0 1px 2px rgba(16, 33, 48, .05), 0 12px 34px rgba(6, 47, 87, .09);
    --sh-lift: 0 2px 6px rgba(16, 33, 48, .07), 0 22px 48px rgba(6, 47, 87, .13);
    --e-push: cubic-bezier(.5, .03, .13, 1);
    --e-drift: cubic-bezier(.25, .6, .4, 1);
    --e-soft: cubic-bezier(.3, 0, .2, 1);
}

body {
    background: var(--page-bg);
    color: var(--ink-body);
    /* Subtle depth so the white cards sit ON something. */
    background-image:
        radial-gradient(1100px 520px at 50% -8%, #ffffff 0%, rgba(255,255,255,0) 62%),
        radial-gradient(760px 420px at 88% 4%, rgba(0,128,158,.05) 0%, rgba(0,128,158,0) 60%);
    background-repeat: no-repeat;
}

.shell { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* ------------------------------------------------------------------ header */

.site-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 12px;
    padding: 22px 0 30px;
}
.wordmark {
    font-size: 16px;
    font-weight: 650;
    letter-spacing: -.01em;
    color: var(--navy);
    text-decoration: none;
}
.wordmark:hover { text-decoration: none; }
.wordmark-sub {
    display: block;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0;
    color: var(--ink-soft);
    margin-top: 1px;
}
.site-nav { display: flex; gap: 22px; }
.site-nav a {
    font-size: 13.5px;
    color: var(--ink-muted);
    text-decoration: none;
    padding-bottom: 2px;
    border-bottom: 1px solid transparent;
}
.site-nav a:hover { color: var(--navy); border-bottom-color: var(--chip-bd); text-decoration: none; }

/* -------------------------------------------------------------------- hero */

.hero { padding-bottom: 24px; }
.hero h1 {
    font-size: 46px;
    line-height: 1.04;
    letter-spacing: -.028em;
    font-weight: 680;
    max-width: 15ch;
    color: var(--navy-deep);
}
.hero-sub {
    font-size: 18.5px;
    line-height: 1.5;
    max-width: 56ch;
    color: var(--ink-sub);
    text-wrap: pretty;
    margin-top: 14px;
}
.steps {
    display: flex;
    flex-wrap: wrap;
    gap: 28px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--rule);
    list-style: none;
}
.steps li { display: flex; gap: 10px; max-width: 26ch; font-size: 14px; line-height: 1.45; color: var(--ink-sub); }
.steps b { color: var(--ink-body); font-weight: 620; }
.step-n {
    flex: none;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--chip-bg);
    color: var(--navy);
    font-size: 11.5px;
    font-weight: 650;
    display: grid;
    place-items: center;
    margin-top: 2px;
}

/* ------------------------------------------------------------------ picker */

.picker {
    background: var(--surface);
    border: 1px solid var(--bd);
    border-radius: 13px;
    padding: 17px 20px;
    margin-bottom: 14px;
    box-shadow: var(--sh-card);
}
.picker-eyebrow {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .1em;
    font-weight: 640;
    color: var(--teal-link);
    margin-bottom: 12px;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
    font: inherit;
    font-size: 15px;
    line-height: 1.35;
    font-weight: 560;
    text-align: left;
    padding: 11px 15px;
    border-radius: 9px;
    border: 1px solid var(--chip-bd);
    background: var(--surface);
    color: var(--navy);
    cursor: pointer;
    transition: background .18s, border-color .18s, transform .18s, box-shadow .18s;
}
.chip:hover { background: var(--chip-hover); border-color: var(--navy); box-shadow: 0 3px 10px rgba(6,47,87,.09); }
.chip:active { transform: translateY(1px); }
.chip[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.picker-note { font-size: 13px; color: var(--ink-soft); max-width: 74ch; margin-top: 12px; }

/* ------------------------------------------------------- stage / camera */

.stage {
    position: relative;
    overflow: hidden;
    border-radius: 14px;
}
.armed .stage { transition: height .8s var(--e-soft); }
.scene { position: relative; transform-origin: 50% 0; }
.scene-img {
    position: absolute;
    top: 0; left: 0;
    max-width: none;
    display: block;
    pointer-events: none;
}
.scene-screen { position: absolute; background: var(--page-bg); pointer-events: none; }
.armed .scene-img, .armed .scene-screen { transition: opacity .9s ease; }
/* Without JS there is no camera: the illustration would only ever cover the
   panel, so it never renders. */
.scene-img, .scene-screen { display: none; }
.armed .scene-img, .armed .scene-screen { display: block; }

/* -------------------------------------------------------------------- panel */

.panel {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--bd);
    border-radius: 13px;
    overflow: hidden;
    box-shadow: var(--sh-panel);
    transition: box-shadow .55s var(--e-soft);
}
.armed .stage.landed .panel { box-shadow: var(--sh-lift); }

/* Only one run is shown at a time; without JS every run renders in full. */
.armed .run { display: none; }
.armed .run.is-active { display: block; }
.run + .run { border-top: 1px solid var(--divider); }
.armed .run + .run { border-top: 0; }

/* --- question row --- */
.q-row { padding: 22px 24px 6px; }
.q-label {
    font-size: 12.5px;
    font-weight: 640;
    letter-spacing: .02em;
    color: var(--teal);
    display: block;
    margin-bottom: 6px;
}
.q-text {
    font-size: 24px;
    line-height: 1.28;
    letter-spacing: -.015em;
    font-weight: 600;
    color: var(--ink);
    min-height: 34px;
}
.q-placeholder { color: var(--ink-ph); font-weight: 500; display: none; }
.q-typed, .q-caret { display: none; }
.armed .q-full { display: none; }
.armed .run.typing .q-typed { display: inline; }
.armed .run.typing .q-caret {
    display: inline-block;
    width: 2px;
    height: 1.05em;
    background: var(--teal);
    vertical-align: -.14em;
    margin-left: 2px;
    animation: cr-blink 1s step-end infinite;
}
.armed .run.rest .q-placeholder { display: inline; }
.armed .run.answered .q-full { display: inline; }
@keyframes cr-blink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }

/* --- sources --- */
.src-block { padding: 14px 24px 4px; }
.src-toggle {
    font: inherit;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: var(--surface-tint);
    border: 1px solid var(--bd);
    border-radius: 10px;
    padding: 11px 14px;
    cursor: pointer;
    text-align: left;
    transition: border-color .2s, background .2s;
}
.src-toggle:hover { border-color: var(--teal); background: #f1f7fc; }
.src-toggle-label { font-size: 13.5px; font-weight: 600; color: var(--navy); }
.src-toggle-action { font-size: 12.5px; color: var(--ink-soft); flex: none; }
.src-wrap { overflow: hidden; }
.armed .src-wrap { max-height: 0; transition: max-height .6s var(--e-soft); }
.src-list { list-style: none; display: grid; gap: 9px; padding-top: 10px; }
.src-card {
    display: flex;
    gap: 13px;
    padding: 13px 15px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--card-bd);
    box-shadow: var(--sh-card);
    transition: opacity .7s ease, transform .7s var(--e-soft),
                border-color .3s, box-shadow .3s;
}
.armed .src-card { opacity: 0; transform: translateY(16px); }
.armed .src-card.shown { opacity: 1; transform: none; }
.src-badge {
    flex: none;
    width: 23px; height: 23px;
    border-radius: 6px;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 660;
    font-variant-numeric: tabular-nums;
    background: var(--chip-bg);
    color: var(--navy);
    transition: background .3s, color .3s;
}
.src-body { min-width: 0; }
.src-meta { display: block; font-size: 12.5px; color: var(--ink-soft); margin-bottom: 6px; }
.src-meta b { color: var(--navy); font-weight: 620; }
.src-quote {
    display: block;
    font-size: 15px;
    line-height: 1.45;
    color: var(--ink-quote);
    border-left: 2px solid var(--teal);
    padding-left: 11px;
    text-wrap: pretty;
}
.src-card.active { border-color: var(--teal); box-shadow: 0 0 0 3px var(--ring); }
.src-card.active .src-badge { background: var(--teal); color: #fff; }

/* --- answer --- */
.ans-block { overflow: hidden; }
.armed .ans-block { transition: min-height .6s var(--e-soft); }
.ans-inner { padding: 18px 24px 24px; transition: opacity .55s ease; }
.armed .run.hushed .ans-inner { opacity: 0; }
.ans-label {
    display: block;
    font-size: 12.5px;
    font-weight: 640;
    color: var(--teal);
    margin-bottom: 10px;
}
.ans-p { font-size: 17px; line-height: 1.62; color: var(--ink-body); max-width: 66ch; text-wrap: pretty; }
.ans-p + .ans-p { margin-top: 16px; }
.armed .w { opacity: 0; transition: opacity .22s linear; }
.armed .w.shown { opacity: 1; }

.cite {
    font: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    margin: 0 3px 0 1px;
    vertical-align: 1px;
    font-size: 12px;
    font-weight: 660;
    font-variant-numeric: tabular-nums;
    border-radius: 5px;
    border: 1px solid var(--cite-bd);
    background: var(--cite-bg);
    color: var(--teal-ink);
    cursor: pointer;
    transition: opacity .3s ease, transform .3s ease,
                background .18s, color .18s, border-color .18s;
}
.cite:hover { background: var(--teal); color: #fff; border-color: var(--teal); }
.cite.active { background: var(--teal); color: #fff; border-color: var(--teal); }
.armed .cite { opacity: 0; transform: translateY(3px); }
.armed .cite.shown { opacity: 1; transform: none; }

.done-row {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--divider);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
}
.armed .done-row { visibility: hidden; opacity: 0; transition: opacity .4s ease; }
.armed .run.answered .done-row { visibility: visible; opacity: 1; }
.replay {
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 16px;
    border-radius: 9px;
    background: var(--navy);
    color: #fff;
    border: 1px solid var(--navy);
    cursor: pointer;
    transition: background .18s, box-shadow .18s;
}
.replay:hover { background: var(--navy-hover); box-shadow: 0 4px 12px rgba(6,47,87,.2); }
.done-note { font-size: 13.5px; color: var(--ink-soft); }

/* --------------------------------------------------------------- narration */

.narration {
    background: var(--surface);
    border: 1px solid var(--bd);
    border-radius: 13px;
    padding: 14px 18px;
    margin: 12px 0 44px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 18px;
    box-shadow: var(--sh-card);
}
.narration-main { flex: 1; min-width: 220px; }
.caption { font-size: 14px; font-weight: 600; line-height: 1.4; color: var(--navy); margin-bottom: 8px; }
.track { height: 3px; border-radius: 2px; background: var(--track); overflow: hidden; }
.track-fill { display: block; height: 100%; width: 0; background: var(--teal); transition: width .5s linear; }
.counter-wrap { text-align: right; }
.armed .counter-wrap { opacity: 0; transition: opacity .4s ease; }
.armed .counter-wrap.on { opacity: 1; }
.counter {
    display: block;
    font-size: 19px;
    font-weight: 640;
    letter-spacing: -.02em;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}
.counter-label { font-size: 11.5px; color: var(--ink-soft); }

/* ------------------------------------------------------------------- trust */

.trust {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    background: var(--rule);
    border: 1px solid var(--rule);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 56px;
}
.trust-cell { background: var(--surface-tint); padding: 18px 20px; }
.trust-v {
    display: block;
    font-size: 26px;
    font-weight: 660;
    letter-spacing: -.025em;
    color: var(--navy);
    font-variant-numeric: tabular-nums;
}
.trust-l { font-size: 13px; color: var(--ink-soft); margin-top: 3px; display: block; }

/* ------------------------------------------------------------------- tools */

.tools {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 44px;
    align-items: start;
    padding-bottom: 56px;
}
.tools h2 { font-size: 28px; line-height: 1.15; letter-spacing: -.02em; font-weight: 660; color: var(--navy-deep); }
.tools p { font-size: 16.5px; line-height: 1.55; color: var(--ink-sub); max-width: 52ch; margin-top: 12px; }
.cta {
    display: inline-block;
    margin-top: 20px;
    font-size: 14.5px;
    font-weight: 620;
    padding: 12px 20px;
    border-radius: 9px;
    background: var(--navy);
    color: #fff;
    text-decoration: none;
    transition: background .18s, box-shadow .18s;
}
.cta:hover { background: var(--navy-hover); text-decoration: none; box-shadow: 0 4px 14px rgba(6,47,87,.22); }
.faq {
    display: grid;
    gap: 1px;
    background: var(--rule);
    border: 1px solid var(--rule);
    border-radius: 12px;
    overflow: hidden;
}
.faq-cell { background: var(--surface); padding: 18px 20px; }
.faq-q { font-size: 15px; font-weight: 620; color: var(--ink); margin-bottom: 7px; }
.faq-a { font-size: 14px; line-height: 1.55; color: var(--ink-muted); }

/* ------------------------------------------------------------------ footer */

.site-foot {
    border-top: 1px solid var(--rule);
    padding: 24px 0 40px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}
.site-foot p { font-size: 13px; line-height: 1.6; color: var(--ink-soft); max-width: 62ch; }
.site-foot span { font-size: 13px; color: var(--ink-soft); }

/* ------------------------------------------------------------- breakpoints */

@media (max-width: 900px) {
    .hero h1 { font-size: 38px; }
    .tools { grid-template-columns: 1fr; gap: 30px; }
}
@media (max-width: 760px) {
    .trust { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .shell { padding: 0 16px; }
    .hero h1 { font-size: 31px; }
    .hero-sub { font-size: 16.5px; }
    .q-text { font-size: 20px; }
    .q-row { padding: 18px 16px 6px; }
    .src-block { padding: 12px 16px 4px; }
    .ans-inner { padding: 16px 16px 20px; }
    .ans-p { font-size: 16px; }
    .chip { font-size: 14px; }
}

/* Reduced motion: a chip click lands straight on the answered state. */
@media (prefers-reduced-motion: reduce) {
    .armed .stage, .armed .scene, .armed .src-wrap, .armed .ans-block,
    .armed .src-card, .armed .w, .armed .cite, .armed .panel {
        transition: none !important;
    }
    .armed .q-caret { animation: none !important; }
}
