/* ===== Interactive Diagram Viewer ===== */
/* Applies to any <svg> or <img> inside a .slide across all 3 decks */

.slide svg,
.slide img,
.slide .diagram > svg {
  cursor: zoom-in !important;
  transition: filter 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  border-radius: 8px;
}
.slide svg:hover,
.slide img:hover,
.slide .diagram > svg:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.45), 0 8px 24px rgba(0, 0, 0, 0.4);
  transform: translateY(-1px);
}

/* pulse hint on first load so users know diagrams are interactive */
@keyframes dv-hint-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0); }
  50%      { box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.35); }
}
.slide.active svg.dv-pulse,
.slide.active img.dv-pulse,
.slide.active .diagram > svg.dv-pulse {
  animation: dv-hint-pulse 1.6s ease-out 0.4s 2;
}

/* Overlay */
.diagram-viewer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 8, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: none;
  z-index: 99999;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  animation: dv-fade 0.22s ease-out;
}
.diagram-viewer-overlay.open { display: flex; }
@keyframes dv-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.dv-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  overflow: hidden;
  touch-action: none;
  position: relative;
}
.dv-stage:active { cursor: grabbing; }

.dv-stage-inner {
  transform-origin: center center;
  will-change: transform;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dv-stage-inner > svg,
.dv-stage-inner > img {
  max-width: 92vw;
  max-height: 80vh;
  width: auto;
  height: auto;
  background: #0a0a0a;
  border-radius: 10px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 30px 80px rgba(0, 0, 0, 0.7);
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

/* Toolbar */
.dv-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 16px 18px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.3));
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-wrap: wrap;
}
.dv-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fafafa;
  padding: 9px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  font-family: inherit;
  font-weight: 500;
  min-width: 42px;
  transition: all 0.13s ease;
  line-height: 1;
}
.dv-btn:hover {
  background: rgba(249, 115, 22, 0.14);
  border-color: #f97316;
  color: #f97316;
}
.dv-btn:active { transform: scale(0.96); }
.dv-btn.dv-close:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #ef4444;
}
.dv-counter {
  font-family: "SF Mono", "Geist Mono", Monaco, Consolas, monospace;
  color: #a1a1aa;
  font-size: 13px;
  min-width: 64px;
  text-align: center;
  letter-spacing: 0.02em;
}
.dv-sep {
  width: 1px;
  height: 26px;
  background: rgba(255, 255, 255, 0.1);
  margin: 0 6px;
}

/* Hint bubble */
.dv-hint {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  font-family: "SF Mono", "Geist Mono", Monaco, monospace;
  font-size: 11px;
  color: #d4d4d8;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 7px 14px;
  border-radius: 20px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  opacity: 0;
  animation: dv-hint-in 0.4s ease-out 0.25s forwards, dv-hint-out 0.6s ease-out 4s forwards;
}
@keyframes dv-hint-in {
  from { opacity: 0; transform: translate(-50%, -8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes dv-hint-out {
  to { opacity: 0; }
}

/* Mobile adjustments */
@media (max-width: 640px) {
  .dv-btn { padding: 8px 11px; min-width: 36px; font-size: 14px; }
  .dv-counter { font-size: 12px; min-width: 54px; }
  .dv-hint { font-size: 10px; top: 12px; padding: 5px 11px; }
  .dv-stage-inner > svg,
  .dv-stage-inner > img { max-width: 96vw; max-height: 72vh; }
}

/* Keyboard focus ring */
.dv-btn:focus-visible {
  outline: 2px solid #f97316;
  outline-offset: 2px;
}

/* ===== Deep-Dive Explanation Blocks ===== */
/* Added to every slide to expand physics context for non-physics students */
.deep-dive {
  background: linear-gradient(
    135deg,
    rgba(24, 95, 165, 0.08),
    rgba(15, 110, 86, 0.06)
  );
  border: 1px solid rgba(24, 95, 165, 0.35);
  border-left: 3px solid #3b82f6;
  border-radius: 8px;
  padding: 16px 20px;
  margin: 18px 0 14px;
  font-size: 14.5px;
  line-height: 1.68;
  color: #e5e7eb;
}
.deep-dive .deep-dive-label {
  display: inline-block;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: #60a5fa;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 3px 9px;
  border-radius: 12px;
  margin-bottom: 10px;
  font-family: "SF Mono", "Geist Mono", Monaco, Consolas, monospace;
}
.deep-dive p {
  margin: 8px 0 !important;
  font-size: 14.5px !important;
  color: #e5e7eb !important;
}
.deep-dive p:first-of-type { margin-top: 4px !important; }
.deep-dive p:last-child { margin-bottom: 2px !important; }
.deep-dive strong {
  color: #93c5fd;
  font-weight: 600;
}
.deep-dive em {
  color: #fbbf24;
  font-style: normal;
  font-weight: 500;
}
.deep-dive ul {
  margin: 8px 0 8px 20px !important;
  padding: 0 !important;
}
.deep-dive li {
  margin: 4px 0 !important;
  color: #e5e7eb !important;
}
.deep-dive code {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: "SF Mono", "Geist Mono", Monaco, Consolas, monospace;
  font-size: 13px;
  color: #fcd34d;
}

@media (max-width: 640px) {
  .deep-dive { padding: 14px 16px; font-size: 14px; }
  .deep-dive p { font-size: 14px !important; }
}
