/* Global Open Wheel, public site.
   The look is a race classification document: hairline rules, tabular figures,
   chequer as texture, and crimson spent sparingly so it still means something.
   Palette is the brand kit in assets/brand/README.md, not invented here. */

:root {
  --ink:          #0A0D14;
  --ink-raised:   #101521;
  --ink-sunken:   #070910;
  --slate:        #1F2937;
  --bone:         #F3F4F6;
  --crimson:      #E11D48;
  --crimson-deep: #9F1239;

  --text:      #F3F4F6;
  --text-dim:  rgba(243, 244, 246, 0.58);
  --text-faint:rgba(243, 244, 246, 0.34);
  --line:      rgba(243, 244, 246, 0.11);
  --line-firm: rgba(243, 244, 246, 0.22);

  --display: "IBM Plex Sans Condensed", "Helvetica Neue", sans-serif;
  --body:    "IBM Plex Sans", "Helvetica Neue", sans-serif;
  --mono:    "IBM Plex Mono", ui-monospace, monospace;

  --gutter: clamp(1.25rem, 4vw, 4rem);
  --measure: 1440px;
}

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

html { -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; }

body {
  /* One short page, so the footer has to be pushed down rather than left
     floating halfway up a tall window. */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  font-feature-settings: "kern" 1;
}

/* --- the chequer, used as a rule rather than a decoration ---------------- */

.chequer {
  height: 6px;
  background-image:
    linear-gradient(45deg, var(--bone) 25%, transparent 25%, transparent 75%, var(--bone) 75%),
    linear-gradient(45deg, var(--bone) 25%, transparent 25%, transparent 75%, var(--bone) 75%);
  background-size: 12px 12px;
  background-position: 0 0, 6px 6px;
  background-color: var(--ink-sunken);
  opacity: 0.85;
}
.chequer--crimson {
  background-image:
    linear-gradient(45deg, var(--crimson) 25%, transparent 25%, transparent 75%, var(--crimson) 75%),
    linear-gradient(45deg, var(--crimson) 25%, transparent 25%, transparent 75%, var(--crimson) 75%);
}

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

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(10, 13, 20, 0.86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.masthead__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 64px;
  flex-wrap: wrap;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: var(--text);
}
.wordmark svg { display: block; flex: none; }
.wordmark__text {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1;
}
.wordmark__text span { color: var(--crimson); }

.nav {
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 2vw, 1.9rem);
  flex-wrap: wrap;
}
.nav a {
  font-family: var(--display);
  font-size: 0.82rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--text-dim);
  text-decoration: none;
  padding: 0.35rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.16s ease, border-color 0.16s ease;
}
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--crimson); }

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.85rem 1.5rem;
  border: 1px solid transparent;
  background: var(--crimson);
  color: #fff;
  position: relative;
  transition: background 0.16s ease, transform 0.16s ease;
}
.btn:hover { background: var(--crimson-deep); transform: translateY(-1px); }
.btn--ghost {
  background: transparent;
  border-color: var(--line-firm);
  color: var(--text);
}
.btn--ghost:hover { background: rgba(243, 244, 246, 0.06); border-color: var(--bone); }
.btn--sm { padding: 0.5rem 1rem; font-size: 0.82rem; letter-spacing: 0.13em; }
.btn svg { flex: none; }

.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 1.5rem;
  align-items: start;
}

/* --- panels -------------------------------------------------------------- */

.panel {
  background: var(--ink-raised);
  border: 1px solid var(--line);
  position: relative;
}
.panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.panel__title {
  font-family: var(--display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 0;
}
.panel__more {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-decoration: none;
}
.panel__more:hover { color: var(--crimson); }
.panel__body { padding: 1.25rem; }

/* next race, the one card that should feel like a session sheet */
.session { display: grid; gap: 0.1rem; }
.session__round {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.session__track {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  line-height: 1.05;
  text-transform: uppercase;
  margin: 0.35rem 0 0.15rem;
}
.session__config { color: var(--text-dim); font-size: 0.95rem; margin-bottom: 1.1rem; }

.sessions {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
}
.sessions div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
}
.sessions dt, .sessions .k {
  font-family: var(--display);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.sessions .v { font-family: var(--mono); font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.sessions .v--hot { color: var(--crimson); font-weight: 600; }

.conditions {
  margin-top: 1rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-faint);
  letter-spacing: 0.04em;
}

/* --- section headers ----------------------------------------------------- */

.section { padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.section__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--line-firm);
}
.section h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.7rem, 3.6vw, 2.6rem);
  letter-spacing: -0.01em;
  text-transform: uppercase;
  margin: 0;
  line-height: 1;
}
.section__meta {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  letter-spacing: 0.06em;
}

/* --- tables, the heart of the thing -------------------------------------- */

.tablewrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--ink-raised);
}

table.sheet {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
table.sheet thead th {
  position: sticky;
  top: 0;
  background: var(--ink-sunken);
  font-family: var(--display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-align: left;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--line-firm);
  z-index: 2;
}
table.sheet td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.93rem;
}
table.sheet tbody tr:last-child td { border-bottom: 0; }
table.sheet tbody tr { transition: background 0.12s ease; }
table.sheet tbody tr:hover { background: rgba(243, 244, 246, 0.035); }

.num { font-family: var(--mono); text-align: right; }
.num--strong { font-weight: 600; }

/* position: the leader gets the crimson spine, and only the leader */
.pos {
  font-family: var(--mono);
  font-weight: 600;
  width: 3.5rem;
  color: var(--text-dim);
  border-left: 3px solid transparent;
}
tr.is-leader .pos { border-left-color: var(--crimson); color: var(--text); }
tr.is-podium .pos { color: var(--text); }

.car {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.86rem;
  color: var(--ink);
  background: var(--bone);
  padding: 0.12rem 0.42rem;
  letter-spacing: 0.02em;
}
tr.is-leader .car { background: var(--crimson); color: #fff; }

.who { font-weight: 500; width: 99%; }
.who a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--line-firm); }
.who a:hover { border-bottom-color: var(--crimson); color: var(--crimson); }

.tag {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  border: 1px solid var(--line);
  padding: 0.05rem 0.35rem;
  margin-left: 0.5rem;
}

.pill {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--line-firm);
  color: var(--text-dim);
}
.pill--reserve { border-color: rgba(225,29,72,.4); color: var(--crimson); }
.pill--live { border-color: var(--crimson); color: #fff; background: var(--crimson); }

/* per-round cells in the standings grid */
.cell {
  font-family: var(--mono);
  font-size: 0.78rem;
  text-align: center;
  width: 2.6rem;
  color: var(--text-dim);
}
.cell--win { color: var(--crimson); font-weight: 700; }
/* Brackets, not a strikethrough: a struck-through single digit is illegible
   at this size and reads as a stray glyph. */
.cell--dropped { color: var(--text-faint); }
.cell--absent { color: rgba(243,244,246,.16); }

.raw { color: var(--text-faint); font-size: 0.8rem; }

/* --- cards --------------------------------------------------------------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.card {
  background: var(--ink-raised);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  text-decoration: none;
  color: inherit;
  position: relative;
  transition: background 0.16s ease;
}
a.card:hover { background: #141a28; }
a.card:hover .card__title { color: var(--crimson); }
.card__kicker {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.card__title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.35rem;
  text-transform: uppercase;
  line-height: 1.1;
  margin: 0;
  transition: color 0.16s ease;
}
.card__meta { font-family: var(--mono); font-size: 0.8rem; color: var(--text-dim); }
.card--next { border-left: 3px solid var(--crimson); }
.card--done .card__title { color: var(--text-dim); }

/* --- stat strip ---------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.stat { background: var(--ink-raised); padding: 1.1rem 1.25rem; }
.stat__n {
  font-family: var(--mono);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat__n--hot { color: var(--crimson); }
.stat__k {
  font-family: var(--display);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-top: 0.45rem;
}

/* --- empty states -------------------------------------------------------- */

.empty {
  border: 1px dashed var(--line-firm);
  padding: clamp(2rem, 5vw, 3.5rem);
  text-align: center;
  color: var(--text-dim);
}
.empty h3 {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 1.25rem;
  margin: 0 0 0.5rem;
  color: var(--text);
}
.empty p { margin: 0 auto; max-width: 48ch; }

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

main { flex: 1 0 auto; }

.foot {
  margin-top: clamp(3rem, 7vw, 5rem);
  border-top: 1px solid var(--line);
  background: var(--ink-sunken);
}
.foot__inner {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding-block: 2rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}
.foot a { color: var(--text-dim); text-decoration: none; border-bottom: 1px solid var(--line); }
.foot a:hover { color: var(--crimson); }
.foot__note { font-family: var(--mono); font-size: 0.74rem; color: var(--text-faint); max-width: 52ch; }

/* --- misc ---------------------------------------------------------------- */

.skip {
  position: absolute; left: -9999px;
  background: var(--crimson); color: #fff; padding: 0.75rem 1rem; z-index: 50;
}
.skip:focus { left: var(--gutter); top: 0.5rem; }

:focus-visible { outline: 2px solid var(--crimson); outline-offset: 2px; }

.crumb {
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.75rem;
}
.crumb a { color: var(--text-dim); text-decoration: none; }
.crumb a:hover { color: var(--crimson); }

.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.5rem; }

/* --- the front page ------------------------------------------------------
   One page while the season is being put together. Same classification-sheet
   language as the rest: mono kickers, hairline rules, crimson only where it
   has to mean something. */

/* --- the bulletin -------------------------------------------------------- */

.bulletin { border: 1px solid var(--line); border-left: 3px solid var(--crimson); background: var(--ink-raised); }
.bulletin__head { padding: 1.5rem clamp(1.25rem, 3vw, 2.25rem) 0; }
.bulletin__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.bulletin__meta .is-tag { color: var(--crimson); }
.bulletin__title {
  font-family: var(--display);
  font-weight: 700;
  text-transform: uppercase;
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  line-height: 1.02;
  letter-spacing: -0.01em;
  margin: 0.9rem 0 0;
}
.bulletin__body { padding: 1.25rem clamp(1.25rem, 3vw, 2.25rem) 1.75rem; }
.bulletin__body p { margin: 0 0 1.1rem; }
.bulletin__body p:last-child { margin-bottom: 0; }
/* The opening paragraph carries the announcement, so it is set larger. */
.bulletin__body p:first-child { font-size: 1.1rem; color: var(--text); }
.bulletin__body strong { color: var(--text); font-weight: 600; }

/* --- the Discord call ---------------------------------------------------- */

.join {
  display: flex;
  align-items: center;
  gap: clamp(1.25rem, 4vw, 2.5rem);
  flex-wrap: wrap;
  border: 1px solid var(--line-firm);
  background: var(--ink-raised);
  padding: clamp(1.5rem, 4vw, 2.5rem);
}
.join__mark { color: #5865F2; flex: none; }
.join__text { flex: 1 1 22rem; }
.join__text h2 {
  font-family: var(--display);
  font-weight: 700;
  text-transform: uppercase;
  font-size: clamp(1.3rem, 3vw, 1.9rem);
  margin: 0 0 0.5rem;
  line-height: 1.05;
}
.join__text p { margin: 0; color: var(--text-dim); max-width: 54ch; }

/* Discord's own blurple, because the button is a door to Discord and needs to
   read as one. Crimson stays the league's colour. */
.btn--discord { background: #5865F2; }
.btn--discord:hover { background: #4752C4; }
