/* Election Letters Project */
:root {
  --ground: #F3F5F8; --paper: #FFFFFF; --ink: #14233B; --soft: #2C3B55; --muted: #46536A;
  --line: #C9D2DE; --field: #8C9AB0; --red: #B3261E; --blue: #1F4E8C; --lock: #E9EDF2; --lockink: #5B667A;
}
html { font-size: 100%; -webkit-text-size-adjust: 100%; }
html.ts-2 { font-size: 118%; }
html.ts-3 { font-size: 137%; }
html.hc { --ground: #FFFFFF; --ink: #000000; --soft: #000000; --muted: #000000; --line: #000000; --field: #000000; --red: #000000; --blue: #000000; --lock: #FFFFFF; --lockink: #000000; }
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--ink); background: var(--ground); line-height: 1.5; }
a { color: var(--blue); }
a:hover { color: var(--ink); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #E0A100; outline-offset: 2px; }
html.hc :focus-visible { outline-color: #000; outline-style: dashed; }
[hidden] { display: none !important; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.wrap.narrow { max-width: 760px; }
.wrap.mid { max-width: 900px; }
.small { font-size: 0.94rem; }
.muted { color: var(--muted); }
.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: 10px 14px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }

/* ---- header ---- */
.bar { background: var(--ink); color: #fff; font-size: 0.875rem; }
.bar-in { display: flex; flex-wrap: wrap; gap: 0 20px; align-items: center; justify-content: space-between; padding-top: 2px; padding-bottom: 2px; }
.share { display: flex; flex-wrap: wrap; gap: 0 16px; align-items: center; }
.share-label { font-weight: 600; }
.bar a, .site-foot a { color: #fff; display: inline-flex; align-items: center; min-height: 44px; }
.free { font-weight: 600; }
.stripe { height: 8px; background: repeating-linear-gradient(135deg, #B3261E 0 16px, #FFFFFF 16px 32px, #1F4E8C 32px 48px, #FFFFFF 48px 64px); }
html.hc .stripe { background: #000; height: 4px; }
.brand-row { background: var(--paper); border-bottom: 1px solid var(--line); }
.brand-in { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; padding-top: 14px; padding-bottom: 14px; }
.brand { flex: 1 1 260px; min-width: 0; }
.brand a { font-family: 'Zilla Slab', Georgia, serif; font-weight: 700; font-size: 1.75rem; color: var(--ink); text-decoration: none; }
.counter { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.digits { display: flex; gap: 3px; }
.digits span { background: var(--ink); color: #fff; font-family: 'Zilla Slab', Georgia, serif; font-weight: 700; font-size: 1.375rem; width: 24px; height: 34px; display: flex; align-items: center; justify-content: center; border-radius: 3px; }
.digits span:last-child { background: var(--red); }
/* Rolling wheels shown until the real count is displayed */
.digits.rolling span { display: block; overflow: hidden; position: relative; }
.digits.rolling b { display: block; font-weight: 700; line-height: 34px; text-align: center; animation: el-roll 9s linear infinite; }
.digits.rolling i { display: none; font-style: normal; line-height: 34px; text-align: center; }
.digits.rolling span:nth-child(1) b { animation-duration: 23s; }
.digits.rolling span:nth-child(2) b { animation-duration: 17s; animation-delay: -4s; }
.digits.rolling span:nth-child(3) b { animation-duration: 13s; animation-delay: -7s; }
.digits.rolling span:nth-child(4) b { animation-duration: 9s; animation-delay: -2s; }
.digits.rolling span:nth-child(5) b { animation-duration: 6s; animation-delay: -3s; }
.digits.rolling span:nth-child(6) b { animation-duration: 3.5s; animation-delay: -1s; }
@keyframes el-roll { from { transform: translateY(0); } to { transform: translateY(-340px); } }
@media (prefers-reduced-motion: reduce) {
  .digits.rolling b { display: none; }
  .digits.rolling i { display: block; }
}
.counter-label { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.reading { flex: 1 1 260px; min-width: 0; display: flex; flex-wrap: wrap; gap: 5px; align-items: center; justify-content: flex-end; }
.reading-label { font-size: 0.8125rem; font-weight: 600; margin: 0 3px 0 10px; }
.langlink { font-size: 0.875rem; font-weight: 600; padding: 6px 4px; }
.reading button { font-weight: 700; height: 32px; min-width: 32px; padding: 0 6px; border-radius: 5px; border: 2px solid var(--line); background: var(--paper); color: var(--ink); font-size: 13px; }
.reading .ts2 { font-size: 16px; }
.reading .ts3 { font-size: 20px; }
.reading #contrast { padding: 0 10px; }
.reading button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---- step buttons ---- */
.steps { list-style: none; margin: 0; padding: 24px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.steps button { min-height: 44px; padding: 0 14px; border-radius: 4px; font-size: 0.94rem; background: var(--paper); color: var(--muted); border: 1px solid var(--line); }
.steps button[aria-current] { background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 700; }

/* ---- shared pieces ---- */
h1, h2.big, .card > h2, .prose h1, .prose h2, .count { font-family: 'Zilla Slab', Georgia, serif; font-weight: 700; }
h1 { font-size: 2.75rem; line-height: 1.1; margin: 0; }
h1:focus { outline: none; }
.step { padding-bottom: 56px; }
.step > .wrap { padding-top: 36px; }
.step > .wrap + .wrap { padding-top: 0; }
.lead { font-size: 1.125rem; color: var(--soft); margin: 12px 0 24px; }
.lead.first { margin-top: 0; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 22px 24px; margin-bottom: 24px; }
.card > h2 { font-size: 1.5rem; margin: 0 0 10px; }
.card p { margin: 6px 0 10px; }
label, label.h { display: block; font-weight: 700; margin-bottom: 6px; }
label.h { font-size: 1.25rem; margin-bottom: 2px; }
label.h.gap { margin-top: 20px; }
input[type="text"], select, textarea { width: 100%; min-height: 48px; padding: 10px 12px; border: 2px solid var(--field); border-radius: 6px; background: var(--paper); font-size: 1.06rem; }
textarea { line-height: 1.5; resize: vertical; }
.two { display: flex; flex-wrap: wrap; gap: 16px 32px; }
.two > div { flex: 1 1 260px; min-width: 0; }
.split-head { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: baseline; justify-content: space-between; }
.row { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-top: 12px; }
.cta { background: var(--red); color: #fff; font-weight: 700; font-size: 1.06rem; border: 2px solid var(--red); padding: 12px 24px; border-radius: 6px; min-height: 48px; }
.ghost { background: var(--paper); color: var(--ink); font-weight: 700; border: 2px solid var(--ink); padding: 8px 18px; border-radius: 6px; min-height: 44px; }
.back { background: none; border: 0; color: var(--blue); font-weight: 700; font-size: 1.06rem; padding: 12px 4px; text-decoration: underline; min-height: 44px; }
.nav { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; }
.status { font-weight: 600; min-height: 1.5em; margin: 10px 0 4px; }
.warn { color: var(--red); font-weight: 700; margin-top: 6px; }

/* ---- step 1 ---- */
.hero h1 { font-size: 3rem; line-height: 1.05; max-width: 820px; }
.hero p { font-size: 1.125rem; line-height: 1.55; max-width: 860px; color: var(--soft); margin: 14px 0 0; }
.hero { padding-bottom: 24px; }
.concerns { padding-top: 12px !important; padding-bottom: 12px; }
h2.big { font-size: 2.125rem; margin: 0; }
.rule-line { font-size: 1.06rem; font-weight: 600; }
.grp { margin-top: 20px; }
.grp h3, #fonts h3 { margin: 0 0 8px; font-size: 0.875rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--red); }
.grp h3 label { display: inline; margin: 0; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 900px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .cards { grid-template-columns: minmax(0, 1fr); } }
.issue { font-size: 0.94rem; font-weight: 600; line-height: 1.25; text-align: left; min-height: 44px; padding: 4px 10px; border-radius: 6px; display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--paper); color: var(--ink); border: 2px solid var(--line); }
.issue[aria-pressed="true"], .chip { background: var(--ink); color: #fff; border-color: var(--ink); }
.issue.locked { background: var(--lock); color: var(--lockink); }
.mark { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; flex-shrink: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chips:empty { margin: 0; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 2px 12px; border-radius: 6px; font-size: 0.94rem; font-weight: 600; border: 2px solid var(--ink); }
.chip.over { background: var(--lock); color: var(--lockink); border-color: var(--line); }
.next { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; margin-top: 12px; }
.count { font-size: 1.5rem; }

/* ---- step 2 ---- */
.lengths { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.lengths button { text-align: left; padding: 10px 14px; min-height: 60px; border-radius: 6px; background: var(--paper); border: 2px solid var(--line); }
.lengths button strong, .lengths button span { display: block; }
.lengths button span { font-size: 0.875rem; }
.lengths button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---- step 3 ---- */
#prompt { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.875rem; line-height: 1.55; background: var(--ground); border: 1px solid var(--line); border-radius: 6px; padding: 16px; max-height: 420px; overflow: auto; }
h3.plain { margin: 22px 0 2px; font-size: 1.06rem; }
.assistants { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.assistants button { font-weight: 700; font-size: 0.94rem; min-height: 48px; padding: 8px 4px; border-radius: 6px; border: 2px solid var(--line); background: var(--paper); }

/* ---- step 4 ---- */
h1.inner { font-size: 1.875rem; margin: 0 0 12px; }
h1.inner label { font: inherit; margin: 0; }
.src { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; margin-bottom: 8px; }
.src.rejected, .src.dead { border-style: dashed; }
.src-text { min-width: 0; flex: 1 1 300px; }
.src-title { font-weight: 700; overflow-wrap: anywhere; }
.badge { font-size: 0.8125rem; font-weight: 700; padding: 4px 10px; border-radius: 4px; border: 1px solid #14532D; color: #14532D; background: #E3F1E7; }
.src.unconfirmed .badge, .src.checking .badge { border-color: #6B4E00; color: #6B4E00; background: #FFF4D6; }
.src.rejected .badge, .src.dead .badge { border-color: #7A1A14; color: #7A1A14; background: #FBE9E7; border-style: dashed; }
html.hc .badge { border-color: #000 !important; color: #000 !important; background: #fff !important; }
.confirm { font-weight: 600; margin: 6px 0 0; display: flex; gap: 8px; align-items: center; min-height: 44px; }
.confirm input { width: 20px; height: 20px; }

/* ---- step 5 ---- */
.s5 { display: flex; flex-wrap: wrap; gap: 28px 32px; align-items: flex-start; padding-top: 32px; }
.s5 h2 { font-size: 1.125rem; margin: 0 0 10px; }
.el-h, .el-paper, .below { flex: 1 1 100%; min-width: 0; }
.controls { flex: 1 1 380px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.el-letter { flex: 999 1 520px; min-width: 0; }
.below { order: 1; border-top: 2px solid var(--line); padding-top: 32px; display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-start; }
.below > * { flex: 1 1 380px; min-width: 0; margin: 0; }
@media (max-width: 1010px) { .el-h { order: -3; } .el-paper { order: -2; } .el-letter { order: -1; } }
.opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.opts.wide { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.opts.fontgrid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; margin-bottom: 12px; }
.opts button { font-size: 0.94rem; font-weight: 600; text-align: left; min-height: 48px; padding: 6px 12px; border-radius: 6px; background: var(--paper); border: 2px solid var(--line); }
.fontgrid button { font-weight: 400; min-height: 44px; padding: 4px 10px; line-height: 1.15; }
.opts button[aria-pressed="true"], .tabs button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.opts button.blocked { background: var(--lock); color: var(--lockink); cursor: not-allowed; }
.inks { display: flex; flex-wrap: nowrap; gap: 12px; padding: 3px; }
.inks button { flex: 0 0 auto; width: 34px; height: 34px; padding: 0; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 3px var(--line); }
.inks button[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--ink); }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 auto 12px; max-width: 660px; }
.tabs button { font-size: 0.875rem; font-weight: 600; min-height: 40px; padding: 4px 12px; border-radius: 6px; background: var(--paper); border: 2px solid var(--line); }
.el-letter > p { max-width: 660px; margin: 14px auto 0; }
.note-demo { margin-top: 12px; min-height: 96px; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 6px; display: flex; align-items: center; justify-content: center; text-align: center; line-height: 1.2; overflow-wrap: anywhere; }
.printcard .back { padding-left: 0; text-align: left; }

/* ---- printed sheets: 816 x 1056 px is exactly 8.5 x 11 inches ---- */
#sheets { --scale: 1; max-width: 660px; margin: 0 auto; }
.sheet-wrap { width: calc(816px * var(--scale)); height: calc(1056px * var(--scale)); margin-bottom: 16px; box-shadow: 0 2px 14px rgba(20, 35, 59, 0.18); overflow: hidden; }
.sheet { position: relative; width: 816px; height: 1056px; overflow: hidden; background: #fff; color: #14233B; transform: scale(var(--scale)); transform-origin: 0 0; font-family: 'Public Sans', sans-serif; }
#sheets.view-letter .sheet-wrap:not(.is-letter), #sheets.view-m1 .sheet-wrap:not(.is-mailer1), #sheets.view-m2 .sheet-wrap:not(.is-mailer2) { display: none; }
.sheet, .sheet * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

.letter-body { position: absolute; right: 72px; display: flex; flex-direction: column; overflow: hidden; }
.letter-body p { margin: 0; overflow-wrap: anywhere; }
.margin-line { position: absolute; top: 0; bottom: 0; left: 120px; width: 2px; background: rgba(196, 60, 60, 0.55); }
.smudge { position: absolute; border-radius: 60% 40% 55% 45% / 50% 60% 40% 50%; filter: blur(5px); }
.doodle { position: absolute; overflow: visible; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.coffee-ring { position: absolute; right: 70px; bottom: 110px; width: 190px; height: 190px; border-radius: 50%; border: 6px solid rgba(110, 72, 40, 0.26); box-shadow: 0 0 0 2px rgba(110, 72, 40, 0.1), inset 0 0 16px rgba(110, 72, 40, 0.16); transform: rotate(-12deg) scaleX(0.97); }
.coffee-drop { position: absolute; border-radius: 55% 45% 50% 50% / 50% 55% 45% 50%; background: rgba(110, 72, 40, 0.3); box-shadow: 0 0 0 1px rgba(110, 72, 40, 0.12); }

.mailer1 .panel { position: absolute; left: 0; width: 816px; height: 352px; }
.mailer1 .p-top { top: 0; padding: 44px 64px 0; }
.mailer1 .p-mid { top: 352px; }
.mailer1 .p-bot { top: 704px; padding: 0 80px; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 50px; line-height: 1.15; overflow-wrap: anywhere; }
.mailer1 .m-title { font-family: 'Zilla Slab', Georgia, serif; font-weight: 700; font-size: 24px; }
.mailer1 ol { margin: 12px 0 0; padding-left: 24px; font-size: 16px; line-height: 1.42; }
.mailer1 li { margin-bottom: 6px; }
.mailer1 .fold { position: absolute; width: 28px; border-top: 2px dashed #8C9AB0; }
.mailer1 .l1 { left: 0; top: 351px; } .mailer1 .r1 { right: 0; top: 351px; }
.mailer1 .l2 { left: 0; top: 703px; } .mailer1 .r2 { right: 0; top: 703px; }
.mailer1 .lines { position: absolute; display: flex; flex-direction: column; }
.mailer1 .lines div { border-top: 1.5px solid #14233B; }
.mailer1 .ret { left: 56px; top: 40px; width: 250px; gap: 28px; padding-top: 28px; }
.mailer1 .to { left: 270px; top: 170px; width: 350px; gap: 36px; padding-top: 36px; }
.mailer1 .stamp { position: absolute; right: 56px; top: 40px; width: 116px; height: 124px; border: 2px dashed #14233B; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 16px; font-weight: 600; line-height: 1.25; }

.mailer2 { padding: 52px 64px; font-size: 16px; line-height: 1.45; display: flex; flex-direction: column; gap: 12px; }
.mailer2 h1 { font-family: 'Zilla Slab', Georgia, serif; font-size: 30px; line-height: 1.15; margin: 0; }
.mailer2 h2 { font-family: 'Zilla Slab', Georgia, serif; font-size: 24px; line-height: 1.15; margin: 8px 0 0; padding-top: 12px; border-top: 2px solid #14233B; }
.mailer2 p { margin: 0; }
.mailer2 .srow { display: flex; gap: 16px; align-items: flex-start; line-height: 1.3; }
.mailer2 .qr { flex: 0 0 48px; width: 48px; height: 48px; }
.mailer2 .qr svg { display: block; width: 48px; height: 48px; }
.mailer2 .stext { min-width: 0; }
.mailer2 .st { font-weight: 700; }
.mailer2 .surl { overflow-wrap: anywhere; font-size: 14px; }
.mailer2 .closing { margin-top: auto; }

/* ---- text pages ---- */
.prose { max-width: 760px; padding-top: 40px; padding-bottom: 56px; font-size: 1.06rem; line-height: 1.6; }
.prose h1 { margin-bottom: 12px; }
.prose h2 { font-size: 1.625rem; margin: 36px 0 8px; }
.prose p { margin: 0 0 12px; }
.prose ul, .prose ol { margin: 0 0 12px; padding-left: 24px; }
.prose li { margin-bottom: 4px; }
.prose .cta { display: inline-block; text-decoration: none; margin-top: 16px; }

/* ---- footer ---- */
.site-foot { background: var(--ink); color: #fff; font-size: 0.875rem; }
.foot-in { display: flex; flex-wrap: wrap; gap: 8px 32px; justify-content: space-between; padding-top: 20px; padding-bottom: 20px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 0 16px; }
.foot-in p { flex-basis: 100%; margin: 0; }

/* ---- printing: only the sheets, at true size ---- */
@page { size: letter; margin: 0; }
@media print {
  html, body { background: #fff !important; font-size: 16px !important; }
  .np { display: none !important; }
  .pchain { display: block !important; margin: 0 !important; padding: 0 !important; max-width: none !important; border: 0 !important; }
  .step[hidden] { display: none !important; }
  #sheets { max-width: none; margin: 0; --scale: 1 !important; }
  #sheets .sheet-wrap { display: block !important; width: 816px; height: 1056px; margin: 0; box-shadow: none; break-after: page; page-break-after: always; }
  #sheets .sheet-wrap:last-child { break-after: auto; page-break-after: auto; }
  #sheets .sheet { transform: none; }
}
