/* ---------------------------------------------------------------
   Inline diagrams (Slingshot case study). Each figure holds a desktop
   and a mobile SVG, swapped at 600px. Everything is scoped to .dgm so
   the short class names used inside the SVGs (.h, .b, .s, .box ...)
   cannot leak onto the rest of the page.
   --------------------------------------------------------------- */
.dgm { margin-top: var(--space-xl); }
.dgm__frame {
  background: #fcfcfc;
  border: 2px solid #000;
  border-radius: 10px;
  padding: var(--space-md);
}
.dgm__frame + .dgm__frame { margin-top: var(--space-md); }
.dgm__frame svg { display: block; width: 100%; height: auto; }
.dgm__frame img { display: block; width: 100%; height: auto; }
.dgm__frame picture { display: block; }
.dgm__frame svg.mob { display: none; }
.case-figure.dgm figcaption {
  max-width: none;
  text-align: center;
}

/* Empty slot for an asset that is still to come. */
.dgm .ph { aspect-ratio: 852 / 373; }

@media (max-width: 760px) {
  .dgm__frame svg.desk { display: none; }
  .dgm__frame svg.mob { display: block; max-width: 480px; margin-inline: auto; }
  /* A supplied image gets a little less padding on a phone. */
  .dgm__frame--photo { padding: 12px; }
}

/* The affinity wall is mostly empty board around six notes. Show the middle
   of it, enlarged, so the notes are readable. The file itself is untouched:
   this only changes what part of it is visible. */
.dgm__crop {
  overflow: hidden;
  aspect-ratio: 1.464;
}
.dgm__crop img {
  width: 185%;
  max-width: none;
  margin-left: -42.5%;
  margin-top: -26.8%;
}

/* --- Before / after toggle (image 5) ------------------------------ */
.dgm__toggle { display: none; }
.js .dgm__toggle {
  display: flex;
  width: fit-content;
  margin: 0 auto var(--space-md);
  padding: 3px;
  background: rgba(30, 30, 30, 0.06);
  border-radius: var(--radius-pill);
}
.dgm__toggle button {
  padding: 7px 18px;
  border-radius: var(--radius-pill);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-muted);
  transition: background 220ms var(--ease), color 220ms var(--ease);
}
.dgm__toggle button[aria-pressed="true"] {
  background: var(--ink);
  color: #fff;
}
.dgm__frame[hidden] { display: none; }
/* The site's pink focus ring is only about 2:1 against this background.
   The toggle gets the ink colour so keyboard focus is clearly visible. */
.dgm__toggle button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* --- SVG vocabulary, the same type and colours as the rest of the site */
.dgm svg text { font-family: var(--font-sans); fill: var(--ink); }
.dgm svg .h  { font-family: var(--font-serif); font-size: 18px; }
.dgm svg .h2 { font-family: var(--font-serif); font-size: 16px; }
.dgm svg .q  { font-family: var(--font-serif); font-size: 14px; font-style: italic; }
.dgm svg .b  { font-size: 15px; }
.dgm svg .bm { font-size: 15px; font-weight: 500; }
.dgm svg .m  { font-size: 14px; }
.dgm svg .s  { font-size: 13px; fill: var(--ink-muted); }
.dgm svg .xs { font-size: 13px; letter-spacing: 0.55px; text-transform: uppercase; fill: var(--ink-muted); }
.dgm svg .c  { text-anchor: middle; }
.dgm svg .coral-t  { fill: #a04020; }
.dgm svg .green-t  { fill: #2a7a40; }
.dgm svg .purple-t { fill: #7a4fa0; }

.dgm svg .box   { fill: #fff; stroke: var(--ink); stroke-width: 1.5; }
.dgm svg .card  { fill: #fff; stroke: #000; stroke-width: 2; }
.dgm svg .band  { fill: rgba(206, 177, 235, 0.28); stroke: #7a4fa0; stroke-width: 2; }
.dgm svg .ghost { fill: none; stroke: rgba(0, 0, 0, 0.5); stroke-width: 1.5; stroke-dasharray: 5 5; }
.dgm svg .ln    { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.dgm svg .ln-p  { fill: none; stroke: #7a4fa0; stroke-width: 2; }
.dgm svg .ln-r  { fill: none; stroke: var(--rule); stroke-width: 1.5; }
.dgm svg .track { fill: var(--rule); }

.dgm svg .pl { stroke-width: 1; }
.dgm svg .pl-white  { fill: #fff; stroke: #7a4fa0; }
.dgm svg .pl-plain  { fill: #fff; stroke: var(--ink); }
.dgm svg .pl-purple { fill: rgba(206, 177, 235, 0.3); stroke: #7a4fa0; }
.dgm svg .pl-blue   { fill: rgba(177, 209, 235, 0.32); stroke: #3d7ab5; }
.dgm svg .pl-coral  { fill: rgba(255, 190, 165, 0.3); stroke: #a04020; }
.dgm svg .pl-grey   { fill: rgba(0, 0, 0, 0.04); stroke: rgba(0, 0, 0, 0.5); }

.dgm svg .row-bad  { fill: rgba(255, 190, 165, 0.18); stroke: #a04020; stroke-width: 1.5; }
.dgm svg .row-good { fill: rgba(167, 220, 180, 0.2); stroke: #2a7a40; stroke-width: 1.5; }

/* A supplied exploration image. It is small, so show it at its own size
   and centred rather than stretching it across the column. */
.case-figure--exploration img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  margin-inline: auto;
}

/* Closing gallery: figures stack one under the other at every width. */
.dgm-gallery { margin-top: var(--space-xl); }
.dgm-gallery > .dgm { margin-top: 0; }
.dgm-gallery > .dgm + .dgm { margin-top: var(--space-2xl); }

/* Phone versions are drawn on a 340 wide canvas and shown a little smaller,
   so their type is set larger to stay at 12px or more on screen. */
.dgm svg.mob .m  { font-size: 15px; }
.dgm svg.mob .s  { font-size: 14.5px; }
.dgm svg.mob .xs { font-size: 14px; letter-spacing: 0.4px; }
