
/* ========================================
   GPX-HÖHENPROFILE – BASIS
   ======================================== */

.gpxhp {

  /* Globale Distanzfarbe */
  --accent: var(--gravel-solo);

  /* Neutrale Farben */
  --ink: #171c1b;
  --muted: #66716e;
  --stroke: #dce5e1;
  --surface: #fff;
  --wash: #f5f8f7;

  /* ========================================
     CANVAS-DIAGRAMM – FARBEN
     ======================================== */

  --gpxhp-grid: #e4eae7;
  --gpxhp-axis: #6b7672;

  /* Höhenkurve */
  --gpxhp-line: var(--accent);

  /* Farbverlauf unter der Höhenkurve */
  --gpxhp-fill-top:
    color-mix(in srgb, var(--accent) 40%, transparent);

  --gpxhp-fill-bottom:
    color-mix(in srgb, var(--accent) 3.5%, transparent);

  /* VP-Markierungen */
  --gpxhp-vp-guide:
    color-mix(in srgb, var(--accent) 48%, transparent);

  --gpxhp-vp-dot-fill: #fff;
  --gpxhp-vp-dot-stroke: var(--accent);
  --gpxhp-vp-label: var(--accent);

  /* Hover-Markierungen */
  --gpxhp-hover-guide: #33443e;
  --gpxhp-hover-dot: #171c1b;

  /* Staffel-Wechselzonen */
  --gpxhp-relay-guide: rgba(80, 90, 88, .65);
  --gpxhp-relay-dot: #2a3633;
  --gpxhp-relay-label: #2a3633;

  /* Tooltip */
  --gpxhp-tooltip-bg: #171c1b;
  --gpxhp-tooltip-fg: #fff;

  /* Äußeres Layout */
  background: transparent;
  color: var(--ink);
  border: 0;
  border-radius: 0;
  padding: 0;
  font: inherit;
  max-width: none;
  margin: 0;
  box-shadow: none;
}


/* ========================================
   GPX – DISTANZFARBEN
   ======================================== */

/* Marathon Solo – Grün */
.gpxhp.marathonsolo {
  --accent: var(--gravel-solo);
}

/* Marathon Staffel – Gelb */
.gpxhp.marathonstaffel {
  --accent: var(--gravel-staffel);
}

/* Dreiviertelmarathon – Rot */
.gpxhp.dreiviertelmarathon {
  --accent: var(--gravel-dreiviertel);
}

/* Halbmarathon – Violett */
.gpxhp.halbmarathon {
  --accent: var(--gravel-halb);
}


/* ========================================
   ALLGEMEINE ELEMENTE
   ======================================== */

.gpxhp * {
  box-sizing: border-box;
}

.gpxhp [hidden] {
  display: none !important;
}


/* ========================================
   TITEL UND BEDIENHINWEIS
   ======================================== */

.gpxhp .gpxhp-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.gpxhp h3 {
  font-size: clamp(20px, 3vw, 29px);
  font-weight: 750;
  color: var(--ink);
  line-height: 1.25;
  margin: 0 !important;
}

.gpxhp .gpxhp-cursor {
  background: var(--wash);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  color: var(--muted);
  padding: 9px 12px;
  font-size: 13px;
  white-space: nowrap;
}

.gpxhp .gpxhp-cursor b {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}


/* ========================================
   STATISTIK-KACHELN
   ======================================== */

.gpxhp .gpxhp-stats {
  display: grid;
  grid-template-columns: repeat(
    auto-fit,
    minmax(min(170px, 100%), 1fr)
  );
  gap: 10px;
  margin: 19px 0 15px;
}

.gpxhp .gpxhp-stat {
  background: var(--wash);
  border: 1px solid #edf0ef;
  border-radius: 12px;
  padding: 11px 14px;
}

.gpxhp .gpxhp-stat span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 3px;
}

.gpxhp .gpxhp-stat strong {
  font-size: clamp(15px, 2.2vw, 22px);
  line-height: 1.25;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}


/* ========================================
   HÖHENPROFIL – CANVAS
   ======================================== */

.gpxhp .gpxhp-chart {
  position: relative;
  min-width: 0;
}

.gpxhp canvas {
  display: block;
  width: 100%;
  height: 280px;
  touch-action: pan-y;
  cursor: crosshair;
}


/* ========================================
   TOOLTIP
   ======================================== */

.gpxhp .gpxhp-tooltip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  transform: translate(-50%, -100%);
  white-space: nowrap;
  padding: 7px 11px;
  border-radius: 7px;

  background: var(--gpxhp-tooltip-bg);
  color: var(--gpxhp-tooltip-fg);

  font: 600 12px/1.3 system-ui, Arial, sans-serif;

  box-shadow: 0 3px 10px rgba(0,0,0,.12);
  font-variant-numeric: tabular-nums;
}

.gpxhp .gpxhp-tooltip[data-placement="bottom"] {
  transform: translate(-50%, 0);
}


/* ========================================
   WEGPUNKT-LEISTE
   ======================================== */

.gpxhp .gpxhp-vps {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 16px;
}

.gpxhp .gpxhp-vptitle {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  margin-right: 5px;
}


/* ========================================
   WEGPUNKT-BUTTONS
   ======================================== */

.gpxhp .gpxhp-vp {
  appearance: none;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);

  font-size: 12px;
  font-family: inherit;
  font-weight: 650;

  padding: 7px 10px;
  cursor: pointer;
  white-space: nowrap;

  transition:
    background .15s ease,
    border-color .15s ease;
}

.gpxhp .gpxhp-vp b {
  color: var(--accent);
  font-weight: 750;
  margin-right: 5px;
}


/* ========================================
   WEGPUNKTE – HOVER & AKTIV
   ======================================== */

.gpxhp .gpxhp-vp:hover,
.gpxhp .gpxhp-vp:focus-visible,
.gpxhp .gpxhp-vp[aria-pressed="true"] {
  background:
    color-mix(in srgb, var(--accent) 13%, white);

  border-color: var(--accent);
  outline-offset: 2px;
}


/* ========================================
   LADEHINWEIS / FEHLERMELDUNG
   ======================================== */

.gpxhp .gpxhp-status {
  padding: 15px;
  background: var(--wash);
  border-radius: 10px;
  font-size: 13px;
  color: var(--muted);
  margin-top: 14px;
}

.gpxhp .gpxhp-status[hidden] {
  display: none;
}


/* ========================================
   RESPONSIVE – MOBILE
   ======================================== */

@media (max-width: 620px) {

  .gpxhp .gpxhp-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gpxhp canvas {
    height: 235px;
  }

  .gpxhp .gpxhp-vps {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 8px;
  }

  .gpxhp .gpxhp-vptitle {
    flex: 0 0 auto;
  }

}
