/* ==========================================================================
   Maine Ballot -- shared styles for every page
   --------------------------------------------------------------------------
   All four pages load this file. Anything that should look the same across
   the site lives here, so the pages cannot drift apart again.
   Page-specific rules stay in that page's own <style> block.
   ========================================================================== */

:root {
  /* brand */
  --navy:        #0b1c33;
  --brand:       #0055a5;
  --brand-dark:  #003f7d;
  --brand-tint:  #eef4fb;

  /* text -- three levels, that is all */
  --ink:         #1f2937;
  --ink-muted:   #556070;
  --ink-faint:   #7b8794;

  /* surfaces */
  --card:        rgba(255, 255, 255, 0.95);
  --panel:       #f4f7fb;
  --line:        #d4dfec;

  /* state */
  --danger:      #c62828;
  --ok:          #2e9b4f;

  /* two radii, one shadow */
  --radius:      10px;
  --radius-sm:   6px;
  --shadow:      0 10px 30px rgba(0, 0, 0, 0.25);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* --- page shell ---------------------------------------------------------- */

html, body { min-height: 100%; }

body {
  font-family: var(--font);
  margin: 0;
  padding: 32px 20px 48px;
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--navy);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-color: var(--navy);
  background-image: url("Background.jpg");
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
}

/* One width for every page. The card must not resize as you move around the
   site, so pages do not override this -- they fit their content to it. */
.wrap {
  max-width: 720px;
  margin: 0 auto;
  background: var(--card);
  border-radius: 12px;
  padding: 0 22px 20px;
  box-shadow: var(--shadow);
}

/* Long text stays readable no matter how wide the card is. Comfortable
   reading is about 45-75 characters a line. */
p, li { max-width: 68ch; }

h1 {
  font-size: 1.55rem;
  line-height: 1.25;
  margin: 4px 0 6px;
  letter-spacing: -0.01em;
}

a { color: var(--brand); }

/* --- header: same on every page ------------------------------------------ */

.site-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 18px;
  padding: 14px 0 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand img {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: block;
}

/* The lookup count beside the brand on the Find page. margin-right:auto
   takes all the spare width, so it hugs the brand on the left and the nav
   stays on the right. Only index.html carries it. */
.brand-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  margin-right: auto;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-muted);
  text-decoration: none;
  font-size: 0.86rem;
  white-space: nowrap;
}
.brand-stat b {
  display: inline-block;        /* transform needs a box; inline has none */
  color: var(--brand);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}
.brand-stat:hover { background: var(--brand-tint); border-color: var(--brand); color: var(--brand); }

/* The count just went up because of the visitor's own search. One short
   pulse so the change is noticed, then still. */
.brand-stat b.bump { animation: stat-bump 0.7s ease-out; }
@keyframes stat-bump {
  0%   { transform: scale(1);    color: var(--brand); }
  30%  { transform: scale(1.35); color: #c0392b; }
  100% { transform: scale(1);    color: var(--brand); }
}
@media (prefers-reduced-motion: reduce) { .brand-stat b.bump { animation: none; } }

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.site-nav a {
  display: inline-block;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-muted);
  text-decoration: none;
  font-size: 0.92rem;
  white-space: nowrap;
}

.site-nav a:hover { background: var(--brand-tint); color: var(--brand); }

.site-nav a[aria-current="page"] {
  background: var(--brand-tint);
  color: var(--brand);
  font-weight: 600;
}

/* --- footer: same on every page ------------------------------------------ */

.site-foot {
  margin-top: 26px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.site-foot p { margin: 0 0 6px; }
.site-foot p:last-child { margin-bottom: 0; }
.site-foot a { color: var(--brand); }

.foot-scope { color: var(--ink-muted); }

.foot-fine {
  color: var(--ink-faint);
  font-size: 0.8rem;
}

/* --- buttons ------------------------------------------------------------- */

.btn {
  display: inline-block;
  padding: 12px 22px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: var(--brand);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn:hover { background: var(--brand-dark); }
.btn:disabled { background: #9aa5b1; cursor: not-allowed; }

/* Actions that only appear once there are results to act on -- Download List
   and the save/remind button. Outlined rather than solid so the primary
   action, Find my candidates, keeps the eye. */
.btn-secondary {
  color: var(--brand);
  background: #fff;
  border: 1px solid var(--brand);
}
.btn-secondary:hover { background: var(--brand-tint); color: var(--brand); }

/* --- form controls ------------------------------------------------------- */

/* Every text-like input has to be listed here. A type that is missing gets
   the browser's default width and sits visibly narrower than the rest --
   which is exactly what happened when the phone field was added. */
input[type="text"],
input[type="email"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="search"],
textarea,
select {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 12px;
  font-family: inherit;      /* without this, textareas render in monospace */
  font-size: 16px;           /* 16px stops iOS zooming in on focus */
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}

textarea { min-height: 140px; resize: vertical; }

input[type="text"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 85, 165, 0.18);
}

::placeholder { color: var(--ink-faint); opacity: 1; }

label { display: block; margin: 16px 0 6px; font-weight: 600; }

.hint { font-weight: 400; color: var(--ink-muted); font-size: 0.88rem; }

/* --- shared odds and ends ------------------------------------------------ */

.note  { font-size: 0.9rem; color: var(--ink-muted); }
.error { color: var(--danger); }

/* The hidden attribute must always win.
   Browsers hide it with [hidden] { display: none }, but that is weak: any rule
   like `#thing { display: flex }` beats it, and then setting hidden="true"
   changes the attribute while the element stays visible on screen. That is
   exactly what left the OPEN SEAT panel stuck over every candidate photo. */
[hidden] { display: none !important; }

/* present for screen readers, invisible on screen */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --- small screens ------------------------------------------------------- */

@media (max-width: 680px) {
  body { padding: 16px 10px 32px; }
  .wrap { padding: 0 14px 16px; }
  h1 { font-size: 1.35rem; }
  .site-head { padding: 12px 0 10px; gap: 8px 12px; }
  .site-nav a { padding: 5px 8px; font-size: 0.88rem; }
}
