/* ── Hero ─────────────────────────────────────────────────── */

.gs-hero {
  position: relative;
  /* Full-bleed stage: the whole viewport is the light. Copy + the glass control
     panel float over it as a centered column; the 2D nodes live on the light
     itself in the open areas around them. */
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(var(--space-sm), 1.6vh, var(--space-md));
  padding: calc(var(--space-md) + 3.5rem) var(--space-md) 1.5rem;
  overflow: clip;
  isolation: isolate;
}

.gs-hero__backdrop {
  position: absolute;
  inset: 0;
  z-index: -1;
  /* Fallback in the default gradient's colours (store.js DEFAULT_STOPS): instant
     paint, slow drift if the shader never mounts. JS rebuilds --gs-ambient from
     the user's stops on every edit. */
  background: var(--gs-ambient,
    radial-gradient(58% 55% at 18% 24%, rgba(255, 179, 0, 0.35), transparent 70%),
    radial-gradient(52% 60% at 80% 16%, rgba(255, 91, 91, 0.3), transparent 70%),
    radial-gradient(70% 58% at 52% 88%, rgba(255, 188, 157, 0.22), transparent 72%),
    linear-gradient(180deg, #070b14, #120c10));
  background-size: 180% 180%;
  animation: gs-ambient-drift 26s ease-in-out infinite alternate;
  /* Cursor parallax: JS sets --gs-px/--gs-py (px). Slight overscale hides the
     edges as the stage drifts toward the pointer. */
  transform: translate3d(calc(var(--gs-px, 0) * 1px), calc(var(--gs-py, 0) * 1px), 0) scale(1.06);
  transition: transform 500ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

@keyframes gs-ambient-drift {
  from { background-position: 0% 0%; }
  to   { background-position: 100% 100%; }
}


/* Fine film grain keeps the big gradient surface from looking flat-vector */
.gs-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.04;
  /* overlay blending textures the stage without lifting the blacks to haze */
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Fade only the bottom into the page floor. The center is the editable
   gradient preview; the old centered headline no longer needs a vignette. */
.gs-hero__scrim {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    /* bottom: dissolve into the page night floor with no edge */
    linear-gradient(to top,
      #080b14 0%,
      rgba(8, 11, 20, 0.7) 10%,
      transparent 34%);
  /* NO top band — the light flows straight up through the transparent header so
     there is no cut. The header keeps its own legibility treatment. */
}

/* One small h1 at the top left, on the logo's edge, 2rem under the header: the
   stage's middle belongs to the light and the nodes. */
.gs-hero__copy {
  position: absolute;
  z-index: 5;
  top: calc(var(--gs-header-clear) + 2.25rem);
  left: var(--gs-edge);
  max-width: min(40rem, calc(100% - 2 * var(--gs-edge)));
  margin: 0;
  /* Non-interactive text → clicks pass through to the color nodes on the light */
  pointer-events: none;
}

/* The page's keyword, as the h1's first line: the brand wink without chrome */
.gs-eyebrow {
  display: block;
  font-family: var(--font-primary);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.36em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
  margin: 0 0 0.75rem;
}

.gs-title {
  font-family: var(--font-secondary);
  font-weight: 650;
  font-size: clamp(1.4rem, 1.1rem + 0.9vw, 1.75rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0;
  color: #fff;
}
.gs-title__line { display: block; }

/* The controls stand on the stage's floor */
.gs-hero > .gs-editor { margin-top: auto; }

/* The open gradient's name, Save and Share: on the headline's top line and the
   menu button's edge, once there is something to keep (modules/docChip.js) */
.gs-doc {
  position: absolute;
  z-index: 6;
  top: calc(var(--gs-header-clear) + 2.25rem);
  right: var(--gs-edge);
  display: flex;
  align-items: center;
  height: 2.5rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: rgba(10, 14, 22, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.14);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  backdrop-filter: blur(22px) saturate(1.4);
  color: var(--color-text-primary);
  animation: gs-doc-in 240ms cubic-bezier(0.22, 1, 0.36, 1);
}
.gs-doc[hidden] { display: none; }
@keyframes gs-doc-in { from { opacity: 0; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .gs-doc { animation: none; } }

.gs-doc__name {
  width: 11rem;
  height: 2rem;
  padding: 0 0.6rem;
  border: 0;
  border-radius: 999px;
  background: none;
  color: inherit;
  font: 600 0.82rem/1 var(--font-secondary);
  text-overflow: ellipsis;
}
@supports (field-sizing: content) {
  .gs-doc__name { field-sizing: content; width: auto; min-width: 6rem; max-width: 16rem; }
}
.gs-doc__name:hover { background: rgba(255, 255, 255, 0.06); }
.gs-doc__name:focus-visible { outline: 2px solid var(--color-text-primary); outline-offset: 1px; background: rgba(255, 255, 255, 0.06); }

.gs-doc__btn {
  height: 2rem;
  padding: 0 0.8rem;
  border: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.14);
  background: none;
  color: inherit;
  font: 600 0.8rem/1 var(--font-secondary);
  cursor: pointer;
}
.gs-doc__btn:last-child { border-radius: 0 999px 999px 0; }
.gs-doc__btn:hover { background: rgba(255, 255, 255, 0.08); }
.gs-doc__btn:focus-visible { outline: 2px solid var(--color-text-primary); outline-offset: 1px; }
.gs-doc__btn.is-saved { color: var(--color-text-secondary); }

/* ── Focus mode: hide EVERYTHING but the gradient itself ─────────────────────── */
.gs-hero.gs-focus .gs-editor,
.gs-hero.gs-focus .gs-hero__copy,
.gs-hero.gs-focus .gs-doc,
.gs-hero.gs-focus .gs-starters,
.gs-hero.gs-focus .gs-trustline,
.gs-hero.gs-focus .gs-mesh-layer,
.gs-hero.gs-focus .gs-geo,
.gs-hero.gs-focus .gs-hero__scrim,
body.gs-focus .site-header {
  opacity: 0;
  pointer-events: none;
  transition: opacity 320ms cubic-bezier(0.22, 1, 0.36, 1);
}
.gs-hero.gs-focus .gs-node-info { display: none; }
.gs-hero.gs-focus .gs-mesh-lines { opacity: 0; }

/* Exit-focus: a round ✕ pinned top-right, above everything. */
.gs-focus-exit {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 1100;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(10, 14, 22, 0.55);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 1rem 2.5rem -0.75rem rgba(0, 0, 0, 0.6);
}
.gs-focus-exit[hidden] { display: none; }
.gs-focus-exit:hover { background: rgba(255, 255, 255, 0.16); }
.gs-focus-exit .gs-icon, .gs-focus-exit > svg { font-size: 1.1rem; }

/* ── Full-bleed light stage ──────────────────────────────────────────────
   The whole hero IS the light. Layers stack inside .gs-hero:
   backdrop (shader/ambient, z-1) ▸ stage-light (--gs-gradient, z0) ▸
   compare (sRGB wipe, z1) ▸ scrim (legibility, z2) ▸ nodes (z4) ▸
   copy (z5) ▸ dock (z6). */
.gs-stage-light {
  position: absolute;
  inset: 0;
  z-index: 0;
  /* The composited layer stack: image list + per-layer blend modes over the
     bottom layer's base colour. */
  background-color: var(--gs-base, #080b14);
  background-image: var(--gs-gradient, linear-gradient(135deg in oklch, #36c9f0, #4e1cff));
  background-blend-mode: var(--gs-blend, normal);
  /* Cursor parallax: JS sets --gs-px/--gs-py. Overscale hides the edges. */
  transform: translate3d(calc(var(--gs-px, 0) * 1px), calc(var(--gs-py, 0) * 1px), 0) scale(1.06);
  transition: transform 500ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

/* Real WebGL gradient stage: covers the CSS layer when the engine is live. */
.gs-stage-gl {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  transition: opacity 320ms ease, transform 500ms cubic-bezier(0.22, 1, 0.36, 1);
  transform: translate3d(calc(var(--gs-px, 0) * 1px), calc(var(--gs-py, 0) * 1px), 0) scale(1.06);
  will-change: transform;
  pointer-events: none;
}
.gs-stage-gl.is-live { opacity: 1; }

.gs-stage-compare {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: var(--gs-gradient-srgb, linear-gradient(135deg, #36c9f0, #4e1cff));
  /* Simple swap on toggle — the toggle is enough, no scrub. */
  opacity: 0;
  transition: opacity 260ms ease;
  pointer-events: none;
}

.gs-hero.is-comparing .gs-stage-compare { opacity: 1; }

.gs-stage-nodes {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none; /* the nodes themselves opt back in */
}

/* Headline fades out while sculpting so the light owns the stage. */
.gs-hero__copy {
  transition: opacity 450ms cubic-bezier(0.22, 1, 0.36, 1);
}
.gs-hero.is-engaged .gs-hero__copy { opacity: 0; }

/* ── Starter chips + trust line under the dock ────────────── */

.gs-starters {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-wrap: wrap;
  justify-content: center;
  position: relative;
  z-index: 6; /* above the full-stage node layer */
}

.gs-starters__label {
  font-size: 0.82rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  margin-right: 0.2rem;
}

/* High specificity + aspect-ratio: global button min-heights otherwise
   stretch these into ovals (same bleed as the dock controls) */
.gradient-studio .gs-starter {
  width: 2.25rem;
  height: 2.25rem;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.75);
  background: var(--card-gradient);
  cursor: pointer;
  padding: 0;
  box-shadow: 0 4px 14px rgba(8, 11, 17, 0.25);
  transition: box-shadow 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* No levitation: the chip's ring brightens in place. */
.gradient-studio .gs-starter:hover,
.gradient-studio .gs-starter:focus-visible {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.55);
}

.gs-trustline {
  margin: 0;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.78);
  position: relative;
  z-index: 6;
}

.gs-trustline a {
  color: #fff;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Flying save swatch (GSAP moves it; this defines its look) */
.gs-fly-swatch {
  position: fixed;
  z-index: 1300;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
