/*
 * Schedule pages: breadcrumbs, page head, filters, division cards, team info,
 * game table (cards on phones), status badges, change log. Tokens only.
 */

/* ---------- Page head ---------- */

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4) var(--space-8);
  list-style: none;
  color: var(--text-muted);
  font-size: var(--text-small);
}

.breadcrumb li + li::before {
  content: "/";
  margin-right: var(--space-8);
  color: var(--text-caption);
}

.breadcrumb a {
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-16) var(--space-24);
}

.page-head > div > * + * {
  margin-top: var(--space-12);
}

.page-lead {
  max-width: 60ch;
  color: var(--text-muted);
  font-size: var(--text-lead);
}

.section__title {
  margin-bottom: var(--space-16);
  font-size: var(--text-heading-section);
}

.empty-note {
  padding: var(--space-18);
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  color: var(--text-muted);
}

/* ---------- Filters ---------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-16);
}

.field {
  display: grid;
  gap: var(--space-8);
  min-width: min(100%, 11rem);
}

.field__label {
  font-size: var(--text-small);
  font-weight: 700;
  color: var(--text-muted);
}

.select {
  position: relative;
  display: flex;
  align-items: center;
}

.select select {
  width: 100%;
  min-height: 56px;
  padding: 0 var(--space-48) 0 var(--space-20);
  border: 1px solid var(--button-secondary-border);
  border-radius: var(--radius-control);
  background: var(--button-secondary-bg);
  color: var(--button-secondary-text);
  font: 600 var(--text-label) / 1 var(--font-body);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.select select:hover {
  background: var(--button-secondary-hover-bg);
}

.select .icon {
  position: absolute;
  right: var(--space-16);
  pointer-events: none;
}

.filters__reset {
  display: inline-flex;
  align-items: center;
  min-height: var(--min-tap-target);
  font-weight: 600;
}

/* ---------- Divisions ---------- */

.division-group + .division-group {
  margin-top: var(--space-32);
}

.division-group__title {
  margin-bottom: var(--space-12);
}

.division-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
  gap: var(--space-16);
  list-style: none;
}

.division-card {
  display: grid;
  gap: var(--space-8);
  min-height: var(--min-tap-target);
  padding: var(--space-18);
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  text-decoration: none;
}

.division-card:hover {
  background: var(--surface-raised);
}

.division-card__name {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  font: 400 var(--text-heading-title) / 1.1 var(--font-heading);
}

.division-card__meta {
  color: var(--text-muted);
  font-size: var(--text-small);
}

/* A venue entry on the Locations index: name link, address, then Directions. */
.venue-card {
  align-content: start;
}

.venue-card .division-card__name {
  text-decoration: none;
}

.venue-card .division-card__name:hover {
  text-decoration: underline;
}

.venue-card__directions {
  justify-self: start;
}

/* ---------- Teams ---------- */

.team-group + .team-group {
  margin-top: var(--space-20);
}

.team-group__title {
  margin-bottom: var(--space-8);
}

.team-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
  gap: var(--space-8) var(--space-24);
  list-style: none;
}

.team-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-8);
  min-height: var(--min-tap-target);
  font-weight: 600;
  text-decoration: none;
}

.team-link:hover {
  text-decoration: underline;
}

/* Team info (left) and calendar subscribe (right) side by side; stacked on a phone. */
.team-overview {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: var(--space-24);
  align-items: start;
}

.team-info {
  padding: var(--space-28);
  background: var(--sand-paper);
  border: 1px solid var(--sand-paper);
  border-radius: var(--radius-card);
  color: var(--ink-base);
}

.team-info__title {
  margin-bottom: var(--space-16);
  color: var(--stone-text);
  font: 700 var(--text-eyebrow) / 1 var(--font-body);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
}

.team-info__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.team-info__row {
  display: flex;
  align-items: center;
  min-height: 64px;
  padding: var(--space-16) 0;
  border-bottom: 1px solid var(--sand-border);
}

.team-info__link {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-20);
  color: inherit;
  text-decoration: none;
}

.team-info__link:hover .team-info__main {
  text-decoration: underline;
}

.team-info__text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: var(--space-6);
  min-width: 0;
}

.team-info__main {
  margin: 0;
  color: var(--ink-base);
  font-size: var(--text-label);
  font-weight: 700;
}

.team-info__sub {
  margin: 0;
  color: var(--stone-text);
  font-size: var(--text-label);
}

/* ---------- Calendar subscribe (team page) ---------- */

/* Compact and flat: a small button and a few lines on the page background. */
.calendar-subscribe {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-12);
}

/* Smaller than a standard button but still a full-size tap target. */
.calendar-subscribe .button {
  gap: var(--space-8);
  padding: 0 var(--space-14);
  font-size: var(--text-small);
}

.calendar-subscribe .icon {
  width: 1.1em;
  height: 1.1em;
}

.calendar-subscribe__title {
  margin: 0;
  color: var(--text-caption);
  font: 700 var(--text-eyebrow) / 1 var(--font-body);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
}

.calendar-subscribe__note {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-small);
}

.calendar-subscribe__link {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  margin: 0;
  max-width: 100%;
}

.calendar-subscribe__url {
  min-width: 0;
  color: var(--text-muted);
  font-size: var(--text-small);
  overflow-wrap: anywhere;
}

/* Icon only, no border: a quiet control next to the address. */
.copy-button {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: var(--min-tap-target);
  height: var(--min-tap-target);
  margin: calc(var(--space-12) * -1) 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
}

.copy-button:hover {
  background: var(--button-secondary-hover-bg);
}
.copy-button .copy-button__done,
.copy-button.is-copied .copy-button__copy {
  display: none;
}

.copy-button.is-copied .copy-button__done {
  display: inline-block;
}

@media (max-width: 800px) {
  .team-overview {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Game status badges ---------- */

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  margin-top: var(--space-6);
  list-style: none;
}

.badge {
  padding: var(--space-4) var(--space-8);
  border-radius: var(--radius-badge);
  font-size: var(--text-small);
  font-weight: 600;
  line-height: 1.45;
}

.badge--rescheduled {
  background: var(--game-rescheduled-bg);
  color: var(--game-rescheduled-text);
}

.badge--location-changed {
  background: var(--game-location-changed-bg);
  color: var(--game-location-changed-text);
}

.badge--canceled {
  background: var(--game-canceled-bg);
  color: var(--game-canceled-text);
}

/* Neutral on purpose: crossover is the kind of game, not a change to it. */
.badge--crossover {
  background: var(--surface-raised);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

/* In the Notes cell the badges start at the top, not under a time. */
.game__notes .badges {
  margin-top: 0;
}

/* ---------- Game table (cards on phones) ---------- */

.games__table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
}

.games__table th,
.games__table td {
  padding: var(--space-14) var(--space-16);
  text-align: left;
  vertical-align: top;
}

.games__table thead th {
  background: var(--sand-paper);
  color: var(--ink-base);
  font-size: var(--text-small);
  font-weight: 700;
}

.games__table tbody tr + tr td {
  border-top: 1px solid var(--border);
}

.game__id {
  color: var(--text-muted);
  white-space: nowrap;
}

.game__time-value {
  font-weight: 700;
}

.game__team--self {
  font-weight: 700;
}

.game--canceled .game__time-value {
  color: var(--text-muted);
}

.game__team--self a,
.game td a {
  text-decoration: none;
}

.game td a:hover {
  text-decoration: underline;
}

.venue-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-6);
  font-weight: 700;
}

.game__court {
  display: block;
  color: var(--text-muted);
  font-size: var(--text-small);
}

/* Wide screens: a 16px table and a Notes column that stays narrow, so its
   badges wrap inside it and the other columns keep their room. Phones keep
   the card layout below; print keeps its own table rules. */
@media screen and (min-width: 641px) {
  .games__table {
    font-size: var(--text-schedule);
  }

  .games__table .game__notes {
    width: 150px;
    max-width: 150px;
    padding-inline: var(--space-8);
  }

  .game__notes .badges {
    gap: var(--space-4);
  }

  .game__notes .badge {
    padding: var(--space-2) var(--space-6);
    font-size: var(--text-badge);
    line-height: 1.35;
  }
}

@media (max-width: 640px) {
  .games__table,
  .games__table tbody,
  .games__table tr,
  .games__table td {
    display: block;
  }

  .games__table {
    background: none;
    border: 0;
  }

  .games__table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .game {
    margin-bottom: var(--space-12);
    padding: var(--space-8) 0;
    background: var(--surface-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
  }

  .games__table tbody tr + tr td {
    border-top: 0;
  }

  .games__table td {
    padding: var(--space-4) var(--space-16);
  }

  .game td::before {
    content: attr(data-label) ": ";
    color: var(--text-muted);
    font-size: var(--text-small);
  }

  /* Card heading: "Game #26-109". */
  .game .game__id {
    padding-top: var(--space-8);
    color: var(--text-primary);
    font-weight: 700;
  }

  .game .game__id::before {
    content: "Game #";
    color: inherit;
    font-size: inherit;
  }

  .game .game__time::before {
    content: none;
  }

  /* A game with no notes gets no empty "Notes:" line on its card. */
  .game .game__notes:empty {
    display: none;
  }

  .game .game__notes::before {
    content: none;
  }

  .game .game__venue .venue-link {
    font-weight: 700;
  }
}

/* ---------- Change log ---------- */

.change-log {
  list-style: none;
}

.change-entry {
  display: grid;
  grid-template-columns: 8rem 7rem 1fr;
  gap: var(--space-4) var(--space-16);
  padding: var(--space-14) 0;
  border-bottom: 1px solid var(--border);
}

.change-entry__date {
  color: var(--text-muted);
  font-size: var(--text-small);
}

@media (max-width: 640px) {
  .change-entry {
    grid-template-columns: 1fr;
  }
}

.print-button[hidden] {
  display: none;
}
