/* ============================================================
   SKWKY Labs — page-specific styles
   ============================================================ */

/* Active state for SKWKY Labs nav button on this page */
.btn--labs.is-active {
  box-shadow: 0 0 0 2px rgba(255,216,107,0.6), 0 12px 30px rgba(255,197,50,0.45);
}

/* Yellow scroll-progress bar on the Labs page (homepage stays purple) */
.page-labs .scroll-progress {
  background: linear-gradient(90deg, #FFD86B 0%, #FFC532 100%);
}

/* All section eyebrows on the Labs page use the yellow accent */
.page-labs .eyebrow,
.page-labs .eyebrow.on-dark {
  color: #FFD86B;
}

/* ============================================================
   Yellow/black theming for icons and accents on Labs page
   ============================================================ */

/* Six dimensions — signal icons */
.page-labs .signal__icon {
  background: linear-gradient(135deg, #FFD86B 0%, #FFC532 100%);
  color: #1A1300;
  box-shadow: 0 4px 16px rgba(255,197,50,0.35);
}
.page-labs .signal__icon svg {
  stroke: #1A1300;
  stroke-width: 2.2;
}

/* Diagnostic layers — icon container, tint to yellow */
.page-labs .diag-layer__icon {
  background: linear-gradient(135deg, rgba(255, 216, 107, 0.10), rgba(255, 197, 50, 0.06));
  border-color: rgba(255, 216, 107, 0.18);
}

/* Rigor callout (the "What it is" / measured construct block) */
.page-labs .rigor-callout {
  background: linear-gradient(135deg, rgba(255, 216, 107, 0.14), rgba(255, 197, 50, 0.06));
  border-color: rgba(255, 216, 107, 0.28);
}

/* ============================================================
   Labs Hero — split: copy left, engine diagram right
   ============================================================ */
.labs-hero {
  position: relative;
  min-height: 100vh;
  background: var(--bg-darker);
  color: white;
  padding: calc(var(--nav-h) + 60px) 0 80px;
  overflow: hidden;
  display: flex;
  align-items: center;
}
.labs-hero .hero__grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  pointer-events: none;
}
.labs-hero .hero__blob--1 { background: rgba(85,92,255,0.5); }
.labs-hero .hero__blob--2 { background: rgba(255,216,107,0.18); }

.labs-hero__inner {
  max-width: 720px;
  position: relative;
  z-index: 2;
  margin-left: clamp(-200px, -16vw, -80px);
}
@media (max-width: 800px) {
  .labs-hero__inner { margin-left: 0; }
}
.labs-hero__inner h1 {
  font-size: clamp(2.6rem, 5.6vw, 4.6rem);
  font-weight: 900;
  margin-bottom: 24px;
}
.labs-hero__accent {
  background: linear-gradient(135deg, #FFD86B 0%, #FFC532 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.labs-hero__sub {
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  color: rgba(255,255,255,0.78);
  max-width: 600px;
  margin-bottom: 32px;
}

.labs-hero__pills {
  display: flex; flex-wrap: wrap; gap: 12px;
}
.labs-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  color: rgba(255,255,255,0.78);
  font-weight: 500;
}
.labs-pill span {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 1rem;
  background: linear-gradient(135deg, #FFD86B 0%, #FFC532 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Engine diagram */
.labs-hero__engine {
  position: absolute;
  right: -80px;
  top: 50%;
  transform: translateY(-50%);
  width: 640px;
  height: 640px;
  z-index: 1;
  opacity: 0.85;
  pointer-events: none;
  animation: engine-drift 18s ease-in-out infinite;
}
@keyframes engine-drift {
  0%, 100% { transform: translateY(-50%) rotate(0deg); }
  50% { transform: translateY(-50%) rotate(8deg); }
}
.neuron-net { width: 100%; height: 100%; overflow: visible; }

/* trunk + branch + terminal flicker — gives a subtle live "data flowing" look */
.neuron-net .neuron-trunks path { animation: synapse-flicker 4s ease-in-out infinite; }
.neuron-net .neuron-trunks path:nth-child(2n) { animation-delay: -1s; }
.neuron-net .neuron-trunks path:nth-child(3n) { animation-delay: -2s; }
.neuron-net .neuron-branches path { animation: synapse-flicker 4.5s ease-in-out infinite; }
.neuron-net .neuron-branches path:nth-child(2n) { animation-delay: -1.5s; }
.neuron-net .neuron-branches path:nth-child(3n) { animation-delay: -2.5s; }
.neuron-net .neuron-branches path:nth-child(4n) { animation-delay: -3.5s; }
.neuron-net .neuron-terminals path { animation: synapse-flicker 5s ease-in-out infinite; }
.neuron-net .neuron-terminals path:nth-child(2n) { animation-delay: -1.2s; }
.neuron-net .neuron-terminals path:nth-child(3n) { animation-delay: -2.4s; }
.neuron-net .neuron-terminals path:nth-child(4n) { animation-delay: -3.6s; }
.neuron-net .neuron-terminals path:nth-child(5n) { animation-delay: -4.2s; }
@keyframes synapse-flicker {
  0%, 100% { stroke-opacity: 0.25; }
  50%      { stroke-opacity: 0.7; }
}

/* node breathing — soma cells pulse softly */
.neuron-net .nn { transform-box: fill-box; transform-origin: center; animation: neuron-breathe 3s ease-in-out infinite; animation-delay: var(--d, 0s); }
.neuron-net .nn circle:first-child { animation: halo-breathe 3s ease-in-out infinite; transform-origin: center; transform-box: fill-box; animation-delay: var(--d, 0s); }
@keyframes neuron-breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }
@keyframes halo-breathe   { 0%,100% { opacity: 0.12; } 50% { opacity: 0.28; } }

/* core soma duck — pixel-art crisp + glowing pulse */
.neuron-core-duck {
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  animation: core-pulse 4s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes core-pulse {
  0%, 100% { filter: drop-shadow(0 0 12px rgba(255, 216, 107, 0.6)) drop-shadow(0 0 24px rgba(255, 197, 50, 0.4)); transform: scale(1); }
  50%      { filter: drop-shadow(0 0 22px rgba(255, 216, 107, 1)) drop-shadow(0 0 44px rgba(255, 197, 50, 0.8)); transform: scale(1.05); }
}

/* traveling pulse glow */
.neuron-net .neuron-pulses circle { filter: drop-shadow(0 0 6px rgba(255, 216, 107, 0.95)); }

@media (max-width: 1100px) {
  .labs-hero__engine { right: -200px; opacity: 0.45; }
}
@media (max-width: 800px) {
  .labs-hero__engine {
    position: relative; right: 0; top: 0; transform: none;
    width: 100%; height: 320px;
    margin-top: 32px;
    opacity: 0.9;
    animation: none;
  }
  .labs-hero {
    min-height: 100vh;
    align-items: flex-start;
    padding-top: calc(var(--nav-h) + 32px);
    padding-bottom: 32px;
  }
}

/* ============================================================
   ERS note (after dimensions, on dark bg)
   ============================================================ */
.ers-note {
  margin: 40px auto 0;
  max-width: 820px;
  padding: 24px 28px;
  background: rgba(255,255,255,0.03);
  border-left: 3px solid #FFD86B;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: 1rem;
  color: var(--text-inverse-muted);
  line-height: 1.6;
}
.ers-note strong { color: white; font-weight: 700; }

/* ============================================================
   Signal cards on dark labs sections
   ============================================================ */
.section--dark .signal {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  transition: transform 0.3s var(--ease-out), background 0.3s, border-color 0.3s, box-shadow 0.3s;
}
.section--dark .signal:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255, 216, 107, 0.25);
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(0,0,0,0.35);
}
.section--dark .signal h3 { color: white; }
.section--dark .signal p { color: var(--text-inverse-muted); }
.section--dark .signal__number { color: rgba(255,255,255,0.4); }

/* ============================================================
   Diagnostic layers — alternating rows
   ============================================================ */
.diag-layers {
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.diag-layer {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 40px;
  align-items: center;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-lg);
  padding: 36px;
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out), border-color 0.3s, background 0.3s;
}
.diag-layer:hover {
  transform: translateY(-4px);
  background: rgba(255,255,255,0.05);
  border-color: rgba(255, 216, 107, 0.25);
  box-shadow: 0 20px 50px rgba(0,0,0,0.35);
}
.diag-layer--reverse { grid-template-columns: 1fr 200px; }
.diag-layer--reverse .diag-layer__icon { order: 2; }

.diag-layer__icon {
  width: 200px; height: 120px;
  background: linear-gradient(135deg, rgba(85,92,255,0.16), rgba(181,52,255,0.10));
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.diag-layer__icon svg { width: 100%; height: 100%; }

.diag-layer__tag {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: #FFD86B;
  font-weight: 600;
  margin-bottom: 10px;
}
.diag-layer h3 { font-size: 1.4rem; margin-bottom: 6px; color: white; }
.diag-layer__lead { color: rgba(255,255,255,0.92); font-weight: 600; margin-bottom: 8px; font-size: 1rem; }
.diag-layer p:not(.diag-layer__lead) { color: var(--text-inverse-muted); font-size: 0.98rem; line-height: 1.6; }

@media (max-width: 800px) {
  .diag-layer, .diag-layer--reverse { grid-template-columns: 1fr; gap: 20px; padding: 28px; }
  .diag-layer--reverse .diag-layer__icon { order: 0; }
  .diag-layer__icon { width: 100%; height: 110px; }
}

/* ============================================================
   Diagnostic mini-animations
   ============================================================ */
.diag-anim--candles rect { animation: candle-flicker 4s ease-in-out infinite; transform-origin: bottom; }
.diag-anim--candles rect:nth-child(1) { animation-delay: 0s; }
.diag-anim--candles rect:nth-child(3) { animation-delay: -0.4s; }
.diag-anim--candles rect:nth-child(5) { animation-delay: -0.8s; }
.diag-anim--candles rect:nth-child(7) { animation-delay: -1.2s; }
.diag-anim--candles rect:nth-child(9) { animation-delay: -1.6s; }
@keyframes candle-flicker { 0%,100% { opacity: 1; transform: scaleY(1); } 50% { opacity: 0.6; transform: scaleY(0.9); } }

.diag-anim--regime path { animation: regime-shift 6s ease-in-out infinite; }
.diag-anim--regime path:nth-child(2) { animation-delay: -1s; }
.diag-anim--regime path:nth-child(3) { animation-delay: -2s; }
@keyframes regime-shift { 0%,100% { stroke-dashoffset: 0; } 50% { stroke-dashoffset: 10; } }

.diag-anim--risk rect { animation: risk-pulse 3.5s ease-in-out infinite; transform-origin: bottom; }
.diag-anim--risk rect:nth-child(2) { animation-delay: -0.4s; }
.diag-anim--risk rect:nth-child(3) { animation-delay: -0.8s; }
@keyframes risk-pulse { 0%,100% { transform: scaleY(1); } 50% { transform: scaleY(0.85); } }

.diag-anim--shapes path:first-child { animation: shapes-trace 5s ease-in-out infinite; stroke-dasharray: 200; }
@keyframes shapes-trace { 0% { stroke-dashoffset: 200; } 60%, 100% { stroke-dashoffset: 0; } }

/* ============================================================
   Timeline demo (real-time intervention)
   ============================================================ */
.timeline-demo {
  max-width: 720px;
  margin: 0 auto;
}
.timeline-demo__messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 32px;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}
.tmsg {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 75%;
}
.tmsg--a {
  background: var(--bg-muted);
  align-self: flex-start;
  color: var(--text);
}
.tmsg--b {
  background: var(--gradient-brand);
  color: white;
  align-self: flex-end;
}
.tmsg--mediator {
  background: linear-gradient(135deg, #FFA94D 0%, #FFC532 50%, #FFD86B 100%);
  color: #2C1A00;
  align-self: center;
  max-width: 90%;
  border-radius: var(--radius-md);
  font-style: italic;
  position: relative;
  padding: 14px 18px 14px 18px;
  box-shadow: 0 6px 18px rgba(255, 169, 77, 0.18);
}
.tmsg__label {
  display: block;
  font-style: normal;
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
  color: #5C2A00;
}
.timeline-demo__caption {
  margin-top: 24px;
  text-align: center;
  font-size: 0.92rem;
  color: var(--text-muted);
}

/* ============================================================
   "Not X" grid (rules-first section)
   ============================================================ */
.not-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  max-width: 980px;
  margin: 60px auto 60px;
}
.not-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-inverse);
  border-radius: var(--radius-lg);
  padding: 28px;
  position: relative;
}
.not-card__x {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.18);
  color: #FCA5A5;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  margin-bottom: 14px;
  font-size: 0.9rem;
}
.not-card h3 { color: white; font-size: 1.05rem; margin-bottom: 6px; }
.not-card p { color: var(--text-inverse-muted); font-size: 0.92rem; }

@media (max-width: 700px) { .not-grid { grid-template-columns: 1fr; } }

.rigor-callout {
  max-width: 980px;
  margin: 0 auto;
  padding: 40px clamp(28px, 4vw, 48px);
  background: linear-gradient(135deg, rgba(85,92,255,0.18), rgba(181,52,255,0.10));
  border: 1px solid rgba(139, 145, 255, 0.3);
  border-radius: var(--radius-lg);
}
.rigor-callout h3 { color: white; font-size: 1.5rem; margin-bottom: 12px; }
.rigor-callout p { color: var(--text-inverse-muted); font-size: 1rem; line-height: 1.7; max-width: 760px; }

/* ============================================================
   Final CTA on labs page
   ============================================================ */
.labs-final { text-align: center; padding: 100px 0; position: relative; overflow: hidden; }
.labs-final__inner { max-width: 680px; margin: 0 auto; position: relative; z-index: 2; }
.labs-final__inner h2 { font-size: clamp(2.2rem, 5vw, 3.2rem); margin-bottom: 16px; }
.labs-final__inner p { color: rgba(255,255,255,0.85); font-size: 1.1rem; margin-bottom: 32px; }
.labs-final__duck {
  position: absolute;
  width: 80px;
  bottom: 10%;
  right: 10%;
  image-rendering: pixelated;
  animation: float-y 5s ease-in-out infinite;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,0.2));
  z-index: 1;
}
@media (max-width: 700px) { .labs-final__duck { display: none; } }
