/* Strecke: Etappen und die gemeinsame Distanzachse des Seitenprofils. */
@media screen {
.profil.vollbild .pf-flaeche { overflow-y: auto; }
.pf-route { position: relative; font: calc(var(--schrift-neben) * var(--fs))/1.4 var(--font); }
.pf-route-achse { position: relative; height: calc(44px + 4.2em); padding: 0; margin: 0; list-style: none; }
.pf-route-platz { position: absolute; top: 44px; display: grid; justify-items: center; transform: translateX(-50%); white-space: nowrap; }
.pf-route-start { transform: none; justify-items: start; }
.pf-route-ziel { transform: translateX(-100%); justify-items: end; }
.pf-route-name { display: flex; align-items: center; gap: 4px; color: var(--t-label); }
.pf-route-id { font-weight: 600; }
.pf-route-zeit, .pf-route-boden { color: var(--t-label-2); }
.pf-route .sym { --sym: calc(16px * var(--fs)); }
.pf-route-etappe { position: absolute; top: 0; }
.pf-route-knopf { display: flex; justify-content: center; align-items: center; gap: 4px; width: 100%; min-height: 44px; padding: 2px 4px; border: 0; border-radius: var(--r-control); font: inherit; background: none; color: var(--t-accent); }
.pf-route-werte { white-space: nowrap; }
.pf-route-wegpunkte { position: relative; }
.pf-route-wegpunkt { position: absolute; text-align: center; white-space: nowrap; color: var(--t-label-2); }
.pf-route-summe { flex: 1 0 100%; margin: 0; font: calc(var(--schrift-neben) * var(--fs))/1.4 var(--font); color: var(--t-label-2); }
.pf-route-summe b { font-weight: 600; color: var(--t-label); }
.pf-route-lokal { height: 4.2em; }
.pf-route-lokal .pf-route-start { top: 0; }
/* Zuklappen betrifft die Höhenzeichnung; Befunde und Etappenzugriff bleiben sichtbar. */
.profil.zu .pf-inhalt { display: grid; }
.profil.zu:not(.vollbild) :is(.pf-svg, .pf-wind, .pf-legende, .lr-hinweis, .pf-wischen) { display: none; }
}
@media print { .pf-route, .pf-route-summe { display: none !important; } }

/* Gemeinsames Profil unter der Karte; am iPhone bleibt es im Kartenbereich.
   Lange Reisen bleiben waagerecht scrollbar. Die Annahmen lassen sich vollständig aufklappen. */
@media (min-width: 768px) {
  .pf-route-summe { flex: 1 1 auto; }
  #abschnitt-karte.layout-proto { max-height: none; padding: 6px 14px; gap: 2px; }
  .layout-proto > :is(.urteilsleiste, .ergebnisleiste) { margin-bottom: 0; }
  .layout-proto .ul-kopf { padding-block: 6px; }
  .layout-proto > .ergebnisleiste { padding-block: 6px; }
  .layout-proto #kopf-abhilfe { margin-top: 4px; padding-bottom: 6px; }
  @media screen {
    html:not([data-ansicht="briefing"]) .workspace-side:not(.expanded) #abschnitt-karte > .route-map { height: var(--kartenhoehe); min-height: var(--kartenhoehe); flex: none; }
  }

  .layout-proto #abschnitt-profil { order: 0; margin: 0; padding: 2px 0 0; border: 0; border-top: 1px solid var(--t-sep); border-radius: 0; box-shadow: none; background: none; }
  .layout-proto #profil .pf-inhalt.mit-wind { grid-template-columns: minmax(0, 1fr) 320px; column-gap: 8px; }
  .layout-proto #profil .pf-wind { grid-column: 2; grid-row: 1; grid-template-rows: auto minmax(60px, 1fr) auto; padding: 2px 6px; }
  .layout-proto #profil .pf-fuss { grid-column: 1 / -1; grid-row: 2; }
  .layout-proto .pf-flaeche { align-self: start; }
  .layout-proto .wk-kopf { flex-wrap: wrap; white-space: normal; }
  .layout-proto #profil { gap: 2px; }
  .layout-proto .pf-kopf { gap: 0 6px; }
  .layout-proto .pf-inhalt { row-gap: 2px; }
  .layout-proto > .hint { margin: 0; font-size: calc(12px * var(--fs, 1)); line-height: 1.35; }
  /* Die gemeinsame Kartenkarte nennt die Anzeigegrenze einmal am Profil; beim Zuklappen bleibt der Kartenhinweis sichtbar. */
  .layout-proto:has(.profil:not(.zu)) > .karte-lr-hinweis { display: none; }
}
@media (min-width: 768px) and (orientation: portrait) {
  /* Auf der schmalen Kartenfläche teilen die Etappen die volle Bandbreite oberhalb der Platzzeile. */
  /* Neben der Seitenleiste bleibt das Profil breit; Wind darunter nutzt die ganze Kartenbreite. */
  .layout-proto #profil .pf-inhalt.mit-wind { grid-template-columns: minmax(0, 1fr); }
  .layout-proto #profil .pf-wind { grid-column: 1; grid-row: 2; grid-template-columns: minmax(100px, 1fr) 280px; grid-template-rows: auto auto; }
  .layout-proto .wk-kopf { grid-column: 1 / -1; }
  .layout-proto .wk-bild { min-height: 90px; }
  .layout-proto #profil .pf-fuss { grid-row: 3; }
}

/* ---------- Etappen & Kraftstoff ---------- */
.etappen { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 10px; }
.etappe-karte { display: block; margin: 0; }
details.etappe { scroll-margin-top: calc(var(--toolbar-h, 0px) + 12px); }
@media (max-width: 767px) { details.etappe { scroll-margin-top: 12px; } }
/* Navlog als Karten am iPhone: lange Spaltennamen („Steuerkurs mwSK“) umbrechen statt die Nachbarspalte zu überdecken */
:is(.et-inhalt, #legs) table.cards td:not([data-k="title"])::before { white-space: normal; overflow-wrap: anywhere; }
details.etappe { border-radius: var(--r-group, 12px); background: var(--t-surface-2); }
details.etappe > summary { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; row-gap: 2px; align-items: baseline; min-height: 44px;
  padding: 12px 14px; list-style: none; cursor: pointer; border-radius: inherit; }
details.etappe > summary::-webkit-details-marker { display: none; }
details.etappe > summary::before { content: ""; grid-row: 1 / span 2; align-self: center; width: 9px; height: 9px; border: solid var(--t-label-2); border-width: 0 2px 2px 0;
  transform: rotate(-45deg); transition: transform 160ms ease; }
details.etappe[open] > summary::before { transform: rotate(45deg); }
details.etappe > summary:focus-visible { outline: 2px solid var(--t-accent); outline-offset: 2px; }
.et-titel { grid-column: 2; font: 600 calc(var(--schrift-abschnitt, 17px) * var(--fs, 1))/1.3 var(--font); color: var(--t-label); }
.et-meta { grid-column: 2; color: var(--t-label-2); font-size: calc(var(--schrift-neben, 14px) * var(--fs, 1)); font-variant-numeric: tabular-nums; }
.et-meta .t-bad { color: var(--t-bad-text); font-weight: 600; }
.et-inhalt { display: grid; gap: 8px; padding: 0 14px 14px; min-width: 0; container: etappe / inline-size; }
/* Winddreiecke nicht über die ganze Breite aufblähen (iPad hoch: eine Spalte von ~450 px) */
.et-inhalt .wd-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 340px)); }
#legs { container: etappe / inline-size; }
/* Etappenübersicht und Navlog als Kartenliste, sobald die Etappe schmal ist (iPad hoch neben der Seitenleiste), nicht erst ab Handybreite:
   dieselben Regeln wie komponenten.css (Handybreite, A12), hier an der Breite der Etappe */
@container etappe (max-width: 640px) {
  :is(.et-inhalt, #legs) table.cards, :is(.et-inhalt, #legs) table.cards tbody { display: block; }
  :is(.et-inhalt, #legs) table.cards thead { display: none; }
  :is(.et-inhalt, #legs) table.cards tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 10px; padding: 10px 12px; margin-bottom: 8px; border: 0; border-radius: 12px; background: var(--t-surface); }
  :is(.et-inhalt, #legs) table.cards td { display: grid; gap: 1px; padding: 0; border: 0; text-align: left; white-space: normal; order: 5; font-size: calc(var(--schrift-neben, 14px) * var(--fs, 1)); }
  :is(.et-inhalt, #legs) table.cards td::before { content: attr(data-label); font: 600 calc(var(--schrift-neben, 13px) * var(--fs, 1))/1.2 var(--font); color: var(--t-label-2); }
  :is(.et-inhalt, #legs) table.cards td[data-k="title"] { grid-column: 1 / -1; order: 0; font: 600 calc(var(--schrift-abschnitt, 17px) * var(--fs, 1))/1.25 var(--font); color: var(--t-label); }
  :is(.et-inhalt, #legs) table.cards td[data-k="title"]::before, :is(.et-inhalt, #legs) table.cards td.empty { display: none; }
  :is(.et-inhalt, #legs) table.cards td:not([data-k="title"]) { white-space: nowrap; }
  :is(.et-inhalt, #legs) table.cards td[data-k="time"] { order: 1; } :is(.et-inhalt, #legs) table.cards td[data-k="course"] { order: 2; } :is(.et-inhalt, #legs) table.cards td[data-k="fuel"] { order: 3; }
  :is(.et-inhalt, #legs) table.cards td:is([data-k="time"], [data-k="course"], [data-k="fuel"]) { font-size: calc(var(--schrift-text, 16px) * var(--fs, 1)); font-weight: 600; }
  :is(.et-inhalt, #legs) table.cards tr.total { border-top: 2px solid var(--t-label); }
  :is(.et-inhalt, #legs) table.cards tr.hw-zeile { display: block; }
  #legs table.cards tr { grid-template-columns: repeat(auto-fit, minmax(min(100%, calc(100px * var(--fs, 1))), 1fr)); background: var(--t-surface-2); }
  #legs table.cards td[data-k="fuel2"] { order: 4; }
}

.et-zwischen { margin: 10px 0 0; font: 600 calc(var(--schrift-text, 15px) * var(--fs, 1))/1.3 var(--font); color: var(--t-label); }
.et-inhalt .table-scroll { margin: 0; }
.et-inhalt .fuelline, .et-inhalt .asp-line { margin: 2px 0; font-size: calc(var(--schrift-neben, 14px) * var(--fs, 1)); }
.et-inhalt .jleg-steps .jstep { background: var(--t-surface); }
.et-inhalt .jstep > .sym { position: absolute; top: 10px; right: 10px; --sym: calc(18px * var(--fs, 1)); }
.etappen .jleg-alt { padding: 12px 14px; border-radius: var(--r-group, 12px); background: var(--t-surface-2); display: grid; gap: 8px; }
/* Etappenname in der Tabelle öffnet die Etappe */
.legs .et-oeffnen { padding: 0; min-height: 0; border: 0; background: none; color: var(--t-accent); font: inherit; font-weight: 600; text-align: left; text-transform: none; letter-spacing: 0; }
.legs .et-oeffnen:hover:not(:disabled) { background: none; border: 0; text-decoration: underline; }
@media (pointer: coarse) { .legs .et-oeffnen { min-height: 44px; } }
@media (prefers-reduced-motion: reduce) { details.etappe > summary::before { transition: none; } }

/* Übungsmodus: Ergebnisse ausgeblendet, bis „Lösung zeigen“ (visibility nimmt sie auch Screenreadern) */
html[data-uebung="an"]:not([data-uebung-loesung="an"]) :is(.pf-route-werte, .pf-route-zeit, .pf-route-summe, .pf-route-name .sym, .pf-route-name .sr-only, .pf-route-boden, .pf-route-knopf > .sym, .pf-route-knopf > .sr-only, .et-meta, .et-inhalt, .gk-urteil > .sym, .jleg-alt .jleg-steps, .pf-hk-ok-text) { visibility: hidden; }

@media screen {
  .map-hilfe { font-size: calc(var(--schrift-neben) * var(--fs)); color: var(--t-label-2); }
  .map-hilfe summary { cursor: pointer; min-height: 28px; font: inherit; }
  .map-hilfe .hint { margin: 2px 0; }
  html[data-planstand="leer"] .map-hilfe, html[data-ansicht="briefing"] .map-hilfe, .workspace-side.expanded .map-hilfe { display: none; }
  @media (pointer: coarse) { .map-hilfe summary { min-height: 44px; } }
}
