/* Ekko — both pages (the landing and the app-link page; two byte-identical copies,
   test/copies.test.js). Brand: .artifacts/ekko/ekko-brand-kit (palette.json).
   Fonts are self-hosted (OFL), subset to Latin, Latin Extended-A and Cyrillic. */

@font-face {
  font-family: 'Manrope';
  font-weight: 500;
  font-display: swap;
  src: url('fonts/Manrope-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Manrope';
  font-weight: 700;
  font-display: swap;
  src: url('fonts/Manrope-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Manrope';
  font-weight: 800;
  font-display: swap;
  src: url('fonts/Manrope-800.woff2') format('woff2');
}
@font-face {
  font-family: 'Lora';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/Lora-Italic-400.woff2') format('woff2');
}

:root {
  color-scheme: light;
  --plum: #241d33;
  --headline: #2a1f3d;
  --muted: #6e6480;
  --violet: #6a5a9a;
  --lilac: #ddd3f0;
  --cream: #fbf3e4;
  --gold: #f7c777;
  --amber: #eec98a;
  --lavender: #e9defa;
  --peach: #fde3d3;
  --butter: #fcf0c4;
  --rose: #f9dbe3;
  --sans: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --serif: 'Lora', Georgia, 'Times New Roman', serif;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--plum);
  font: 500 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  background-color: var(--lavender);
  /* A pastel evening sky: lavender above, the warm glow of the glade below. */
  background-image:
    radial-gradient(120% 60% at 85% 18%, rgba(252, 240, 196, 0.75) 0%, rgba(252, 240, 196, 0) 60%),
    radial-gradient(90% 50% at 10% 85%, rgba(249, 219, 227, 0.8) 0%, rgba(249, 219, 227, 0) 70%),
    linear-gradient(180deg, #e9defa 0%, #efe4f8 42%, #f8e3e6 78%, #fde3d3 100%);
  background-attachment: fixed;
}

[hidden] {
  display: none !important;
}

.stage {
  max-width: 440px;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: center;
}

/* ── The name ─────────────────────────────────────────────────────────────── */
.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: 800 20px/1 var(--sans);
  letter-spacing: -0.01em;
  color: var(--headline);
}
.brand img {
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(42, 31, 61, 0.18);
}

/* ── Ekko, the hero ───────────────────────────────────────────────────────── */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 14px;
}

.sparkles {
  position: absolute;
  inset: 0 -10px auto;
  width: calc(100% + 20px);
  height: 100%;
  pointer-events: none;
}
.spark {
  fill: #fff;
  opacity: 0.9;
  transform-box: fill-box;
  transform-origin: center;
}

.bubble {
  position: relative;
  z-index: 1;
  max-width: 300px;
  min-height: 1.5em;
  margin: 0 0 14px;
  padding: 12px 18px;
  border-radius: 20px;
  /* Solid, so the tail (a rotated square under the edge) does not show through. */
  background: #fffcfe;
  border: 1px solid rgba(106, 90, 154, 0.14);
  box-shadow: 0 10px 28px rgba(42, 31, 61, 0.08);
  font: italic 400 18px/1.4 var(--serif);
  color: var(--headline);
}
.bubble:empty {
  visibility: hidden;
}
.bubble::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 16px;
  height: 16px;
  margin-left: -8px;
  background: inherit;
  border-right: inherit;
  border-bottom: inherit;
  border-bottom-right-radius: 4px;
  transform: rotate(45deg);
}

.ekko {
  position: relative;
  z-index: 1;
  display: block;
  width: auto;
  height: 196px;
  filter: drop-shadow(0 14px 18px rgba(106, 90, 154, 0.18));
}

.ground {
  width: 150px;
  height: 18px;
  margin-top: -8px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(106, 90, 154, 0.22), rgba(106, 90, 154, 0));
}

/* ── The words and the action ─────────────────────────────────────────────── */
.panel {
  margin-top: 10px;
}

.state {
  display: none;
}
.stage[data-state='loading'] [data-show~='loading'],
.stage[data-state='ready'] [data-show~='ready'],
.stage[data-state='desktop'] [data-show~='desktop'],
.stage[data-state='fallback'] [data-show~='fallback'],
/* the app-link page: one block may serve several states */
.stage[data-state='android'] [data-show~='android'],
.stage[data-state='ios'] [data-show~='ios'],
.stage[data-state='dead'] [data-show~='dead'] {
  display: block;
  animation: rise 0.45s ease-out both;
}

h1 {
  margin: 0;
  font: 800 30px/1.14 var(--sans);
  letter-spacing: -0.025em;
  color: var(--headline);
  text-wrap: balance;
}

.lead {
  margin: 10px auto 0;
  max-width: 34ch;
  font-size: 16.5px;
  color: var(--muted);
  text-wrap: pretty;
}

.cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  margin-top: 22px;
  padding: 0 22px;
  border-radius: 999px;
  background: linear-gradient(180deg, #f9d28d 0%, var(--gold) 55%, #f2b961 100%);
  box-shadow:
    0 12px 26px rgba(222, 160, 70, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.65);
  color: var(--headline);
  font: 700 17px/1.2 var(--sans);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease;
}
.cta::after {
  content: '→';
  font-weight: 700;
}
.cta:active {
  transform: translateY(1px) scale(0.985);
  box-shadow:
    0 6px 14px rgba(222, 160, 70, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.65);
}
.cta:focus-visible,
.pin:focus-visible,
a:focus-visible {
  outline: 3px solid var(--violet);
  outline-offset: 3px;
}

.note {
  margin: 12px auto 0;
  max-width: 34ch;
  font-size: 14px;
  color: var(--muted);
}
.note a,
.stores a {
  color: var(--violet);
  font-weight: 700;
  text-underline-offset: 3px;
}

/* ── The pin ──────────────────────────────────────────────────────────────── */
.pin-card {
  margin-top: 26px;
  padding: 18px 18px 16px;
  border-radius: 22px;
  background: rgba(251, 243, 228, 0.92);
  border: 1px solid rgba(238, 201, 138, 0.55);
  box-shadow: 0 8px 22px rgba(42, 31, 61, 0.06);
}
.pin-title {
  margin: 0;
  font: 700 15px/1.3 var(--sans);
  color: var(--headline);
}
.pin-how {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--muted);
}
.pin {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 10px 0;
  border: 1.5px dashed rgba(106, 90, 154, 0.35);
  border-radius: 16px;
  background: #fff;
  color: var(--headline);
  font: 800 30px/1.2 var(--sans);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.12em;
  cursor: pointer;
  /* Eight digits are not a phone number: no selection, no call menu. */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.pin-hint {
  margin: 8px 0 0;
  font: 700 13px/1.3 var(--sans);
  color: var(--violet);
}
.pin-expiry {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--muted);
}

/* ── Waiting ──────────────────────────────────────────────────────────────── */
.dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}
.dots i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--violet);
  opacity: 0.35;
  animation: dot 1.2s ease-in-out infinite;
}
.dots i:nth-child(2) {
  animation-delay: 0.15s;
}
.dots i:nth-child(3) {
  animation-delay: 0.3s;
}

/* ── Desktop ──────────────────────────────────────────────────────────────── */
.qr-card {
  display: inline-block;
  margin-top: 22px;
  padding: 16px;
  border-radius: 24px;
  background: #fff;
  box-shadow:
    0 14px 34px rgba(42, 31, 61, 0.1),
    0 0 0 1px rgba(106, 90, 154, 0.1);
  line-height: 0;
}
.qr-card svg {
  display: block;
  width: 208px;
  height: 208px;
}

.stores {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
  color: var(--muted);
}

.noscript {
  max-width: 440px;
  margin: 0 auto;
  padding: 0 20px 28px;
  text-align: center;
  color: var(--muted);
}

/* ── Wide screens: Ekko beside the words ──────────────────────────────────── */
@media (min-width: 820px) {
  .stage {
    max-width: 880px;
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr;
    column-gap: 56px;
    align-items: center;
    padding-top: 28px;
  }
  .brand {
    grid-column: 1 / -1;
    justify-content: flex-start;
    align-self: start;
  }
  .hero {
    margin-top: 0;
  }
  .ekko {
    height: 300px;
  }
  .ground {
    width: 210px;
  }
  .bubble {
    font-size: 20px;
  }
  .panel {
    margin-top: 0;
    text-align: left;
  }
  .lead,
  .note {
    margin-left: 0;
  }
  h1 {
    font-size: 38px;
  }
  .stores {
    justify-content: flex-start;
  }
}

@media (max-width: 360px) {
  h1 {
    font-size: 27px;
  }
  .ekko {
    height: 168px;
  }
  .pin {
    font-size: 27px;
  }
}

/* ── Motion: gentle, and none for those who asked for none ────────────────── */
@media (prefers-reduced-motion: no-preference) {
  .ekko {
    animation: float 5.5s ease-in-out infinite;
  }
  .ground {
    animation: shadow 5.5s ease-in-out infinite;
  }
  .spark {
    animation: twinkle 3.6s ease-in-out infinite;
  }
  .s2 {
    animation-delay: 0.9s;
  }
  .s3 {
    animation-delay: 1.8s;
  }
  .s4 {
    animation-delay: 2.7s;
  }
}
@media (prefers-reduced-motion: reduce) {
  .stage [data-show],
  .dots i {
    animation: none !important;
  }
  .dots i {
    opacity: 0.6;
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-7px);
  }
}
@keyframes shadow {
  0%,
  100% {
    transform: scaleX(1);
    opacity: 1;
  }
  50% {
    transform: scaleX(0.88);
    opacity: 0.7;
  }
}
@keyframes twinkle {
  0%,
  100% {
    transform: scale(0.6);
    opacity: 0.35;
  }
  50% {
    transform: scale(1);
    opacity: 0.95;
  }
}
@keyframes dot {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  50% {
    transform: translateY(-5px);
    opacity: 0.9;
  }
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
