/* Deltriva Homepage – Bausteine-Tunnel (Präfix tu-, alles unter .tu)
   Grundzustand (ohne JS / reduzierte Bewegung): Titel + ruhiges Kartenraster.
   .tu-an (von tunnel.js gesetzt): hoher Abschnitt, Bühne sticky; transform/opacity der bewegten Teile schreibt tunnel.js direkt. */

.tu { position: relative; background: var(--grund); color: var(--text);
  --tu-ring: color-mix(in srgb, var(--primaer) 22%, transparent);
  --tu-ring2: color-mix(in srgb, var(--primaer) 16%, transparent);
  --tu-punkt: color-mix(in srgb, var(--primaer) 30%, transparent);
  --tu-schatten: 0 26px 50px -26px rgba(11, 42, 47, .5), 0 6px 16px -8px rgba(11, 42, 47, .2);
  --tu-ecke: color-mix(in srgb, var(--primaer) 55%, transparent); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tu { --tu-schatten: 0 26px 50px -24px rgba(0, 0, 0, .75), 0 6px 16px -8px rgba(0, 0, 0, .5);
    --tu-punkt: color-mix(in srgb, var(--primaer) 22%, transparent); }
}
:root[data-theme="dark"] .tu { --tu-schatten: 0 26px 50px -24px rgba(0, 0, 0, .75), 0 6px 16px -8px rgba(0, 0, 0, .5);
  --tu-punkt: color-mix(in srgb, var(--primaer) 22%, transparent); }

/* ---------- Bühne: Gitter, Licht, Ringe ---------- */
.tu-buehne { position: relative; padding: 84px 16px 40px; overflow: clip; }
.tu-gitter, .tu-licht { position: absolute; inset: 0; pointer-events: none; }
.tu-gitter { background-image: radial-gradient(var(--tu-punkt) 1px, transparent 1.2px); background-size: 28px 28px; background-position: center;
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, #000 55%, transparent 100%);
  mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, #000 55%, transparent 100%); opacity: .8; }
.tu-licht { --mx: 50%; --my: 50%; }
.tu-ring { display: none; }

/* ---------- Mitte: Titel ---------- */
.tu-welt { position: relative; }
.tu-hof { display: none; }
.tu-mitte { position: relative; max-width: 780px; margin: 0 auto; text-align: center; padding: 28px 32px; }
.tu-mitte h2 { font-size: clamp(32px, 4.6vw, 62px); line-height: 1.02; letter-spacing: -0.03em; }
.tu-mitte h2 span { display: block; color: var(--primaer); }
.tu-leit { margin: 18px auto 0; max-width: 56ch; font-size: clamp(15.5px, 1.15vw, 17px); color: var(--schwach); text-wrap: pretty; }
.tu-fuss { margin-top: 18px; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 18px; font-size: 13px; color: var(--schwach); }
.tu-sprung { font-weight: 600; font-size: 14.5px; display: inline-flex; align-items: center; gap: 6px; }
.tu-sprung::after { content: ""; width: 7px; height: 7px; border: solid currentColor; border-width: 0 1.6px 1.6px 0; transform: translateY(-2px) rotate(45deg); }
/* Eck-Markierungen um den Titel */
.tu-ecken { position: absolute; inset: 0; pointer-events: none; --c: var(--tu-ecke);
  background:
    linear-gradient(var(--c), var(--c)) left top / 16px 1px no-repeat, linear-gradient(var(--c), var(--c)) left top / 1px 16px no-repeat,
    linear-gradient(var(--c), var(--c)) right top / 16px 1px no-repeat, linear-gradient(var(--c), var(--c)) right top / 1px 16px no-repeat,
    linear-gradient(var(--c), var(--c)) left bottom / 16px 1px no-repeat, linear-gradient(var(--c), var(--c)) left bottom / 1px 16px no-repeat,
    linear-gradient(var(--c), var(--c)) right bottom / 16px 1px no-repeat, linear-gradient(var(--c), var(--c)) right bottom / 1px 16px no-repeat; }
.tu-hinweis { display: none; }

/* ---------- Ruhiges Raster (Grundzustand) ---------- */
.tu-ebene { display: grid; grid-template-columns: repeat(auto-fill, 220px); justify-content: center; gap: 20px; max-width: 1000px; margin: 36px auto 0; }
.tu-karte { position: relative; }
.tu-karte[data-extra] { display: none; }
@media (max-width: 767px) {
  /* schmal: waagrecht wischbare Reihe statt hohem Raster */
  .tu:not(.tu-an) .tu-ebene { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 14px; margin: 28px -16px 0; padding: 4px 16px 18px;
    scroll-padding-inline: 16px; scrollbar-width: none; }
  .tu:not(.tu-an) .tu-ebene::-webkit-scrollbar { display: none; }
  .tu:not(.tu-an) .tu-karte { flex: none; scroll-snap-align: start; }
}

/* ---------- Karte: kleine Programmansicht 220×270 ---------- */
.tu-k { width: 220px; height: 270px; display: flex; flex-direction: column; gap: 7px; padding: 13px 13px 11px; text-align: left;
  background: var(--flaeche); border: 1px solid var(--rahmen); border-radius: 14px; box-shadow: var(--tu-schatten);
  font: 400 11.5px/1.35 Inter, system-ui, sans-serif; color: var(--text); user-select: none; -webkit-user-select: none; cursor: pointer;
  transition: transform .5s cubic-bezier(.34, 1.3, .5, 1), border-color .2s, box-shadow .3s; }
.tu-stand { align-self: flex-start; display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 650; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.tu-stand::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.tu-einsatz { background: var(--positiv-zart); color: var(--positiv); }
.tu-aufbau { background: var(--primaer-zart); color: var(--primaer); }
.tu-plan { background: var(--akzent-zart); color: var(--akzent-text); }
.tu-k-titel { font: 650 14px/1.2 var(--titel); font-stretch: 108%; letter-spacing: -0.012em; text-wrap: balance;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.4em; }
.tu-k-fuss { display: flex; justify-content: space-between; align-items: center; font-size: 10.5px; color: var(--schwach); }
.tu-k-fuss svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transform: rotate(-90deg); transition: transform .3s; }
@media (hover: hover) {
  .tu-karte:hover .tu-k { transform: translateY(-8px); border-color: var(--akzent);
    box-shadow: 0 0 0 1px var(--akzent), 0 30px 54px -24px color-mix(in srgb, var(--akzent) 45%, rgba(11, 42, 47, .5)); }
  .tu-karte:hover .tu-k-fuss { color: var(--akzent-text); }
  .tu-karte:hover .tu-k-fuss svg { transform: rotate(0deg); }
}

/* Innenfläche der Ansicht */
.tu-ui { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 9px 10px; border-radius: 9px;
  background: var(--flaeche2); border: 1px solid color-mix(in srgb, var(--rahmen) 70%, transparent); overflow: hidden; color: var(--schwach); }
.tu-ui b { color: var(--text); font-weight: 650; }
.tu-zahl { font-variant-numeric: tabular-nums; }
.tu-z { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; white-space: nowrap; }
.tu-z > span:first-child { overflow: hidden; text-overflow: ellipsis; }
.tu-gross { font-size: 12px; }
.tu-gross b { font-size: 15px; }
.tu-gross small { font-size: 10.5px; font-weight: 500; color: var(--schwach); }
.tu-markiert b { box-shadow: inset 0 -2px 0 var(--akzent); }
.tu-abw { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 7px; white-space: nowrap;
  background: var(--akzent-zart); color: var(--akzent-text); font-size: 11px; }
.tu-abw b { color: var(--akzent-text); }
.tu-plus { color: var(--positiv) !important; }
.tu-chip { font-size: 10.5px; font-weight: 650; padding: 2px 7px; border-radius: 999px; background: var(--primaer-zart); color: var(--primaer); }
.tu-gut { color: var(--positiv); }
.tu-chip.tu-gut { background: var(--positiv-zart); }
.tu-warn { color: var(--akzent-text) !important; }
.tu-haken { width: 12px; height: 12px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tu-z.tu-gut { justify-content: flex-start; gap: 6px; font-weight: 600; }
.tu-svg { width: 100%; height: auto; overflow: visible; }

/* Listen */
.tu-liste { display: grid; gap: 6px; }
.tu-liste li { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.tu-liste li span { color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.tu-liste i { margin-left: auto; font-style: normal; font-size: 10.5px; }
.tu-liste .tu-ok .tu-haken { width: 15px; height: 15px; padding: 2px; border-radius: 50%; background: var(--positiv-zart); color: var(--positiv); }
.tu-liste .tu-ok i { color: var(--positiv); }
.tu-kreis { width: 15px; height: 15px; flex: none; border-radius: 50%; border: 1.5px dashed var(--rahmen-stark); }
.tu-liste .tu-offen i { color: var(--akzent-text); }

/* Tour */
.tu-feld { stroke: var(--rahmen); stroke-width: 1; fill: none; }
.tu-weg { fill: none; stroke: var(--primaer); stroke-width: 2.6; stroke-linecap: round; stroke-dasharray: 1 5; }
.tu-weg-aktiv { stroke-dasharray: none; stroke: var(--akzent); }
.tu-lager { fill: var(--text); }
.tu-stopp { fill: var(--flaeche); stroke: var(--primaer); stroke-width: 2; }
.tu-stopp.tu-erledigt { fill: var(--primaer); }
.tu-stopp-nr { font: 700 7.5px Inter, sans-serif; text-anchor: middle; fill: var(--primaer); }
.tu-erledigt + .tu-stopp-nr { fill: var(--auf-primaer); }

/* Kühlkette */
.tu-grenze { stroke: var(--akzent); stroke-width: 1.2; stroke-dasharray: 4 3; }
.tu-grenze-text { font: 600 8px Inter, sans-serif; fill: var(--akzent-text); text-anchor: end; }
.tu-kurve { fill: none; stroke: var(--primaer); stroke-width: 2.2; stroke-linecap: round; }
.tu-flaeche-kurve { fill: color-mix(in srgb, var(--primaer) 14%, transparent); }
.tu-jetzt { fill: var(--primaer); stroke: var(--flaeche2); stroke-width: 2; }

/* Etikett und Waage */
.tu-waage { display: grid; justify-items: end; padding: 6px 9px; border-radius: 7px; background: var(--band); color: var(--band-schwach); font-size: 10px; }
.tu-waage span { justify-self: start; }
.tu-waage b { color: #f2f6f6 !important; font: 650 21px/1.05 var(--titel); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; margin-top: -12px; }
.tu-waage small { font-size: 9.5px; font-variant-numeric: tabular-nums; }
.tu-etikett { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 4px; background: #fff; color: #1a2629;
  border: 1px solid #d6dfe0; transform: rotate(-1.5deg); }
.tu-etikett div { display: grid; font-size: 10px; }
.tu-etikett div b { color: #1a2629; font-size: 11px; }
.tu-strich { width: 64px; height: 22px; fill: #1a2629; flex: none; }

/* Balken */
.tu-balken { fill: color-mix(in srgb, var(--primaer) 38%, transparent); }
.tu-balken-jetzt { fill: var(--primaer); }
.tu-achse { font: 500 8px Inter, sans-serif; fill: var(--schwach); text-anchor: middle; }

/* Handscanner */
.tu-geraet { display: flex; align-items: center; gap: 4px; }
.tu-geraet > .tu-svg { width: 92px; flex: none; }
.tu-scanner { fill: var(--text); }
.tu-scanner-fenster { fill: var(--primaer); opacity: .85; }
.tu-strahl { stroke: var(--akzent); stroke-width: 1.4; stroke-linecap: round; opacity: .9; }
.tu-qr { display: grid; justify-items: center; gap: 7px; margin-left: auto; }
.tu-qr .tu-svg { width: 44px; fill: var(--text); padding: 4px; background: var(--flaeche); border-radius: 5px; box-sizing: content-box; }

/* Vorprüfung */
.tu-pruef { display: grid; gap: 3px; }
.tu-pruef li { display: flex; align-items: center; gap: 7px; font-size: 11px; }
.tu-pruef i { margin-left: auto; font-style: normal; font-size: 10px; }
.tu-punkt { width: 7px; height: 7px; border-radius: 50%; background: var(--rahmen-stark); }
.tu-pruef .tu-auffaellig { color: var(--akzent-text); font-weight: 600; background: var(--akzent-zart); margin: 0 -5px; padding: 1px 5px; border-radius: 5px; }
.tu-auffaellig .tu-punkt { background: var(--akzent); }

/* Tacho */
.tu-spur { display: flex; height: 12px; border-radius: 4px; overflow: hidden; background: var(--rahmen); gap: 1px; }
.tu-spur i { width: var(--w); }
.tu-lenk { --f: var(--primaer); }
.tu-pause { --f: var(--akzent); }
.tu-arbeit { --f: var(--rahmen-stark); }
.tu-spur i[class] { background: var(--f); }
.tu-legende { display: flex; gap: 10px; font-size: 9.5px; }
.tu-legende span { display: inline-flex; align-items: center; gap: 4px; }
.tu-legende span::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--f); }
.tu-fortschritt { height: 5px; border-radius: 3px; background: var(--rahmen); overflow: hidden; }
.tu-fortschritt i { display: block; height: 100%; width: var(--w); background: var(--primaer); border-radius: 3px; }

/* Wiegekette */
.tu-kette { stroke: var(--primaer); stroke-width: 2; }
.tu-luecke { stroke: var(--akzent); stroke-dasharray: 3 4; }
.tu-glied { fill: var(--primaer); stroke: var(--flaeche2); stroke-width: 2; }
.tu-glied-warn { fill: var(--flaeche2); stroke: var(--akzent); }

/* Lager */
.tu-regal { display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; padding: 4px; border: 1.5px solid var(--rahmen-stark); border-radius: 4px; }
.tu-regal i { height: 13px; border-radius: 2px; background: var(--rahmen); }
.tu-regal .tu-fach-voll { background: color-mix(in srgb, var(--primaer) 45%, transparent); }
.tu-regal .tu-fach-wahl { background: var(--akzent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--akzent) 35%, transparent); }
.tu-spurkette { display: flex; align-items: center; gap: 4px; font-size: 10px; }
.tu-spurkette i { flex: 1; height: 1.5px; background: var(--primaer); position: relative; }
.tu-spurkette i::after { content: ""; position: absolute; right: -1px; top: -2.5px; border: 3px solid transparent; border-left-color: var(--primaer); border-right: 0; }

/* Protokoll */
.tu-protokoll { display: grid; gap: 5px; font-size: 10.5px; }
.tu-protokoll li { display: flex; gap: 7px; white-space: nowrap; }
.tu-protokoll time { font-variant-numeric: tabular-nums; color: var(--schwach); opacity: .8; }
.tu-protokoll span { color: var(--text); display: inline-flex; align-items: center; gap: 4px; overflow: hidden; text-overflow: ellipsis; }
.tu-protokoll .tu-gut { color: var(--positiv); font-weight: 600; }

/* Anrufradar */
.tu-anruf { display: flex; align-items: center; gap: 9px; padding-bottom: 6px; border-bottom: 1px solid var(--rahmen); }
.tu-anruf div { display: grid; }
.tu-anruf small { font-size: 10px; }
.tu-anruf b { font-size: 13px; }
.tu-hoerer { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--positiv-zart); color: var(--positiv);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--positiv) 14%, transparent); }
.tu-hoerer .tu-svg { width: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Leergut */
.tu-tabelle { display: grid; grid-template-columns: 1fr auto auto; gap: 4px 12px; align-items: baseline; font-size: 11px; }
.tu-tabelle > span:nth-child(-n+3) { font-size: 9.5px; text-align: right; }
.tu-tabelle b { text-align: right; }

/* Gegenprobe */
.tu-gegen { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.tu-gegen div { display: grid; justify-items: center; flex: 1; padding: 6px 4px; border-radius: 7px; background: var(--flaeche); border: 1px solid var(--rahmen); }
.tu-gegen small { font-size: 9.5px; }
.tu-gegen b { font: 650 16px/1.15 var(--titel); font-variant-numeric: tabular-nums; }
.tu-gegen > span { font: 700 16px var(--titel); color: var(--positiv); }

/* =====================================================================
   Tunnel (nur mit .tu-an): hoher Abschnitt, Bühne klebt, Karten in der Tiefe
   ===================================================================== */
.tu-an { height: 300svh; }
.tu-an.tu-mobil { height: 210svh; }
.tu-an .tu-buehne { position: sticky; top: 0; height: 100svh; padding: 0; overflow: hidden; perspective: 1200px; perspective-origin: 50% 50%; }
.tu-an.tu-mobil .tu-buehne { perspective: 900px; }
.tu-an.tu-zeiger .tu-licht { background: radial-gradient(520px circle at var(--mx) var(--my), color-mix(in srgb, var(--primaer) 10%, transparent), transparent 70%); }
.tu-an .tu-ring { display: block; position: absolute; left: 50%; top: 50%; border-radius: 50%; pointer-events: none;
  transform: translate(-50%, -50%); }
.tu-an .tu-ring-innen { width: 48vmin; height: 48vmin; border: 1px solid var(--tu-ring); }
.tu-an .tu-ring-aussen { width: 76vmin; height: 76vmin; border: 1px dashed var(--tu-ring2); }

.tu-an .tu-welt { position: absolute; inset: 0; transform-style: preserve-3d; }
/* Hof hinter dem Titel: ferne Karten verschwinden dahinter, der Titel bleibt lesbar */
.tu-an .tu-hof { display: block; position: absolute; left: 50%; top: 50%; width: min(86vw, 900px); height: min(58vh, 460px); pointer-events: none;
  transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(closest-side, var(--grund) 52%, color-mix(in srgb, var(--grund) 70%, transparent) 72%, transparent 100%); }
.tu-an .tu-mitte { position: absolute; left: 50%; top: 50%; width: min(780px, calc(100% - 32px)); margin: 0;
  transform: translate(-50%, -50%) scale(.84); opacity: .62; }
.tu-an .tu-ebene { position: absolute; inset: 0; margin: 0; max-width: none; display: block; transform-style: preserve-3d; pointer-events: none; }
.tu-an .tu-karte { position: absolute; left: 50%; top: 50%; width: 220px; height: 270px; margin: -135px 0 0 -110px; display: block;
  transform: translate3d(0, 0, -2000px); opacity: 0; }
.tu-an .tu-karte[data-extra] { display: block; }
.tu-an .tu-karte[hidden] { display: none; }
.tu-an .tu-karte.tu-weg-aus { visibility: hidden; }
.tu-an .tu-karte.tu-greifbar { pointer-events: auto; }

/* Scroll-Hinweis unten, verschwindet mit dem ersten Stück Weg */
.tu-an .tu-hinweis { display: flex; flex-direction: column; align-items: center; gap: 8px; position: absolute; left: 0; right: 0; bottom: 26px;
  font-size: 13px; color: var(--schwach); pointer-events: none; }
.tu-an .tu-hinweis i { width: 1px; height: 28px; background: linear-gradient(var(--primaer), transparent); transform-origin: top;
  animation: tu-faden 2.4s cubic-bezier(.6, 0, .3, 1) infinite; }
@keyframes tu-faden { 0% { transform: scaleY(0); opacity: 1; } 60% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }
/* Fokus auf den Sprunglink holt den Titel immer voll zurück */
.tu-an .tu-mitte:focus-within { opacity: 1 !important; }

@media (max-width: 767px) {
  .tu-an .tu-mitte { padding: 22px 18px; }
  .tu-an .tu-mitte h2 { font-size: clamp(30px, 8.6vw, 40px); }
  .tu-an .tu-leit { font-size: 15px; margin-top: 14px; }
  .tu-an .tu-fuss { margin-top: 14px; }
  .tu-an .tu-hinweis { bottom: 18px; }
}

/* Reduzierte Bewegung: tunnel.js setzt dann kein .tu-an (ruhiges Raster); hier nur Übergänge aus */
@media (prefers-reduced-motion: reduce) {
  .tu-an .tu-hinweis i { animation: none; }
  .tu-k { transition: none; }
}
