/* Schedule page (templates/games/season_calendar.html) - the calendar
   month-grid view (?view=calendar, apps.games.views.season_calendar_view)
   and the toolbar that switches into it. The default list view's table
   itself is styled by static/css/base.css's shared .hl-table/.hl-schedule-*
   rules (this page never had its own file before - everything it needed
   already lived there) - this file is only the genuinely new surface
   the month grid adds. */

.cal-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.cal-view-toggle-icon {
  margin-right: 5px;
  vertical-align: -2px;
}

/* ─── Month navigation ───────────────────────────────────────────── */
.cal-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.cal-nav-btn {
  padding: 8px 10px;
}

.cal-nav-icon {
  transform: rotate(-90deg);
}

.cal-nav-icon--next {
  transform: rotate(90deg);
}

.cal-nav-title {
  min-width: 180px;
  text-align: center;
  font-size: 17px;
  margin: 0;
}

/* ─── "Today" jump (apps.games.views.season_calendar_view's
   show_calendar_today_link) - its own centered row under Prev/Month/Next
   rather than a 4th item in .cal-nav itself, so it can't crowd or
   collide with the Prev/Next arrows at narrow widths where .cal-nav's
   three items already fill the row edge-to-edge. Only rendered at all
   once the visitor has actually navigated off the real current month
   (view logic), so it's never a permanent no-op button sitting there. */
.cal-nav-today-row {
  display: flex;
  justify-content: center;
  margin: calc(var(--space-2) * -1) 0 var(--space-3);
}

.cal-nav-today {
  padding: 4px 14px;
  font-size: 12px;
}

/* ─── Grid ────────────────────────────────────────────────────────
   The 1px `gap` over a `background: var(--border)` grid container is the
   same "hairline ruled table" trick static/css/league_home.css's own
   .lh-glance-panel uses for its cell dividers - one border color painted
   once, not seven/six separate cell borders that would double up at
   every shared edge. */
.cal-weekday-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--space-1);
  padding: 0 2px;
  margin-bottom: var(--space-2);
}

.cal-weekday-row span {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.cal-cell {
  min-height: 92px;
  padding: 6px;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cal-cell--outside {
  background: var(--bg-raised);
}

.cal-cell--outside .cal-cell-date {
  color: var(--text-muted);
  opacity: 0.55;
}

.cal-cell-date {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Today gets a small filled circle around the date number - the one
   piece of "orientation" a real calendar app always gives you, same job
   League Home's own live-badge dot does for "this is current". */
.cal-cell--today .cal-cell-date {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
}

.cal-cell-games {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.cal-game-chip {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 3px 5px;
  border-radius: 6px;
  border-left: 2px solid var(--border-strong);
  background: var(--bg-raised);
  text-decoration: none;
  min-width: 0;
  /* Defense in depth alongside the mobile time/meridiem stacking below -
     .cal-grid's own `overflow: hidden` is what silently clips (instead of
     visibly wrapping) anything that escapes a chip's box in the grid's
     rightmost column, so a chip should never let content past its own
     edge in the first place. */
  overflow: hidden;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.cal-game-chip:hover {
  background: color-mix(in srgb, var(--primary) 10%, var(--bg-raised));
}

/* Same status palette static/css/base.css's .hl-badge[data-status] uses,
   as a left-edge accent instead of a filled chip - a whole extra badge
   per game would be too heavy at this size (up to 3 chips in a ~90px
   cell), so status reads as a color instead of a repeated label. */
.cal-game-chip[data-status="scheduled"],
.cal-game-chip[data-status="in_progress"] { border-left-color: var(--badge-teal); }
.cal-game-chip[data-status="completed"] { border-left-color: var(--badge-lime); }
.cal-game-chip[data-status="forfeited"],
.cal-game-chip[data-status="cancelled"] { border-left-color: var(--badge-alert); }

.cal-game-chip--next {
  border-left-color: var(--primary);
  background: rgba(var(--primary-rgb), 0.08);
}

.cal-game-chip-time {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
}

.cal-game-chip-matchup {
  font-size: 10px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-game-chip-vs {
  color: var(--text-muted);
  font-weight: 400;
}

/* Mirrors .hl-schedule-team--win in the list view (base.css) - same
   underlying game.winner_side, just not surfaced here until now. */
.cal-game-chip-team--win {
  color: var(--text);
  font-weight: 800;
}

.cal-game-chip-score {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  color: var(--text-secondary);
}

.cal-cell-more {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  padding-left: 5px;
}

/* ─── Mobile - 7 columns is tight below ~560px; drop the matchup/score
   text and leave just the time + status-colored edge, tap-through to the
   real game for the rest. Cells also shrink (less empty vertical space
   when there's rarely more than 1-2 games a day at this width). ────── */
@media (max-width: 560px) {
  .cal-cell {
    min-height: 56px;
    padding: 4px;
  }

  .cal-game-chip-matchup,
  .cal-game-chip-score {
    display: none;
  }

  /* Only the time label survives at this width (above), so the chip
     itself is the whole tap target - padding/gap bumped up from the
     desktop values so each one is easier to hit on a touchscreen, and
     the cell is allowed to grow taller to fit the larger chips rather
     than clipping them. Still short of the ~44px guideline with 3 chips
     stacked in one cell - a hard tradeoff against a 7-day-wide grid on a
     phone - but meaningfully bigger than the original 3px/9px chip. */
  .cal-game-chip {
    padding: 7px 8px;
    min-height: 30px;
    justify-content: center;
  }

  .cal-cell-games {
    gap: 5px;
  }

  /* Stacked value/meridiem instead of one "12:21AM"-shaped string - a
     ~50px-wide cell (7 columns minus gutters, below ~400px) can't fit
     that on one line even at a small font: it was overflowing its own
     chip and, in the grid's rightmost (Saturday) column specifically,
     getting silently clipped by .cal-grid's own `overflow: hidden`
     rather than wrapping or truncating visibly. Splitting the meridiem
     (template) into its own line gives the browser a real break point
     instead of relying on mid-word wrapping. Desktop/tablet render the
     same two spans inline (no override there), so this is mobile-only. */
  .cal-game-chip-time {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.15;
    font-size: 10px;
  }

  .cal-game-chip-time-meridiem {
    font-size: 8px;
    font-weight: 600;
    opacity: 0.8;
  }

  .cal-nav-title {
    min-width: 0;
    font-size: 15px;
  }
}

/* Scroll-reveal itself needs no rule here - `.cal-grid-wrap` carries the
   plain `data-lh-reveal` attribute (see the template), and static/css/
   league_home.css's generic `html.lh-anim-ready [data-lh-reveal]` base
   rule already fades/rises ANY element with that attribute, no per-page
   CSS required. Deliberately no per-cell stagger on top of it, unlike
   e.g. Standings' table rows - up to 42 cells is too many independently-
   delayed transitions to read as anything but noise. */
