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

:root {
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-200: #bfdbfe;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --ink: #0f172a;
  --muted: #64748b;
  --muted-light: #94a3b8;
  --card: #ffffff;
  --ring: rgba(37, 99, 235, 0.18);
}

html,
body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, var(--blue-50) 0%, #ffffff 60%, var(--blue-50) 100%);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

/* Subtle drifting clouds */
.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.cloud {
  position: absolute;
  color: var(--blue-200);
  animation: drift linear forwards;
  will-change: transform;
}

@keyframes drift {
  from { transform: translateX(0); }
  to   { transform: translateX(130vw); }
}

/* Light rain — short streaks falling at a slight angle behind the clouds */
.rain {
  position: absolute;
  top: -40px;
  width: 2px;
  background: linear-gradient(180deg, transparent 0%, var(--blue-500) 25%, var(--blue-500) 100%);
  border-radius: 1px;
  animation: rain-fall linear forwards;
  will-change: transform;
}

@keyframes rain-fall {
  from { transform: translateY(0); }
  to   { transform: translateY(115vh); }
}

@media (prefers-reduced-motion: reduce) {
  .cloud { display: none; }
  .badge::before { animation: none; }
}

/* Layout */
.wrap {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  padding: 24px clamp(20px, 4vw, 40px);
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 0;
}

.logo {
  height: 40px;
  width: auto;
  display: block;
}

/* Hero */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 64px 0 48px;
}

.hero {
  max-width: 680px;
  margin: 0 auto;
  text-align: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  color: var(--blue-700);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: 20px;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue-500);
  box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.6);
  animation: pulse 2.2s ease-out infinite;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.5); }
  70%  { box-shadow: 0 0 0 8px rgba(59, 130, 246, 0); }
  100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

h1 {
  font-size: clamp(2.1rem, 5.5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin-bottom: 18px;
}

h1 .accent,
.legal h1 {
  background: linear-gradient(135deg, var(--blue-600), var(--blue-500));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.slogan {
  font-size: clamp(1.05rem, 2.2vw, 1.2rem);
  color: var(--muted);
  max-width: 540px;
  margin: 0 auto 36px;
}

/* Social-proof line below the form */
.signup-count {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  font-size: 0.9rem;
  color: var(--muted);
}

.avatars {
  display: flex;
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #fff;
  margin-left: -8px;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
  object-fit: cover;
  display: block;
}

.avatar:first-child { margin-left: 0; }

/* Form */
form {
  display: flex;
  gap: 8px;
  max-width: 460px;
  margin: 0 auto;
  background: var(--card);
  padding: 6px;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 8px 24px -8px rgba(37, 99, 235, 0.18);
  border: 1px solid var(--blue-100);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

form:focus-within {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 4px var(--ring), 0 8px 24px -8px rgba(37, 99, 235, 0.25);
}

input[type="email"] {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 0 14px;
  font: inherit;
  font-size: 0.98rem;
  color: var(--ink);
  min-width: 0;
}

input[type="email"]::placeholder {
  color: var(--muted-light);
}

button {
  border: 0;
  cursor: pointer;
  background: var(--blue-600);
  color: #fff;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 12px 22px;
  border-radius: 10px;
  transition: background 0.15s ease, transform 0.05s ease;
  white-space: nowrap;
}

button:hover  { background: var(--blue-700); }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.7; cursor: default; }

/* Keyboard-navigation focus rings (a11y) — only fire for keyboard, not mouse clicks */
:focus-visible {
  outline: 2px solid var(--blue-500);
  outline-offset: 2px;
}

/* The form already glows via :focus-within when the input is focused, so we
   suppress the input's own ring to avoid a double outline. */
input:focus-visible { outline: none; }

button:focus-visible { outline-offset: 3px; }

.form-note {
  margin-top: 12px;
  font-size: 0.82rem;
  color: var(--muted);
}

.form-note.success { color: var(--blue-700); font-weight: 500; }
.form-note.error   { color: #dc2626; }

.privacy-note {
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--muted);
}

.privacy-note a,
.legal a {
  text-decoration: underline;
  text-decoration-color: var(--blue-200);
  text-underline-offset: 2px;
}

.privacy-note a { color: inherit; }

.privacy-note a:hover { color: var(--blue-700); }

/* Legal / prose pages (privacy.html) */
.legal {
  max-width: 720px;
  margin: 16px auto 48px;
  padding: clamp(28px, 5vw, 44px) clamp(22px, 4vw, 44px);
  background: var(--card);
  border: 1px solid var(--blue-100);
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 12px 32px -12px rgba(37, 99, 235, 0.2);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.65;
}

.legal h1 {
  font-size: clamp(1.85rem, 4.4vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 4px;
}

.legal h2 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  margin: 28px 0 8px;
}

.legal p,
.legal li { color: var(--muted); margin-bottom: 10px; }

.legal ul { margin: 4px 0 14px 1.2rem; padding: 0; }
.legal li::marker { color: var(--blue-200); }

.legal strong { color: var(--ink); font-weight: 600; }

.legal a { color: var(--blue-700); }

.legal a:hover {
  color: var(--blue-600);
  text-decoration-color: var(--blue-500);
}

.legal-meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 24px;
}

/* Features */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin: 24px auto 0;
  max-width: 880px;
  width: 100%;
}

.feature {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--blue-100);
  border-radius: 14px;
  padding: 22px;
}

.feature .icon {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--blue-50);
  color: var(--blue-600);
  margin-bottom: 14px;
}

.feature .icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.feature h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.feature p {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.5;
}

@media (max-width: 520px) {
  main { padding: 32px 0 28px; }

  /* Heading scales down on phones — the desktop clamp's min is too big */
  h1 { font-size: 1.9rem; }
  .slogan { margin-bottom: 28px; }

  /* Form stacks; bigger touch targets */
  form { flex-direction: column; padding: 10px; gap: 10px; }
  input[type="email"] { padding: 12px 14px; }
  button { width: 100%; padding: 14px; }

  /* Social-proof line wraps gracefully on very narrow widths */
  .signup-count { flex-wrap: wrap; justify-content: center; }

  /* Smaller feature cards + force single-column stacking on phones —
     auto-fit was unreliable on real iOS/Android (DevTools and the device
     disagreed on track count). */
  .feature { padding: 18px; }
  .features { grid-template-columns: 1fr; gap: 14px; margin-top: 28px; }

  /* Logo trims slightly */
  .logo { height: 36px; }
}

@media (max-width: 360px) {
  h1 { font-size: 1.65rem; }
  .feature { padding: 16px; }
  .badge { font-size: 0.78rem; padding: 5px 10px; }
}

/* Lock landing/legal pages to the viewport on tall-enough desktops, compressing
   vertical spacing. The legal article scrolls internally when it overflows, so
   the body never scrolls. Below 620px tall (or on mobile) the default
   scrollable layout is kept. */
@media (min-width: 521px) and (min-height: 620px) {
  body:is(:has(.hero), :has(.legal)) {
    height: 100dvh;
    min-height: 0;
    overflow: hidden;

    .wrap { padding-block: clamp(12px, 2.2vh, 24px); min-height: 0; }
  }

  body:has(.hero) {
    main { padding: clamp(16px, 5vh, 64px) 0 clamp(12px, 4vh, 48px); }
    .badge { margin-bottom: clamp(10px, 2vh, 20px); }
    h1 { margin-bottom: clamp(10px, 1.8vh, 18px); }
    .slogan { margin-bottom: clamp(16px, 3.6vh, 36px); }
    .signup-count { margin-top: clamp(10px, 1.8vh, 18px); }
    .features {
      grid-template-columns: repeat(3, 1fr);
      margin-top: clamp(14px, 2.4vh, 24px);
      gap: clamp(10px, 1.8vh, 18px);
    }
    .feature { padding: clamp(14px, 2.2vh, 22px); }
  }

  body:has(.legal) {
    main {
      padding: clamp(16px, 4vh, 64px) 0 clamp(12px, 3.5vh, 48px);
      justify-content: safe center;
      min-height: 0;
      overflow-y: auto;
    }
    .legal {
      margin-block: 0;
      padding-block: clamp(20px, 4vh, 44px);
    }
  }
}

/* Cloud-burst on successful signup */
.burst {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 100;
  animation: burst-out cubic-bezier(.2, .6, .35, 1) forwards;
  will-change: transform, opacity;
}

@keyframes burst-out {
  from {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  to {
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.4);
    opacity: 0;
  }
}
