/* ---------------------------------------------------------------------------
   Matches. One card per team: its live or next game up top, every game and
   the table in a <details> underneath. js/fixtures.js builds the insides.

   The point of the section is to get people to home games, so a home game is
   marked (red-tinted band, big red kick-off time) and an away game is deliberately
   quiet. Keep that imbalance if you restyle it.
   --------------------------------------------------------------------------- */

/* Several rules below set display, which would beat the UA's [hidden]. */
.fixtures [hidden] { display: none; }

.fixture-teams { display: grid; gap: 1.5rem; }
@media (min-width: 44rem) {
  .fixture-teams { grid-template-columns: 1fr 1fr; align-items: start; }
}

/* min-width: 0 lets the table scroll inside its card. Grid items default to
   min-width: auto, so without it a wide table stretches the card, and the
   page, past the edge of a phone screen. */
.fixture-team {
  display: flex; flex-direction: column; min-width: 0;
  border: 1px solid var(--rule); background: var(--bg);
}
.fixture-team-head { padding: 1rem 1.25rem 0.9rem; border-bottom: 1px solid var(--rule); }
.fixture-kicker {
  margin: 0 0 0.2rem; font-size: 0.85rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--slate);
}
.fixture-team-head h3 { font-size: clamp(1.25rem, 2.5vw, 1.5rem); color: var(--red-text); }

/* Without JS there is nothing to wait for, so no "loading" either. */
.fixture-loading { display: none; }
.js .fixture-loading { display: block; margin: 0; padding: 1.25rem; color: var(--slate); }
.fixture-empty { margin: 0; padding: 1.25rem; color: var(--slate); }

/* ---- the headline game ---- */
.fixture-flag {
  display: flex; align-items: center; gap: 0.6rem;
  margin: 0; padding: 0.6rem 1.25rem;
  font-family: var(--display); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em;
}
.is-home > .fixture-flag,
.is-live > .fixture-flag {
  background: var(--red-tint); color: var(--red-text);
  box-shadow: inset 4px 0 0 var(--red);
  font-size: clamp(1.15rem, 2.5vw, 1.4rem);
}
.is-away > .fixture-flag { background: var(--surface); color: var(--slate); font-size: 1rem; }

.fixture-body { padding: 1.1rem 1.25rem 1.4rem; }
.fixture-body > * { margin: 0; }

.fixture-when { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1rem; }
.fixture-date { font-size: clamp(1.15rem, 2.5vw, 1.4rem); }
.fixture-time { font-size: clamp(2.25rem, 6vw, 3.25rem); line-height: 1; }
.is-home .fixture-time { color: var(--red-text); }
.fixture-relative { margin-top: 0.15rem; color: var(--slate); font-weight: 700; }
.fixture-relative::first-letter { text-transform: uppercase; } /* "morgen" opens a line */

.fixture-teams-line {
  display: flex; flex-wrap: wrap; gap: 0 0.5rem;
  margin-top: 0.9rem; font-size: 1.1rem; font-weight: 700;
}
.fixture-teams-line .is-us { color: var(--red-text); }
.fixture-vs { color: var(--slate); font-weight: 400; }

.fixture-venue { margin-top: 0.4rem; color: var(--slate); font-size: 0.95rem; }
/* Live: the score is the headline. */
.fixture-live-dot {
  width: 0.65rem; height: 0.65rem; border-radius: 50%; background: var(--red);
  animation: fixture-pulse 1.6s ease-in-out infinite;
}
@keyframes fixture-pulse { 50% { opacity: 0.25; } }

.fixture-score-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  font-size: 1.15rem; font-weight: 700;
}
.fixture-score-row + .fixture-score-row { margin-top: 0.35rem; }
.fixture-score-row.is-us .fixture-score-team { color: var(--red-text); }
.fixture-score-points {
  font-family: var(--display); font-size: clamp(2rem, 5vw, 2.75rem); line-height: 1;
}

.is-break .fixture-list { margin-top: 0.75rem; }

/* Today's result, held on the card until midnight. */
.is-result > .fixture-flag .fixture-outcome { margin-left: auto; font-family: var(--ui); }
.fixture-next-up {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.35rem;
  margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid var(--rule);
  font-size: 0.95rem; color: var(--slate);
}
.fixture-next-up-label { font-weight: 700; }

/* ---- the fold-out, styled after the membership application's ---- */
.fixture-more { border-top: 1px solid var(--rule); }
.fixture-more > summary {
  cursor: pointer; list-style: none;
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.9rem 1.25rem;
  font-family: var(--display); font-weight: 600; font-size: 1.05rem;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.fixture-more > summary::-webkit-details-marker { display: none; }
.fixture-more > summary::before {
  content: ''; width: 0; height: 0;
  border-left: 0.5rem solid var(--red);
  border-top: 0.35rem solid transparent;
  border-bottom: 0.35rem solid transparent;
  transition: transform 0.15s ease;
}
.fixture-more[open] > summary::before { transform: rotate(90deg); }
.fixture-more > summary:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; }

.fixture-more-body { padding: 0 1.25rem 1.25rem; }
.fixture-more-title {
  margin: 1.25rem 0 0.5rem; font-size: 0.85rem; letter-spacing: 0.08em; color: var(--slate);
}
.fixture-more-title:first-child { margin-top: 0.25rem; }
.fixture-more-body .fixture-empty { padding: 0; }

.fixture-list { list-style: none; margin: 0; padding: 0; font-size: 0.95rem; }
.fixture-row {
  display: flex; align-items: baseline; gap: 0.6rem;
  padding: 0.5rem 0.5rem 0.5rem 0.65rem;
  border-bottom: 1px solid var(--rule); border-left: 3px solid transparent;
}
/* Home games stand out in the list as well, not only in the headline. */
.fixture-row.is-home { border-left-color: var(--red); background: var(--surface); }
.fixture-row.is-home .fixture-row-opponent { font-weight: 700; }

.fixture-row-date { flex: 0 0 5.5em; white-space: nowrap; }
.fixture-row-time { flex: 0 0 3em; font-weight: 700; }
.fixture-row-opponent { flex: 1; min-width: 0; }
.fixture-row-note { color: var(--slate); font-style: italic; white-space: nowrap; }
.fixture-row-result { display: flex; align-items: baseline; gap: 0.5rem; white-space: nowrap; }
.fixture-row-note, .fixture-row-result { margin-left: auto; }

/* Phones: club names like "Heidelberger Turnverein 1846" get a line of their
   own under date, time and badge, rather than one word per line. */
@media (max-width: 30rem) {
  .fixture-row { flex-wrap: wrap; row-gap: 0.15rem; }
  .fixture-row-opponent { order: 1; flex-basis: 100%; }
}
.fixture-row-score { font-weight: 700; font-variant-numeric: tabular-nums; }

.fixture-badge {
  flex: 0 0 auto; min-width: 3.4em; text-align: center;
  padding: 0.05rem 0.35rem; border-radius: 2px;
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
}
.fixture-badge.is-home { background: var(--red); color: #fff; }
.fixture-badge.is-away { box-shadow: inset 0 0 0 1px var(--rule); color: var(--slate); }

.fixture-outcome {
  display: inline-grid; place-items: center;
  width: 1.5em; height: 1.5em; border-radius: 2px;
  font-size: 0.8rem; font-weight: 700;
}
/* Win is our red, loss stays neutral: no green, no second accent colour. */
.fixture-outcome.is-win { background: var(--red); color: #fff; }
.fixture-outcome.is-loss { background: var(--fg); color: var(--bg); }
.fixture-outcome.is-draw { box-shadow: inset 0 0 0 1px var(--slate); }

/* ---- league table ---- */
.fixture-table-wrap { overflow-x: auto; }
.fixture-table {
  width: 100%; border-collapse: collapse; font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
.fixture-table th, .fixture-table td {
  padding: 0.45rem 0.4rem; text-align: center; border-bottom: 1px solid var(--rule);
}
.fixture-table thead th {
  background: var(--fg); color: var(--bg);
  font-family: var(--display); font-weight: 600; letter-spacing: 0.06em;
}
.fixture-table abbr { text-decoration: none; }
.fixture-table .col-team { text-align: left; font-weight: 400; }
.fixture-table tbody .col-team { min-width: 9rem; }
.fixture-table .col-points { font-weight: 700; }
.fixture-table tr.is-us { background: var(--surface); }
.fixture-table tr.is-us > * { font-weight: 700; }
.fixture-table tr.is-us > :first-child { box-shadow: inset 3px 0 0 var(--red); }
.fixture-table tr.is-us .col-team { color: var(--red-text); }

/* Phones: drop W/D/L, which played and points already summarise. */
@media (max-width: 30rem) {
  .fixture-table .col-won, .fixture-table .col-drawn, .fixture-table .col-lost { display: none; }
  .fixture-table th, .fixture-table td { padding-inline: 0.25rem; }
  .fixture-table tbody .col-team { min-width: 0; }
}

/* ---- both teams at home on one day ---- */
.fixture-matchday {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1rem;
  margin: -1rem 0 1.5rem; padding: 0.9rem 1.25rem;
  background: var(--red-tint); box-shadow: inset 4px 0 0 var(--red);
}
.fixture-matchday-title { font-size: clamp(1.15rem, 3vw, 1.5rem); letter-spacing: 0.06em; color: var(--red-text); }
.fixture-matchday-games { display: flex; flex-wrap: wrap; gap: 0 1rem; font-weight: 700; }

@media (prefers-reduced-motion: reduce) {
  .fixture-live-dot { animation: none; }
  .fixture-more > summary::before { transition: none; }
}

/* The way out to the full list, last in every card. */
.fixture-source {
  display: block; margin-top: auto; padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--rule);
  font-size: 0.85rem; color: var(--slate);
}
.fixture-source::after { content: '\00a0↗'; }
