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

:root {
  --ink: #0d1b2e;
  --muted: #55657a;
  --blue: #00a3ef;
  --blue-hover: #0092d8;
  --line: #b9c4d0;
  --card: rgba(248, 250, 252, 0.96);
  --sans: "Helvetica Neue", Helvetica, Arial, "Liberation Sans", sans-serif;
  --serif: Georgia, "Times New Roman", "Liberation Serif", serif;
}

html, body { margin: 0; }

body {
  min-height: 100vh;
  min-height: 100svh;
  font-family: var(--sans);
  color: var(--ink);
  background: #f3b493;
  -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------ scene
   Background and clouds share one 1672:941 stage. The stage is scaled and
   cropped as a single unit to cover the viewport (like object-fit: cover),
   and every layer fills it. */
.scene {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

.stage {
  --stage-w: max(100vw, 100vh * 1672 / 941);
  --stage-h: max(100vh, 100vw * 941 / 1672);
  /* Where the crop is anchored: 0 = left/top edge, 0.5 = centre. */
  --crop-x: 0.5;
  --crop-y: 0.5;
  position: absolute;
  left: calc((100vw - var(--stage-w)) * var(--crop-x));
  top: calc((100vh - var(--stage-h)) * var(--crop-y));
  width: var(--stage-w);
  height: var(--stage-h);
}

.layer {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* The clouds drift about 4% of the scene width to the left over 30s, then
   ease back. Their right-most cloud is cut off at the artwork's edge, so that
   edge is feathered out to keep the cut from showing as the layer moves. */
.clouds {
  will-change: transform;
  animation: drift 30s ease-in-out infinite alternate;
  -webkit-mask-image: linear-gradient(to left, transparent 0, #000 6%);
          mask-image: linear-gradient(to left, transparent 0, #000 6%);
}

@keyframes drift {
  from { transform: translateX(0); }
  to   { transform: translateX(-4%); }
}

/* ------------------------------------------------------------ card */
.page {
  position: relative;
  z-index: 1; /* the card sits above the scene */
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  /* Louc's flight overlay is wider than the screen; clip it sideways without
     creating a horizontal scrollbar. */
  overflow-x: clip;
}

/* Where the card's top edge sits on desktop. Louc's frames are scaled by
   min(cardWidth / 405, 1.5) and his perch is 146 frame-px below the frame's
   top, so with the card's top at T:
   - at most 146 * scale - 1 px (218 px at full size): the frame's top edge
     stays at or above the viewport. His wings rise past that edge during the
     approach, so lower than this would show a straight cut in the sky;
   - at least 104 * scale + 8 px (164 px at full size): the perched pose,
     which reaches 104 frame-px above the perch, fits on screen.
   Between those limits the card is centred (584 px is its usual height). */
@media (min-width: 641px) {
  .page {
    align-items: flex-start;
    padding-top: clamp(
      min(164px, (100vw - 48px) * 104 / 405 + 8px),
      (100vh - 584px) / 2,
      min(218px, (100vw - 48px) * 146 / 405 - 1px)
    );
  }
}

.card {
  position: relative; /* anchors Louc's overlay; overflow stays visible */
  width: 100%;
  max-width: 610px;
  padding: 28px 46px 40px;
  text-align: center;
  background: var(--card);
  border-radius: 28px;
  box-shadow: 0 24px 60px rgba(60, 30, 70, 0.22), 0 2px 6px rgba(60, 30, 70, 0.08);
}

.logo {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 0.18em 0.45em 0.25em;
  font-size: 44px;
  line-height: 1;
  background: #020a16;
  border-radius: 0.14em;
  color: #fff;
}
.logo__mark {
  font-family: "Arial Black", "Helvetica Neue", Arial, sans-serif;
  font-weight: 900;
  letter-spacing: -0.035em;
  margin-right: 0.035em;
}
.logo__num { color: #18a8f5; }
.logo__sub {
  margin-top: 0.12em;
  font-size: 0.19em;
  font-weight: 700;
  letter-spacing: 0.9em;
  margin-right: -0.9em;
}

.headline {
  margin: 14px 0 0;
  font-weight: 800;
  line-height: 0.98;
}
.headline__top {
  display: block;
  font-family: var(--sans);
  font-size: clamp(2.6rem, 4.6vw, 4.1rem);
  letter-spacing: -0.055em;
}
.headline__bottom {
  display: block;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(2.8rem, 4.9vw, 4.35rem);
  letter-spacing: -0.03em;
}

.lede {
  margin: 22px 0 0;
  font-size: 1.15rem;
  line-height: 1.4;
}

/* Desktop: input and button share one bordered field. */
.waitlist {
  display: flex;
  gap: 8px;
  margin: 22px auto 0;
  padding: 5px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.waitlist:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 163, 239, 0.18);
}
.waitlist__input {
  flex: 1;
  min-width: 0;
  padding: 0 14px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 1.05rem;
  color: var(--ink);
  outline: none;
}
.waitlist__input::placeholder { color: #6b7a8c; }
.waitlist__button {
  flex: none;
  padding: 15px 26px;
  border: 0;
  border-radius: 7px;
  background: var(--blue);
  color: var(--ink);
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}
.waitlist__button:hover { background: var(--blue-hover); }
.waitlist__button:active { transform: translateY(1px); }
.waitlist__button:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

.waitlist[hidden] { display: none; }
.waitlist__button:disabled { cursor: progress; opacity: 0.75; }

.waitlist__status {
  margin: 12px 0 0;
  font-size: 0.98rem;
  line-height: 1.4;
}
.waitlist__status:empty { display: none; }
.waitlist__status.is-error { color: #b4232a; }
.waitlist__status.is-success {
  margin-top: 22px;
  padding: 14px 16px;
  border-radius: 10px;
  background: #e6f6ee;
  color: #145c36;
  font-weight: 600;
}

.waitlist__consent {
  margin: 10px auto 0;
  max-width: 34em;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}
.waitlist__consent[hidden] { display: none; }

/* ------------------------------------------------------------ Louc
   Positioned and sized by main.js so the perch point in the frames lands on
   the card's top edge, 73% of the way across. */
.louc {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  pointer-events: none;
}
.louc__canvas,
.louc__final {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}
.louc__final[hidden] { display: none; }

/* The button gets excited once Louc has landed (see main.js). */
.waitlist__button.is-excited {
  animation: excited 0.9s cubic-bezier(.36, .07, .19, .97);
}
@keyframes excited {
  0%, 100% { transform: none; box-shadow: none; }
  10%  { transform: scale(1.07) rotate(-4deg); box-shadow: 0 0 0 4px rgba(0, 163, 239, 0.35); }
  20%  { transform: scale(1.07) rotate(4deg); }
  30%  { transform: scale(1.07) rotate(-4deg); }
  40%  { transform: scale(1.07) rotate(4deg); box-shadow: 0 0 0 7px rgba(0, 163, 239, 0.22); }
  50%  { transform: scale(1.05) rotate(-3deg); }
  60%  { transform: scale(1.05) rotate(3deg); }
  70%  { transform: scale(1.03) rotate(-1.5deg); box-shadow: 0 0 0 10px rgba(0, 163, 239, 0); }
  80%  { transform: scale(1.02) rotate(1deg); }
}

.aside {
  margin: 30px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.socials {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 40px;
  margin-top: 14px;
}
.social {
  display: inline-flex;
  border-radius: 8px;
  transition: transform 0.15s ease;
}
.social:hover { transform: translateY(-2px); }
.social:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ------------------------------------------------------------ mobile */
@media (max-width: 640px) {
  .page {
    align-items: flex-start;
    /* Same rule as on desktop: card top at 146 * scale - 1 px, which also
       leaves room above the card for Louc's perched pose. */
    padding: min(218px, (100vw - 32px) * 146 / 405 - 1px) 16px 32px;
  }

  .card {
    padding: 28px 22px 26px;
    border-radius: 24px;
  }

  .logo { font-size: 46px; }

  .headline__top { font-size: clamp(2.3rem, 10vw, 2.9rem); }
  .headline__bottom { font-size: clamp(2.5rem, 10.8vw, 3.1rem); }

  .lede { font-size: 1rem; line-height: 1.5; margin-top: 18px; }

  /* Mobile: stacked field and full-width button. */
  .waitlist {
    flex-direction: column;
    gap: 8px;
    padding: 0;
    border: 0;
    background: none;
  }
  .waitlist:focus-within { box-shadow: none; }
  .waitlist__input {
    padding: 13px 13px;
    border: 1.5px solid var(--line);
    border-radius: 8px;
    background: #fff;
  }
  .waitlist__input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 163, 239, 0.18);
  }
  .waitlist__button { padding: 13px; }

  .aside { margin-top: 24px; font-size: 0.95rem; }
  .socials { gap: 26px; margin-top: 10px; }
}

/* Portrait phones: anchor the crop to the left, where Louc and the castle are. */
@media (max-width: 640px) and (orientation: portrait) {
  .stage { --crop-x: 0; }
}
