/* The blob page (blob.html): the xfea.ai cloud, which becomes a network as
   the camera flies in, then the private beta signup.
   blob-scroll.js times the story; blob.js draws it. */

/* ---------------------------------------------------------------- tokens */

:root {
  /* xfea.ai's dark ground and light text; Taltal's ink for text on white. */
  --blob-ground: #0a0c0f;
  --blob-ink: #e6e8eb;
  --ink: #18263a;
}

/* ------------------------------------------------------------------ page
   blob-scroll.js turns the background white at the end, step by step with
   the scroll. */

.blob-page {
  margin: 0;
  background: var(--blob-ground);
}

/* ----------------------------------------------------------------- track
   The story plays over the track's scroll (timed in blob-scroll.js). Long,
   so each beat gets time on screen. */

.blob-track {
  position: relative;
  height: 400svh;
}

.blob-stage {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100svh;
  padding: 0 16px;
  text-align: center;
}

/* ----------------------------------------------------------------- lines
   Shown one at a time in the middle of the screen while the camera is
   inside the cloud. blob-scroll.js sets each line's opacity and rise from
   its data-show range. */

.blob-lines {
  position: absolute;
  inset: 0;
  /* Above the fixed canvas (z-index 0). */
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 0 16px;
  pointer-events: none;
}

.blob-line {
  /* All lines share one cell, so each sits in the centre. */
  grid-area: 1 / 1;
  max-width: 20ch;
  margin: 0;
  font-family: "Urbanist", system-ui, sans-serif;
  font-weight: 600;
  font-size: clamp(34px, 5.4vw, 76px);
  line-height: 1;
  letter-spacing: -0.02em;
  text-wrap: balance;
  color: var(--blob-ink);
  opacity: 0;
  transition: color 0.4s;
}
/* ------------------------------------------------------------------ beta
   The end of the scroll: the private beta signup, over the network. */

.beta {
  grid-area: 1 / 1;
  display: grid;
  justify-items: center;
  gap: 28px;
  width: min(100%, 520px);
  opacity: 0;
  pointer-events: auto;
}
.beta-title { opacity: 1; }
.beta-form { width: 100%; }
.beta-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.beta-row {
  display: flex;
  gap: 8px;
}
.beta-row input,
.beta-row button {
  font: 500 17px/1 "Urbanist", system-ui, sans-serif;
  padding: 14px 18px;
  border-radius: 999px;
  border: 1px solid rgba(230, 232, 235, 0.35);
}
.beta-row input {
  flex: 1;
  min-width: 0;
  background: rgba(10, 12, 15, 0.6);
  color: var(--blob-ink);
}
.beta-row input::placeholder { color: rgba(230, 232, 235, 0.5); }
.beta-row button {
  background: var(--blob-ink);
  color: var(--blob-ground);
  font-weight: 600;
  cursor: pointer;
}
.beta-row button:disabled { opacity: 0.6; cursor: wait; }
.beta-row :focus-visible { outline: 2px solid var(--blob-ink); outline-offset: 2px; }
.beta-note {
  min-height: 1.4em;
  margin: 14px 0 0;
  font: 400 15px/1.4 "Urbanist", system-ui, sans-serif;
  color: var(--blob-ink);
}
@media (max-width: 480px) {
  .beta-row { flex-direction: column; }
}
.beta-consent {
  max-width: 44ch;
  margin: 4px auto 0;
  font: 400 13px/1.45 "Urbanist", system-ui, sans-serif;
  color: rgba(230, 232, 235, 0.55);
  text-wrap: pretty;
}

/* ---------------------------------------------------------------- credit
   Fixed at the foot of the screen, quiet. */

.blob-credit {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 16px;
  z-index: 2;
  text-align: center;
  font: 500 12px/1 "Urbanist", system-ui, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(230, 232, 235, 0.4);
  pointer-events: none;
}
.blob-credit a {
  color: inherit;
  text-decoration: none;
  pointer-events: auto;
}
.blob-credit a:hover,
.blob-credit a:focus-visible { color: var(--blob-ink); }

/* ------------------------------------------------------------------ blob */

.blob {
  position: relative;
  /* canvas_size_desktop in blob.yaml */
  width: min(53vw, 510px);
  aspect-ratio: 1;
}
@media (max-width: 640px) {
  /* canvas_size_mobile in blob.yaml */
  .blob { width: 86vw; }
}

/* One canvas over the whole viewport, behind the page. The .blob box only
   reserves the cloud's place; the shader draws the cloud where the box is. */
.blob-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* A faint halo behind the network, under the canvas. blob-scroll.js fades it
   in as the network forms. */
.blob-halo {
  position: fixed;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(closest-side at 50% 50%,
    rgba(120, 160, 215, 0.16) 0%,
    rgba(87, 128, 184, 0.07) 45%,
    rgba(87, 128, 184, 0) 100%);
  /* a circle wider than the screen on phones, filling the height on desktop */
  width: max(140vw, 120vh);
  height: max(140vw, 120vh);
  left: 50%;
  top: 50%;
  translate: -50% -50%;
}

/* Shown when WebGL is unavailable. */
.blob-fallback {
  display: none;
  position: absolute;
  inset: 12%;
  border-radius: 48% 52% 46% 54% / 52% 44% 56% 48%;
  background: radial-gradient(circle at 42% 38%, #dbe7f5 0%, #8fb0d6 28%, #5780b8 62%, #17243a 100%);
  box-shadow: inset 0 0 40px rgba(255, 255, 255, 0.35), 0 0 80px rgba(87, 128, 184, 0.45);
  animation: blob-morph 12s ease-in-out infinite alternate, blob-breathe 6s ease-in-out infinite;
}
.blob[data-fallback] .blob-canvas { display: none; }
.blob[data-fallback] .blob-fallback { display: block; }

@keyframes blob-morph {
  0% { border-radius: 48% 52% 46% 54% / 52% 44% 56% 48%; transform: rotate(0deg) scale(1); }
  50% { border-radius: 54% 46% 56% 44% / 46% 56% 44% 54%; transform: rotate(6deg) scale(1.03); }
  100% { border-radius: 44% 56% 48% 52% / 56% 46% 54% 44%; transform: rotate(-4deg) scale(0.98); }
}
@keyframes blob-breathe {
  0%, 100% { opacity: 0.8; scale: 0.92; }
  50% { opacity: 1; scale: 1.06; }
}
@media (prefers-reduced-motion: reduce) {
  .blob-fallback { animation: none; }
}
