/* Page d'une course (v3) : mêmes composants que l'app (cartes 16 px, Aeonik 400/500, italique Crimson à 1,19 em,
 * bande de chiffres, liste des passages avec icônes, boutons pilule, listes groupées). Couleurs : jetons de .hbrp. */
.hbrp.tgp-race3 { max-width: 760px; padding: 40px 20px 96px; }
.tgp-race3 ::selection { background: rgba(200, 243, 29, .35); color: inherit; }
.tgp-race3 a { color: var(--accent); text-underline-offset: .2em; }
.tgp-race3 :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* En-tête */
.tgp-crumb { display: flex; gap: 8px; margin-bottom: 20px; font-size: 14px; color: var(--muted); }
.tgp-crumb a { color: inherit; text-decoration: none; }
.tgp-banner { margin: 0 0 16px; padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 12%, var(--ink2)); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); font-size: 14px; }
.tgp-head { display: flex; align-items: flex-start; gap: 16px; }
.tgp-rlogo { flex: none; width: 72px; height: 72px; border-radius: 16px; background: #fff; padding: 6px; object-fit: contain; }
.tgp-race3 h1 { margin: 0; font-weight: 400; font-size: clamp(34px, 6vw, 52px); line-height: 1.06; letter-spacing: -.03em; text-wrap: balance; }
.tgp-race3 h1 em, .tgp-h em { font-family: 'Crimson Pro', Georgia, serif; font-style: italic; font-weight: 400; font-size: 1.19em; line-height: 1; letter-spacing: -.01em; color: var(--accent); }
.tgp-meta { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 15px; }
.tgp-meta li { display: flex; align-items: center; gap: 8px; }
.tgp-meta .hbrp-ic { flex: none; width: 18px; height: 18px; color: var(--accent); }
.tgp-intro { margin-top: 20px; font-size: 17px; line-height: 1.6; max-width: 65ch; }
.tgp-rich p { margin: 0 0 12px; } .tgp-rich p:last-child { margin-bottom: 0; }
.tgp-rich ul, .tgp-rich ol { margin: 0 0 12px 1.2em; padding: 0; }
.tgp-fine { margin: 12px 0 0; font-size: 13px; line-height: 1.45; color: var(--muted); }

/* Carte et formats */
.tgp-mapbox { margin-top: 32px; }
.tgp-pills { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--ink); }
.hbrp.tgp-race3 .tgp-pill, .hbrp.tgp-race3 .tgp-pill:hover, .hbrp.tgp-race3 .tgp-pill:focus { flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 14px; border: 0; border-radius: 12px; background: none; color: var(--muted); font: 400 15px/1.2 Aeonik, system-ui, sans-serif; cursor: pointer; }
.tgp-pill i { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.hbrp.tgp-race3 .tgp-pill[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); font-weight: 500; }
.tgp-pill[aria-pressed="true"] i { box-shadow: 0 0 0 2px var(--on-accent); }
.tgp-map { position: relative; height: clamp(280px, 50vh, 440px); border-radius: 16px; border: 1px solid var(--line); overflow: hidden; background: var(--ink2); z-index: 0; }
.tgp-map:not(.is-live)::after { content: "Touche la carte pour la déplacer"; position: absolute; right: 10px; top: 10px; z-index: 500; padding: 6px 12px; border-radius: 99px; background: var(--glass); color: var(--paper); font-size: 12px; pointer-events: none; }
@media (pointer: fine) { .tgp-map::after { display: none; } }
.tgp-map .leaflet-control-attribution { background: var(--glass); color: var(--muted); font-size: 10px; }
.tgp-map .leaflet-control-attribution a { color: var(--muted); }
.tgp-map .leaflet-bar a { background: var(--ink2); color: var(--paper); border-color: var(--line); }

/* Fiche d'un format */
.tgp-fmt { margin-top: 32px; display: flex; flex-direction: column; gap: 16px; }
.tgp-fmt[hidden] { display: none; }
.tgp-fmt-h h2 { margin: 0; font-weight: 400; font-size: 28px; line-height: 1.15; letter-spacing: -.02em; }
.tgp-fmt-h p { margin: 4px 0 0; color: var(--muted); }
.tgp-kstats { display: flex; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.tgp-kstats div { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 12px 10px; border-left: 1px solid var(--line); }
.tgp-kstats div:first-child { border-left: 0; }
.tgp-kstats b { font-weight: 400; font-size: 20px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tgp-kstats span { font-size: 12px; color: var(--muted); }
.tgp-card { padding: 20px; border-radius: 16px; border: 1px solid var(--line); background: var(--ink2); }
.tgp-h { margin: 0 0 14px; font-weight: 400; font-size: 20px; line-height: 1.2; letter-spacing: -.02em; }

/* Profil */
.tgp-pf { margin: 0; }
.tgp-pf svg { display: block; width: 100%; height: 170px; overflow: visible; }
.tgp-pf-area { fill: color-mix(in srgb, var(--c) 14%, transparent); }
.tgp-pf-line { fill: none; stroke: var(--c); stroke-width: 2; vector-effect: non-scaling-stroke; }
.tgp-pf-aid line { stroke: var(--line); vector-effect: non-scaling-stroke; }
.tgp-pf-aid circle { fill: var(--paper); stroke: var(--ink2); stroke-width: 2; vector-effect: non-scaling-stroke; }
.tgp-pf-aid.is-cut circle { fill: var(--warn); }
.tgp-pf-ticks text { fill: var(--muted); font: 11px Aeonik, system-ui, sans-serif; }
.tgp-pf figcaption { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12px; color: var(--muted); }

/* Temps de passage : carte citron, sélecteur, liste */
.hbrp.tgp-race3 .tgp-etac { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 2px; padding: 16px; border-radius: 16px; background: var(--accent-fill); color: var(--on-accent); }
.tgp-etac span { font-size: 13px; }
.tgp-etac strong { font-weight: 500; font-size: 32px; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tgp-etac small { font-size: 13px; opacity: .75; }
.tgp-goal-ctl { display: flex; flex-direction: column; gap: 10px; margin: 12px 0 6px; }
.tgp-seg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 16px; background: var(--ink); }
.hbrp.tgp-race3 .tgp-seg button, .hbrp.tgp-race3 .tgp-seg button:hover, .hbrp.tgp-race3 .tgp-seg button:focus { min-height: 44px; padding: 6px 4px; border: 0; border-radius: 12px; background: none; color: var(--muted); font: 400 14px/1.1 Aeonik, system-ui, sans-serif; cursor: pointer; }
.hbrp.tgp-race3 .tgp-seg button[aria-pressed="true"] { background: var(--accent-fill); color: var(--on-accent); font-weight: 500; }
.tgp-goal { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--muted); }
.tgp-goal input { width: 120px; min-height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--ink); color: var(--paper); font: 400 17px Aeonik, system-ui, sans-serif; font-variant-numeric: tabular-nums; text-align: center; }
.tgp-goal input:focus { outline: none; border-color: var(--accent); }
.tgp-race3 .hbrp-tml { list-style: none; margin: 8px 0 0; padding: 0; }
.tgp-race3 .hbrp-tml-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 2px 12px; min-height: 64px; padding: 10px 0; border-top: 1px solid var(--line); }
.tgp-race3 .hbrp-tml-row:first-child { border-top: 0; }
.tgp-race3 .hbrp-tml-ic { display: grid; place-items: center; color: var(--muted); }
.tgp-race3 .hbrp-tml-ic .hbrp-ic { width: 20px; height: 20px; }
.tgp-race3 .hbrp-tml-row.is-assist .hbrp-tml-ic, .tgp-race3 .hbrp-tml-row.is-start .hbrp-tml-ic, .tgp-race3 .hbrp-tml-row.is-finish .hbrp-tml-ic { color: var(--accent); }
.tgp-race3 .hbrp-tml-pt { min-width: 0; }
.tgp-race3 .hbrp-tml-pt strong { display: block; font-weight: 500; font-size: 16px; line-height: 1.25; overflow-wrap: anywhere; }
.tgp-race3 .hbrp-tml-pt small { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; line-height: 1.3; }
.tgp-race3 .hbrp-tml-t { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tgp-race3 .hbrp-tml-t strong { display: block; font-weight: 500; font-size: 22px; line-height: 1.1; letter-spacing: -.02em; }
.tgp-race3 .hbrp-tml-t small { color: var(--muted); font-size: 12px; }
.tgp-race3 .hbrp-tml-row.is-finish .hbrp-tml-t strong { color: var(--accent); }
.tgp-cut { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.tgp-cut em { font-style: normal; padding: 2px 8px; border-radius: 99px; background: var(--ok-bg); color: var(--ok); }
.tgp-cut em:empty { display: none; }
.hbrp-tml-row.is-tight .tgp-cut em { background: var(--warn-bg); color: var(--warn); }
.hbrp-tml-row.is-late .tgp-cut em { background: var(--ko-bg); color: var(--ko); }
.hbrp-tml-row.is-late .hbrp-tml-t strong { color: var(--ko); }

/* Boutons (pilule, comme l'app) */
.tgp-fmt-cta { display: flex; flex-direction: column; gap: 10px; }
.hbrp.tgp-race3 .tgp-btn, .hbrp.tgp-race3 .tgp-btn:hover, .hbrp.tgp-race3 .tgp-btn:focus { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 22px; border-radius: 999px; border: 1px solid var(--line); background: var(--ink2); color: var(--paper) !important; font: 500 16px/1 Aeonik, system-ui, sans-serif; text-decoration: none; white-space: nowrap; cursor: pointer; }
.tgp-btn .hbrp-ic { width: 18px; height: 18px; }
.hbrp.tgp-race3 .tgp-btn-p, .hbrp.tgp-race3 .tgp-btn-p:hover, .hbrp.tgp-race3 .tgp-btn-p:focus { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent) !important; }
.tgp-btn:active { transform: scale(.98); }
@media (hover: hover) { .tgp-btn:hover, .tgp-pill:hover, .tgp-seg button:hover { filter: brightness(1.12); } }
.tgp-dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tgp-dl .tgp-btn { min-height: 48px; padding: 0 10px; font-size: 14px; }

/* Sections du bas : libellé discret + liste groupée */
.tgp-blk { margin-top: 40px; }
.tgp-lbl { margin: 0 0 10px; font-size: 13px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.tgp-group { border: 1px solid var(--line); border-radius: 16px; background: var(--ink2); overflow: hidden; }
.tgp-row { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--paper) !important; text-decoration: none; }
.tgp-row:first-child { border-top: 0; }
.tgp-row span { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tgp-row b { font-weight: 500; }
.tgp-row small { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.tgp-row .hbrp-ic { flex: none; width: 18px; height: 18px; color: var(--muted); }
.tgp-row:active { background: var(--hover); }
.tgp-gal { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.tgp-gal img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 12px; }
.tgp-claim, .hbrp.tgp-race3 p.tgp-claim { margin: 40px 0 0; text-align: center; font-size: 14px; }
.tgp-claim a { color: var(--muted); }
@media (max-width: 480px) { .tgp-kstats b { font-size: 17px; } .tgp-kstats div { padding: 10px 8px; } .tgp-card { padding: 16px; } .tgp-head { align-items: flex-start; } .tgp-rlogo { width: 56px; height: 56px; border-radius: 14px; } }

/* Fiche PDF : impression du format affiché */
@media print {
	html.tgp-printing body * { visibility: hidden; }
	html.tgp-printing .tgp-race3, html.tgp-printing .tgp-race3 * { visibility: visible; }
	html.tgp-printing .tgp-race3 { position: absolute; inset: 0 auto auto 0; width: 100%; max-width: none; padding: 0; --paper: #05060D; --muted: #555; --line: #ccc; --ink: #fff; --ink2: #fff; color: #05060D; }
	html.tgp-printing .tgp-crumb, html.tgp-printing .tgp-pills, html.tgp-printing .tgp-blk, html.tgp-printing .tgp-claim, html.tgp-printing .tgp-fmt-cta, html.tgp-printing .tgp-goal-ctl, html.tgp-printing .leaflet-control-container, html.tgp-printing .tgp-intro { display: none !important; }
	html.tgp-printing .tgp-map { height: 300px; break-inside: avoid; }
	html.tgp-printing .tgp-fmt[hidden] { display: none !important; }
	html.tgp-printing .hbrp-tml-row { break-inside: avoid; }
	html.tgp-printing .tgp-etac { border: 1px solid #05060D; }
}

/* Pages du catalogue (phase 3) */
.tgp-official { display: inline-flex; align-items: center; gap: 6px; margin: 12px 0 0; padding: 4px 12px 4px 8px; border-radius: 99px; background: var(--accent-fill); color: var(--on-accent); font-size: 13px; font-weight: 500; }
.tgp-official .hbrp-ic { width: 16px; height: 16px; color: var(--on-accent); }
.hbrp.tgp-race3 p.tgp-official { color: var(--on-accent); }
.tgp-meta a { color: inherit; }
.tgp-facts { margin: 0; padding: 0 0 0 1.1em; display: flex; flex-direction: column; gap: 8px; line-height: 1.5; }
.tgp-facts li::marker { color: var(--accent); }
.tgp-race3 .tgp-rows .hbrp-tml-row.tgp-noic, .tgp-race3 .tgp-nutri .hbrp-tml-row { grid-template-columns: 0 minmax(0, 1fr) auto; gap: 2px 0; }
.tgp-race3 .tgp-rows .hbrp-tml-t strong { font-size: 18px; }
.tgp-nutri { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.tgp-nutri-h { margin: 0 0 6px; font-weight: 400; font-size: 18px; letter-spacing: -.02em; }
.tgp-nutri-h em { font-family: 'Crimson Pro', Georgia, serif; font-style: italic; font-size: 1.19em; color: var(--accent); }
.tgp-race3 .tgp-nutri .hbrp-tml-t strong { font-size: 18px; }
.tgp-nutri-t { margin: 10px 0 0; font-size: 14px; }
.tgp-nutri-t b { font-weight: 500; }
.tgp-fcards { display: flex; flex-direction: column; gap: 16px; margin-top: 24px; }
.tgp-fcard { display: flex; flex-direction: column; gap: 12px; padding: 20px; border-radius: 16px; border: 1px solid var(--line); background: var(--ink2); }
.tgp-fcard h2 { margin: 0; display: flex; align-items: center; gap: 10px; font-weight: 400; font-size: 24px; letter-spacing: -.02em; }
.tgp-fcard h2::before { content: ""; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--accent)); }
.tgp-fcard-w { margin: -6px 0 0; color: var(--muted); font-size: 14px; }
.tgp-fcard .tgp-pf svg { height: 120px; }
.tgp-fcard-cta { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
@media (max-width: 480px) { .tgp-fcard-cta { grid-template-columns: 1fr; } .tgp-fcard { padding: 16px; } }
.tgp-cal-f { display: flex; flex-direction: column; gap: 10px; margin: 20px 0 8px; }
.hbrp.tgp-race3 .tgp-cal-f input, .hbrp.tgp-race3 .tgp-cal-f select { width: 100%; min-height: 52px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background-color: var(--ink2); color: var(--paper); font: 400 17px Aeonik, system-ui, sans-serif; }
.tgp-cal-sel { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tgp-cal-dist { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.tgp-cal-m { margin-top: 28px; }
.tgp-cal .tgp-group { margin: 0; }
.tgp-cal-d { color: var(--accent) !important; }
.tgp-cal-r[hidden], .tgp-cal-m[hidden], .tgp-group[hidden] { display: none !important; }

/* Logos des épreuves dans le calendrier */
.tgp-cal-r { gap: 14px; }
.tgp-cal-logo { flex: none; width: 48px; height: 48px; border-radius: 12px; background: #fff; object-fit: contain; padding: 4px; box-sizing: border-box; }
.tgp-cal-logo.is-empty { display: grid; place-items: center; padding: 0; background: var(--hover); color: var(--accent); font-style: normal; font-size: 20px; font-weight: 500; }

.tgp-cal-logo.is-dark, .tgp-rlogo.is-dark { background: var(--hover); }

/* Formats sous forme d'onglets : la distance en gros, le nom dessous (le format choisi en avant). */
.tgp-pill span { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; line-height: 1.2; text-align: left; font-size: 13px; }
.tgp-pill span b { font-weight: 500; font-size: 16px; font-variant-numeric: tabular-nums; }
/* Carte : bouton plein écran, choix du fond, noms des points de passage. */
.hbrp.tgp-race3 .tgp-map .tgp-fullbtn, .hbrp.tgp-race3 .tgp-map .tgp-fullbtn:hover, .hbrp.tgp-race3 .tgp-map .tgp-fullbtn:focus { position: absolute; display: inline-flex; align-items: center; width: auto; height: auto; box-shadow: 0 2px 10px rgba(0,0,0,.35); z-index: 500; left: 50%; bottom: 12px; transform: translateX(-50%); min-height: 40px; padding: 0 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--ink); color: var(--paper); font: 500 14px/1 Aeonik, system-ui, sans-serif; cursor: pointer; white-space: nowrap; }
.tgp-mapbox.is-full { position: fixed; inset: 0; z-index: 99999; margin: 0; padding: calc(8px + env(safe-area-inset-top, 0px)) 8px calc(8px + env(safe-area-inset-bottom, 0px)); background: var(--ink); display: flex; flex-direction: column; gap: 8px; }
.tgp-mapbox.is-full .tgp-pills { margin: 0; flex: none; max-height: 30vh; overflow: auto; }
.tgp-mapbox.is-full .tgp-map { flex: 1 1 auto; height: auto; min-height: 0; }
.tgp-mapbox.is-full .tgp-fine { display: none; }
html.tgp-nofs, html.tgp-nofs body { overflow: hidden; }
.leaflet-tooltip.tgp-tip { padding: 2px 6px; border: 0; border-radius: 6px; background: rgba(5, 6, 13, .82); color: #fff; font: 500 12px/1.3 Aeonik, system-ui, sans-serif; box-shadow: none; }
.leaflet-tooltip.tgp-tip::before { display: none; }
.tgp-map .leaflet-control-layers { border: 1px solid var(--line); border-radius: 12px; background: var(--ink); color: var(--paper); font: 400 14px/1.4 Aeonik, system-ui, sans-serif; }
.tgp-map .leaflet-control-layers-toggle { width: 40px; height: 40px; background-color: #fff; border-radius: 11px; }
.tgp-map .leaflet-control-layers:not(.leaflet-control-layers-expanded) { background: #fff; }
.tgp-map .leaflet-control-layers-expanded { padding: 10px 12px; }
.tgp-map .leaflet-control-layers label { margin: 4px 0; }
/* Partager, et le mot de l'organisateur sur le GPX */
.tgp-share .hbrp-ic { width: 18px; height: 18px; }
.tgp-nogpx { margin: 0; text-align: center; }
@media print { .tgp-fullbtn, .tgp-share, .leaflet-control-layers { display: none !important; } }
@media (max-width: 640px) {
	.tgp-pills { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.hbrp.tgp-race3 .tgp-pill, .hbrp.tgp-race3 .tgp-pill:hover, .hbrp.tgp-race3 .tgp-pill:focus { justify-content: flex-start; }
	.tgp-map .leaflet-top.leaflet-right { top: 44px; }
}
