/* America petition - one stylesheet for the whole petition.
   Toolpop's own stylesheet loads first on state pages; everything here that
   touches the dialog is scoped to .toolpop.am-sign (the tool's css_class). */

:root {
  --am-navy: #13294b;
  --am-navy-2: #1d3f72;
  --am-red: #b22234;
  --am-ink: #172033;
  --am-muted: #5b6577;
  --am-line: #dfe4ec;
  --am-field: #c3cbd8;
  --am-soft: #f3f5f9;
  --am-tint: #eef3fb;
  --am-yes: #1d3f72;
  --am-no: #8f99ab;
  --am-radius: 14px;
  --am-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 6px 18px rgba(16, 24, 40, .07);
  --am-serif: Georgia, "Times New Roman", Times, serif;
  --am-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --am-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.2 8.6l3.1 3.1 6.5-7.4' fill='none' stroke='%23ffffff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--am-sans); color: var(--am-ink); background: #fff; line-height: 1.5; }
img { max-width: 100%; height: auto; }
a { color: var(--am-navy-2); }
[hidden] { display: none !important; }

.am-skip { position: absolute; left: -9999px; top: .75rem; z-index: 50; background: #fff; color: var(--am-navy); padding: .5rem .8rem; border-radius: 8px; }
.am-skip:focus { left: .75rem; }

.am-wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* ── header ─────────────────────────────────────────────────────────────── */
.am-top { background: var(--am-navy); color: #fff; border-bottom: 4px solid var(--am-red); }
.am-top__inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 56px; }
.am-brand { display: inline-flex; align-items: center; gap: .5rem; color: #fff; text-decoration: none; font-weight: 800; font-size: 1.15rem; letter-spacing: .03em; }
.am-brand__mark { width: 22px; height: 22px; fill: #fff; }
.am-top__tag { font-size: .85rem; opacity: .85; text-align: right; }

/* ── shared ─────────────────────────────────────────────────────────────── */
.am-eyebrow { margin: 0 0 .5rem; font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--am-red); }
.am-h1, .am-h2 { font-family: var(--am-serif); color: var(--am-navy); }
.am-h2 { font-size: 1.6rem; margin: 0 0 1rem; }
.am-text { margin: 0 0 1.25rem; font-size: 1.05rem; max-width: 38rem; }
.am-btn { display: inline-flex; align-items: center; justify-content: center; padding: .75rem 1.2rem; border-radius: 10px; border: 1px solid transparent; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; }
.am-btn--primary { background: var(--am-navy); color: #fff; }
.am-btn--primary:hover { background: var(--am-navy-2); }
.am-btn:focus-visible, .am-tile:focus-visible, .am-choice:focus-visible, .am-pager__link:focus-visible { outline: 3px solid rgba(29, 63, 114, .4); outline-offset: 2px; }
.am-note { padding: .75rem 1rem; border-radius: 10px; background: #fff7e6; border: 1px solid #f3d9a4; }

/* Yes / No split bar (inline SVG; widths are attributes) */
.am-bar { display: block; width: 100%; height: 8px; border-radius: 999px; overflow: hidden; }
.am-bar__yes { fill: var(--am-yes); }
.am-bar__no { fill: var(--am-no); }
.am-bar__empty { fill: #e5e9f0; }

/* ── core page ──────────────────────────────────────────────────────────── */
.am-hero { background: linear-gradient(180deg, #f2f5fa 0%, #fff 100%); border-bottom: 1px solid var(--am-line); }
.am-hero__inner { display: grid; grid-template-columns: 1.05fr .95fr; gap: 40px; align-items: center; padding-top: 48px; padding-bottom: 48px; }
.am-hero__q { margin: 0 0 .75rem; font-family: var(--am-serif); font-size: clamp(2.1rem, 4.6vw, 3.4rem); line-height: 1.08; color: var(--am-navy); }
.am-hero__sub { margin: 0 0 1.5rem; font-size: 1.1rem; color: var(--am-muted); max-width: 34rem; }
.am-hero__media { margin: 0; }
.am-hero__media img { display: block; width: 100%; border-radius: var(--am-radius); box-shadow: var(--am-shadow); }

.am-jump { max-width: 30rem; }
.am-jump__label { display: block; font-weight: 700; margin-bottom: .4rem; }
.am-jump__row { display: flex; gap: .5rem; }
.am-jump select { flex: 1; min-width: 0; padding: .75rem .8rem; font: inherit; font-size: 1rem; color: var(--am-ink); border: 1px solid var(--am-field); border-radius: 10px; background: #fff; }
.am-jump select:focus { outline: none; border-color: var(--am-navy-2); box-shadow: 0 0 0 3px rgba(29, 63, 114, .18); }

.am-tally { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 28px; }
.am-tally__item { background: #fff; border: 1px solid var(--am-line); border-radius: 12px; padding: 14px 16px; box-shadow: var(--am-shadow); }
.am-tally__num { display: block; font-size: 1.65rem; font-weight: 800; color: var(--am-navy); font-variant-numeric: tabular-nums; line-height: 1.2; }
.am-tally__label { font-size: .85rem; color: var(--am-muted); }
.am-tally__item--no .am-tally__num { color: #5f6b80; }
.am-tally__bar { grid-column: 1 / -1; }

.am-states { padding-top: 40px; padding-bottom: 56px; }
.am-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.am-grid > li { display: flex; }
.am-tile { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .2rem; padding: 14px 12px 12px; background: #fff; border: 1px solid var(--am-line); border-radius: 12px; text-decoration: none; color: var(--am-ink); transition: border-color .15s, box-shadow .15s, transform .15s; }
.am-tile:hover { border-color: var(--am-navy-2); box-shadow: var(--am-shadow); transform: translateY(-2px); }
.am-tile__shape { display: flex; align-items: center; justify-content: center; width: 100%; height: 92px; margin-bottom: .35rem; }
.am-tile__shape img { width: 100%; height: 92px; object-fit: contain; }
.am-tile__name { font-weight: 700; text-align: center; line-height: 1.2; }
.am-tile__meta { font-size: .8rem; color: var(--am-muted); margin-bottom: .45rem; }
.am-tile .am-bar { margin-top: auto; height: 6px; }

/* ── state page ─────────────────────────────────────────────────────────── */
.am-crumbs { padding-top: 18px; font-size: .9rem; color: var(--am-muted); display: flex; gap: .45rem; }
.am-state { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 48px; align-items: center; padding: 24px 0 40px; }
.am-state__media { margin: 0; position: relative; padding: 28px; border-radius: 24px; background: radial-gradient(circle at 50% 45%, var(--am-tint) 0%, #fff 72%); }
.am-state__shape { display: block; width: 100%; height: auto; max-height: 440px; aspect-ratio: 1 / 1; object-fit: contain; }
.am-state__code { position: absolute; right: 20px; bottom: 14px; font-weight: 800; font-size: 1.1rem; letter-spacing: .14em; color: var(--am-red); }
.am-state__q { margin: 0 0 1rem; font-family: var(--am-serif); font-size: clamp(2.1rem, 4.2vw, 3.1rem); line-height: 1.08; color: var(--am-navy); }

.am-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 28rem; margin: 1.25rem 0 .6rem; }
.am-choice { display: flex; align-items: center; gap: .8rem; padding: 1rem 1.1rem; border: 2px solid var(--am-field); border-radius: 14px; background: #fff; font: inherit; font-size: 1.35rem; font-weight: 800; color: var(--am-ink); cursor: pointer; text-align: left; transition: border-color .15s, background-color .15s; }
.am-choice:hover { border-color: var(--am-navy-2); }
.am-choice__box { flex: 0 0 auto; width: 28px; height: 28px; border: 2px solid #7a869a; border-radius: 6px; background: #fff no-repeat center / 18px 18px; }
.am-choice[aria-pressed="true"] { border-color: var(--am-navy); background-color: var(--am-tint); }
.am-choice[aria-pressed="true"] .am-choice__box { border-color: var(--am-navy); background-color: var(--am-navy); background-image: var(--am-check); }
.am-hint { margin: .25rem 0 1.5rem; color: var(--am-muted); font-size: .95rem; max-width: 30rem; }

.am-count { display: grid; grid-template-columns: auto auto 1fr; gap: 6px 22px; align-items: end; max-width: 28rem; padding-top: 1rem; border-top: 1px solid var(--am-line); }
.am-count__num { display: block; font-size: 1.55rem; font-weight: 800; color: var(--am-navy); font-variant-numeric: tabular-nums; line-height: 1.2; }
.am-count__label { font-size: .85rem; color: var(--am-muted); }
.am-count__cell--no .am-count__num { color: #5f6b80; }
.am-count__bar { grid-column: 1 / -1; padding-top: 4px; }

.am-pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 0 40px; border-top: 1px solid var(--am-line); }
.am-pager__link { text-decoration: none; color: var(--am-navy-2); font-weight: 700; }
.am-pager__all { color: var(--am-muted); font-weight: 600; }

/* ── footer, not-found, error ───────────────────────────────────────────── */
.am-foot { background: var(--am-soft); border-top: 1px solid var(--am-line); padding: 28px 0; color: var(--am-muted); font-size: .9rem; }
.am-foot p { margin: 0 0 .5rem; max-width: 52rem; }
.am-foot__small { font-size: .8rem; }
.am-empty { padding-top: 48px; padding-bottom: 48px; }
.am-links { columns: 3 12rem; padding-left: 1.1rem; }
.am-ref { color: var(--am-muted); font-size: .85rem; }
.am-debug { white-space: pre-wrap; background: #fff3f3; border: 1px solid #f1c0c0; padding: 12px; border-radius: 8px; font-size: .85rem; }

/* ══ The sign dialog (toolpop tool "sign", css_class am-sign) ══════════════ */
.toolpop.am-sign { font-family: var(--am-sans); }
.toolpop.am-sign .toolpop__title { font-size: 1.05rem; }
.toolpop.am-sign .am-dlg-q { margin: 0 0 .9rem; font-family: var(--am-serif); font-size: 1.4rem; line-height: 1.2; font-weight: 700; color: var(--am-navy); }
.toolpop.am-sign .tp-sec + .tp-sec { margin-top: .6rem; }
.toolpop.am-sign .tp-field { margin-bottom: .9rem; }
.toolpop.am-sign .tp-field__label { font-size: .85rem; font-weight: 700; color: #3c4658; }

.toolpop.am-sign .tp-sec--form input[type="text"],
.toolpop.am-sign .tp-sec--form input[type="email"] {
  padding: .65rem .75rem; font-size: 1rem; border: 1px solid var(--am-field); border-radius: 10px;
}
.toolpop.am-sign .tp-sec--form input[type="text"]:focus,
.toolpop.am-sign .tp-sec--form input[type="email"]:focus {
  outline: none; border-color: var(--am-navy-2); box-shadow: 0 0 0 3px rgba(29, 63, 114, .18);
}

/* Yes / No: radios drawn as checkboxes (one answer, so radio semantics) */
.toolpop.am-sign .am-answers { flex-direction: row; flex-wrap: wrap; gap: .6rem; }
.toolpop.am-sign .am-answers > .tp-field__label { flex: 1 0 100%; }
.toolpop.am-sign .am-answers .tp-field__inline { flex: 1 1 0; min-width: 8rem; padding: .75rem .9rem; border: 2px solid var(--am-line); border-radius: 12px; font-size: 1.1rem; font-weight: 800; cursor: pointer; }
.toolpop.am-sign .am-answers .tp-field__inline:has(input:checked) { border-color: var(--am-navy); background: var(--am-tint); }
.toolpop.am-sign .am-answers input[type="radio"],
.toolpop.am-sign .am-resident input[type="checkbox"] {
  -webkit-appearance: none; appearance: none; flex: 0 0 auto; width: 22px; height: 22px; margin: 0;
  border: 2px solid #7a869a; border-radius: 5px; background: #fff no-repeat center / 14px 14px; cursor: pointer;
}
.toolpop.am-sign .am-answers input[type="radio"]:checked,
.toolpop.am-sign .am-resident input[type="checkbox"]:checked {
  border-color: var(--am-navy); background-color: var(--am-navy); background-image: var(--am-check);
}
.toolpop.am-sign .am-answers input:focus-visible,
.toolpop.am-sign .am-resident input:focus-visible,
.toolpop.am-sign .am-methods input:focus-visible { outline: 3px solid rgba(29, 63, 114, .4); outline-offset: 2px; }

/* How to sign: segmented pills */
.toolpop.am-sign .am-methods { flex-direction: row; flex-wrap: wrap; gap: .45rem; }
.toolpop.am-sign .am-methods > .tp-field__label { flex: 1 0 100%; }
.toolpop.am-sign .am-methods .tp-field__inline { padding: .45rem .85rem; border: 1px solid var(--am-field); border-radius: 999px; font-size: .92rem; font-weight: 600; cursor: pointer; }
.toolpop.am-sign .am-methods input { accent-color: var(--am-navy); margin: 0; }
@supports selector(:has(*)) {
  .toolpop.am-sign .am-methods .tp-field__inline { position: relative; }
  .toolpop.am-sign .am-methods input { position: absolute; opacity: 0; width: 1px; height: 1px; }
  .toolpop.am-sign .am-methods .tp-field__inline:has(input:checked) { background: var(--am-navy); border-color: var(--am-navy); color: #fff; }
  .toolpop.am-sign .am-methods .tp-field__inline:has(input:focus-visible) { outline: 3px solid rgba(29, 63, 114, .4); outline-offset: 2px; }
}

.toolpop.am-sign .am-resident .tp-field__inline { font-size: .98rem; font-weight: 600; cursor: pointer; }
.toolpop.am-sign .am-privacy { margin: 0; color: var(--am-muted); }

/* signature pad */
.am-sigpad { margin: .1rem 0 1rem; }
.am-sigpad__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .35rem; }
.am-sigpad__label { font-size: .85rem; font-weight: 700; color: #3c4658; }
.toolpop.am-sign .am-sigpad__clear { padding: .25rem .75rem; font-size: .82rem; }
.am-sigpad__canvas {
  display: block; width: 100%; height: auto; aspect-ratio: 3 / 1; touch-action: none; cursor: crosshair;
  border: 2px dashed #b9c2d0; border-radius: 12px;
  background: linear-gradient(to top, transparent 22%, #cfd6e1 22%, #cfd6e1 calc(22% + 1px), transparent calc(22% + 1px)), #fff;
}
.am-sigpad__canvas:focus-visible { outline: 3px solid rgba(29, 63, 114, .4); outline-offset: 2px; }
.am-sigpad.has-ink .am-sigpad__canvas { border-style: solid; border-color: #9aa6b8; }
.am-sigpad__hint { margin: .35rem 0 0; font-size: .78rem; color: var(--am-muted); }

/* validation: the message sits under its field; red wins over the focus ring */
.toolpop.am-sign .am-invalid input[type="text"],
.toolpop.am-sign .am-invalid input[type="email"],
.toolpop.am-sign .am-invalid input[type="text"]:focus,
.toolpop.am-sign .am-invalid input[type="email"]:focus,
.am-sigpad.am-invalid .am-sigpad__canvas { border-color: #b42318; box-shadow: 0 0 0 3px rgba(180, 35, 24, .16); }
.toolpop.am-sign .am-err { flex: 1 0 100%; margin: .15rem 0 0; color: #b42318; font-size: .85rem; font-weight: 600; }
.toolpop.am-sign .am-answers.am-invalid .tp-field__inline,
.toolpop.am-sign .am-resident.am-invalid .tp-field__inline { border-radius: 12px; box-shadow: 0 0 0 2px rgba(180, 35, 24, .45); }
.toolpop.am-sign .am-resident.am-invalid .tp-field__inline { padding: .25rem .4rem; }

/* actions */
.toolpop.am-sign .toolpop__actions { margin-top: .9rem; }
.toolpop.am-sign .tp-btn { border-radius: 10px; }
.toolpop.am-sign .tp-btn--primary { padding: .7rem 1.25rem; font-weight: 700; }

/* thank-you */
.am-thanks { text-align: center; padding: .25rem 0 0; }
.am-thanks__big { margin: 0 0 .35rem; font-family: var(--am-serif); font-size: 1.9rem; font-weight: 700; color: var(--am-navy); }
.am-thanks__big::before { content: ""; display: block; width: 58px; height: 58px; margin: 0 auto .7rem; border-radius: 50%; background: var(--am-navy) var(--am-check) no-repeat center / 30px 30px; }
.am-thanks__line { margin: 0 0 .25rem; font-size: 1.05rem; font-weight: 600; }
.am-thanks__num { margin: 0; color: var(--am-muted); }
.am-thanks .toolpop__actions { justify-content: center; }

/* ── responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .am-hero__inner { grid-template-columns: 1fr; gap: 24px; padding-top: 28px; padding-bottom: 28px; }
  .am-tally { grid-template-columns: repeat(2, 1fr); }
  .am-state { grid-template-columns: 1fr; gap: 16px; padding-top: 12px; }
  .am-state__media { max-width: 340px; width: 100%; margin: 0 auto; padding: 18px; }
}
@media (max-width: 520px) {
  .am-top__tag { display: none; }
  .am-grid { grid-template-columns: repeat(2, 1fr); }
  .am-choice { font-size: 1.2rem; padding: .85rem .9rem; }
  .am-count { grid-template-columns: 1fr 1fr; }
  .am-count__cell:nth-child(3) { grid-column: 1 / -1; }
  .am-pager { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  .am-tile, .am-choice { transition: none; }
  .am-tile:hover { transform: none; }
}
