/* CAN Toulouse 2027 — pages « Le tournoi » et « Galerie ». Chargée après can.css (mêmes jetons). */

.pg { --pg-pas: clamp(56px, 7vw, 96px); }
.pg-head { max-width: 760px; }
.pg-lead { margin-top: 16px; color: #d6d3c8; font-size: clamp(17px, 1.4vw, 19px); line-height: 1.6; }
.pg-maj { margin-top: 12px; color: var(--muted-2); font-size: 14px; }
.pg-h2 { font-size: clamp(32px, 3.8vw, 52px); font-weight: 900; line-height: 1; letter-spacing: -.035em; }
.pg-h2 em { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--gold); letter-spacing: -.01em; }
.pg-bloc { padding-top: var(--pg-pas); scroll-margin-top: 84px; }
.pg-bloc-tete { display: flex; align-items: end; justify-content: space-between; gap: 12px 40px; flex-wrap: wrap; margin-bottom: 28px; }
.pg-bloc-tete p { color: var(--muted); font-size: 15px; max-width: 46ch; }
.pg-bloc-tete .link-gold { display: inline; padding-bottom: 1px; font-size: inherit; }

.pg-badge { display: inline-flex; align-items: center; gap: 7px; align-self: start; justify-self: start; padding: 6px 12px; border-radius: 999px; background: rgba(216, 187, 130, .14); color: var(--gold-2); font-size: 13px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.pg-badge.ok { background: rgba(47, 107, 69, .35); color: #b9e2c5; }
.pg-badge .i { width: 15px; height: 15px; }

.pg-vide { display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: start; background: var(--panel); border: 1px dashed var(--line-2); border-radius: var(--r); padding: 28px 30px; }
.pg-vide-ic { width: 40px; height: 40px; color: var(--gold); }
.pg-vide h2, .pg-vide h3 { font-size: 20px; font-weight: 800; line-height: 1.3; }
.pg-vide p { margin-top: 8px; color: var(--muted); max-width: 62ch; line-height: 1.6; }
.pg-vide .link-gold { margin-top: 18px; }

/* ------------------------------------------------------------- Le tournoi en bref */
.tn-bref { margin-top: 8px; }
.tn-chiffres { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line-2); border-radius: var(--r); overflow: hidden; background: var(--line); gap: 1px; position: relative; }
.tn-chiffres::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; z-index: 1; background: linear-gradient(90deg, #1f7a45 0 33.3%, #e8bc26 33.3% 66.6%, #c8302b 66.6%); }
.tn-chiffres > div { background: var(--panel); padding: 26px 24px 22px; display: grid; gap: 8px; align-content: start; }
.tn-chiffres dt { color: var(--gold); font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.tn-chiffres dd { margin: 0; display: grid; gap: 6px; }
.tn-chiffres b { font-size: clamp(21px, 2vw, 26px); font-weight: 900; letter-spacing: -.02em; line-height: 1.15; }
.tn-chiffres span { color: var(--muted); font-size: 14px; line-height: 1.5; }

/* ------------------------------------------------------------- Tirage */
.tn-tirage { display: grid; gap: 12px; padding: 28px 30px; border-radius: var(--r); background: linear-gradient(160deg, #223026, #161d18 70%); border: 1px solid var(--line-2); }
.tn-tirage-date { font-family: var(--serif); font-size: clamp(30px, 3.4vw, 44px); line-height: 1.1; color: var(--gold-2); }
.tn-tirage-lieu { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.tn-tirage p:not([class]) { color: #d6d3c8; max-width: 62ch; line-height: 1.6; }
.tn-tirage .link-gold { justify-self: start; }

/* ------------------------------------------------------------- Poules */
.tn-poules { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.tn-poule { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r); padding: 20px 20px 10px; min-width: 0; }
.tn-poule h3 { display: flex; align-items: baseline; gap: 8px; font-size: 30px; font-weight: 900; letter-spacing: -.02em; padding-bottom: 12px; border-bottom: 1px solid var(--line-2); }
.tn-poule h3 span { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 22px; color: var(--gold); }
.tn-classement { width: 100%; border-collapse: collapse; font-size: 15px; }
.tn-classement th, .tn-classement td { padding: 10px 4px; border-bottom: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; }
.tn-classement tr:last-child > * { border-bottom: 0; }
.tn-classement thead th { color: var(--muted-2); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding-block: 10px 6px; }
.tn-classement th[scope="row"], .tn-classement thead th:nth-child(2) { text-align: left; width: 100%; }
.tn-classement th[scope="row"] { font-weight: 700; }
.tn-classement th[scope="row"] small { display: block; margin: 2px 0 0 42px; color: var(--muted); font-weight: 400; font-size: 13px; }
.tn-classement td { padding-left: 12px; color: var(--muted); }
.tn-rang { color: var(--gold) !important; font-weight: 800; padding-left: 0 !important; padding-right: 10px !important; }
.tn-pts { color: var(--text) !important; font-weight: 900; }

.tn-eq { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.tn-eq > span:last-child { overflow-wrap: anywhere; }
.tn-eq-vide { width: 32px; height: 24px; flex: none; border-radius: 3px; border: 1.5px dashed var(--line-2); }

/* ------------------------------------------------------------- Calendrier */
.tn-cal-outils { max-width: 340px; margin-bottom: 20px; }
.tn-cal-outils label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.tn-onglets { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 10px; margin-bottom: 18px; }
.tn-onglets [role="tab"] { display: grid; gap: 4px; text-align: left; padding: 16px 18px; min-height: 64px; border-radius: 12px; border: 1px solid var(--line-2); background: transparent; color: var(--text); font: inherit; cursor: pointer; transition: background .15s, border-color .15s; }
.tn-onglets [role="tab"] b { font-size: 18px; font-weight: 800; }
.tn-onglets [role="tab"] span { font-size: 14px; color: var(--muted); }
.tn-onglets [role="tab"]:hover { border-color: rgba(216, 187, 130, .5); }
.tn-onglets [role="tab"][aria-selected="true"] { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.tn-onglets [role="tab"][aria-selected="true"] span { color: #5c4a22; }
.tn-onglets [role="tab"]:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 3px; }
.tn-we-titre { font-size: 22px; font-weight: 800; margin-bottom: 14px; }
.tn-we-titre span { color: var(--muted); font-weight: 400; font-size: 16px; margin-left: 8px; }
.tn-we-prog { color: #d6d3c8; margin-bottom: 16px; }
.tn-jour + .tn-jour { margin-top: 28px; }
.tn-jour h4 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; font-size: 18px; font-weight: 800; padding-bottom: 10px; border-bottom: 1px solid var(--line-2); }
.tn-jour h4 span { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; font-weight: 500; }
.tn-matchs { list-style: none; margin: 0; padding: 0; }
.tn-match { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 8px 24px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); transition: opacity .2s; }
.tn-match.estompe { opacity: .32; }
.tn-match-quand { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; font-size: 14px; color: var(--muted); }
.tn-match-quand b { color: var(--text); font-size: 17px; font-variant-numeric: tabular-nums; }
.tn-phase { color: var(--gold-2); }
.tn-match-affiche { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 16px; font-weight: 700; }
.tn-match-affiche .dom { justify-self: end; text-align: right; flex-direction: row-reverse; }
.tn-score { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; min-width: 74px; padding: 6px 10px; border-radius: 8px; background: var(--panel-2); font-size: 20px; font-weight: 900; font-variant-numeric: tabular-nums; }
.tn-score i { font-style: normal; color: var(--muted-2); padding: 0 4px; }
.tn-match:not(.joue) .tn-score { background: transparent; font-size: 14px; font-weight: 500; }
.tn-score small { flex-basis: 100%; text-align: center; font-size: 11px; color: var(--muted); font-weight: 600; }

/* ------------------------------------------------------------- Galerie */
.gl-outils { margin-bottom: 22px; }
.gl-filtres { display: flex; flex-wrap: wrap; gap: 8px; }
.gl-filtre { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
.gl-filtre span { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.gl-filtre[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.gl-filtre[aria-pressed="true"] span { color: #5c4a22; }
.gl-filtre[hidden] { display: none; }
.gl-grille { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); grid-auto-flow: dense; gap: 12px; }
.gl-item button { position: relative; display: block; width: 100%; aspect-ratio: 4 / 3; padding: 0; border: 0; border-radius: 12px; overflow: hidden; background: var(--panel-2); cursor: zoom-in; color: inherit; }
.gl-item.large { grid-column: span 2; grid-row: span 2; }
.gl-item.large button { aspect-ratio: auto; height: 100%; min-height: 100%; }
.gl-item.video button { cursor: pointer; }
.gl-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s cubic-bezier(.2, .8, .2, 1); }
.gl-item button:hover img { transform: scale(1.05); }
.gl-item button:focus-visible { outline: 3px solid var(--gold-2); outline-offset: 3px; }
.gl-sans { display: grid; place-items: center; height: 100%; color: var(--muted-2); }
.gl-sans .i { width: 40px; height: 40px; }
.gl-lecture { position: absolute; inset: 0; margin: auto; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: rgba(17, 21, 18, .72); border: 2px solid var(--gold); color: var(--gold-2); backdrop-filter: blur(4px); }
.gl-lecture .i { width: 26px; height: 26px; fill: currentColor; margin-left: 4px; }
.gl-legende { position: absolute; inset: auto 0 0 0; padding: 28px 14px 12px; text-align: left; font-size: 14px; font-weight: 600; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, .75)); }

.gl-dlg { width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(8, 10, 9, .96); color: var(--text); }
.gl-dlg::backdrop { background: rgba(0, 0, 0, .8); }
.gl-dlg[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.gl-dlg-barre { display: flex; justify-content: space-between; align-items: center; padding: 12px max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left)); }
.gl-dlg-compteur { color: var(--muted); font-variant-numeric: tabular-nums; }
.gl-dlg-scene { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 0 16px max(16px, env(safe-area-inset-bottom)); min-height: 0; }
.gl-dlg-media { margin: 0; display: grid; justify-items: center; gap: 12px; min-height: 0; height: 100%; align-content: center; touch-action: pan-y; }
.gl-dlg-media img, .gl-dlg-media video { max-width: 100%; max-height: calc(100dvh - 150px); object-fit: contain; border-radius: 8px; }
.gl-video { width: min(100%, calc((100dvh - 150px) * 16 / 9)); aspect-ratio: 16 / 9; }
.gl-video iframe { width: 100%; height: 100%; border: 0; border-radius: 8px; }
.gl-dlg-media figcaption { text-align: center; color: #d6d3c8; font-size: 15px; max-width: 70ch; }
.gl-dlg-media figcaption small { display: block; color: var(--muted-2); font-size: 13px; margin-top: 2px; }
.gl-nav { width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line-2); background: rgba(27, 36, 30, .8); color: var(--text); display: grid; place-items: center; cursor: pointer; }
.gl-nav:hover { border-color: var(--gold); color: var(--gold-2); }
.gl-nav[hidden] { visibility: hidden; display: grid; }
html.gl-ouvert { overflow: hidden; }

/* ------------------------------------------------------------- Responsive */
@media (max-width: 1080px) {
  .tn-chiffres { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .tn-match { grid-template-columns: 1fr; gap: 10px; }
  .tn-match-affiche { gap: 10px; font-size: 15px; }
  .tn-match-affiche .tn-eq .flag { width: 26px; height: 20px; }
  .tn-score { min-width: 60px; font-size: 18px; }
  .tn-onglets [role="tab"] { padding: 12px 14px; }
  .tn-onglets [role="tab"] b { font-size: 16px; }
  .gl-item.large { grid-column: auto; grid-row: auto; }
  .gl-item.large button { aspect-ratio: 4 / 3; height: auto; min-height: 0; }
  /* Visionneuse : flèches sous le média, à portée de pouce */
  .gl-dlg-scene { grid-template-columns: 1fr 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .gl-dlg-media { grid-column: 1 / -1; grid-row: 1; }
  .gl-prec { grid-row: 2; justify-self: start; }
  .gl-suiv { grid-row: 2; justify-self: end; }
  .gl-dlg-media img, .gl-dlg-media video { max-height: calc(100dvh - 190px); }
}
@media (max-width: 560px) {
  .tn-chiffres { grid-template-columns: 1fr; }
  .tn-chiffres > div { padding: 20px 18px 18px; }
  .pg-vide { grid-template-columns: 1fr; padding: 22px 20px; gap: 14px; }
  .tn-tirage { padding: 22px 20px; }
  .tn-onglets { grid-auto-flow: row; }
  .tn-match-affiche { grid-template-columns: 1fr; justify-items: start; gap: 6px; }
  .tn-match-affiche .dom { flex-direction: row; text-align: left; justify-self: start; }
  .tn-score { justify-self: start; min-width: 0; padding: 2px 10px; margin-left: 42px; }
  .tn-match:not(.joue) .tn-score { padding: 0; margin-left: 42px; }
  .gl-grille { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .gl-legende { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .gl-item img, .tn-match { transition: none; }
}

/* Le tournoi en bref : 5 cases (lieu retiré) → la dernière occupe la place restante, pas de case vide */
@media (min-width: 1081px) { .tn-chiffres > div:last-child:nth-child(3n+2) { grid-column: span 2; } }
@media (min-width: 561px) and (max-width: 1080px) { .tn-chiffres > div:last-child:nth-child(odd) { grid-column: 1 / -1; } }
