/* ===========================================================
   Ligue Croissant — design tokens
   =========================================================== */
:root {
  --navy: #000563;
  --blue: #0030B1;
  --gold: #D8B260;
  --gold-light: #EAE4C5;
  --red: #E60028;
  --green: #2C9B4B;
  --cream: #FFFCF5;
  --paper: #FFFFFF;
  --ink: #12163A;
  --ink-soft: #55597c;
  --line: #E4DFCB;

  --font-display: "Cinzel", serif;
  --font-body: "Inter", -apple-system, sans-serif;

  --radius: 10px;
  --shadow: 0 2px 14px rgba(0, 5, 99, 0.07);
  --container: 1120px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.wrap {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

h1, h2, h3 { font-family: var(--font-display); color: var(--navy); margin: 0 0 .4em; font-weight: 600; }
h1 { font-size: clamp(1.9rem, 3vw, 2.6rem); }
h2 { font-size: clamp(1.4rem, 2.4vw, 1.9rem); }
h3 { font-size: 1.15rem; }

.eyebrow {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: .72rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--gold);
  display: inline-block;
  margin-bottom: .5em;
}

.muted { color: var(--ink-soft); }

/* ---------- Header / nav ---------- */
.site-header {
  background: var(--navy);
  border-bottom: 3px solid var(--gold);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-top: 12px;
  padding-bottom: 12px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { height: 46px; width: auto; }
.brand-text {
  font-family: var(--font-display);
  color: var(--gold-light);
  font-size: 1.1rem;
  letter-spacing: .04em;
  line-height: 1.1;
}
.brand-text b { color: var(--gold); display: block; font-size: 1.25rem; }

nav.main-nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
  flex-wrap: wrap;
}
nav.main-nav a {
  color: var(--gold-light);
  font-size: .88rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
nav.main-nav a:hover { background: rgba(216,178,96,.15); }
nav.main-nav a.active { background: var(--gold); color: var(--navy); }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 60px;
  background: var(--navy);
  color: var(--gold-light);
  padding: 28px 0;
  text-align: center;
  font-size: .85rem;
}
.site-footer .gold { color: var(--gold); }
.footer-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.footer-social { display: flex; gap: 14px; }
.footer-social a {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(216,178,96,.4);
  color: var(--gold-light);
  transition: background .15s, color .15s;
}
.footer-social a:hover { background: var(--gold); color: var(--navy); }
.footer-social svg { width: 18px; height: 18px; }
.site-footer a { color: var(--gold-light); text-decoration: underline; text-underline-offset: 2px; }
.site-footer a:hover { color: var(--gold); }

/* ---------- Hero ---------- */
.hero {
  padding: 56px 0 40px;
  text-align: center;
}
.hero img.crest { height: 120px; margin: 0 auto 18px; }
.hero p.tagline { max-width: 520px; margin: 0 auto; color: var(--ink-soft); }

.hero-actions { display: flex; gap: 12px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: .9rem;
  border: 1px solid var(--navy);
  cursor: pointer;
  background: var(--paper);
  color: var(--navy);
}
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--navy); }

/* ---------- Cards / sections ---------- */
.section { padding: 36px 0; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 18px; gap: 12px; flex-wrap: wrap;
}
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 20px 22px; }

.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

/* ---------- Logo d'equipe ---------- */
.team-logo {
  width: 46px; height: 46px;
  object-fit: contain;
  flex: none;
  vertical-align: middle;
}
.team-logo.lg { width: 96px; height: 96px; }
.team-logo.xl { width: 220px; height: 220px; }
.team-logo.sm { width: 32px; height: 32px; }
.team-logo.md { width: 56px; height: 56px; }

/* ---------- Team / player rows ---------- */
.team-line { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.team-tag { color: var(--ink-soft); font-weight: 500; font-size: .82rem; }

.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  object-fit: cover;
  flex: none;
}
.avatar.lg { width: 76px; height: 76px; }
.avatar.xl { width: 100px; height: 100px; }
.avatar.xxl { width: 160px; height: 160px; }
/* Ajoutee en JS uniquement quand la vraie photo ne charge pas : cadre visible pour le repli. */
.avatar-fallback {
  border: 2px solid var(--gold);
  background: var(--gold-light);
}

/* ---------- Tables ---------- */
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: .92rem;
}
table.data th, table.data td {
  padding: 11px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data th {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: .72rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--navy);
  background: var(--gold-light);
  cursor: pointer;
  user-select: none;
  position: sticky; top: 0;
}
table.data th.no-sort { cursor: default; }
table.data th span.arrow { margin-left: 4px; opacity: .5; }
table.data tbody tr:hover { background: #FFF9EA; }
table.data tbody tr:nth-child(1) td:first-child { font-weight: 700; }
table.data tr.rank-1 td:first-child::before { content: "\1F3C6 "; }
table.table-scroll { overflow-x: auto; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: .74rem; font-weight: 700; letter-spacing: .03em;
}
.badge.win { background: #E7F3E4; color: #2C7A3C; }
.badge.draw { background: var(--gold-light); color: #7a611f; }
.badge.loss { background: #FBE4E7; color: var(--red); }
.badge.upcoming { background: #E7ECFB; color: var(--blue); }
.badge.gold { background: var(--gold-light); color: #7a611f; }
.badge.live { background: var(--red); color: #fff; }

table.data tr.qualifie { background: #FFFBF0; }

/* ---------- Ligne de tableau dépliable (clic pour afficher un détail) ---------- */
tr.expandable-row { cursor: pointer; }
tr.expandable-detail { display: none; background: var(--gold-light); }
tr.expandable-detail.open { display: table-row; }

td.rank-col, th.rank-col {
  width: 34px;
  text-align: center;
  font-weight: 700;
  color: var(--navy);
}
td.rank-col.quali { border-right: 4px solid var(--green); }

/* ---------- Match card (calendrier) ---------- */
.journee-title {
  font-family: var(--font-display);
  color: var(--navy);
  font-size: 1.05rem;
  margin: 30px 0 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--gold);
}
.match-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr; /* equipe A | score | equipe B (plus de colonne "Detail") */
  align-items: center;
  gap: 18px;
  padding: 20px 22px;
}
.match-row + .match-row { border-top: 1px solid var(--line); }
.match-row .team-line { display: flex; align-items: center; gap: 12px; }
/* Equipe de droite collee au bord droit, logo a l'exterieur (miroir de l'equipe de gauche).
   En row-reverse, flex-start = cote droit. */
.match-row .team-line.right { justify-content: flex-start; text-align: right; flex-direction: row-reverse; }
.match-score {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--navy);
  min-width: 64px;
  text-align: center;
}
a.match-score:hover { color: var(--blue); text-decoration: underline; }
/* Encadre de rencontre entierement cliquable (accueil, calendrier) -> page de la confrontation */
a.match-row { cursor: pointer; transition: background .15s; }
a.match-row:hover { background: #FFF9EA; }
a.match-row:last-child { border-radius: 0 0 var(--radius) var(--radius); }

/* ---------- Arbre du top cut ---------- */
.bracket {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 20px 0;
  overflow-x: auto;
}
.bracket-round {
  display: flex;
  flex-direction: column;
  gap: 28px;
  flex: 0 0 300px;
}
.bracket-match {
  display: block;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.bracket-match .bm-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 0; }
.bracket-match .bm-row .nom { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); }
.bracket-match .bm-row.winner .nom { color: var(--navy); font-weight: 700; }
.bracket-match .bm-score { font-family: var(--font-display); color: var(--navy); min-width: 20px; text-align: right; }
.bracket-connector { flex: 0 0 44px; align-self: stretch; position: relative; }
.bracket-connector::before {
  content: "";
  position: absolute; left: 0; right: 50%;
  top: 25%; bottom: 25%;
  border-top: 2px solid var(--gold);
  border-right: 2px solid var(--gold);
  border-bottom: 2px solid var(--gold);
}
.bracket-connector::after {
  content: "";
  position: absolute; left: 50%; right: 0; top: 50%;
  border-top: 2px solid var(--gold);
}
.bracket-final { flex: 0 0 300px; }
.bracket-final .bracket-match { border-color: var(--gold); background: var(--gold-light); }
.bracket-final .bracket-match .bm-row .nom { color: var(--ink); }
.bracket-final .bracket-match .bm-row.winner .nom { color: var(--navy); }

@media (max-width: 820px) {
  .bracket { flex-direction: column; }
  .bracket-connector { display: none; }
  .bracket-round, .bracket-final { flex: none; width: 100%; }
}

/* ---------- Filters ---------- */
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
select, input[type="search"] {
  font-family: var(--font-body);
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: .88rem;
  color: var(--ink);
}
.tabs { display: flex; gap: 6px; }
.tabs button {
  font-family: var(--font-body);
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  font-size: .88rem;
  color: var(--ink-soft);
}
.tabs button.active { background: var(--navy); color: var(--gold-light); border-color: var(--navy); }

/* ---------- Podium (accueil) ---------- */
.podium { display: flex; gap: 14px; align-items: flex-end; justify-content: center; margin: 20px 0 6px; }
.podium .spot { text-align: center; }
.podium .spot .team-logo { margin: 0 auto 8px; }
.podium .spot .place {
  font-family: var(--font-display); color: var(--gold); font-size: 1.4rem;
}
.podium .spot.p1 .place { font-size: 1.8rem; }

/* ---------- Duel table (rencontre) ---------- */
.duel-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 12px 10px;
}
.duel-row + .duel-row { border-top: 1px solid var(--line); }
.duel-row .winner { font-weight: 700; color: var(--navy); }
.duel-row .num { color: var(--gold); font-family: var(--font-display); }

/* ---------- Empty / loading states ---------- */
.state-msg {
  text-align: center;
  color: var(--ink-soft);
  padding: 40px 20px;
  font-size: .95rem;
}
.state-msg.error { color: var(--red); }

/* ---------- Profile headers ---------- */
.profile-head {
  display: flex; align-items: center; gap: 20px; padding: 30px 0; flex-wrap: wrap;
}
.profile-head .meta .eyebrow { margin-bottom: 4px; }
.stat-pills { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.stat-pill {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 16px; text-align: center; min-width: 84px;
}
.stat-pill b { display: block; font-family: var(--font-display); color: var(--navy); font-size: 1.2rem; }
.stat-pill span { font-size: .72rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .05em; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .match-row { grid-template-columns: 1fr; text-align: center; }
  .match-row .team-line { justify-content: center; }
  .match-row .team-line.right { flex-direction: row; justify-content: center; text-align: left; }
  .duel-row { grid-template-columns: 1fr; text-align: center; }
  nav.main-nav { justify-content: center; width: 100%; }
  .site-header .wrap { justify-content: center; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
