/*
 * The holding page, in one stylesheet.
 *
 * ## Why there is no build step
 *
 * The product is React, Tailwind and shadcn everywhere — ADR-0001 in the main
 * repository — and this page deliberately is not. It lives in a different,
 * temporary repository, it is one page, it will be deleted when the beta opens,
 * and the brief was "as easy to deploy as possible": no build means `wrangler
 * pages deploy` works from a clean checkout with nothing installed and nothing
 * compiled. Reaching for the product's stack here would buy component reuse
 * that a single page cannot spend.
 *
 * The tokens below are the *values* from `@lithos/ui-design-tokens`, dark
 * theme, copied rather than imported — importing would mean a package, a
 * registry and a build. They are a snapshot: if the product's palette moves,
 * this page does not follow it, which is the correct trade for something with a
 * known end date.
 */

/*
 * The two typefaces, self-hosted.
 *
 * The designs specify Inter and JetBrains Mono by name, and a system stack is
 * not a near-enough substitute: on Windows the UI text was falling back to
 * Segoe UI, whose wider apertures and shorter x-height change where the
 * headline breaks and make the mono margin data noticeably wider than the
 * ruled line it sits under.
 *
 * Self-hosted rather than linked from Google's CDN, for three reasons that all
 * point the same way: a third-party connection on a page whose entire job is
 * to collect an email address is an awkward thing to explain in a privacy
 * policy; the render-blocking round trip to a second origin costs more than
 * these four files do; and a holding page that outlives its CDN's URL scheme
 * is a page that silently loses its typography.
 *
 * Variable fonts, so one file covers every weight the page uses (400 body,
 * 600 labels, 700 headline) rather than three. Latin and latin-ext only —
 * the full set is ten subsets and this page has no Cyrillic on it.
 */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("/fonts/jetbrains-mono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("/fonts/jetbrains-mono-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: dark;

  --bg-base: #0e1013;
  --bg-panel: #161a20;
  --bg-sunken: #101318;
  --bg-elevated: #1d222a;
  --bg-hover: #252b35;
  --border: #252b34;
  --border-strong: #39424f;
  --grid-line: #1a1f26;
  --grid-line-major: #222831;

  --text-primary: #e5e9ef;
  --text-secondary: #98a2b0;
  --text-muted: #606b7b;

  --accent: #6e97c4;
  --accent-line: #6e97c44d;
  --accent-tint: #6e97c41f;
  --on-accent: #12151a;
  --brand-hi: #8ab7e9;

  --danger: #e5534b;
  --danger-line: #e5534b59;
  --live: #93bfa0;

  /* Port types. These are what colour the wires as well as the dots — an edge
     is the colour of what travels down it, which is the only legend the graph
     gets. */
  --type-height: #f2b559;
  --type-mask: #b8b7a8;
  --type-material: #e0699a;
  --type-flow: #00cae5;
  --type-water: #5b8def;

  /* Node categories, which colour the header icon only. */
  --cat-sculpt: #ff9f98;
  --cat-simulation: #3fd1b0;
  --cat-features: #d07be0;
  --cat-mask: #b8b7a8;
  --cat-core: #f0883e;
  --cat-cave: #8fcf6e;
  --cat-water: #5b8def;

  /* Presence. One hue per collaborator, used for their cursor, their name tag
     and the selection outline, so the three read as one person. */
  --pres-1: #d3a2b4;
  --pres-3: #b0a6cc;

  --wire-pulse: #fff0ce;

  --font-ui: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --gutter: clamp(1.25rem, 4vw, 4.5rem);
}

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

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* -- the backdrop ---------------------------------------------------------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/*
 * The editor's canvas grid. Gradients rather than an image: a few lines of CSS
 * against a request, and it stays crisp at any zoom.
 *
 * 34px cells with a heavier line every fifth one, which is the editor's own
 * ruling and the reason the graph sits on it convincingly — nodes are placed on
 * multiples of that pitch, so a node edge lands on a grid line rather than
 * between two.
 */
.backdrop__grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--grid-line-major) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line-major) 1px, transparent 1px),
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 170px 170px, 170px 170px, 34px 34px, 34px 34px;
  opacity: 0.9;
}

.backdrop__graph {
  position: absolute;
  top: 0;
  right: 0;
  width: 74%;
  height: 100%;
}

/*
 * The scrim is what makes the text legible over the graph.
 *
 * A horizontal gradient rather than a flat overlay: the graph should stay
 * readable on the right, where there is nothing on top of it, and disappear
 * under the column on the left. Flattening the whole thing would leave the
 * headline sitting on a grey rectangle.
 */
.backdrop__scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(100deg,
      var(--bg-base) 20%,
      rgba(14, 16, 19, 0.93) 32%,
      rgba(14, 16, 19, 0.42) 48%,
      rgba(14, 16, 19, 0.22) 72%,
      rgba(14, 16, 19, 0.34) 100%),
    radial-gradient(110% 78% at 8% 46%, rgba(14, 16, 19, 0.97) 0%, rgba(14, 16, 19, 0) 58%);
}

/* -- the graph itself ------------------------------------------------------ */

/*
 * A node, per `cmp/GraphNode`.
 *
 * The header has no band of its own — body and header are the same fill, and
 * the preview thumbnail is what separates the title from the ports. An earlier
 * version of this page drew a lighter strip across the top, which is a
 * reasonable guess at what a node editor looks like and not what this one does.
 */
.gn__body {
  fill: var(--bg-elevated);
  stroke: var(--border-strong);
  stroke-width: 1;
}
.gn__icon {
  fill: none;
  stroke: var(--cat, var(--text-secondary));
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.gn__title { fill: var(--text-primary); font: 600 11.5px var(--font-ui); }
.gn__ver {
  fill: var(--text-muted);
  font: 400 9px var(--font-mono);
  text-anchor: end;
}
/* A node with a newer version available says so in the accent colour. */
.gn__ver--bump { fill: var(--accent); }
.gn__bump {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gn__port { fill: var(--text-secondary); font: 400 9.5px var(--font-ui); }
.gn__port--out { text-anchor: end; }

.gn__meta { fill: var(--text-muted); font: 400 9.5px var(--font-mono); }
.gn__meta--r { text-anchor: end; }
.gn__meta--busy { fill: var(--accent); }

/* The compute bar, on the one node that is mid-pass. */
.gn__bar { fill: var(--bg-sunken); }
.gn__bar-trail { fill: var(--accent); opacity: 0.3; }
.gn__bar-fill { fill: var(--accent); }

/*
 * Port dots sit *on* the node edge rather than inside it — centred at x=0 and
 * x=186 — so half of each dot overhangs. That is what makes a wire look
 * plugged in instead of merely adjacent, and it is why the dots carry a stroke
 * in the panel colour: it punches them out of the node body behind them.
 */
.pt { r: 4.5; stroke: var(--bg-panel); stroke-width: 1.5; }
.pt--height { fill: var(--type-height); }
.pt--mask { fill: var(--type-mask); }
.pt--flow { fill: var(--type-flow); }
.pt--water { fill: var(--type-water); }
.pt--material { fill: var(--type-material); }

.wires .w {
  fill: none;
  stroke: var(--type-height);
  stroke-width: 1.7;
  stroke-linecap: round;
}
.wires .w--mask { stroke: var(--type-mask); }
.wires .w--live { stroke-width: 2.2; }

/*
 * The pulse: one packet travelling from Thermal erosion into Erosion, which is
 * the node the graph shows mid-compute. A dash travelling along a duplicate of
 * the edge rather than SMIL, because a CSS animation is the one kind a
 * `prefers-reduced-motion` rule can actually turn off.
 */
.wires .w--pulse {
  stroke: var(--wire-pulse);
  stroke-width: 2.2;
  stroke-dasharray: 7 52;
  stroke-dashoffset: 0;
  animation: pulse 2.6s linear infinite;
}
@keyframes pulse { to { stroke-dashoffset: -59; } }

/* -- presence -------------------------------------------------------------- */

.sel__box { fill: none; stroke-width: 1.5; }
.sel__name { font: 500 10px var(--font-ui); }
.cur__arrow { stroke: #edeef1; stroke-width: 1; stroke-linejoin: round; }
.cur__name { fill: #fff; font: 500 10.5px var(--font-ui); }

/* The tag tints are written out rather than derived with `color-mix`: a
   presence hue is a constant, and a browser that does not know the function
   would drop the declaration and leave the name label sitting on nothing. */
.sel--mara .sel__box { stroke: var(--pres-1); }
.sel--mara .sel__tag { fill: rgba(211, 162, 180, 0.22); }
.sel--mara .sel__name { fill: var(--pres-1); }
.cur--mara .cur__arrow, .cur--mara .cur__pill { fill: var(--pres-1); }

.sel--aiko .sel__box { stroke: var(--pres-3); }
.sel--aiko .sel__tag { fill: rgba(176, 166, 204, 0.22); }
.sel--aiko .sel__name { fill: var(--pres-3); }
.cur--aiko .cur__arrow, .cur--aiko .cur__pill { fill: var(--pres-3); }

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

.page {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: clamp(2rem, 5vh, 4rem);
  padding: clamp(1.25rem, 3vw, 2.25rem) var(--gutter);
  max-width: 1680px;
  margin-inline: auto;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: inherit;
}
.brand__mark { width: 34px; height: 34px; display: block; }
.brand__word { font-weight: 700; font-size: 1.3125rem; letter-spacing: 0.019em; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.5625rem;
  padding: 0.5625rem 0.9375rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-elevated);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.127em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
/* Accent, not the "live" green. Nothing on this page is live yet — that is the
   whole message — and a green pulse says a service is up. */
.status__dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--accent);
}

/*
 * The hero column is 640px and the paragraph inside it 600, which are the
 * designs' numbers rather than round ones. They matter: the headline is set to
 * break after "for", and a column 40px wider takes "entire" up onto the first
 * line.
 */
.hero {
  align-self: center;
  max-width: 40rem;
}

/* 30px between every block in the column, uniformly — the design uses a single
   gap rather than a tuned rhythm, and copying its four different margins was
   how this drifted in the first place. */
.eyebrow {
  margin: 0 0 1.875rem;
  font-family: var(--font-mono);
  font-size: 0.78125rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.headline {
  margin: 0 0 1.875rem;
  font-size: clamp(2.25rem, 6.2vw, 3.875rem);
  line-height: 1.06;
  font-weight: 700;
}

.lede {
  margin: 0 0 1.875rem;
  color: var(--text-secondary);
  font-size: clamp(0.9375rem, 1.6vw, 1.0625rem);
  line-height: 1.55;
  max-width: 37.5rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1.875rem;
  padding: 0;
  list-style: none;
}
/*
 * The label carries the category colour, not just the dot. That is what the
 * designs do and it is the same convention as the node headers in the backdrop
 * — a category is a colour, wherever it appears — so a grey label with a
 * coloured dot quietly broke the rhyme between the chips and the graph.
 */
.chips .chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 7px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-elevated);
  font-size: 0.78125rem;
  font-weight: 600;
  letter-spacing: 0.016em;
  color: var(--cat, var(--text-secondary));
}
.chips .chip::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--cat, var(--accent));
}
.chip[data-kind="sculpt"]  { --cat: var(--cat-sculpt); }
.chip[data-kind="erosion"] { --cat: var(--cat-simulation); }
.chip[data-kind="caves"]   { --cat: var(--cat-cave); }
.chip[data-kind="rivers"]  { --cat: var(--cat-water); }
.chip[data-kind="export"]  { --cat: var(--cat-core); }

/* -- capture --------------------------------------------------------------- */

.capture {
  max-width: 35rem;
}

.capture__form {
  display: flex;
  gap: 0.625rem;
  align-items: stretch;
}

.field {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
}
.field__icon {
  position: absolute;
  left: 1rem;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
  transition: stroke 120ms ease;
}
.field input {
  width: 100%;
  height: 54px;
  padding: 0 1rem 0 2.75rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--bg-sunken);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.90625rem;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.field input::placeholder { color: var(--text-muted); }
.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}

/* Invalid is driven by a class, not by `:invalid`. The pseudo-class matches an
   empty required field the moment the page loads, so a stock `:invalid` rule
   greets everybody with a red box before they have typed anything. */
.field.is-invalid input { border-color: var(--danger); }
.field.is-invalid input:focus { box-shadow: 0 0 0 3px rgba(229, 83, 75, 0.16); }
.field.is-invalid .field__icon { stroke: var(--danger); }

.submit {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5625rem;
  height: 54px;
  padding: 0 1.625rem;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-size: 0.90625rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease, opacity 120ms ease;
}
.submit:hover { background: #7ea4cd; }
.submit:focus-visible { outline: 2px solid var(--brand-hi); outline-offset: 2px; }
.submit[disabled] { cursor: default; opacity: 0.55; }

.submit__arrow {
  width: 15px; height: 15px;
  fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.submit__spinner {
  display: none;
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 999px;
  animation: spin 640ms linear infinite;
}
.submit.is-busy .submit__arrow { display: none; }
.submit.is-busy .submit__spinner { display: block; }

@keyframes spin { to { transform: rotate(360deg); } }

/* Off-screen rather than hidden: `display:none` is the first thing a bot checks
   for, and a field it can see but a person cannot is the whole trick. */
.trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Empty until Cloudflare needs to challenge somebody, so it must collapse to
   nothing rather than be hidden — see the note in the markup. */
.turnstile:not(:empty) { margin-top: 0.75rem; }

.error {
  margin: 0.6rem 0 0;
  color: var(--danger);
  font-size: 0.78125rem;
}

.note {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.8125rem 0 0;
  color: var(--text-muted);
  font-size: 0.78125rem;
}
.note__icon {
  width: 13px; height: 13px; flex: none;
  fill: none; stroke: currentColor;
  stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round;
}

/* -- confirmation ---------------------------------------------------------- */

.done__card {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--accent-line);
  border-radius: 12px;
  background: rgba(110, 151, 196, 0.09);
}
.done__check {
  flex: none;
  width: 20px; height: 20px;
  margin-top: 2px;
  padding: 3px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  fill: none; stroke: var(--accent);
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.done__title { margin: 0 0 0.375rem; font-weight: 700; font-size: 1.125rem; }
.done__body { margin: 0; color: var(--text-secondary); font-size: 0.84375rem; line-height: 1.5; }
.done__body span { color: var(--text-primary); }

.done__again {
  margin: 0.875rem 0 0;
  color: var(--text-muted);
  font-size: 0.78125rem;
}
.done__again button {
  border: 0;
  padding: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-underline-offset: 2px;
}
.done__again button:hover { text-decoration: underline; }

/* -- margin data ----------------------------------------------------------- */

.foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.71875rem;
  letter-spacing: 0.122em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.specs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.specs span { color: #3f4854; }
.specs span::after { content: " ·"; }

/* The domain sits a step brighter than the legal line beside it — it is the
   one thing in the footer somebody might want to read twice. */
.colophon { margin: 0; }
.colophon .domain { color: var(--text-secondary); }

/* -- responsive ------------------------------------------------------------ */

@media (max-width: 900px) {
  /* The graph stops being a column and becomes wallpaper: still present, still
     saying "this is an editor", no longer competing with the text. */
  .backdrop__graph { width: 132%; right: -20%; opacity: 0.42; }
  .backdrop__scrim {
    background:
      linear-gradient(180deg, rgba(14, 16, 19, 0.82) 0%, rgba(14, 16, 19, 0.94) 46%, var(--bg-base) 92%);
  }
  .hero { max-width: none; align-self: start; padding-top: 1rem; }
}

@media (max-width: 560px) {
  .capture__form { flex-direction: column; }
  .submit { width: 100%; }
  .foot { flex-direction: column; align-items: flex-start; }
  .specs { gap: 0.35rem 1rem; }
}

/* A tall thin viewport gets the hero centred again rather than stranded. */
@media (max-height: 620px) and (min-width: 901px) {
  .page { gap: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .submit__spinner { animation-duration: 2s; }
  * { transition-duration: 1ms !important; }

  /* The pulse is decoration on a decoration. It stops outright rather than
     slowing down — there is nothing to communicate by keeping it. */
  .wires .w--pulse { animation: none; stroke: transparent; }
}
