/* Sticky scroll heart — embeddable on index + optional lab.html debug page */

.lab-page {
  background: #c6e7f1;
  color: #0b2a36;
  font-family: var(--display, "Space Grotesk", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif);
  overflow-x: clip;
}

.lab-page .lab-top {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  pointer-events: none;
}

.lab-page .lab-top a {
  pointer-events: auto;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(11, 42, 54, 0.55);
  text-decoration: none;
}

.lab-page .lab-top a:hover { color: #0b2a36; }

.lab-page .lab-brand {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #0b2a36;
}

.lab-page .lab-brand span { color: #0d9488; }

.lab-page .lab-hint {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(11, 42, 54, 0.55);
}

/* Full-bleed breakout when nested in .wrap */
.site-lab {
  --lab-fg: #0b2a36;
  --lab-mute: rgba(11, 42, 54, 0.55);
  --lab-line: rgba(11, 42, 54, 0.16);
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  margin-top: 48px;
  margin-bottom: 48px;
  z-index: 3;
}

.lab-track {
  height: 360vh;
  position: relative;
}

.lab-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  background:
    radial-gradient(ellipse 55% 45% at 50% 42%, rgba(255, 255, 255, 0.45), transparent 62%),
    radial-gradient(ellipse 40% 35% at 70% 70%, rgba(13, 148, 136, 0.08), transparent 55%),
    #c6e7f1;
}

#grain-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.lab-film {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.14;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
  animation: labFilmShift 7s steps(6) infinite;
}

@keyframes labFilmShift {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-1.5%, 1%); }
  50% { transform: translate(1%, -1.5%); }
  75% { transform: translate(-1%, -0.5%); }
  100% { transform: translate(0, 0); }
}

.lab-copy {
  position: absolute;
  left: 50%;
  bottom: 12%;
  top: auto;
  transform: translateX(-50%);
  text-align: center;
  width: min(920px, calc(100% - 40px));
  z-index: 5;
  pointer-events: none;
}

.lab-kicker {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: #0d9488;
  margin-bottom: 18px;
  text-transform: uppercase;
}

.lab-title {
  font-family: var(--display);
  font-size: clamp(2.4rem, 8vw, 5.6rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
  font-weight: 700;
  text-transform: lowercase;
  color: var(--lab-fg);
}

.lab-title span {
  display: block;
  opacity: 0.92;
  transition: opacity 0.4s var(--ease, cubic-bezier(0.22, 1, 0.36, 1)),
    transform 0.5s var(--ease, cubic-bezier(0.22, 1, 0.36, 1));
}

.lab-sub {
  margin-top: 18px;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--lab-mute);
  max-width: 42ch;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

.lab-progress {
  position: absolute;
  left: 28px;
  right: 28px;
  bottom: 28px;
  height: 1px;
  background: var(--lab-line);
  z-index: 5;
}

.lab-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0d9488, #06b6d4, #0b2a36);
  box-shadow: 0 0 12px rgba(13, 148, 136, 0.25);
}

.lab-meta {
  position: absolute;
  left: 28px;
  right: 28px;
  bottom: 48px;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--lab-mute);
  text-transform: uppercase;
}

.lab-meta strong {
  display: block;
  margin-top: 6px;
  color: var(--lab-fg);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: none;
  font-size: 0.86rem;
}

@media (max-width: 720px) {
  .site-lab {
    margin-top: 28px;
    margin-bottom: 28px;
  }

  .lab-copy {
    bottom: auto;
    top: 16%;
  }

  .lab-title {
    font-size: clamp(2rem, 11vw, 3.2rem);
  }

  .lab-meta {
    flex-direction: column;
    bottom: 56px;
    left: 16px;
    right: 16px;
  }

  .lab-progress {
    left: 16px;
    right: 16px;
    bottom: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lab-film { animation: none; }
  .lab-track { height: 100vh; }
}
