/* ═══════════════════════════════════ CHIFFRES-CLÉS, PROFIL ET TRACE ═══════════════════════════════════
   Fiche parcours (single-parcours.php) et éditeur de repères dans l'admin.
   Les couleurs du thème ont un repli : l'admin ne charge pas style.css. */

.flc-topo {
  --t-ink: var(--ink, #1C2B1A);
  --t-cream: var(--cream, #FDFAF5);
  --t-yellow: var(--yellow, #F8C462);
  --t-orange: var(--orange, #D4520C);
  --t-green: var(--green, #758E4F);
  --t-mono: 'DM Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --t-ui: var(--U, 'Quicksand', sans-serif);
  /* Fond du panneau de la trace : décliné selon la couleur du parcours. */
  --t-panel: #3d4a2b;
  --t-line: var(--t-yellow);

  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr);
  gap: 28px;
  align-items: stretch;
  color: var(--t-ink);
}
/* Panneau du profil : version sombre de la couleur du niveau (variables posées par flc_parcours_vars). */
.flc-topo[style*="--pc-dark"] { --t-panel: var(--pc-dark); }

.flc-topo-main { display: flex; flex-direction: column; gap: 26px; min-width: 0; }

/* Cartes */
.flc-topo-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 22px; }
.flc-topo-card {
  position: relative; overflow: hidden;
  background: #fffdf8; border: 1px solid rgba(28,43,26,0.16); border-radius: 10px;
  padding: 30px 22px 18px; box-shadow: 0 1px 2px rgba(28,43,26,0.06);
}
.flc-topo-card::before { content: ''; position: absolute; inset: 0 0 auto; height: 11px; background: var(--t-yellow); }
.flc-topo-card.is-orange::before { background: var(--t-orange); }
.flc-topo-card.is-vert::before   { background: var(--t-green); }
.flc-topo-card .v { font-family: var(--t-mono); font-weight: 400; font-size: clamp(30px, 3vw, 40px); line-height: 1; letter-spacing: -0.02em; white-space: nowrap; }
.flc-topo-card .v small { font-size: 0.4em; letter-spacing: 0; margin-left: 0.35em; }
.flc-topo-card .v.is-empty { color: rgba(28,43,26,0.35); }
.flc-topo-card .k { margin-top: 14px; font-family: var(--t-ui); font-size: 14px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; line-height: 1.3; }
.flc-topo-card .k span { display: block; margin-top: 4px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; opacity: 0.6; }

/* Chemins / routes : barre bicolore, les chemins hachurés d'abord, l'asphalte en plein ensuite. */
.flc-topo-card .revet { display: flex; gap: 2px; height: 10px; margin-top: 14px; border-radius: 5px; overflow: hidden; }
/* Deux valeurs sur la ligne : un peu plus petites, et la part « routes » passe
   à la ligne d'un bloc si la carte est trop étroite. */
.flc-topo-card.is-revet .v { white-space: normal; font-size: clamp(26px, 2.4vw, 34px); }
.flc-topo-card .revet-suite, .flc-topo-card.is-revet .v small { white-space: nowrap; }
.flc-topo-card .revet-sep { margin: 0 0.3em; opacity: 0.35; }
.revet-route { background: var(--t-ink); }
.revet-chemin { background: repeating-linear-gradient(135deg, var(--t-green) 0 4px, #b5c497 4px 7px); }

/* Difficulté : une jauge de cinq icônes par niveau.
   Physique : des montagnes oranges ; technique : des cailloux verts. */
.flc-topo-card.is-niveaux { display: flex; flex-direction: column; gap: 14px; }
.niv {
  --niv-c: var(--t-orange);
  --niv-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 18'%3E%3Cpath d='M0 18 8 4l4 5 5-8 6 17z'/%3E%3C/svg%3E");
  display: flex; flex-direction: column; gap: 6px;
}
.niv--technique {
  --niv-c: var(--t-green);
  --niv-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 18'%3E%3Cpath d='M1 18 3 11 8 7 14 8 17 12 18 18zM19 18 20 15 23 14 25 18z'/%3E%3C/svg%3E");
}
/* Le formulaire d'inscription a aussi une classe .niv (style.css) : on neutralise
   ses cadres ici, sinon chaque niveau devient une grosse case cliquable. */
.flc-topo .niv { padding: 0; background: none; border: 0; border-radius: 0; cursor: default; transform: none; box-shadow: none; }
.niv-k { font-family: var(--t-ui); font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(28,43,26,0.6); }
.niv-jauge {
  position: relative; display: block; width: 130px; height: 18px;
  background: rgba(28,43,26,0.13);
  -webkit-mask: var(--niv-ico) 0 0 / 26px 18px repeat-x;
          mask: var(--niv-ico) 0 0 / 26px 18px repeat-x;
}
.niv-jauge span { position: absolute; inset: 0 auto 0 0; background: var(--niv-c); }
.flc-topo-card.is-niveaux .k { margin-top: auto; padding-top: 2px; }

/* Profil altimétrique */
.flc-topo-profile { position: relative; margin-top: auto; min-height: 120px; }
.flc-topo-profile svg, .flc-topo-shape svg { display: block; overflow: visible; }
.flc-topo svg text { font-family: var(--t-mono); }
.topo-prof-area { fill: #dcdcd6; }
.topo-prof-line { fill: none; stroke: var(--t-ink); stroke-width: 1.4; stroke-linejoin: round; }
.topo-rep line { stroke: rgba(28,43,26,0.5); stroke-width: 1; }
.topo-rep text { font-size: 12px; fill: var(--t-ink); }
.topo-rep.is-fort line { stroke: var(--t-orange); }
.topo-rep.is-fort text { fill: var(--t-orange); font-weight: 500; }
.topo-guide line { stroke: var(--t-ink); stroke-width: 1; stroke-dasharray: 3 3; }
.topo-guide text { font-size: 11px; fill: var(--t-ink); paint-order: stroke; stroke: var(--t-cream); stroke-width: 4px; stroke-linejoin: round; }
.topo-guide circle { fill: var(--t-cream); stroke: var(--t-ink); stroke-width: 1.5; }
.topo-axe line { stroke: rgba(28,43,26,0.3); stroke-width: 1; }
.topo-axe line.is-grille { stroke: rgba(28,43,26,0.18); stroke-dasharray: 2 3; }
.topo-axe text { font-size: 10px; fill: rgba(28,43,26,0.55); }

/* Trace sans fond de carte */
.flc-topo-shape { position: relative; min-height: 440px; border-radius: 14px; background: var(--t-panel); overflow: hidden; }
.flc-topo-shape svg { position: absolute; inset: 0; }
.topo-rings path { fill: none; stroke: rgba(0,0,0,0.2); stroke-width: 1; stroke-linecap: round; }
.topo-rings path.is-maitre { stroke: rgba(0,0,0,0.3); stroke-width: 1.6; }
.topo-path { fill: none; stroke: var(--t-line); stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round; }
.topo-lieu text { font-size: 10px; fill: rgba(253,250,245,0.62); letter-spacing: 0.02em; }
.topo-lieu circle { fill: var(--t-line); }
.topo-lieu.is-fort text { fill: var(--t-line); font-weight: 500; }
.topo-curseur { fill: var(--t-cream); stroke: var(--t-ink); stroke-width: 2; }

/* Sans GPX : les cartes seules, sur trois colonnes */
.flc-topo--sans-trace { grid-template-columns: 1fr; }
.flc-topo--sans-trace .flc-topo-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Section de la fiche */
.trace-topo {
  position: relative; padding: clamp(20px, 4svh, 56px) 64px clamp(16px, 3svh, 40px); border-bottom: 3px solid var(--ink, #1C2B1A); overflow: hidden;
}
/* Lignes de niveau à peine visibles derrière les cartes (dessinées par trace-topo.js). */
.trace-topo-bg { position: absolute; inset: 0; pointer-events: none; }
.trace-topo-bg svg { display: block; }
.topo-bg-lignes path { fill: none; stroke: rgba(28,43,26,0.08); stroke-width: 1; stroke-linecap: round; }
.topo-bg-lignes path.is-maitre { stroke: rgba(28,43,26,0.13); stroke-width: 1.4; }
.trace-topo > .flc-topo, .trace-topo > .flc-topo-legende { max-width: 1440px; margin-left: auto; margin-right: auto; position: relative; }
.flc-topo-legende { margin-top: clamp(8px, 1.6svh, 18px); font-size: 14px; line-height: 1.5; color: rgba(28,43,26,0.75); }

/* Éditeur de repères (admin) */
.flc-rep-editor .flc-topo--admin { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; padding: 16px; background: #fdfaf5; border: 1px solid #dcdcde; border-radius: 6px; }
.flc-rep-editor .flc-topo-profile { margin-top: 0; }
.flc-rep-editor .flc-topo-shape { min-height: 340px; }
.flc-rep-info { margin: 0 0 12px !important; }
.flc-rep-table { margin-top: 4px; }
.flc-rep-table th, .flc-rep-table td { vertical-align: middle; }
.flc-rep-table td.flc-rep-km { white-space: nowrap; width: 150px; }
.flc-rep-table td.flc-rep-km input { width: 78px !important; }
.flc-rep-table td.flc-rep-km .description { margin-left: 8px; }
.flc-rep-table td.flc-rep-check { width: 56px; text-align: center; }

/* Écran large mais bas (portable) : tout se resserre pour que l'entête, les
   chiffres-clés et le bandeau « En bref » tiennent ensemble à l'ouverture. */
@media (min-width: 1025px) and (max-height: 960px) {
  .flc-topo { gap: 22px; }
  .flc-topo-main { gap: 16px; }
  .flc-topo-cards { gap: 12px 18px; }
  .flc-topo-card { padding: 22px 18px 14px; }
  .flc-topo-card::before { height: 8px; }
  .flc-topo-card .k { margin-top: 10px; }
  .flc-topo-card.is-niveaux { gap: 10px; }
  .flc-topo-shape { min-height: 0; }
  .flc-topo-profile { min-height: 140px; }
}
@media (max-width: 1024px) {
  .flc-topo { grid-template-columns: 1fr; }
  .flc-topo-shape { min-height: 0; aspect-ratio: 1 / 1; max-height: 640px; }
  .flc-topo--sans-trace .flc-topo-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .trace-topo { padding: 36px 22px 28px; }
  .trace-topo-bg { display: none; }
  .flc-topo-cards { gap: 12px; }
  .flc-topo-card { padding: 24px 14px 14px; }
  .flc-topo-card .k { font-size: 12px; }
  .topo-rep text { font-size: 11px; }
}
@media (max-width: 480px) {
  .trace-topo { padding-left: 16px; padding-right: 16px; }
  .flc-topo-card .v { font-size: 26px; }
}
