/* Southend Ticket Stats */

:root {
  --navy: #00285a;
  --navy-dark: #001b3d;
  --navy-soft: #123a72;
  --accent: #ffb800;
  --sold: #00285a;
  --free: #2f9e5f;
  --closed: #9aa4b2;

  --bg: #f0f3f7;
  --surface: #ffffff;
  --border: #dde2ea;
  --text: #16202f;
  --text-soft: #5c6879;
  --text-muted: #9aa4b2;

  --radius: 3px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1320;
    --surface: #111c2b;
    --border: #1e2e42;
    --text: #e8edf5;
    --text-soft: #8a9bb4;
    --text-muted: #556070;
    --closed: #445568;
    --free: #3aad6e;
    --sold: #4f8fe0;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap { width: min(1080px, 100% - 2.5rem); margin-inline: auto; }

a { color: var(--navy-soft); }
@media (prefers-color-scheme: dark) { a { color: #7fb2ff; } }

/* --- masthead --- */

.masthead {
  background: var(--navy);
  color: #fff;
  padding: 0;
  border-bottom: 2px solid var(--accent);
}
.masthead__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  height: 54px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: #fff;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.brand__mark {
  width: 14px;
  height: 20px;
  border-radius: 0;
  background: repeating-linear-gradient(90deg, var(--accent) 0 4px, rgba(255,255,255,.7) 4px 8px);
}
.brand__text strong { font-weight: 800; }

.fixture-select { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; }
.fixture-select label { color: rgba(255,255,255,.5); font-weight: 500; }
.fixture-select select {
  font: inherit;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.1);
  color: #fff;
  max-width: 16rem;
}
.fixture-select select option { color: #16202f; background: #fff; }

/* --- hero --- */

.hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  margin: 1.5rem 0;
  overflow: hidden;
}
.hero__head {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.4rem 1.75rem 1.35rem;
  border-bottom: 1px solid var(--border);
}
.hero__head > div { flex: 1 1 16rem; }
.hero__crest { width: 46px; height: 46px; object-fit: contain; }
.hero__title {
  margin: 0 0 0.2rem;
  font-size: clamp(1.15rem, 2.8vw, 1.55rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.hero__meta { margin: 0; color: var(--text-soft); font-size: 0.875rem; font-weight: 500; }
.dot { margin: 0 0.4rem; opacity: .4; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.6rem 1.15rem;
  border-radius: var(--radius);
  background: var(--navy);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.875rem;
  border: 0;
  white-space: nowrap;
}
.btn:hover { background: var(--navy-dark); }
.btn--buy { background: var(--accent); color: #2a1d00; }
.btn--buy:hover { background: #e6a600; }

/* --- status --- */

.status {
  margin: 1rem 1.75rem;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  border: 1px solid var(--border);
}
.status--loading { background: rgba(255,184,0,.1); border-color: rgba(255,184,0,.35); }
.status--ok      { background: rgba(47,158,95,.1);  border-color: rgba(47,158,95,.3); }
.status--error   { background: rgba(200,50,50,.1);  border-color: rgba(200,50,50,.35); }

/* --- stats --- */

.stats {
  display: flex;
  flex-wrap: nowrap;
  border-top: 1px solid var(--border);
}
.stat {
  flex: 1 1 0;
  min-width: 0;
  padding: 1.1rem 1.5rem;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0;
}
.stat:last-child { border-right: none; }

.stat--primary .stat__value { color: var(--navy); }
@media (prefers-color-scheme: dark) {
  .stat--primary .stat__value { color: #7fb2ff; }
}
.stat--muted .stat__value { color: var(--text-muted); }

.stat__value {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.stat__label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
  margin-top: 0.35rem;
  font-weight: 700;
}
.stat__sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.1rem; }

/* --- meter --- */

.meter { padding: 0 1.75rem 1.25rem; }
.meter__bar {
  height: 6px;
  border-radius: 0;
  background: var(--border);
  overflow: hidden;
}
.meter__fill {
  display: block;
  height: 100%;
  background: var(--navy);
  border-radius: 0;
  transition: width .5s ease;
}
@media (prefers-color-scheme: dark) {
  .meter__fill { background: #4f8fe0; }
}
.meter__caption {
  margin: .5rem 0 0;
  font-size: .78rem;
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.meter__verify { font-size: .78rem; }

/* --- panels --- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.75rem;
  margin-bottom: 1.5rem;
}
.panel h2 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.panel__note { margin: 0 0 1rem; color: var(--text-soft); font-size: 0.875rem; }
.panel--empty { text-align: center; padding: 3rem 1.5rem; margin-top: 1.5rem; }
.panel--empty h1 { margin-top: 0; font-weight: 800; letter-spacing: -0.035em; }

/* --- stands --- */

.legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .35rem 1rem;
  margin: 0 0 1rem;
  padding: 0;
  font-size: .8rem;
  color: var(--text-soft);
}
.legend li { display: inline-flex; align-items: center; gap: .4rem; }
.swatch { width: 20px; height: 4px; border-radius: 0; display: inline-block; }
.swatch--free    { background: var(--free); }
.swatch--tight   { background: var(--accent); }
.swatch--soldout { background: #c0392b; }
.swatch--closed  { background: var(--closed); }
.swatch--unsold {
  background: repeating-linear-gradient(
    45deg, var(--closed) 0 3px, transparent 3px 6px
  ), var(--map-unsold-bg);
}

.stands { display: grid; gap: .75rem; }
.stand {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.stand__head {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  flex-wrap: wrap;
  padding: .7rem 1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.stand__name { font-weight: 700; font-size: .9rem; letter-spacing: -.01em; }
.stand__counts { margin-left: auto; font-size: .875rem; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.stand__counts strong { color: var(--text); font-weight: 700; }

.stand__body > :last-child { padding-bottom: .9rem; }
.blocks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: .45rem;
  padding: .75rem 1rem .25rem;
}

.tier {
  padding: .15rem 1rem .1rem;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  font-weight: 700;
}

.block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .5rem .65rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
  font-size: .85rem;
}
.block__top { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.block__name { font-weight: 700; }
.block__count { font-variant-numeric: tabular-nums; color: var(--text-soft); }
/* Track = sold, fill = still available. */
.block__bar { height: 4px; border-radius: 0; background: var(--sold); overflow: hidden; }
.block__fill { display: block; height: 100%; border-radius: 0; background: var(--free); transition: width .4s ease; }
.block--closed { opacity: .55; }
.block--closed .block__count { font-style: italic; }
.block--closed .block__bar { background: var(--closed); }
.block--tight .block__fill { background: var(--accent); }
.block--soldout .block__bar { background: #c0392b; }
.block--soldout .block__count { color: #c0392b; font-weight: 700; }

/* --- stadium map --- */

:root {
  --map-unsold-bg: #eef1f5;
  --map-unsold-line: #a6b0be;
  --map-outline: rgba(16, 32, 56, .35);
}
@media (prefers-color-scheme: dark) {
  :root {
    --map-unsold-bg: #182436;
    --map-unsold-line: #3a5068;
    --map-outline: rgba(230, 238, 248, .28);
  }
}

.stadium-map { width: 100%; position: relative; }
.stadium-map__svg { width: 100%; height: auto; display: block; }

.seg-shape {
  fill: var(--closed);
  stroke: var(--map-outline);
  stroke-width: 8;
  transition: fill .35s ease;
}
.seg-shape.seg--roomy   { fill: var(--free); }
.seg-shape.seg--tight   { fill: var(--accent); }
.seg-shape.seg--soldout { fill: #c0392b; }
.seg-shape.seg--unsold  { fill: url(#seg-hatch); }
.seg-shape.seg--empty   { fill: var(--map-unsold-bg); }

.seg-hatch__bg   { fill: var(--map-unsold-bg); }
.seg-hatch__line { stroke: var(--map-unsold-line); }

.seg-label { fill: #fff; }
g.seg--unsold .seg-label,
g.seg--empty .seg-label { fill: var(--text-soft); }

g[data-code] { cursor: pointer; outline: none; }
g[data-code]:hover .seg-shape,
g[data-code]:focus-visible .seg-shape { stroke: var(--text); stroke-width: 18; }

.map-tip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5;
  pointer-events: none;
  min-width: 8.5rem;
  max-width: 15rem;
  padding: .5rem .65rem;
  border-radius: var(--radius);
  background: var(--navy-dark);
  color: #fff;
  font-size: .82rem;
  line-height: 1.35;
  box-shadow: 0 4px 14px rgba(0,0,0,.28);
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.map-tip[hidden] { display: none; }
@media (prefers-color-scheme: dark) {
  .map-tip { background: #05264f; border: 1px solid var(--border); }
}
.map-tip strong { font-size: .875rem; font-weight: 700; }
.map-tip span { color: rgba(255,255,255,.78); }
.map-tip__bar {
  margin-top: .25rem;
  height: 4px;
  border-radius: 0;
  background: rgba(255,255,255,.2);
  overflow: hidden;
}
.map-tip__bar i {
  display: block;
  height: 100%;
  border-radius: 0;
  background: var(--free);
}

.map-caption {
  margin: .8rem 0 0;
  font-size: .8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* --- chart --- */

.chart { width: 100%; }
.chart svg { width: 100%; height: 220px; display: block; overflow: visible; }
.chart__grid { stroke: var(--border); stroke-width: 1; }
.chart__line { fill: none; stroke: var(--navy); stroke-width: 2; stroke-linejoin: round; stroke-linecap: square; }
.chart__area { fill: var(--navy); opacity: .07; }
.chart__dot { fill: var(--navy); }
.chart__label { fill: var(--text-muted); font-size: 11px; font-family: 'Plus Jakarta Sans', system-ui, sans-serif; font-weight: 600; }
@media (prefers-color-scheme: dark) {
  .chart__line { stroke: #4f8fe0; }
  .chart__dot { fill: #4f8fe0; }
  .chart__area { fill: #4f8fe0; }
}
.chart__empty { color: var(--text-soft); font-size: .875rem; padding: .5rem 0 0; margin: 0; }

/* --- prices --- */

.price-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.price-table th { text-align: left; font-weight: 600; padding: .6rem 0; vertical-align: top; }
.price-table td { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; padding: .6rem 0; white-space: nowrap; }
.price-table--single tr + tr th,
.price-table--single tr + tr td { border-top: 1px solid var(--border); }
.price-table--single { max-width: 32rem; }
.price-note { display: block; font-size: .78rem; color: var(--text-muted); font-weight: 500; margin-top: .1rem; }

/* --- footer --- */

.footer {
  padding: 1.25rem 0 2.5rem;
  color: var(--text-muted);
  font-size: .82rem;
  border-top: 1px solid var(--border);
  margin-top: .25rem;
}
.footer p { margin: .3rem 0; line-height: 1.5; }
.footer__meta { opacity: .8; }

/* --- responsive --- */

@media (max-width: 640px) {
  .hero__head { padding: 1.1rem; }
  .status { margin: 0.75rem 1.1rem; }
  .meter { padding: 0 1.1rem 1rem; }
  .panel { padding: 1.1rem; }
  .fixture-select { width: 100%; }
  .fixture-select select { flex: 1; max-width: none; }
}

@media (max-width: 560px) {
  .stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    flex-wrap: unset;
  }
  .stat {
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }
  .stat:nth-child(2n)       { border-right: none; }
  .stat:nth-last-child(-n+2) { border-bottom: none; }
  .stat__value { font-size: 1.7rem; }
  .stat { padding: .9rem 1.1rem; }
}
