/*
 * Sports calendar design, ported from the legacy Pickx sports calendar
 * (styles/pages/_calendarview.scss + the PXDS text scale it relied on).
 *
 * The legacy site set `html { font-size: 62.5% }`, so its `rem` values were
 * 10px-based. This page keeps the browser default root size, so every legacy
 * rem value is converted to px here (e.g. legacy 1.2rem -> 12px).
 *
 * Breakpoints: 480px (mobile), 768px (tablet rows), 1024px (side banner
 * column), and the PXDS type steps at 761px / 1201px.
 *
 * Everything is scoped under `.calendar-page--sports` so the cycling page,
 * which shares `shared/layout.css`, is unaffected.
 */

/* Page column: max-width 1200px, 10px side padding (legacy 0 1rem). */
.calendar-page--sports .site-main {
  max-width: 1200px;
  padding: 20px 10px 40px;
}

/* ---- Top banner (legacy .festival-calendar-banner) ---- */

.calendar-page--sports .banner-section {
  overflow: hidden;
}

.calendar-page--sports .calendar-banner {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: right center;
}

@media (max-width: 768px) {
  .calendar-page--sports .calendar-banner {
    object-position: 70% center;
  }
}

/* ---- Content + side banner layout (legacy .festival-calendar-*) ---- */

.calendar-page--sports .calendar-layout {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.calendar-page--sports .calendar-content {
  flex: 1;
  min-width: 0;
}

.calendar-page--sports .calendar-side-banner {
  display: block;
  flex: 0 0 350px;
  width: 350px;
  position: sticky;
  /*
   * Legacy used top: 1rem (10px) under a non-sticky header. This page's
   * site header is sticky (65px: 40px logo + 2 x 12px padding + 1px
   * border), so offset by its height to keep the banner visible.
   */
  top: 75px;
}

.calendar-page--sports .calendar-side-banner-link {
  display: block;
}

.calendar-page--sports .calendar-side-banner img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0;
}

@media (max-width: 1024px) {
  .calendar-page--sports .calendar-layout {
    flex-direction: column;
  }

  .calendar-page--sports .calendar-side-banner {
    flex-basis: auto;
    width: 100%;
    max-width: 400px;
    position: static;
  }
}

@media (max-width: 480px) {
  .calendar-page--sports .calendar-side-banner {
    display: none;
  }
}

/* Inline banner after the first day: phones only (<= 480px). */
.calendar-page--sports .calendar-mobile-inline-banner {
  display: block;
  width: 100%;
  margin: 15px 0;
}

.calendar-page--sports .calendar-mobile-inline-banner img {
  display: block;
  width: 100%;
  height: auto;
}

@media (min-width: 481px) {
  .calendar-page--sports .calendar-mobile-inline-banner {
    display: none;
  }
}

/* ---- Header: title + intro (legacy .lineup-calendar-header) ---- */

.calendar-page--sports .calendar-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7.5px;
  margin-bottom: 20px;
}

/* PXDS text size 8, bold: 22px / 24px (>= 761px) / 28px (>= 1201px). */
.calendar-page--sports .calendar-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.5;
}

/* PXDS text size 4: 14px / 16px (>= 1201px), 10px bottom padding. */
.calendar-page--sports .calendar-intro,
.calendar-page--sports .calendar-subtitle {
  margin: 0;
  padding-bottom: 10px;
  color: #fff;
  font-size: 14px;
  line-height: 1.5;
}

.calendar-page--sports .calendar-intro a {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
}

.calendar-page--sports .calendar-intro a:hover {
  opacity: 0.8;
}

/* ---- Day groups (legacy .lineup-day-group / .lineup-day-events) ---- */

.calendar-page--sports .calendar-group {
  margin-bottom: 20px;
}

/* PXDS text size 6, bold: 18px / 20px (>= 1201px), 15px bottom margin. */
.calendar-page--sports .calendar-group-header {
  margin: 0 0 15px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.5;
  text-transform: none;
}

.calendar-page--sports .calendar-day-events {
  margin: 0;
  padding: 15px 20px 5px;
  list-style: none;
  background: #342c44;
  border-radius: 10px;
  overflow: hidden;
}

/*
 * ---- Rows: Category | Name | Channel (legacy .lineup-event-row) ----
 *
 * Legacy columns were `<category> 1fr auto`. The channel column is
 * `fit-content(40%)` instead of `auto`: legacy channels were small logos,
 * ours are text (e.g. "DAZN Pro League 1 | Pickx+ Sports 1"), and an
 * `auto` column grows to the full text width, crushing the name column on
 * phones. Short channel labels still size to their content like `auto`.
 */

.calendar-page--sports .calendar-event-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) fit-content(40%);
  gap: 10px;
  align-items: center;
  min-width: 0;
  margin-bottom: 10px;
  font-size: 14px;
  line-height: 1.5;
}

.calendar-page--sports .calendar-event-category {
  min-width: 0;
  overflow-wrap: break-word;
}

.calendar-page--sports .calendar-event-name {
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
}

.calendar-page--sports .calendar-event-channel {
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
  text-align: right;
}

.calendar-page--sports .calendar-row-notes {
  display: block;
  margin-top: 2px;
  color: rgb(255 255 255 / 60%);
  font-size: 0.875em;
}

/* PXDS type step up. */
@media (min-width: 761px) {
  .calendar-page--sports .calendar-title {
    font-size: 24px;
  }
}

@media (min-width: 1201px) {
  .calendar-page--sports .calendar-title {
    font-size: 28px;
  }

  .calendar-page--sports .calendar-group-header {
    font-size: 20px;
  }

  .calendar-page--sports .calendar-intro,
  .calendar-page--sports .calendar-subtitle,
  .calendar-page--sports .calendar-event-row {
    font-size: 16px;
  }
}

/* Tablet rows. */
@media (max-width: 768px) {
  .calendar-page--sports .calendar-event-row {
    grid-template-columns: 85px minmax(0, 1fr) fit-content(40%);
    gap: 7.5px;
  }
}

/* Mobile: tighter rows with dividers, 12px regular text. */
@media (max-width: 480px) {
  .calendar-page--sports .calendar-day-events {
    padding-right: 15px;
    padding-left: 15px;
  }

  .calendar-page--sports .calendar-event-row {
    grid-template-columns: 65px minmax(0, 1fr) fit-content(40%);
    gap: 5px;
    margin-bottom: 0;
    padding: 5px 0;
    border-bottom: 1px solid rgb(255 255 255 / 8%);
  }

  .calendar-page--sports .calendar-event-row:last-child {
    border-bottom: none;
  }

  .calendar-page--sports .calendar-event-category,
  .calendar-page--sports .calendar-event-category *,
  .calendar-page--sports .calendar-event-name,
  .calendar-page--sports .calendar-event-name *,
  .calendar-page--sports .calendar-event-channel,
  .calendar-page--sports .calendar-event-channel * {
    font-size: 12px;
    font-weight: 400;
  }
}
