/* Gameblitz page: our week in the NFL, by kickoff. */

/* The head is one slim row: the arrows to browse the weeks, in the middle the
   week and our fantasy matchup. On a phone the matchup goes below the week. */
/* the small line above the head: the page, and the time zone of the times */
.gameblitz-topline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
  margin-bottom: 8px;
}

.gameblitz-topline .eyebrow {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.gameblitz-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 10px 8px;
  border: 1px solid var(--line);
  background: var(--dark-2);
}

/* two halves: the week at the right of the left one, the matchup at the left
   of the right one, so neither moves when the other changes from week to
   week (a phone has its own layout, below) */
.gameblitz-head-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 12px 28px;
  min-width: 0;
}

.gameblitz-head-main > .gameblitz-title-block {
  justify-self: end;
  min-width: 11rem;
}

.gameblitz-head-main > .gameblitz-matchup {
  justify-self: start;
}

/* the week with the days of its games small underneath (not on a phone) */
.gameblitz-title-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.gameblitz-title-block small {
  color: var(--muted);
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.gameblitz-head h1 {
  margin: 0;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.7rem;
  line-height: 1;
  white-space: nowrap;
}

/* the arrows: plain chevrons without a box, a generous area to tap */
.gameblitz-arrow {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--cream);
  font-size: 0;
  cursor: pointer;
}

.gameblitz-arrow::before {
  content: "";
  width: 11px;
  height: 11px;
  border-bottom: 2.5px solid currentColor;
  border-left: 2.5px solid currentColor;
  transform: translateX(3px) rotate(45deg);
}

#week-next::before {
  transform: translateX(-3px) rotate(-135deg);
}

.gameblitz-arrow:hover:not(:disabled) {
  color: var(--orange);
}

.gameblitz-arrow:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: -4px;
}

.gameblitz-arrow:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* the block of the kickoffs */
.gameblitz-block {
  padding-bottom: 24px;
}

.gameblitz-block .gameblitz-slot:first-child {
  margin-top: 24px;
}

/* our fantasy game of the week: "[our logo]  VS  Dumptrucks [logo]", the group
   in the middle of the box */
.gameblitz-matchup {
  display: grid;
  grid-template-columns: auto auto auto;
  justify-content: center;
  align-items: center;
  gap: 8px 14px;
  padding-left: 28px;
  border-left: 1px solid var(--line);
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.5rem;
  text-transform: uppercase;
}

.gameblitz-matchup.bye {
  grid-template-columns: auto auto;
}

.gameblitz-matchup .gameblitz-note {
  grid-column: 1 / -1;
  text-align: center;
  white-space: nowrap;
}

.gameblitz-matchup strong {
  font-weight: 600;
  line-height: 1.05;
}

.gameblitz-side {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.gameblitz-side.own {
  justify-content: flex-end;
}

.gameblitz-side.opponent {
  justify-content: flex-start;
}

.gameblitz-vs {
  color: var(--muted);
  font-size: 1.2rem;
  letter-spacing: 0.1em;
  text-align: center;
}

.gameblitz-logo {
  flex: none;
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.gameblitz-logo.placeholder {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  font-size: 1.1rem;
}

.gameblitz-score {
  color: var(--muted);
}

.gameblitz-score.won {
  color: var(--cream);
}

@media (max-width: 600px) {
  .gameblitz-head {
    padding: 8px 2px;
  }

  .gameblitz-head-main {
    flex-direction: column;
    gap: 6px;
  }

  .gameblitz-title-block small {
    display: none;
  }

  .gameblitz-matchup {
    padding-left: 0;
    border-left: 0;
    gap: 8px;
    font-size: 1.25rem;
  }

  /* played: the logos and the opponent in the first row, the scores under
     them, so even a long name and both scores have room */
  .gameblitz-matchup.played {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "own opponent"
      "vs vs";
    row-gap: 6px;
  }

  .gameblitz-matchup.played .gameblitz-side.own {
    grid-area: own;
    justify-content: flex-start;
  }

  .gameblitz-matchup.played .gameblitz-side.opponent {
    grid-area: opponent;
    justify-content: flex-end;
    text-align: right;
  }

  .gameblitz-matchup.played .gameblitz-vs {
    grid-area: vs;
  }

  .gameblitz-side {
    gap: 8px;
  }

  .gameblitz-logo {
    width: 34px;
    height: 34px;
  }
}

/* The slim bar that stays under the page header once the matchup is scrolled
   away: the week and the teams, in the colours of the page turned around
   (orange with dark text) so it stands out. It takes no room in the page (the
   wrapper has no height) and spans the whole screen. */
body {
  overflow-x: clip;
}

.gameblitz-bar-wrap {
  position: sticky;
  top: var(--header-h, 76px);
  z-index: 900;
  height: 0;
  margin-inline: calc(50% - 50vw);
}

.gameblitz-bar {
  position: absolute;
  inset: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  height: 40px;
  padding-inline: max(5vw, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid rgba(12, 13, 18, 0.25);
  background: var(--orange);
  color: var(--dark);
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.15rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition:
    opacity 0.15s ease,
    transform 0.15s ease;
}

.gameblitz-bar.is-visible {
  opacity: 1;
  transform: none;
}

.bar-week {
  font-weight: 800;
  white-space: nowrap;
}

.bar-match {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  font-weight: 600;
  white-space: nowrap;
}

/* the "vs" is quieter than the names, as in the matchup above */
.bar-vs {
  color: rgba(12, 13, 18, 0.62);
  font-size: 0.8em;
  font-weight: 500;
  letter-spacing: 0.1em;
}

@media (max-width: 600px) {
  .gameblitz-bar {
    gap: 10px;
  }

  .bar-own {
    display: none;
  }
}

.gameblitz-note {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  text-transform: none;
}

/* the slots: the times at which our players play */
.gameblitz-slot {
  margin-top: 36px;
}

/* a slot that is over is quieter, but not the note about the live data */
.gameblitz-slot.over > :not(.gameblitz-slot-head),
.gameblitz-slot.over .gameblitz-slot-title {
  opacity: 0.55;
}

.gameblitz-slot-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.4rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.gameblitz-slot-title .slot-day {
  color: var(--muted);
  font-size: 1.1rem;
}

/* the weekday is white and as big as the clock, the date stays small and
   quiet, the clock is orange */
.gameblitz-slot-title .slot-weekday {
  color: var(--cream);
  font-size: 1.4rem;
  font-weight: 700;
}

.gameblitz-slot-title .slot-clock {
  color: var(--orange);
  font-weight: 700;
}

/* the time zone of the times, small at the right above the head */
.gameblitz-topline .gameblitz-zone {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-family: Inter, sans-serif;
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* A game is a card: its title with the check box, then the tiles. */
.gameblitz-game {
  padding: 8px 6px 6px;
  border: 1px solid rgba(244, 241, 235, 0.3);
  background: var(--dark-2);
  transition: opacity 0.2s ease;
}

.gameblitz-game.checking {
  opacity: 0.45;
}

.gameblitz-game-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 8px;
  padding: 0 2px 6px;
  border-bottom: 1px solid var(--line);
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.2rem;
  letter-spacing: 0.04em;
}

/* the kickoff in the list of done games */
.gameblitz-game-title > span {
  color: var(--muted);
  font-size: 1rem;
}

/* the name of the game is the label of the check box: tap either to mark the
   game as done (or to bring it back) */
.gameblitz-check {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.gameblitz-check strong {
  font-weight: 600;
}

.gameblitz-check input {
  appearance: none;
  display: grid;
  flex: none;
  place-content: center;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1.5px solid var(--muted);
  background: transparent;
  cursor: pointer;
}

.gameblitz-check input::after {
  content: "";
  width: 9px;
  height: 5px;
  margin-top: -2px;
  border-bottom: 2px solid var(--dark);
  border-left: 2px solid var(--dark);
  transform: rotate(-45deg) scale(0);
  transition: transform 0.1s ease;
}

.gameblitz-check input:checked {
  border-color: var(--orange);
  background: var(--orange);
}

.gameblitz-check input:checked::after {
  transform: rotate(-45deg) scale(1);
}

.gameblitz-check:hover input {
  border-color: var(--orange);
}

.gameblitz-check input:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

/* on a card the tiles have a fill instead of a frame */
.gameblitz-game .lineup-player {
  border-color: transparent;
  background: rgba(244, 241, 235, 0.06);
}

/* The games of a slot sit in a grid with as many columns (--n) as fit, the
   tiles grow with the screen. A game takes as many columns as its longest row
   of tiles needs (--span), so single players sit side by side and a wide
   screen holds several games in a row. Both are set by gameblitz.js. */
.gameblitz-games {
  display: grid;
  grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr));
  grid-auto-flow: dense;
  align-items: start;
  gap: 10px 8px;
}

.gameblitz-games .gameblitz-game {
  grid-column: span var(--span, 1);
}

.gameblitz-games .lineup-players.compact {
  grid-template-columns: repeat(var(--span, 1), minmax(0, 1fr));
}

/* the folded areas: not playing, done */
.gameblitz-fold {
  margin-top: 32px;
}

.gameblitz-fold > .fold-toggle {
  margin-top: 0;
}

.gameblitz-fold > .lineup-players {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

/* the rows of one game (one per team) */
.gameblitz-game > .lineup-players + .lineup-players {
  margin-top: 8px;
}

.gameblitz-fold > .gameblitz-game {
  margin: 10px 0 0;
}


/* --- live data (worker) ----------------------------------------------------- */

/* the line under the matchup: from when the live scores are, and the button
   to get them new */
.gameblitz-live {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-family: Inter, sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: none;
}

.gameblitz-live.ok span::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--orange);
  vertical-align: 1px;
}

.gameblitz-live.error {
  color: var(--orange);
}

.gameblitz-refresh {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--cream);
  cursor: pointer;
}

.gameblitz-refresh svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.gameblitz-refresh:hover {
  border-color: var(--orange);
  color: var(--orange);
}

.gameblitz-refresh:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

.gameblitz-refresh:disabled {
  cursor: progress;
}

.gameblitz-refresh:disabled svg {
  animation: refresh-turn 0.9s linear infinite;
}

@keyframes refresh-turn {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .gameblitz-refresh:disabled svg {
    animation: none;
    opacity: 0.4;
  }
}

/* the score in the slim bar */
.bar-score {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  white-space: nowrap;
}

@media (max-width: 600px) {

}

/* The players of the fantasy opponent (red name and points, lineup.css) come
   under ours in a card, after a dashed line. */
.gameblitz-game > .lineup-players.new-team {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

/* our bench of a game (gameblitz.js, createGameBench): a small toggle at the
   bottom of the card, closed at first */
.gameblitz-game-bench {
  margin-top: 8px;
}

.gameblitz-game > .gameblitz-game-bench:nth-child(2) {
  margin-top: 0;
}

.gameblitz-game-bench > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 2px 0;
  color: var(--muted);
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  list-style: none;
}

.gameblitz-game-bench > summary::-webkit-details-marker {
  display: none;
}

.gameblitz-game-bench > summary::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-left: 2px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.15s ease;
}

.gameblitz-game-bench[open] > summary::after {
  transform: translateY(1px) rotate(-135deg);
}

.gameblitz-game-bench > summary span.own {
  color: var(--cream);
}

.gameblitz-game-bench > summary span.opponent {
  color: var(--opponent);
}

.gameblitz-game-bench > summary span.split {
  margin: 0 -2px;
  color: var(--muted);
}

.gameblitz-game-bench > summary:hover {
  color: var(--cream);
}

.gameblitz-game-bench > summary:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

.gameblitz-game-bench > .lineup-players {
  margin-top: 6px;
}

/* the opponent's bench under ours */
.gameblitz-game-bench > .lineup-players + .lineup-players {
  margin-top: 4px;
}

/* the bench tiles are quieter than the starters */
.gameblitz-game-bench .lineup-player {
  opacity: 0.75;
}

/* two half high tiles of the opponent in one cell of a row, one above the
   other, together as high as one of ours */
.gameblitz-game .mini-stack {
  min-width: 0;
}

.gameblitz-game .mini-stack > ul {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.gameblitz-game .mini-stack .lineup-player.mini {
  padding-top: 2px;
  padding-bottom: 2px;
}

.gameblitz-game .mini-stack .mini .jersey {
  width: 18px;
  height: 18px;
  font-size: 0.8rem;
}

/* the score of an NFL game in the title of its card ("PHI @ DAL · 39 – 38"),
   once it has begun; when it is over the loser is dimmed */
.gameblitz-game-score {
  margin-left: -2px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}

/* a game that is over: the loser's abbreviation dimmed, the @ quiet too, so
   only the winner stands out */
.gameblitz-check .lost,
.gameblitz-check .at {
  color: var(--muted);
}

/* the teams stay together; a card of one column (on a phone) is narrow: the
   score gets a smaller font, the teams a little smaller, so that "PHI @ DAL ·
   39 – 38" still fits in one line */
.gameblitz-check strong {
  white-space: nowrap;
}

.gameblitz-game {
  container-type: inline-size;
}

@container (max-width: 220px) {
  .gameblitz-game-title {
    letter-spacing: 0.01em;
  }

  .gameblitz-check:has(.gameblitz-game-score) {
    gap: 6px;
  }

  .gameblitz-check:has(.gameblitz-game-score) strong {
    font-size: 1.12rem;
  }

  .gameblitz-game-score {
    margin-left: -3px;
    font-size: 0.95rem;
  }

  .gameblitz-game-score .dot {
    margin-right: 0;
  }
}

/* the projected points of a side, small in brackets under its score; they
   hang below it, so the scores stay level with the logos and the name */
.gameblitz-matchup.played {
  padding-bottom: 12px;
}

.gameblitz-score {
  position: relative;
}

.gameblitz-projected {
  position: absolute;
  top: 100%;
  left: 50%;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  line-height: 1.1;
  transform: translateX(-50%);
  white-space: nowrap;
}

/* the first slot carries the note about the live data at the right of its
   title */
.gameblitz-slot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 14px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.gameblitz-slot-head .gameblitz-slot-title {
  min-width: 0;
  margin: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.gameblitz-live-box {
  flex: none;
}

.gameblitz-live-box.alone {
  margin-top: 24px;
}

.gameblitz-live-box .gameblitz-live {
  justify-content: flex-end;
}

/* On a phone the head is two rows: the arrows next to the week, under them
   the matchup in one row as on a wide screen (our logo, the scores, the
   opponent), the live line below. */
@media (max-width: 600px) {
  /* two equal sides around the week: the matchup under it does not move the
     arrows */
  .gameblitz-head {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 6px 4px;
    padding: 6px 8px 8px;
  }

  .gameblitz-head-main {
    display: contents;
  }

  #week-prev,
  #week-next,
  .gameblitz-title-block {
    grid-row: 1;
  }

  /* the week is not the main thing: small, the matchup under it is */
  .gameblitz-head h1 {
    font-size: 1.3rem;
  }

  /* the week has a fixed width, so the arrows next to it stay where they are
     from week to week (WEEK 9 is narrower than WEEK 12) */
  .gameblitz-head .gameblitz-title-block {
    width: 6rem;
    min-width: 0;
    justify-self: center;
  }

  .gameblitz-head-main > .gameblitz-matchup {
    justify-self: center;
  }

  #week-prev,
  #week-next {
    align-self: center;
  }

  #week-prev {
    justify-self: end;
  }

  #week-next {
    justify-self: start;
  }

  .gameblitz-head .gameblitz-matchup {
    grid-row: 2;
    grid-column: 1 / -1;
  }

  .gameblitz-matchup.played {
    grid-template-columns: auto auto minmax(0, max-content);
    grid-template-areas: "own vs opponent";
    column-gap: 10px;
    row-gap: 6px;
  }

  .gameblitz-matchup.played .gameblitz-side.own {
    justify-content: flex-end;
  }

  .gameblitz-matchup.played .gameblitz-side.opponent {
    justify-content: flex-start;
    text-align: left;
  }

  .gameblitz-matchup.played .gameblitz-side.opponent strong {
    font-size: 1.1rem;
  }
}
