/* Keep the roster chrome and schedule inside the site's shared dark palette. */
:root[data-theme="dark"][data-palette="crimson"] .teams-page .team-workspace :is(.team-selector-rail, .team-detail > .team-schedule) {
  background: var(--surface);
  border-color: var(--line);
}

:root[data-theme="dark"][data-palette="crimson"] .teams-page .team-workspace :is(.team-rail-heading, .team-identity) {
  border-color: var(--line);
}

:root[data-theme="dark"][data-palette="crimson"] .teams-page .team-selector-rail .team-rail-heading {
  color: var(--muted);
}

:root[data-theme="dark"][data-palette="crimson"] .teams-page .team-selector-rail [data-team-dock] > a:is(:hover, :focus-visible) {
  background-color: var(--surface-2);
  color: var(--text);
}

:root[data-theme="dark"][data-palette="crimson"] .teams-page .team-selector-rail [data-team-dock] > a[aria-current="page"] {
  background-color: color-mix(in srgb, var(--surface) 91%, var(--accent));
  border-color: color-mix(in srgb, var(--line) 62%, var(--accent));
  color: var(--accent);
}

:root[data-theme="dark"][data-palette="crimson"] .teams-page .team-schedule .section-heading > h2 {
  color: var(--text);
}

:root[data-theme="dark"][data-palette="crimson"] .teams-page .team-schedule .section-heading > a {
  color: var(--muted);
}

:root[data-theme="dark"][data-palette="crimson"] .teams-page .team-schedule .section-heading > a:is(:hover, :focus-visible) {
  color: var(--accent);
}

:root[data-theme="dark"][data-palette="crimson"] .teams-page .team-schedule [data-team-fixtures-grid] > :is(.cup-match-card.fixture-card, .training-match-card) {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--line);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--accent) 10%, transparent);
}

:root[data-theme="dark"][data-palette="crimson"] .teams-page .team-schedule [data-team-fixtures-grid] :is(.match-teams, .training-card-match) {
  border-radius: 4px;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--blue) 12%, transparent),
    transparent 43% 57%,
    color-mix(in srgb, var(--red) 10%, transparent));
}

:root[data-theme="dark"][data-palette="crimson"] .teams-page .team-schedule [data-team-fixtures-grid] > :is(.fixture-card, .training-match-card):is(:hover, :focus-within) {
  border-color: color-mix(in srgb, var(--line) 62%, var(--accent));
}

:root[data-theme="dark"][data-palette="crimson"] .teams-page .team-schedule [data-team-fixtures-grid] :is(.fixture-time, .match-result-pending) {
  color: var(--muted);
}

:root[data-theme="dark"][data-palette="crimson"] .teams-page .team-schedule [data-team-fixtures-grid] :is(.team-fixture-stage-swiss, .training-card-stage) {
  color: var(--accent);
}

:root[data-theme="dark"][data-palette="crimson"] .teams-page .team-schedule [data-team-fixtures-grid] .training-card-stage {
  font-weight: 650;
}

:root[data-theme="dark"][data-palette="crimson"] .teams-page .team-schedule [data-team-fixtures-grid] :is(.match-result, .training-card-score) {
  font-variant-numeric: tabular-nums;
}

/* Keep the date and time intact, using the remaining width for the stage label. */
.teams-page .team-detail > .team-schedule [data-team-fixtures-grid] .team-fixture-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
  gap: 4px;
  line-height: 1.25;
  white-space: nowrap;
}

.teams-page .team-detail > .team-schedule [data-team-fixtures-grid] .team-fixture-meta > :is(.team-fixture-stage, .training-card-stage) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.teams-page .team-detail > .team-schedule [data-team-fixtures-grid] .team-fixture-meta > .fixture-time {
  margin-inline-start: 0;
  text-align: end;
  white-space: nowrap;
}

/* Free-form fixture notes can be longer than a date and time. */
.teams-page .team-detail > .team-schedule [data-team-fixtures-grid] .team-fixture-meta:has(> span.fixture-time) {
  grid-template-columns: minmax(0, 1fr) fit-content(50%);
}

.teams-page .team-detail > .team-schedule [data-team-fixtures-grid] .team-fixture-meta > span.fixture-time {
  min-inline-size: 0;
  max-inline-size: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Keep the roster crests at their artwork size, including older embed markup. */
.public-full-embed.teams-page :is(.team-selector-rail [data-team-dock] .team-mark, .team-identity > .team-mark, .team-schedule [data-team-fixtures-grid] .team-mark),
.public-full-embed.teams-page :is(.team-selector-rail [data-team-dock] .team-mark, .team-identity > .team-mark, .team-schedule [data-team-fixtures-grid] .team-mark) > img {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  clip-path: none;
}

.public-full-embed.teams-page .team-identity > .team-mark {
  width: clamp(56px, 6vw, 72px);
  height: clamp(56px, 6vw, 72px);
  flex-basis: clamp(56px, 6vw, 72px);
}

@media (max-width: 700px) {
  .public-full-embed.teams-page .team-selector-rail nav[data-team-dock] > a {
    grid-template-columns: 36px minmax(0, 1fr);
    min-height: 46px;
  }

  .public-full-embed.teams-page .team-selector-rail nav[data-team-dock] .team-mark {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }
}

/* Keep both names readable in a half-width card by placing the crest above it. */
@container team-fixtures (min-width: 260px) and (max-width: 659px) {
  .public-full-embed.teams-page .team-schedule [data-team-fixtures-grid] {
    --team-fixture-crest: clamp(31px, 10cqw, 42px);
    --team-fixture-name: clamp(12px, 3.8cqw, 15px);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .public-full-embed.teams-page .team-schedule .team-fixtures-viewport {
    --team-fixtures-height: 244px;
    scrollbar-gutter: auto;
  }

  .public-full-embed.teams-page .team-schedule [data-team-fixtures-grid] > :is(.cup-match-card.fixture-card, .training-match-card) {
    height: auto;
    min-height: 92px;
    padding: 6px;
  }

  .public-full-embed.teams-page .team-schedule [data-team-fixtures-grid] .team-fixture-meta {
    font-size: 10px;
  }

  .public-full-embed.teams-page .team-schedule [data-team-fixtures-grid] :is(.match-teams, .training-card-match) {
    grid-template-columns: minmax(0, 1fr) max-content minmax(0, 1fr);
    align-items: start;
    gap: 3px;
    padding-inline: 0;
  }

  :root[data-match-label-mode] .public-full-embed.teams-page .team-schedule [data-team-fixtures-grid] :is(.match-team, .training-card-team)[data-match-wordmark] {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: start;
    min-width: 0;
    gap: 2px;
    padding-inline: 0;
    text-align: center;
  }

  .public-full-embed.teams-page .team-schedule [data-team-fixtures-grid] :is(.match-team, .training-card-team) > .team-mark {
    order: -1;
    width: var(--team-fixture-crest);
    height: var(--team-fixture-crest);
    flex-basis: var(--team-fixture-crest);
  }

  :root[data-match-label-mode] .public-full-embed.teams-page .team-schedule [data-team-fixtures-grid] [data-match-wordmark] > :is(.team-caption, .training-card-name) {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
    padding-inline: 1px;
    line-height: 1.2;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .public-full-embed.teams-page .team-detail > .team-schedule [data-team-fixtures-grid] .fixture-card .match-team > .fixture-winner {
    position: absolute;
    inset-block: 0 auto;
    inset-inline: 0 auto;
    width: max-content;
    padding-inline: 2px;
    font-size: 8px;
    line-height: 12px;
  }

  .public-full-embed.teams-page .team-detail > .team-schedule [data-team-fixtures-grid] .fixture-card .match-team-b > .fixture-winner {
    inset-inline: auto 0;
  }

  .public-full-embed.teams-page .team-schedule [data-team-fixtures-grid] :is(.match-result, .training-card-score) {
    min-width: 0;
    margin-block-start: 5px;
    gap: 2px;
    font-size: 16px;
    line-height: 1.2;
  }

  .public-full-embed.teams-page .team-schedule [data-team-fixtures-grid] .training-card-score strong {
    font-size: inherit;
  }
}
