/* ==========================================================================
   SwimSafe — Onboarding (splash + intro 1–3)
   Source: user_config/.../SwimSafe Responsive Onboarding.dc.html
   Mobile-first bottom-sheet flow; tablet/desktop split-stage. DS tokens only.
   ========================================================================== */

/* Full-bleed: drop the shared .swoom-page chrome for the onboarding flow. */
main.swoom-page:has(.onb-wrap) { max-width: none; padding: 0; }

.onb-wrap {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-body);
  overflow: hidden;
}
.onb-wrap *,
.onb-wrap *::before,
.onb-wrap *::after {
  box-sizing: border-box;
}

/* ---------- Screen shell (stage + sheet) ---------- */
.onb {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.onb--welcome { background: linear-gradient(180deg, var(--tint-aqua) 0%, var(--tint-ocean) 100%); }
.onb--path    { background: linear-gradient(180deg, var(--ocean-50) 0%, var(--card) 100%); }
.onb--rewards { background: linear-gradient(180deg, var(--sun-50) 0%, var(--tint-sun) 55%, var(--ocean-50) 100%); }

.onb__stage {
  position: relative;
  min-width: 0;
  flex: 1 1 auto;
  min-height: 40vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.onb--path .onb__stage {
  flex: 0 0 52vh;
  min-height: 24rem;
  padding: calc(var(--space-4) + env(safe-area-inset-top)) var(--space-screen) var(--space-4);
}
.onb__stage::after {
  display: none;
  content: "";
}

.onb__sheet {
  position: relative;
  z-index: 2;
  min-width: 0;
  background: var(--card);
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  padding: var(--space-4) var(--space-3) calc(var(--space-4) + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 40px rgba(12, 42, 77, .08);
}

.onb--path .onb__sheet {
  flex: 1 0 auto;
}

/* Brand row — desktop split panels only. */
.onb__brand { display: none; align-items: center; gap: 10px; margin-bottom: var(--space-3); }
.onb__brand-mark {
  width: 38px; height: 38px; border-radius: var(--radius-md);
  background: var(--grad-aqua);
  display: flex; align-items: center; justify-content: center;
}
.onb__brand-word {
  font-family: var(--font-display); font-weight: var(--weight-semibold);
  font-size: var(--text-h3); color: var(--ink-900); letter-spacing: -.3px;
}

.onb__progress { display: flex; gap: 8px; margin-bottom: var(--space-3); }
.onb__progress span { width: 8px; height: 8px; border-radius: 4px; background: var(--ocean-100); }
.onb__progress span.is-active { width: 26px; background: var(--ocean-600); }

.onb__title {
  font-family: var(--font-display); font-weight: var(--weight-semibold);
  font-size: var(--text-h1); line-height: var(--leading-tight); letter-spacing: -.4px;
  color: var(--ink-900); margin: 0;
}
.onb__body {
  font-size: var(--text-body-lg); line-height: var(--leading-normal);
  color: var(--ink-400); font-weight: var(--weight-semibold); margin: 14px 0 0;
}

.onb__cta {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 62px;
  border: 0; border-radius: var(--radius-lg);
  background: var(--grad-cta); color: #fff !important; text-decoration: none !important;
  font-family: var(--font-display); font-weight: var(--weight-semibold); font-size: 19px;
  box-shadow: var(--shadow-cta-ocean);
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.onb__cta:active { transform: translateY(1px) scale(.985); }
.onb__cta:focus-visible { outline: 3px solid rgba(127,233,223,.9); outline-offset: 3px; }
@media (hover: hover) {
  .onb__cta:hover {
    background: var(--grad-cta-hover);
    color: #fff !important;
    text-decoration: none !important;
    transform: translateY(-2px);
    box-shadow: var(--shadow-cta-ocean-hover);
  }
}
.onb__cta-arrow { display: none; }

.onb__actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: var(--space-3);
}
.onb__actions .onb__cta {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
}
/* Welcome groups CTA + skip; on mobile the skip wraps to its own centered line. */
.onb__actions--welcome { flex-wrap: wrap; }
.onb__actions--welcome .onb__skip { flex: 1 0 100%; margin-top: 0; }
.onb__back {
  display: none;
  width: 56px;
  min-width: 56px;
  height: 56px;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--ink-100);
  border-radius: var(--radius-md);
  background: var(--card);
  color: var(--ink-600);
  text-decoration: none;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.onb__back:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}
.onb__back svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.onb__skip {
  display: block; text-align: center; margin-top: var(--space-2);
  color: var(--ink-300); font-weight: var(--weight-bold); font-size: var(--text-body);
  text-decoration: none;
}
.onb__skip:hover { color: var(--ink-600); }
.onb__skip--link { color: var(--ocean-600); font-weight: var(--weight-extrabold); }
.onb__skip--link:hover { color: var(--ocean-800); }

/* ---------- Screen 1: welcome stage ---------- */
.onb__blob {
  position: absolute; top: 6%; left: 50%; transform: translateX(-50%);
  width: min(74vw, 300px); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, var(--aqua-200), var(--aqua-400) 70%);
  filter: blur(2px); opacity: .5; pointer-events: none;
}
.onb__spark { position: absolute; color: var(--sun-400); animation: onb-spark 2.4s ease-in-out infinite; }
.onb__spark--1 { top: 18%; left: 16%; font-size: 22px; }
.onb__spark--2 { top: 14%; right: 16%; font-size: 16px; color: var(--aqua-400); animation-delay: .7s; }
.onb__spark--3 { bottom: 22%; left: 13%; font-size: 14px; color: var(--ocean-600); animation-delay: 1.3s; }
.onb__spark--4 { bottom: 26%; right: 12%; font-size: 20px; animation-delay: 1.8s; }

.onb__mascot {
  position: relative; z-index: 1;
  width: min(64vw, 260px); height: auto; object-fit: contain;
  filter: drop-shadow(0 22px 28px rgba(14, 99, 150, .28));
  animation: onb-float 5s ease-in-out infinite;
  pointer-events: none;
}

/* ---------- Screen 2: learning path ---------- */
.onb__journey {
  position: relative;
  width: min(72vw, 280px); aspect-ratio: 1 / 1;
  border-radius: var(--radius-2xl);
  background: var(--grad-deep);
  box-shadow: 0 24px 44px rgba(20, 99, 214, .28);
  overflow: hidden;
}
.onb__journey-path { position: absolute; inset: 0; width: 100%; height: 100%; }
.onb__journey-path--desktop { display: none; }
.onb__journey-hl { stroke: var(--sun-400); }

.onb__node {
  position: absolute; width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: var(--weight-bold); font-size: 18px; color: #fff;
  box-shadow: 0 8px 16px rgba(0, 40, 90, .25);
  transform: translate(-50%, -50%);
}
.onb__node--goal {
  left: 50%; top: 11%;
  background: var(--grad-reward);
  border: 2.5px solid #fff;
  box-shadow: var(--shadow-reward);
}
.onb__node--locked {
  left: 70%; top: 39%;
  width: 40px; height: 40px;
  background: var(--ink-50);
  border: 2.5px solid #fff;
  color: var(--ink-200);
  box-shadow: none;
}
.onb__node--num {
  left: 30%; top: 59%;
  background: #fff;
  color: var(--ocean-600);
  border: 3px solid var(--aqua-400);
}
.onb__node--done {
  background: var(--grad-reward);
  border: 2.5px solid #fff;
  box-shadow: var(--shadow-reward);
}
.onb__node--done-a { left: 68%; top: 79%; display: none; }
.onb__node--done-b { left: 30%; top: 92%; }

.onb__node--here {
  left: 68%; top: 79%; width: 68px; height: 68px;
  background: var(--grad-cta); border: 3px solid #fff;
  box-shadow: 0 10px 20px rgba(20, 99, 214, .4);
  overflow: visible;
}
.onb__node--here img { width: 84%; height: 84%; object-fit: cover; border-radius: 50%; }
.onb__node-ring {
  position: absolute; inset: -6px; border-radius: 50%;
  border: 3px solid #fff; animation: onb-pulse-ring 2s ease-out infinite;
}
.onb__node-tip {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: var(--ink-900); color: #fff; white-space: nowrap;
  font-family: var(--font-body); font-weight: var(--weight-extrabold); font-size: var(--text-xs);
  padding: 3px 9px; border-radius: var(--radius-sm);
  animation: onb-bob 2.4s ease-in-out infinite;
}

/* ---------- Screen 3: rewards ---------- */
.onb__stage--rewards { flex-direction: column; gap: var(--space-3); }
.onb__badges {
  display: flex; gap: 14px; align-items: flex-end; justify-content: center;
}
.onb__badge {
  width: 74px; height: 74px; object-fit: contain;
  filter: drop-shadow(0 12px 20px rgba(12, 42, 77, .22));
}
.onb__badge--left  { transform: rotate(-8deg); animation: onb-bob-left 3.2s ease-in-out infinite; }
.onb__badge--mid   { width: 104px; height: 104px; filter: drop-shadow(0 16px 28px rgba(244, 165, 9, .4)); animation: onb-bob 3.2s ease-in-out infinite .3s; }
.onb__badge--right { transform: rotate(8deg); animation: onb-bob-right 3.2s ease-in-out infinite .6s; }

.onb__mascot--rewards {
  width: min(52vw, 210px); animation: onb-float 4.4s ease-in-out infinite;
}

/* ---------- Splash overlay ---------- */
.onb-splash {
  position: fixed; inset: 0; z-index: 60;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(165deg, var(--aqua-400) 0%, var(--ocean-600) 48%, var(--ocean-900) 100%);
  opacity: 1; transition: opacity var(--dur-slow) var(--ease-out);
}
.onb-splash.is-hidden { opacity: 0; pointer-events: none; }

.onb-splash__ripple {
  position: absolute; top: 38%; left: 50%; width: 240px; height: 240px;
  margin: -120px 0 0 -120px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .5);
  animation: onb-ripple 3.4s ease-out infinite;
}
.onb-splash__ripple--2 { animation-delay: 1.1s; }
.onb-splash__ripple--3 { animation-delay: 2.2s; }

.onb-splash__icon {
  position: relative; z-index: 2;
  width: 168px; height: 168px; border-radius: 46px;
  background: rgba(255, 255, 255, .16); backdrop-filter: blur(8px);
  border: 1.5px solid rgba(255, 255, 255, .4);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 24px 50px rgba(0, 40, 90, .35);
  animation: onb-float-icon 4s ease-in-out infinite;
}
.onb-splash__icon img { width: 140px; height: 140px; object-fit: contain; object-position: top; filter: drop-shadow(0 8px 14px rgba(0, 30, 70, .3)); }

.onb-splash__brand { position: relative; z-index: 2; text-align: center; margin-top: var(--space-4); }
.onb-splash__title {
  font-family: var(--font-display); font-weight: var(--weight-bold); font-size: 42px;
  color: #fff; letter-spacing: -.5px; text-shadow: 0 4px 18px rgba(0, 30, 70, .25);
}
.onb-splash__tagline { font-size: 16px; color: rgba(255, 255, 255, .86); font-weight: var(--weight-bold); margin-top: 4px; }

.onb-splash__dots { position: absolute; bottom: 84px; display: flex; gap: 10px; }
.onb-splash__dots span { width: 10px; height: 10px; border-radius: 50%; background: #fff; animation: onb-pulse-dot 1.2s ease-in-out infinite; }
.onb-splash__dots span:nth-child(2) { animation-delay: .2s; }
.onb-splash__dots span:nth-child(3) { animation-delay: .4s; }

.onb-splash__wave { position: absolute; bottom: 0; left: 0; width: 100%; height: 120px; }

/* ---------- Animations ---------- */
@keyframes onb-float       { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes onb-float-icon  { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes onb-spark       { 0%, 100% { opacity: .2; transform: scale(.6); } 50% { opacity: 1; transform: scale(1); } }
@keyframes onb-ripple      { 0% { transform: scale(.35); opacity: .5; } 100% { transform: scale(1.7); opacity: 0; } }
@keyframes onb-pulse-ring  { 0% { transform: scale(.85); opacity: .9; } 100% { transform: scale(1.35); opacity: 0; } }
@keyframes onb-pulse-dot   { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.5); opacity: .4; } }
@keyframes onb-bob         { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes onb-bob-left    { 0%, 100% { transform: translateY(0) rotate(-8deg); } 50% { transform: translateY(-5px) rotate(-8deg); } }
@keyframes onb-bob-right   { 0%, 100% { transform: translateY(0) rotate(8deg); } 50% { transform: translateY(-5px) rotate(8deg); } }
/* The "Hier bist du!" tooltip keeps its X-centering while bobbing. */
.onb__node-tip { animation-name: onb-bob-tip; }
@keyframes onb-bob-tip     { 0%, 100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-4px); } }

/* ==========================================================================
   Tablet / Desktop — split stage (visual left, sheet right)
   ========================================================================== */
@media (min-width: 768px) {
  .onb { flex-direction: row; }

  .onb__stage {
    flex: 0 0 52%;
    min-height: 100vh; min-height: 100dvh;
    align-self: stretch;
  }
  .onb--welcome .onb__stage { background: linear-gradient(160deg, var(--ocean-900) 0%, var(--ocean-400) 58%, var(--aqua-400) 100%); }
  .onb--path    .onb__stage { background: var(--grad-deep); }
  .onb--rewards .onb__stage { background: linear-gradient(165deg, var(--tint-sun) 0%, var(--sun-100) 100%); }
  .onb--path .onb__stage { padding: 0; }
  .onb__stage::after {
    position: absolute;
    top: 0;
    right: -4.25rem;
    bottom: 0;
    z-index: 1;
    display: block;
    width: 8rem;
    background: var(--card);
    border-radius: 56% 0 0 56% / 50% 0 0 50%;
    pointer-events: none;
  }
  .onb--path .onb__stage::after { display: none; }

  .onb__sheet {
    flex: 1 1 auto;
    display: flex; flex-direction: column; justify-content: center;
    align-self: stretch;
    border-radius: 0;
    box-shadow: none;
    padding: var(--space-8) clamp(40px, 6vw, 72px);
  }
  .onb--path .onb__sheet {
    align-items: flex-start;
    padding-left: clamp(40px, 6vw, 72px);
    padding-right: clamp(32px, 5vw, 64px);
  }
  /* Keep a readable column rather than stretching full-width. */
  .onb__sheet > * { width: 100%; max-width: min(460px, 100%); }
  .onb--path .onb__sheet > * { max-width: min(400px, 100%); }

  .onb__brand { display: flex; }
  .onb__back { display: inline-flex; }
  .onb__cta-arrow { display: inline; margin-left: 4px; }

  /* Welcome: CTA hugs its content so the skip sits inline beside it. */
  .onb--welcome .onb__cta { width: auto; }
  .onb__actions--welcome .onb__skip { flex: 0 0 auto; }

  /* On a deep brand panel, sparks read brighter. */
  .onb--welcome .onb__spark { color: rgba(255, 255, 255, .85); }
  .onb--welcome .onb__spark--1 { color: var(--sun-400); }
  .onb__mascot { width: min(36vw, 360px); }
  .onb__journey {
    width: min(42vw, 460px);
    height: min(84vh, 680px);
    aspect-ratio: auto;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  .onb__journey-path--mobile { display: none; }
  .onb__journey-path--desktop { display: block; }
  .onb__node {
    width: 52px;
    height: 52px;
  }
  .onb__node--goal {
    left: 42%; top: 9%;
    width: 60px; height: 60px;
    border-width: 3px;
  }
  .onb__node--locked {
    left: 64%; top: 29%;
    width: 52px; height: 52px;
    border-width: 3px;
  }
  .onb__node--num { left: 34%; top: 45%; }
  .onb__node--here {
    left: 69%; top: 64%;
    width: 84px; height: 84px;
    border-width: 4px;
  }
  .onb__node--done-a { left: 33%; top: 82%; display: flex; }
  .onb__node--done-b { left: 50%; top: 94%; }
  .onb__node-tip {
    bottom: calc(100% + 10px);
    font-size: 12px;
    padding: 4px 11px;
    border-radius: 10px;
  }
  .onb__badge { width: 92px; height: 92px; }
  .onb__badge--mid { width: 130px; height: 130px; }
  .onb__mascot--rewards { width: min(28vw, 240px); }
}

@media (min-width: 1024px) {
  .onb__title { font-size: clamp(34px, 4vw, 42px); }
  .onb--path .onb__title { font-size: clamp(42px, 3.75vw, 48px); }
  .onb__mascot { width: min(30vw, 400px); }
  .onb--path .onb__stage { flex-basis: 52%; }
  .onb--path .onb__journey {
    width: min(40vw, 500px);
    height: min(86vh, 690px);
  }
  .onb--path .onb__node--here {
    width: 96px;
    height: 96px;
  }
}

@media (min-width: 1200px) {
  .onb--path .onb__sheet > * { max-width: min(460px, 100%); }
}

@media (prefers-reduced-motion: reduce) {
  .onb-wrap *, .onb-splash * { animation: none !important; transition-duration: .001ms !important; }
}
