/* ==========================================================================
   Slide diagrams embedded by scripts/embed_slide_figures.py into hand-written
   slide breakdowns. Borders and captions derive from the page's own text
   colour, so figures sit in whatever light or dark theme the page uses.
   Classes are doubled where page-wide button/img/figure rules could win.
   ========================================================================== */
.sfx-figure.sfx-figure {
  max-width: 100%;
  margin: 1.6rem 0;
  padding: 0;
  border: 0;
  background: none;
}

.sfx-zoom.sfx-zoom {
  display: block;
  width: 100%;
  margin: 0;
  padding: clamp(0.5rem, 1.5vw, 1rem);
  border: 1px solid color-mix(in srgb, currentColor 18%, transparent);
  border-radius: 14px;
  background: #fff;
  color: inherit;
  font: inherit;
  cursor: zoom-in;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.sfx-zoom.sfx-zoom:hover,
.sfx-zoom.sfx-zoom:focus-visible {
  border-color: color-mix(in srgb, currentColor 45%, transparent);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  transform: none;
}

/* No width: auto -- the width/height attributes must reserve the box before a
   lazy image loads, or each figure shoves the page down as it appears. */
.sfx-figure.sfx-figure img {
  display: block;
  max-width: 100%;
  height: auto;
  max-height: min(75vh, 760px);
  margin: 0 auto;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  object-fit: contain;
}

.sfx-figure.sfx-figure figcaption {
  display: flex;
  gap: 0.7rem;
  align-items: baseline;
  margin-top: 0.6rem;
  font-size: 0.88rem;
  line-height: 1.55;
  text-align: left;
  opacity: 0.82;
}

/* The tag links to the slide the diagram came from; keep the page's own text colour
   rather than the browser's default link blue. */
.sfx-tag.sfx-tag {
  flex: none;
  color: inherit;
  font:
    700 0.68rem ui-monospace,
    "JetBrains Mono",
    SFMono-Regular,
    Menlo,
    monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  opacity: 0.85;
}

a.sfx-tag.sfx-tag:hover,
a.sfx-tag.sfx-tag:focus-visible {
  border-bottom-color: currentColor;
  opacity: 1;
}

.sfx-lightbox {
  width: fit-content;
  max-width: 96vw;
  max-height: 94vh;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: #fff;
  overflow: auto;
}

.sfx-lightbox::backdrop {
  background: rgba(4, 7, 14, 0.82);
}

/* Never upscale past the crop's own pixels; small slide images blur. */
.sfx-lightbox img {
  display: block;
  max-width: 100%;
  height: auto;
  padding: 1.25rem;
}

.sfx-lightbox-close {
  position: sticky;
  top: 0.6rem;
  float: right;
  margin: 0.6rem;
  padding: 0.35rem 0.8rem;
  border: 1px solid rgba(15, 23, 42, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #0f172a;
  font:
    700 0.72rem ui-monospace,
    "JetBrains Mono",
    SFMono-Regular,
    Menlo,
    monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

@media print {
  .sfx-zoom.sfx-zoom {
    border: 0;
    padding: 0;
  }
}
