.team-profile {
  --club-accent: #fe7950;
  --club-forest: #201e1b;
  --club-badge: #fff;
  --club-background: color-mix(in srgb, var(--club-accent) 13%, #f5f3ef);
  --club-paper: color-mix(in srgb, var(--club-accent) 5%, #fff);
  --club-ink: color-mix(in srgb, var(--club-forest) 65%, #171a18);
  --club-muted: color-mix(in srgb, var(--club-ink) 78%, #a9aaa8);
  --club-rule: color-mix(in srgb, var(--club-forest) 28%, var(--club-background));
  --club-wash: color-mix(in srgb, var(--club-accent) 23%, #f4f3ef);
  --club-focus: var(--club-forest);
  --club-pattern: linear-gradient(transparent, transparent);
  --club-cover-position: center;

  position: relative;
  isolation: isolate;
  overflow: clip;
  padding: 0 0 56px;
  background: var(--club-background);
  color: var(--club-ink);
}

.team-profile[data-team-profile="skill-up"] {
  --club-accent: #cbd3a9;
  --club-forest: #173329;
  --club-background: #edf0e3;
  --club-paper: #f8f9f1;
  --club-ink: #182920;
  --club-muted: #4a5a4d;
  --club-rule: #9cae98;
  --club-wash: #e2e9d6;
  --club-focus: #356544;
  --club-pattern: url("/assets/team-profiles/skill-up/wordmark-tile.webp");
  --club-cover-position: 66% 55%;
}

.team-profile::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  background: var(--club-ink);
  mask: var(--club-pattern) repeat;
  opacity: 0.075;
  pointer-events: none;
  content: "";
}

.team-profile[data-team-profile="fatracing"]::before {
  background: var(--pattern-leopard) repeat;
  mask: none;
}

.team-profile .container--protocol {
  width: min(1280px, calc(100% - clamp(28px, 7vw, 112px)));
}

.team-profile__opening {
  padding: 20px 0 10px;
}

.team-profile__topline {
  display: flex;
  margin-bottom: 16px;
}

.team-profile__back,
.team-profile__jump a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--club-ink);
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.team-profile__back {
  padding: 0 14px;
  border: 1px solid var(--club-rule);
  background: var(--club-paper);
}

.team-profile__hero {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  background: var(--club-forest);
  color: var(--club-accent);
}

.team-profile__intro {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: clamp(26px, 4vw, 60px);
}

.team-profile__location {
  margin: 0 0 26px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.team-profile__intro h1 {
  width: 100%;
  margin: 0 0 22px;
  font-family: var(--display-font-cyrillic-safe);
  font-size: clamp(33px, 5.5vw, 82px);
  font-weight: var(--display-font-weight);
  line-height: 0.98;
  overflow-wrap: anywhere;
  text-transform: uppercase;
}

.team-profile__intro h1 img {
  width: min(100%, 480px);
  height: auto;
}

.team-profile__description {
  max-width: 40ch;
  margin: 0 0 24px;
  color: #fff;
  font-size: clamp(15px, 1.35vw, 19px);
  font-weight: 650;
  line-height: 1.5;
  white-space: pre-line;
}

.team-profile__action {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  min-height: 48px;
  padding: 10px 15px;
  background: var(--club-accent);
  color: var(--club-forest);
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
  text-transform: uppercase;
}

.team-profile__action:hover {
  background: #fff;
}

.team-profile__intro .teams-directory__link {
  gap: 0 14px;
  margin-top: 11px;
  padding: 0;
  border: 0;
  background: transparent;
}

.team-profile__intro .teams-directory__link a {
  min-height: 44px;
  border: 0;
  color: var(--club-accent);
  font-size: 11px;
  text-transform: none;
}

.team-profile__intro .teams-directory__link a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.team-profile__cover {
  position: relative;
  min-height: 100%;
}

.team-profile__cover img {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--club-cover-position);
}

.team-profile__badge-inline {
  margin-bottom: 16px;
}

.team-profile__badge {
  display: block;
  position: relative;
  width: min(66%, 250px);
  height: auto;
  aspect-ratio: 1;
  padding: 12px;
  background: var(--club-badge);
  object-fit: contain;
  box-shadow: 5px 5px 0 color-mix(in srgb, var(--club-forest) 30%, transparent);
}

.team-profile__badge-inline .team-profile__badge {
  width: 78px;
  padding: 4px;
}

.team-profile__identity {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 250px;
  background: color-mix(in srgb, var(--club-accent) 32%, #f7f5ee);
}

.team-profile__identity::before {
  position: absolute;
  inset: 0;
  background: var(--club-forest);
  mask: var(--club-pattern) repeat;
  opacity: 0.15;
  pointer-events: none;
  content: "";
}

.team-profile[data-team-layout="type"] .team-profile__hero {
  grid-template-columns: minmax(0, 1fr);
  background-image: repeating-linear-gradient(123deg, transparent 0 22px, #fff1 22px 23px);
}

.team-profile[data-team-layout="type"] .team-profile__intro h1 {
  max-width: 22ch;
  font-size: clamp(36px, 8vw, 110px);
  margin-bottom: 0;
}

.team-profile[data-team-layout="type"] .team-profile__description {
  margin: 20px 0 0;
}

.team-profile[data-team-layout="type"] .team-profile__action {
  margin-top: 20px;
}

@media (min-width: 761px) {
  .team-profile:is([data-team-layout="badge"], [data-team-layout="reverse"]) .team-profile__hero {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  }

  .team-profile[data-team-layout="reverse"] .team-profile__cover {
    grid-column: 1;
    grid-row: 1;
  }

  .team-profile:is([data-team-layout="banner"], [data-team-layout="banner-right"]) .team-profile__hero {
    grid-template-columns: 1fr;
    min-height: 450px;
  }

  .team-profile:is([data-team-layout="banner"], [data-team-layout="banner-right"]) :is(.team-profile__intro, .team-profile__cover) {
    grid-area: 1 / 1;
  }

  .team-profile:is([data-team-layout="banner"], [data-team-layout="banner-right"]) .team-profile__intro {
    position: relative;
    z-index: 1;
    align-self: end;
    width: min(48%, 550px);
    margin: 22px;
    padding: clamp(22px, 3vw, 42px);
    background: var(--club-forest);
  }

  .team-profile[data-team-layout="banner-right"] .team-profile__intro {
    justify-self: end;
  }

  .team-profile:is([data-team-layout="banner"], [data-team-layout="banner-right"]) .team-profile__intro h1 {
    font-size: clamp(36px, 4.6vw, 68px);
  }
}

.team-profile__index {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid var(--club-rule);
  border-top: 0;
  background: var(--club-paper);
}

.team-profile__jump {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 6px 12px;
}

.team-profile__jump a {
  padding-inline: 10px;
}

.team-profile__jump a:hover,
.team-profile__back:hover {
  background: var(--club-wash);
}

.team-profile__stats {
  display: flex;
  margin: 0;
}

.team-profile__stats > div {
  display: flex;
  flex-direction: column-reverse;
  justify-content: center;
  gap: 3px;
  min-width: 120px;
  padding: 10px 18px;
  border-left: 1px solid var(--club-rule);
}

.team-profile__stats dt {
  color: var(--club-muted);
  font-size: 11px;
  font-weight: 850;
  line-height: 1.25;
  text-transform: uppercase;
}

.team-profile__stats dd {
  margin: 0;
  font-family: var(--display-font-cyrillic-safe);
  font-size: 31px;
  font-weight: var(--display-font-weight);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.team-profile .section {
  padding: clamp(24px, 4vw, 46px) 0 0;
  scroll-margin-top: 90px;
}

.team-profile .section__header {
  align-items: center;
  gap: 8px 18px;
  padding: 14px 16px;
  border-block: 1px solid var(--club-rule);
  background: var(--club-paper);
}

.team-profile .section__header h2 {
  font-family: var(--display-font-cyrillic-safe);
  font-size: clamp(27px, 3.6vw, 44px);
  font-weight: var(--display-font-weight);
  line-height: 1;
}

.team-profile .section__header .hint {
  color: var(--club-muted);
  font-weight: 750;
}

.team-profile .team-coaches {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
  gap: 13px;
}

.team-profile .team-coaches__card {
  flex-direction: column;
  min-width: 0;
  padding: 0;
  gap: 0;
  overflow: hidden;
}

.team-profile .team-coaches__media {
  width: 100%;
  height: auto;
  flex: none;
  aspect-ratio: 4 / 3;
  border: 0;
  border-bottom: 1px solid var(--club-rule);
  border-radius: 0;
}

.team-profile .team-coaches__photo {
  object-position: center 15%;
}

.team-profile .team-coaches__info {
  flex: 1;
  padding: clamp(14px, 2vw, 23px);
}

.team-profile .team-coaches__name {
  font-size: clamp(19px, 2.5vw, 32px);
  line-height: 1.04;
  overflow-wrap: anywhere;
}

.team-profile .team-coaches__role {
  color: var(--club-muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.team-profile .team-coaches__title {
  max-width: 65ch;
  color: var(--club-ink);
  font-size: 14px;
  line-height: 1.45;
}

@media (min-width: 641px) {
  .team-profile .team-coaches__card:only-child {
    display: grid;
    grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
  }

  .team-profile .team-coaches__card:only-child .team-coaches__media {
    min-height: 100%;
    aspect-ratio: 1;
    border-bottom: 0;
    border-right: 1px solid var(--club-rule);
  }
}

.team-profile .team-coaches__profile {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  margin-top: auto;
  color: inherit;
  font-size: 13px;
  font-weight: 850;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.team-profile :is(.team-coaches__card, .team-roster__card, .team-feed, .team-tech, .team-past) {
  border: 1px solid var(--club-rule);
  border-radius: 0;
  background: var(--club-paper);
  box-shadow: none;
}

.team-profile .empty {
  border-color: var(--club-rule);
  background: var(--club-paper);
  color: var(--club-muted);
}

.team-profile .team-roster {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 186px), 1fr));
  gap: 12px;
}

.team-profile .team-roster__card:is(:hover, :focus-visible) {
  border-color: var(--club-focus);
  box-shadow: 3px 3px 0 var(--club-rule);
}

.team-profile :is(.team-roster__media, .team-coaches__media) {
  background: var(--club-wash);
}

.team-profile .team-roster__media {
  aspect-ratio: 4 / 3;
  border-bottom: 1px solid var(--club-rule);
}

.team-profile .team-roster__bib {
  border: 1px solid var(--club-rule);
  background: var(--club-paper);
}

.team-profile :is(.team-roster__stat, .team-feed__chip) {
  border: 1px solid var(--club-rule);
  background: var(--club-wash);
  color: var(--club-muted);
}

.team-profile :is(.team-roster__stat b, .team-roster__last b, .team-tech__body b) {
  color: var(--club-ink);
}

.team-profile :is(.team-roster__last, .team-feed__result-meta, .team-feed__rest, .team-tech__body) {
  color: var(--club-muted);
}

.team-profile .team-roster__legend {
  padding: 10px 12px;
  background: var(--club-paper);
  color: var(--club-muted);
}

.team-profile .team-past__body .team-roster__legend {
  padding: 0;
}

.team-profile :is(.team-past, .team-tech) > summary {
  min-height: 44px;
  color: var(--club-ink);
}

.team-profile :is(.team-past, .team-tech) > summary::after {
  float: right;
  margin-left: 8px;
  content: "+";
}

.team-profile :is(.team-past, .team-tech)[open] > summary::after {
  content: "−";
}

.team-profile .team-feed__row {
  border-bottom-width: 1px;
  border-color: var(--club-rule);
}

.team-profile .team-feed__row > summary {
  position: relative;
  padding-right: 44px;
}

.team-profile .team-feed__row > summary::after {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  font-size: 20px;
  line-height: 1;
  content: "+";
}

.team-profile .team-feed__row[open] > summary::after {
  content: "−";
}

.team-profile .team-feed__row[open] > .team-feed__head {
  background: var(--club-forest);
  color: var(--club-accent);
}

.team-profile :is(.team-past, .team-tech) > summary:hover,
.team-profile .team-feed__row:not([open]) > summary:hover {
  background: var(--club-wash);
  color: var(--club-ink);
}

.team-profile .team-feed__row > div.team-feed__head {
  background: transparent;
  color: var(--club-ink);
  cursor: auto;
}

.team-profile .team-feed :is(.link, .team-feed__title a, .team-feed__date) {
  color: inherit;
}

.team-profile .team-feed .link {
  border-color: var(--club-focus);
}

.team-profile .team-feed__count {
  border-width: 1px;
}

.team-profile .team-feed__result {
  border-color: var(--club-rule);
  border-top-width: 1px;
}

.team-profile :is(a, summary):focus-visible {
  outline: 3px solid var(--club-focus);
  outline-offset: -3px;
}

.team-profile :is(.team-profile__intro a, .team-feed__row[open] > summary):focus-visible {
  outline-color: var(--club-accent);
}

@media (max-width: 760px) {
  .team-profile__opening {
    padding-top: 12px;
  }

  .team-profile__topline {
    margin-bottom: 12px;
  }

  .team-profile__hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .team-profile__location,
  .team-profile__intro h1,
  .team-profile__description {
    margin-bottom: 16px;
  }

  .team-profile__intro h1 img {
    max-width: 390px;
  }

  .team-profile__cover {
    aspect-ratio: 8 / 5;
  }

  .team-profile__identity {
    min-height: 0;
    padding: 20px 14px;
  }

  .team-profile__identity .team-profile__badge {
    width: min(45%, 164px);
  }

  .team-profile__index {
    flex-wrap: wrap;
    gap: 0;
  }

  .team-profile__jump {
    gap: 0;
    padding: 3px 7px;
  }

  .team-profile__stats {
    flex: 1 1 100%;
    border-top: 1px solid var(--club-rule);
  }

  .team-profile__stats > div {
    flex: 1;
  }

  .team-profile__stats > div:first-child {
    border-left: 0;
  }
}

@media (max-width: 640px) {
  .team-profile .team-coaches {
    grid-template-columns: 1fr;
  }

  .team-profile .team-coaches__card {
    flex-direction: row;
  }

  .team-profile .team-coaches__media {
    position: relative;
    width: clamp(86px, 29vw, 160px);
    aspect-ratio: auto;
    border-bottom: 0;
    border-right: 1px solid var(--club-rule);
  }

  .team-profile .team-coaches__photo {
    position: absolute;
    object-position: center 25%;
  }

  .team-profile .team-roster {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 136px), 1fr));
  }

  .team-profile .team-feed__head {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  .team-profile .team-feed__count {
    justify-self: start;
  }
}

@media (prefers-color-scheme: dark) {
  .team-profile {
    --club-background: color-mix(in srgb, var(--club-forest) 52%, #131615);
    --club-paper: color-mix(in srgb, var(--club-accent) 8%, var(--club-background));
    --club-ink: color-mix(in srgb, var(--club-accent) 10%, #fff);
    --club-muted: color-mix(in srgb, var(--club-ink) 75%, var(--club-background));
    --club-rule: color-mix(in srgb, var(--club-accent) 38%, var(--club-background));
    --club-wash: color-mix(in srgb, var(--club-accent) 15%, var(--club-background));
    --club-focus: var(--club-accent);
  }

  .team-profile[data-team-profile="skill-up"] {
    --club-background: #14241d;
    --club-paper: #1e352a;
    --club-ink: #f1f4e9;
    --club-muted: #c1cdbf;
    --club-rule: #66816c;
    --club-wash: #2c4738;
    --club-focus: #d0dfa9;
  }
}
