/* Suffolk & Ipswich Grassroots Football — "chalk on pitch green"
   Identity: deep pitch green structure, chalk-white pitch-marking rules
   (3px lines, never hairlines), scoreboard-condensed type for numbers, and
   Saturday-yellow reserved for the football itself: scores, top spots,
   live search hits. A modern descendant of the Green'Un results paper. */

:root {
  --pitch-950: #082419;
  --pitch-900: #0b3324;
  --pitch-700: #14573c;
  --grass: #1d7a50;
  --chalk: #fafbf5;
  --paper: #eef1ea;
  --ink: #13201a;
  --ink-soft: #52645a;
  --line: #d9dfd3;
  --score-yellow: #ffc838;
  --clay: #a63d2c;
  --radius: 10px;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "Barlow", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.55 var(--body);
  color: var(--ink);
  background: var(--paper);
}
a { color: var(--pitch-700); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--grass); }
:focus-visible { outline: 3px solid var(--pitch-700); outline-offset: 2px; border-radius: 2px; }
.site-header :focus-visible, .site-footer :focus-visible { outline-color: var(--score-yellow); }

/* ---------- header: dark green bar with a chalk touchline ---------- */
.site-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  padding: 0.9rem 1.25rem;
  background: linear-gradient(180deg, var(--pitch-900), var(--pitch-950));
  border-bottom: 3px solid var(--chalk);
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--chalk);
  text-decoration: none;
}
.brand-mark { width: 40px; height: 40px; color: var(--chalk); flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-title {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.brand-sub {
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--score-yellow);
  font-weight: 600;
}
.search-wrap { position: relative; flex: 1; min-width: 14rem; max-width: 26rem; margin-left: auto; }
.search-wrap input {
  width: 100%;
  padding: 0.55rem 0.9rem;
  font: inherit;
  color: var(--ink);
  background: var(--chalk);
  border: none;
  border-radius: 999px;
}
#search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--chalk);
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(8, 36, 25, 0.35);
  overflow: hidden;
  z-index: 30;
}
#search-results a {
  display: block;
  padding: 0.55rem 0.9rem;
  text-decoration: none;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}
#search-results a:last-child { border-bottom: none; }
#search-results a:hover, #search-results a:focus { background: var(--score-yellow); }

main { max-width: 62rem; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }

/* ---------- signature: section titles sit on a chalk pitch-line with a
   centre-spot ring, the way markings sit on grass ---------- */
.section-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 2.2rem 0 1rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.45rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.section-title::after {
  content: "";
  flex: 1;
  height: 3px;
  background: var(--chalk);
  border-radius: 2px;
  box-shadow: 0 0 0 1px var(--line);
}
.section-title::before {
  content: "";
  order: 2;
  width: 11px;
  height: 11px;
  border: 3px solid var(--chalk);
  box-shadow: 0 0 0 1px var(--line);
  border-radius: 50%;
  flex: none;
}

.eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 1.6rem 0 0.4rem;
}
.eyebrow a { color: inherit; }
.crumb { margin: 0.4rem 0 0; color: var(--ink-soft); font-size: 0.9rem; }

.hero { margin: 1.2rem 0 0.4rem; }
h1 {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.8rem, 5.5vw, 2.9rem);
  line-height: 1.03;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  margin: 0.15rem 0 0.6rem;
}

/* ---------- boards: the white cards the data lives on ---------- */
.board {
  background: var(--chalk);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.4rem 1.1rem 0.9rem;
  margin: 0 0 1.4rem;
}
.board .section-title { margin-top: 0.9rem; }
.date-head {
  font-family: var(--display);
  font-size: 1.02rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--pitch-700);
  margin: 1.1rem 0 0.3rem;
}

/* match rows read like the classified results column */
.match {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--line);
}
.match:last-child { border-bottom: none; }
.match-time {
  font-family: var(--display);
  font-weight: 700;
  color: var(--ink-soft);
  min-width: 3.2rem;
}
.match-teams { flex: 1 1 16rem; }
.score {
  display: inline-block;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.05rem;
  background: var(--pitch-900);
  color: var(--score-yellow);
  padding: 0.05rem 0.5rem;
  border-radius: 4px;
  margin: 0 0.35rem;
  white-space: nowrap;
}
.vs { color: var(--ink-soft); font-weight: 600; padding: 0 0.15rem; }
.match-meta { font-size: 0.82rem; color: var(--ink-soft); }
.empty { color: var(--ink-soft); font-style: italic; }

/* ---------- standings ---------- */
.table-scroll { overflow-x: auto; }
table.standings { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
table.standings th, table.standings td {
  padding: 0.42rem 0.55rem;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}
table.standings th {
  font-family: var(--display);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  border-bottom: 3px solid var(--pitch-900);
}
table.standings th:nth-child(2), table.standings td:nth-child(2) { text-align: left; width: 100%; white-space: normal; }
table.standings td:first-child {
  font-family: var(--display);
  font-weight: 700;
  color: var(--ink-soft);
}
table.standings tbody tr:first-child { background: linear-gradient(90deg, rgba(255, 200, 56, 0.30), transparent 70%); }
table.standings tbody tr:first-child td:first-child { color: var(--pitch-900); }
table.standings td:last-child, table.standings th:last-child { font-weight: 700; }

/* ---------- form chips ---------- */
.form-row { display: flex; gap: 0.3rem; margin: 0.4rem 0 0.8rem; padding: 0; }
.form-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  font-family: var(--display);
  font-weight: 800;
  color: var(--chalk);
  background: var(--ink-soft);
}
.form-w { background: var(--grass); }
.form-d { background: var(--ink-soft); }
.form-l { background: var(--clay); }

/* ---------- league directory & division cards ---------- */
.league-list { list-style: none; padding: 0; margin: 0.2rem 0 0.8rem; }
.league-list li { padding: 0.32rem 0; border-bottom: 1px solid var(--line); }
.league-list li:last-child { border-bottom: none; }
.league-note { display: block; font-size: 0.8rem; color: var(--ink-soft); }
.external::after { content: " ↗" / ""; color: var(--ink-soft); }

.division-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 0.7rem;
  margin: 0.6rem 0 1rem;
  padding: 0;
  list-style: none;
}
.division-grid a {
  display: block;
  background: var(--chalk);
  border: 1px solid var(--line);
  border-left: 4px solid var(--grass);
  border-radius: 6px;
  padding: 0.6rem 0.8rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--ink);
}
.division-grid a:hover { border-left-color: var(--score-yellow); background: #fff; }

/* ---------- status ---------- */
.status-ok { color: var(--grass); font-weight: 700; }
.status-bad { color: var(--clay); font-weight: 700; }

/* ---------- footer ---------- */
.site-footer {
  margin-top: 3rem;
  padding: 1.4rem 1.25rem 2rem;
  background: var(--pitch-950);
  border-top: 3px solid var(--chalk);
  color: #b8c6be;
  font-size: 0.85rem;
  text-align: center;
}
.site-footer a { color: var(--chalk); }
.footer-strong { color: var(--chalk); font-weight: 600; margin: 0 0 0.3rem; }

@media (max-width: 40rem) {
  .brand-title { font-size: 1.2rem; }
  main { padding: 1rem 0.8rem 2.5rem; }
  .board { padding: 0.3rem 0.8rem 0.7rem; }
  .match-time { min-width: 2.6rem; }
  table.standings { font-size: 0.85rem; }
}

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

/* ---------- v2: nav, chips, splits, search & filter polish ---------- */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--score-yellow);
  color: var(--ink);
  padding: 0.5rem 1rem;
  z-index: 100;
  font-weight: 700;
}
.skip-link:focus { left: 0; }

.site-nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.site-nav a {
  color: var(--chalk);
  text-decoration: none;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.02rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 3px solid transparent;
}
.site-nav a:hover { color: var(--score-yellow); border-bottom-color: var(--score-yellow); }

.season-nav { display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 0.2rem 0 1rem; }
.season-chip {
  display: inline-block;
  padding: 0.15rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--chalk);
  font-family: var(--display);
  font-weight: 700;
  text-decoration: none;
  color: var(--ink);
}
.season-chip:hover { border-color: var(--grass); }
.season-chip.current { background: var(--pitch-900); color: var(--score-yellow); border-color: var(--pitch-900); }

.split-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1.2rem; }
.form-inline { display: inline-flex; margin: 0; }
.cell-left { text-align: left !important; }
.leader-line { display: block; font-family: var(--body); font-weight: 400; font-size: 0.78rem;
  text-transform: none; letter-spacing: 0; color: var(--ink-soft); margin-top: 0.15rem; }
.more-link { margin: 0.8rem 0 0.2rem; font-weight: 600; }
.ics-line { font-size: 0.85rem; margin: 0.5rem 0 0.2rem; }

.filter-input {
  display: block;
  width: 100%;
  max-width: 20rem;
  margin: 0.2rem 0 0.6rem;
  padding: 0.45rem 0.7rem;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}

#search-results { max-height: min(60vh, 22rem); overflow-y: auto; }
#search-results a { display: flex; justify-content: space-between; gap: 0.8rem; align-items: baseline; }
#search-results a.active { background: var(--score-yellow); }
.hit-name { font-weight: 600; }
.hit-detail { font-size: 0.75rem; color: var(--ink-soft); white-space: nowrap; }

.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;
}

/* ---------- v3: stat tiles, chart, follow ---------- */
.stat-strip { display: flex; gap: 0.7rem; flex-wrap: wrap; margin: 0 0 1.4rem; }
.stat-tile {
  background: var(--pitch-900);
  color: var(--chalk);
  border-radius: var(--radius);
  padding: 0.55rem 1rem 0.5rem;
  min-width: 6.5rem;
  display: flex;
  flex-direction: column;
}
.stat-num { font-family: var(--display); font-weight: 800; font-size: 1.7rem; line-height: 1.05; color: var(--score-yellow); }
.stat-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: #b8c6be; }
.stat-wide { flex: 1; min-width: 12rem; }
.pos-chart { width: 100%; height: auto; display: block; margin: 0.4rem 0 0.6rem; }
.follow-btn {
  font: 600 0.85rem/1 var(--body);
  vertical-align: middle;
  margin-left: 0.6rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--chalk);
  color: var(--ink);
  cursor: pointer;
}
.follow-btn.on { background: var(--score-yellow); border-color: var(--score-yellow); }

/* ---------- maps & badges & news ---------- */
.map-board { height: 420px; border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; margin: 0 0 1.4rem; background: var(--chalk); }
.map-board.small { height: 300px; }
.ground-pin { background: var(--grass); border: 3px solid var(--chalk); border-radius: 50%; box-shadow: 0 0 0 1px var(--line); }
.ground-pin.large { background: var(--pitch-900); border-color: var(--score-yellow); }
.leaflet-popup-content-wrapper { border-radius: 8px; font-family: var(--body); }
.team-badge { width: 26px; height: 26px; border-radius: 4px; object-fit: contain; vertical-align: middle; margin-right: 0.45rem; background: #fff; border: 1px solid var(--line); }
.team-badge.hero { width: 52px; height: 52px; border-radius: 8px; margin-right: 0.6rem; }
.news-item h3 { margin: 0 0 0.2rem; }
.news-date { color: var(--ink-soft); font-size: 0.85rem; }

/* Google embed maps: framed like a board, gently toned to the palette */
.map-frame {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 0 0 1.4rem;
  box-shadow: inset 0 0 0 3px var(--chalk);
  background: var(--chalk);
}
.map-embed { display: block; width: 100%; height: 360px; border: 0; filter: saturate(0.82) contrast(1.02); }

/* ---------- consistent match rows: home | score | away columns ---------- */
.match-teams.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: baseline;
  gap: 0.55rem;
}
.mt-home { text-align: right; min-width: 0; overflow-wrap: anywhere; }
.mt-away { text-align: left; min-width: 0; overflow-wrap: anywhere; }
.score { min-width: 3.4rem; text-align: center; }
.score-special { background: var(--paper); color: var(--ink-soft); border: 1px solid var(--line); font-size: 0.85rem; }
.score-note { display: inline-block; font-size: 0.72rem; color: var(--ink-soft); font-family: var(--body); font-weight: 500; margin-left: 0.3rem; }
.vs { min-width: 3.4rem; text-align: center; }
.match .match-teams a, .match .mt-home a, .match .mt-away a { text-decoration: none; }
.match .match-teams a:hover { text-decoration: underline; }
@media (max-width: 40rem) {
  .match-teams.grid { gap: 0.4rem; }
  .score { min-width: 2.9rem; }
}

/* ---------- venue hero: map + facts side by side ---------- */
.venue-hero { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(15rem, 1fr); gap: 1.2rem; margin: 0.6rem 0 1.4rem; align-items: stretch; }
.venue-hero .map-frame { margin: 0; height: 100%; min-height: 320px; }
.venue-hero .map-embed { height: 100%; min-height: 320px; }
.facts-card { background: var(--chalk); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: 0.9rem; }
.facts-address { margin: 0; font-weight: 600; line-height: 1.4; }
.stat-strip.stacked { margin: 0; }
.btn { display: inline-block; align-self: flex-start; background: var(--score-yellow); color: var(--ink); font-weight: 700; text-decoration: none; padding: 0.55rem 1.2rem; border-radius: 999px; }
.btn:hover { background: #ffd45e; color: var(--ink); }
@media (max-width: 46rem) { .venue-hero { grid-template-columns: 1fr; } }

/* ---------- match pages & cards ---------- */
.match-hero { display: grid; grid-template-columns: 1fr auto 1fr; gap: 0.8rem; align-items: center; margin: 1rem 0 0.6rem; }
.match-hero .mh-team { font-family: var(--display); font-weight: 700; font-size: 1.25rem; }
.match-hero .mh-team:first-child { text-align: right; }
.match-hero .mh-score { font-size: 1.6rem; padding: 0.15rem 0.9rem; }
.card-yellow, .card-red { display: inline-block; width: 0.62rem; height: 0.85rem; border-radius: 2px; vertical-align: -1px; margin-left: 0.3rem; }
.card-yellow { background: var(--score-yellow); border: 1px solid #d4a20a; }
.card-red { background: var(--clay); border: 1px solid #7c2c1f; }
a.score.has-detail { cursor: pointer; }
a.score.has-detail:hover { background: var(--pitch-700); }
