/* ══════════════════════════════════════════
   ITS Rugby — Home Stats
   ────────────────────────────────────────
   Tous les conteneurs ont un background opaque (vanilla ou white) pour
   ne pas laisser transparaître l'habillage publicitaire. Les tokens
   --teal / --vanilla / --white / --border / --muted / --g-bright /
   --red / --sage proviennent de itsrugby-common.css.
   ══════════════════════════════════════════ */

/* Wrapper full-width (le titre couvre toute la largeur)
   Pas de margin-bottom — la .section parente gère l'espace inter-sections via padding */
.itsr-stats {
	background: var(--vanilla);
	margin: 0;
}

/* Header : full-width comme les autres section-title de la home */
.itsr-stats__header {
	margin: 0 0 12px;
}

.itsr-stats__header .section-title {
	margin: 0;
	display: flex;
	align-items: center;
	gap: 16px;
}
/* Uniformise avec .section-title-sm (mode soft) : titre à gauche, hint, ligne à droite.
   Surcharge l'ordre global de itsrugby-common.css qui place la règle avant le titre. */
.itsr-stats__header .section-title a,
.itsr-stats__header .section-title .itsr-stats__title-link,
.itsr-stats__header .section-title .section-title-hint { order: 0; }
.itsr-stats__header .section-title::after { order: 1; }

/* Lien titre → page compétition : hérite couleur, signalé par underline au hover */
.itsr-stats__title-link {
	color: inherit;
	text-decoration: none;
	transition: opacity .15s;
}
.itsr-stats__title-link:hover,
.itsr-stats__title-link:focus-visible {
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 3px;
}

/* KPI cards en <a> : héritent du même look que la version <div>, hover lisible */
a.stat-kpi {
	color: inherit;
	text-decoration: none;
	transition: transform .15s, box-shadow .15s;
}
a.stat-kpi:hover,
a.stat-kpi:focus-visible {
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(28,61,52,.12);
}

/* Liens dans les tableaux (joueur / équipe) : couleur héritée, underline au hover */
.itsr-stats__leaders a,
.itsr-stats__form a,
.itsr-stats__pen a {
	color: inherit;
	text-decoration: none;
}
.itsr-stats__leaders a:hover,
.itsr-stats__form a:hover,
.itsr-stats__pen a:hover,
.itsr-stats__leaders a:focus-visible,
.itsr-stats__form a:focus-visible,
.itsr-stats__pen a:focus-visible {
	text-decoration: underline;
}

/* Mode "soft" : ré-utilise .section-title-sm (strip vert plus fin) avec
   un peu moins de margin-top pour rester collé au bloc édito au-dessus.
   Aligné sur le 90% des KPI/articles pour ne pas casser visuellement la grille home. */
.itsr-stats__title-soft {
	max-width: 90%;
	margin: 0 auto 8px !important;
	box-sizing: border-box;
}

/* Section stats home : on colle le bloc au section éditorial du dessus
   (sinon padding 28px section + 28px section = 56px de vide). */
.its-v2 .section[data-layout="stats"] {
	padding-top: 4px;
	padding-bottom: 10px;
}

.itsr-stats--title-soft {
	margin-top: 0;
}

/* Contenus : alignés sur le container 90% commun aux autres blocs home */
.itsr-stats__kpi,
.itsr-stats__leaders,
.itsr-stats__pen,
.itsr-stats__form {
	max-width: 90%;
	margin-left: auto;
	margin-right: auto;
	box-sizing: border-box;
}

/* Grille KPI : 4 colonnes pleine largeur (override de stat-kpi-grid qui est en 5 cols) */
.itsr-stats__kpi {
	grid-template-columns: repeat(4, 1fr);
	gap: 6px;
	margin-bottom: 0;
}

/* KPI cards : 3 colonnes internes côte à côte
   [icône] | [valeur] | [label + sous-titre empilés]
   La valeur (label+sub) occupe la 3e col en stack vertical. */
.itsr-stats__kpi .stat-kpi {
	position: relative;
	display: grid;
	grid-template-columns: auto auto minmax(0, 1fr);
	grid-template-rows: auto auto;
	grid-template-areas:
		"icon val lbl"
		"icon val sub";
	align-items: center;
	column-gap: 12px;
	row-gap: 1px;
	min-height: 0;
	padding: 10px 12px;
}
.itsr-stats__kpi .stat-kpi-icon {
	grid-area: icon;
	align-self: center;
	width: 32px;
	height: 32px;
	padding: 6px;
	background: var(--teal);
	color: var(--g-bright);
	flex-shrink: 0;
	transition: background .25s ease, color .25s ease, transform .25s ease;
}
.itsr-stats__kpi .stat-kpi:hover .stat-kpi-icon {
	background: var(--g-bright);
	color: var(--teal);
	transform: rotate(-4deg);
}
/* Annule la bordure teal sombre au hover (héritée de .stat-kpi:hover dans common.css
   — sur le scope home elle ressemblait à une bordure noire). On garde un léger
   indicateur via box-shadow déjà défini sur a.stat-kpi:hover. */
.itsr-stats__kpi .stat-kpi:hover {
	border-color: var(--border);
}
.itsr-stats__kpi .stat-kpi-val {
	grid-area: val;
	align-self: center;
	margin: 0;
	padding: 0;
	font-family: var(--serif);
	font-size: 22px;
	letter-spacing: -0.5px;
	line-height: 1;
	white-space: nowrap;
}
.itsr-stats__kpi .stat-kpi-lbl {
	grid-area: lbl;
	align-self: end;
	margin: 0;
	font-size: 9px;
	line-height: 1.2;
	/* Filet de sécurité : en majuscules + letter-spacing, un mot long
	   (« MARQUEUR ») dépasse la colonne et bave hors de la carte. */
	min-width: 0;
	overflow-wrap: anywhere;
}
.itsr-stats__kpi .stat-kpi-sub {
	grid-area: sub;
	align-self: start;
	margin: 0;
	font-size: 10.5px;
	line-height: 1.25;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

@media (max-width: 920px) {
	.itsr-stats__kpi { grid-template-columns: repeat(2, 1fr); }
	/* En 2 colonnes : la 3e carte tomberait seule sur sa ligne, on la garde mais
	   on retire la règle de masquage de la 4e qui ne s'applique plus visuellement. */
}

/* Une carte par ligne dès 600px : en dessous, la 2e colonne laisse ~80px au
   label, ce qui casse « MATCH LE PLUS SERRÉ » en 4 lignes. Couvre aussi les
   webviews qui rapportent un viewport plus large que la largeur réelle. */
@media (max-width: 600px) {
	.itsr-stats__kpi { grid-template-columns: 1fr; }
}

.itsr-stats__sub {
	font-size: 11px;
	font-weight: 800;
	letter-spacing: 1px;
	text-transform: uppercase;
	color: var(--teal);
	margin: 0 0 8px;
	padding: 6px 10px;
	background: var(--white);
	border: 1px solid var(--border);
	border-bottom: 2px solid var(--teal);
}

/* ── KPI single (un seul widget unitaire) : carte largeur naturelle ── */

.itsr-stats__kpi--single {
	grid-template-columns: minmax(220px, 360px);
	margin-bottom: 0;
}

/* ── Leaders : 3 colonnes, qui se rabattent en 1 col en mobile ─────── */

.itsr-stats__leaders {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 16px;
	margin-bottom: 20px;
}

@media (max-width: 920px) {
	.itsr-stats__leaders { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
	.itsr-stats__leaders { grid-template-columns: 1fr; }
}

.itsr-stats__col {
	background: var(--white);
	border: 1px solid var(--border);
	padding: 12px;
	transition: box-shadow .2s ease, border-color .2s ease;
}
.itsr-stats__col:hover {
	border-color: var(--teal);
	box-shadow: 0 6px 18px rgba(28,61,52,.1);
}

.itsr-stats__col .data-table { background: var(--white); }

/* ── Essais de pénalité ───────────────────────────────────────────── */

.itsr-stats__pen {
	background: var(--white);
	border: 1px solid var(--border);
	padding: 12px 16px;
	margin-bottom: 20px;
	transition: box-shadow .2s ease, border-color .2s ease;
}
.itsr-stats__pen:hover {
	border-color: var(--teal);
	box-shadow: 0 6px 18px rgba(28,61,52,.1);
}

.itsr-stats__pen-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.itsr-stats__pen-list li {
	font-size: 12px;
	color: var(--teal);
	background: var(--vanilla);
	padding: 6px 10px;
	border: 1px solid var(--border);
}

.itsr-stats__pen-team {
	font-weight: 700;
	margin-right: 6px;
}

.itsr-stats__pen-nb {
	font-weight: 900;
	color: var(--red);
}

/* ── Forme des équipes : pastilles W/L/D ──────────────────────────── */

.itsr-stats__form {
	background: var(--white);
	border: 1px solid var(--border);
	padding: 12px;
	transition: box-shadow .2s ease, border-color .2s ease;
}
.itsr-stats__form:hover {
	border-color: var(--teal);
	box-shadow: 0 6px 18px rgba(28,61,52,.1);
}

.itsr-form-pills {
	display: inline-flex;
	gap: 4px;
	align-items: center;
}

.itsr-form-pill {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	font-size: 11px;
	font-weight: 900;
	line-height: 1;
	color: var(--white);
	letter-spacing: 0;
}

.itsr-form-pill--w { background: var(--g-bright); color: var(--teal-dk); }
.itsr-form-pill--l { background: var(--red);      color: var(--white); }
.itsr-form-pill--d { background: var(--muted);    color: var(--white); }
