/* Hooplytix — tokens and chrome.
   Colours and type come from the product's own design system
   (docs/design-system.md → src/styles/globals.css). */

:root {
  color-scheme: dark;

  /* ---- surfaces, straight from the app's dark theme ---- */
  --ink-900: #080C16;   /* background.main     */
  --ink-850: #0B1120;
  --ink-800: #101521;   /* background.secondary */
  --ink-750: #151D30;   /* background.tertiary  */
  --ink-700: #1C2335;   /* surface.card         */
  --ink-600: #20283C;   /* surface.row          */

  --chalk:   #FFFFFF;   /* text.primary   */
  --chalk-2: #7588A3;   /* text.secondary */
  --chalk-3: #5C6B84;   /* text.muted, lifted for body copy contrast */

  --line:      #1E2942;
  --line-soft: #151D30;

  --leather:    #F9941F;   /* primary.main */
  --leather-hi: #FFAB44;
  --leather-dim: rgba(249, 148, 31, 0.14);

  --good: #22C55E;   /* status.success */
  --bad:  #EF4444;   /* status.error   */
  --warn: #F59E0B;   /* status.warning */

  /* series: us / them / good / index / neutral */
  --s1: #F9941F;
  --s2: #EF4444;
  --s3: #22C55E;
  --s4: #9085E9;
  --s5: #7588A3;

  --shell: min(1240px, 92vw);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-pill: 999px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--ink-900);
  color: var(--chalk);
  font-family: "DM Sans", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
}

h1, h2, h3 {
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0;
  text-wrap: balance;
}

p { margin: 0; max-width: 62ch; }
a { color: inherit; }

.num { font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

.stamp {
  font-size: 12px;
  font-weight: 500;
  color: var(--chalk-2);
  font-variant-numeric: tabular-nums;
}

/* ---------- scene canvas ---------- */
#court {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
  pointer-events: none;
}

/* ---------- top bar ---------- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 28px;
  height: 64px;
  padding: 0 max(20px, 4vw);
  background: rgba(8, 12, 22, 0.86);
  border-bottom: 1px solid var(--line-soft);
  backdrop-filter: blur(12px);
}

.mark {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
/* the supplied lockup, sized by height; below 480px the source swaps to the
   ball on its own so the row still fits a phone */
.mark img {
  display: block;
  flex: none;
  height: 26px;
  width: auto;
}
footer.foot .mark img { height: 23px; }

.topbar nav { display: flex; gap: 8px; margin-left: auto; align-items: center; }
.topbar nav a {
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--chalk-2);
  padding: 7px 13px;
  border-radius: var(--r-pill);
  white-space: nowrap;
}
.topbar nav a:hover { color: var(--chalk); background: var(--ink-800); }
.topbar nav a[aria-current="page"] { color: var(--chalk); background: var(--ink-700); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  background: var(--leather);
  color: #14202E;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.btn:hover { background: var(--leather-hi); }
.topbar nav a.btn { color: #14202E; }
.topbar nav a.btn:hover { background: var(--leather-hi); }
.btn.ghost {
  background: transparent;
  border-color: var(--leather);
  color: var(--chalk);
}
.btn.ghost:hover { background: var(--leather-dim); border-color: var(--leather-hi); }

:focus-visible { outline: 2px solid var(--leather); outline-offset: 3px; border-radius: 4px; }

/* ---------- the card, as the app draws it ---------- */
.card {
  background: var(--ink-700);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--ink-800);
  font-size: 12px;
  font-weight: 500;
  color: var(--chalk-2);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }

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

/* ---------- section head, with the app's orange rule ---------- */
.page-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.page-head::before {
  content: "";
  width: 3px;
  align-self: stretch;
  border-radius: 2px;
  background: var(--leather);
  flex: none;
}

/* ---------- segmented control ---------- */
.seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--ink-800);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
}
.seg button {
  flex: 1;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--chalk-2);
  background: transparent;
  border: 0;
  border-radius: var(--r-sm);
  padding: 7px 12px;
  cursor: pointer;
  white-space: nowrap;
}
.seg button:hover { color: var(--chalk); }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] {
  background: var(--ink-700);
  color: var(--chalk);
}
.seg.solid button[aria-pressed="true"], .seg.solid button[aria-selected="true"] {
  background: var(--leather);
  color: #14202E;
}

/* ---------- ranked rows, as on the app's Top Players card ---------- */
.rank { display: grid; gap: 14px; }
.rank-row { display: grid; gap: 7px; }
.rank-line {
  display: grid;
  grid-template-columns: 22px auto 1fr auto;
  gap: 10px;
  align-items: baseline;
  font-size: 14px;
}
.rank-line .pos { color: var(--chalk-2); font-weight: 600; font-size: 13px; }
.rank-line .pos.first {
  width: 20px; height: 20px;
  display: grid; place-items: center;
  background: var(--leather);
  color: #14202E;
  border-radius: 50%;
  font-size: 12px;
  align-self: center;
}
.rank-line .jersey { color: var(--leather); font-weight: 700; font-size: 13px; }
.rank-line .who { color: var(--chalk); }
.rank-line .val { font-weight: 700; }
.rank-line .val em { font-style: normal; color: var(--chalk-2); font-weight: 500; font-size: 12.5px; }
.rank-bar { height: 4px; border-radius: 2px; background: var(--ink-600); overflow: hidden; }
.rank-bar i { display: block; height: 100%; border-radius: 2px; background: var(--leather); }

/* ---------- stat tiles, as on the app's Metrics card ---------- */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px;
}
.tile {
  background: var(--ink-800);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: 10px 12px;
}
.tile span { display: block; font-size: 11.5px; color: var(--chalk-2); margin-bottom: 2px; }
.tile b { font-size: 21px; font-weight: 700; letter-spacing: -0.02em; }
.tile b.up { color: var(--good); }
.tile b.down { color: var(--bad); }
.tile b.neutral { color: var(--leather); }

/* ---------- comparison rows, as on Team vs Opponents ---------- */
.vs { display: grid; }
.vs-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--chalk-2);
  padding-bottom: 8px;
}
.vs-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--line-soft);
  font-size: 14px;
}
.vs-row b { font-size: 17px; font-weight: 700; }
.vs-row b:first-child { color: var(--good); }
.vs-row b:last-child { text-align: right; }
.vs-row span { color: var(--chalk-2); font-size: 13px; }

/* ---------- promo strip: the free period, wherever it needs saying ---------- */
.promo-strip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  padding: 9px 16px 9px 12px;
  border: 1px solid rgba(249, 148, 31, 0.45);
  background: var(--leather-dim);
  border-radius: var(--r-pill);
  text-decoration: none;
  max-width: 100%;
}
.promo-strip b { font-size: 19px; font-weight: 700; color: var(--leather); letter-spacing: -0.03em; }
.promo-strip span { font-size: 14px; font-weight: 500; color: var(--chalk); }
.promo-strip:hover { background: rgba(249, 148, 31, 0.22); }


/* ---------- footer ---------- */
footer.foot {
  position: relative;
  z-index: 2;
  border-top: 1px solid var(--line-soft);
  padding: 28px max(20px, 4vw);
  display: flex;
  align-items: center;
  gap: 16px 32px;
  flex-wrap: wrap;
  background: var(--ink-900);
}
footer.foot .mark { margin-right: auto; }
.foot-mail {
  font-size: 15px;
  font-weight: 600;
  color: var(--leather);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.foot-mail:hover { border-bottom-color: currentColor; }
.foot-sig { font-size: 12.5px; color: var(--chalk-2); }

@media (max-width: 620px) {
  footer.foot { flex-direction: column; align-items: flex-start; gap: 12px; }
  footer.foot .mark { margin-right: 0; }
}

/* ---------- language switcher ---------- */
.lang {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px 6px 12px;
  background: var(--ink-800);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-pill);
  color: var(--chalk-2);
  cursor: pointer;
}
.lang:hover { border-color: var(--line); color: var(--chalk); }
.lang .globe { flex: none; display: block; }
.lang select {
  appearance: none;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: inherit;
  background: transparent;
  border: 0;
  padding: 0 17px 0 0;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 5px) 54%, calc(100% - 1px) 54%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.lang select:focus-visible { outline: 2px solid var(--leather); outline-offset: 4px; }
.lang select option { background: var(--ink-700); color: var(--chalk); }

/* ---------- numbers that flick up where the ball lands ---------- */
#pops {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}
.pop {
  position: absolute;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--leather);
  text-shadow: 0 2px 12px rgba(8, 12, 22, 0.95);
  opacity: 0;
  animation: pop-rise 1.25s cubic-bezier(0.18, 0.75, 0.3, 1) forwards;
}
.pop u { text-decoration: none; font-weight: 500; font-size: 10px; color: var(--chalk-2); margin-left: 4px; }
@keyframes pop-rise {
  0%   { opacity: 0; transform: translate(-50%, -50%) translateY(8px) scale(0.82); }
  16%  { opacity: 1; transform: translate(-50%, -50%) translateY(-2px) scale(1); }
  70%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) translateY(-52px) scale(1); }
}
@media (prefers-reduced-motion: reduce) { #pops { display: none; } }

/* ---------- season block ---------- */
.season {
  margin-top: 22px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: 16px 18px;
  background: var(--ink-800);
}
.season-top { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.season-top b { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; }
.season-comps { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px; font-size: 12.5px; color: var(--chalk-2); }
.season-comps span { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.season-comps i { width: 6px; height: 6px; border-radius: 50%; background: var(--leather); align-self: center; }
.season-comps b { color: var(--chalk); font-weight: 700; }
.season-avgs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 14px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}
.season-avgs > div { display: grid; gap: 1px; }
.season-avgs b { font-size: 17px; font-weight: 700; line-height: 1.15; }
.season-avgs span { font-size: 11.5px; color: var(--chalk-2); }

@media (max-width: 900px) {
  footer.foot .cols { margin-left: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 24px; }
  .topbar { gap: 12px; height: 58px; }
  .topbar nav { gap: 4px; }
  .topbar nav a { padding: 6px 8px; font-size: 12.5px; }
  .mark b { font-size: 17px; letter-spacing: 0.07em; }
}
@media (max-width: 560px) {
  .topbar nav a.btn { display: none; }
  .mark b { font-size: 15px; }
}

/* Narrow phones: the nav now carries two named pages plus the language
   picker, so the wordmark drops to its ball and the row stops overflowing. */
@media (max-width: 480px) {
  .topbar { gap: 8px; padding-inline: 12px; }
}
