/* =========================================================================
   StratoFoundry v2.0 — KARL Memory Explorer (3D interactive preview)
   ========================================================================= */

.memory-explorer-section {
  position: relative;
  background:
    radial-gradient(1200px 520px at 15% -10%, rgba(0, 69, 156, 0.35), transparent 60%),
    radial-gradient(900px 480px at 100% 110%, rgba(46, 125, 50, 0.16), transparent 60%),
    var(--sf-navy-950);
  color: var(--sf-mist-100);
  overflow: hidden;
}

.memory-explorer-section::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(180deg, rgba(184, 197, 209, 0.045) 0 1px, transparent 1px 46px);
  pointer-events: none;
  mask-image: linear-gradient(180deg, transparent, #000 25%, #000 75%, transparent);
}

.memory-explorer-section .container { position: relative; }

.memory-explorer-section .kicker { color: var(--sf-steel-400); }
.memory-explorer-section .h-section { color: var(--sf-white); margin: 0; }
.memory-explorer-section .text-gradient-strata {
  background: linear-gradient(90deg, #7FA1BE 0%, #8FD694 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.mx-head {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 32px 56px;
  align-items: end;
  margin-bottom: 40px;
}

.mx-intro {
  margin: 0;
  color: var(--sf-mist-300);
  font-size: 1.05rem;
  line-height: 1.65;
}

/* ---- Window shell ---------------------------------------------------- */
.mx-shell {
  border: 1px solid rgba(184, 197, 209, 0.18);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(34, 48, 63, 0.72), rgba(15, 23, 42, 0.86));
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
  backdrop-filter: blur(6px);
}

.mx-window-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border-bottom: 1px solid rgba(184, 197, 209, 0.12);
  background: rgba(15, 23, 42, 0.6);
  font-size: 0.78rem;
}

.mx-dots { display: inline-flex; gap: 6px; }
.mx-dots span {
  width: 10px; height: 10px; border-radius: 50%;
  background: rgba(184, 197, 209, 0.25);
}
.mx-dots span:first-child { background: var(--sf-terracotta-600); }
.mx-dots span:nth-child(2) { background: var(--sf-amber-500); }
.mx-dots span:last-child { background: var(--sf-verified-500); }

.mx-window-title { color: var(--sf-mist-300); letter-spacing: 0.02em; }

.mx-verified {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: rgba(46, 125, 50, 0.16);
  border: 1px solid rgba(76, 175, 80, 0.35);
  color: #8FD694;
  font-weight: 600;
}
.mx-verified::before {
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--sf-verified-500);
  box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.18);
}
.mx-verified { transition: background-color .3s ease, border-color .3s ease, color .3s ease; }
.mx-verified.is-alert {
  background: rgba(224, 87, 75, 0.16);
  border-color: rgba(224, 87, 75, 0.5);
  color: #FFB4AA;
}
.mx-verified.is-alert::before {
  background: #E0574B;
  box-shadow: 0 0 0 4px rgba(224, 87, 75, 0.22);
  animation: mx-alert-pulse 1s ease-in-out infinite;
}
@keyframes mx-alert-pulse { 50% { box-shadow: 0 0 0 7px rgba(224, 87, 75, 0.05); } }

/* ---- Scenario tabs ---------------------------------------------------- */
.mx-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 12px 0;
  border-bottom: 1px solid rgba(184, 197, 209, 0.12);
  background: rgba(15, 23, 42, 0.42);
  overflow-x: auto;
  scrollbar-width: none;
}
.mx-tab {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  padding: 10px 16px 11px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  background: transparent;
  color: var(--sf-mist-300);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: color .2s ease, background-color .2s ease;
}
.mx-tab:hover { color: #E8EEF4; background: rgba(184, 197, 209, 0.06); }
.mx-tab:focus-visible { outline: 2px solid var(--sf-amber-500); outline-offset: -2px; }
.mx-tab.is-active {
  color: #FFFFFF;
  background: rgba(34, 48, 63, 0.9);
  border-color: rgba(184, 197, 209, 0.16);
}
.mx-tab.is-active::after {
  content: "";
  position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2px;
  border-radius: 2px;
  background: var(--c-tab, #6FB7FF);
}
.mx-tab[data-mx-scenario="memory"] { --c-tab: #4CAF50; }
.mx-tab[data-mx-scenario="ransomware"] { --c-tab: #6FB7FF; }
.mx-tab[data-mx-scenario="evidence"] { --c-tab: #2EC4B6; }
.mx-tab-short { display: none; }
.mx-verified.is-pending {
  background: rgba(46, 196, 182, 0.12);
  border-color: rgba(46, 196, 182, 0.45);
  color: #9FE7DF;
}
.mx-verified.is-pending::before {
  background: transparent;
  border: 2px solid #2EC4B6;
  border-right-color: transparent;
  box-shadow: none;
  width: 8px; height: 8px;
  animation: mx-spin .9s linear infinite;
}
@keyframes mx-spin { to { transform: rotate(360deg); } }
.mx-cmd {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(184, 197, 209, 0.14);
  border-left: 2px solid var(--c, #2EC4B6);
  background: rgba(8, 13, 22, 0.75);
  color: #CFE9E5;
  font-size: 0.7rem;
  line-height: 1.55;
  white-space: pre;
  overflow-x: auto;
}
.mx-tab-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 22%, transparent);
}

.mx-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  min-height: 520px;
}

/* ---- Stage ----------------------------------------------------------- */
.mx-stage {
  position: relative;
  min-height: 520px;
}

.mx-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0 !important;
  cursor: grab;
  touch-action: pan-y;
  outline: none;
}
.mx-canvas.is-dragging { cursor: grabbing; }
.mx-canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--sf-cobalt-500); }

.mx-stage-overlay {
  position: absolute;
  top: 16px; left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.74rem;
  color: var(--sf-mist-300);
  pointer-events: none;
}
.mx-stage-overlay span:first-child { color: var(--sf-white); font-weight: 600; }

.mx-controls {
  position: absolute;
  top: 14px; right: 16px;
  display: flex;
  gap: 8px;
}

.mx-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(184, 197, 209, 0.25);
  background: rgba(15, 23, 42, 0.65);
  color: var(--sf-mist-100);
  font: 600 0.76rem/1 var(--font-sans);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.mx-btn:hover { background: rgba(0, 69, 156, 0.45); border-color: rgba(127, 161, 190, 0.6); }
.mx-btn:focus-visible { outline: 2px solid var(--sf-cobalt-500); outline-offset: 2px; }
.mx-btn[data-mx-action="play"]::before {
  content: "";
  width: 8px; height: 10px;
  border-left: 3px solid currentColor;
  border-right: 3px solid currentColor;
  box-sizing: border-box;
}
.mx-btn[data-mx-action="play"].is-paused::before {
  border-right: 0;
  border-left: 8px solid currentColor;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  width: 0; height: 0;
}

.mx-hint {
  position: absolute;
  left: 18px; right: 18px; bottom: 12px;
  margin: 0;
  font-size: 0.74rem;
  color: rgba(184, 197, 209, 0.7);
  pointer-events: none;
}

.mx-tooltip {
  position: absolute;
  transform: translate(-50%, -100%);
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: rgba(246, 242, 236, 0.97);
  color: var(--sf-navy-900);
  font-size: 0.78rem;
  box-shadow: var(--shadow-md);
  pointer-events: none;
  white-space: nowrap;
  z-index: 2;
}
.mx-tooltip .mono { font-size: 0.7rem; color: var(--sf-steel-600); }

/* ---- Side panel ------------------------------------------------------ */
.mx-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 22px 22px 18px;
  border-left: 1px solid rgba(184, 197, 209, 0.12);
  background: rgba(15, 23, 42, 0.45);
}

.mx-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 0.74rem;
  color: var(--sf-mist-300);
}
.mx-legend-item { display: inline-flex; align-items: center; gap: 7px; }
.mx-swatch { display: inline-block; width: 10px; height: 10px; background: var(--c); }
.mx-swatch.mx-circle { border-radius: 50%; }
.mx-swatch.mx-diamond { transform: rotate(45deg) scale(0.85); }

.mx-detail {
  flex: 1;
  padding: 18px;
  border-radius: var(--radius-md);
  background: rgba(34, 48, 63, 0.7);
  border: 1px solid rgba(184, 197, 209, 0.14);
  animation: mx-fade 0.35s ease;
}
.mx-detail-head { display: flex; align-items: center; gap: 10px; }
.mx-chip {
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--c) 22%, transparent);
  border: 1px solid var(--c);
  color: var(--sf-white);
  font: 700 0.72rem/1.4 var(--font-mono);
}
.mx-detail-date { font-size: 0.76rem; color: var(--sf-mist-300); }
.mx-detail-title {
  margin: 12px 0 14px;
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--sf-white);
}
.mx-facts { margin: 0; display: grid; gap: 10px; }
.mx-facts div { display: grid; gap: 2px; }
.mx-facts dt {
  font: 600 0.66rem/1.3 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sf-steel-400);
}
.mx-facts dd { margin: 0; font-size: 0.86rem; color: var(--sf-mist-100); line-height: 1.45; }
.mx-facts dd.mx-proof { color: #8FD694; }
.mx-facts dd.mx-proof.is-alert { color: #FFB4AA; }
.mx-note {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px dashed rgba(184, 197, 209, 0.2);
  font-size: 0.82rem;
  font-style: italic;
  color: var(--sf-mist-300);
  line-height: 1.5;
}
.mx-disclaimer { margin: 0; font-size: 0.7rem; color: rgba(184, 197, 209, 0.6); }

/* ---- Timeline -------------------------------------------------------- */
.mx-timeline {
  list-style: none;
  margin: 0;
  padding: 14px 18px 16px;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  border-top: 1px solid rgba(184, 197, 209, 0.12);
  background: rgba(15, 23, 42, 0.55);
  counter-reset: mx;
}
.mx-step {
  position: relative;
  width: 100%;
  display: grid;
  gap: 3px;
  padding: 10px 12px 10px 28px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(184, 197, 209, 0.12);
  background: transparent;
  color: var(--sf-mist-300);
  text-align: left;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.25s, background 0.25s, border-color 0.25s;
}
.mx-step:hover, .mx-step:focus-visible { opacity: 1; background: rgba(34, 48, 63, 0.7); outline: none; }
.mx-step.is-done { opacity: 0.9; }
.mx-step.is-selected {
  opacity: 1;
  background: color-mix(in srgb, var(--c) 14%, transparent);
  border-color: var(--c);
}
.mx-step-dot {
  position: absolute;
  left: 11px; top: 15px;
  width: 9px; height: 9px;
  background: var(--c);
  transform: rotate(45deg);
}
.mx-step-meta { font-size: 0.66rem; color: var(--sf-steel-400); }
.mx-step-title { font-size: 0.8rem; font-weight: 600; color: var(--sf-white); line-height: 1.3; }

.mx-failed .mx-canvas { display: none; }

@keyframes mx-fade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* ---- Responsive ------------------------------------------------------ */
@media (max-width: 1100px) {
  .mx-body { grid-template-columns: minmax(0, 1fr) 300px; }
  .mx-timeline { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .mx-head { grid-template-columns: 1fr; }
  .mx-body { grid-template-columns: 1fr; }
  .mx-stage, .mx-canvas { min-height: 420px; }
  .mx-panel { border-left: 0; border-top: 1px solid rgba(184, 197, 209, 0.12); }
}

@media (max-width: 640px) {
  .mx-window-bar { flex-wrap: wrap; }
  .mx-verified { margin-left: 0; }
  .mx-tabs { padding: 6px 8px 0; }
  .mx-tab { padding: 9px 8px 10px; font-size: 0.78rem; flex: 1 1 0; min-width: 0; justify-content: center; line-height: 1.25; white-space: nowrap; }
  .mx-tab-long { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .mx-tab-short { display: inline; }
  .mx-stage-overlay { left: 10px; right: 10px; top: 10px; padding: 7px 9px; font-size: 0.66rem; gap: 2px; border-radius: 8px; background: rgba(10, 16, 26, 0.72); backdrop-filter: blur(3px); }
  .mx-controls { top: auto; bottom: 14px; }
  .mx-stage, .mx-canvas { min-height: 440px; }
  .mx-timeline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mx-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .mx-detail { animation: none; }
  .mx-verified.is-alert::before { animation: none; }
  .mx-verified.is-pending::before { animation: none; }
}
