/* Header-Panel: Variante D, kreativ animiert. Ergaenzung zu styles.css */

.panel {
  position: relative;
  background: rgba(10, 21, 38, .82);
  border: var(--border-on-navy);
  border-radius: var(--radius-card);
  padding: clamp(20px, 2.2vw, 28px);
  backdrop-filter: blur(3px);
}
.panel-note { margin: 14px 0 0; font-size: 15px; line-height: 1.5; color: rgba(255,255,255,.58); }

/* Hinweis auf das kostenlose Erstgespraech */
.hero-free {
  display: flex; align-items: baseline; gap: 12px;
  margin: 16px 0 0; font-size: 16px; line-height: 1.5; color: rgba(255,255,255,.86);
}
.hero-free .tag {
  flex: none; font-family: var(--font-mono); font-size: 12px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--navy); background: #7FB2FF;
  border-radius: 4px; padding: 4px 8px;
}


/* Variante D, kreativ animiert */

.d2 { position: relative; overflow: hidden; }

/* Laufende Linie auf der Oberkante des Rahmens */
.d2::before {
  content: ""; position: absolute; left: 0; top: 0; height: 2px; width: 100%;
  background: var(--accent); transform-origin: left center; transform: scaleX(0);
}
.d2.tick::before { transition: transform var(--d2-dauer, 8400ms) linear; transform: scaleX(1); }

.d2-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding-bottom: 14px; border-bottom: 1px solid rgba(255,255,255,.12);
}
.d2-head .ttl { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.35; color: var(--white); }
.d2-count {
  flex: none; font-family: var(--font-mono); font-size: 12px; letter-spacing: .1em;
  color: rgba(255,255,255,.50); font-variant-numeric: tabular-nums;
}

.d2-body { position: relative; padding-top: 20px; }
.d2-scene { display: none; }
.d2-scene.on { display: block; }

/* --- Bausteine mit Maskenauftritt --- */
.mask { display: block; overflow: hidden; }
.mask > span, .mask > b { display: block; transform: translateY(105%); }
.d2-scene.on .mask > span, .d2-scene.on .mask > b {
  animation: m-in 620ms cubic-bezier(0.2, 0, 0.2, 1) both;
}
@keyframes m-in { from { transform: translateY(105%); } to { transform: translateY(0); } }

.d2-lbl {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  color: #7FB2FF;
}
.d2-in { position: relative; margin: 8px 0 0; font-size: 16px; line-height: 1.5; color: rgba(255,255,255,.82); }
.d2-in .sweep {
  position: absolute; inset: -4px -8px; pointer-events: none; opacity: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(127,178,255,.20) 45%, rgba(127,178,255,.03) 60%, transparent 100%);
}
.d2-scene.on .d2-in .sweep { animation: sweep 1150ms cubic-bezier(0.2, 0, 0.2, 1) 420ms both; }
@keyframes sweep {
  from { transform: translateX(-100%); opacity: 0; }
  15% { opacity: 1; }
  85% { opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* --- Strecke mit wanderndem Knoten --- */
.d2-rail { position: relative; margin: 20px 0 18px; height: 16px; display: flex; align-items: center; }
.d2-rail .base { flex: 1 1 auto; height: 1px; background: rgba(255,255,255,.18); position: relative; }
.d2-rail .base i {
  position: absolute; left: 0; top: 0; height: 1px; width: 100%;
  background: var(--accent); transform-origin: left center; transform: scaleX(0);
}
.d2-rail .knoten {
  position: absolute; left: 0; top: 50%; width: 9px; height: 9px; border-radius: 50%;
  background: var(--white); transform: translate(-50%, -50%) scale(0);
}
.d2-rail .tip {
  flex: none; margin-left: 12px;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .1em;
  color: rgba(255,255,255,.38);
}
.d2-scene.on .d2-rail .base i { animation: rail-fill 1000ms cubic-bezier(0.2, 0, 0.2, 1) 760ms both; }
.d2-scene.on .d2-rail .knoten { animation: knoten 1000ms cubic-bezier(0.2, 0, 0.2, 1) 760ms both; }
.d2-scene.on .d2-rail .tip { animation: tip-on 400ms var(--ease) 1700ms both; }
@keyframes rail-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes knoten {
  0% { left: 0; transform: translate(-50%, -50%) scale(0); }
  18% { transform: translate(-50%, -50%) scale(1); }
  100% { left: 100%; transform: translate(-50%, -50%) scale(1); }
}
@keyframes tip-on { from { color: rgba(255,255,255,.38); } to { color: #7FB2FF; } }

/* --- Ergebnis --- */
.d2-res { display: flex; align-items: flex-start; gap: 14px; }
.d2-star { flex: none; width: 26px; height: 26px; margin-top: 8px; opacity: 0; }
.d2-star line {
  stroke: #7FB2FF; stroke-width: 2.4; stroke-linecap: round;
  stroke-dasharray: 22; stroke-dashoffset: 22;
}
.d2-scene.on .d2-star { animation: star-on 520ms var(--ease) 1780ms both; }
.d2-scene.on .d2-star line { animation: star-draw 620ms var(--ease) 1820ms both; }
@keyframes star-on {
  from { opacity: 0; transform: rotate(-24deg) scale(.7); }
  to { opacity: 1; transform: rotate(0) scale(1); }
}
@keyframes star-draw { to { stroke-dashoffset: 0; } }

.d2-val {
  font-family: var(--font-display); font-weight: 700; color: var(--white);
  font-size: clamp(30px, 3.4vw, 40px); line-height: 1.1; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; margin: 0;
}
.d2-val.txt { font-size: clamp(21px, 2.3vw, 27px); line-height: 1.3; max-width: 26ch; }
.d2-k {
  display: block; font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em;
  font-weight: 500; color: rgba(255,255,255,.50); margin-bottom: 6px;
}
.d2-val .caret {
  display: inline-block; width: 2px; height: .92em; margin-left: 3px; vertical-align: -0.1em;
  background: #7FB2FF; animation: blink 900ms steps(1, end) infinite;
}
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

/* --- Randangaben --- */
.d2-meta { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 9px; }
.d2-meta li {
  display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 14px; align-items: baseline;
  font-size: 16px; line-height: 1.45;
  clip-path: inset(0 100% 0 0);
}
.d2-scene.on .d2-meta li { animation: wipe 520ms cubic-bezier(0.2, 0, 0.2, 1) both; }
.d2-scene.on .d2-meta li:nth-child(1) { animation-delay: 2260ms; }
.d2-scene.on .d2-meta li:nth-child(2) { animation-delay: 2400ms; }
.d2-scene.on .d2-meta li:nth-child(3) { animation-delay: 2540ms; }
@keyframes wipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.d2-meta .k {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em; color: rgba(255,255,255,.50);
}
.d2-meta .v { color: rgba(255,255,255,.88); font-variant-numeric: tabular-nums; }

/* --- Zuständigkeit --- */
.d2-hand {
  display: flex; align-items: flex-start; gap: 10px; margin: 22px 0 0;
  padding-top: 16px; border-top: 1px solid rgba(255,255,255,.12);
  font-size: 16px; line-height: 1.5; color: rgba(255,255,255,.82);
}
.d2-hand svg { flex: none; width: 19px; height: 19px; margin-top: 3px; }
.d2-hand svg path {
  fill: none; stroke: #7FB2FF; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 26; stroke-dashoffset: 26;
}
.d2-hand span { opacity: 0; }
.d2-scene.on .d2-hand svg path { animation: haken 520ms cubic-bezier(0.2, 0, 0.2, 1) 2800ms both; }
.d2-scene.on .d2-hand span { animation: fade-in 420ms var(--ease) 3060ms both; }
@keyframes haken { to { stroke-dashoffset: 0; } }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* --- Abgang --- */
.d2-scene.out .mask > span, .d2-scene.out .mask > b,
.d2-scene.out .d2-val, .d2-scene.out .d2-meta li,
.d2-scene.out .d2-hand, .d2-scene.out .d2-rail, .d2-scene.out .d2-star {
  animation: raus 380ms cubic-bezier(0.2, 0, 0.2, 1) both;
}
.d2-scene.out .d2-meta li:nth-child(2) { animation-delay: 50ms; }
.d2-scene.out .d2-meta li:nth-child(3) { animation-delay: 100ms; }
.d2-scene.out .d2-hand { animation-delay: 120ms; }
@keyframes raus { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(-10px); } }

/* --- Schrittanzeige --- */
.d2-steps { display: flex; gap: 6px; margin-top: 20px; padding-top: 0; }
.d2-steps i { flex: 1 1 0; height: 2px; background: rgba(255,255,255,.14); position: relative; overflow: hidden; }
.d2-steps i b { position: absolute; inset: 0 auto 0 0; display: block; width: 0; background: var(--accent); }

@media (max-width: 520px) {
  .d2-meta li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  .d2.tick::before { transition: none; transform: scaleX(1); }
  .d2-scene.on * { animation: none !important; }
  .d2-scene.on .mask > span, .d2-scene.on .mask > b { transform: none; }
  .d2-scene.on .d2-meta li { clip-path: none; }
  .d2-scene.on .d2-star { opacity: 1; }
  .d2-scene.on .d2-star line { stroke-dashoffset: 0; }
  .d2-scene.on .d2-hand svg path { stroke-dashoffset: 0; }
  .d2-scene.on .d2-hand span { opacity: 1; }
  .d2-scene.on .d2-rail .base i { transform: scaleX(1); }
  .d2-scene.on .d2-rail .knoten { left: 100%; transform: translate(-50%, -50%) scale(1); }
  .d2-val .caret { display: none; }
}

/* Hoehe fuer den Textentwurf reservieren, damit beim Tippen nichts springt */
.d2-val.txt .ziel { display: block; min-height: 2.6em; }

/* Ergebnis erscheint erst, wenn der Knoten angekommen ist */
.d2-val { opacity: 0; }
.d2-scene.on .d2-val { animation: fade-in 400ms var(--ease) 1740ms both; }
@media (prefers-reduced-motion: reduce) { .d2-val { opacity: 1; } }
