/* Expandable figures ({{< diagram >}} shortcode). Loaded only on pages that use it. */
.content .post .zx-figure {
  margin: 1.75rem 0;
  border: 1px solid var(--border-subtle, #1e293b);
  border-radius: var(--radius-lg, 12px);
  background: var(--surface-obsidian, #0a0d14);
  overflow: hidden;
}
.zx-figure__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem 0.45rem 0.85rem;
  border-bottom: 1px solid var(--border-subtle, #1e293b);
  background: var(--surface-elevated, #151c27);
  font-family: var(--font-body, system-ui, sans-serif);
}
.zx-figure__label {
  font-size: 0.8rem;
  color: var(--text-muted, #94a3b8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.zx-figure__tools { display: flex; flex-wrap: wrap; gap: 0.35rem; justify-content: flex-end; flex-shrink: 0; }
.content .post .zx-figure__btn,
.zx-figure__btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 2rem;
  min-width: 2rem;
  justify-content: center;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--border-active, #334155);
  border-radius: var(--radius-md, 8px);
  background: var(--surface-slate, #0f141c);
  color: var(--text-on, #e1e2ec);
  font: 500 0.78rem/1 var(--font-body, system-ui, sans-serif);
  text-decoration: none;
  cursor: pointer;
}
.content .post .zx-figure__btn:hover,
.zx-figure__btn:hover,
.zx-figure__btn:focus-visible {
  border-color: var(--primary, #10b981);
  color: var(--primary-bright, #4edea3);
  outline: none;
}
.content .post .zx-figure__btn[hidden],
.zx-figure__btn[hidden] { display: none !important; }
.zx-figure__frame {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  text-align: center;
  background: var(--surface-obsidian, #0a0d14);
}
.post .zx-figure__frame img,
.zx-figure__frame img {
  border: 0;
  border-radius: 0;
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
}
.zx-figure.is-enhanced:not(.is-expanded) .zx-figure__frame img { cursor: zoom-in; }
.zx-figure__frame iframe { display: block; width: 100%; border: 0; background: #0b1220; }
.content .post .zx-figure figcaption {
  padding: 0.6rem 0.85rem 0.75rem;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-muted, #94a3b8);
  border-top: 1px solid var(--border-subtle, #1e293b);
}

/* Expanded: real fullscreen or full-window overlay share the same layout. */
.content .post .zx-figure.is-expanded,
.zx-figure.is-expanded {
  display: flex;
  flex-direction: column;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: var(--surface-obsidian, #0a0d14);
}
.zx-figure:fullscreen { width: 100vw; height: 100vh; }
.zx-figure:-webkit-full-screen { width: 100vw; height: 100vh; }
.content .post .zx-figure.is-overlay,
.zx-figure.is-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.zx-figure.is-expanded .zx-figure__frame {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
}
.zx-figure.is-expanded .zx-figure__frame img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}
.zx-figure.is-expanded.is-zoomed .zx-figure__frame { display: block; }
.zx-figure.is-expanded.is-zoomed .zx-figure__frame img { max-width: none; max-height: none; height: auto; margin: 0; }
.zx-figure.is-expanded .zx-figure__frame iframe { width: 100%; height: 100% !important; }
.zx-figure.is-expanded.zx-figure--iframe .zx-figure__frame { padding: 0; }
.zx-figure.is-expanded figcaption { flex: 0 0 auto; max-height: 20vh; overflow: auto; }
html.zx-figure-lock, html.zx-figure-lock body { overflow: hidden; }

@media (max-width: 560px) {
  .zx-figure__label { display: none; }
  .zx-figure__bar { justify-content: flex-end; }
}
@media print {
  .zx-figure__bar { display: none; }
}
