/*
 * Blush V2 — Pinot Noir
 * Deep burgundy/plum palette - berry/ink not caramel/chocolate.
 */

/* ─────────────────────────────────────────────────────────
   ROLLBACK: Previous "Moonlit Velvet" palette
   --void: #0a0507; --mid: #2a0b12; --ember: #5b0f1f;
   --cream: rgba(245, 231, 210, 0.92);
   body bg: radial-gradient(550px 400px at 50% 40%, rgba(110, 24, 46, 0.18)...
   orb: rgba(110, 24, 46, 0.55) 0%, rgba(95, 20, 38, 0.30) 30%...
   ───────────────────────────────────────────────────────── */

/* ─────────────────────────────────────────────────────────
   Typography — DM Serif Display + DM Sans
   ───────────────────────────────────────────────────────── */

:root {
  /* Safe area anchors */
  --safeTop: env(safe-area-inset-top, 0px);
  --safeBottom: env(safe-area-inset-bottom, 0px);

  /* Spacing scale */
  --s1: 6px;
  --s2: 10px;
  --s3: 14px;
  --s4: 18px;
  --s5: 24px;
  --s6: 32px;

  /* Form width */
  --form-w: min(360px, 78vw);

  /* Typography */
  --font-logo: "DM Serif Display", serif;
  --font-ui: "DM Sans", system-ui, -apple-system, sans-serif;

  /* Pinot Noir palette — berry/ink, not brown */
  --pn-black: #050107;   /* near-black with violet bias */
  --pn-deep:  #12020b;   /* deep noir */
  --pn-wine:  #2b0817;   /* pinot core */
  --pn-berry: #3a0b22;   /* lifted wine */
  --pn-cream: #F4D9C8;   /* warm paper */

  /* Legacy aliases */
  --void: var(--pn-black);
  --mid: var(--pn-wine);
  --ember: var(--pn-berry);

  /* Cream — single source of truth (space-separated RGB) */
  --cream: 244 217 200; /* #F4D9C8 */

  /* Text opacity tokens */
  --text-main: rgb(var(--cream) / 0.92);      /* tagline */
  --text-interactive: rgb(var(--cream) / 0.72); /* placeholder */
  --text-meta: rgb(var(--cream) / 0.52);      /* helper/braces */
  --text-footer: rgb(var(--cream) / 0.52);    /* footer */

  /* Legacy aliases */
  --cream-soft: rgb(var(--cream) / 0.72);

  /* Borders & edges — wine-tinted, not gray */
  --edge: rgba(243, 230, 213, 0.22);
  --edge-hover: rgba(243, 230, 213, 0.32);

  /* The orb — wine glow */
  --orb-core: rgba(58, 11, 34, 0.55);
  --orb-mid: rgba(43, 8, 23, 0.35);
  --orb-outer: rgba(18, 2, 11, 0.20);

  /* Focus ring */
  --ring: rgba(243, 230, 213, 0.25);
  --ring-outer: rgba(243, 230, 213, 0.12);
}

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

html {
  height: 100%;
}

html, body {
  font-family: var(--font-ui);
  font-weight: 400;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
}

body {
  min-height: 100%;
  color: var(--text);
  background:
    /* Wine glow at center */
    radial-gradient(600px 420px at 50% 34%,
      color-mix(in srgb, var(--pn-berry) 70%, transparent) 0%,
      color-mix(in srgb, var(--pn-wine) 55%, transparent) 42%,
      transparent 70%),
    /* Vignette */
    radial-gradient(1200px 900px at 50% 50%,
      rgba(0,0,0,0) 35%,
      rgba(0,0,0,.62) 78%,
      rgba(0,0,0,.82) 100%),
    /* Base gradient */
    linear-gradient(180deg, var(--pn-deep), var(--pn-black));
  overflow-x: hidden;
  line-height: 1.6;
}

/* Force form controls to inherit */
button, input, textarea, select {
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
}

/* ─────────────────────────────────────────────────────────
   The Orb — single soft light source, bottom-right
   ───────────────────────────────────────────────────────── */

.orb {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 75vmax;
  height: 55vmax;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(
    ellipse at 50% 50%,
    rgba(58, 11, 34, 0.60) 0%,      /* --pn-berry */
    rgba(43, 8, 23, 0.35) 30%,       /* --pn-wine */
    rgba(18, 2, 11, 0.15) 50%,       /* --pn-deep */
    transparent 70%
  );
  filter: blur(90px);
  transform: translate(-50%, -50%);
  opacity: 0.85;
  will-change: opacity, transform;
  animation:
    orb-breathe 6s ease-in-out infinite,
    orb-drift 7s ease-in-out infinite;
}

@keyframes orb-breathe {
  0%, 100% { opacity: 0.65; }
  50% { opacity: 1; }
}

@keyframes orb-drift {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1, 1);
  }
  /* Gentle ambient movement — subtle, not distracting */
  25% {
    transform: translate(-48%, -52%) scale(1.04, 0.97);
  }
  50% {
    transform: translate(-52%, -48%) scale(0.97, 1.04);
  }
  75% {
    transform: translate(-49%, -51%) scale(1.02, 0.98);
  }
}

/* Mouse following — JS controls transform, keep breathing */
.orb.mouse-active {
  animation: orb-breathe 8s ease-in-out infinite;
}

/* Settle lower when user is typing — very visible drift */
.orb.at-rest {
  animation: none;
  transform: translate(-50%, -5%) scale(1.25, 0.82);
  transition: transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.orb.waking {
  animation: none;
  transition: transform 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.8s ease;
}

/* Sensual pulse on keystroke — like a heartbeat */
.orb.pulse {
  animation: keystroke-pulse 0.7s ease-in-out forwards;
}

@keyframes keystroke-pulse {
  0% {
    opacity: 0.85;
    filter: blur(90px) brightness(1);
  }
  35% {
    opacity: 0.95;
    filter: blur(80px) brightness(1.25);
  }
  65% {
    opacity: 1;
    filter: blur(75px) brightness(1.35);
  }
  100% {
    opacity: 0.85;
    filter: blur(90px) brightness(1);
  }
}

/* ─────────────────────────────────────────────────────────
   Waves — concentric ripples emanating from center
   ───────────────────────────────────────────────────────── */

.waves {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 200vmax;
  height: 200vmax;
  pointer-events: none;
  z-index: 0;
}

.waves::before,
.waves::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  filter: blur(80px);
}

/* Inner wave - faster pulse */
.waves::before {
  width: 70%;
  height: 70%;
  background: radial-gradient(
    ellipse at center,
    rgba(110, 24, 46, 0.20) 0%,
    rgba(90, 20, 38, 0.12) 40%,
    transparent 70%
  );
  animation: wave-pulse 12s ease-in-out infinite;
}

/* Outer wave - slower, larger pulse */
.waves::after {
  width: 100%;
  height: 100%;
  background: radial-gradient(
    ellipse at center,
    rgba(95, 22, 40, 0.14) 0%,
    rgba(75, 18, 32, 0.07) 50%,
    transparent 75%
  );
  animation: wave-pulse 18s ease-in-out infinite;
  animation-delay: -6s;
}

@keyframes wave-pulse {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.6;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.15);
    opacity: 1;
  }
}

/* ─────────────────────────────────────────────────────────
   Bokeh — soft floating circles, dreamy depth
   ───────────────────────────────────────────────────────── */

.bokeh {
  display: none;
  z-index: 0;
  overflow: hidden;
}

.bokeh::before,
.bokeh::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(28px);
  opacity: 0;
  animation: bokeh-float 20s ease-in-out infinite;
}

.bokeh::before {
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(255, 160, 140, 0.32) 0%, transparent 65%);
  top: 15%;
  left: 10%;
  animation-delay: 0s;
  animation-duration: 25s;
}

.bokeh::after {
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, rgba(255, 190, 170, 0.28) 0%, transparent 65%);
  top: 60%;
  right: 15%;
  animation-delay: -8s;
  animation-duration: 22s;
}

@keyframes bokeh-float {
  0%, 100% {
    opacity: 0;
    transform: translateY(0) scale(1);
  }
  15% {
    opacity: 0.7;
  }
  50% {
    opacity: 0.9;
    transform: translateY(-35px) scale(1.15);
  }
  85% {
    opacity: 0.6;
  }
}

/* ─────────────────────────────────────────────────────────
   Embers — warm floating particles
   ───────────────────────────────────────────────────────── */

/* Ember element base styles */
.ember {
  position: fixed;
  border-radius: 50%;
  background: rgba(255, 150, 130, 0.7);
  box-shadow: 0 0 6px 2px rgba(255, 140, 120, 0.4);
  pointer-events: none;
  z-index: 0;
  opacity: 0;
}

.ember.size-sm { width: 3px; height: 3px; }
.ember.size-md { width: 4px; height: 4px; }

/* Position variants */
.ember.pos-1 { left: 18%; bottom: 6%; }
.ember.pos-2 { left: 25%; bottom: 8%; }
.ember.pos-3 { right: 18%; bottom: 7%; left: auto; }
.ember.pos-4 { right: 25%; bottom: 5%; left: auto; }
.ember.pos-5 { left: 30%; bottom: 4%; }
.ember.pos-6 { right: 30%; bottom: 6%; left: auto; }

/* Animation variants - longer durations, taller rise */
.ember.ember-v1 { animation: ember-v1 28s ease-in-out forwards; }
.ember.ember-v2 { animation: ember-v2 32s ease-in-out forwards; }
.ember.ember-v3 { animation: ember-v3 25s ease-in-out forwards; }
.ember.ember-v4 { animation: ember-v4 30s ease-in-out forwards; }
.ember.ember-v5 { animation: ember-v5 27s ease-in-out forwards; }

/* Variant 1 - wavy S-curve rise */
@keyframes ember-v1 {
  0% { transform: translate(0, 0); opacity: 0; }
  5% { transform: translate(3px, -3vh); opacity: 0.88; }
  15% { transform: translate(14px, -12vh); opacity: 0.82; }
  25% { transform: translate(8px, -20vh); }
  35% { transform: translate(-6px, -28vh); opacity: 0.65; }
  45% { transform: translate(-14px, -36vh); }
  55% { transform: translate(-8px, -43vh); opacity: 0.5; }
  65% { transform: translate(5px, -50vh); }
  75% { transform: translate(12px, -55vh); opacity: 0.32; }
  85% { transform: translate(6px, -58vh); opacity: 0.16; }
  100% { transform: translate(-4px, -62vh); opacity: 0; }
}

/* Variant 2 - wide meandering drift */
@keyframes ember-v2 {
  0% { transform: translate(0, 0); opacity: 0; }
  6% { transform: translate(-5px, -4vh); opacity: 0.92; }
  14% { transform: translate(-16px, -11vh); }
  22% { transform: translate(-10px, -18vh); opacity: 0.75; }
  32% { transform: translate(8px, -26vh); }
  42% { transform: translate(18px, -34vh); opacity: 0.58; }
  52% { transform: translate(12px, -42vh); }
  62% { transform: translate(-4px, -50vh); opacity: 0.42; }
  72% { transform: translate(-14px, -56vh); }
  82% { transform: translate(-8px, -61vh); opacity: 0.2; }
  100% { transform: translate(6px, -68vh); opacity: 0; }
}

/* Variant 3 - gentle wobble rise */
@keyframes ember-v3 {
  0% { transform: translate(0, 0); opacity: 0; }
  8% { transform: translate(6px, -5vh); opacity: 0.85; }
  18% { transform: translate(-4px, -13vh); }
  28% { transform: translate(-12px, -21vh); opacity: 0.68; }
  38% { transform: translate(-6px, -28vh); }
  48% { transform: translate(8px, -35vh); opacity: 0.52; }
  58% { transform: translate(15px, -42vh); }
  68% { transform: translate(10px, -48vh); opacity: 0.36; }
  78% { transform: translate(-2px, -52vh); }
  88% { transform: translate(-10px, -55vh); opacity: 0.15; }
  100% { transform: translate(-5px, -58vh); opacity: 0; }
}

/* Variant 4 - lazy leftward drift */
@keyframes ember-v4 {
  0% { transform: translate(0, 0); opacity: 0; }
  7% { transform: translate(-4px, -4vh); opacity: 0.8; }
  16% { transform: translate(6px, -12vh); }
  26% { transform: translate(-2px, -20vh); opacity: 0.68; }
  36% { transform: translate(-14px, -28vh); }
  46% { transform: translate(-20px, -36vh); opacity: 0.52; }
  56% { transform: translate(-12px, -43vh); }
  66% { transform: translate(-22px, -50vh); opacity: 0.36; }
  76% { transform: translate(-16px, -55vh); }
  86% { transform: translate(-24px, -58vh); opacity: 0.15; }
  100% { transform: translate(-18px, -62vh); opacity: 0; }
}

/* Variant 5 - lazy rightward drift */
@keyframes ember-v5 {
  0% { transform: translate(0, 0); opacity: 0; }
  7% { transform: translate(5px, -5vh); opacity: 0.85; }
  16% { transform: translate(-4px, -13vh); }
  26% { transform: translate(10px, -21vh); opacity: 0.68; }
  36% { transform: translate(18px, -29vh); }
  46% { transform: translate(12px, -37vh); opacity: 0.5; }
  56% { transform: translate(22px, -44vh); }
  66% { transform: translate(16px, -51vh); opacity: 0.36; }
  76% { transform: translate(26px, -56vh); }
  86% { transform: translate(20px, -59vh); opacity: 0.15; }
  100% { transform: translate(28px, -63vh); opacity: 0; }
}

/* ─────────────────────────────────────────────────────────
   Light Leak — soft warm glow at edges
   ───────────────────────────────────────────────────────── */

.light-leak {
  display: none;
  overflow: hidden;
}

.light-leak::before {
  content: "";
  position: absolute;
  width: 50%;
  height: 60%;
  top: -10%;
  right: -15%;
  background: radial-gradient(
    ellipse at center,
    rgba(255, 160, 140, 0.18) 0%,
    rgba(255, 130, 110, 0.10) 40%,
    transparent 70%
  );
  filter: blur(45px);
  animation: leak-drift 30s ease-in-out infinite;
}

.light-leak::after {
  content: "";
  position: absolute;
  width: 40%;
  height: 50%;
  bottom: -5%;
  left: -10%;
  background: radial-gradient(
    ellipse at center,
    rgba(255, 180, 150, 0.14) 0%,
    rgba(255, 150, 130, 0.08) 40%,
    transparent 70%
  );
  filter: blur(40px);
  animation: leak-drift 35s ease-in-out infinite reverse;
  animation-delay: -15s;
}

@keyframes leak-drift {
  0%, 100% {
    transform: translate(0, 0) scale(1);
    opacity: 0.6;
  }
  33% {
    transform: translate(5%, 3%) scale(1.1);
    opacity: 1;
  }
  66% {
    transform: translate(-3%, -2%) scale(0.95);
    opacity: 0.7;
  }
}

/* ─────────────────────────────────────────────────────────
   Vignette — heavy edges fade to true darkness
   ───────────────────────────────────────────────────────── */

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(
    ellipse 70% 60% at 50% 50%,
    transparent 10%,
    rgba(21, 0, 7, 0.35) 50%,
    rgba(15, 0, 6, 0.80) 100%
  );
  animation: vignette-breathe 60s ease-in-out infinite;
}

@keyframes vignette-breathe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.92; }
}

/* ─────────────────────────────────────────────────────────
   Grain — subtle texture
   ───────────────────────────────────────────────────────── */

.grain {
  position: fixed;
  inset: -10px;
  pointer-events: none;
  z-index: 2;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23g)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  animation: grain-shift 8s steps(10) infinite;
}

@keyframes grain-shift {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-2%, -2%); }
  20% { transform: translate(1%, 3%); }
  30% { transform: translate(-3%, 1%); }
  40% { transform: translate(3%, -1%); }
  50% { transform: translate(-1%, 2%); }
  60% { transform: translate(2%, -3%); }
  70% { transform: translate(-2%, 1%); }
  80% { transform: translate(1%, -2%); }
  90% { transform: translate(3%, 2%); }
}

/* ─────────────────────────────────────────────────────────
   Shell — centers content
   ───────────────────────────────────────────────────────── */

.shell {
  position: relative;
  z-index: 3;
  min-height: 100svh;
  min-height: 100dvh; /* dynamic viewport for keyboard */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(24px, 6vh, 72px) var(--s4);
  text-align: center;
}

/* ─────────────────────────────────────────────────────────
   Content — floating in the void
   ───────────────────────────────────────────────────────── */

.content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: clamp(420px, 44vw, 520px); /* content column - underline = 100% of this */
  max-width: 520px;
  margin: 0 auto;
  padding-bottom: 80px; /* button → footer gap */
}

/* Glass depth overlay */
.content::before {
  content: "";
  position: absolute;
  inset: -40px;
  background: radial-gradient(closest-side at 50% 35%,
    rgba(255,255,255,0.06), rgba(0,0,0,0) 55%);
  mix-blend-mode: soft-light;
  pointer-events: none;
  z-index: -1;
}

/* Copy block — logo + tagline + subline */
.copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 0; /* secondary handles gap to form */
}

.primary {
  opacity: 0;
  -webkit-animation: emerge 1.4s cubic-bezier(0.33, 1, 0.68, 1) 0.35s forwards;
  animation: emerge 1.4s cubic-bezier(0.33, 1, 0.68, 1) 0.35s forwards;
}

.secondary {
  opacity: 0;
  -webkit-animation: emerge 1.4s cubic-bezier(0.33, 1, 0.68, 1) 0.6s forwards;
  animation: emerge 1.4s cubic-bezier(0.33, 1, 0.68, 1) 0.6s forwards;
}

.form-reveal {
  opacity: 0;
  transform: translate3d(0, 20px, 0) scale(0.98);
  -webkit-transform: translate3d(0, 20px, 0) scale(0.98);
  transition: opacity 800ms cubic-bezier(0.22, 1, 0.36, 1),
              transform 1000ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.form-reveal.is-in {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
  -webkit-transform: translate3d(0, 0, 0) scale(1);
}

@-webkit-keyframes emerge {
  from {
    opacity: 0;
    -webkit-transform: translateY(16px);
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    -webkit-transform: translateY(0);
    transform: translateY(0);
  }
}

@keyframes emerge {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@-webkit-keyframes emerge-form {
  from {
    opacity: 0;
    -webkit-transform: translateY(20px) scale(0.98);
    transform: translateY(20px) scale(0.98);
  }
  50% {
    opacity: 0.8;
  }
  to {
    opacity: 1;
    -webkit-transform: translateY(0) scale(1);
    transform: translateY(0) scale(1);
  }
}

@keyframes emerge-form {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  50% {
    opacity: 0.8;
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ─────────────────────────────────────────────────────────
   Typography
   ───────────────────────────────────────────────────────── */

.brand {
  font-family: var(--font-logo);
  font-size: clamp(6rem, 14vw, 8.5rem);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1;
  margin: 0 0 24px 0; /* logo → tagline: 24px */
  color: rgb(var(--cream));
  user-select: none;
  -webkit-user-select: none;
  cursor: default;
  text-shadow:
    0 1px 18px rgba(0, 0, 0, 0.35),
    0 0 48px rgba(255, 210, 190, 0.08),
    0 0 80px rgba(140, 31, 45, 0.40);
  opacity: 0;
  will-change: opacity, transform;
  transform: translateZ(0);
  -webkit-animation: emerge-brand 1.6s cubic-bezier(0.16, 1, 0.3, 1) 0.1s forwards;
  animation: emerge-brand 1.6s cubic-bezier(0.16, 1, 0.3, 1) 0.1s forwards;
}

@-webkit-keyframes emerge-brand {
  from {
    opacity: 0;
    -webkit-transform: translateY(24px) scale(0.96);
    transform: translateY(24px) scale(0.96);
    -webkit-filter: blur(4px);
    filter: blur(4px);
  }
  60% {
    -webkit-filter: blur(0);
    filter: blur(0);
  }
  to {
    opacity: 1;
    -webkit-transform: translateY(0) scale(1);
    transform: translateY(0) scale(1);
    -webkit-filter: blur(0);
    filter: blur(0);
  }
}

@keyframes emerge-brand {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
    filter: blur(4px);
  }
  60% {
    filter: blur(0);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@-webkit-keyframes emerge-brand {
  from {
    opacity: 0;
    -webkit-transform: translateY(24px) scale(0.96);
            transform: translateY(24px) scale(0.96);
    -webkit-filter: blur(4px);
            filter: blur(4px);
  }
  60% {
    -webkit-filter: blur(0);
            filter: blur(0);
  }
  to {
    opacity: 1;
    -webkit-transform: translateY(0) scale(1);
            transform: translateY(0) scale(1);
    -webkit-filter: blur(0);
            filter: blur(0);
  }
}

.primary {
  font-family: var(--font-ui);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.25;
  color: var(--text-main);
  margin: 0; /* tagline → helper gap handled by helper margin-top */
  will-change: opacity, transform;
  transform: translateZ(0);
}

.secondary {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.25;
  text-transform: lowercase;
  color: rgb(var(--cream) / 0.72);
  margin: 0 0 26px 0; /* separate from email section */
  transition: color 800ms ease;
  will-change: opacity, transform;
  transform: translateZ(0);
}

/* ─────────────────────────────────────────────────────────
   Form — minimal, stacked
   ───────────────────────────────────────────────────────── */

.form {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  width: 100%;
  /* No animation - parent .form-reveal handles reveal */
}

.form::before {
  content: "";
  position: absolute;
  inset: -40px -60px;
  background: radial-gradient(
    ellipse 100% 100% at 50% 50%,
    rgba(255, 255, 255, 0.012) 0%,
    transparent 70%
  );
  pointer-events: none;
  z-index: -1;
}

/* Helper text - in .copy, animates with logo/tagline */
.helper {
  position: relative;
  height: 16px;
  margin-top: 12px; /* tagline → helper: 12px */
  margin-bottom: 28px; /* helper → email label: 28px desktop */
  opacity: 0;
  -webkit-animation: emerge 1.2s cubic-bezier(0.33, 1, 0.68, 1) 0.55s forwards;
  animation: emerge 1.2s cubic-bezier(0.33, 1, 0.68, 1) 0.55s forwards;
}

.helper .idle,
.helper .focus {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.25;
  text-transform: lowercase;
  color: var(--text-meta);
  white-space: nowrap;
  will-change: opacity;
}

/* Base state (idle visible, focus hidden) */
.helper .idle {
  opacity: 1;
  transition: opacity 500ms cubic-bezier(0.4, 0, 0.2, 1) 200ms;
}

.helper .focus {
  opacity: 0;
  transition: opacity 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Input focused state - toggled via JS class on body */
body.input-focused .helper .idle {
  opacity: 0;
  transition: opacity 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

body.input-focused .helper .focus {
  opacity: 1;
  transition: opacity 500ms cubic-bezier(0.4, 0, 0.2, 1) 200ms;
}

/* Input line brightens on focus */
body.input-focused .emailLine {
  border-bottom-color: rgb(var(--cream) / 0.32);
}

/* Hide password manager icons */
input::-webkit-credentials-auto-fill-button,
input::-webkit-contacts-auto-fill-button,
input::-webkit-credit-card-auto-fill-button {
  visibility: hidden;
  display: none !important;
  pointer-events: none;
  position: absolute;
  right: 0;
}

/* Hide LastPass */
[data-lastpass-icon-root],
[data-lastpass-root],
div[data-lastpass-icon-root],
div[data-lastpass-root],
.lastpass-icon,
#__lpform_input_idx_0,
[id^="__lpform"],
[class*="lastpass"] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  pointer-events: none !important;
}

/* Hide 1Password, Bitwarden, Dashlane */
[data-com-onepassword-filled],
com-1password-button,
[data-dashlanecreated],
[style*="data:image/svg+xml"] {
  display: none !important;
}

/* Field wrapper */
.field {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

/* Field label - above the input */
.fieldLabel {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0;
  color: rgb(var(--cream) / 0.62);
  margin: 0;
  text-align: center;
}

/* Form block - controls input line width */
.formBlock {
  width: clamp(320px, 42vw, 460px); /* desktop sweet spot */
  margin: 0 auto 16px; /* underline → button: 16px */
}

input[type="email"] {
  width: 100%;
  height: 44px;
  padding: 12px 2px 14px; /* label → underline: ~12px */
  margin: 0;
  border: none;
  border-bottom: 1px solid rgb(var(--cream) / 0.28); /* light but present */
  border-radius: 0;
  background: transparent;
  color: var(--text-main);
  caret-color: rgb(var(--cream) / 0.85);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.25;
  text-align: center;
  outline: none;
  /* Safari mobile fixes */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition:
    border-color 200ms ease,
    box-shadow 200ms ease;
}

input[type="email"]::placeholder {
  color: var(--text-interactive);
  transition: color 300ms ease;
}

input[type="email"]:focus::placeholder {
  color: rgb(var(--cream) / 0.86);
}

input[type="email"]:hover {
  border-bottom-color: rgb(var(--cream) / 0.24);
}

input[type="email"]:focus {
  border-bottom-color: rgb(var(--cream) / 0.32);
  box-shadow: 0 10px 18px -18px rgba(255, 77, 109, 0.45);
}

/* Fix iOS/Safari autofill background color */
input[type="email"]:-webkit-autofill,
input[type="email"]:-webkit-autofill:hover,
input[type="email"]:-webkit-autofill:focus,
input[type="email"]:-webkit-autofill:active {
  -webkit-background-clip: text;
  -webkit-text-fill-color: rgb(var(--cream) / 0.88);
  transition: background-color 5000s ease-in-out 0s;
  box-shadow: inset 0 0 20px 20px transparent;
}

button[type="submit"] {
  min-height: 42px;
  padding: 12px 22px;
  border: 1px solid rgb(var(--cream) / 0.22);
  border-radius: 22px;
  background: rgba(58, 11, 34, 0.18);
  color: var(--cream-soft);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.25;
  cursor: pointer;
  /* Safari mobile fixes */
  touch-action: manipulation; /* removes 300ms tap delay */
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
  transition:
    color 200ms ease,
    border-color 200ms ease,
    background 200ms ease,
    box-shadow 200ms ease,
    transform 100ms ease;
}

button[type="submit"]:hover {
  color: var(--text-main);
  border-color: rgb(var(--cream) / 0.28);
  background: rgba(58, 11, 34, 0.26);
}

button[type="submit"]:active,
button[type="submit"].touch-active {
  transform: scale(0.96);
  background: rgba(58, 11, 34, 0.32);
  transition: transform 50ms ease, background 50ms ease;
}

button[type="submit"]:focus-visible {
  outline: none;
  border-color: rgb(var(--cream) / 0.38);
}

/* Button success state — neon glow */
button[type="submit"].success {
  border-color: rgba(255, 180, 190, 0.65);
  background: transparent;
  color: rgb(var(--cream));
  text-shadow: 0 0 6px rgba(255, 200, 210, 0.4);
  box-shadow:
    0 0 8px rgba(255, 170, 185, 0.3),
    0 0 16px rgba(255, 150, 170, 0.18),
    0 0 30px rgba(255, 130, 160, 0.1),
    inset 0 0 12px rgba(255, 180, 195, 0.06);
  animation: neon-pulse 1.5s ease-in-out infinite;
  pointer-events: none;
  transition: all 0.8s ease-out;
}

/* Smooth fade out when success ends */
button[type="submit"]:not(.success) {
  transition: all 0.6s ease-out;
}

@keyframes neon-pulse {
  0%, 100% {
    border-color: rgba(255, 180, 190, 0.65);
    box-shadow:
      0 0 8px rgba(255, 170, 185, 0.3),
      0 0 16px rgba(255, 150, 170, 0.18),
      0 0 30px rgba(255, 130, 160, 0.1),
      inset 0 0 12px rgba(255, 180, 195, 0.06);
  }
  50% {
    border-color: rgba(255, 200, 210, 0.8);
    box-shadow:
      0 0 12px rgba(255, 180, 195, 0.38),
      0 0 22px rgba(255, 160, 180, 0.25),
      0 0 38px rgba(255, 140, 165, 0.14),
      inset 0 0 16px rgba(255, 190, 200, 0.08);
  }
}

/* Success tick icon */
button[type="submit"] .tick {
  display: inline-block;
  margin-left: 0.15em;
  font-size: 1em;
  text-shadow: none;
}

/* Button error state — holds red with soft glow, then fades back */
button[type="submit"].error {
  border-color: rgba(255, 110, 110, 0.6) !important;
  box-shadow: 0 0 20px rgba(255, 90, 90, 0.15), 0 0 40px rgba(255, 90, 90, 0.08);
  transition: border-color 600ms ease-out, box-shadow 600ms ease-out;
}

/* ─────────────────────────────────────────────────────────
   Utility
   ───────────────────────────────────────────────────────── */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ─────────────────────────────────────────────────────────
   Footer
   ───────────────────────────────────────────────────────── */

.footer {
  position: fixed;
  bottom: 22px;
  left: 0;
  right: 0;
  z-index: 10;
  padding: 0 var(--s4);
  text-align: center;
  opacity: 0;
  animation: fade-in 0.6s ease 1.5s forwards;
}

@keyframes fade-in {
  to { opacity: 1; }
}

.footer p {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.25;
  color: var(--text-footer);
}


/* ─────────────────────────────────────────────────────────
   Reduced Motion
   ───────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .orb,
  .vignette,
  .waves::before,
  .waves::after,
  .bokeh::before,
  .bokeh::after,
  .ember,
  .light-leak::before,
  .light-leak::after,
  .grain {
    animation: none;
  }

  .orb {
    opacity: 0.85;
    transform: translate(-50%, -50%);
  }

  .bokeh::before,
  .bokeh::after {
    opacity: 0.5;
  }

  .grain {
    transform: none;
  }

  button[type="submit"].success {
    animation: none;
  }

  input[type="email"],
  button[type="submit"] {
    transition: none;
  }
}

/* ─────────────────────────────────────────────────────────
   Responsive
   ───────────────────────────────────────────────────────── */

/* Email input width - responsive */
.emailLine { width: min(420px, 46vw); }

/* Tablet: restrained but readable */
@media (min-width: 481px) and (max-width: 1024px) {
  .emailLine { width: min(420px, 70vw); }
}

/* Mobile: intimate, ~1.2-1.4× logo width */
@media (max-width: 480px) {
  .emailLine { width: min(300px, 68vw); }
}
/* Tablet */
@media (max-width: 1024px) {
  .content {
    width: clamp(320px, 72vw, 560px);
    max-width: 560px;
  }

  .formBlock {
    width: min(560px, 72vw);
  }
}

/* Tablet (481px - 1024px) */
@media (min-width: 481px) and (max-width: 1024px) {
  .shell {
    padding-top: clamp(96px, 16svh, 140px);
  }

  .brand { margin-bottom: clamp(18px, 2.2svh, 28px); }
  .primary { margin-bottom: 8px; }
  .helper { margin-top: 0; line-height: 1.25; }

  .form-reveal { margin-top: clamp(26px, 4.5svh, 38px); }
  .formBlock {
    width: min(440px, 74vw);
    margin-bottom: 16px;
  }
  .footer { margin-top: clamp(28px, 10svh, 56px); }
}

/* Tablet short-height */
@media (min-width: 481px) and (max-width: 1024px) and (max-height: 820px) {
  .shell { padding-top: clamp(72px, 12svh, 100px); }
  .form-reveal { margin-top: clamp(20px, 3.5svh, 28px); }
}

/* Mobile (≤ 480px) */
@media (max-width: 480px) {
  :root {
    --form-w: min(320px, 72vw);
  }

  .shell {
    min-height: 100svh;
    display: grid;
    place-items: center;
    padding: var(--s3);
    padding-top: clamp(72px, 14svh, 96px);
    padding-bottom: env(safe-area-inset-bottom, 16px);
    transition: padding-top 0.3s ease;
  }

  .content {
    width: min(86vw, 340px);
    max-width: 340px;
    padding-bottom: 56px;
    transform: none;
  }

  .brand { margin-bottom: var(--s5); } /* 24px */
  .primary { margin-bottom: var(--s1); } /* 6px */
  .helper { margin-top: 0; line-height: 1.25; }

  .form-reveal { margin-top: clamp(22px, 5svh, 32px); }
  .formBlock {
    width: min(320px, 72vw);
    margin-bottom: var(--s3); /* 14px */
  }
  .footer { margin-top: clamp(24px, 8svh, 40px); }
}

/* Mobile short-height (tiny screens) */
@media (max-width: 480px) and (max-height: 740px) {
  .shell { padding-top: clamp(56px, 10svh, 72px); }
  .form-reveal { margin-top: clamp(16px, 4svh, 22px); }
}

/* Shared mobile/tablet styles (≤ 768px) */
@media (max-width: 768px) {

  /* When keyboard is open: DON'T move the layout, let scroll-padding handle it */
  /* Safari's native scroll + scroll-padding-top preserves logo visibility */

  /* Pause heavy background animations while typing (reduce GPU load) */
  body.keyboard-open .waves,
  body.keyboard-open .waves::before,
  body.keyboard-open .waves::after,
  body.keyboard-open .grain,
  body.keyboard-open .vignette {
    animation-play-state: paused;
  }
  /* embers keep floating */

  /* Disable input transitions while typing (smoother caret) */
  body.keyboard-open input[type="email"] {
    transition: none;
  }

  .copy {
    margin-bottom: 0;
  }

  /* Typography + animations for mobile/tablet */
  .brand {
    font-size: clamp(4rem, 18vw, 6rem);
    -webkit-animation: emerge-brand 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.1s forwards;
    animation: emerge-brand 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.1s forwards;
  }

  .primary {
    font-size: clamp(14px, 4vw, 16px);
    -webkit-animation: emerge 1s cubic-bezier(0.33, 1, 0.68, 1) 0.3s forwards;
    animation: emerge 1s cubic-bezier(0.33, 1, 0.68, 1) 0.3s forwards;
  }

  .helper {
    -webkit-animation: emerge 0.9s cubic-bezier(0.33, 1, 0.68, 1) 0.45s forwards;
    animation: emerge 0.9s cubic-bezier(0.33, 1, 0.68, 1) 0.45s forwards;
  }

  .helper .idle,
  .helper .focus {
    font-size: 11px;
  }

  .form-reveal {
    opacity: 0;
    transform: translate3d(0, 16px, 0);
    -webkit-transform: translate3d(0, 16px, 0);
    transition: opacity 600ms ease-out, transform 700ms cubic-bezier(0.22, 1, 0.36, 1);
  }

  .form-reveal.is-in {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
  }

  .form {
    opacity: 1;
  }

  /* formBlock fallback for shared mobile/tablet */
  .formBlock {
    width: min(420px, 72vw);
    margin-bottom: 14px;
  }

  /* Input: mobile adjustments */
  input[type="email"] {
    height: 40px;
    font-size: 16px; /* prevent iOS auto-zoom */
    padding: 10px 2px 12px; /* label → underline: ~10px */
  }

  /* Button: pillowy, tappable (44px height) */
  button[type="submit"] {
    height: 44px;
    min-height: 44px;
    padding: 0 clamp(22px, 6vw, 26px);
    font-size: clamp(10px, 2.8vw, 12px);
    border: 1px solid rgb(var(--cream) / 0.22);
  }

  /* Footer: better readability + safe-area */
  .footer {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
    padding: 0 var(--s3);
  }

  .footer p {
    font-size: clamp(11px, 2.6vw, 13px);
  }

  /* Mobile ember positions — push slightly outward */
  .ember.pos-1 { left: 12%; }
  .ember.pos-2 { left: 16%; }
  .ember.pos-3 { right: 12%; }
  .ember.pos-4 { right: 16%; }
  .ember.pos-5 { left: 20%; }
  .ember.pos-6 { right: 20%; }

  /* Mobile at-rest — keep more centered */
  .orb.at-rest {
    transform: translate(-50%, -40%) scale(1.15, 0.88);
  }

  /* More dramatic mobile pulse */
  /* Mobile pulse — slower, gentler, matches stretch */
  .orb.pulse {
    animation: keystroke-pulse 0.8s ease-in-out forwards;
  }

  @keyframes keystroke-pulse {
    0% {
      opacity: 0.85;
      filter: blur(70px) brightness(1);
    }
    30% {
      opacity: 0.95;
      filter: blur(55px) brightness(1.3);
    }
    60% {
      opacity: 1;
      filter: blur(50px) brightness(1.5);
    }
    100% {
      opacity: 0.85;
      filter: blur(70px) brightness(1);
    }
  }

  .orb {
    width: 120vw;
    height: 80vh;
    filter: blur(70px);
    animation:
      orb-breathe 5s ease-in-out infinite,
      orb-drift-mobile 5s ease-in-out infinite;
  }

  @keyframes orb-drift-mobile {
    0%, 100% {
      transform: translate(-50%, -50%) scale(1, 1);
    }
    /* Visible but gentle — noticeable ambient life */
    20% {
      transform: translate(-46%, -54%) scale(1.08, 0.94);
    }
    40% {
      transform: translate(-54%, -47%) scale(0.94, 1.08);
    }
    60% {
      transform: translate(-48%, -53%) scale(1.06, 0.95);
    }
    80% {
      transform: translate(-52%, -48%) scale(0.96, 1.06);
    }
  }

  .waves {
    width: 150vw;
    height: 150vh;
  }

  .waves::before {
    width: 80%;
    height: 80%;
  }

  .waves::after {
    width: 110%;
    height: 110%;
  }
}
