/*
 * ICE Standings Module
 * All slanted geometry is derived from --ice-slant-angle where supported.
 */

.mod-ice-standings {
  --ice-blue: #00437A;
  --ice-light-blue: #D9E2EB;
  --ice-dark-blue: #0B1B34;
  --ice-red: #D70A2D;
  --ice-white: #FFFFFF;
  --ice-slant-angle: 30deg;
  --ice-chevron-angle-positive: calc(90deg - var(--ice-slant-angle));
  --ice-chevron-angle-negative: calc(var(--ice-slant-angle) - 90deg);
  --ice-head-height: 28px;
  --ice-row-height: 39px;
  --ice-rank-width: 36px;
  --ice-rank-height: 27px;
  --ice-team-column: 58px;
  --ice-logo-width: 46px;
  --ice-logo-height: calc(var(--ice-row-height) * 0.72);
  --ice-logo-max-height: calc(var(--ice-row-height) * 0.8);
  --ice-rail-logo-height: calc(var(--ice-row-height) * 0.62);
  --ice-divider: rgba(0, 67, 122, 0.22);
  --ice-row-divider: rgba(0, 67, 122, 0.16);
  --ice-rail-half-rows: 3.5;
  --ice-rail-straight-width: 78px;
  --ice-rail-tip-depth: 86px;
  --ice-rail-width: calc(var(--ice-rail-tip-depth) + var(--ice-rail-straight-width));
  width: 100%;
  min-width: 0;
  color: var(--ice-dark-blue);
  font-family: Roboto, Arial, sans-serif;
  container-type: inline-size;
  container-name: ice-standings;
}

.mod-ice-standings,
.mod-ice-standings *,
.mod-ice-standings *::before,
.mod-ice-standings *::after {
  box-sizing: border-box;
}

.ice-standings__heading {
  min-width: 0;
}

.ice-standings__surface {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.62);
}

.ice-standings__surface--split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--ice-rail-width);
}

.ice-standings__surface--full {
  display: block;
}

.ice-standings__table-wrap {
  min-width: 0;
  transition: opacity 130ms ease, transform 130ms ease;
}

.ice-standings__table {
  width: 100%;
  min-width: 0;
  border: 0;
  border-collapse: collapse;
  border-spacing: 0;
  table-layout: fixed;
  color: var(--ice-dark-blue);
  font-size: clamp(10px, 1.55cqi, 14px);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.ice-standings__table col.ice-col-rank {
  width: calc(var(--ice-rank-width) + 6px);
}

.ice-standings__table col.ice-col-team {
  width: var(--ice-team-column);
}

.ice-standings__table col.ice-col-pts {
  width: 48px;
}

.mod-ice-standings--team-names .ice-standings__table col.ice-col-team {
  width: clamp(140px, 27cqi, 240px);
}

.ice-standings__table th,
.ice-standings__table td {
  height: var(--ice-row-height);
  padding: 0 4px;
  border: 0;
  vertical-align: middle;
  text-align: center;
}

.ice-standings__table thead th {
  height: var(--ice-head-height);
  color: var(--ice-blue);
  font-family: "Rigid Square", "Arial Narrow", Arial, sans-serif;
  font-size: clamp(9px, 1.3cqi, 12px);
  font-weight: 800;
  letter-spacing: 0.015em;
  text-transform: uppercase;
  white-space: nowrap;
}

.ice-standings__table thead abbr {
  border: 0;
  text-decoration: none;
  cursor: help;
}

.ice-standings__table tbody tr {
  border-top: 1px solid var(--ice-row-divider);
}

.ice-standings__table tbody:last-of-type tr:last-child {
  border-bottom: 1px solid var(--ice-row-divider);
}

.ice-standings__table tbody[hidden],
.ice-standings__rail-page[hidden] {
  display: none;
}

.ice-standings__rank-cell {
  padding-inline: 0 4px;
}

.ice-standings__rank {
  display: grid;
  width: var(--ice-rank-width);
  height: var(--ice-rank-height);
  place-items: center;
  margin: 0 auto 0 0;
  background: var(--ice-blue);
  color: var(--ice-white);
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 0 100%);
  font-family: "Rigid Square", "Arial Narrow", Arial, sans-serif;
  font-size: clamp(12px, 1.7cqi, 16px);
  font-weight: 800;
  line-height: 1;
}

.ice-standings__rank--playoff {
  background: var(--ice-blue);
  color: var(--ice-white);
}

.ice-standings__rank--preplayoff {
  background: var(--ice-light-blue);
  color: var(--ice-dark-blue);
}

.ice-standings__rank--out {
  background: var(--ice-red);
  color: var(--ice-white);
}

.ice-standings__team-cell {
  padding-inline: 2px;
  font-weight: 600;
}

.ice-standings__team-content {
  display: flex;
  min-width: 0;
  height: 100%;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.mod-ice-standings--team-names .ice-standings__team-content {
  justify-content: flex-start;
}

.ice-standings__logo-frame,
.ice-standings__rail-logo-frame {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: var(--ice-logo-width);
  height: min(var(--ice-logo-height), var(--ice-logo-max-height));
  max-height: var(--ice-logo-max-height);
}

.ice-standings__logo-inner,
.ice-standings__rail-logo-inner {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
}

.ice-standings__logo {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: var(--ice-logo-max-height);
  object-fit: contain;
}

.ice-standings__logo-fallback,
.ice-standings__rail-logo-fallback {
  overflow: hidden;
  color: var(--ice-blue);
  font-size: 8px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ice-standings__team-name {
  min-width: 0;
  overflow: hidden;
  color: var(--ice-dark-blue);
  font-size: clamp(11px, 1.45cqi, 14px);
  font-weight: 700;
  line-height: 1.15;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ice-standings__stat {
  border-inline-start: 1px solid var(--ice-divider);
  color: var(--ice-dark-blue);
  font-weight: 600;
  white-space: nowrap;
}

.ice-standings__stat--points {
  color: var(--ice-blue);
  font-size: 1.08em;
  font-weight: 900;
}

.ice-standings__empty {
  color: var(--ice-dark-blue);
  text-align: center;
}

.ice-standings__rail {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 100%;
  grid-template-columns: var(--ice-rail-tip-depth) minmax(0, 1fr);
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--ice-blue);
  color: var(--ice-white);
  clip-path: polygon(var(--ice-rail-tip-depth) 0, 100% 0, 100% 100%, var(--ice-rail-tip-depth) 100%, 0 50%);
  cursor: pointer;
  font: inherit;
  touch-action: manipulation;
  appearance: none;
}

.ice-standings__rail:focus-visible {
  outline: 0;
  box-shadow: inset 0 0 0 3px var(--ice-red);
}

.ice-standings__rail-pages {
  display: block;
  min-width: 0;
  grid-column: 2;
  padding-top: var(--ice-head-height);
  transition: opacity 130ms ease, transform 130ms ease;
}

.ice-standings__rail-page {
  display: block;
  min-width: 0;
}

.ice-standings__rail-row {
  display: grid;
  height: var(--ice-row-height);
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) 36px;
  align-items: center;
  gap: 3px;
  border-top: 1px solid rgba(255, 255, 255, 0.22);
}

.ice-standings__rail-row:last-child {
  border-bottom: 1px solid rgba(255, 255, 255, 0.22);
}

.ice-standings__rail-logo-frame {
  --ice-logo-width: 30px;
  --ice-logo-height: var(--ice-rail-logo-height);
  justify-self: end;
  height: min(var(--ice-logo-height), var(--ice-logo-max-height));
  max-height: var(--ice-logo-max-height);
}

.ice-standings__rail-logo {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(var(--ice-rail-logo-height), var(--ice-logo-max-height));
  object-fit: contain;
}

.ice-standings__rail-logo-fallback {
  color: var(--ice-white);
}

.ice-standings__rail-rank-frame {
  --ice-rail-rank-height: 25px;
  display: grid;
  width: 36px;
  height: var(--ice-rail-rank-height);
  place-items: center;
  justify-self: end;
  background: var(--ice-white);
  clip-path: polygon(8px 0, 100% 0, 100% 100%, 8px 100%, 0 50%);
}

.ice-standings__rail-rank {
  display: grid;
  width: calc(100% - 2px);
  height: calc(100% - 2px);
  place-items: center;
  background: var(--ice-blue);
  color: var(--ice-white);
  clip-path: inherit;
  font-family: "Rigid Square", "Arial Narrow", Arial, sans-serif;
  font-size: clamp(11px, 1.5cqi, 14px);
  font-weight: 900;
  line-height: 1;
}

.ice-standings__rail-rank--playoff {
  background: var(--ice-blue);
  color: var(--ice-white);
}

.ice-standings__rail-rank--preplayoff {
  background: var(--ice-light-blue);
  color: var(--ice-dark-blue);
}

.ice-standings__rail-rank--out {
  background: var(--ice-red);
  color: var(--ice-white);
}

.ice-standings__rail-chevron {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: calc(var(--ice-rail-tip-depth) * 0.14);
  width: 44px;
  height: 82px;
  transform: translateY(-50%);
  transform-origin: center;
  transition: transform 180ms ease;
  pointer-events: none;
}

.ice-standings__rail-chevron {
  display: grid;
  place-items: center;
}

.ice-standings__rail-chevron svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.ice-standings__rail-chevron path {
  fill: none;
  stroke: currentColor;
}

.mod-ice-standings.is-page-2 .ice-standings__rail-chevron {
  transform: translateY(-50%) scaleX(-1);
}

.mod-ice-standings.is-switching .ice-standings__table-wrap,
.mod-ice-standings.is-switching .ice-standings__rail-pages {
  opacity: 0;
  transform: translateX(-8px);
}

.ice-standings__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@supports (width: calc(1px * tan(30deg))) {
  .ice-standings__rank {
    --ice-rank-tip: calc((var(--ice-rank-height) / 2) * tan(var(--ice-slant-angle)));
    clip-path: polygon(
      0 0,
      calc(100% - var(--ice-rank-tip)) 0,
      100% 50%,
      calc(100% - var(--ice-rank-tip)) 100%,
      0 100%
    );
  }


  .ice-standings__surface--split {
    --ice-rail-half-height: calc(
      (var(--ice-head-height) / 2)
      + (var(--ice-row-height) * var(--ice-rail-half-rows))
    );
    --ice-rail-tip-depth: calc(var(--ice-rail-half-height) * tan(var(--ice-slant-angle)));
    --ice-rail-width: calc(var(--ice-rail-tip-depth) + var(--ice-rail-straight-width));
  }

  .ice-standings__rail {
    clip-path: polygon(
      var(--ice-rail-tip-depth) 0,
      100% 0,
      100% 100%,
      var(--ice-rail-tip-depth) 100%,
      0 50%
    );
  }

  .ice-standings__rail-rank-frame {
    --ice-rail-rank-tip: calc((var(--ice-rail-rank-height) / 2) * tan(var(--ice-slant-angle)));
    clip-path: polygon(
      var(--ice-rail-rank-tip) 0,
      100% 0,
      100% 100%,
      var(--ice-rail-rank-tip) 100%,
      0 50%
    );
  }
}

@container ice-standings (max-width: 700px) {
  .ice-col-gf,
  .ice-col-ga {
    display: none;
  }

  .ice-standings__surface--split {
    --ice-row-height: 36px;
    --ice-head-height: 27px;
    --ice-rail-straight-width: 66px;
    --ice-team-column: 58px;
  }

  .ice-standings__surface--split .ice-standings__rail-chevron {
    width: 34px;
    height: 68px;
  }

  }

@container ice-standings (max-width: 560px) {
  .mod-ice-standings--split .ice-col-otw,
  .mod-ice-standings--split .ice-col-otl {
    display: none;
  }

  .ice-standings__surface--split {
    --ice-row-height: 35px;
    --ice-rank-width: 32px;
    --ice-rank-height: 25px;
    --ice-team-column: 48px;
    --ice-logo-width: 38px;
    --ice-rail-straight-width: 54px;
  }

  .ice-standings__surface--split .ice-standings__rail-row {
    grid-template-columns: minmax(0, 1fr) 31px;
    gap: 2px;
  }

  .ice-standings__surface--split .ice-standings__rail-rank-frame {
    --ice-rail-rank-height: 23px;
    width: 31px;
  }

  .ice-standings__surface--split .ice-standings__rail-logo-frame {
    --ice-logo-width: 28px;
  }

  .ice-standings__table th,
  .ice-standings__table td {
    padding-inline: 3px;
  }
}

@container ice-standings (max-width: 470px) {
  .mod-ice-standings--full .ice-col-otw,
  .mod-ice-standings--full .ice-col-otl,
  .mod-ice-standings--split .ice-col-w,
  .mod-ice-standings--split .ice-col-l {
    display: none;
  }

  .ice-standings__surface--split {
    --ice-row-height: 34px;
    --ice-head-height: 25px;
    --ice-rank-width: 29px;
    --ice-rank-height: 23px;
    --ice-team-column: 40px;
    --ice-logo-width: 31px;
    --ice-rail-straight-width: 47px;
  }

  .ice-standings__surface--split .ice-standings__rail-chevron {
    left: calc(var(--ice-rail-tip-depth) * 0.1);
    width: 26px;
    height: 56px;
  }


  .ice-standings__surface--split .ice-standings__rail-row {
    grid-template-columns: minmax(0, 1fr) 27px;
  }

  .ice-standings__surface--split .ice-standings__rail-rank-frame {
    --ice-rail-rank-height: 21px;
    width: 27px;
  }

  .ice-standings__surface--split .ice-standings__rail-rank {
    font-size: 10px;
  }

  .ice-standings__surface--split .ice-standings__rail-logo-frame {
    --ice-logo-width: 23px;
  }

  .ice-standings__table th,
  .ice-standings__table td {
    padding-inline: 2px;
  }
}

@container ice-standings (max-width: 620px) {
  .mod-ice-standings--team-names .ice-standings__team-name {
    display: none;
  }

  .mod-ice-standings--team-names .ice-standings__table col.ice-col-team {
    width: var(--ice-team-column);
  }

  .mod-ice-standings--team-names .ice-standings__team-content {
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ice-standings__table-wrap,
  .ice-standings__rail-pages,
  .ice-standings__rail-chevron {
    transition: none;
  }
}
