/* ==========================================================================
   Silver Gloves of America — site stylesheet
   Hand-maintained. No build step, no framework, no external requests.
   ========================================================================== */

:root {
  --navy:        #14315e;
  --navy-dark:   #0d2244;
  --red:         #c8102e;
  --blue:        #2a5da8;
  --blue-light:  #4ca8d1;

  --ink:         #1c1f23;
  --ink-muted:   #55606d;
  --rule:        #d8dee6;
  --bg:          #ffffff;
  --bg-soft:     #f4f6f9;

  --wrap:        1180px;
  --gutter:      clamp(1rem, 4vw, 2.5rem);
  --radius:      6px;

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

/* --- reset ---------------------------------------------------------------- */

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

html {
  /* Nothing on this site may cause sideways scrolling — the old site did. */
  overflow-x: hidden;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  overflow-x: hidden;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

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

a { color: var(--blue); }
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--red);
  outline-offset: 2px;
}

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; color: var(--navy); }
h1 { font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.75rem); }
h2 { font-size: clamp(1.4rem, 1.1rem + 1.4vw, 2rem); }
h3 { font-size: clamp(1.15rem, 1rem + .7vw, 1.4rem); }
p  { margin: 0 0 1.1em; }

.wrap { width: min(100% - (var(--gutter) * 2), var(--wrap)); margin-inline: auto; }

.skip-link {
  position: absolute; left: -9999px;
  background: var(--navy); color: #fff;
  padding: .75rem 1.25rem; z-index: 200;
}
.skip-link:focus { left: 1rem; top: 1rem; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

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

.topbar {
  background: var(--navy-dark);
  color: #fff;
  font-size: .9rem;
  border-bottom: 4px solid var(--red);
}
.topbar .wrap { display: flex; justify-content: flex-end; padding: .5rem 0; }
.topbar a { color: #fff; text-decoration: none; display: inline-flex; gap: .5ch; align-items: center; }
.topbar a:hover { text-decoration: underline; }

.masthead { background: #fff; border-bottom: 1px solid var(--rule); }
.masthead .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .75rem 0;
}
.masthead__logo img { width: 92px; height: auto; }

.nav-toggle {
  display: none;
  background: none; border: 1px solid var(--rule); border-radius: var(--radius);
  padding: .55rem .7rem; cursor: pointer; color: var(--navy);
}
.nav-toggle svg { width: 22px; height: 22px; display: block; }

.nav ul {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: clamp(.5rem, 1.6vw, 1.4rem);
}
.nav a {
  display: block; padding: .5rem .25rem;
  color: var(--navy); text-decoration: none; font-weight: 600;
  border-bottom: 3px solid transparent;
}
.nav a:hover { color: var(--red); }
.nav a[aria-current="page"] { color: var(--red); border-bottom-color: var(--red); }

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav {
    display: none;
    flex-basis: 100%;
    border-top: 1px solid var(--rule);
    padding-top: .5rem;
  }
  .nav.is-open { display: block; }
  .nav ul { flex-direction: column; gap: 0; }
  .nav a { padding: .75rem .25rem; border-bottom: 1px solid var(--rule); }
  .nav a[aria-current="page"] { border-bottom-color: var(--red); }
}

/* --- page banner ---------------------------------------------------------- */

.banner { position: relative; background: var(--navy); }
.banner img { width: 100%; max-height: 320px; object-fit: cover; opacity: .55; }
.banner__title {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  text-align: center; padding: var(--gutter);
}
.banner__title h1 { color: #fff; margin: 0; text-shadow: 0 2px 10px rgba(0,0,0,.55); }

/* --- hero (home) ---------------------------------------------------------- */

.hero { background: var(--bg-soft); border-bottom: 1px solid var(--rule); }
.hero .wrap {
  display: grid; gap: clamp(1.5rem, 4vw, 3rem);
  grid-template-columns: 1fr;
  align-items: center;
  padding: clamp(1.5rem, 4vw, 3rem) 0;
}
@media (min-width: 900px) { .hero .wrap { grid-template-columns: 1.1fr .9fr; } }

/* The poster is portrait; never crop it — the old site clipped the dates off. */
.hero__poster img {
  width: 100%; height: auto;
  border-radius: var(--radius);
  box-shadow: 0 6px 28px rgba(0,0,0,.18);
}
.hero__lede { font-size: 1.15rem; color: var(--ink-muted); }
/* Second line of the H1 — the descriptive half, set smaller than the brand name
   so the heading still reads as one title. */
.hero__sub {
  display: block; margin-top: .25em;
  font-size: .46em; font-weight: 600; letter-spacing: .01em;
  color: var(--blue);
}

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

.btn {
  display: inline-block;
  background: var(--red); color: #fff;
  padding: .8rem 1.6rem;
  border: 0; border-radius: var(--radius);
  font: inherit; font-weight: 700; text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: #a60d26; color: #fff; }
.btn--ghost { background: transparent; color: var(--navy); border: 2px solid var(--navy); }
.btn--ghost:hover { background: var(--navy); color: #fff; }

/* --- sections ------------------------------------------------------------- */

.section { padding: clamp(2rem, 5vw, 3.75rem) 0; }
.section--soft { background: var(--bg-soft); }
.section--navy { background: var(--navy); color: #fff; }
.section--navy h2 { color: #fff; }
.section--navy a { color: #9ec8ff; }
.section__head { text-align: center; margin-bottom: 2rem; }
.section__head p { color: var(--ink-muted); max-width: 60ch; margin-inline: auto; }
.section--navy .section__head p { color: #c6d4e8; }

.prose { max-width: 72ch; }
.prose h2 { margin-top: 1.6em; }

.cards { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card {
  background: #fff; border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 1.4rem;
}
.card h3 { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }

/* Cards with a photo: the source images have wildly different aspect ratios,
   so crop them all to a consistent band rather than letting the grid jump. */
.card--media { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.card--media > img {
  width: 100%; aspect-ratio: 16 / 9; object-fit: cover; object-position: center;
  background: var(--bg-soft);
}
.card__body { padding: 1.4rem; }

/* --- regional map --------------------------------------------------------- */

.map-wrap { max-width: 980px; margin-inline: auto; }
.us-map { width: 100%; height: auto; display: block; }

.us-map text {
  fill: #fff; stroke: none;
  font-family: var(--font); font-weight: 700; font-size: 20px;
  pointer-events: none;
}
.us-map path { stroke: #fff; stroke-width: 1.5; transition: fill .12s ease; }

/* Region colours, keyed to the real region number. The original stylesheet
   used variables whose names did not match the regions they coloured. */
.state--r1 path { fill: #4ca8d1; }
.state--r2 path { fill: #485868; }
.state--r3 path { fill: #6898c8; }
.state--r4 path { fill: #0868a8; }
.state--r5 path { fill: #183838; }
.state--r6 path { fill: #5898a8; }
.state--r7 path { fill: #9cb6c9; }
.state--r8 path { fill: #587898; }

.us-map a:hover path,
.us-map a:focus path { fill: var(--red); stroke: #ffd34d; stroke-width: 2.5; }
.us-map a:focus { outline: none; }

.map-legend {
  list-style: none; margin: 1.5rem 0 0; padding: 0;
  display: grid; gap: .35rem 1rem;
  grid-template-columns: repeat(auto-fit, minmax(15.5rem, 1fr));
}
.map-legend a {
  display: flex; align-items: baseline; gap: .6rem;
  padding: .45rem .6rem; border-radius: var(--radius);
  color: var(--ink); text-decoration: none; font-weight: 600;
  font-size: .95rem; line-height: 1.35;
}
/* Keep "Region N" and the director's name from splitting across lines. */
.map-legend .who { white-space: nowrap; }
.map-legend a:hover { background: var(--bg-soft); color: var(--red); }
.map-legend .swatch {
  width: 1.1rem; height: 1.1rem; border-radius: 3px; flex: none;
  border: 1px solid rgba(0,0,0,.15);
}

/* --- tables --------------------------------------------------------------- */

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table.data {
  width: 100%; border-collapse: collapse; font-size: .97rem;
  min-width: 34rem;
}
table.data caption { text-align: left; color: var(--ink-muted); padding-bottom: .6rem; }
table.data th, table.data td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid var(--rule); }
table.data thead th { background: var(--navy); color: #fff; position: sticky; top: 0; }
table.data tbody tr:nth-child(even) { background: var(--bg-soft); }
/* A covered state with no representative yet — falls back to the Director. */
table.data tr.is-vacant td { color: var(--ink-muted); font-style: italic; }
table.data a { word-break: break-word; }

/* --- champions ------------------------------------------------------------ */

.champ-controls {
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end;
  margin-bottom: 1.25rem;
}
.champ-controls label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .25rem; }
.champ-controls input, .champ-controls select {
  font: inherit; padding: .55rem .7rem;
  border: 1px solid var(--rule); border-radius: var(--radius); background: #fff;
  min-width: 12rem;
}
.champ-count { color: var(--ink-muted); font-size: .95rem; }
.champ-empty { padding: 2rem; text-align: center; color: var(--ink-muted); }

table.data th[aria-sort] { cursor: pointer; user-select: none; }
table.data th[aria-sort]::after { content: " ↕"; opacity: .45; }
table.data th[aria-sort="ascending"]::after  { content: " ↑"; opacity: 1; }
table.data th[aria-sort="descending"]::after { content: " ↓"; opacity: 1; }

.year-index { margin-top: 2.5rem; border-top: 1px solid var(--rule); padding-top: 1.5rem; }
.year-index h2 { font-size: 1.1rem; }
.year-index ul {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: .5rem;
}
.year-index a {
  display: block; padding: .4rem .8rem;
  border: 1px solid var(--rule); border-radius: var(--radius);
  text-decoration: none; font-weight: 600; color: var(--navy);
}
.year-index a:hover { background: var(--navy); color: #fff; border-color: var(--navy); }

.pager { display: flex; gap: .5rem; align-items: center; justify-content: center; margin-top: 1.5rem; flex-wrap: wrap; }
.pager button {
  font: inherit; padding: .5rem .9rem; cursor: pointer;
  background: #fff; color: var(--navy);
  border: 1px solid var(--rule); border-radius: var(--radius);
}
.pager button:hover:not(:disabled) { background: var(--navy); color: #fff; }
.pager button:disabled { opacity: .45; cursor: default; }

/* --- forms ---------------------------------------------------------------- */

.form-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }

.field label { display: block; font-weight: 600; margin-bottom: .3rem; }
.field .req { color: var(--red); }
.field input, .field textarea {
  width: 100%; font: inherit;
  padding: .7rem .8rem;
  border: 1px solid #b9c2ce; border-radius: var(--radius);
  background: #fff; color: var(--ink);
}
.field textarea { min-height: 9rem; resize: vertical; }
.field input:invalid:not(:placeholder-shown) { border-color: var(--red); }

/* Honeypot — hidden from people, still submitted by naive bots.
   Not display:none, which some bots specifically skip. */
.hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px; height: 1px; overflow: hidden;
}

.form-banner {
  padding: .9rem 1.1rem; border-radius: var(--radius);
  border-left: 5px solid; font-weight: 600;
}
.form-banner.is-ok    { background: #e7f6ec; border-color: #1c8a45; color: #14562c; }
.form-banner.is-error { background: #fdecee; border-color: var(--red); color: #8a1122; }

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

.footer { background: var(--navy-dark); color: #c6d4e8; padding: 2.5rem 0 1.5rem; margin-top: 3rem; }
.footer a { color: #fff; }
.footer__grid { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.footer h2 { color: #fff; font-size: 1rem; text-transform: uppercase; letter-spacing: .05em; }
.footer ul { list-style: none; margin: 0; padding: 0; }
.footer li { margin-bottom: .4rem; }
.footer__logo img { width: 84px; }
.footer .social a { display: inline-flex; align-items: center; gap: .55rem; }
.footer .social svg { width: 1.15rem; height: 1.15rem; flex: none; }
.footer .social a:hover { text-decoration: underline; }

.footer__base {
  margin-top: 2rem; padding-top: 1.25rem;
  border-top: 1px solid rgba(255,255,255,.18);
  display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; justify-content: space-between;
  font-size: .9rem;
}

/* --- print ---------------------------------------------------------------- */

@media print {
  .topbar, .nav, .nav-toggle, .banner, .pager, .champ-controls { display: none !important; }
  body { font-size: 11pt; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; color: #555; }
}
