/* ==========================================================================
   Nudge — waitlist (/waitlist)
   One screen. A flight down a corridor of doorways, dithered to the logo's inks, with the form held
   still at the vanishing point. Type: Bricolage Grotesque (the site's display face), Geist, Geist Mono.
   ========================================================================== */

:root {
  --bg: #0a0807;
  --text: #f3ece2;
  --text-2: rgba(240, 230, 214, 0.68);
  --text-3: rgba(240, 230, 214, 0.46);
  --hair: rgba(240, 230, 214, 0.1);
  --cream: #f0e6d6;
  --terracotta: #ba7545;
  --terra-hi: #dcab80;
  --sage: #7d8963;
  --sage-hi: #b2bf92;
  --error: #ff8a7a;

  --display: "Bricolage Grotesque", "Geist", ui-sans-serif, system-ui, sans-serif;
  --sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* iOS's sheet curve: fast out of the gate, settles without overshoot */
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --gutter: 16px;

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); overflow-x: hidden; overflow-x: clip; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.45;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, p { margin: 0; }
button, input { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: inherit; text-decoration: none; }
::selection { background: rgba(178, 191, 146, 0.4); color: #fff; }
:focus-visible { outline: 2px solid var(--sage-hi); outline-offset: 3px; }

/* ---------- background ---------- */
.backdrop { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; background: var(--bg); }
/* drawn small and scaled up with hard edges: every big pixel is one ink */
.scene { position: absolute; left: 0; top: 0; display: block; image-rendering: pixelated; image-rendering: crisp-edges; }
/* keeps the middle quiet so the motion lives at the edges, and the words always read */
.shade {
  position: absolute; inset: 0;
  background:
    radial-gradient(min(600px, 92vw) min(470px, 60vh) at 50% 52%, rgba(10, 8, 7, 0.84), rgba(10, 8, 7, 0.58) 52%, rgba(10, 8, 7, 0) 100%),
    linear-gradient(to bottom, rgba(10, 8, 7, 0.6), rgba(10, 8, 7, 0) 90px),
    linear-gradient(to top, rgba(10, 8, 7, 0.6), rgba(10, 8, 7, 0) 80px);
}

/* no WebGL: the doorways still fly at you, as outlines */
.fallback { display: none; position: absolute; inset: 0; }
.no-webgl .fallback { display: block; }
.fallback svg {
  position: absolute; left: 50%; top: 50%;
  width: 70vmin; height: 70vmin; margin: -35vmin 0 0 -35vmin;
  fill: none; stroke: var(--terracotta); stroke-width: 0.012; stroke-linejoin: round;
  opacity: 0;
  animation: fly 7.5s cubic-bezier(0.6, 0, 1, 0.6) infinite;
}
.fallback svg:nth-child(2) { animation-delay: 1.5s; }
.fallback svg:nth-child(3) { animation-delay: 3s; }
.fallback svg:nth-child(4) { animation-delay: 4.5s; }
.fallback svg:nth-child(5) { animation-delay: 6s; }
@keyframes fly {
  0% { transform: scale(0.06) rotate(-30deg); opacity: 0; }
  20% { opacity: 0.8; }
  100% { transform: scale(3.4) rotate(6deg); opacity: 0.8; }
}

/* ---------- one screen: bar, the form in the middle, a line at the foot ---------- */
.screen {
  position: relative; z-index: 2;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) var(--gutter) 0;
}
.brand { display: inline-flex; align-items: center; gap: 9px; min-height: 44px; padding: 0 4px; border-radius: 12px; }
.brand-mark { width: 26px; height: 22px; display: block; }
.brand-word { font-family: var(--sans); font-size: 20px; font-weight: 600; letter-spacing: -0.05em; line-height: 1; }
.back {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 0 4px;
  font-size: 15px; color: var(--text-2);
  transition: color 0.2s;
}
.back svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.4s var(--ease); }
.back:hover { color: var(--text); }
.back:hover svg { transform: translateX(3px); }

.page {
  display: grid; place-items: center;
  padding: 12px var(--gutter);
}
.panel { width: 100%; max-width: 760px; display: flex; flex-direction: column; align-items: center; text-align: center; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--mono); font-size: 12px; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--sage-hi);
}
/* the dot from the mark, sending out a nudge */
.dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--sage); box-shadow: 0 0 10px rgba(125, 137, 99, 0.9); }
.dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1px solid var(--sage-hi); animation: ping 2.8s var(--ease) infinite; }
@keyframes ping { from { transform: scale(0.45); opacity: 1; } to { transform: scale(2); opacity: 0; } }

h1 {
  margin-top: 12px;
  font-family: var(--display);
  font-size: clamp(44px, 6.6vw, 80px);
  font-weight: 700;
  font-optical-sizing: auto;
  line-height: 0.96;
  letter-spacing: -0.04em;
  text-wrap: balance;
}
.sub {
  margin-top: 14px;
  max-width: 22em;
  font-size: clamp(16px, 1.4vw, 18px);
  line-height: 1.45;
  color: var(--text-2);
  text-wrap: balance;
}

/* ---------- card: held in a viewfinder, the next doorway ---------- */
.card {
  position: relative;
  width: 100%; max-width: 440px;
  margin-top: 26px;
  padding: 18px;
  border-radius: 20px;
  background: rgba(14, 11, 9, 0.74);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid rgba(240, 230, 214, 0.11);
  box-shadow: inset 0 1px 0 rgba(240, 230, 214, 0.07), 0 30px 80px -30px rgba(0, 0, 0, 0.9);
  text-align: left;
  transition: height 0.55s var(--ease);
}
/* corner ticks: they close in when you focus a field, and turn sage once you're in */
.tick {
  position: absolute; width: 14px; height: 14px;
  border: 0 solid var(--terra-hi);
  opacity: 0.75;
  transition: transform 0.6s var(--ease), border-color 0.6s var(--ease), opacity 0.6s var(--ease);
  pointer-events: none;
}
.tl { left: -9px; top: -9px; border-left-width: 1.5px; border-top-width: 1.5px; border-top-left-radius: 6px; }
.tr { right: -9px; top: -9px; border-right-width: 1.5px; border-top-width: 1.5px; border-top-right-radius: 6px; }
.bl { left: -9px; bottom: -9px; border-left-width: 1.5px; border-bottom-width: 1.5px; border-bottom-left-radius: 6px; }
.br { right: -9px; bottom: -9px; border-right-width: 1.5px; border-bottom-width: 1.5px; border-bottom-right-radius: 6px; }
.card:focus-within .tl { transform: translate(3px, 3px); }
.card:focus-within .tr { transform: translate(-3px, 3px); }
.card:focus-within .bl { transform: translate(3px, -3px); }
.card:focus-within .br { transform: translate(-3px, -3px); }
.card:focus-within .tick, .card.is-in .tick { opacity: 1; border-color: var(--sage-hi); }

/* two fields joined in one group, labels that float up as you type */
.fields {
  border-radius: 13px;
  background: rgba(240, 230, 214, 0.05);
  border: 1px solid rgba(240, 230, 214, 0.1);
}
.field { position: relative; height: 58px; }
.field + .field::before { content: ""; position: absolute; left: 16px; right: 0; top: 0; height: 1px; background: var(--hair); }
.field input {
  width: 100%; height: 100%;
  padding: 23px 16px 6px;
  border: 0; outline: 0;
  background: transparent;
  font-size: 17px; /* 16px+ so iOS doesn't zoom in on focus */
  caret-color: var(--sage-hi);
  border-radius: inherit;
}
.field:first-child { border-radius: 12px 12px 0 0; }
.field:last-child { border-radius: 0 0 12px 12px; }
.field label {
  position: absolute; left: 16px; top: 50%;
  font-size: 17px; color: var(--text-3);
  transform: translateY(-50%);
  transform-origin: left center;
  pointer-events: none;
  transition: transform 0.35s var(--ease), color 0.35s var(--ease);
}
.field input:focus + label,
.field input:not(:placeholder-shown) + label { transform: translateY(-118%) scale(0.74); }
.field input:focus + label { color: var(--sage-hi); }
.field::after {
  content: ""; position: absolute; inset: -1px;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1.5px var(--sage-hi);
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s var(--ease);
}
.field:focus-within::after { opacity: 1; }
.field.is-bad::after { opacity: 1; box-shadow: inset 0 0 0 1.5px var(--error); }
.field.is-bad input + label { color: var(--error); }
.field input:-webkit-autofill { -webkit-text-fill-color: var(--text); transition: background-color 9999s; }

.err { font-size: 14px; color: var(--error); padding: 0 4px; }
.err:empty { display: none; }
.err:not(:empty) { margin-top: 8px; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.join {
  position: relative;
  width: 100%; height: 52px;
  margin-top: 12px;
  border: 0; border-radius: 13px;
  background: var(--cream); color: #16110d;
  font-size: 17px; font-weight: 600; letter-spacing: -0.02em;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 14px 34px -18px rgba(220, 171, 128, 0.7);
  transition: transform 0.4s var(--ease), background-color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.join-label { display: inline-flex; align-items: center; gap: 8px; transition: opacity 0.2s; }
.join-label svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.45s var(--ease); }
.join:hover { background: #fbf4ea; }
.join:hover .join-label svg { transform: translateX(4px); }
.join:active { transform: scale(0.97); transition-duration: 0.1s; }
.join:focus-visible { outline-offset: 4px; }
.spinner {
  position: absolute; left: 50%; top: 50%;
  width: 20px; height: 20px; margin: -10px 0 0 -10px;
  border-radius: 50%;
  border: 2px solid rgba(22, 17, 13, 0.18); border-top-color: #16110d;
  opacity: 0;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(1turn); } }
.is-busy .join { cursor: progress; }
.is-busy .join-label { opacity: 0; }
.is-busy .spinner { opacity: 1; }

.msg { font-size: 14px; color: var(--error); text-align: center; }
.msg:empty { display: none; }
.msg:not(:empty) { margin-top: 12px; }
.note { margin-top: 12px; font-size: 13px; line-height: 1.4; color: var(--text-3); text-align: center; text-wrap: balance; }

/* the answer */
.done { text-align: center; padding: 6px 4px 0; outline: none; }
.seal { width: 60px; height: 60px; margin: 2px auto 14px; display: block; fill: none; overflow: visible; }
.seal-track { stroke: rgba(240, 230, 214, 0.1); stroke-width: 2; }
.seal-ring {
  stroke: var(--sage-hi); stroke-width: 2.5; stroke-linecap: round;
  stroke-dasharray: 100; stroke-dashoffset: 100;
  transform: rotate(-90deg); transform-origin: 32px 32px;
  filter: drop-shadow(0 0 6px rgba(178, 191, 146, 0.7));
}
.seal-tick { stroke: var(--text); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 100; stroke-dashoffset: 100; }
.done.is-on .seal-ring { transition: stroke-dashoffset 1.1s var(--ease); stroke-dashoffset: 0; }
.done.is-on .seal-tick { transition: stroke-dashoffset 0.5s var(--ease) 0.75s; stroke-dashoffset: 0; }
.done-title {
  font-family: var(--display);
  font-size: 34px; font-weight: 700; letter-spacing: -0.035em; line-height: 1.04;
  text-wrap: balance;
}
.done-text { margin: 10px auto 0; max-width: 24em; color: var(--text-2); font-size: 16px; line-height: 1.45; text-wrap: pretty; overflow-wrap: anywhere; }
.done-text b { color: var(--text); font-weight: 600; }
.done-actions { margin-top: 20px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.share {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 20px;
  border-radius: 13px;
  border: 1px solid rgba(240, 230, 214, 0.16);
  background: rgba(240, 230, 214, 0.06);
  font-size: 16px; font-weight: 600;
  cursor: pointer;
  transition: transform 0.4s var(--ease), background-color 0.2s;
}
.share:hover { background: rgba(240, 230, 214, 0.11); }
.share:active { transform: scale(0.97); transition-duration: 0.1s; }
.share svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.again {
  min-height: 44px; padding: 0 12px;
  border: 0; background: none;
  font-size: 15px; color: var(--text-3);
  cursor: pointer;
}
.again:hover { color: var(--text-2); }

/* swapping form ↔ answer: the outgoing side dissolves, the incoming side materialises */
.form, .done { transition: opacity 0.32s var(--ease), filter 0.32s var(--ease), transform 0.5s var(--ease); }
.is-leaving { opacity: 0; filter: blur(8px); transform: scale(0.98); }
.is-arriving { opacity: 0; filter: blur(10px); transform: scale(1.02); }

/* ---------- foot ---------- */
.foot {
  display: flex; justify-content: center; gap: 16px;
  padding: 10px var(--gutter) max(16px, env(safe-area-inset-bottom));
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-3);
}
.foot-line { display: none; }

/* ---------- entrance (set by JS; without JS everything is simply there) ---------- */
.js [data-in] { opacity: 0; transform: translateY(14px); filter: blur(6px); }
.is-ready [data-in] {
  opacity: 1; transform: none; filter: none;
  transition: opacity 0.9s var(--ease), transform 1.1s var(--ease), filter 0.9s var(--ease);
}
.is-ready [data-in]:nth-child(1) { transition-delay: 0.35s; }
.is-ready [data-in]:nth-child(2) { transition-delay: 0.43s; }
.is-ready [data-in]:nth-child(3) { transition-delay: 0.51s; }
.is-ready [data-in]:nth-child(4) { transition-delay: 0.6s; }
/* the viewfinder locks on as the card arrives */
.js .card .tick { transform: scale(1.8); opacity: 0; }
.is-ready .card .tick { transform: none; opacity: 0.75; transition-delay: 0.75s; }
.is-ready .card:focus-within .tick, .is-ready .card.is-in .tick { opacity: 1; transition-delay: 0s; }
.js .bar, .js .foot { opacity: 0; transition: opacity 1s var(--ease) 0.2s; }
.is-ready .bar, .is-ready .foot { opacity: 1; }

@media (min-width: 720px) {
  :root { --gutter: 28px; }
  .bar { padding-top: max(20px, env(safe-area-inset-top)); }
  .card { padding: 22px; margin-top: 30px; }
  .foot { justify-content: space-between; padding-bottom: max(22px, env(safe-area-inset-bottom)); }
  .foot-line { display: inline; }
}
/* short screens: tighten so it still fits without scrolling */
@media (max-height: 760px) {
  h1 { font-size: clamp(40px, 5.6vw, 64px); margin-top: 10px; }
  .sub { margin-top: 10px; }
  .card { margin-top: 20px; }
}
@media (max-height: 640px) {
  .sub { display: none; }
  .note { display: none; }
  .field { height: 54px; }
}

/* ---------- preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  .js [data-in] { transform: none; filter: none; }
  .is-ready [data-in] { transition: opacity 0.4s ease; }
  .is-leaving, .is-arriving { transform: none; filter: none; }
  .card { transition: none; }
  .tick { transition: none; }
  .dot::after, .fallback svg { animation: none; }
  .fallback svg:first-child { opacity: 0.5; transform: scale(1.4); }
  .done.is-on .seal-ring, .done.is-on .seal-tick { transition-duration: 0.01s; transition-delay: 0s; }
}
@media (prefers-reduced-transparency: reduce) {
  .card { background: #15110e; -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  :root { --text-2: rgba(240, 230, 214, 0.86); --text-3: rgba(240, 230, 214, 0.72); }
  .card { background: #120e0b; border-color: rgba(240, 230, 214, 0.4); }
  .fields { border-color: rgba(240, 230, 214, 0.45); }
}
