/* =====================================================================
   Spawn Edge — spawnedge.com landing
   One word, one link, and a scene that never quite stops moving.

   Rules obeyed throughout:
     · only `transform` and `opacity` are ever animated
     · every keyframe set opens and closes on the same value, so every
       loop is seamless by construction
     · filters are rasterised once and never animated
     · no external request: all art is generated geometry or gradient
   ===================================================================== */

/* ---------------------------------------------------------------- tokens */
:root {
  --font-sans: 'Inter', 'Segoe UI Variable Text', 'Segoe UI', system-ui, -apple-system,
    'Helvetica Neue', Arial, sans-serif;

  --bg-void:    #04070c;
  --bg-sunken:  #06090d;
  --bg-base:    #0a0e14;

  --accent:     #2ed8a0;
  --accent-hi:  #8ff2d0;
  --accent-lo:  #12695f;

  --ink:        #eef3f9;
  --ink-soft:   #a9b5c7;
  --hair:       rgba(233, 238, 246, 0.14);

  /* one scale drives the whole scene: grows with the viewport, but never
     runs away on an ultrawide because half of it is tied to vmin */
  --u: calc(7vw + 13vmin);
  --bleed: 64px;

  color-scheme: dark;
}

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

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  /* `clip` does not make a scroll container, which keeps position:fixed
     well behaved; `hidden` is the fallback for engines that lack it */
  overflow-x: hidden;
  overflow-x: clip;
  overscroll-behavior: none;
  background: var(--bg-void);
}

body {
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}

.defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ============================================================== the scene */
.scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--bg-base);
  contain: strict;
  animation: sceneIn 1400ms cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
@keyframes sceneIn { from { opacity: 0; } to { opacity: 1; } }

.layer { position: absolute; inset: 0; pointer-events: none; }

/* parallax carriers bleed past the viewport so a few pixels of drift can
   never expose an edge */
.layer[data-depth] {
  inset: calc(-1 * var(--bleed));
  will-change: transform;
  transform: translate3d(0, 0, 0);
}

.myc {
  z-index: 3;
  display: block;
  width: calc(100% + 2 * var(--bleed));
  height: calc(100% + 2 * var(--bleed));
}

/* ---------------------------------------------------- 4 · horizon glow */
.grain {
  z-index: 11;
  inset: -16%;
  opacity: 0.075;
  background-repeat: repeat;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch' seed='7'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  will-change: transform;
  animation: grainShift 0.8s steps(1, end) infinite;
}
@keyframes grainShift {
  0%    { transform: translate3d(0, 0, 0); }
  12.5% { transform: translate3d(-5%, -3%, 0); }
  25%   { transform: translate3d(-9%, 4%, 0); }
  37.5% { transform: translate3d(3%, -6%, 0); }
  50%   { transform: translate3d(-7%, 7%, 0); }
  62.5% { transform: translate3d(6%, 2%, 0); }
  75%   { transform: translate3d(-2%, -8%, 0); }
  87.5% { transform: translate3d(8%, -1%, 0); }
  100%  { transform: translate3d(0, 0, 0); }
}

/* --------------------------------------------------------- 4 · topbar */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 30;
  display: flex;
  justify-content: flex-end;
  padding: clamp(14px, 2.4vmin, 30px) clamp(16px, 2.8vmin, 44px);
  padding-top: max(clamp(14px, 2.4vmin, 30px), env(safe-area-inset-top, 0px));
  padding-right: max(clamp(16px, 2.8vmin, 44px), env(safe-area-inset-right, 0px));
}

.signin {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  border: 1px solid var(--hair);
  border-radius: 999px;
  background: rgba(6, 10, 16, 0.46);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
          backdrop-filter: blur(12px) saturate(1.1);
  color: var(--ink);
  font-size: clamp(0.6875rem, 1.15vmin, 0.8125rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color 220ms ease, border-color 220ms ease, background-color 220ms ease, transform 220ms ease;
}
.signin__label { display: block; }
.signin__arrow {
  display: block;
  flex: none;
  transition: transform 220ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
.signin:hover {
  color: var(--accent-hi);
  border-color: rgba(46, 216, 160, 0.46);
  background: rgba(8, 26, 24, 0.6);
  transform: translateY(-1px);
}
.signin:hover .signin__arrow { transform: translateX(3px); }
.signin:active { transform: translateY(0); }
.signin:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  color: var(--accent-hi);
  border-color: rgba(46, 216, 160, 0.46);
}

/* ============================================================ wordmark */
.stage {
  position: relative;
  z-index: 20;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 3vmin, 38px);
  padding: clamp(80px, 13vmin, 150px) 6vw clamp(170px, 30vmin, 330px);
  pointer-events: none;
  will-change: transform;
}

.wm {
  position: relative;
  margin: 0;
  pointer-events: auto;
  font-weight: 600;
  font-size: clamp(2.6rem, min(8.4vw, 13.5vh), 9rem);
  line-height: 0.96;
  letter-spacing: 0.215em;
  text-transform: uppercase;
  white-space: nowrap;
  animation: wmIn 1100ms 160ms cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
@keyframes wmIn { from { opacity: 0; } to { opacity: 1; } }

.wm__ink,
.wm__glow {
  display: flex;
  flex-flow: row nowrap;
  align-items: baseline;
  justify-content: center;
  gap: 0.34em;
}
.wm__glow {
  position: absolute;
  inset: 0;
  animation: wmBreathe 11s ease-in-out infinite;
}

.wm__a { color: #f4f8fd; }
.wm__b { color: var(--accent); margin-right: -0.215em; }

.wm__ink .wm__a { text-shadow: 0 1px 0 rgba(2, 6, 10, 0.55); }
.wm__ink .wm__b { text-shadow: 0 1px 0 rgba(2, 6, 10, 0.55); }

.wm__glow .wm__a {
  color: transparent;
  text-shadow: 0 0 32px rgba(198, 226, 255, 0.5), 0 0 88px rgba(120, 186, 228, 0.26);
}
.wm__glow .wm__b {
  color: transparent;
  text-shadow: 0 0 26px rgba(46, 216, 160, 0.78), 0 0 74px rgba(46, 216, 160, 0.4), 0 0 140px rgba(46, 216, 160, 0.22);
}
@keyframes wmBreathe { 0%, 100% { opacity: 0.4; } 50% { opacity: 0.95; } }

/* hairline rule — engineered, quietly alive */
.rule {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(44vw, 420px);
  pointer-events: none;
  animation: wmIn 1100ms 420ms cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
.rule__line {
  flex: 1 1 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(46, 216, 160, 0) 0%, rgba(46, 216, 160, 0.38) 55%, rgba(143, 242, 208, 0.85) 100%);
  transform-origin: 100% 50%;
  animation: ruleGrow 14s ease-in-out infinite;
}
.rule__line:last-child {
  background: linear-gradient(270deg, rgba(46, 216, 160, 0) 0%, rgba(46, 216, 160, 0.38) 55%, rgba(143, 242, 208, 0.85) 100%);
  transform-origin: 0 50%;
}
.rule__node {
  flex: none;
  width: 5px;
  height: 5px;
  border-radius: 1px;
  background: var(--accent-hi);
  box-shadow: 0 0 10px rgba(46, 216, 160, 0.9), 0 0 26px rgba(46, 216, 160, 0.45);
  transform: rotate(45deg);
  animation: nodePulse 11s ease-in-out infinite;
}
@keyframes ruleGrow { 0%, 100% { transform: scaleX(0.72); } 50% { transform: scaleX(1); } }
@keyframes nodePulse {
  0%, 100% { opacity: 0.55; transform: rotate(45deg) scale(0.86); }
  50%      { opacity: 1;    transform: rotate(45deg) scale(1.14); }
}

/* ========================================================= responsive */

/* stack the wordmark; spread the hero flora past both edges so a phone
   reads as a deliberate crop rather than a squeezed desktop */
@media (max-width: 700px) {
  .wm {
    font-size: clamp(2.4rem, min(15vw, 11vh), 5.4rem);
    line-height: 1.08;
  }
  .wm__ink, .wm__glow { flex-direction: column; align-items: center; gap: 0.06em; }
  .wm__a { margin-right: -0.215em; }
  .rule { width: min(62vw, 300px); }
}

/* very short viewports: pull the composition tighter so nothing clips */
@media (max-height: 480px) {
  .stage { padding-bottom: clamp(90px, 18vmin, 160px); padding-top: clamp(56px, 10vmin, 100px); }
  .rule { width: min(38vw, 300px); }
}

/* ultrawide: let the wordmark own more of the middle */
@media (min-width: 2200px) {
  .rule { width: min(30vw, 620px); }
}

/* ==================================================== reduced motion ==
   Everything stops on a chosen, composed frame — lit, layered, and
   deliberately posed, not a blank background. */
@media (prefers-reduced-motion: reduce) {
  .scene,
  .grain,
  .wm, .wm__glow, .rule, .rule__line, .rule__node {
    animation: none !important;
  }

  .scene { opacity: 1; }
  .wm, .rule { opacity: 1; }
  .grain         { opacity: 0.06; transform: translate3d(0, 0, 0); }

  .wm__glow      { opacity: 0.7; }
  .rule__line    { transform: scaleX(0.94); }
  .rule__line:last-child { transform: scaleX(0.94); }
  .rule__node    { opacity: 0.95; transform: rotate(45deg) scale(1.05); }

  .signin, .signin__arrow { transition: none; }
}

/* backgrounded tab: hold every CSS loop where it stands */
.is-hidden .scene *,
.is-hidden .stage * { animation-play-state: paused !important; }

/* ================================================== see what we grow ==
   One link, into the public catalogue at /items/.

   It carries the `signin` class as well as this one, deliberately: the
   pill, its hover, its focus ring and its arrow are all defined once,
   up there, and this block adds only what differs — the entrance, and
   the pointer events that `.stage` turns off so the scene can be moused
   through beneath it.
   ===================================================================== */
.grow {
  pointer-events: auto;
  animation: wmIn 1100ms 700ms cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

@media (prefers-reduced-motion: reduce) {
  .grow { animation: none; opacity: 1; }
}
