/* Parity build, leg media: rules start from its own class prefix (tests/test_leg_css_scope.py).
   Question images in the exam and the review (_media_figure.html) and the zoom page (media_view.html). Zoom works
   without JavaScript: .md-box is shown by :target; /media/ver/<id> shows the picture at its natural size. */
.md-fig { margin: var(--s4) 0; max-width: 100%; }
/* A case image in the exam lines up with the case text, which has its own side padding until the two-column frame. */
.md-exam.md-case { margin: 0 var(--s4) var(--s4); }
@media (min-width: 68.75rem) { .md-exam.md-case { margin: var(--s4) 0; } }
/* In the review the case sits in a bordered fold whose text is padded: the picture keeps the same inset. */
.md-fig.md-case:not(.md-exam) { margin: 0 var(--s4) var(--s4); }
.md-thumb { display: block; position: relative; border: 1px solid var(--line); border-radius: var(--rad-card); overflow: hidden;
  background: var(--surface-2); color: var(--ink); text-decoration: none; }
.md-thumb:hover { border-color: var(--line-strong); }
.md-thumb:focus-visible { outline: 3px solid var(--foco); outline-offset: 2px; }
.md-img { display: block; width: 100%; height: auto; max-height: 28rem; object-fit: contain; background: var(--papel); }
.md-tag { position: absolute; right: var(--s2); bottom: var(--s2); display: inline-flex; align-items: center; gap: var(--s1);
  padding: var(--s1) var(--s2); border-radius: var(--rad-btn); background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); box-shadow: var(--shadow-1); font: 600 var(--t-label)/1.2 var(--sans); }
.md-tag .icon { width: 1rem; height: 1rem; }
.md-cap { display: flex; flex-direction: column; gap: var(--s1); margin-top: var(--s2); font: var(--t-caption)/1.45 var(--sans);
  color: var(--muted); }
.md-caption { color: var(--ink); }
.md-credit a, .md-about-credit a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
/* The in-page zoom box: hidden until its id is the URL's fragment. */
.md-box { display: none; position: fixed; inset: 0; z-index: 900; padding: var(--s4); }
.md-box:target { display: grid; place-items: center; }
.md-shade { position: absolute; inset: 0; background: color-mix(in srgb, var(--noche) 88%, transparent); }
.md-panel { position: relative; display: flex; flex-direction: column; gap: var(--s3); max-width: min(100%, 75rem);
  max-height: 100%; }
.md-box-img { display: block; max-width: 100%; max-height: calc(100vh - 7rem); width: auto; height: auto; margin: 0 auto;
  object-fit: contain; background: var(--papel); border-radius: var(--rad); }
.md-box-bar { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s2); margin: 0; }
.md-box-bar .btn { min-height: 44px; }
.md-box-bar .md-full { background: var(--surface); }
.md-close .icon { width: 1.125rem; height: 1.125rem; }
/* The zoom page: the picture at its natural size, scrolling inside its own box. */
.md-page { background: var(--bg); }
.md-bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: var(--s3);
  padding: var(--s3) var(--s4); background: var(--surface); border-bottom: 1px solid var(--line); }
.md-bar .btn { min-height: 44px; }
.md-bar-title { margin: 0; font: 600 var(--t-body)/1.3 var(--sans); color: var(--titulo); }
.md-stage { padding: var(--s4) 0 var(--s7); }
.md-scroll { overflow: auto; padding: 0 var(--s4); text-align: center; -webkit-overflow-scrolling: touch; }
.md-natural { display: inline-block; max-width: none; height: auto; background: var(--papel); border: 1px solid var(--line);
  border-radius: var(--rad); }
.md-about { max-width: 44rem; margin: var(--s5) auto 0; padding: 0 var(--s4); }
.md-about p { margin: 0 0 var(--s2); }
.md-about-caption { font: 600 var(--t-body)/1.5 var(--sans); color: var(--ink); }
.md-about-alt { color: var(--ink); }
.md-about-credit, .md-about-hint { font: var(--t-caption)/1.5 var(--sans); color: var(--muted); }
@media (max-width: 40rem) {
  .md-box { padding: var(--s2); }
  .md-img { max-height: 20rem; }
  .md-box-bar { justify-content: stretch; }
  .md-box-bar .btn { flex: 1 1 auto; justify-content: center; }
}
