/* ── PsychoPharmRef Blog — Slide Overview component ─────────────────────── */
/* Collapsible image carousel + PDF download, sourced from a manifest.json   */
/* Loaded by blog/slides.js. Hides itself if no manifest is reachable.       */

.ba-slides {
  display: block;
  margin: 0 0 24px;
  border: 1px solid var(--border, #cfc8ba);
  border-radius: 8px;
  background: var(--bg2, #ece6db);
  overflow: hidden;
}
.ba-slides[hidden] { display: none; }

/* ── Toggle (header bar that opens/closes the panel) ────────────────────── */
.ba-slides-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  background: var(--bg2, #ece6db);
  border: none;
  border-bottom: 1px solid transparent;
  color: var(--text, #231e14);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
}
.ba-slides-toggle:hover { background: var(--bg3, #e2dbd0); }
.ba-slides-toggle[aria-expanded="true"] {
  border-bottom-color: var(--border, #cfc8ba);
  background: var(--bg3, #e2dbd0);
}
.ba-slides-icon {
  width: 18px; height: 18px; flex-shrink: 0; fill: var(--accent, #4a7c35);
}
.ba-slides-label { flex: 1; }
.ba-slides-count {
  font-size: 12px; font-weight: 600; color: var(--text-muted, #6b6050);
  background: var(--card, #fefcf8); padding: 2px 8px; border-radius: 10px;
  border: 1px solid var(--border, #cfc8ba);
}
.ba-slides-count:empty { display: none; }
.ba-slides-chevron {
  width: 16px; height: 16px; flex-shrink: 0; fill: var(--text-muted, #6b6050);
  transition: transform 0.2s ease;
}
.ba-slides-toggle[aria-expanded="true"] .ba-slides-chevron { transform: rotate(180deg); }

/* ── Panel ──────────────────────────────────────────────────────────────── */
.ba-slides-panel {
  background: var(--card, #fefcf8);
  padding: 14px 14px 12px;
}
.ba-slides-panel[hidden] { display: none; }

/* ── Stage: image + arrows ──────────────────────────────────────────────── */
.ba-slides-stage {
  position: relative;
  background: #1a1a1a;
  border-radius: 6px;
  overflow: hidden;
  /* 16:9-ish; image is contained so PDF aspect ratio is preserved */
  aspect-ratio: 16 / 10;
}
@supports not (aspect-ratio: 1) {
  .ba-slides-stage { padding-top: 62.5%; }
}
.ba-slides-track {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
.ba-slides-track img {
  max-width: 100%; max-height: 100%;
  width: auto; height: auto;
  display: none;
  user-select: none;
  -webkit-user-drag: none;
}
.ba-slides-track img.is-active { display: block; }

/* arrows */
.ba-slides-prev, .ba-slides-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 36px; height: 56px;
  background: rgba(0,0,0,0.45); color: #fff;
  border: none; cursor: pointer;
  font-size: 24px; font-weight: 700; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
  z-index: 2;
}
.ba-slides-prev:hover, .ba-slides-next:hover { background: rgba(0,0,0,0.7); }
.ba-slides-prev { left: 0; border-radius: 0 4px 4px 0; }
.ba-slides-next { right: 0; border-radius: 4px 0 0 4px; }
.ba-slides-prev:disabled, .ba-slides-next:disabled { opacity: 0.3; cursor: default; }

/* ── Bottom bar: dots, position, fullscreen, download ───────────────────── */
.ba-slides-bar {
  display: flex; align-items: center; gap: 12px;
  margin-top: 10px; flex-wrap: wrap;
}
.ba-slides-dots {
  display: flex; gap: 6px; flex: 1; flex-wrap: wrap;
  min-width: 0;
}
.ba-slides-dots button {
  width: 8px; height: 8px; padding: 0;
  border-radius: 50%;
  background: var(--border, #cfc8ba);
  border: none; cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.ba-slides-dots button:hover { background: var(--text-muted, #6b6050); }
.ba-slides-dots button.is-active {
  background: var(--accent, #4a7c35); transform: scale(1.3);
}
.ba-slides-actions {
  display: flex; align-items: center; gap: 8px;
}
.ba-slides-pos {
  font-size: 12px; font-weight: 600; color: var(--text-muted, #6b6050);
  font-variant-numeric: tabular-nums;
}
.ba-slides-fs, .ba-slides-dl {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px;
  font-size: 12px; font-weight: 600;
  color: var(--text, #231e14);
  background: var(--bg2, #ece6db);
  border: 1px solid var(--border, #cfc8ba);
  border-radius: 4px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.ba-slides-fs:hover, .ba-slides-dl:hover {
  background: var(--accent, #4a7c35); color: #fff; border-color: var(--accent, #4a7c35);
}
.ba-slides-dl::before {
  content: ""; width: 12px; height: 12px; flex-shrink: 0;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z'/></svg>") no-repeat center / contain;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z'/></svg>") no-repeat center / contain;
}

/* ── Fullscreen mode ────────────────────────────────────────────────────── */
.ba-slides.is-fullscreen {
  position: fixed; inset: 0; z-index: 9999;
  border-radius: 0; border: none;
  margin: 0;
  background: #0a0a0a;
  display: flex; flex-direction: column;
}
.ba-slides.is-fullscreen .ba-slides-toggle { display: none; }
.ba-slides.is-fullscreen .ba-slides-panel {
  background: #0a0a0a; padding: 12px;
  flex: 1; display: flex; flex-direction: column;
}
.ba-slides.is-fullscreen .ba-slides-stage {
  flex: 1; aspect-ratio: auto; background: #0a0a0a;
}
.ba-slides.is-fullscreen .ba-slides-pos { color: #d8d4cc; }
.ba-slides.is-fullscreen .ba-slides-dots button {
  background: #444;
}
.ba-slides.is-fullscreen .ba-slides-dots button.is-active { background: var(--accent, #4a7c35); }
.ba-slides.is-fullscreen .ba-slides-fs,
.ba-slides.is-fullscreen .ba-slides-dl {
  background: #1d1d1d; color: #ece6db; border-color: #333;
}
.ba-slides.is-fullscreen .ba-slides-fs:hover,
.ba-slides.is-fullscreen .ba-slides-dl:hover {
  background: var(--accent, #4a7c35); color: #fff; border-color: var(--accent, #4a7c35);
}

/* ── Mobile tweaks ──────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .ba-slides-stage { aspect-ratio: 4 / 3; }
  .ba-slides-prev, .ba-slides-next { width: 30px; height: 48px; font-size: 20px; }
  .ba-slides-bar { gap: 8px; }
  .ba-slides-dots { order: 3; flex-basis: 100%; justify-content: center; }
  .ba-slides-pos { font-size: 11px; }
  .ba-slides-fs, .ba-slides-dl { padding: 5px 10px; font-size: 11px; }
}

/* ── Print: hide the slide block (it's redundant with the article body) ── */
@media print {
  .ba-slides { display: none !important; }
}
