/* Case Studies page. Prefix: cs- */

.cs-figure {
  margin: 1.5rem 0;
}

.cs-figure figcaption {
  font-size: 0.875rem;
  color: var(--ink-2);
  margin-top: 0.5rem;
}

.cs-ph {
  aspect-ratio: var(--ar, 16 / 9);
  max-height: 420px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  text-align: center;
  background:
    repeating-linear-gradient(135deg, transparent 0 14px, rgba(26, 26, 26, 0.035) 14px 28px),
    var(--paper-sink);
  border: 1px dashed var(--ink-3);
  border-radius: var(--radius-sm);
}

.cs-ph__label {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--ink-3);
  overflow-wrap: anywhere;
}

.cs-table-caption {
  font-size: 0.875rem;
  color: var(--ink-2);
  margin-top: 0.5rem;
}

.cs-pullquote {
  margin: 1.5rem 0;
}

.cs-pullquote p:last-child {
  margin-bottom: 0;
}

/* The References accordion header is generated as an h4.accordion-header;
   it is excluded so the margin does not show as a white strip above the button. */
#wikiMain h4:not(.accordion-header) {
  margin-top: 1.5rem;
}

#wikiMain [id^="ref-"],
#wikiMain #cs-ref-endo-note {
  overflow-wrap: anywhere;
}

.cs-img {
  max-width: 100%;
  height: auto;
}

/* Click-to-enlarge (static/lightbox.js); same lb- rules as Human Practices. */
.js-zoomable {
  cursor: zoom-in;
  position: relative;
}

.js-zoomable:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.lb-modal .modal-dialog.lb-dialog {
  width: fit-content;
  max-width: calc(100vw - 2rem);
}

.lb-modal .lb-content {
  position: relative;
  align-items: center;
  background: transparent;
  border: 0;
}

.lb-img {
  display: block;
  width: auto;
  height: auto;
  max-height: calc(100vh - 8rem);
  border-radius: var(--radius-md);
  background: var(--card);
}

.lb-caption {
  margin: 0.75rem 0 0;
  max-width: 60ch;
  text-align: center;
  font-size: 0.9rem;
  color: var(--card);
}

.lb-caption--hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.lb-close {
  position: absolute;
  top: -2.25rem;
  right: 0;
}

/* Zoom hint on hover/focus. */
.cs-figure:has(> .js-zoomable) {
  position: relative;
}

.cs-figure:has(> .js-zoomable)::after {
  content: "Click to enlarge";
  position: absolute;
  right: 0.75rem;
  top: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--card);
  font-size: 0.75rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.cs-figure:has(> .js-zoomable:hover)::after,
.cs-figure:has(> .js-zoomable:focus-visible)::after {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .cs-figure:has(> .js-zoomable)::after,
  .lb-modal.fade .modal-dialog,
  .lb-modal.fade {
    transition: none;
  }
}

.cs-figure figcaption .cs-ai-note {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.8em;
  color: var(--text-muted);
}
