/* Stonks — landing page
   Design tokens ported verbatim from the iOS app:
   Core/Theme/AppColors.swift, AppFonts.swift, AppSpacing.swift.
   The app is dark-only by construction (.preferredColorScheme(.dark)),
   so there is no light palette here either. */

:root {
  /* surfaces */
  --bg: #000000;
  --surface-1: #1C1C1E;
  --surface-2: #2C2C2E;
  --surface-3: #3A3A3C;
  --card: linear-gradient(180deg, #3E3E3E 0%, #2C2C2E 100%);

  /* accents */
  --accent: #0091FF;
  --green: #30D158;
  --orange: #FF9230;

  /* text ramp */
  --text-1: #FFFFFF;
  --text-2: rgba(255, 255, 255, .7);
  --text-3: rgba(255, 255, 255, .5);
  --text-4: rgba(255, 255, 255, .3);

  --separator: rgba(255, 255, 255, .1);
  --hairline: rgba(255, 255, 255, .06);

  /* SF Pro Rounded is the app's only typeface. No webfont request:
     the page must work offline and over file://. Exact on Apple
     platforms; degrades to the default system sans elsewhere. */
  --font: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont,
          "Segoe UI", system-ui, sans-serif;

  /* radii — 32 is the app's signature card radius */
  --r-card: 32px;
  --r-tile: 16px;

  /* spacing scale */
  --s-xs: 4px;
  --s-sm: 8px;
  --s-md: 12px;
  --s-lg: 16px;
  --s-xl: 24px;
  --s-xxl: 32px;

  /* the app's standard reveal curve:
     .spring(response: 0.55, dampingFraction: 0.85) */
  --spring: cubic-bezier(.22, 1.16, .36, 1);
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-xxl);

  padding: var(--s-xxl) var(--s-lg);
  padding-bottom: max(var(--s-xxl), env(safe-area-inset-bottom));

  background: var(--bg);
  color: var(--text-1);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;

  overflow-x: hidden;
}

/* ── Ambient field ───────────────────────────────────────────────
   Three blurred blooms, colours taken from the app's login screen
   (Features/Auth/LoginView.swift:48-98) — the app's literal front
   door. Sized in vmin so the composition holds at any viewport. */

.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  will-change: transform;
}

.blob--violet {
  width: 78vmin;
  height: 78vmin;
  left: -14vmin;
  top: -10vmin;
  background: radial-gradient(circle closest-side,
    rgba(102, 26, 153, .80) 0%,
    rgba(51, 13, 102, .40) 55%,
    transparent 100%);
  animation: drift-a 28s ease-in-out infinite;
}

.blob--indigo {
  width: 70vmin;
  height: 70vmin;
  right: -12vmin;
  top: -22vmin;
  background: radial-gradient(circle closest-side,
    rgba(51, 38, 140, .70) 0%,
    rgba(26, 26, 102, .30) 55%,
    transparent 100%);
  animation: drift-b 40s ease-in-out infinite;
}

.blob--magenta {
  width: 74vmin;
  height: 74vmin;
  right: -8vmin;
  bottom: -20vmin;
  background: radial-gradient(circle closest-side,
    rgba(115, 26, 89, .60) 0%,
    rgba(77, 13, 64, .30) 55%,
    transparent 100%);
  animation: drift-c 34s ease-in-out infinite;
}

/* Periods 28s / 40s / 34s are co-prime enough that the field
   never visibly repeats. */
@keyframes drift-a {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50%      { transform: translate3d(6vmin, 5vmin, 0) scale(1.12); }
}
@keyframes drift-b {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1.06); }
  50%      { transform: translate3d(-7vmin, 6vmin, 0) scale(.94); }
}
@keyframes drift-c {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50%      { transform: translate3d(-5vmin, -7vmin, 0) scale(1.1); }
}

/* The CSS analogue of the app's full-screen .ultraThinMaterial frost.
   This is what keeps the blooms reading as ambient light rather than
   as shapes. */
.frost {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: rgba(0, 0, 0, .30);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  pointer-events: none;
}

/* Sparkles sit above the frost so they stay crisp.
   Ported from SharedUI/Components/SparklesView.swift. */
#sparkles {
  position: fixed;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ── Hero ────────────────────────────────────────────────────────── */

.hero {
  position: relative;
  z-index: 3;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 34rem;
}

.mark {
  width: clamp(84px, 22vmin, 112px);
  height: clamp(84px, 22vmin, 112px);
  margin-bottom: var(--s-xl);
  border-radius: 23%;
  /* The app has only 8 shadows and every one is a coloured glow,
     never depth — so the mark glows in the accent hue. */
  box-shadow: 0 0 60px rgba(0, 145, 255, .45),
              0 0 140px rgba(0, 145, 255, .18);
}

.mark svg {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 23%;
}

.wordmark {
  margin: 0;
  font-size: clamp(44px, 13vw, 76px);
  font-weight: 700;
  letter-spacing: .4px;      /* the app's .tracking(0.4) */
  line-height: 1.05;
  color: var(--text-1);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s-sm);
  margin: var(--s-lg) 0 0;
  padding: var(--s-sm) var(--s-lg);

  font-size: 16px;
  font-weight: 500;
  color: var(--text-2);

  /* rgba(255,255,255,.06) is the app's exact segmented-control
     track fill (Features/Analytics/AnalyticsView.swift) */
  background: var(--hairline);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 999px;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}

.pill__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px rgba(48, 209, 88, .9);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1;  transform: scale(1); }
  50%      { opacity: .45; transform: scale(.82); }
}

.tagline {
  margin: var(--s-xl) 0 0;
  font-size: clamp(16px, 4.2vw, 19px);
  font-weight: 500;
  line-height: 1.45;         /* ≈ the app's .lineSpacing(2) at 16pt */
  color: var(--text-2);
  max-width: 26rem;
  text-wrap: balance;
}

.foot {
  position: relative;
  z-index: 3;
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .2px;
  color: var(--text-4);
}

/* ── Entrance ────────────────────────────────────────────────────── */

.reveal {
  animation: rise .8s var(--spring) both;
  animation-delay: var(--d, 0ms);
}

@keyframes rise {
  from { opacity: 0; transform: translate3d(0, 16px, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}

/* ── Narrow screens ──────────────────────────────────────────────── */

@media (max-width: 380px) {
  body { gap: var(--s-xl); }
  .mark { margin-bottom: var(--s-lg); }
  /* stack the tagline's two clauses instead of hyphenating them */
  .tagline__sep { display: block; height: 0; overflow: hidden; }
}

/* ── Reduced motion ──────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .blob, .pill__dot { animation: none; }
  .reveal {
    animation: none;
    opacity: 1;
    transform: none;
  }
}
