/* ------------------------------------------------------------------
   NaLogo – Landing Page
   Farben & Formen orientieren sich am App-Design (lila Hintergrund,
   weiße Karte mit abgerundeten Ecken, verspielte Kreise).
------------------------------------------------------------------- */

:root {
  --purple: #6c5ce7;
  --lavender: #dad1ff;
  --lavender-2: #c4b9ff;
  --mint: #c6efd8;
  --yellow: #fde68a;
  --white: #ffffff;
  --ink: #1b1b2f;
  --muted: #6f7280;
  --line: #e6e6ee;
  --radius-card: 40px;
  --radius-logo: 26%;
  /* Desktop: Breite der Karte und Abstand zum rechten Rand */
  --card-width-desktop: 40vw;
  --card-gap-desktop: clamp(24px, 6vw, 96px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden; /* Seite ist genau 100vh × 100vw, kein Scrollen */
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Rounded", "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--purple);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Grundlayout: 100vh / 100vw ---------- */

.page {
  width: 100vw;
  height: 100vh;
  height: 100dvh; /* mobile Browser mit dynamischer Adressleiste */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--purple);
}

/* ---------- Oberer lila Bereich ---------- */

.hero {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding-top: env(safe-area-inset-top);
}

.logo {
  position: relative;
  z-index: 1;
  width: clamp(120px, 30vmin, 176px);
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-logo);
  background: var(--white);
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(20, 10, 80, 0.28);
  animation: logo-in 700ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Verspielte Kreise wie in der App */
.bubble {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  animation: float 7s ease-in-out infinite;
}

.bubble--1 {
  /* großer Lavendel-Kreis oben links */
  width: clamp(110px, 28vmin, 240px);
  aspect-ratio: 1;
  top: -6vmin;
  left: -9vmin;
  background: var(--lavender);
  animation-duration: 9s;
}

.bubble--2 {
  /* kleiner Lavendel-Punkt */
  width: clamp(10px, 3.4vmin, 26px);
  aspect-ratio: 1;
  top: 16%;
  left: 17%;
  background: var(--lavender-2);
  animation-duration: 6s;
  animation-delay: -2s;
}

.bubble--3 {
  /* Mint-Kreis oben rechts */
  width: clamp(80px, 20vmin, 180px);
  aspect-ratio: 1;
  top: 8%;
  right: -6vmin;
  background: var(--mint);
  animation-duration: 8s;
  animation-delay: -3s;
}

.bubble--4 {
  /* gelber Punkt rechts vom Logo */
  width: clamp(12px, 4vmin, 34px);
  aspect-ratio: 1;
  top: 50%;
  left: 78%;
  background: var(--yellow);
  animation-duration: 5.5s;
  animation-delay: -1s;
}

.bubble--5 {
  /* transparenter Kreis unten links */
  width: clamp(34px, 8.7vmin, 80px);
  aspect-ratio: 1;
  bottom: 6%;
  left: 6%;
  background: rgba(255, 255, 255, 0.18);
  animation-duration: 7.5s;
  animation-delay: -4s;
}

/* ---------- Weiße Karte ---------- */

.card {
  position: relative;
  flex: 0 0 auto;
  min-height: 46%;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--white);
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  padding: clamp(28px, 5vh, 48px) clamp(16px, 6vw, 40px)
    calc(clamp(16px, 3vh, 28px) + env(safe-area-inset-bottom));
  overflow-y: auto; /* Sicherheitsnetz für sehr kleine Fenster */
  animation: card-in 650ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.card__content {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

/* ---------- Konfetti in der Karte ---------- */

.confetti {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}

.confetti > span {
  position: absolute;
  display: block;
  opacity: 0.55;
  transform: rotate(var(--r, 0deg));
  animation: confetti-float var(--d, 8s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}

.confetti__dot {
  width: var(--s, 10px);
  height: var(--s, 10px);
  border-radius: 50%;
}

.confetti__flake {
  width: 6px;
  height: 14px;
  border-radius: 3px;
}

.confetti--lavender { background: var(--lavender-2); }
.confetti--mint     { background: #9fe0bd; }
.confetti--yellow   { background: #fcd34d; }
.confetti--pink     { background: #ffb3c1; }

/* Verteilung – hauptsächlich an den Rändern, damit der Text frei bleibt */
.confetti > span:nth-child(1)  { --s: 14px; top: 9%;    left: 7%;   --d: 9s; }
.confetti > span:nth-child(2)  { top: 15%;   left: 21%;  --r: 20deg;  --d: 7s;  --delay: -2s; }
.confetti > span:nth-child(3)  { --s: 8px;  top: 7%;    left: 47%;  --d: 8s;  --delay: -4s; }
.confetti > span:nth-child(4)  { --s: 12px; top: 12%;   right: 12%; --d: 10s; --delay: -1s; }
.confetti > span:nth-child(5)  { top: 27%;   right: 6%;  --r: -30deg; --d: 8.5s; --delay: -3s; }
.confetti > span:nth-child(6)  { --s: 6px;  top: 40%;   left: 5%;   --d: 7.5s; --delay: -5s; }
.confetti > span:nth-child(7)  { --s: 10px; top: 56%;   right: 5%;  --d: 9.5s; --delay: -2.5s; }
.confetti > span:nth-child(8)  { top: 63%;   left: 8%;   --r: 45deg;  --d: 8s;  --delay: -6s; }
.confetti > span:nth-child(9)  { --s: 16px; bottom: 12%; left: 13%; --d: 11s; --delay: -1.5s; }
.confetti > span:nth-child(10) { --s: 7px;  bottom: 20%; right: 15%; --d: 7s;  --delay: -3.5s; }
.confetti > span:nth-child(11) { bottom: 8%; right: 8%;  --r: -15deg; --d: 9s;  --delay: -0.5s; }
.confetti > span:nth-child(12) { --s: 9px;  bottom: 30%; left: 4%;  --d: 8s;  --delay: -4.5s; }
.confetti > span:nth-child(13) { top: 5%;    left: 33%;  --r: 60deg;  --d: 10s; --delay: -7s; }
.confetti > span:nth-child(14) { --s: 6px;  top: 30%;   right: 22%; --d: 6.5s; --delay: -2s; }

.title {
  margin: 0 0 0.5rem;
  font-size: clamp(2rem, 7vmin, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.subtitle {
  margin: 0 auto;
  max-width: 42ch;
  font-size: clamp(1rem, 2.6vmin, 1.125rem);
  line-height: 1.5;
  color: var(--muted);
}

.divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: clamp(1.25rem, 3.5vh, 2rem) 0 clamp(1rem, 2.5vh, 1.5rem);
  color: var(--muted);
  font-size: 0.875rem;
  white-space: nowrap;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--line);
}

/* ---------- Store-Badges ---------- */

.stores {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 12px;
}

.store-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 56px;
  min-width: 158px;
  padding: 0 16px 0 12px;
  background: #000;
  color: #fff;
  border: 1px solid #a6a6a6;
  border-radius: 9px;
  text-decoration: none;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.store-badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
}

.store-badge:active {
  transform: translateY(0);
}

.store-badge:focus-visible {
  outline: 3px solid var(--purple);
  outline-offset: 3px;
}

.store-badge__icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.store-badge__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1;
  text-align: left;
}

.store-badge__text small {
  font-size: 0.68rem;
  letter-spacing: 0.02em;
}

.store-badge__caps {
  text-transform: uppercase;
  letter-spacing: 0.06em !important;
}

.store-badge__text strong {
  margin-top: 3px;
  font-size: clamp(1.05rem, 5vw, 1.25rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* Passenden Store zuerst anzeigen (wird per JS gesetzt) */
html[data-platform="android"] #badge-android {
  order: -1;
}

/* ---------- Einladungsseite (invite.html) ---------- */

/* Großer Haupt-Button ("In NaLogo öffnen") im App-Lila. */
.cta {
  display: block;
  margin: clamp(1.25rem, 3.5vh, 2rem) auto 0;
  max-width: 320px;
  padding: 17px 24px;
  background: var(--purple);
  color: var(--white);
  border-radius: 16px;
  font-size: clamp(1rem, 2.6vmin, 1.0625rem);
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 12px 26px rgba(108, 92, 231, 0.32);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(108, 92, 231, 0.38);
}

.cta:active {
  transform: translateY(0);
}

.cta:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.cta-hint {
  margin: 0.75rem 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

/* Hinweis unter den Badges, solange die App in keinem Store ist. */
.stores-note {
  margin: 0.875rem 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

/* Badge ohne hinterlegten Store-Link (siehe script.js). */
.store-badge[aria-disabled="true"] {
  opacity: 0.4;
  cursor: default;
}

.store-badge[aria-disabled="true"]:hover {
  transform: none;
  box-shadow: none;
}

/* Die Einladungsseite trägt mehr Inhalt als die Startseite; auf sehr
   flachen Screens darf die Karte scrollen statt abzuschneiden. */
html[data-page="invite"] .card__content {
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* ---------- Footer ---------- */

.footer {
  margin-top: auto;
  padding-top: 1rem;
  font-size: 0.75rem;
  color: var(--muted);
}

/* ---------- Querformat auf niedrigen Bildschirmen ---------- */

@media (orientation: landscape) and (max-height: 560px) {
  .page {
    flex-direction: row;
  }

  .hero {
    flex: 0 0 42%;
    padding-top: 0;
    padding-left: env(safe-area-inset-left);
  }

  .card {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    border-radius: var(--radius-card) 0 0 var(--radius-card);
    padding-right: calc(clamp(20px, 6vw, 40px) + env(safe-area-inset-right));
  }
}

/* ---------- Desktop: Karte schwebt rechts (40vw × 80vh, vertikal zentriert) ---------- */

@media (min-width: 900px) and (min-height: 561px) {
  .page {
    position: relative;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
  }

  /* Lila Fläche mit Kreisen füllt die ganze Seite; das Logo wird
     im freien Bereich links neben der Karte zentriert. */
  .hero {
    position: absolute;
    inset: 0;
    padding-top: 0;
    padding-right: calc(var(--card-width-desktop) + var(--card-gap-desktop));
  }

  .logo {
    width: clamp(160px, 24vmin, 230px);
  }

  .card {
    position: relative;
    z-index: 1;
    flex: 0 0 auto;
    width: var(--card-width-desktop);
    height: 80vh;
    height: 80dvh;
    min-height: 0;
    margin-right: var(--card-gap-desktop);
    border-radius: var(--radius-card);
    box-shadow: 0 32px 80px rgba(20, 10, 80, 0.3);
    padding: clamp(32px, 6vh, 56px) clamp(28px, 3vw, 48px) clamp(24px, 4vh, 36px);
  }

  /* Gelber Punkt neben dem Logo statt hinter der Karte */
  .bubble--4 {
    top: 40%;
    left: 38%;
  }
}

/* ---------- Animationen ---------- */

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes logo-in {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes card-in {
  from {
    transform: translateY(24px);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes confetti-float {
  0%,
  100% {
    transform: translateY(0) rotate(var(--r, 0deg));
  }
  50% {
    transform: translateY(-10px) rotate(var(--r, 0deg));
  }
}

@media (prefers-reduced-motion: reduce) {
  .bubble,
  .logo,
  .card,
  .confetti > span {
    animation: none;
  }

  .store-badge {
    transition: none;
  }
}
