/* Holodepth — Interleaved vs sequential grid demo */

figure.doc-ilv-demo + .doc-h3 {
  margin-top: 1.35rem;
}

figure.doc-ilv-demo {
  margin-block: 1.1rem 0;
  margin-inline: 0;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}

.doc-ilv-demo {
  border-radius: var(--radius, 14px);
  border: 1px solid rgba(94, 200, 255, 0.16);
  background: linear-gradient(
    165deg,
    rgba(10, 12, 22, 0.98) 0%,
    rgba(4, 6, 14, 0.99) 100%
  );
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.45) inset,
    0 16px 40px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.doc-ilv-demo__hud {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.7rem 0.9rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(4, 6, 12, 0.72);
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 0.78rem;
}

.doc-ilv-demo__hud-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.doc-ilv-demo__tag {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(140, 200, 255, 0.88);
}

.doc-ilv-demo__metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.55rem;
  justify-content: flex-end;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono, "JetBrains Mono", ui-monospace, monospace);
  font-size: 0.64rem;
  line-height: 1.35;
  color: rgba(175, 210, 245, 0.92);
  text-align: right;
}

.doc-ilv-demo__metric {
  padding: 0.32rem 0.5rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.28);
}

.doc-ilv-demo__metric strong {
  font-weight: 600;
  color: rgba(120, 220, 255, 0.98);
}

.doc-ilv-demo__metric--fetch {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  flex-wrap: nowrap;
}

.doc-ilv-demo__fetch {
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.doc-ilv-demo__fetch-arrow {
  opacity: 0.55;
  font-weight: 600;
  user-select: none;
}

.doc-ilv-demo[data-ilv-layout="sequential"] .doc-ilv-demo__fetch--right {
  opacity: 0.38;
  font-weight: 500;
}

.doc-ilv-demo[data-ilv-layout="interleaved"] .doc-ilv-demo__fetch--left {
  opacity: 0.38;
  font-weight: 500;
}

.doc-ilv-demo[data-ilv-layout="sequential"] .doc-ilv-demo__fetch--left {
  color: rgba(150, 230, 255, 0.98);
  text-shadow: 0 0 10px rgba(46, 200, 255, 0.35);
}

.doc-ilv-demo[data-ilv-layout="interleaved"] .doc-ilv-demo__fetch--right {
  color: rgba(200, 255, 220, 0.98);
  text-shadow: 0 0 10px rgba(80, 255, 180, 0.35);
}

.doc-ilv-demo__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
}

.doc-ilv-demo__seg {
  display: inline-flex;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.25);
  padding: 3px;
  gap: 2px;
}

.doc-ilv-demo__seg-btn {
  appearance: none;
  border: 0;
  margin: 0;
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.55);
  background: transparent;
  transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.doc-ilv-demo__seg-btn:hover {
  color: rgba(255, 255, 255, 0.88);
}

.doc-ilv-demo__seg-btn[aria-pressed="true"] {
  color: #0b1020;
  background: linear-gradient(135deg, #5ec8ff 0%, #b56cff 100%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12) inset;
}

.doc-ilv-demo__checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  align-items: center;
  font-size: 0.72rem;
  color: rgba(220, 230, 250, 0.88);
}

.doc-ilv-demo__checks label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  user-select: none;
}

.doc-ilv-demo__checks input {
  accent-color: #5ec8ff;
}

.doc-ilv-demo__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
  align-items: center;
  font-size: 0.65rem;
  color: rgba(200, 215, 245, 0.85);
}

.doc-ilv-demo__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.doc-ilv-demo__swatch {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.doc-ilv-demo__swatch--pos {
  background: linear-gradient(135deg, #3d7cff, #5ec8ff);
}

.doc-ilv-demo__swatch--uv {
  background: linear-gradient(135deg, #ffd24a, #ff9f1a);
}

.doc-ilv-demo__swatch--nrm {
  background: linear-gradient(135deg, #3ddc84, #2ee7a8);
}

.doc-ilv-demo__strip-wrap {
  margin-top: 0.35rem;
}

.doc-ilv-demo__strip-label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgba(130, 175, 220, 0.75);
  margin-bottom: 0.35rem;
}

.doc-ilv-demo__strip {
  position: relative;
  min-height: 1.35rem;
  height: 1.35rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.35);
}

.doc-ilv-demo__strip-pane {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.doc-ilv-demo__strip-inner {
  display: flex;
  flex-direction: row;
  height: 100%;
  width: 200%;
  will-change: transform;
}

.doc-ilv-demo__strip-seq-unit {
  display: flex;
  flex: 0 0 50%;
  width: 50%;
  height: 100%;
  box-sizing: border-box;
}

.doc-ilv-demo__strip--seq .doc-ilv-demo__strip-pane--seq .doc-ilv-demo__strip-inner {
  animation: doc-ilv-seq-pan 4.5s steps(3, end) infinite;
}

.doc-ilv-demo__strip--ilv .doc-ilv-demo__strip-pane--ilv .doc-ilv-demo__strip-inner {
  animation: doc-ilv-ilv-pan 2.8s linear infinite;
}

@keyframes doc-ilv-seq-pan {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

@keyframes doc-ilv-ilv-pan {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

.doc-ilv-demo__strip-chunk {
  height: 100%;
  min-width: 0;
}

.doc-ilv-demo__strip-chunk--seq-pos {
  flex: 3 1 0;
  background: linear-gradient(90deg, rgba(61, 124, 255, 0.55), rgba(94, 200, 255, 0.45));
}

.doc-ilv-demo__strip-chunk--seq-uv {
  flex: 2 1 0;
  background: linear-gradient(90deg, rgba(255, 178, 74, 0.55), rgba(255, 159, 26, 0.45));
}

.doc-ilv-demo__strip-chunk--seq-nrm {
  flex: 3 1 0;
  background: linear-gradient(90deg, rgba(61, 220, 132, 0.55), rgba(46, 231, 168, 0.45));
}

.doc-ilv-demo__strip-pack {
  display: flex;
  flex-direction: row;
  width: 100%;
  height: 100%;
}

.doc-ilv-demo__strip-cell {
  height: 100%;
  flex: 1 1 0;
}

.doc-ilv-demo__strip-cell--p {
  background: rgba(61, 124, 255, 0.55);
}

.doc-ilv-demo__strip-cell--uv {
  background: rgba(255, 178, 74, 0.55);
}

.doc-ilv-demo__strip-cell--n {
  background: rgba(61, 220, 132, 0.55);
}

.doc-ilv-demo__strip-pointer {
  position: absolute;
  top: 50%;
  left: 0;
  z-index: 3;
  transform: translate(-50%, -50%);
  pointer-events: none;
  filter: drop-shadow(0 0 6px rgba(120, 220, 255, 0.75));
}

.doc-ilv-demo__strip-arrow {
  display: block;
  font-size: 0.78rem;
  line-height: 1;
  color: #f2fbff;
  text-shadow:
    0 0 8px rgba(46, 200, 255, 0.9),
    0 0 14px rgba(120, 220, 255, 0.55);
}

/* Sequential: ok zıplar + yön tersler (cache miss / atlama hissi) */
.doc-ilv-demo__strip--seq .doc-ilv-demo__strip-pointer {
  animation: doc-ilv-pointer-seq 3.8s steps(4, end) infinite;
}

/* Interleaved: düz akış (memory locality) */
.doc-ilv-demo__strip--ilv .doc-ilv-demo__strip-pointer {
  animation: doc-ilv-pointer-ilv 2.6s linear infinite;
}

.doc-ilv-demo__strip-pane[hidden] {
  display: none !important;
}

@keyframes doc-ilv-pointer-seq {
  0% {
    left: 10%;
    transform: translate(-50%, -50%) scaleX(1);
  }
  25% {
    left: 42%;
    transform: translate(-50%, -50%) scaleX(-1);
  }
  50% {
    left: 78%;
    transform: translate(-50%, -50%) scaleX(1);
  }
  75% {
    left: 42%;
    transform: translate(-50%, -50%) scaleX(-1);
  }
  100% {
    left: 10%;
    transform: translate(-50%, -50%) scaleX(1);
  }
}

@keyframes doc-ilv-pointer-ilv {
  0% {
    left: 3%;
    transform: translate(-50%, -50%) scaleX(1);
  }
  100% {
    left: 97%;
    transform: translate(-50%, -50%) scaleX(1);
  }
}

.doc-ilv-demo__viewport-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: min(68vh, 480px);
  background: radial-gradient(ellipse at 50% 40%, rgba(28, 48, 78, 0.4), rgba(4, 6, 12, 0.96));
}

.doc-ilv-demo__viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.doc-ilv-demo__viewport canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.doc-ilv-demo__caption {
  margin: 0;
  padding: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(0, 0, 0, 0.18);
}

.doc-ilv-demo__caption .doc-demo-cap {
  padding: 0.75rem 0.9rem 0.95rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: rgba(210, 220, 245, 0.84);
}

@media (max-width: 560px) {
  .doc-ilv-demo__metrics {
    justify-content: flex-start;
    text-align: left;
  }
}
