/* ============================================
   PITCH26 — SQUAD PAGE STYLES
   Version 5.0 | July 2026 — Dynamic Nation-Themed Edition
   Design System: "Floodlight Almanac" with nation flag colors
   Depends on: main.css design tokens + encyclopedia.css tokens
   ============================================ */

/* CHANGELOG — v5.1 Contrast Audit (July 2026)
   Fixed light-text-on-light-surface bugs where dark-theme tokens
   (--true-white, --ink-muted) had been reused inside the page's light
   "paper" surfaces (roster table, modal, formation player marker).
   See inline comments at each change for details. */

/* NOTE: Uses CSS color-mix() for dynamic nation color blending.
   Supported in all major browsers since 2023 (Chrome 111+, Firefox 113+, Safari 16.2+).
   If you need to support older browsers, the fallback values after each color-mix()
   expression will be used automatically by the CSS parser. */
/* ============================================
   NATION COLOR VARIABLES (set by squad.js)
   Fallbacks use the original FWC brand colors
   ============================================ */
:root {
  --nation-primary: #e61d25;
  --nation-secondary: #f5a623;
  /* ── paper-line: defined here so it's always available ── */
  /* (was referenced but never defined in v4.0) */
  --paper-line: rgba(0, 0, 0, 0.08);
  --paper-line-strong: rgba(0, 0, 0, 0.15);

  --font-display: "Anton", "Arial Narrow", sans-serif;
  --font-heading: "Space Grotesk", "Arial Narrow", sans-serif;
  --font-body: "Space Grotesk", Arial, Helvetica, sans-serif;
  --font-mono: "Space Mono", "Courier New", monospace;

  /* ============================================
     v7.0 — DYNAMIC-COLORING CONTRAST SAFETY NET
     ------------------------------------------
     squad.js sets --nation-primary/--nation-secondary straight from
     each nation's flag colors. That's fine when a color is only used
     as a decorative accent (a border, an underline, a dot) — but it
     breaks the moment one of those colors is white, or another very
     light shade, AND it's either (a) used directly as a text color,
     or (b) paired with a fixed white/dark text on top of it as a
     solid fill. Both produce invisible or near-invisible text. This
     happens for real: plenty of national teams carry white as their
     primary or secondary color.

     Two pairs of tokens fix this at the source instead of patching
     every individual usage:

     1) --nation-primary-safe / --nation-secondary-safe
        A forced-dark variant of each nation color, safe to use as
        TEXT sitting on a light/paper surface no matter how light the
        source color is. Built by capping brightness with color-mix()
        against black at a fixed ratio (40% nation color / 60% black)
        — comfortably clears WCAG AA (4.5:1) even in the worst case of
        a pure-white input, while barely affecting colors that were
        already dark. Pure color-mix(), so it needs no feature
        detection and works everywhere color-mix() does.

     2) --nation-on-primary / --nation-on-secondary
        The correct foreground (black or white) for TEXT sitting on
        top of a SOLID FILL of that nation color — e.g. a badge whose
        background is --nation-primary. Uses the native
        contrast-color() function (Baseline 2026 — Chrome, Edge,
        Firefox and Safari), which always returns whichever of black
        or white has the higher contrast against the color it's given.
        Browsers that don't support it simply fail to match the
        @supports block below, leaving these two tokens undefined —
        every usage site below supplies its own var() fallback (the
        original hardcoded --true-white / --fwc-dark-charcoal) so
        there's no breakage, just a loss of the extra safety margin on
        very old browsers. */
  --nation-primary-safe: color-mix(
    in srgb,
    var(--nation-primary, var(--fwc-red)) 40%,
    black 60%
  );
  --nation-secondary-safe: color-mix(
    in srgb,
    var(--nation-secondary, var(--fwc-amber)) 40%,
    black 60%
  );
}

@supports (color: contrast-color(red)) {
  :root {
    --nation-on-primary: contrast-color(var(--nation-primary, var(--fwc-red)));
    --nation-on-secondary: contrast-color(
      var(--nation-secondary, var(--fwc-amber))
    );
  }
}

/* ============================================
   BACK LINK
   ============================================ */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--font-size-small);
  color: var(--nation-secondary, var(--fwc-amber));
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  transition:
    background var(--transition-fast),
    color var(--transition-fast);
  margin-bottom: var(--space-lg);
}

.back-link:hover {
  background: color-mix(
    in srgb,
    var(--nation-primary, var(--fwc-red)) 8%,
    transparent
  );
  color: var(--nation-primary, var(--fwc-red));
}

/* ============================================
   SQUAD HEADER — Nation-themed hero
   ============================================ */
.squad-header {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--nation-primary, var(--ink-2)) 15%, var(--ink-2)) 0%,
    var(--ink-2) 50%,
    color-mix(in srgb, var(--nation-secondary, var(--ink-3)) 12%, var(--ink-3))
      100%
  );
  padding: var(--space-xxl) 0;
  border-bottom: 4px solid var(--nation-primary, var(--fwc-red));
  /* Removed the arbitrary margin-top: 50px — the main-nav height
     is handled by the --main-nav-height variable and the sticky nav.
     Use a consistent top offset matching the encyclopedia page. */
  margin-top: 0;
  color: var(--true-white);
  position: relative;
  overflow: hidden;
}

/* Blurred flag background — mirrors the encyclopedia hero technique */
.squad-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.08;
  filter: blur(40px) saturate(1.5);
  transform: scale(1.1);
  z-index: 0;
  pointer-events: none;
}

.squad-header > .container {
  position: relative;
  z-index: 1;
}

.squad-header-inner {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  flex-wrap: wrap;
  margin-bottom: var(--space-xl);
}

#squad-header-flag {
  width: 96px;
  height: 64px;
  border-radius: var(--radius-sm);
  border: 3px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  object-fit: cover;
  flex-shrink: 0;
}

.squad-title-group {
  flex: 1;
  min-width: 200px;
  /* Explicit left alignment: this element also carries the generic
     .section-title/.section-subtitle classes from main.css, which
     center text by default for the site's standard section headers.
     That's fine for centered headers elsewhere, but here it was
     pulling the title/subtitle away from the flag instead of sitting
     beside it. */
  text-align: left;
}

.squad-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.8rem, 3vw + 1rem, var(--font-size-display));
  color: var(--true-white);
  margin: 0 0 var(--space-xs) 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  text-align: left;
}

.squad-subtitle {
  font-size: var(--font-size-large);
  color: var(--ink-muted);
  margin: 0 0 var(--space-sm) 0;
  text-align: left;
}

/* ============================================
   DATA FRESHNESS BAR
   ------------------------------------------
   The HTML wrapper (.data-freshness-bar) had no rule
   here at all — only the badge inside it did — so this
   bar had no background of its own. Giving it an explicit
   dark surface guarantees the badge's translucent-white
   glass effect and white text are always readable, no
   matter what section ends up above or below it.
   ============================================ */
.data-freshness-bar {
  --freshness-primary: var(--nation-primary, #ef4360);
  --freshness-secondary: var(--nation-secondary, #f2b705);
  background: var(--ink-2);
  padding: var(--space-sm) 0;
  text-align: center;
  position: relative;
}

/* v3.6: Nation-colored gradient stripe at the top of the bar */
.data-freshness-bar::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--freshness-primary),
    var(--freshness-secondary),
    var(--freshness-primary)
  );
}

.data-freshness-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--true-white);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  letter-spacing: 0.04em;
}

/* v3.6: Small nation-colored dot before the text */
.data-freshness-badge::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--freshness-primary);
  box-shadow: 0 0 4px var(--freshness-secondary);
}

/* ============================================
   SQUAD STATS BAR — glassmorphism with nation tint
   ============================================ */
.squad-stats,
.squad-stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.squad-stat {
  background: color-mix(
    in srgb,
    var(--nation-primary, transparent) 5%,
    rgba(255, 255, 255, 0.06)
  );
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-top: 2px solid var(--nation-secondary, var(--fwc-amber));
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-sm);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.squad-stat-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--font-size-xxl);
  color: var(--true-white);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.squad-stat-label {
  font-size: 10px;
  color: var(--nation-secondary, var(--fwc-amber));
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-card {
  background: color-mix(
    in srgb,
    var(--nation-primary, transparent) 5%,
    rgba(255, 255, 255, 0.06)
  );
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-top: 2px solid var(--nation-secondary, var(--fwc-amber));
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-sm);
  text-align: center;
  transition:
    background var(--transition-fast),
    transform var(--transition-fast),
    border-color var(--transition-fast);
}

.stat-card:hover {
  background: color-mix(
    in srgb,
    var(--nation-primary, transparent) 12%,
    rgba(255, 255, 255, 0.12)
  );
  border-top-color: var(--nation-primary, var(--fwc-red));
  transform: translateY(-3px);
}

.stat-card .stat-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--font-size-xxl);
  color: var(--true-white);
  display: block;
  margin-bottom: 2px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.stat-card .stat-label {
  font-size: 10px;
  color: var(--nation-secondary, var(--fwc-amber));
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ============================================
   TOURNAMENT BADGE
   ============================================ */
.squad-tournament-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--nation-primary, var(--fwc-red));
  /* v7.0: was a hardcoded --true-white, invisible against a white
     --nation-primary. --nation-on-primary auto-picks black or white
     based on the actual fill color; the var() fallback preserves the
     original behavior on browsers without contrast-color(). */
  color: var(--nation-on-primary, var(--true-white));
  font-size: 12px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ============================================
   TOURNAMENT PERFORMANCE SECTION
   ============================================ */
.tournament-stats-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.tournament-matches-list {
  margin-top: var(--space-lg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  overflow: hidden;
}

/* ============================================
   POSITION GROUP ANALYSIS
   ============================================ */
.position-analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-lg);
}

/* ============================================
   KEY PLAYER SPOTLIGHT
   ------------------------------------------
   v6.1: Switched from `repeat(auto-fit, minmax(280px, 1fr))` to an
   explicit 3-column grid.

   Why: auto-fit doesn't have a concept of "how many columns is too
   many" — it just packs in as many 280px-or-wider tracks as the
   container allows. On a typical ~1200-1300px content width that
   works out to 4 columns, leaving each card only ~280-300px wide.
   That's not enough room for a player's name (which can run to two
   words plus a diacritic or two), their role badge, AND the 3-stat
   row without things clipping or wrapping awkwardly — which is
   exactly the "cramped text" symptom this fixes.

   Hardcoding 3 columns guarantees each card gets roughly a third of
   the row (minus gaps) regardless of viewport width, so the name and
   role badge consistently have enough breathing room. Responsive
   step-down to 2 and then 1 column is handled in the breakpoints
   below rather than left to auto-fit's judgment. */
.key-spotlight-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

@media (max-width: 1023px) {
  .key-spotlight-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .key-spotlight-grid {
    grid-template-columns: 1fr;
  }
}

/* v6.0: Restructured card layout.
   ------------------------------------------
   The role badge ("Set-Piece Specialist", "False Nine", etc.) used to
   be `position: absolute; top/right` sitting directly on top of the
   header row. That worked for a short one- or two-word role, but any
   longer label would clip against the card edge or physically
   overlap the player's name and avatar — the "cluttered" look flagged
   for revamp.

   Fix: the badge is now a normal-flow element, visually moved above
   the header using flexbox `order` (no HTML changes needed since it's
   already a sibling of .spotlight-header inside the flex column). As
   flow content it can wrap onto a second line and simply pushes the
   rest of the card down instead of colliding with anything. */
.key-spotlight-card {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.02) 0%,
    rgba(255, 255, 255, 0.05) 100%
  );
  border: 1px solid var(--ink-line, rgba(255, 255, 255, 0.08));
  border-left: 3px solid var(--nation-primary, var(--fwc-red));
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  transition:
    transform var(--transition-fast),
    border-left-color var(--transition-fast);
}

.key-spotlight-card:hover {
  transform: translateY(-4px);
  border-left-color: var(--nation-secondary, var(--fwc-amber));
}

/* Role banner — order: -1 pulls it to the top of the card visually
   (DOM order is untouched), align-self keeps it hugging the right
   edge like before, and the wrap/break rules let a long label take a
   second line instead of overflowing or sitting on top of other
   content. */
.spotlight-role-badge {
  order: -1;
  align-self: flex-end;
  display: inline-block;
  max-width: 100%;
  background: linear-gradient(
    100deg,
    var(--nation-primary, var(--fwc-red)),
    color-mix(
      in srgb,
      var(--nation-primary, var(--fwc-red)) 65%,
      var(--nation-secondary, var(--fwc-amber)) 35%
    )
  );
  /* v7.0: was a hardcoded true-white — invisible when a nation's
     primary color is white or another very light shade, which is
     exactly the "banner in the key player card" contrast bug this
     fixes. --nation-on-primary is a good match here since the
     gradient is primary-dominant (65% primary in the mix). */
  color: var(--nation-on-primary, var(--true-white, #fff));
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.45rem 1.2rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.4;
  text-align: center;
  white-space: normal;
  overflow-wrap: break-word;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.spotlight-header {
  display: flex;
  align-items: center;
  gap: 14px;
  /* min-width: 0 is required on flex children for line-clamp to
     actually kick in instead of forcing the row wider */
  min-width: 0;
}

.spotlight-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid var(--nation-secondary, var(--fwc-amber));
  object-fit: cover;
  flex-shrink: 0;
}

.spotlight-player-meta {
  flex-grow: 1;
  min-width: 0;
}

.spotlight-name {
  margin: 0;
  font-family: var(--font-heading);
  color: var(--true-white, #fff);
  font-size: 17px;
  text-transform: uppercase;
  /* v6.0: a long name now wraps to a second line instead of being
     force-truncated with an ellipsis — with the badge no longer
     floating on top of this row, there's room for it to breathe. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.25;
}

.spotlight-position {
  font-size: 11px;
  color: var(--nation-secondary, var(--fwc-amber));
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.spotlight-reason {
  font-size: 13px;
  color: var(--ink-muted, #9aa3c4);
  margin: 0;
  line-height: 1.5;
  flex-grow: 1;
  font-style: italic;
  /* v6.0: cap long spotlight copy at 3 lines so cards in the same
     row stay roughly the same height instead of stretching unevenly
     when one player's write-up runs much longer than another's. */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.spotlight-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  text-align: center;
}

.spotlight-stat {
  padding: 10px 4px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
}

.spotlight-stat-value {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--true-white, #fff);
}

.spotlight-stat--rating .spotlight-stat-value {
  color: var(--nation-secondary, var(--fwc-amber));
}

.spotlight-stat-label {
  font-size: 9px;
  color: var(--ink-muted, #9aa3c4);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.spotlight-link {
  color: var(--nation-primary, var(--fwc-red));
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  align-self: flex-end;
  transition: color var(--transition-fast);
}

.spotlight-link:hover {
  color: var(--nation-secondary, var(--fwc-amber));
}

/* ============================================
   TOP PERFORMERS (v3.6 — replaces Formation Selector)
   ============================================ */
.top-performers-section {
  /* v5.2: This section had no background of its own, so it fell
     through to the page's default surface — noticeably lighter than
     the dark --ink-2 surface used by squad-header, the freshness bar,
     and every other .section--ink sibling. Setting it explicitly here
     (rather than relying on a `section--ink` class in the HTML) keeps
     it dark and consistent no matter what markup wraps it. */
  background: var(--ink-2);
  padding: var(--space-xxl) 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.top-performers-section .section-header {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.top-performers-grid {
  display: grid;
  /* minmax(0,1fr): a bare 1fr track still expands to the item's
     min-content (the card is ~420px), overflowing narrow phones */
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-md);
  max-width: 700px;
  margin: 0 auto;
}

.performer-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  background: color-mix(
    in srgb,
    var(--nation-primary, transparent) 5%,
    rgba(255, 255, 255, 0.04)
  );
  border: 1px solid var(--ink-line, rgba(255, 255, 255, 0.08));
  border-left: 3px solid var(--nation-primary, var(--fwc-red));
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  transition:
    transform var(--transition-fast),
    border-color var(--transition-fast);
}

.performer-card:hover {
  transform: translateX(4px);
  border-left-color: var(--nation-secondary, var(--fwc-amber));
}

.performer-rank {
  font-family: var(--font-display);
  font-size: var(--font-size-xxl);
  font-weight: 400;
  color: var(--nation-primary, var(--fwc-red));
  min-width: 32px;
  text-align: center;
  opacity: 0.8;
}

.performer-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--nation-secondary, var(--fwc-amber));
  object-fit: cover;
  flex-shrink: 0;
}

.performer-info {
  flex-grow: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.performer-name {
  margin: 0;
  font-family: var(--font-heading);
  font-size: var(--font-size-body);
  font-weight: 700;
  color: var(--true-white, #fff);
}

.performer-pos {
  font-size: 11px;
  color: var(--nation-secondary, var(--fwc-amber));
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.performer-rating {
  font-family: var(--font-mono);
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--nation-secondary, var(--fwc-amber));
  min-width: 48px;
  text-align: right;
}

.performer-meta {
  font-size: 11px;
  color: var(--ink-muted, #9aa3c4);
  white-space: nowrap;
}

@media (max-width: 480px) {
  .performer-card {
    flex-wrap: wrap;
    padding: var(--space-md);
    gap: var(--space-sm) var(--space-md);
  }
  .performer-rank {
    min-width: 24px;
    font-size: var(--font-size-xl);
    align-self: center;
  }
  .performer-avatar {
    width: 40px;
    height: 40px;
  }
  .performer-info {
    flex: 1 1 calc(100% - 120px);
  }
  .performer-meta {
    white-space: normal;
    flex-basis: 100%;
    order: 5;
    text-align: right;
  }
  .performer-rating {
    margin-left: auto;
    font-size: var(--font-size-lg);
    min-width: 40px;
  }
}

/* ============================================
   SQUAD COMPOSITION (v3.6 — replaces Position Group Analysis)
   ============================================ */
.squad-composition-section {
  padding: var(--space-xxl) 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.squad-composition-section .section-header {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.composition-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
  max-width: 800px;
  margin: 0 auto;
}

.composition-card {
  background: color-mix(
    in srgb,
    var(--nation-primary, transparent) 4%,
    rgba(255, 255, 255, 0.03)
  );
  border: 1px solid var(--ink-line, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-md);
  padding: var(--space-lg);
}

.composition-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--font-size-small);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--nation-secondary, var(--fwc-amber));
  margin: 0 0 var(--space-md) 0;
}

.position-bars {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.pos-bar-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.pos-bar-label {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--font-size-small);
  color: var(--ink-text, #eef1fb);
  min-width: 36px;
}

.pos-bar-track {
  flex-grow: 1;
  height: 10px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 5px;
  overflow: hidden;
}

.pos-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.6s ease-out;
}

.pos-gk-fill {
  background: var(--nation-primary, var(--fwc-red));
}
.pos-def-fill {
  background: var(--nation-secondary, var(--fwc-amber));
}
.pos-mid-fill {
  background: color-mix(
    in srgb,
    var(--nation-primary, var(--fwc-red)) 60%,
    var(--nation-secondary, var(--fwc-amber)) 40%
  );
}
.pos-fwd-fill {
  background: var(--fwc-green, #2bcf9c);
}

.pos-bar-count {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--font-size-body);
  color: var(--true-white, #fff);
  min-width: 24px;
  text-align: right;
}

.age-brackets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-sm);
}

.age-bracket {
  text-align: center;
  padding: var(--space-sm);
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  border-top: 2px solid var(--nation-primary, var(--fwc-red));
}

.age-bracket-count {
  font-family: var(--font-display);
  font-size: var(--font-size-xl);
  font-weight: 400;
  color: var(--true-white, #fff);
  line-height: 1.2;
}

.age-bracket-label {
  font-size: 10px;
  color: var(--ink-muted, #9aa3c4);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

@media (max-width: 767px) {
  .composition-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   FORMATION SELECTOR
   ============================================ */
.formation-selector {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: var(--space-xl);
}

.formation-btn {
  padding: 6px 16px;
  font-family: var(--font-heading);
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.formation-btn.active {
  background: var(--nation-primary, var(--fwc-red));
  border-color: var(--nation-primary, var(--fwc-red));
  /* v7.0: was hardcoded true-white; see the --nation-on-primary note
     on .squad-tournament-badge above for why. */
  color: var(--nation-on-primary, var(--true-white));
}

/* ============================================
   FORMATION SECTION
   ============================================ */
.formation-section {
  background: linear-gradient(
    180deg,
    var(--ink-2) 0%,
    color-mix(in srgb, var(--nation-primary, var(--ink-3)) 8%, var(--ink-3))
      100%
  );
  padding: var(--space-xxl) 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.formation-section .section-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--font-size-xxl);
  color: var(--true-white);
  text-align: center;
  margin-bottom: var(--space-xl);
  text-transform: uppercase;
}

.formation-section .section-title::after {
  content: "";
  display: block;
  width: 60px;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--nation-primary, var(--fwc-red)),
    var(--nation-secondary, var(--fwc-amber))
  );
  margin: var(--space-sm) auto 0 auto;
}

.formation-container {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.formation-pitch-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.pitch-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.formation-players {
  position: relative;
  width: 100%;
  padding-top: 64.7%;
  pointer-events: none;
  z-index: 1;
}

.formation-player {
  position: absolute;
  width: 56px;
  height: 56px;
  background: var(--true-white);
  border: 3px solid var(--nation-secondary, var(--fwc-amber));
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: pointer;
  transition: all var(--transition-base);
  min-width: 48px;
  min-height: 48px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.formation-player:hover,
.formation-player:focus {
  background: var(--nation-primary, var(--fwc-red));
  border-color: var(--true-white);
  /* v7.0: was hardcoded true-white, invisible if --nation-primary
     itself resolves to white (the marker background right above). */
  color: var(--nation-on-primary, var(--true-white));
  transform: translate(-50%, -50%) scale(1.15);
  outline: 3px solid var(--true-white);
  z-index: 10;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.formation-player-number {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 14px;
  /* v7.0: this is nation-primary used as TEXT on the marker's fixed
     --true-white background (see .formation-player above) — a
     different failure mode than a badge fill: if --nation-primary is
     white too, the number vanished into the white circle entirely.
     --nation-primary-safe forces a floor on darkness so it's always
     readable against white, regardless of the source color. */
  color: var(--nation-primary-safe, var(--nation-primary, var(--fwc-blue)));
  line-height: 1;
}

.formation-player:hover .formation-player-number,
.formation-player:focus .formation-player-number {
  /* Marker background flips to --nation-primary on hover/focus, so
     this now needs the "text on a solid nation-color fill" token
     instead of the "text on white" one above. */
  color: var(--nation-on-primary, var(--true-white));
}

.formation-player-name {
  font-size: 8px;
  font-weight: 700;
  /* was var(--true-white) sitting on the true-white marker background
     directly above (line ~395) — text and surface were the same color,
     rendering the name invisible. Swapped to the dedicated dark-text
     token so it reads clearly against the white circle. */
  color: var(--fwc-dark-charcoal, var(--ink-3));
  text-shadow: none;
  text-align: center;
  max-width: 52px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.formation-player:hover .formation-player-name,
.formation-player:focus .formation-player-name {
  color: var(--nation-on-primary, var(--true-white));
  text-shadow: none;
}

/* ============================================
   ROSTER SECTION
   ============================================ */
.roster-section {
  background: var(--ink-2);
  padding: var(--space-xxl) 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.roster-section .section-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--font-size-xxl);
  color: var(--ink-text);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-heading);
  position: relative;
  display: inline-block;
  padding-bottom: var(--space-md);
  margin-bottom: var(--space-xl);
}

.roster-section .section-title::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 48px;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--nation-primary, var(--fwc-red)),
    var(--nation-secondary, var(--fwc-amber))
  );
  border-radius: 2px;
}

/* ============================================
   POSITION FILTER BUTTONS
   ============================================ */
.roster-filters {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
}

.filter-btn {
  min-width: 100px;
  min-height: 44px;
  padding: var(--space-sm) var(--space-xl);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--font-size-body);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--ink-3);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  color: var(--ink-muted);
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
}

.filter-btn:hover {
  border-color: var(--nation-secondary, var(--fwc-amber));
  color: var(--nation-secondary, var(--fwc-amber));
  transform: translateY(-2px);
}

.filter-btn.active {
  background: var(--nation-secondary, var(--fwc-amber));
  border-color: var(--nation-secondary, var(--fwc-amber));
  /* v7.0: dark text already reads fine against most nation secondary
     colors, but swapping to --nation-on-secondary keeps this
     consistent with every other nation-color-fill badge and also
     covers the rarer case of an unusually dark secondary color. */
  color: var(--nation-on-secondary, var(--fwc-dark-charcoal, var(--ink)));
  box-shadow: 0 4px 12px
    color-mix(
      in srgb,
      var(--nation-secondary, var(--fwc-amber)) 30%,
      transparent
    );
}

.filter-btn:focus {
  outline: 3px solid var(--nation-secondary, var(--fwc-amber));
  outline-offset: 2px;
}

/* ============================================
   ROSTER TABLE — Light "paper" surface with dark text
   The table uses --paper (light) intentionally for contrast
   ============================================ */
.roster-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 2px solid var(--paper-line);
  border-radius: var(--radius-md);
  position: relative;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.roster-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--paper);
}

.roster-table thead {
  background: linear-gradient(135deg, var(--ink-3) 0%, var(--ink) 100%);
  color: var(--true-white);
  position: sticky;
  top: 0;
  z-index: 5;
}

.roster-table th {
  padding: 16px 12px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  min-height: 48px;
  color: var(--true-white);
  transition: background var(--transition-fast);
}

.roster-table th[data-sort]:hover {
  background: color-mix(
    in srgb,
    var(--nation-primary, rgba(255, 255, 255, 0.1)) 15%,
    rgba(255, 255, 255, 0.1)
  );
}

.roster-table th.sort-asc::after {
  content: " ↑";
}
.roster-table th.sort-desc::after {
  content: " ↓";
}

.roster-table td {
  padding: 12px;
  border-bottom: 1px solid var(--paper-line);
  /* Standardized on fwc-dark-charcoal (falls back to ink-3) so body text
     on this --paper surface uses a token whose job is explicitly
     "dark text on light background," rather than reusing ink-3, which
     is primarily a dark *surface* color elsewhere in this file. */
  color: var(--fwc-dark-charcoal, var(--ink-3));
  vertical-align: middle;
  white-space: nowrap;
}

.roster-table tbody tr {
  transition: background var(--transition-fast);
  background: var(--paper);
}

.roster-table tbody tr:hover {
  background: color-mix(
    in srgb,
    var(--nation-primary, rgba(11, 15, 30, 0.05)) 8%,
    var(--paper)
  );
  cursor: pointer;
}

.roster-table tbody tr:focus {
  /* v7.0: an outline needs to contrast against the --paper row it
     sits on, same as text would — --nation-secondary-safe keeps this
     visible even for a white/near-white secondary color. */
  outline: 3px solid
    var(--nation-secondary-safe, var(--nation-secondary, var(--fwc-amber)));
  background: color-mix(
    in srgb,
    var(--nation-primary, rgba(11, 15, 30, 0.08)) 10%,
    var(--paper)
  );
}

.roster-table tbody tr:nth-child(even) {
  background: color-mix(
    in srgb,
    var(--nation-primary, transparent) 2%,
    rgba(0, 0, 0, 0.02)
  );
}

.roster-table tbody tr:nth-child(even):hover {
  background: color-mix(
    in srgb,
    var(--nation-primary, rgba(11, 15, 30, 0.06)) 8%,
    rgba(0, 0, 0, 0.03)
  );
}

.roster-loading {
  text-align: center;
  padding: 48px;
  color: var(--ink-muted);
  font-family: var(--font-heading);
  font-size: var(--font-size-large);
}

/* Pinned first column */
.col-sticky {
  position: sticky;
  left: 0;
  background: var(--paper);
  z-index: 3;
  box-shadow: 2px 0 6px rgba(0, 0, 0, 0.12);
}

.roster-table thead .col-sticky {
  background: var(--ink-3);
  color: var(--true-white);
  z-index: 6;
}

.roster-table tbody tr:nth-child(even) .col-sticky {
  background: #f1ebd8;
}

.roster-table tbody tr:hover .col-sticky {
  background: #e6dec1;
}

/* Player cell styling */
.player-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
}

.player-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--paper-line);
  flex-shrink: 0;
  background: var(--paper-line);
}

.player-cell-info {
  display: flex;
  flex-direction: column;
}

.player-cell-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 13px;
  color: var(--fwc-dark-charcoal, var(--ink-3));
}

.player-cell-number {
  font-family: var(--font-mono);
  font-size: 11px;
  /* was var(--ink-muted) — that token is a light color designed for
     text on dark "ink" surfaces. This label sits inside the roster
     table row, which is explicitly a --paper (light) surface, so the
     light-on-light combination was washing the number out. Using the
     dark text token at reduced opacity keeps the "muted/secondary"
     intent while staying readable. */
  color: var(--fwc-dark-charcoal, var(--ink-3));
  opacity: 0.65;
}

/* ============================================
   POSITION BADGES — use nation primary as GK accent
   ============================================ */
.position-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
}

.pos-GK {
  background: var(--nation-primary, var(--fwc-red));
  /* v7.0: was hardcoded true-white — this is the exact "certain
     positions in the squad table" bug: a nation with white as its
     primary color rendered a white GK badge with invisible white
     text. --nation-on-primary picks black or white automatically
     based on the actual fill. */
  color: var(--nation-on-primary, var(--true-white));
}
.pos-DEF {
  /* fwc-sky reads as a pale, near-white blue — too close in lightness to
     the --paper table background it sits on, so any lighter accents
     (hover glows, mixed borders) risked washing the badge out. Swapped
     to fwc-blue, a deeper, more saturated blue that holds contrast
     reliably against both the paper table and white text. */
  background: var(--fwc-blue);
  color: var(--true-white);
}
.pos-MID {
  background: var(--fwc-green);
  color: var(--fwc-dark-charcoal, var(--ink));
}
.pos-FWD {
  background: var(--nation-secondary, var(--fwc-amber));
  /* v7.0: dark text already reads fine against most light fills, but
     using --nation-on-secondary here too keeps this badge consistent
     with .pos-GK and covers the edge case of an unusually dark
     secondary color, where the old fixed dark-charcoal text could
     itself run into low contrast. */
  color: var(--nation-on-secondary, var(--fwc-dark-charcoal, var(--ink)));
}

/* ============================================
   PLAYER DETAIL MODAL
   ============================================ */
#player-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(11, 15, 30, 0.8);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: var(--z-modal);
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

#player-modal.open {
  display: flex;
  animation: fadeIn 200ms ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content-inner {
  background: var(--paper);
  border: 1px solid var(--paper-line);
  border-top: 4px solid var(--nation-primary, var(--fwc-red));
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  max-width: 540px;
  width: 100%;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
  animation: slideUp 300ms ease;
  color: var(--fwc-dark-charcoal, var(--ink-3));
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  width: 44px;
  height: 44px;
  background: var(--paper-line);
  border: none;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast);
  z-index: 10;
  color: var(--fwc-dark-charcoal, var(--ink-3));
}

.modal-close:hover {
  background: var(--nation-primary, var(--fwc-red));
  color: var(--nation-on-primary, var(--true-white));
  transform: rotate(90deg);
}

.modal-player-header {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-lg);
  border-bottom: 2px solid var(--paper-line);
}

.modal-player-photo {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--nation-primary, var(--ink-3));
  flex-shrink: 0;
  background: var(--paper-line);
}

.modal-player-meta {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.modal-player-number {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--font-size-xxl);
  /* fwc-amber's default value (#f5a623) against the --paper modal
     background computes to roughly 2.1:1 contrast — well under the
     3:1 minimum for large text, let alone 4.5:1 for body text. Mixing
     it toward the dark-charcoal text token keeps the amber "jersey
     number" brand feel while pulling the luminance down enough to
     actually read. */
  color: color-mix(
    in srgb,
    var(--nation-secondary, var(--fwc-amber)) 65%,
    var(--fwc-dark-charcoal, var(--ink-3)) 35%
  );
}

.modal-player-name {
  font-family: var(--font-display);
  font-weight: bold;
  font-size: var(--font-size-xl);
  /* v7.0: this is the "player names on the modal card" contrast bug —
     --nation-primary was used directly as a text color on the light
     --paper modal surface. For most nations that's a saturated,
     readable brand color, but for any nation whose primary color is
     white (or another very light shade) the name effectively
     disappeared into the card background. --nation-primary-safe
     forces a floor on darkness via color-mix() so the name always
     clears WCAG AA against a light surface, while still carrying that
     nation's color identity for every non-white case exactly as
     before. */
  color: var(
    --nation-primary-safe,
    var(--nation-primary, var(--fwc-red))
  ) !important;
  margin: 0;
  text-transform: uppercase;
}

.modal-player-badges {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-top: var(--space-xs);
}

.modal-player-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

.modal-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--space-md);
  background: var(--ink-2);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--nation-secondary, var(--fwc-amber));
  transition: border-color var(--transition-fast);
}

.modal-stat:hover {
  border-left-color: var(--nation-primary, var(--fwc-red));
}

.modal-stat-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
}

.modal-stat-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--font-size-large);
  color: var(--true-white);
}

.modal-view-profile {
  margin-top: var(--space-lg);
  text-align: center;
}

.modal-view-profile a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md) var(--space-xl);
  /* Button is built from BOTH nation colors instead of one fixed color:
     primary as the fill, secondary as the text + border. That border
     is what keeps the button legible even when a nation's primary and
     secondary happen to sit close together on the color wheel — it
     always draws a visible edge around the fill. Hover simply swaps
     which of the two colors is the fill and which is the text/border,
     rather than mixing in an unrelated fixed color. */
  /* v7.0: this button's fill AND text were both raw nation colors —
     the riskiest possible pairing, since a nation whose primary and
     secondary are both white/near-white made the button text (and
     even its border) disappear entirely. Text now goes through
     --nation-on-primary so it's always black or white, whichever
     actually contrasts against the fill beneath it. */
  background: var(--nation-primary, var(--fwc-red));
  color: var(--nation-on-primary, var(--nation-secondary, var(--true-white)));
  border: 2px solid var(--nation-secondary, var(--fwc-amber));
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--font-size-body);
  text-decoration: none;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    border-color var(--transition-fast),
    transform var(--transition-fast);
}

.modal-view-profile a:hover {
  background: var(--nation-secondary, var(--fwc-amber));
  color: var(--nation-on-secondary, var(--nation-primary, var(--fwc-red)));
  border-color: var(--nation-primary, var(--fwc-red));
  transform: translateY(-2px);
}

/* ============================================
   CARD GRID (fallback player-card)
   ============================================ */
.roster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-lg);
}

.player-card {
  background: var(--ink-3);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top: 3px solid var(--nation-primary, transparent);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  transition:
    border-color var(--transition-base),
    transform var(--transition-base),
    box-shadow var(--transition-base);
  cursor: pointer;
  color: var(--ink-text);
}

.player-card:hover {
  border-top-color: var(--nation-secondary, var(--fwc-amber));
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.player-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.player-card-number {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--font-size-xl);
  color: var(--nation-secondary, var(--fwc-amber));
  min-width: 36px;
}

.player-card-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--font-size-body);
  color: var(--true-white);
  flex: 1;
}

.player-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.player-stat {
  text-align: center;
}

.player-stat-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--font-size-large);
  color: var(--nation-secondary, var(--fwc-amber));
  display: block;
}

.player-stat-label {
  font-size: var(--font-size-small);
  color: var(--ink-muted);
}

.player-card-club {
  font-size: var(--font-size-small);
  color: var(--ink-muted);
  margin-top: var(--space-sm);
  opacity: 0.8;
}

/* ============================================
   SURFACE UTILITY CLASS — .section--ink
   ------------------------------------------
   squad-header, formation-section, and roster-section
   each hard-coded their own dark background. The three
   sections below (tournament, position-analysis,
   key-spotlight) were left with NO background rule at
   all, so they fell back to the page's default surface —
   while their headings still used ink-text/true-white,
   tokens meant for a dark surface. Depending on what the
   default section background resolves to in main.css,
   that's either invisible text-on-text, or at minimum an
   inconsistent look next to their dark siblings.

   Fix: give all three an explicit, shared dark surface
   class instead of relying on inheritance. Apply
   `section--ink` to a section in the HTML and its header
   text is guaranteed readable regardless of what main.css
   does elsewhere. See squad.html for where this class was
   added.
   ============================================ */
.section--ink {
  background: var(--ink-2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--ink-text);
}

.section--ink .eyebrow {
  color: var(--nation-primary, var(--fwc-red));
}

.section--ink .section-title {
  color: var(--true-white);
}

/* ============================================
   SECTION HEADERS (consistent with encyclopedia)
   ============================================ */
.squad-tournament-section .section-header,
.top-performers-section .section-header,
.squad-composition-section .section-header,
.key-spotlight-section .section-header {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.squad-tournament-section .eyebrow,
.top-performers-section .eyebrow,
.squad-composition-section .eyebrow,
.key-spotlight-section .eyebrow {
  display: block;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: var(--font-size-small);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--nation-primary, var(--fwc-red));
  margin-bottom: var(--space-sm);
}

.squad-tournament-section .section-title,
.top-performers-section .section-title,
.squad-composition-section .section-title,
.key-spotlight-section .section-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--font-size-xxl);
  /* was var(--ink-text) with no dark background under it — fixed by
     pairing this rule with the new .section--ink class in the HTML,
     and switching to --true-white to match the same treatment
     formation-section already uses correctly below. */
  color: var(--true-white);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-heading);
  position: relative;
  display: inline-block;
  padding-bottom: var(--space-md);
}

.squad-tournament-section .section-title::after,
.top-performers-section .section-title::after,
.squad-composition-section .section-title::after,
.key-spotlight-section .section-title::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 48px;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--nation-primary, var(--fwc-red)),
    var(--nation-secondary, var(--fwc-amber))
  );
  border-radius: 2px;
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */
@media (max-width: 1279px) {
  .squad-stats {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 1023px) {
  .squad-stats {
    grid-template-columns: repeat(3, 1fr);
  }
  .roster-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
  .squad-header-inner {
    gap: var(--space-lg);
  }
}

@media (max-width: 767px) {
  .squad-header {
    padding: var(--space-xl) var(--space-md);
    margin-top: 0;
  }
  .squad-header-inner {
    flex-direction: column;
    text-align: center;
    align-items: center;
  }
  #squad-header-flag {
    width: 72px;
    height: 48px;
  }
  .squad-title-group {
    text-align: center;
  }
  .squad-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .formation-container {
    max-width: 100%;
  }
  .formation-player {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }
  .formation-player-name {
    display: none;
  }
  .roster-filters {
    gap: var(--space-sm);
  }
  .filter-btn {
    min-width: 64px;
    font-size: 12px;
    padding: var(--space-sm) var(--space-md);
  }
  .roster-table {
    font-size: 12px;
    min-width: 640px;
  }
  .player-cell {
    min-width: 140px;
  }
  .player-avatar {
    width: 32px;
    height: 32px;
  }
  .modal-player-stats {
    grid-template-columns: 1fr;
  }
  .modal-content-inner {
    padding: var(--space-lg);
  }
  .modal-player-header {
    flex-direction: column;
    text-align: center;
  }
  .roster-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 375px) {
  .squad-stats {
    grid-template-columns: 1fr;
  }
  .player-card-stats {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
}

/* ============================================
   DATA DISCLAIMER — at bottom of squad page
   ============================================ */
.data-disclaimer {
  max-width: 100%;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-lg) var(--space-xl);
  /* v3.6: Dark base ensures text readability regardless of nation colors */
  background: var(--ink-2);
  border-top: 3px solid var(--nation-primary, var(--fwc-red));
  border-bottom: 1px solid var(--ink-line, rgba(255, 255, 255, 0.08));
}

.data-disclaimer p {
  font-size: var(--font-size-body);
  font-weight: 600;
  color: var(--ink-text, #eef1fb);
  line-height: 1.6;
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
}

/* v3.6: Nation-colored accent icon before the disclaimer text */
.data-disclaimer p::before {
  content: "ℹ";
  display: inline-block;
  margin-right: 6px;
  color: var(--nation-secondary, var(--fwc-amber));
  font-weight: 700;
}

/* ============================================
   DETAILED POSITION BADGE — in roster table
   Shows specific position (RB, CDM, LW, etc.)
   while keeping the filter category color
   ============================================ */
.roster-table .position-badge {
  min-width: 42px;
  text-align: center;
}

/* ============================================
   WIKIPEDIA IMAGE FALLBACK STYLING
   ============================================ */
.player-avatar {
  background-color: var(--ink-3);
}

.modal-player-photo {
  background-color: var(--ink-3);
}
