/* =========================================================
   Antic Teams — FRONT (Hero + Next/Last Matches)
   Refactor 2025-08 — API inchangée (mêmes classes)
   - Variables normalisées
   - Accessibilité : focus visibles, contrastes
   - Motion-safe : prefers-reduced-motion
   - Corrections : couleurs invalides, doublons, petits bugs
   ========================================================= */

/* ===================== */
/* Tokens & Theme        */
/* ===================== */
:root {
  /* Layout */
  --am-card-w: 320px;
  --am-radius: 16px;
  --am-gap: 6px;

  /* Spacing */
  --am-pad-y: clamp(4px, 0.5vw, 5px);
  --am-pad-x: clamp(4px, 0.5vw, 5px);

  /* Tile sizes */
  --am-tile-w: clamp(68px, 12vw, 84px);
  --am-tile-h: clamp(86px, 15vw, 104px);

  /* Typo scales */
  --am-logo: clamp(18px, 3.2vw, 22px);
  --am-tag-size: clamp(10px, 2.2vw, 11px);
  --am-title: clamp(15px, 2.7vw, 16px);
  --am-game: clamp(12px, 2.4vw, 12px);
  --am-date: clamp(12px, 2.4vw, 12px);

  /* Hero placement (pour la variante absolute) */
  --am-hero-top: 230px;
  --am-hero-left: 30%;

  /* Couleurs (thème clair par défaut) */
  --am-bg: #f9f9f9;
  --am-fg: #111111;
  --am-fg-2: #1c1c1c;
  --am-fg-3: #3a3a3a;
  --am-card-glass: rgba(255, 255, 255, 0.92);
  --am-border: rgba(255, 255, 255, 0.6);
  --am-shadow: 0 8px 28px rgba(0, 0, 0, 0.16);
  --am-live: #e71818;
  --am-muted: #737373;
  --am-muted-2: #9a9a9a;
  --am-surface-dark: #262626;

  /* Accent (compat : l’ancien code utilisait --var--accent) */
  --am-accent: #e6b9a0;
  --var--accent: var(--am-accent);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ===================== */
/* Helpers               */
/* ===================== */

.am-hero-wrap {
  position: relative;
  min-height: 180px;
}

/* ===================== */
/* Carte Hero            */
/* ===================== */

.am-hero {
  display: flex;
  align-items: center;
  gap: 13px;
  width: min(100%, var(--am-card-w));
  border-radius: var(--am-radius);
  padding: var(--am-pad-y) var(--am-pad-x);
  background: var(--am-card-glass);
  color: var(--am-fg);
  border: 1px solid var(--am-border);
  box-shadow: var(--am-shadow);
  -webkit-backdrop-filter: saturate(130%) blur(6px);
  backdrop-filter: saturate(130%) blur(6px);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Arial, sans-serif;
}

.am-hero--abs {
  position: absolute;
  top: var(--am-hero-top);
  left: var(--am-hero-left);
  transform: translateX(-50%);
  width: min(100%, var(--am-card-w));
  z-index: 2;
}

/* Tuile logos */
.am-hero__tile {
  position: relative;
  flex: 0 0 var(--am-tile-w);
  width: var(--am-tile-w);
  height: var(--am-tile-h);
  border-radius: var(--am-radius);
  overflow: hidden;
  background: #0b0b0b;
}
.am-hero__bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.45;
}
.am-hero__vs-divider {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 50%;
  height: 1px;
  background: #f5f5f5;
  transform: translateY(-0.5px);
}
.am-hero__slot {
  position: absolute;
  left: 8px;
  right: 8px;
  height: 40px;
  display: flex;
  align-items: center;
  gap: var(--am-gap);
}
.am-hero__slot--top {
  top: 8px;
}
.am-hero__slot--bottom {
  bottom: 8px;
}

.am-hero__logo-img {
  width: var(--am-logo);
  height: var(--am-logo);
  object-fit: contain;
  filter: brightness(0) invert(1);
}
.am-hero__tag {
  color: #f5f5f5;
  font-weight: 700;
  font-size: var(--am-tag-size);
  letter-spacing: 0.3px;
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

/* Textes */
.am-hero__title {
  font-weight: 600;
  font-size: var(--am-title);
  line-height: 1.05;
  letter-spacing: 0.2px;
}
.am-hero__game {
  margin-top: 1px;
  font-weight: 600;
  font-size: var(--am-game);
  color: var(--am-fg-2);
}
.am-hero__date {
  margin-top: 6px;
  font-weight: 500;
  font-size: var(--am-date);
  color: var(--am-fg-3);
}
.am-hero__date-time {
  font-weight: 700;
}

/* Badges */
.am-hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  padding: 2px 7px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 12px;
  line-height: 1;
}
.am-hero__badge--live {
  background: var(--am-live);
  color: #f5f5f5;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12),
    0 4px 14px rgba(228, 29, 29, 0.35);
}
.am-hero__badge--live::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  display: inline-block;
  animation: am-pulse 1.6s ease-in-out infinite;
}
.am-hero__badge--result {
  background: #efefef;
  color: var(--am-fg);
}

/* Lien cliquable (hover/focus) */
.am-hero-link {
  display: block;
  text-decoration: none;
  color: inherit;
}
.am-hero-link .am-hero {
  transition: box-shadow 0.15s ease, transform 0.15s ease;
  cursor: pointer;
}
.am-hero-link:focus-visible .am-hero {
  outline: 2px solid var(--am-accent);
  outline-offset: 3px;
}
@media (hover: hover) {
  .am-hero-link:hover .am-hero {
    transform: translateY(-1px);
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.18);
  }
}

/* Animation (motion-safe) */
@keyframes am-pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.15);
  }
  100% {
    transform: scale(1);
  }
}
@media (prefers-reduced-motion: reduce) {
  .am-hero-link .am-hero {
    transition: none;
  }
  .am-hero__badge--live::before {
    animation: none;
  }
}

/* ===================== */
/* Prochain Match        */
/* ===================== */

.am-nextmatch {
  color: #f5f5f5;
  border-radius: 8px;
  padding: 12px 8px;
  background: transparent; /* l’arrière-plan vient du hero/section parent */
}
.am-nextmatch__inner {
  max-width: 920px;
  margin-inline: auto;
  text-align: center;
}
.am-nextmatch__competition {
  text-transform: uppercase;
  font-size: 16px;
  margin-bottom: 8px;
  color: var(--var--accent);
  font-weight: 400;
}
.am-nextmatch__title {
  margin: 0 0 14px;
  font-weight: 600;
  font-size: 28px;
}
.am-nextmatch__teams {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
  margin: 10px 0 16px;
}

.am-nextmatch__team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.am-nextmatch__logo {
  height: 50px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.am-nextmatch__logo img {
  max-height: 100%;
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
  filter: brightness(0) invert(1);
}
.am-nextmatch__tag {
  font-size: 12px;
  text-transform: uppercase;
  color: #737373;
  line-height: 1;
}
.am-nextmatch__vs {
  font-weight: 600;
  font-size: 28px;
  color: var(--var--accent);
}
.am-nextmatch__countdown {
  display: flex;
  gap: 22px;
  align-items: center;
  justify-content: center;
  margin: 8px 0;
}
.am-nextmatch__cd-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 48px;
}
.am-nextmatch__cd-item .num {
  font-size: 18px;
  font-weight: 600;
  line-height: 18px;
}
.am-nextmatch__cd-item .lab {
  font-size: 14px;
  color: #737373;
  text-transform: uppercase;
}
.am-nextmatch__date {
  margin-top: 6px;
  opacity: 0.88;
  font-size: 13px;
}
.am-nextmatch__result {
  margin-top: 10px;
  font-weight: 800;
}
.am-nextmatch__reslab {
  opacity: 0.8;
  margin-right: 8px;
}
.am-nextmatch__cta {
  margin-top: 14px;
}
.am-nextmatch__btn {
  position: relative;
  display: inline-block;
  background: var(--am-accent);
  color: #292929;
  text-decoration: none;
  text-transform: uppercase;
  font-weight: 600;
  font-size: 16px;
  padding: 4px 30px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}
.am-nextmatch__btn::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  background: #292929;
  right: -11px;
  bottom: -11px;
  transform: rotate(45deg);
  border-left: 1px solid rgba(0, 0, 0, 0.08);
  border-bottom-right-radius: 4px;
}
.am-nextmatch__btn:hover {
  filter: brightness(0.98);
}
.am-nextmatch__btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

/* ===================== */
/* Derniers Matchs       */
/* ===================== */

.am-lastmatches {
  --card-bg: var(--am-surface-dark);
  --accent: var(--am-accent);
  color: #f5f5f5;
}
.am-lastmatches__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.am-lmcard {
  background-color: #292929;
  padding: 8px 10px;
  border: 1px solid #7373734d;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}
.am-lmcard__head {
  margin-bottom: 10px;
}
.am-lmcard__title {
  margin: 0;
  font-size: 16px;
  font-weight: 400;
  color: #f6c9b1 !important;
  text-transform: uppercase;
}

.am-lmcard__date {
  font-size: 13px;
  color: #f5f5f5;
  text-transform: uppercase;
}
.am-lmcard__teams {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.am-lmrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.am-lmrow__left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.am-lmrow__logo img {
  width: 27px;
  height: 27px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}
.am-lmrow__tag {
  font-size: 13px;
  text-transform: uppercase;
  color: var(--am-muted-2);
  letter-spacing: 0.06em;
}
.am-lmrow__score {
  font-weight: 600;
  font-size: 16px;
  color: #f5f5f5;
  min-width: 24px;
  text-align: right;
}

.am-lmrow__player {
  color: #f6c9b1;
  font-weight: 600;
  white-space: nowrap;
}

/* ===================== */
/* Grille Nos Équipes    */
/* ===================== */

/* ---------- Grille ---------- */
.am-teams-grid {
  display: grid;
  gap: 18px;
  --am-cols: 4; /* fallback */
}
.am-teams-grid.cols-1 {
  --am-cols: 1;
}
.am-teams-grid.cols-2 {
  --am-cols: 2;
}
.am-teams-grid.cols-3 {
  --am-cols: 3;
}
.am-teams-grid.cols-4 {
  --am-cols: 4;
}
.am-teams-grid {
  grid-template-columns: repeat(var(--am-cols), 1fr);
}

/* ---------- Carte bannière ---------- */
.am-team-card {
  position: relative;
  display: block;
  overflow: hidden;
  text-decoration: none;
  background: #0e0e0e;
  height: 720px; /* ← fixe */
  min-height: 720px; /* sécurité */
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
  isolation: isolate;
}

/* image de fond */
.am-team-card__bg {
  position: absolute;
  inset: 0;
  background: #1b1b1b center/cover no-repeat;
  transform: scale(1.02);
  transition: transform 0.35s ease, filter 0.35s ease;
}

.am-team-card::before {
  /* gradient sombre pour lisibilité des logos/texte */
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.55) 0%,
    rgba(0, 0, 0, 0.15) 35%,
    rgba(0, 0, 0, 0.45) 100%
  );
  z-index: 1;
}

/* hover */
.am-team-card:hover .am-team-card__bg {
  transform: scale(1.07);
  filter: brightness(0.95);
}

/* zones */
.am-team-card__top,
.am-team-card__mid {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.am-team-card__top {
  top: 40px;
}

.am-team-card__mid {
  top: 20%;
  transform: translateY(-24%);
}

/* on masque le bas */
.am-team-card__bottom {
  display: none !important;
}

/* crest Antic (blanc) */
.am-team-card__crest {
  width: 50px;
  height: 50px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}
.am-team-card__glogo {
  width: 140px;
  height: auto;
  object-fit: contain;
  filter: brightness(0) invert(1);
  opacity: 0.95;
}

/* textes */
.am-team-card__game {
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 14px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.am-team-card__tag {
  color: #e6b9a0;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
}

/* ===================== */
/*  PAGE ÉQUIPES         */
/* ===================== */

/* ===== Layout ===== */
.am-team-page {
  position: relative;
  overflow: hidden;
  width: 100%;
}

.am-team-page .am-container {
  width: 1440px;
  max-width: calc(100% - 40px); /* resp: petites marges sur mobile */
  margin-inline: auto;
}

/* ===== Overlay grille pleine largeur ===== */
.grid-overlay {
  position: relative;
  overflow: hidden;
  z-index: 0;
}
.grid-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(to right, #73737326 1px, transparent 1px),
    linear-gradient(to bottom, #73737326 1px, transparent 1px);
  background-size: 180px 180px;
  background-position: 50px 50px;
  pointer-events: none;
  z-index: -1;
  -webkit-mask-image: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 1) 85%,
    rgba(0, 0, 0, 0) 100%
  );
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
  mask-image: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 1) 50%,
    rgba(0, 0, 0, 0) 100%
  );
  mask-repeat: no-repeat;
  mask-size: 100% 100%;
}

/* ===== Header ===== */
.am-team-head {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Arial, sans-serif;
  color: #f9f9f9; /* ; manquant corrigé */
  min-height: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px 0 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  margin-bottom: 18px;
}
.am-team-head__line {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 12px;
  flex-wrap: nowrap; /* => ne passe pas à la ligne */
  font: 700 38px/1.1 "Inter", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, Arial, sans-serif;
  margin: 0;
}

/* Empêche les retours à la ligne sur chaque morceau */
.am-team-head__label,
.am-team-head__game {
  white-space: nowrap;
}

.am-team-head__label {
  color: #f9f9f9;
} /* ; manquant corrigé */
.am-team-head__game {
  color: #f6c9b1;
  text-transform: uppercase;
}

/* ===== Tabs ===== */
.am-tabs {
  position: relative;
  z-index: 2; /* passe au-dessus de la grille */
  display: flex;
  gap: 8px;
  margin: 22px auto 14px;
}
.am-tabs a {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Arial, sans-serif;
  font-weight: 500;
  font-size: 18px;
  text-transform: uppercase;
  color: #f9f9f9;
  text-decoration: none;
  cursor: pointer;
  margin-right: 10px;
  padding-bottom: 2px;
}
.am-tabs a:hover,
.am-tabs a.active {
  color: #f9f9f9;
  border-bottom: 2px solid #f9f9f9;
}

/* ===== Contenu des onglets ===== */
.am-tab {
  display: none;
  margin-top: 25px;
}
.am-tab.active {
  display: block;
}

/* ===== Liste joueurs ===== */
.antic-player-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, 270px);
  gap: 24px;
  justify-content: start;
  align-items: start;
}

/* Cartes */
.am-tab .player-card {
  box-sizing: border-box;
  border: 1px solid #73737326;
  background: linear-gradient(to bottom, #404040 0%, #2d2d2d 100%);
  padding-top: 10px;
  padding-left: 10px;
  padding-right: 10px;
  margin: 0;
  width: 100%; /* remplace le 270px!important */
}

.am-tab .player-card h4 {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Arial, sans-serif;
  font-weight: 500;
  font-size: 24px;
  color: #f9f9f9;
  margin: 0 0 2px;
}
.am-tab .player-card h5 {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Arial, sans-serif;
  font-weight: 500;
  font-size: 18px;
  color: #f9f9f9;
  margin: 0;
}
.am-tab .player-card .player-card-name {
  margin-right: 5px;
}
.am-tab .player-card .player-card-role {
  color: #f6c9b1;
  text-transform: uppercase;
  font-weight: 700;
}

/* Image bord à bord */
.am-tab .player-card .photo {
  padding: 0;
  margin: 0;
  text-align: center;
}
.am-tab .player-card .photo img {
  display: block;
  width: 100%;
  height: auto;
}

/* RESPONSIVES */

/* <= 1366px (laptop) */
@media (max-width: 1366px) {
  :root {
    --am-hero-left: 55%;
    --am-hero-top: 28vh;
  }
  .am-lastmatches__grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .am-teams-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .am-team-card__crest {
    width: 50px;
    height: 50px;
  }
  .am-team-card__glogo {
    width: 150px;
  }

  .am-team-card__mid {
    top: 25%;
    transform: translateY(-24%);
  }

  .am-team-page .am-container {
    width: auto;
    padding: 15px;
  }

  .antic-player-list {
    grid-template-columns: repeat(auto-fill, 280px);
  }
}

/* <= 1024px (tablette) */
@media (max-width: 1024px) {
  :root {
    --am-hero-left: 59%;
    --am-hero-top: 19vh;
    --am-title: clamp(15px, 2.7vw, 16px);
    --am-game: clamp(12px, 2.4vw, 12px);
    --am-date: clamp(12px, 2.4vw, 12px);
  }

  .am-lastmatches__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .am-teams-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .am-team-card__crest {
    width: 70px;
    height: 70px;
  }

  .am-team-card__glogo {
    width: 220px;
  }

  .am-team-card__mid {
    top: 30%;
  }
}

/* <= 767px (mobile) */
@media (max-width: 767px) {
  :root {
    --am-hero-left: 50%;
    --am-hero-top: 24px; /* fixe pour éviter les surprises */
  }

  .am-lastmatches__grid {
    grid-template-columns: 1fr;
  }

  .am-team-card {
    height: 500px;
    min-height: 500px;
  }

  .am-teams-grid {
    grid-template-columns: 1fr;
  }
  .am-team-card__crest {
    width: 70px;
    height: 70px;
  }

  .am-team-card__glogo {
    width: 220px;
  }

  .am-team-card__mid {
    top: 35%;
  }

  .am-team-head__line {
    flex-wrap: wrap; /* peut repasser à la ligne si nécessaire */
    row-gap: 4px;
  }

  .antic-player-list {
    justify-content: center;
  }
}
