/*
 * A league's page, after the competition header (competition.css): a card
 * per team with the next fixtures in a column beside them; on phones, a row
 * per team, then the fixtures.
 */

.league-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 380px);
  gap: 48px 40px;
  align-items: start;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 40px var(--gutter) 64px;
}

.next-fixtures:only-child {
  grid-column: 1 / -1;
  max-width: 626px;
}

@media (width <= 1000px) {
  .league-body {
    grid-template-columns: minmax(0, 1fr);
  }
}

.next-fixtures .section-title {
  margin-bottom: 0;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--ink);
}

.teams {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.team {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
  justify-items: center;
  padding: 16px 12px 12px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  background: var(--surface);
  text-align: center;
}

.crest {
  display: block;
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.team-name {
  align-self: center;
  font-weight: 700;
  line-height: 1.25;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.team .button {
  justify-self: stretch;
  min-height: 44px;
}

/* In the narrow column beside the teams, a fixture's time sits in a narrower column. */
.next-fixtures .fixture {
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 4px 16px;
}

.next-fixtures .when-stacked .when-date {
  font-size: 17px;
}

.next-fixtures .when-stacked :is(.when-time, .when-allday) {
  font-size: 24px;
}

.next-fixtures .fixture-title {
  font-size: 17px;
}

.fixtures-none {
  padding: 16px 0;
  color: var(--muted);
}

/* Phones: a row per team, crest then name, with Subscribe at the end. */
@media (width <= 640px) {
  .teams {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .team {
    grid-template-columns: 48px minmax(0, 1fr) auto;
    grid-template-rows: none;
    gap: 14px;
    place-items: center start;
    padding: 10px 0;
    border: 0;
    border-bottom: 1px solid var(--rule);
    border-radius: 0;
    background: none;
    text-align: start;
  }

  .crest {
    width: 48px;
    height: 48px;
  }

  .team-name {
    font-size: 17px;
    text-wrap: pretty;
  }

  .team .button {
    justify-self: end;
    padding: 0 16px;
  }

  .section-title {
    font-size: 30px;
  }
}

/* The narrowest phones: a smaller crest and button leave room for "Middlesbrough". */
@media (width <= 380px) {
  .team {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    gap: 12px;
  }

  .crest {
    width: 40px;
    height: 40px;
  }

  .team-name {
    font-size: 16px;
  }

  .team .button {
    padding: 0 12px;
    font-size: 15px;
  }
}
