/* Manzil Map · Coming soon (dark)
   Built from Figma "Website · Coming soon" → Coming soon/Desktop/Dark (1440×900)
   and Coming soon/Mobile/Dark (390×844). Breakpoint: 600px. */

:root {
  /* Figma tokens */
  --surface-deep: #061214;          /* surface/deep */
  --surface-page: #001f24;          /* surface/page */
  --border-panel: #9ebac0;          /* border/panel */
  --action-primary-fill: #9ebac0;   /* action/primary-fill */
  --action-primary-text: #001f24;   /* action/primary-text */
  --text-primary: #fafbf8;          /* text/primary */
  --text-secondary: #d2e4e8;        /* text/secondary */
  --text-headline: #d2e4e8;         /* text/headline */
  --text-link: #b8cfd4;             /* text/link */
  --atlas-teal-325: #6b929a;
  --atlas-teal-275: #84a6ad;
  --atlas-teal-150: #b8cfd4;
  --atlas-teal-75: #d2e4e8;
  --graphic-highlight: #d6a03a;     /* graphic/highlight · Compass Gold 500 */
  --semantic-success: #82b19d;      /* Green 300 · 7.9:1 on surface/deep, 5.5:1 on glow core */

  /* States (not in Figma, derived from the palette above) */
  --action-primary-hover: #b8cfd4;
  --action-primary-active: #84a6ad;
  --focus-ring: rgba(158, 186, 192, 0.32);
  --text-error: #f4b19f;
  --border-error: #e8907a;

  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Tagline size: 88px at 1440, shrinking so the single line always fits */
  --t: min(88px, calc((100vw - 64px) / 12.341));

  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--surface-deep);
  color: var(--text-secondary);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img { display: block; }

/* ---------- Background glows ---------- */

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

.glow {
  position: absolute;
  display: block;
}

.glow img {
  width: 100%;
  height: 100%;
}

/* Positions are the Figma frame offsets as a share of the 1440×900 frame */
.glow--1 { left: -8.3333%;  top: -8.8889%;  width: 119.4444%; height: 118.8889%; }
.glow--2 { left: 45.1389%;  top: -52.2222%; width: 104.1667%; height: 113.3333%; }
.glow--3 { left: -44.4444%; top: 22.2222%;  width: 104.1667%; height: 113.3333%; }

/* ---------- Page layout ---------- */

.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 32px 32px;
}

/* Spare height splits 1 : 2 above the logo vs. above the footer, so the
   content sits a little above centre. At the design sizes the space above
   the logo (≈98px desktop, ≈92px mobile) roughly matches the logo-to-tagline
   gap (102 / 84px), and it stays proportionate on taller screens. */
.spacer--top {
  flex: 1 0 0;
  min-height: 40px;
}

.spacer--bottom {
  flex: 2 0 0;
  min-height: 48px;
}

.content {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.logo img {
  width: 200px;
  height: auto;
}

/* ---------- Tagline + path ---------- */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 102px;
  font-size: var(--t);
}

.tagline {
  margin: 0;
  font-size: 1em;
  font-weight: 400;
  line-height: 1.3636;          /* 120px at 88px */
  letter-spacing: -0.02em;      /* -1.76px at 88px */
  text-align: center;
  white-space: nowrap;
}

.br-mobile { display: none; }

/* Each word is its own box so the blur animates reliably (Safari included).
   The spaces sit in separate spans with the same weight, keeping Figma's spacing. */
.w { display: inline-block; }

.w--1 { color: var(--atlas-teal-325); font-weight: 400; }
.w--2 { color: var(--atlas-teal-275); font-weight: 500; }
.w--3 { color: var(--atlas-teal-150); font-weight: 600; }
.w--4 { color: var(--atlas-teal-75);  font-weight: 700; }
.w--5 { color: var(--graphic-highlight); font-weight: 800; }

.path {
  display: block;
  margin-top: 0.1818em;                 /* 16px at 88px */
  transform: translateX(0.0185em);      /* 1.6px right of centre, as in Figma */
}

.path__svg {
  display: block;
  height: auto;
  overflow: visible;                    /* room for the goal's ripple */
}

.path__svg--desktop {
  width: 10.1903em;                     /* 896.75px at 88px */
  aspect-ratio: 896.75 / 38;
}

.path__svg--mobile { display: none; }

/* Segments grow from their left end; nodes pop from their centre. */
.path .seg,
.path .node,
.path .goal-dot,
.path .ripple {
  transform-box: fill-box;
  transform-origin: 50% 50%;
}

.path .seg { transform-origin: 0 50%; }
.path .ripple { opacity: 0; }

/* ---------- Status line ---------- */

.status {
  margin: 48px 0 0;
  font-size: 24px;
  font-weight: 600;
  line-height: 32px;
  color: var(--text-headline);
  text-align: center;
}

/* ---------- Launch email form ---------- */

.launch-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 520px;
  max-width: 100%;
  margin-top: 22px;
}

.launch-form__label {
  font-size: 14px;
  font-weight: 700;
  line-height: 22px;
  color: var(--text-primary);
}

.launch-form__row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.field {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  height: 48px;
  padding: 0 16px 0 14px;
  background: var(--surface-page);
  border: 1.5px solid var(--border-panel);
  border-radius: 8px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field:focus-within {
  border-color: var(--text-secondary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.field__icon {
  flex: none;
  width: 20px;
  height: 20px;
}

.field__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-primary);
  caret-color: var(--text-primary);
  font: 400 16px/26px var(--font);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.field__input::placeholder {
  color: var(--text-secondary);
  opacity: 1;
}

.field__input:-webkit-autofill,
.field__input:-webkit-autofill:hover,
.field__input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text-primary);
  -webkit-box-shadow: 0 0 0 1000px var(--surface-page) inset;
  box-shadow: 0 0 0 1000px var(--surface-page) inset;
  transition: background-color 9999s ease-out;
}

.button {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  margin: 0;
  padding: 0 24px;
  border: 0;
  border-radius: 8px;
  background: var(--action-primary-fill);
  color: var(--action-primary-text);
  font: 700 16px/24px var(--font);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 160ms ease, opacity 160ms ease;
}

.button:hover { background: var(--action-primary-hover); }
.button:active { background: var(--action-primary-active); }

.button:focus-visible {
  outline: 2px solid var(--text-secondary);
  outline-offset: 2px;
}

.button__icon {
  width: 20px;
  height: 20px;
}

.button[aria-busy="true"] {
  cursor: progress;
  opacity: 0.8;
}

.button:disabled { cursor: default; }

.launch-form__helper {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
  color: var(--text-secondary);
}

/* Messages wrap only between sentences, never mid-sentence. */
.launch-form__helper .nowrap { white-space: nowrap; }

.launch-form__helper a {
  color: inherit;
  font-weight: 700;
}

.launch-form.is-error .field { border-color: var(--border-error); }
.launch-form.is-error .field:focus-within { box-shadow: 0 0 0 3px rgba(232, 144, 122, 0.25); }
.launch-form.is-error .launch-form__helper { color: var(--text-error); }
.launch-form.is-success .launch-form__helper { color: var(--semantic-success); }

/* ---------- Follow along ---------- */

.follow {
  margin: 22px 0 0;
  font-size: 15px;
  font-weight: 500;
  line-height: 24px;
  color: var(--text-secondary);
  text-align: center;
}

.follow__short { display: none; }

.follow a {
  color: var(--text-link);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-skip-ink: none;
  text-underline-position: from-font;
}

.follow a:hover { color: var(--text-primary); }

.follow a:focus-visible,
.footer a:focus-visible {
  outline: 2px solid var(--text-secondary);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---------- Footer ---------- */

.footer p {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  line-height: 20px;
  color: var(--text-secondary);
  text-align: center;
}

.footer a {
  color: inherit;
  text-decoration: none;
}

.footer a:hover { text-decoration: underline; }

/* ---------- Mobile ----------
   The Figma 390 frame (Coming soon/Mobile/Dark), same layout and styling,
   with the hierarchy tuned so the tagline + path are the focus:
   - Tagline + path: the hero. Fluid --tag (48px at 390, 40–50px range,
     Figma 44); the path keeps its Figma proportion to the tagline.
   - Everything else: compact, Figma × 0.85. The form and button are
     exactly the path's width, so tagline, path and form share one column
     and the hero, at the largest size, leads.
   - Logo 104px: the same logo-to-tagline ratio as desktop (≈2.2×).
   - More space after the path than within the form group, so the hero
     reads as its own block.
   Exceptions to × 0.85: helper/footer text stop at 11px; borders stay
   1.5px; the email input keeps a real 16px font (smaller makes iPhones
   zoom in on focus), drawn at 85%. */

@media (max-width: 599px) {
  .glow--1 { left: -56.4103%; top: 0;         width: 215.3846%; height: 73.4597%; }
  .glow--2 { left: 10.2564%;  top: -33.1754%; width: 174.3590%; height: 68.7204%; }
  .glow--3 { left: -92.3077%; top: 56.8720%;  width: 189.7436%; height: 68.7204%; }

  .page {
    --tag: clamp(40px, 12.3vw, 50px);         /* tagline size; Figma 44 */
    padding: 0 16px calc(20.4px + env(safe-area-inset-bottom, 0px));
  }
  .spacer--top { min-height: 32px; }
  .spacer--bottom { flex-grow: 3; min-height: 40px; }

  .logo img { width: 104px; }                 /* 140 */

  .hero {
    margin-top: 64px;
    font-size: var(--tag);
  }

  .tagline {
    line-height: 1.0909;                      /* 48/44 */
    white-space: normal;
  }

  .br-mobile { display: inline; }

  .path {
    margin-top: 0.2102em;                     /* 9.25/44 */
    transform: translateX(0.0105em);          /* 0.46/44 */
  }

  .path__svg--desktop { display: none; }

  .path__svg--mobile {
    display: block;
    width: 6.0772em;                          /* 267.397/44 */
    aspect-ratio: 267.397 / 27.5;
  }

  .status {
    margin-top: 40px;
    font-size: 16.15px;                       /* 19 */
    line-height: 23.8px;                      /* 28 */
  }

  .launch-form {
    width: min(calc(var(--tag) * 6.0772), 100%); /* exactly the path width */
    margin-top: 20.4px;                       /* 24 */
    gap: 6.8px;                               /* 8 */
  }

  .launch-form__label {
    font-size: 11.9px;                        /* 14 */
    line-height: 18.7px;                      /* 22 */
  }

  .launch-form__row {
    flex-direction: column;
    align-items: stretch;
    gap: 6.8px;                               /* 8 */
  }

  .field {
    flex: none;
    height: 40.8px;                           /* 48 */
    gap: 8.5px;                               /* 10 */
    padding: 0 13.6px 0 11.9px;               /* 16 / 14 */
    border-radius: 6.8px;                     /* 8 */
    overflow: hidden;
  }

  .field__icon {
    width: 17px;                              /* 20 */
    height: 17px;
  }

  /* 16px text drawn at 85% (13.6px). Laid out 1/0.85 larger, then scaled
     down from the left edge so it exactly fills the space after the icon. */
  .field__input {
    flex: 0 0 auto;
    width: calc((100% - 25.5px) / 0.85);      /* 25.5 = icon 17 + gap 8.5 */
    height: calc(100% / 0.85);
    font-size: 16px;
    line-height: 26px;
    transform: scale(0.85);
    transform-origin: 0 50%;
  }

  .button {
    width: 100%;
    height: 40.8px;                           /* 48 */
    gap: 6.8px;                               /* 8 */
    padding: 0 20.4px;                        /* 24 */
    border-radius: 6.8px;                     /* 8 */
    font-size: 13.6px;                        /* 16 */
    line-height: 20.4px;                      /* 24 */
  }

  .button__icon {
    width: 17px;                              /* 20 */
    height: 17px;
  }

  .launch-form__helper {
    font-size: 11px;                          /* 12 → floor */
    line-height: 16px;
  }

  .follow {
    margin-top: 20.4px;                       /* 24 */
    font-size: 11.9px;                        /* 14 */
    line-height: 18.7px;                      /* 22 */
  }

  .follow__long { display: none; }
  .follow__short { display: inline; }

  .footer p {
    font-size: 11px;                          /* 12 → floor */
    line-height: 16px;
  }
}

/* ---------- Load animation ----------
   Word N and node N arrive together: as each node pops in, its word
   sharpens from blurred to clear; the line then draws on to the next node
   at a steady speed, so the longer gaps take longer. At "map." the gold goal
   pops in with a ripple. Both breakpoints share the timing because their
   node spacing has the same proportions (desktop's). It plays on every
   device, including ones that ask for reduced motion. Without JS the page
   renders in its final state.

   It starts at once, alongside the quicker intro (below): the rest of the
   page settles around the hero while the hero plays at its own pace.

   --tN = when word/node N arrives: 0ms + 1100ms × (node N's position
   along the path: 0, .306, .643, .834, 1). */

:root {
  --t1: 0ms;
  --t2: 337ms;
  --t3: 708ms;
  --t4: 918ms;
  --t5: 1100ms;
  --ease-out-cubic: cubic-bezier(0.33, 1, 0.68, 1);
}

/* Intro: background glows light up, and every element except the tagline
   and path rises 16px into place while fading in and sharpening (a small
   echo of the tagline), top to bottom, 70ms apart, 550ms each. Quick, but
   long enough to be seen; it runs at the same time as the hero and is
   settled by ~1.05s, while the hero finishes later. */

.js .glows { opacity: 0; }

.js .logo,
.js .status,
.js .launch-form__label,
.js .field,
.js .button,
.js .launch-form__helper,
.js .follow,
.js .footer {
  opacity: 0;
  transform: translateY(16px);
  filter: blur(4px);
}

.js.is-ready .glows { animation: mm-fade 1300ms ease-out both; }

.js.is-ready .logo,
.js.is-ready .status,
.js.is-ready .launch-form__label,
.js.is-ready .field,
.js.is-ready .button,
.js.is-ready .launch-form__helper,
.js.is-ready .follow,
.js.is-ready .footer {
  animation: mm-rise 550ms var(--ease-out-cubic) both;
}

.js.is-ready .logo                { animation-delay: 0ms; }
.js.is-ready .status              { animation-delay: 70ms; }
.js.is-ready .launch-form__label  { animation-delay: 140ms; }
.js.is-ready .field               { animation-delay: 210ms; }
.js.is-ready .button              { animation-delay: 280ms; }
.js.is-ready .launch-form__helper { animation-delay: 350ms; }
.js.is-ready .follow              { animation-delay: 420ms; }
.js.is-ready .footer              { animation-delay: 490ms; }

@keyframes mm-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes mm-rise {
  from { opacity: 0; transform: translateY(16px); filter: blur(4px); }
  to   { opacity: 1; transform: none;             filter: none; }
}

.js .w {
  opacity: 0.2;
  filter: blur(12px);
  will-change: filter, opacity;
}

.js .path .seg { transform: scaleX(0); }

.js .path .node,
.js .path .goal-dot {
  opacity: 0;
  transform: scale(0);
}

/* Words */
.js.is-ready .w { animation: mm-sharpen 550ms cubic-bezier(0.22, 0.61, 0.36, 1) both; }
.js.is-ready .w--1 { animation-delay: var(--t1); }
.js.is-ready .w--2 { animation-delay: var(--t2); }
.js.is-ready .w--3 { animation-delay: var(--t3); }
.js.is-ready .w--4 { animation-delay: var(--t4); }
.js.is-ready .w--5 { animation-delay: var(--t5); }

/* Nodes pop in with their word */
.js.is-ready .path .node { animation: mm-pop 380ms ease-out both; }
.js.is-ready .path .node--1 { animation-delay: var(--t1); }
.js.is-ready .path .node--2 { animation-delay: var(--t2); }
.js.is-ready .path .node--3 { animation-delay: var(--t3); }
.js.is-ready .path .node--4 { animation-delay: var(--t4); }
.js.is-ready .path .node--5 { animation: mm-pop-goal 500ms ease-out var(--t5) both; }
.js.is-ready .path .goal-dot { animation: mm-pop-goal 420ms ease-out calc(var(--t5) + 110ms) both; }
/* forwards, not both: the ripple must stay hidden until the goal arrives */
.js.is-ready .path .ripple { animation: mm-ripple 900ms ease-out calc(var(--t5) + 200ms) forwards; }

/* The line travels from node N to node N+1 between their arrival times */
.js.is-ready .path .seg--1 { animation: mm-grow calc(var(--t2) - var(--t1)) linear var(--t1) both; }
.js.is-ready .path .seg--2 { animation: mm-grow calc(var(--t3) - var(--t2)) linear var(--t2) both; }
.js.is-ready .path .seg--3 { animation: mm-grow calc(var(--t4) - var(--t3)) linear var(--t3) both; }
.js.is-ready .path .seg--4 { animation: mm-grow calc(var(--t5) - var(--t4)) linear var(--t4) both; }

@keyframes mm-sharpen {
  from { opacity: 0.2; filter: blur(12px); }
  to   { opacity: 1;   filter: blur(0); }
}

@keyframes mm-pop {
  0%   { opacity: 0; transform: scale(0); }
  60%  { opacity: 1; transform: scale(1.3); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes mm-pop-goal {
  0%   { opacity: 0; transform: scale(0); }
  55%  { opacity: 1; transform: scale(1.22); }
  80%  { transform: scale(0.95); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes mm-grow {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

@keyframes mm-ripple {
  0%   { opacity: 0.75; transform: scale(1); }
  100% { opacity: 0;    transform: scale(2); }
}

/* ?debug panel (see js/main.js) */
.mm-debug {
  position: fixed;
  left: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 10;
  margin: 0;
  padding: 10px 12px;
  max-height: 45vh;
  overflow: auto;
  background: rgba(0, 0, 0, 0.85);
  color: #d2e4e8;
  border: 1px solid #9ebac0;
  border-radius: 8px;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}
