/* HB Metrics — pages de statistiques publiques
   En-tete aux couleurs de la charte, contenu sur fond clair pour la lecture des tables. */

:root {
  --petrol: #044E69;
  --petrol-dark: #002C40;
  --petrol-700: #013A53;
  --petrol-500: #006B96;
  --gold: #EFB702;
  --gold-ink: #8A6A00;
  --silver: #A8A7AC;
  --bronze: #C86A2A;
  --red: #C01818;

  --bg: #F3F6F8;
  --surface: #FFFFFF;
  --ink: #0C2733;
  --muted: #5B7380;
  --line: #E1E8EC;
  --row-hover: #F1F7FA;

  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --radius: 12px;
  --max: 1600px;
}

@font-face {
  font-family: "Barlow Semi Condensed";
  src: url("/assets/fonts/barlow-semicondensed-bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Barlow Semi Condensed";
  src: url("/assets/fonts/barlow-semicondensed-medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

a { color: var(--petrol-500); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 clamp(16px, 2.5vw, 40px); }


/* En-tete */

.top { background: var(--petrol-dark); color: #E2E8F0; position: sticky; top: 0; z-index: 20; }

.top-row { display: flex; align-items: center; gap: 28px; height: 76px; }

.brand { display: flex; align-items: center; gap: 12px; flex: none; }
.brand:hover { text-decoration: none; }
.brand img { width: 52px; height: 52px; }
.wordmark { display: flex; flex-direction: column; line-height: 1; font-family: "Barlow Semi Condensed", var(--font); }
.wm-name { color: var(--gold); font-weight: 700; font-size: 28px; letter-spacing: .04em; }
.wm-tag { margin-top: 4px; color: #FFF; font-weight: 500; font-size: 11.5px; letter-spacing: .2em; text-transform: uppercase; }

.search { position: relative; flex: 1; min-width: 0; max-width: 460px; }
.search svg { position: absolute; left: 12px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); fill: none; stroke: #9FB8C4; stroke-width: 2; }
.search input {
  width: 100%; height: 38px; padding: 0 12px 0 38px;
  border: 1px solid #0F4E6B; border-radius: 999px;
  background: var(--petrol-700); color: #FFF; font: inherit;
}
.search input::placeholder { color: #9FB8C4; }
.search input:focus { outline: none; border-color: var(--gold); }

#results {
  position: absolute; left: 0; right: 0; top: 44px; margin: 0; padding: 6px; list-style: none;
  background: var(--surface); color: var(--ink); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 20, 30, .25); max-height: 360px; overflow-y: auto;
}
#results a { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; border-radius: 6px; color: var(--ink); }
#results a:hover, #results a.on { background: var(--row-hover); text-decoration: none; }
#results small { color: var(--muted); }

.pro-link {
  margin-left: auto; padding: 7px 14px; border: 1.5px solid var(--gold); border-radius: 8px;
  color: var(--gold); font-weight: 700; font-size: 14px; white-space: nowrap;
}
.pro-link:hover { background: rgba(239, 183, 2, .12); text-decoration: none; }

.leagues { background: #04283A; border-bottom: 1px solid #0F4E6B; font-size: 13px; }
.leagues-row { display: flex; align-items: center; gap: 14px; height: 36px; overflow-x: auto; scrollbar-width: none; }
.leagues-label { color: #9FB8C4; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.league {
  display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 12px 0 4px;
  border-radius: 999px; color: #E2E8F0; font-weight: 600; white-space: nowrap;
}
.league img { background: #FFF; border-radius: 50%; padding: 1px; }
.league:hover { background: var(--petrol-700); text-decoration: none; }
.league[aria-current] { background: var(--gold); color: var(--petrol-dark); }
.leagues-soon { color: #6E8E9C; font-style: italic; white-space: nowrap; }
.season { margin-left: auto; display: flex; align-items: center; gap: 8px; color: #9FB8C4; white-space: nowrap; }
.season select {
  height: 26px; padding: 0 28px 0 10px; border: 1px solid #0F4E6B; border-radius: 6px;
  background: var(--petrol-700) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23EFB702' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 10px center;
  color: #FFF; font: inherit; font-weight: 600; appearance: none; cursor: pointer;
}
.season select:hover, .season select:focus { border-color: var(--gold); outline: none; }

.tabs { display: flex; align-items: center; gap: 4px; height: 46px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 12px 12px; color: #CBDDE6; font-weight: 600; font-size: 14px; white-space: nowrap; border-bottom: 3px solid transparent; }
.tabs a:hover { color: #FFF; text-decoration: none; }
.tabs a[aria-current="page"] { color: #FFF; border-bottom-color: var(--gold); }
.comp {
  display: flex; align-items: center; gap: 8px; margin-right: 10px; padding: 4px 12px 4px 6px;
  background: var(--petrol-700); border-radius: 999px; color: #FFF; font-weight: 700; font-size: 13px; white-space: nowrap;
}
.comp img { background: #FFF; border-radius: 50%; padding: 2px; }


/* Titres de page */

.intro, .page-h { padding: 32px 0 20px; }
.intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.eyebrow { margin: 0 0 6px; color: var(--petrol-500); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1 { margin: 0 0 6px; font-size: clamp(24px, 3.4vw, 34px); line-height: 1.15; letter-spacing: -.01em; }
h1 sup, h2 sup { font-size: .55em; }
.lede { margin: 0; color: var(--muted); }

.quick { display: flex; gap: 8px; flex-wrap: wrap; }
.quick a {
  padding: 8px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  color: var(--ink); font-weight: 600; font-size: 14px;
}
.quick a:hover { border-color: var(--petrol-500); text-decoration: none; }


/* Panneaux */

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 20px; }
.panel-h { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.panel-h h2 { margin: 0; font-size: 18px; }
.panel-h a { font-size: 14px; font-weight: 600; }

.home-grid { display: grid; grid-template-columns: minmax(340px, 420px) 1fr; gap: 20px; align-items: start; }
.home-grid .panel { margin-bottom: 0; min-width: 0; }
.home-grid + .panel { margin-top: 20px; }

.legend { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.lg { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: -8px; }
.lg.z-top { background: var(--gold); }
.lg.z-f4 { background: var(--petrol-500); }
.lg.z-low { background: var(--red); }


/* Tables */

.tbl-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
.tbl { width: 100%; border-collapse: collapse; white-space: nowrap; }
.tbl th {
  position: sticky; top: 0; background: var(--surface); text-align: left; padding: 8px 10px;
  border-bottom: 2px solid var(--ink); font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
}
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl tbody tr:hover td { background: var(--row-hover); }
.tbl .num { text-align: right; }
.tbl .strong { font-weight: 800; }
.tbl .rk { width: 36px; text-align: center; color: var(--muted); font-weight: 700; }
.tbl.compact td { padding: 6px 8px; }

.sortable th[data-sort] { cursor: pointer; user-select: none; }
.sortable th[data-sort]:hover { color: var(--ink); }
.sortable th[aria-sort] { color: var(--ink); }
.sortable th[aria-sort="descending"]::after { content: " ↓"; }
.sortable th[aria-sort="ascending"]::after { content: " ↑"; }
.sortable td.sorted { font-weight: 700; background: #FAFCFD; }

.tbl tr.z-top td.rk { box-shadow: inset 4px 0 var(--gold); color: var(--ink); }
.tbl tr.z-f4 td.rk { box-shadow: inset 4px 0 var(--petrol-500); color: var(--ink); }
.tbl tr.z-low td.rk { box-shadow: inset 4px 0 var(--red); }

.ranked tbody tr:nth-child(1) td.rk { color: var(--gold-ink); }

.team { display: inline-flex; align-items: center; gap: 8px; }
.club-logo { object-fit: contain; flex: none; }
.pn { font-weight: 600; }

@media (max-width: 760px) {
  .tbl .sticky { position: sticky; left: 0; background: var(--surface); z-index: 1; box-shadow: 1px 0 var(--line); }
  .tbl th.sticky { z-index: 2; }
}

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.filters input, .filters select {
  height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit;
}
.filters input { min-width: 220px; }
.count { color: var(--muted); font-size: 13px; margin-left: auto; }


/* Leaders */

.leaders { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(310px, 100%), 1fr)); gap: 14px; }
.card.leader { border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; }
.leader header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.leader h3 { margin: 0; font-size: 15px; }
.leader .sub { color: var(--muted); font-size: 12px; }
.leader ol { list-style: none; margin: 0 0 8px; padding: 0; }
.leader li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.leader li:last-child { border-bottom: 0; }
.leader li:first-child .pn { font-size: 15px; }
.pos {
  flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; color: var(--muted); background: var(--bg);
}
.pos.m-gold { background: var(--gold); color: var(--petrol-dark); }
.pos.m-silver { background: #D9D9DC; color: var(--petrol-dark); }
.pos.m-bronze { background: var(--bronze); color: #FFF; }
.who { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.who .pn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.who .pt { color: var(--muted); font-size: 12px; }
.val { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.val b { font-size: 17px; }
.val small { color: var(--muted); font-size: 11px; white-space: nowrap; }
.more { margin-top: auto; font-size: 13px; font-weight: 600; }


/* Equipe type */

.equipe-type { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(8, 1fr); gap: 10px; }
.equipe-type li {
  position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px;
  padding: 14px 8px 12px; border-radius: 10px;
  background: linear-gradient(180deg, var(--petrol) 0%, var(--petrol-dark) 100%); color: #FFF;
}
.equipe-type .club-logo { background: #FFF; border-radius: 50%; padding: 4px; margin-bottom: 6px; }
.et-pos { color: var(--gold); font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.et-name { font-weight: 700; font-size: 14px; line-height: 1.2; }
.et-team { color: #9FB8C4; font-size: 12px; }
.et-stat { margin-top: 6px; font-size: 12px; color: #E2E8F0; }
.badge {
  margin-top: 8px; padding: 2px 8px; border-radius: 999px; background: var(--gold); color: var(--petrol-dark);
  font-size: 10px; font-weight: 800; letter-spacing: .05em;
}


/* Pied */

.foot { margin-top: 28px; padding: 22px 0 36px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.foot-row { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }


/* Ecrans moyens et telephone */

@media (max-width: 1020px) {
  .home-grid { grid-template-columns: 1fr; }
  .equipe-type { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 640px) {
  .top-row { gap: 12px; }
  .wordmark { display: none; }
  .brand img { width: 40px; height: 40px; }
  .top-row { height: 60px; }
  .leagues-soon { display: none; }
  .pro-link { padding: 6px 10px; font-size: 13px; }
  .equipe-type { grid-template-columns: repeat(2, 1fr); }
  .panel { padding: 14px; border-radius: 10px; }
  .tbl-wrap { margin: 0 -14px; padding: 0 14px; }
  .filters input { min-width: 0; flex: 1; }
  .count { width: 100%; margin-left: 0; }
}

@media (max-width: 640px) {
  .tbl .team span { display: none; }
  .tbl .club-logo { width: 26px; height: 26px; }
}
