/* ============================================================
   ballotintegrity.org — archival restoration
   Hand-rolled CSS system. No framework, no CDN, no webfonts.
   Visual concept: a civic document archive / records office.
   Palette: teal structure, antique gold rules, oatmeal paper.
   ============================================================ */

:root {
  /* Ground + ink */
  --paper:        #EFEDE3;
  --paper-deep:   #E4E1D3;
  --paper-tint:   #E9E5D6;
  --ink:          #1A1A18;
  --ink-soft:     #43433E;
  --ink-faint:    #6A6A62;

  /* Structure */
  --teal:         #2F5E5E;
  --teal-mid:     #3E7373;
  --teal-pale:    #6B8A96;

  /* Accent */
  --gold:         #C9971F;
  --gold-deep:    #9E7413;
  --gold-wash:    rgba(201, 151, 31, 0.14);

  /* Rules */
  --hair:         rgba(26, 26, 24, 0.22);
  --hair-soft:    rgba(26, 26, 24, 0.12);
  --hair-teal:    rgba(47, 94, 94, 0.28);

  /* Type */
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
           "Hoefler Text", Georgia, "Times New Roman", Times, serif;
  --sans:  "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto,
           "Helvetica Neue", "Lucida Grande", Arial, sans-serif;
  --mono:  ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
           "Liberation Mono", monospace;

  /* Rhythm */
  --measure: 40rem;      /* ~68ch at this body size */
  --wrap:    62rem;
  --gutter:  1.25rem;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 0;
  background-color: var(--paper);
  /* fine tally ruling drawn from a tally sheet — very low contrast */
  background-image:
    repeating-linear-gradient(90deg,
      rgba(47, 94, 94, 0.035) 0 1px,
      transparent 1px 34px);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.68;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a {
  color: var(--teal);
  text-decoration: none;
  border-bottom: 1px solid var(--hair-teal);
  transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
a:hover, a:focus {
  color: var(--gold-deep);
  border-bottom-color: var(--gold);
  background-color: var(--gold-wash);
}
a:focus-visible {
  outline: 2px solid var(--gold-deep);
  outline-offset: 2px;
}

/* ---------- utilities ---------- */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding-inline: var(--gutter);
  min-width: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 99;
  background: var(--teal);
  color: var(--paper);
  padding: .6rem 1rem;
  border: 0;
  font-family: var(--mono);
  font-size: .8125rem;
}
.skip-link:focus { left: .5rem; top: .5rem; }

.label {
  font-family: var(--mono);
  font-size: .6875rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ============================================================
   ARCHIVE BANNER — site-wide, on every page.
   Sticky (never fixed) so it can never cover content.
   ============================================================ */
.archive-banner {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--teal);
  color: #EDEFE8;
  border-bottom: 2px solid var(--gold);
  font-family: var(--mono);
  font-size: .6875rem;
  line-height: 1.5;
  letter-spacing: .06em;
}
.archive-banner .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .35rem .75rem;
  min-width: 0;
  padding-block: .5rem;
}
.archive-banner__tag {
  letter-spacing: .22em;
  text-transform: uppercase;
  color: #F0C765;
  font-weight: 700;
  white-space: nowrap;
}
.archive-banner__text {
  margin: 0;
  min-width: 0;
  color: #DCE2DB;
}

/* ============================================================
   MASTHEAD
   ============================================================ */
.masthead {
  background: var(--teal);
  color: #F2F1E7;
  border-bottom: 1px solid rgba(240, 199, 101, .35);
}
.masthead .wrap { padding-block: 2.25rem 1.75rem; min-width: 0; }

.masthead__eyebrow {
  margin: 0 0 .85rem;
  font-family: var(--mono);
  font-size: .6875rem;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: #E8B84C;
}
.masthead__eyebrow::after {
  content: "";
  display: block;
  height: 1px;
  margin-top: .7rem;
  background: linear-gradient(90deg, var(--gold) 0 4.5rem, rgba(240,199,101,.28) 4.5rem);
}

.masthead__title {
  display: inline-block;
  margin: 0;
  border: 0;
  color: #F6F4EA;
  font-family: var(--serif);
  font-size: clamp(1.55rem, 5.2vw, 2.7rem);
  font-weight: 400;
  line-height: 1.14;
  letter-spacing: .005em;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}
a.masthead__title:hover, a.masthead__title:focus {
  color: #F0C765;
  background: transparent;
}

.masthead__sub {
  margin: .85rem 0 0;
  font-family: var(--mono);
  font-size: .75rem;
  letter-spacing: .08em;
  color: #B9CCC5;
}

/* the tally/ruling motif under the masthead */
.rule-tally {
  height: 9px;
  background:
    repeating-linear-gradient(90deg,
      var(--gold) 0 1px,
      transparent 1px 9px),
    var(--teal);
  opacity: .85;
}

/* ============================================================
   ARCHIVE NAV — wrapping, never clipped, never fixed.
   ============================================================ */
.archive-nav {
  background: var(--paper-deep);
  border-bottom: 1px solid var(--hair);
}
.archive-nav .wrap { padding-block: 1rem 1.15rem; min-width: 0; }

.navgroup { min-width: 0; }
.navgroup + .navgroup {
  margin-top: .9rem;
  padding-top: .9rem;
  border-top: 1px solid var(--hair-soft);
}
.navgroup__label {
  margin: 0 0 .5rem;
  font-family: var(--mono);
  font-size: .625rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.navlist {
  display: flex;
  flex-wrap: wrap;          /* CRITICAL: items wrap, never pushed off-screen */
  gap: .3rem .35rem;
  margin: 0;
  padding: 0;
  list-style: none;
  min-width: 0;
}
.navlist li { min-width: 0; flex: 0 1 auto; }

.navlist a {
  display: block;
  min-width: 0;
  padding: .3rem .55rem;
  border: 1px solid transparent;
  border-bottom: 1px solid var(--hair-soft);
  color: var(--ink-soft);
  font-size: .875rem;
  line-height: 1.35;
  overflow-wrap: break-word;
  word-break: break-word;
}
.navlist a:hover, .navlist a:focus {
  color: var(--teal);
  background: var(--gold-wash);
  border-color: var(--hair);
}
.navlist a[aria-current="page"] {
  color: var(--teal);
  font-weight: 600;
  background: rgba(47, 94, 94, .08);
  border-color: var(--hair-teal);
  border-bottom-color: var(--gold);
}
.navlist--docs a { font-family: var(--serif); font-size: .9375rem; }

/* ============================================================
   MAIN — single column, generous measure
   ============================================================ */
main { display: block; }

.sheet {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2.5rem 0 3rem;
  min-width: 0;
}

.doc { min-width: 0; }

.doc h1 {
  margin: 0 0 1.1rem;
  font-family: var(--serif);
  font-size: clamp(1.7rem, 5.6vw, 2.45rem);
  font-weight: 400;
  line-height: 1.16;
  letter-spacing: -.005em;
  color: var(--ink);
  overflow-wrap: break-word;
  hyphens: auto;
}

.doc h2 {
  position: relative;
  margin: 2.75rem 0 .85rem;
  padding-top: 1.15rem;
  font-family: var(--serif);
  font-size: clamp(1.2rem, 3.7vw, 1.45rem);
  font-weight: 600;
  line-height: 1.28;
  color: var(--teal);
  border-top: 1px solid var(--hair-soft);
  overflow-wrap: break-word;
}
.doc h2::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 2.75rem;
  height: 2px;
  background: var(--gold);
}

.doc h3 {
  margin: 2rem 0 .6rem;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.doc p { margin: 0 0 1.15rem; }
.doc strong { font-weight: 650; color: var(--ink); }

.doc ul, .doc ol { margin: 0 0 1.35rem; padding-left: 1.25rem; }
.doc li { margin-bottom: .55rem; }
.doc ul { list-style: none; padding-left: 0; }
.doc ul li {
  position: relative;
  padding-left: 1.35rem;
}
.doc ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .72em;
  width: .7rem;
  height: 1px;
  background: var(--gold);
}
.doc ol { list-style: decimal; }
.doc ol li::marker { color: var(--teal-pale); font-family: var(--mono); font-size: .85em; }

.doc blockquote {
  margin: 1.75rem 0;
  padding: .25rem 0 .25rem 1.35rem;
  border-left: 3px solid var(--gold);
  font-family: var(--serif);
  font-size: 1.075rem;
  line-height: 1.58;
  color: var(--ink-soft);
}
.doc blockquote p { margin-bottom: .8rem; }
.doc blockquote p:last-child { margin-bottom: 0; }

/* ============================================================
   ARCHIVAL DEVICES — the signature components
   ============================================================ */

/* The dated stamp under each h1 */
.archive-stamp {
  margin: 0 0 2rem !important;
  padding: .7rem .9rem .7rem 1rem;
  background: var(--paper-tint);
  border: 1px solid var(--hair-soft);
  border-left: 3px solid var(--gold);
  font-family: var(--mono);
  font-size: .75rem;
  line-height: 1.55;
  letter-spacing: .045em;
  text-transform: uppercase;
  color: var(--ink-soft);
  overflow-wrap: break-word;
}

/* The about-this-archive block that closes every page */
.archive-note {
  margin: 3.25rem 0 0;
  padding: 1.5rem 1.35rem 1.35rem;
  background: var(--paper-tint);
  border: 1px solid var(--hair);
  border-top: 3px solid var(--teal);
}
.archive-note h2 {
  margin: 0 0 .9rem;
  padding-top: 0;
  border-top: 0;
  font-family: var(--mono);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--teal);
}
.archive-note h2::before { display: none; }
.archive-note p {
  margin: 0 0 .85rem;
  font-size: .9375rem;
  line-height: 1.62;
  color: var(--ink-soft);
}
.archive-note p:last-child { margin-bottom: 0; }

/* ---------- plates (images) ---------- */
.plate {
  margin: 0 0 2.25rem;
  min-width: 0;
}
.plate--inline { margin: 2.5rem 0; }

.plate__frame {
  padding: .4rem;
  background: var(--paper-tint);
  border: 1px solid var(--hair);
}
.plate img {
  width: 100%;
  border: 1px solid var(--hair-soft);
}

.plate figcaption {
  margin-top: .6rem;
  padding-top: .5rem;
  border-top: 1px solid var(--hair-soft);
  font-family: var(--mono);
  font-size: .6875rem;
  line-height: 1.55;
  letter-spacing: .05em;
  color: var(--ink-faint);
  overflow-wrap: break-word;
}
.plate__no {
  color: var(--gold-deep);
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

/* ============================================================
   FOOTER — the record card
   ============================================================ */
.site-footer {
  margin-top: 3rem;
  background: var(--teal);
  color: #D9E1DC;
  border-top: 2px solid var(--gold);
}
.site-footer .wrap { padding-block: 2.25rem 2rem; min-width: 0; }

.recordcard {
  margin: 0 0 1.6rem;
  padding: 0;
  border-top: 1px solid rgba(240, 199, 101, .3);
}
.recordcard__title {
  margin: 1.1rem 0 1rem;
  font-family: var(--mono);
  font-size: .6875rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: #E8B84C;
}
.recordcard dl {
  display: grid;
  grid-template-columns: minmax(0, 11rem) minmax(0, 1fr);
  gap: 0;
  margin: 0;
  font-size: .8125rem;
  line-height: 1.55;
}
.recordcard dt {
  padding: .45rem .75rem .45rem 0;
  border-top: 1px solid rgba(217, 225, 220, .16);
  font-family: var(--mono);
  font-size: .6875rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #9DBAB2;
  min-width: 0;
  overflow-wrap: break-word;
}
.recordcard dd {
  margin: 0;
  padding: .45rem 0;
  border-top: 1px solid rgba(217, 225, 220, .16);
  color: #E4EAE4;
  min-width: 0;
  overflow-wrap: break-word;
}

.site-footer__note {
  margin: 0 0 1.1rem;
  max-width: 46rem;
  font-size: .8125rem;
  line-height: 1.65;
  color: #BCCCC5;
}
.site-footer__legal {
  margin: 0;
  padding-top: 1rem;
  border-top: 1px solid rgba(240, 199, 101, .22);
  font-family: var(--mono);
  font-size: .6875rem;
  letter-spacing: .07em;
  color: #9DBAB2;
}

.site-footer a { color: #F0C765; border-bottom-color: rgba(240, 199, 101, .4); }
.site-footer a:hover, .site-footer a:focus {
  color: #FFF; background: rgba(240, 199, 101, .16); border-bottom-color: #F0C765;
}

/* ---------- 404 ---------- */
.doc--notfound .archive-stamp { border-left-color: var(--teal); }

/* ============================================================
   RESPONSIVE — verified 320 → 1440
   ============================================================ */
@media (max-width: 40rem) {
  :root { --gutter: 1rem; }
  body { font-size: 1rem; }
  .sheet { padding-top: 1.9rem; }
  .masthead .wrap { padding-block: 1.6rem 1.35rem; }
  .archive-note { padding: 1.15rem 1rem 1rem; }
  .recordcard dl { grid-template-columns: minmax(0, 1fr); }
  .recordcard dt { padding-bottom: 0; border-bottom: 0; }
  .recordcard dd { padding-top: .1rem; border-top: 0; padding-bottom: .6rem; }
  .doc blockquote { padding-left: 1rem; }
}

@media (min-width: 64rem) {
  .sheet { padding: 3.25rem 0 3.75rem; }
  .archive-nav .wrap { padding-block: 1.2rem 1.35rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

@media print {
  .archive-banner, .archive-nav { position: static; }
  body { background: #fff; }
}
