/* LEGACY SPORTS — 2027 KNOCKOUT BRACKET (basketball)
   Columns: Semi Finals | lines | Final | line | Champion + trophy.
   Every column body has the same height, so the semi cards sit at 25% / 75%
   (space-around) and the final at 50%: the connector lines meet them exactly.
   Crest styles live in event_hub.css. */

.kb-page {
  min-height: calc(100vh - 120px);
  padding: 56px 16px 56px;
  color: #f7f5f2;
  background:
    radial-gradient(ellipse at 85% 0%, rgba(187, 8, 11, .32), transparent 55%),
    linear-gradient(160deg, #0b0c0e 0%, #151a1f 60%, #1e2023 100%);
}

.kb-shell {
  max-width: 1180px;
  margin: 0 auto;
}

.kb-header {
  margin-bottom: 32px;
  text-align: center;
}

.kb-header h1 {
  margin: 0 0 10px;
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(48px, 8vw, 88px);
  font-weight: 400;
  line-height: .92;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.kb-header p {
  max-width: 520px;
  margin: 0 auto;
  color: #b9b6b1;
  font: 15px/1.6 "Sofia Sans", sans-serif;
}

/* ---------- SCROLL BOX (phones scroll the bracket, not the page) ---------- */
.kb-scroll {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}

.kb-scroll:focus-visible {
  outline: 2px solid #bb080b;
  outline-offset: 4px;
}

.kb-board {
  --kb-body: 320px;
  --kb-line: rgba(247, 245, 242, .45);
  display: grid;
  grid-template-columns: minmax(230px, 1fr) 44px minmax(230px, 1fr) 44px minmax(220px, .9fr);
  min-width: 860px;
}

/* ---------- COLUMNS ---------- */
.kb-round-head {
  height: 58px;
  margin-bottom: 10px;
  border-bottom: 2px solid #bb080b;
}

.kb-link .kb-round-head {
  border-bottom-color: transparent;
}

.kb-round-head h2 {
  margin: 0;
  font-family: "Bebas Neue", sans-serif;
  font-size: 26px;
  font-weight: 400;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.kb-round-head span {
  color: #b9b6b1;
  font: 700 11px "Sofia Sans", sans-serif;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.kb-col-body {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: var(--kb-body);
}

.kb-col--semis .kb-col-body {
  justify-content: space-around;
}

/* ---------- CONNECTOR LINES ---------- */
.kb-link--fork .kb-col-body::before {
  /* "]" joining the two semi finals */
  content: "";
  position: absolute;
  top: 25%;
  bottom: 25%;
  left: 0;
  width: 50%;
  border: 2px solid var(--kb-line);
  border-left: 0;
  border-radius: 0 6px 6px 0;
}

.kb-link--fork .kb-col-body::after,
.kb-link--straight .kb-col-body::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0;
  border-top: 2px solid var(--kb-line);
}

.kb-link--fork .kb-col-body::after {
  left: 50%;
}

.kb-link--straight .kb-col-body::after {
  left: 0;
}

/* ---------- MATCH CARD ---------- */
.kb-card {
  overflow: hidden;
  border-radius: 6px;
  background: #fff;
  color: #151a1f;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .35);
}

.kb-card.is-live {
  box-shadow: 0 0 0 2px #bb080b, 0 12px 28px rgba(0, 0, 0, .35);
}

.kb-card-meta {
  display: flex;
  justify-content: space-between;
  padding: 7px 12px;
  background: #f0ede8;
  color: #5d5a56;
  font: 800 10px "Sofia Sans", sans-serif;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.kb-card.is-live .kb-card-meta span:last-child {
  color: #bb080b;
}

.kb-team {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 7px 12px;
  border-top: 1px solid #e7e3dd;
}

.kb-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  font: 800 14px "Sofia Sans", sans-serif;
  letter-spacing: .3px;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.kb-name small {
  margin-left: 4px;
  color: #8a8680;
  font-weight: 700;
  font-size: 11px;
}

.kb-score {
  flex: 0 0 auto;
  min-width: 26px;
  font-family: "Bebas Neue", sans-serif;
  font-size: 24px;
  font-weight: 400;
  text-align: right;
}

.kb-team.is-winner {
  background: #bb080b;
  color: #fff;
}

.kb-team.is-winner + .kb-team {
  border-top-color: transparent;
}

/* ---------- CHAMPION + TROPHY ---------- */
.kb-champion {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.kb-trophy {
  width: auto;
  height: 220px;
  filter: drop-shadow(0 14px 24px rgba(0, 0, 0, .5));
}

.kb-champion-name {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 6px;
  background: rgba(21, 26, 31, .85);
}

.kb-champion-name strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font: 800 15px "Sofia Sans", sans-serif;
  text-transform: uppercase;
}

.kb-champion.is-crowned .kb-champion-name {
  border-color: #bb080b;
  background: #bb080b;
}

@media (min-width: 760px) {
  .kb-page {
    padding: 72px 32px 64px;
  }
}


/* ---------- GROUP STAGE (under the bracket) ---------- */
.kg-section {
  margin-top: 56px;
}

.kg-head {
  margin-bottom: 24px;
  text-align: center;
}

.kg-kicker {
  color: #ff5a5e;
  font: 800 11px "Sofia Sans", sans-serif;
  letter-spacing: 3px;
}

.kg-head h2 {
  margin: 8px 0 8px;
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(36px, 6vw, 56px);
  font-weight: 400;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.kg-head p {
  max-width: 520px;
  margin: 0 auto;
  color: #b9b6b1;
  font: 14px/1.6 "Sofia Sans", sans-serif;
}

.kg-groups {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
}

.kg-group-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.kg-badge {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #bb080b;
  color: #fff;
  font-family: "Bebas Neue", sans-serif;
  font-size: 24px;
  box-shadow: 0 0 0 4px rgba(187, 8, 11, .25);
}

.kg-group-label {
  font-family: "Bebas Neue", sans-serif;
  font-size: 26px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.kg-table {
  display: grid;
  gap: 6px;
}

.kg-row {
  display: grid;
  /* P, W-D-L (wider: "1-1-0"), PTS, +/- */
  grid-template-columns: 24px minmax(0, 1fr) 30px 48px 34px 34px;
  align-items: center;
  gap: 6px;
  min-height: 54px;
  padding: 0 12px;
  border-left: 3px solid transparent;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .03));
  font: 600 14px "Sofia Sans", sans-serif;
}

.kg-row--head {
  min-height: 28px;
  background: none;
  color: #8c8883;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.kg-row.is-through {
  border-left-color: #bb080b;
  background: linear-gradient(90deg, rgba(187, 8, 11, .28), rgba(255, 255, 255, .04));
}

.kg-row.is-open {
  color: #77736e;
}

.kg-pos {
  color: #b9b6b1;
  font-weight: 800;
}

.kg-team {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.kg-team strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .5px;
  text-transform: uppercase;
}

.kg-seed {
  flex: none;
  padding: 2px 6px;
  border-radius: 3px;
  background: #bb080b;
  color: #fff;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 1px;
}

.kg-num {
  white-space: nowrap;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.kg-soon {
  display: grid;
  gap: 8px;
  max-width: 560px;
  margin: 0 auto;
  padding: 36px 24px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 8px;
  background: rgba(21, 26, 31, .7);
  text-align: center;
}

.kg-soon span {
  color: #ff5a5e;
  font: 800 11px "Sofia Sans", sans-serif;
  letter-spacing: 3px;
}

.kg-soon strong {
  font: 700 18px "Sofia Sans", sans-serif;
}

.kg-soon a {
  color: #ff5a5e;
  font: 700 14px "Sofia Sans", sans-serif;
}

@media (min-width: 760px) {
  .kg-groups {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }

  .kg-row {
    grid-template-columns: 28px minmax(0, 1fr) 42px 56px 42px 42px;
    padding: 0 16px;
  }
}

/* ---------- CHAMPION CELEBRATION (celebrate.js) ---------- */
.kb-page {
  overflow-x: clip; /* the celebration canvas is full width; never adds sideways scroll */
}

.kb-stage {
  position: relative;
}

.kb-celebrate {
  position: absolute;
  top: -56px;           /* up to the top of the dark area (page padding) */
  left: 50%;
  z-index: 5;
  width: 100vw;
  height: calc(100% + 80px);
  transform: translateX(-50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s ease;
}

.kb-celebrate.is-on {
  opacity: 1;
}

.kb-champion.is-crowned .kb-trophy {
  animation: kb-trophy-glow 2.8s ease-in-out infinite;
}

.kb-champion.is-celebrating .kb-trophy {
  animation: kb-trophy-pop .9s cubic-bezier(.2, 1.6, .4, 1) both, kb-trophy-glow 2.8s ease-in-out .9s infinite;
}

.kb-champion.is-crowned .kb-champion-name {
  position: relative;
  overflow: hidden;
}

.kb-champion.is-crowned .kb-champion-name::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .45) 50%, transparent 70%);
  transform: translateX(-120%);
  animation: kb-shine 3.2s ease-in-out 1s infinite;
}

@keyframes kb-trophy-pop {
  0% { transform: scale(.6) translateY(20px); }
  60% { transform: scale(1.12) translateY(-6px); }
  100% { transform: scale(1) translateY(0); }
}

@keyframes kb-trophy-glow {
  0%, 100% { filter: drop-shadow(0 14px 24px rgba(0, 0, 0, .5)) drop-shadow(0 0 0 rgba(245, 197, 66, 0)); }
  50% { filter: drop-shadow(0 14px 24px rgba(0, 0, 0, .5)) drop-shadow(0 0 26px rgba(245, 197, 66, .65)); }
}

@keyframes kb-shine {
  0%, 60% { transform: translateX(-120%); }
  100% { transform: translateX(120%); }
}

@media (prefers-reduced-motion: reduce) {
  .kb-champion.is-crowned .kb-trophy,
  .kb-champion.is-celebrating .kb-trophy,
  .kb-champion.is-crowned .kb-champion-name::after {
    animation: none;
  }
}

/* Standings rules line under the group tables */
.kg-rule { margin: 14px 0 0; color: #8a8782; font-size: 13px; line-height: 1.5; text-align: center; }
