/* Match-related styling (Carnival theme).
 * Existing class names are preserved so views don't need wholesale renames;
 * they are restyled here to match the Carnival look.
 * ---------------------------------------------------------------------- */

/* Match card (used in grids and lists)
 * ------------------------------------------------------------------ */

.match-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-l);
  color: var(--color-ink);
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
  padding: var(--space-l);
  text-decoration: none;
  transition: transform 180ms, border-color 180ms, box-shadow 180ms;
}

.match-card:hover {
  border-color: var(--color-border-strong);
  box-shadow: 0 24px 50px -22px oklch(var(--lch-ink-darkest) / 0.22);
  color: var(--color-ink);
  transform: translateY(-3px);
}

.match-card__meta {
  align-items: center;
  color: var(--color-ink-medium);
  display: flex;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  gap: var(--space-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.match-card__scoreline {
  align-items: center;
  display: grid;
  gap: var(--space-m);
  grid-template-columns: 1fr auto 1fr;
}

.match-card__team {
  align-items: center;
  display: flex;
  flex-direction: column;
  font-size: var(--text-small);
  font-weight: 500;
  gap: var(--space-xxs);
  min-width: 0;
  text-align: center;
}

.match-card__team-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-card__score {
  background-color: var(--color-sun);
  border-radius: 0.75rem;
  color: var(--color-ink);
  flex-shrink: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: -0.02em;
  padding: 0.2rem 0.625rem;
  white-space: nowrap;
}

/* Match header / scoreline (Carnival hero score)
 * ------------------------------------------------------------------ */

.match-header__meta {
  align-items: center;
  color: var(--color-ink-medium);
  display: flex;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  gap: var(--space-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.match-scoreline {
  align-items: center;
  display: grid;
  gap: var(--gutter, 1rem);
  grid-template-columns: 1fr auto 1fr;
  padding-block: var(--space-xl);
}

.match-scoreline > .match-scoreline__team:first-of-type {
  justify-self: end;
}

.match-scoreline > .match-scoreline__team:last-of-type {
  justify-self: start;
}

.match-scoreline__team {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: var(--space-xxs);
  text-align: center;
}

.match-scoreline__team-name {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.match-scoreline__formation {
  color: var(--color-ink-medium);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.match-scoreline__score {
  align-items: center;
  color: var(--color-ink);
  display: flex;
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 7vw, 4rem);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  gap: var(--space-s);
  letter-spacing: -0.03em;
  line-height: 1;
  white-space: nowrap;
}

.match-scoreline__separator {
  color: var(--color-ink-medium);
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 400;
}

/* Tab navigation — Carnival pill row
 * ------------------------------------------------------------------ */

.match-tabs-nav {
  background-color: var(--color-surface-2);
  border-radius: 99rem;
  display: inline-flex;
  gap: 0.25rem;
  max-inline-size: 100%;
  overflow-x: auto;
  padding: 0.25rem;
  scrollbar-width: none;
  width: fit-content;
}

.match-tabs-nav::-webkit-scrollbar {
  display: none;
}

.match-tabs-nav__link {
  border-radius: 99rem;
  color: var(--color-ink-dark);
  display: inline-block;
  flex-shrink: 0;
  font-family: var(--font-sans);
  font-size: 0.825rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  text-decoration: none;
  transition: background-color 150ms, color 150ms, box-shadow 150ms;
  white-space: nowrap;
}

.match-tabs-nav__link:hover {
  color: var(--color-ink);
}

.match-tabs-nav__link.is-active {
  background-color: var(--color-surface);
  box-shadow: 0 6px 14px -6px oklch(var(--lch-ink-darkest) / 0.22);
  color: var(--color-ink);
}

/* Tab content
 * ------------------------------------------------------------------ */

.match-tabs-content {
  padding-block: var(--space-l);
}

/* Statistics — two-segment Carnival bar
 * ------------------------------------------------------------------ */

.match-stat {
  padding-block: var(--space-s);
}

.match-stat__row {
  align-items: baseline;
  display: grid;
  gap: var(--space-s);
  grid-template-columns: 3.5rem 1fr 3.5rem;
  margin-block-end: var(--space-xxs);
}

.match-stat__value {
  font-family: var(--font-mono);
  font-size: var(--text-small);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.match-stat__value--home {
  text-align: end;
}

.match-stat__label {
  color: var(--color-ink-medium);
  font-family: var(--font-mono);
  font-size: var(--text-xx-small);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-align: center;
  text-transform: uppercase;
}

.match-stat__bar {
  display: flex;
  gap: 0.25rem;
  height: 0.5rem;
}

.match-stat__bar-fill {
  background-color: var(--color-accent);
  border-radius: 0.25rem;
  height: 100%;
}

.team-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-s);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--color-ink-medium);
}

.team-legend__item::before {
  content: "";
  display: inline-block;
  inline-size: 0.625rem;
  block-size: 0.625rem;
  border-radius: 50%;
  margin-inline-end: 0.375rem;
}

.team-legend__item--home::before {
  background-color: oklch(var(--lch-blue-dark));
}

.team-legend__item--away::before {
  background-color: oklch(var(--lch-pink-medium));
}

.team-legend__item--goal::before {
  background-color: transparent;
  border: 2px solid var(--color-ink);
}

.match-log__link:hover,
.match-log__link:focus-visible {
  color: var(--color-ink);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.top-performers__team {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.top-performers__team--home {
  color: oklch(var(--lch-blue-dark));
}

.top-performers__team--away {
  color: oklch(var(--lch-pink-medium));
}

.top-performers__card--home {
  border-color: oklch(var(--lch-blue-dark));
}

.top-performers__card--away {
  border-color: oklch(var(--lch-pink-medium));
}

.match-stat__bar-fill--home {
  background-color: oklch(var(--lch-blue-dark));
}

.match-stat__bar-fill--away {
  background-color: oklch(var(--lch-pink-medium));
}

/* Match info
 * ------------------------------------------------------------------ */

.match-info-dl {
  display: grid;
  gap: var(--space-m) var(--space-l);
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
}

.match-info-dl dt {
  color: var(--color-ink-medium);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin: 0;
  text-transform: uppercase;
}

.match-info-dl dd {
  font-size: var(--text-normal);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  margin: 0;
}

/* One player's match card, opened from the lineup pitch
 * ------------------------------------------------------------------ */

.participant-card {
  align-items: flex-start;
  flex-wrap: nowrap;
}

.participant-card__identity {
  align-items: center;
  flex-wrap: nowrap;
  min-width: 0;
}

.participant-card__number {
  color: var(--color-ink-medium);
  flex: none;
  font-family: var(--font-mono);
  font-size: 2rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  line-height: 1;
  min-width: 3ch;
  text-align: center;
}

/* Lineups
 * ------------------------------------------------------------------ */

.lineup-section {
  display: flex;
  flex-direction: column;
}

.lineup-section__label {
  color: var(--color-ink-medium);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin-block: var(--space-s);
  text-transform: uppercase;
}

.lineup-player {
  align-items: center;
  border-block-end: 1px solid var(--color-border);
  display: grid;
  font-size: var(--text-small);
  gap: var(--space-s);
  grid-template-columns: 2rem 1fr auto;
  padding-block: var(--space-xs);
}

.lineup-player:first-of-type {
  border-block-start: 1px solid var(--color-border);
}

.lineup-player:last-of-type {
  border-block-end: 0;
}

.lineup-player__number {
  color: var(--color-ink-medium);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  text-align: end;
}

.lineup-player__name {
  font-size: var(--text-small);
}

.lineup-player__meta {
  display: flex;
  gap: var(--space-s);
  justify-content: flex-end;
}

.lineup-player__slot,
.lineup-formation {
  color: var(--color-ink-medium);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
}

.lineup-player__subbed {
  color: var(--color-ink-medium);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
}

/* Team competition row
 * ------------------------------------------------------------------ */

.team-competition-row {
  border-block-end: 1px solid var(--color-border);
  color: var(--color-ink);
  display: block;
  font-size: var(--text-small);
  font-weight: 600;
  padding-block: var(--space-s);
  text-decoration: none;
}

.team-competition-row:first-child {
  border-block-start: 1px solid var(--color-border);
}

.team-competition-row:last-child {
  border-block-end: 0;
}

.team-competition-row:hover {
  color: var(--color-accent);
}

/* Form tab
 * ------------------------------------------------------------------ */

.form-row {
  align-items: center;
  border-block-end: 1px solid var(--color-border);
  color: var(--color-ink);
  display: grid;
  gap: var(--space-s);
  grid-template-columns: auto 1fr auto auto;
  padding-block: var(--space-xs);
  text-decoration: none;
}

.form-row:first-child {
  border-block-start: 1px solid var(--color-border);
}

.form-row:hover {
  background-color: var(--color-hover);
}

.form-row__opponent {
  font-size: var(--text-small);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.form-row__score {
  background-color: var(--color-surface-2);
  border-radius: 0.4rem;
  font-family: var(--font-mono);
  font-size: var(--text-small);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  white-space: nowrap;
}

.form-row__meta {
  color: var(--color-ink-medium);
  font-family: var(--font-mono);
  font-size: var(--text-xx-small);
  overflow: hidden;
  text-align: end;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.form-result {
  align-items: center;
  border-radius: 4px;
  color: var(--color-ink-inverted);
  display: inline-flex;
  font-family: var(--font-mono);
  font-size: var(--text-xx-small);
  font-weight: 700;
  height: 1.2rem;
  justify-content: center;
  min-inline-size: 1.2rem;
  padding-inline: 0.2rem;
  text-transform: uppercase;
}

.form-result--w {
  background-color: oklch(var(--lch-green-dark));
}

.form-result--d {
  background-color: var(--color-ink-medium);
}

.form-result--l {
  background-color: oklch(var(--lch-red-dark));
}

/* Key events timeline
 * ------------------------------------------------------------------ */

.key-events {
  display: flex;
  flex-direction: column;
  list-style: none;
  margin: 0;
  padding: 0;
}

.key-event {
  align-items: center;
  display: flex;
  gap: var(--space-m);
  padding-block: var(--space-xs);
}

/* The key over the timeline: each club above its own column, ruled off from
   the events under it. */
.key-events__key {
  border-block-end: 1px solid var(--color-border-subtle);
  font-weight: 600;
  padding-block-end: var(--space-xs);
}

.key-events__spacer {
  flex: 0 0 auto;
  min-inline-size: 2.25rem;
}

.key-event__side {
  align-items: center;
  display: flex;
  flex: 1 1 0;
  font-size: 0.8125rem;
  gap: var(--space-s);
  min-inline-size: 0;
}

.key-event__side--home {
  flex-direction: row-reverse;
  justify-content: flex-start;
  text-align: end;
}

.key-event__side--away {
  justify-content: flex-start;
}

.key-event__minute {
  background-color: var(--color-surface-2);
  border-radius: 99rem;
  color: var(--color-ink-medium);
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: var(--text-xx-small);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: 0.05em;
  min-inline-size: 2.25rem;
  padding: 0.15rem 0.55rem;
  text-align: center;
  white-space: nowrap;
}

.key-event-divider {
  align-items: center;
  display: flex;
  gap: var(--space-s);
  padding-block: var(--space-s);
}

.key-event-divider::before,
.key-event-divider::after {
  border-block-start: 1px solid var(--color-border);
  content: "";
  flex: 1 1 0;
}

.key-event-divider__label {
  color: var(--color-ink-medium);
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: var(--text-xx-small);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.key-event__icon {
  block-size: 1.25rem;
  flex-shrink: 0;
  inline-size: 1.25rem;
}

.key-event__icon--goal {
  align-items: center;
  display: inline-flex;
  font-size: 1.1rem;
  justify-content: center;
  line-height: 1;
}

.key-event__icon--own-goal {
  filter: grayscale(1);
  opacity: 0.75;
}

.key-event__icon--sub {
  color: var(--color-ink-medium);
}

.key-event__body {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.key-event__player {
  color: var(--color-ink);
  font-weight: 600;
  overflow: hidden;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.key-event__player:hover {
  color: var(--color-accent);
}

.key-event__kind {
  color: var(--color-ink-medium);
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.key-event__sub {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.key-event__sub-row {
  align-items: center;
  display: flex;
  gap: var(--space-xxs);
  min-width: 0;
}

.key-event__side--home .key-event__sub-row {
  flex-direction: row-reverse;
}

.key-event__sub-arrow {
  color: var(--color-ink-medium);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
}

.key-event__sub-row--in .key-event__sub-arrow {
  color: oklch(var(--lch-green-dark));
}

.key-event__sub-row--out .key-event__sub-arrow {
  color: var(--color-cobalt);
}

.key-event__player--out {
  color: var(--color-ink-medium);
  font-weight: 500;
}

/* Centered title for the key events card (replaces the default left-aligned
 * section-label since the timeline is symmetric around the minute pill). */
.key-events__title {
  display: block;
  text-align: center;
}

/* Mobile: tighten the match scoreline so it fits comfortably on small screens. */
@media (max-width: 30rem) {
  .match-narrative {
    font-size: 0.875rem;
  }

  .match-header__meta {
    font-size: 0.5625rem;
  }

  .match-scoreline {
    padding-block: var(--space-s);
  }

  .match-scoreline__team-name {
    font-size: 1rem;
  }

  .match-scoreline__score {
    font-size: 1.75rem;
    gap: var(--space-xs);
  }

  .match-scoreline__separator {
    font-size: 1.1rem;
  }

  .match-scoreline__formation {
    font-size: 0.55rem;
  }

  .match-scoreline .crest {
    --crest-size: 2rem !important;
  }

  .key-events__title {
    font-size: 0.6rem;
  }
}

/* Mobile: keep the symmetric desktop layout (home | pill | away) but
 * tighten gaps and let long player names wrap to a second line instead of
 * being truncated to "Player ..." */
@media (max-width: 30rem) {
  .key-event {
    gap: var(--space-xs);
  }

  .key-event__side {
    font-size: 0.75rem;
  }

  .key-event__kind {
    font-size: 0.55rem;
  }

  .key-event__minute {
    font-size: 0.55rem;
    min-inline-size: 0;
    padding-inline: 0.4rem;
  }

  .key-event__player {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }
}

/* Match Q&A cards (info tab) */
.match-faq__question {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
}

.match-faq__answer {
  color: var(--color-ink-medium);
  margin: 0;
}
