/* Team workspace only. Size columns from the remaining detail width, so the
   directory rail and a broadcast iframe cannot make the match cards too narrow. */
.team-detail > .team-schedule {
  container: team-fixtures / inline-size;
}
.team-detail > .team-schedule .matches-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.team-detail > .team-schedule .matches-grid > * {
  min-width: 0;
  align-self: start;
}
.team-detail > .team-schedule .matches-grid > .fixture-card {
  height: auto;
  min-height: 90px;
}
.team-detail > .team-schedule .matches-grid > .empty-state {
  grid-column: 1 / -1;
}
/* About 320px per fixture keeps existing names, score and crests readable. */
@container team-fixtures (min-width: 660px) {
  .team-detail > .team-schedule .matches-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@container team-fixtures (min-width: 1000px) {
  .team-detail > .team-schedule .matches-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
/* A phone keeps one fixture per row even in an unusual wide embedded layout. */
@media (max-width: 700px) {
  .team-detail > .team-schedule .matches-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .team-detail > .team-schedule .matches-grid > .fixture-card {
    min-height: 86px;
  }
}
.team-fixtures-viewport {
  max-block-size: var(--team-fixtures-height, 396px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
  min-width: 0;
}
.team-fixtures-viewport:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.team-fixtures-pagination { display: flex; justify-content: center; padding-block: 12px 2px; }
.team-fixtures-message { color: var(--muted); padding: 10px 0; }
.team-detail>.team-schedule .team-fixture-meta{display:flex;align-items:center;gap:8px;white-space:nowrap}
.team-detail>.team-schedule .team-fixture-meta .fixture-format{display:flex;align-items:center;gap:8px;margin-left:auto}
.team-detail>.team-schedule .team-fixture-meta .fixture-time{margin-left:auto;flex:none;font-variant-numeric:tabular-nums}
.team-detail>.team-schedule .team-fixture-meta .training-card-report{margin-left:auto;font-size:10px}
@container team-fixtures (max-width: 999px) {
  .team-fixtures-viewport { --team-fixtures-height: 294px; }
}
@media (max-width: 700px) {
  .team-fixtures-viewport { --team-fixtures-height: 192px; }
}


/* Long captions wrap within their own side on any width. */
.team-detail > .team-schedule .training-match-card { height:auto; }
:root[data-match-label-mode] .team-detail > .team-schedule [data-match-wordmark] > .team-caption { overflow:visible; white-space:normal; }
:root[data-match-label-mode] .team-detail > .team-schedule [data-match-wordmark] .team-caption-content :is(.team-caption-name, .team-caption-tag, .team-caption-tag-text) { white-space:normal; overflow:visible; text-overflow:clip; overflow-wrap:anywhere; word-break:break-word; }

/* Keep both sites readable in narrow iframes without shrinking team names. */
@media (max-width:700px) {
 .team-detail > .team-schedule { padding-inline: 10px; }
 .team-detail > .team-schedule .team-fixtures-viewport { scrollbar-gutter: auto; }
 .team-detail > .team-schedule .cup-match-card.fixture-card,
 .team-detail > .team-schedule .training-match-card { height: auto; min-height: 86px; }
 .team-detail > .team-schedule .fixture-card .match-team,
 .team-detail > .team-schedule .training-card-team { position: relative; gap: 3px; }
 .team-detail > .team-schedule .fixture-card .match-team > .team-mark,
 .team-detail > .team-schedule .training-card-team > .team-mark { width: 24px; height: 24px; flex-basis: 24px; }
 :root[data-match-label-mode] .team-detail > .team-schedule .training-card-team[data-match-wordmark] { padding-inline: 0; }
 :root[data-match-label-mode] .team-detail > .team-schedule .fixture-card .match-team > .fixture-winner { position: absolute; z-index: 1; bottom: -6px; inset-inline-end: 0; }
 :root[data-match-label-mode] .team-detail > .team-schedule .fixture-card .match-team > .fixture-winner.is-placeholder { display: none; }
 :root[data-match-label-mode] .team-detail > .team-schedule [data-match-wordmark] > .team-caption { padding-inline: 2px; overflow: visible; white-space: normal; }
 :root[data-match-label-mode] .team-detail > .team-schedule [data-match-wordmark] .team-caption-content :is(.team-caption-name, .team-caption-tag, .team-caption-tag-text) { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; word-break: break-word; }
}

/* One row geometry for formal and training matches, including in the iframe. */
.team-detail > .team-schedule [data-team-fixtures-grid] {
  --team-fixture-crest: 36px;
  --team-fixture-name: 20px;
  --team-fixture-score: 48px;
  --team-fixture-gap: 6px;
  align-items: stretch;
}
.team-detail > .team-schedule [data-team-fixtures-grid] > :is(.cup-match-card.fixture-card, .training-match-card) {
  box-sizing: border-box;
  align-self: stretch;
  min-height: 86px;
  height: auto;
  justify-content: flex-start;
  gap: 4px;
  padding: 8px 10px;
}
.team-detail > .team-schedule [data-team-fixtures-grid] .team-fixture-meta {
  min-height: 16px;
  line-height: 1.3;
  margin: 0;
}
.team-detail > .team-schedule .team-fixture-stage {
  color: var(--text);
  white-space: normal;
}
.team-detail > .team-schedule .team-fixture-stage-swiss {
  color: #e6bb72;
  font-weight: 650;
}
:root[data-theme="light"] .team-detail > .team-schedule .team-fixture-stage-swiss {
  color: #895814;
}
.team-detail > .team-schedule .team-fixture-stage-separator {
  margin-inline: .25em;
  font-family: Arial, sans-serif;
  font-size: 1.35em;
  font-weight: 800;
  line-height: .65;
}
.team-detail > .team-schedule [data-team-fixtures-grid] :is(.fixture-card .match-teams, .training-card-match) {
  grid-template-columns: minmax(0, 1fr) var(--team-fixture-score) minmax(0, 1fr);
  min-height: var(--team-fixture-crest);
  gap: var(--team-fixture-gap);
  flex: 0 0 auto;
  align-items: center;
}
:root[data-match-label-mode] .team-detail > .team-schedule [data-team-fixtures-grid] :is(.fixture-card .match-team, .training-card-team)[data-match-wordmark] {
  position: relative;
  gap: var(--team-fixture-gap);
  padding-inline: 0;
  flex-direction: row;
  align-items: center;
}
:root[data-match-label-mode] .team-detail > .team-schedule [data-team-fixtures-grid] .training-card-team.is-red[data-match-wordmark="red"] {
  flex-direction: row-reverse;
}
.team-detail > .team-schedule [data-team-fixtures-grid] :is(.fixture-card .match-team, .training-card-team) > .team-mark {
  width: var(--team-fixture-crest);
  height: var(--team-fixture-crest);
  flex-basis: var(--team-fixture-crest);
}
.team-detail > .team-schedule [data-team-fixtures-grid] :is(.fixture-card .match-team-name, .training-card-name),
.team-detail > .team-schedule [data-team-fixtures-grid] .team-caption-content :is(.team-caption-name, .team-caption-tag-text) {
  font-size: var(--team-fixture-name);
  line-height: 1.15;
  font-weight: 650;
}
.team-detail > .team-schedule [data-team-fixtures-grid] .fixture-card .fixture-winner {
  position: absolute;
  inset: auto auto -4px 0;
  z-index: 1;
}
.team-detail > .team-schedule [data-team-fixtures-grid] .fixture-card .match-team-b .fixture-winner { inset-inline: auto 0; }
.team-detail > .team-schedule [data-team-fixtures-grid] .fixture-card .fixture-winner.is-placeholder { display: none; }
.team-detail > .team-schedule [data-team-fixtures-grid] .fixture-card .fixture-main-link {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.team-detail > .team-schedule [data-team-fixtures-grid] .fixture-card .fixture-support {
  position: static;
  min-height: 4px;
  width: 100%;
  height: 4px;
  margin: 0;
}
.team-detail > .team-schedule [data-team-fixtures-grid] .fixture-card .support-track { height: 4px; }
.team-detail > .team-schedule [data-team-fixtures-grid] .fixture-card .fixture-support-label { display: none; }
.team-detail > .team-schedule [data-team-fixtures-grid] .training-match-card::after { content: ""; height: 4px; }
@media (max-width: 700px) {
  .team-detail > .team-schedule [data-team-fixtures-grid] {
    --team-fixture-crest: 26px;
    --team-fixture-name: 16px;
    --team-fixture-score: 40px;
    --team-fixture-gap: 4px;
  }
}
