/* Algorithms & Data Systems — full-bleed black, no boxed lab; sticky parallax must not sit inside overflow:hidden */

body.subpage-tech.algo-page {
  background: #000;
}

body.algo-page {
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "SF Pro Text",
    "SF Pro Display",
    "Segoe UI",
    "Helvetica Neue",
    Helvetica,
    Arial,
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: #000;
}

body.algo-page #algoPageRoot {
  background: #000;
}

/* Hero — black (no light margins) */
body.algo-page .tech-hero {
  background: #000;
  color: rgba(255, 255, 255, 0.92);
}

body.algo-page .tech-hero-kicker {
  color: var(--accent-light);
}

body.algo-page .tech-hero-title {
  color: #fff;
}

body.algo-page .tech-hero-lead {
  color: rgba(255, 255, 255, 0.62);
}

body.algo-page .tech-hero-note {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.78);
}

body.algo-page .subpage-back {
  color: var(--accent-light);
  font-weight: 500;
}

body.algo-page .subpage-back:hover {
  color: #fff;
  text-decoration: underline;
}

/* Parallax band — full width, no max-width card, no side gutters */
body.algo-page .tech-rsl-outer.algo-parallax-band {
  background: #000;
  padding: 0;
  margin: 0;
}

/* Scroll runway: (min-height − 100vh) = distance for --algo-x: 0→1; +1px avoids rounding stalls */
#algoParallaxSection.algo-parallax-section {
  --algo-x: 0;
  position: relative;
  min-height: calc(280vh + 1px);
}

.algo-parallax-pin {
  position: sticky;
  top: 0;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-top: min(5vh, 40px);
  padding-bottom: 52px;
  box-sizing: border-box;
  background: #000;
}

.algo-mega {
  text-align: center;
  margin: 0 auto 10px;
  padding: 0 16px;
  flex-shrink: 0;
}

.algo-mega-big {
  display: block;
  font-size: clamp(28px, 6vw, 56px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  background: linear-gradient(90deg, #64d2ff 0%, var(--accent) 42%, #a1c4fd 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.algo-mega-sub {
  display: block;
  margin-top: 4px;
  font-size: clamp(18px, 3.2vw, 28px);
  font-weight: 600;
  font-style: italic;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.02em;
}

.algo-track-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 100vw;
  margin: 0 auto;
  overflow: hidden;
}

.algo-track {
  display: flex;
  width: 300vw;
  height: min(58vh, 560px);
  transform: translateX(calc(var(--algo-x) * -200vw));
  will-change: transform;
}

.algo-stage {
  width: 100vw;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 clamp(12px, 3vw, 28px);
  box-sizing: border-box;
}

.algo-stage-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  margin-bottom: 12px;
}

.algo-stage-cap {
  margin-top: 14px;
  max-width: 40ch;
  text-align: center;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.48);
}

.algo-chaos-root {
  position: relative;
  width: min(96vw, 1120px);
  height: min(48vh, 520px);
  margin: 0 auto;
}

.algo-chaos-bit {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 1px;
}

.algo-chaos-bit--p {
  background: var(--accent);
}
.algo-chaos-bit--b {
  background: var(--accent-light);
}
.algo-chaos-bit--y {
  background: #d1d1d6;
}

.algo-grid {
  display: grid;
  grid-template-columns: repeat(18, 1fr);
  gap: 3px;
  width: min(96vw, 1120px);
  margin: 0 auto;
  aspect-ratio: 18 / 4;
}

.algo-cell {
  border-radius: 1px;
  min-height: 0;
}

.algo-cell--p {
  background: var(--accent);
}
.algo-cell--b {
  background: var(--accent-light);
}
.algo-cell--y {
  background: #d1d1d6;
}

.algo-scroll-hint {
  position: absolute;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
  pointer-events: none;
  opacity: clamp(0.15, calc(1 - var(--algo-x) * 2.2), 1);
}

.algo-scroll-hint span:last-child {
  font-size: 18px;
  animation: algo-bob 1.4s ease-in-out infinite;
}

@keyframes algo-bob {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  50% {
    transform: translateY(6px);
    opacity: 1;
  }
}

/* Outro — same black stream as page */
.algo-outro {
  position: relative;
  z-index: 0;
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 24px 80px;
  background: #000;
}

.algo-outro h2 {
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.algo-outro p {
  font-size: 16px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.55);
  max-width: 62ch;
  margin-bottom: 22px;
}

.algo-outro a {
  display: inline-flex;
  align-items: center;
  padding: 12px 22px;
  border-radius: 12px;
  background: #fff;
  color: #000;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
}

.algo-outro a:hover {
  background: #e8e8ed;
}

@media (max-width: 600px) {
  .algo-grid {
    gap: 2px;
  }

  .algo-chaos-bit {
    width: 8px;
    height: 8px;
  }

  #algoParallaxSection.algo-parallax-section {
    min-height: calc(255vh + 1px);
  }
}
