/*
 * The home page: the headline beside Next up, then a row of competition
 * cards per sport. Rows scroll sideways (arrows on wide screens come from
 * the script); Show all turns a row into a grid.
 */

.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 sport's row. */
.sport {
  max-width: var(--page-max);
  margin: 36px auto 0;
}

.sport-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  margin: 0 var(--gutter) 16px;
}

.sport-title {
  margin-right: auto;
  font: 800 34px/1 var(--font-display);
  text-transform: uppercase;
}

.show-all,
.show-fewer {
  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-underline-offset: 4px;
}

.show-fewer,
.sport:is([data-expanded], :has(.rail:target)) .show-all {
  display: none;
}

.sport:is([data-expanded], :has(.rail:target)) .show-fewer {
  display: inline-flex;
}

.rail-arrows {
  display: flex;
  gap: 8px;
}

.rail-arrow {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition:
    transform 120ms var(--ease-out),
    opacity 160ms var(--ease-out);
}

.rail-arrow svg {
  width: 20px;
  height: 20px;
}

.rail-arrow:disabled {
  opacity: 0.35;
  cursor: default;
}

.rail-arrow:active:not(:disabled) {
  transform: scale(0.97);
}

.sport[data-expanded] .rail-arrows {
  display: none;
}

@media (width <= 860px) {
  .rail-arrows {
    display: none;
  }
}

/* The row itself: fixed-size cards side by side, snapping into place. */
.rail {
  display: grid;
  grid-auto-columns: min(78%, 260px);
  grid-auto-flow: column;
  gap: 14px;
  margin: 0;
  padding: 4px var(--gutter) 12px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  list-style: none;
  scroll-padding-inline: var(--gutter);
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
}

.sport:is([data-expanded], :has(.rail:target)) .rail {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  grid-auto-flow: row;
  overflow: visible;
}

/* A competition card, positioned so its hidden words for screen readers stay inside the row. */
.card {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 300px;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  background: var(--surface);
  scroll-snap-align: start;
  animation: card-in 300ms var(--ease-out) backwards;
  animation-delay: calc(var(--i, 0) * 40ms);
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* On pointer devices a card takes a soft shadow on hover; it doesn't lift, since only its buttons are pressable. */
@media (hover: hover) and (pointer: fine) {
  .card {
    transition: box-shadow 200ms var(--ease-out);
  }

  .card:hover {
    box-shadow: 0 10px 24px -12px #0e101340;
  }
}

.card .band {
  gap: 10px;
  min-height: 54px;
  padding-left: 12px;
}

.card .logo-plate {
  height: 30px;
  padding: 3px 5px;
}

.card .logo-plate img {
  max-width: 44px;
  height: 24px;
}

.slots {
  display: grid;
  align-content: center;
  margin: 0;
  padding: 0 14px;
  list-style: none;
}

.slot {
  display: grid;
  gap: 4px;
  padding: 12px 0;
}

.slot + .slot {
  border-top: 1px solid var(--rule);
}

.slot-title {
  font-size: 15px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.slot-none {
  color: var(--muted);
}

.card-league {
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 12px 14px;
  font-size: 15px;
}

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

.card-foot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 14px 14px;
  border-top: 1px solid var(--rule);
}

.card-foot .button {
  min-height: 44px;
  padding: 0 10px;
  font-size: 15px;
}

/* Reduced motion: cards are just there. */
@media (prefers-reduced-motion: reduce) {
  .card {
    animation: none;
  }

  .rail-arrow:active:not(:disabled) {
    transform: none;
  }
}
