/**
 * Binary Memory Explorer — buffer segmentleri · küp MRI · Three.js r170
 */

.doc-gltf-binary-memory {
  --gbm-cyan: #3db8c4;
  --gbm-blue: #6a9ec4;
  --gbm-violet: #9a7ec8;
  --gbm-amber: #c4a04a;
  --gbm-border: rgba(255, 255, 255, 0.08);
  --gbm-surface: rgba(255, 255, 255, 0.025);

  margin: 1rem 0 1.25rem;
  padding: 0.95rem 0.95rem 1.05rem;
  border-radius: 12px;
  border: 1px solid var(--gbm-border);
  background: linear-gradient(180deg, #080b12 0%, #0a0e16 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.doc-gltf-binary-memory__hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem 0.75rem;
  margin-bottom: 0.8rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--gbm-border);
}

.doc-gltf-binary-memory__tag {
  display: inline-flex;
  padding: 0.16rem 0.48rem;
  border-radius: 4px;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gbm-amber);
  background: rgba(196, 160, 74, 0.08);
  border: 1px solid rgba(196, 160, 74, 0.2);
}

.doc-gltf-binary-memory__hint {
  margin: 0;
  font-size: 0.8rem;
  color: rgba(160, 172, 190, 0.82);
}

.doc-gltf-binary-memory__grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 0.75rem;
  align-items: stretch;
}

.doc-gltf-binary-memory__col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-radius: 10px;
  border: 1px solid var(--gbm-border);
  background: var(--gbm-surface);
  overflow: hidden;
}

.doc-gltf-binary-memory__col-title {
  margin: 0;
  padding: 0.52rem 0.62rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(160, 172, 190, 0.85);
  border-bottom: 1px solid var(--gbm-border);
  background: rgba(0, 0, 0, 0.2);
}

.doc-gltf-binary-memory__segments {
  flex: 1;
  padding: 0.65rem 0.6rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.doc-gltf-binary-memory__seg {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  padding: 0.42rem 0.48rem;
  border-radius: 8px;
  border: 1px solid var(--gbm-border);
  background: rgba(0, 0, 0, 0.22);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.doc-gltf-binary-memory__seg:hover,
.doc-gltf-binary-memory__seg.is-active {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.35);
}

.doc-gltf-binary-memory__seg.is-active {
  outline: 1px solid rgba(255, 255, 255, 0.06);
}

.doc-gltf-binary-memory__seg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.doc-gltf-binary-memory__seg-label {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(210, 218, 230, 0.92);
}

.doc-gltf-binary-memory__seg-range {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.64rem;
  color: rgba(160, 172, 190, 0.7);
}

.doc-gltf-binary-memory__bar {
  height: 0.42rem;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.doc-gltf-binary-memory__bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  transition: width 0.25s ease;
}

.doc-gltf-binary-memory__seg--position .doc-gltf-binary-memory__bar-fill {
  background: var(--gbm-cyan);
}

.doc-gltf-binary-memory__seg--normal .doc-gltf-binary-memory__bar-fill {
  background: var(--gbm-blue);
}

.doc-gltf-binary-memory__seg--uv .doc-gltf-binary-memory__bar-fill {
  background: var(--gbm-violet);
}

.doc-gltf-binary-memory__seg--indices .doc-gltf-binary-memory__bar-fill {
  background: var(--gbm-amber);
}

.doc-gltf-binary-memory__pool {
  margin-top: 0.55rem;
  padding: 0.55rem 0.6rem 0.6rem;
  border-top: 1px solid var(--gbm-border);
}

.doc-gltf-binary-memory__pool-label {
  margin: 0 0 0.4rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(160, 172, 190, 0.75);
}

.doc-gltf-binary-memory__pool-strip {
  display: flex;
  height: 1.1rem;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid var(--gbm-border);
  background: rgba(0, 0, 0, 0.35);
}

.doc-gltf-binary-memory__pool-chunk {
  flex: 0 0 auto;
  height: 100%;
  opacity: 0.45;
  transition: opacity 0.2s ease, filter 0.2s ease;
}

.doc-gltf-binary-memory__pool-chunk.is-lit {
  opacity: 1;
  filter: brightness(1.15);
}

.doc-gltf-binary-memory__pool-chunk--position {
  background: var(--gbm-cyan);
}

.doc-gltf-binary-memory__pool-chunk--normal {
  background: var(--gbm-blue);
}

.doc-gltf-binary-memory__pool-chunk--uv {
  background: var(--gbm-violet);
}

.doc-gltf-binary-memory__pool-chunk--indices {
  background: var(--gbm-amber);
}

.doc-gltf-binary-memory__pool-meta {
  margin: 0.35rem 0 0;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.66rem;
  color: rgba(160, 172, 190, 0.72);
}

.doc-gltf-binary-memory__explainer {
  margin: 0;
  padding: 0.5rem 0.6rem 0.55rem;
  font-size: 0.8rem;
  line-height: 1.5;
  color: rgba(185, 195, 210, 0.88);
  border-top: 1px solid var(--gbm-border);
  min-height: 3.2rem;
}

.doc-gltf-binary-memory__col--scene {
  min-height: 100%;
}

.doc-gltf-binary-memory__scene-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 320px;
  touch-action: pan-y;
}

.doc-gltf-binary-memory__scene-wrap [data-gbm-mount] {
  width: 100%;
  height: 100%;
  min-height: 320px;
  touch-action: inherit;
  user-select: none;
  -webkit-user-select: none;
}

.doc-gltf-binary-memory__mount {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 320px;
}

.doc-gltf-binary-memory__scene-hud {
  position: absolute;
  left: 0.5rem;
  bottom: 0.5rem;
  right: 0.5rem;
  padding: 0.35rem 0.48rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(210, 218, 230, 0.9);
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid var(--gbm-border);
  pointer-events: none;
}

.doc-gltf-binary-memory__mri {
  display: flex;
  flex-wrap: wrap;
  gap: 0.32rem;
  padding: 0.5rem 0.55rem 0.55rem;
  border-top: 1px solid var(--gbm-border);
}

.doc-gltf-binary-memory__mri-btn {
  padding: 0.28rem 0.48rem;
  border-radius: 5px;
  border: 1px solid var(--gbm-border);
  background: rgba(0, 0, 0, 0.25);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.66rem;
  font-weight: 500;
  color: rgba(170, 182, 200, 0.85);
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease;
}

.doc-gltf-binary-memory__mri-btn:hover,
.doc-gltf-binary-memory__mri-btn.is-active {
  border-color: rgba(255, 255, 255, 0.14);
  color: rgba(220, 228, 240, 0.95);
}

.doc-gltf-binary-memory__caption {
  margin: 0.75rem 0 0;
  font-size: 0.84rem;
  line-height: 1.55;
  color: rgba(165, 178, 198, 0.88);
}

.doc-gltf-binary-memory__scene-engage {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem;
  border-radius: 0 0 10px 10px;
  background: linear-gradient(
    180deg,
    rgba(4, 8, 16, 0.35) 0%,
    rgba(4, 8, 16, 0.78) 45%,
    rgba(4, 8, 16, 0.92) 100%
  );
  pointer-events: auto;
}

.doc-gltf-binary-memory.is-touch-gated .doc-gltf-binary-memory__scene-engage {
  display: flex;
}

.doc-gltf-binary-memory.is-touch-gated.is-orbit-engaged .doc-gltf-binary-memory__scene-engage {
  display: none;
}

.doc-gltf-binary-memory.is-orbit-engaged .doc-gltf-binary-memory__scene-wrap {
  touch-action: none;
}

.doc-gltf-binary-memory__engage-btn {
  padding: 0.45rem 0.85rem;
  border-radius: 7px;
  border: 1px solid rgba(61, 184, 196, 0.35);
  background: rgba(61, 184, 196, 0.1);
  color: rgba(210, 228, 240, 0.95);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.doc-gltf-binary-memory__engage-note {
  margin: 0;
  font-size: 0.7rem;
  color: rgba(150, 165, 185, 0.8);
  text-align: center;
}

.doc-gltf-binary-memory__engage-exit {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  z-index: 3;
  padding: 0.28rem 0.5rem;
  border-radius: 5px;
  border: 1px solid var(--gbm-border);
  background: rgba(0, 0, 0, 0.6);
  color: rgba(200, 210, 225, 0.9);
  font-size: 0.68rem;
  cursor: pointer;
}

.doc-gltf-binary-memory.is-touch-gated:not(.is-orbit-engaged) .doc-gltf-binary-memory__mount {
  pointer-events: none;
}

@media (max-width: 900px) {
  .doc-gltf-binary-memory__grid {
    grid-template-columns: 1fr;
  }

  .doc-gltf-binary-memory__scene-wrap,
  .doc-gltf-binary-memory__scene-wrap [data-gbm-mount],
  .doc-gltf-binary-memory__mount {
    min-height: min(52vh, 400px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .doc-gltf-binary-memory__bar-fill,
  .doc-gltf-binary-memory__pool-chunk,
  .doc-gltf-binary-memory__seg {
    transition: none;
  }
}
