/* Reusable pattern: a readable inline figure plus the detailed canonical image
   behind a "View full figure" control. The detailed image is real page content,
   present in the HTML, not injected after the click. */

:root { --fig-expand: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round' d='M9.5 2.5h4v4M13.5 2.5 9 7M6.5 13.5h-4v-4M2.5 13.5 7 9'/%3E%3C/svg%3E"); }

.fig-full { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin: 6px 0 0; }

.fig-full__btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid #ddd6e8;
  border-radius: 999px;
  background: #fff;
  font: inherit;
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.4;
  color: #592f91;
  cursor: pointer;
}
.fig-full__btn:hover { border-color: #c3b4dc; background: #faf8fd; }
.fig-full__btn:focus-visible { outline: 2px solid #592f91; outline-offset: 2px; }
/* Expand glyph: two opposed corner brackets, not a plain box. */
.fig-full__btn::before {
  content: "";
  width: 12px;
  height: 12px;
  flex: none;
  background-color: currentColor;
  -webkit-mask: var(--fig-expand) center / contain no-repeat;
  mask: var(--fig-expand) center / contain no-repeat;
}

.fig-modal { position: fixed; inset: 0; margin: auto; width: min(96vw, 1320px); max-width: none; max-height: 92vh; padding: 0; border: 0; border-radius: 10px; background: #fff; box-shadow: 0 18px 60px rgba(37, 44, 97, 0.28); overflow: hidden; }
.fig-modal::backdrop { background: rgba(20, 22, 26, 0.62); }
.fig-modal[open] { display: flex; flex-direction: column; }

.fig-modal__bar { display: flex; justify-content: flex-end; padding: 6px 8px 0; }
.fig-modal__close { appearance: none; border: 0; background: transparent; padding: 4px 8px; font: inherit; font-size: 20px; line-height: 1; color: #56514f; cursor: pointer; border-radius: 6px; }
.fig-modal__close:hover { background: #f4f1f8; }
.fig-modal__close:focus-visible { outline: 2px solid #592f91; outline-offset: 2px; }

/* The detailed image sits in a pannable viewport; it is never cropped. */
.fig-modal__body { flex: 1 1 auto; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y; overscroll-behavior: contain; padding: 0 10px 10px; background: #fff; }
.fig-modal__body img { display: block; width: 100%; height: auto; min-width: 680px; margin: 0 auto; }

/* Phones: full-screen dialog, and the figure keeps a readable width so the
   viewport pans rather than shrinking 1200px of detail into 374px. */
/* Two triggers should still share a line on a phone. */
@media (max-width: 640px) {
  .fig-full { gap: 6px; }
  .fig-full__btn { padding: 4px 8px; font-size: 11.5px; }
}

@media (max-width: 640px) {
  .fig-modal { inset: 0; margin: 0; width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .fig-modal__body { padding: 0 6px 6px; }
  .fig-modal__body img { width: auto; max-width: none; min-width: 0; height: auto; margin: 0; }
}
