/*
 * Every competition by sport: on the home page (the headline beside Next up,
 * then the list) and on each sport's page. Wide screens list the sports
 * beside the competitions, which scroll past a sport at a time under a
 * sticky list of sports; phones get a tile per sport on the home page and
 * the sport's groups as chips on its page.
 */

.home-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 626px);
  gap: 24px 48px;
  align-items: start;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 28px var(--gutter) 12px;
}

.lede h1 {
  font: 800 clamp(48px, 7vw, 108px) / 0.9 var(--font-display);
  overflow-wrap: anywhere;
}

.slogan {
  margin-top: clamp(14px, 1.8vw, 26px);
  color: var(--muted);
  font-size: clamp(18px, 1.6vw, 20px);
}

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

/* A count beside a sport's or group's name; positioned to keep its words for screen readers inside a scrolling row. */
.tally {
  position: relative;
  color: var(--muted);
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

/* The list of sports beside their competitions. */
.sports {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
  max-width: var(--page-max);
  margin: 44px auto 0;
  padding: 0 var(--gutter) 24px;
}

.sport-nav {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  border-top: 2px solid var(--ink);
  scrollbar-width: thin;
}

.sport-nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sport-nav a {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding: 0 10px;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  font: 700 17px/1 var(--font-display);
  letter-spacing: 0.03em;
  text-decoration: none;
  text-transform: uppercase;
  transition: background-color 160ms var(--ease-out);
}

.sport-nav a:focus-visible {
  outline-offset: -3px;
}

@media (hover: hover) {
  .sport-nav a:not([aria-current]):hover {
    background: color-mix(in srgb, var(--ink) 8%, transparent);
  }
}

.sport-nav a[aria-current] {
  background: var(--button);
  color: var(--button-ink);
}

/* A sport: its heading and count, then each group's competitions in two columns. */
.sport {
  scroll-margin-top: 16px;
}

.sport + .sport {
  margin-top: 56px;
}

.sport-title {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--ink);
  font: 800 34px/1 var(--font-display);
  text-transform: uppercase;
}

.sport-title .tally {
  font-size: 20px;
}

.group-title {
  margin: 28px 0 2px;
  color: var(--muted);
  font: 700 13px/1 var(--font-body);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sport-title + .group-title {
  margin-top: 20px;
}

.rows {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr));
  column-gap: 40px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* A competition: colour, its name over its teams or next fixture (a link to its page), then Teams and Subscribe. */
.row {
  position: relative;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--rule);
}

.row .swatch {
  align-self: start;
  margin-top: 8px;
}

.row-link {
  display: grid;
  gap: 2px;
  align-content: center;
  min-height: 52px;
  color: var(--ink);
  text-decoration: none;
}

.row-name {
  font-weight: 700;
  overflow-wrap: anywhere;
}

@media (hover: hover) {
  .row-link:hover .row-name {
    text-decoration: underline;
    text-underline-offset: 3px;
  }
}

.row-meta {
  color: var(--muted);
  font: 700 15px/1.2 var(--font-display);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.row-meta .when {
  letter-spacing: inherit;
}

.row-actions {
  display: flex;
  gap: 18px;
  align-items: center;
}

.row-actions .link-button {
  display: inline-flex;
  align-items: center;
  font-size: 15px;
}

/* Phones: a tile per sport, leading to its page. */
.tiles-section {
  display: none;
  max-width: var(--page-max);
  margin: 32px auto 0;
  padding: 0 var(--gutter) 24px;
}

.tiles-title {
  padding-bottom: 10px;
  border-bottom: 2px solid var(--ink);
  font: 800 34px/1 var(--font-display);
  text-transform: uppercase;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100% / 2 - 6px, 260px), 1fr));
  gap: 12px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  min-height: 112px;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  transition: transform 120ms var(--ease-out);
}

.tile:active {
  transform: scale(0.98);
}

.tile-top {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px 12px 8px;
}

.tile-name {
  font: 800 20px/1 var(--font-display);
  overflow-wrap: anywhere;
  text-transform: uppercase;
}

.tile-count .tally {
  color: var(--ink);
  font-size: 28px;
  font-weight: 800;
  line-height: 0.9;
}

.tile-names {
  flex: 1;
  padding: 0 12px 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.tile-strip {
  display: flex;
  height: 10px;
}

.tile-strip span {
  flex: 1;
  background: var(--c);
}

/* A sport's own page. */
.sport-page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 12px var(--gutter) 0;
}

.back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink);
  font: 700 17px/1 var(--font-display);
  letter-spacing: 0.03em;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-transform: uppercase;
  text-underline-offset: 4px;
}

.sport-page h1 {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  align-items: baseline;
  margin-top: 4px;
  font: 800 clamp(44px, 7vw, 72px) / 0.9 var(--font-display);
  overflow-wrap: anywhere;
  text-transform: uppercase;
}

.sport-page h1 .tally {
  font-size: 26px;
}

.group-chips {
  margin: 18px calc(var(--gutter) * -1) 0;
}

.group-chips .chip {
  gap: 8px;
}

.group-chips .chip .tally {
  font-size: 16px;
}

.sport-page + .sports {
  margin-top: 28px;
}

.sport-page + .sports .sport-list > .group-title:first-child {
  margin-top: 0;
}

/* A chosen sport or group's count is in its own colours. */
:is(.sport-nav a, .chip)[aria-current] .tally {
  color: inherit;
}

@media (width <= 900px) {
  .tiles-section {
    display: block;
  }

  .sports {
    grid-template-columns: minmax(0, 1fr);
  }

  .sports-home,
  .sport-nav {
    display: none;
  }

  .sport-page + .sports {
    margin-top: 12px;
  }

  .sport-page + .sports .sport-list > .group-title:first-child {
    margin-top: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tile:active {
    transform: none;
  }
}
