/* manifold_isomap.css - Isomap explainer player */
.ui.manifold .mf-isomap.container { max-width: 1100px; }
.ui.manifold .mfi-player { display: flex; flex-direction: column; }
.ui.manifold .mfi-fs-wrap { display: flex; flex-direction: column; gap: 12px; }
.ui.manifold .mfi-fs-wrap > .mfi-transcript { margin-top: 4px; }

/* Stage: the video plus its overlaid controls share one positioned box so the
   control bar floats inside the frame (in-video controls). */
.ui.manifold .mfi-stage {
  position: relative; line-height: 0; background: #000;
  border-radius: var(--radius-md); overflow: hidden;
  border: 1px solid var(--hairline);
}
.ui.manifold .mfi-video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; }

/* Center play affordance, shown only while paused. */
.ui.manifold .mfi-bigplay {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 72px; height: 72px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; background: rgba(18, 18, 18, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.28);
  /* Decorative only: taps pass through to the video so a press never splits
     between the button (pointerdown) and the frame (pointerup), which would
     send the click to their common ancestor and start nothing. */
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.ui.manifold .mfi-bigplay::before {
  content: ""; width: 0; height: 0;
  border-style: solid; border-width: 13px 0 13px 22px;
  border-color: transparent transparent transparent currentColor;
  /* The triangle's visual mass sits left of its box, so nudge it right to sit
     centered in the circle. */
  margin-left: 4px;
}
.ui.manifold .mfi-bigplay:hover { background: rgba(40, 40, 40, 0.7); }
/* Fade out in place when playback starts (no scale/translate, so it does not
   drift down or sideways while disappearing). */
.ui.manifold .mfi-stage.is-playing .mfi-bigplay {
  opacity: 0; pointer-events: none;
}

/* Bottom control bar with a gradient scrim for legibility over any frame. */
.ui.manifold .mfi-overlay {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; gap: 4px;
  padding: 6px 12px 8px; line-height: normal;
  background: linear-gradient(to top,
    rgba(0, 0, 0, 0.82) 0%, rgba(0, 0, 0, 0.42) 55%, rgba(0, 0, 0, 0) 100%);
  opacity: 1; transition: opacity 0.25s ease;
}
.ui.manifold .mfi-stage.is-hidden-ui .mfi-overlay { opacity: 0; pointer-events: none; }

/* Progress bar: a track with a filled portion, a draggable thumb (::after),
   and section-boundary stamps from the step timeline. */
.ui.manifold .mfi-progress {
  position: relative; padding: 9px 0; cursor: pointer; touch-action: none;
  --mfi-thumb: 0%;
}
.ui.manifold .mfi-progress:focus-visible { outline: none; }
.ui.manifold .mfi-progress-track {
  position: relative; height: 5px; border-radius: 3px;
  background: rgba(255, 255, 255, 0.26);
}
.ui.manifold .mfi-progress-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0;
  border-radius: 3px; background: var(--accent);
}
.ui.manifold .mfi-progress-marks { position: absolute; inset: 0; pointer-events: none; }
.ui.manifold .mfi-progress-mark {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  width: 2px; height: 11px; border-radius: 1px;
  background: rgba(255, 255, 255, 0.9); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
}
.ui.manifold .mfi-progress::after {
  content: ''; position: absolute; top: 50%; left: var(--mfi-thumb);
  width: 13px; height: 13px; border-radius: 50%; background: #fff;
  transform: translate(-50%, -50%); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
  opacity: 0; transition: opacity 0.15s ease;
}
.ui.manifold .mfi-progress:hover::after,
.ui.manifold .mfi-progress:focus-visible::after { opacity: 1; }

.ui.manifold .mfi-controls { display: flex; align-items: center; gap: 4px; }
.ui.manifold .mfi-ctrl {
  font: inherit; color: #fff; background: transparent; border: none;
  cursor: pointer; padding: 4px 6px; border-radius: 6px; line-height: 1;
}
.ui.manifold .mfi-ctrl:hover { background: rgba(255, 255, 255, 0.16); }
.ui.manifold .mfi-ctrl:focus-visible { outline: var(--focus-ring); outline-offset: 1px; }
.ui.manifold .mfi-ctrl-icon {
  min-width: 32px; min-height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
}

/* Control glyphs are drawn in CSS (shapes / masked SVG) rather than unicode
   symbols, which iOS renders as color emoji. currentColor keeps them in sync
   with the button's text color and hover state. */
.ui.manifold .mfi-ico-playpause { gap: 3px; }
.ui.manifold .mfi-ico-playpause::before {
  content: ""; width: 0; height: 0;
  border-style: solid; border-width: 7px 0 7px 12px;
  border-color: transparent transparent transparent currentColor;
}
.ui.manifold .mfi-ico-playpause::after { content: ""; display: none; }
.ui.manifold .mfi-stage.is-playing .mfi-ico-playpause::before,
.ui.manifold .mfi-stage.is-playing .mfi-ico-playpause::after {
  display: block; width: 4px; height: 15px; border: 0; background: currentColor;
}

.ui.manifold .mfi-ico-prev { gap: 2px; }
.ui.manifold .mfi-ico-prev::before { content: ""; width: 2.5px; height: 13px; background: currentColor; }
.ui.manifold .mfi-ico-prev::after {
  content: ""; width: 0; height: 0; border-style: solid;
  border-width: 6.5px 10px 6.5px 0; border-color: transparent currentColor transparent transparent;
}
.ui.manifold .mfi-ico-next { gap: 2px; }
.ui.manifold .mfi-ico-next::before {
  content: ""; width: 0; height: 0; border-style: solid;
  border-width: 6.5px 0 6.5px 10px; border-color: transparent transparent transparent currentColor;
}
.ui.manifold .mfi-ico-next::after { content: ""; width: 2.5px; height: 13px; background: currentColor; }

.ui.manifold .mfi-ico-full {
  --mfi-full-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z'/%3E%3C/svg%3E");
}
.ui.manifold .mfi-ico-full.is-fs {
  --mfi-full-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z'/%3E%3C/svg%3E");
}
.ui.manifold .mfi-ico-full::before {
  content: ""; width: 17px; height: 17px; background: currentColor;
  -webkit-mask: var(--mfi-full-mask) center / contain no-repeat;
          mask: var(--mfi-full-mask) center / contain no-repeat;
}
.ui.manifold .mfi-time {
  color: rgba(255, 255, 255, 0.85); font-size: 0.82rem;
  font-variant-numeric: tabular-nums; white-space: nowrap; margin-left: 4px;
}
.ui.manifold .mfi-controls-spacer { flex: 1; }
.ui.manifold .mfi-speed-label {
  display: flex; align-items: center; gap: 6px;
  color: rgba(255, 255, 255, 0.82); font-size: 0.8rem; white-space: nowrap;
}
.ui.manifold .mfi-speed {
  font: inherit; font-size: 0.8rem; padding: 3px 6px; border-radius: 6px;
  border: 1px solid var(--hairline-strong); background: rgba(0, 0, 0, 0.45);
  color: #fff; cursor: pointer;
}

/* Native fullscreen: the video fills the screen; scrolling down reveals the transcript directly
   beneath it (sized to its content, so the scroll stops at the end with no over-scroll). The
   scrollbar is hidden and the swipe-down hint is dropped; only the steps and dataset note are
   removed in fullscreen. */
.ui.manifold .mfi-fs-wrap:fullscreen,
.ui.manifold .mfi-fs-wrap:-webkit-full-screen {
  width: 100vw; height: 100vh; gap: 0; background: #000;
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none;
}
.ui.manifold .mfi-fs-wrap:fullscreen::-webkit-scrollbar,
.ui.manifold .mfi-fs-wrap:-webkit-full-screen::-webkit-scrollbar { display: none; }
.ui.manifold .mfi-fs-wrap:fullscreen .mfi-stage,
.ui.manifold .mfi-fs-wrap:-webkit-full-screen .mfi-stage {
  flex: none; width: 100vw; height: 100vh; border: none; border-radius: 0;
}
.ui.manifold .mfi-fs-wrap:fullscreen .mfi-video,
.ui.manifold .mfi-fs-wrap:-webkit-full-screen .mfi-video {
  width: 100%; height: 100%; aspect-ratio: auto; object-fit: contain;
}
.ui.manifold .mfi-fs-wrap:fullscreen .mfi-steps,
.ui.manifold .mfi-fs-wrap:fullscreen .mfi-datasetnote,
.ui.manifold .mfi-fs-wrap:-webkit-full-screen .mfi-steps,
.ui.manifold .mfi-fs-wrap:-webkit-full-screen .mfi-datasetnote { display: none; }
.ui.manifold .mfi-fs-wrap:fullscreen .mfi-transcript,
.ui.manifold .mfi-fs-wrap:-webkit-full-screen .mfi-transcript {
  flex: none; margin: 0; border-radius: 0; padding: 6vh max(20px, 3vw) 8vh; background: #0c0c0c;
}
/* let the explanation paragraph use the full fullscreen width (the archetype caps p at 82ch) */
.ui.manifold .mfi-fs-wrap:fullscreen .mfi-transcript .mfi-explain,
.ui.manifold .mfi-fs-wrap:-webkit-full-screen .mfi-transcript .mfi-explain { max-width: none; }
.ui.manifold .mfi-fs-hint { display: none; }

.ui.manifold .mfi-steps { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.ui.manifold .mfi-steps li {
  padding: 6px 10px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--hairline); color: var(--text-muted); font-size: 0.9rem;
}
.ui.manifold .mfi-steps li.is-active {
  background: var(--accent-muted); color: #fff;
  box-shadow: inset 0 -2px 0 var(--accent);
}
.ui.manifold .mfi-transcript { margin-top: 16px; padding: 14px 16px;
  background: var(--surface); border-radius: var(--radius-md); line-height: 1.6; }
.ui.manifold .mfi-transcript .mfi-caption { color: var(--text); font-size: 1.04rem; }
.ui.manifold .mfi-transcript .mfi-formula { margin-top: 6px; color: var(--text-muted); }
.ui.manifold .mfi-transcript .mfi-explain { margin: 10px 0 0; color: var(--text-muted); }
.ui.manifold .mfi-tryit { margin-top: 14px; color: var(--text-muted); }
.ui.manifold .mfi-intro { margin: 0 0 14px; color: var(--text-muted); }
.ui.manifold .mfi-pickers { display: flex; flex-wrap: wrap; gap: 16px; margin: 0 0 14px; }
.ui.manifold .mfi-pick { display: flex; flex-direction: column; gap: 4px;
  color: var(--text-muted); font-size: 0.85rem; }
.ui.manifold .mfi-pick-sel { font: inherit; padding: 7px 10px; min-width: 160px;
  border-radius: var(--radius-sm); border: 1px solid var(--hairline-strong);
  background: rgba(255, 255, 255, 0.05); color: var(--text); cursor: pointer; }
.ui.manifold .mfi-pick-sel:disabled { opacity: 0.5; cursor: not-allowed; }
.ui.manifold .mfi-datasetnote:not(:empty) { margin-top: 8px; color: var(--text-muted); font-size: 0.85rem; }

/* Tighten the control bar on narrow screens: drop the "Speed" word and shrink gaps. */
@media (max-width: 560px) {
  .ui.manifold .mfi-overlay { padding: 4px 8px 6px; }
  .ui.manifold .mfi-speed-text { display: none; }
  .ui.manifold .mfi-time { font-size: 0.76rem; margin-left: 2px; }
  .ui.manifold .mfi-ctrl-icon { min-width: 30px; }
}
