/* ═══════════════════════════════════════════════════════════════════════════
   body-figure.css — the plate that stands in the masthead's right margin.

   Placement is the whole layout problem: the hero's headline is capped at 16ch
   of display type and already fills the container, so there is no column to
   put a figure in. The plate therefore sits ABSOLUTELY in the page's right
   margin, outside the 820px column, with its width derived from whatever
   margin is actually there. Nothing on any page gets narrower, and no page's
   markup has to be restructured for a decoration.

   When the viewport leaves no margin worth drawing in, it does not exist. A
   figure that pushes a headline around is worse than no figure.
   ═══════════════════════════════════════════════════════════════════════════ */

.lh-fig { display: none; }

/* 1290px is the first width where a 180px plate and its 41px gap fit beside
   the 820px column without touching the page edge. */
@media (min-width: 1290px) {
  #hero .container {
    /* something in the theme stack leaves the hero container static; the
       plate is positioned against it, so it has to be the containing block */
    position: relative;
    --frame: 820px;
    --plate: clamp(176px, calc((100vw - var(--frame)) / 2 - 62px), 270px);
  }

  .lh-fig {
    display: block;
    position: absolute;
    right: calc(-1 * (var(--plate) + 32px));
    top: 50%;
    transform: translateY(-50%);
    width: var(--plate);
    -webkit-user-select: none;
    user-select: none;
  }
}

/* IB SEHS runs a 1088px masthead, so its margin only exists much later —
   and until it does, the plate must not be drawn at all: at 1440 the same
   maths put it 104px past the right edge and gave the page a scrollbar. */
@media (max-width: 1659px) {
  body.ib-learn-page .lh-fig { display: none; }
}

@media (min-width: 1660px) {
  body.ib-learn-page #hero .container {
    --frame: 1088px;
    --plate: clamp(170px, calc((100vw - var(--frame)) / 2 - 62px), 218px);
  }
  body.ib-learn-page .lh-fig { display: block; }
}

.lh-fig {
  /* Ink, not gold: on this skin --jr-gold resolves through --accent, which is
     the site's teal, and a teal wash made the figure look seasick. Ink mixed
     into paper is warm in both editions and stays a drawing. */
  --bf-skin: color-mix(in srgb, var(--jr-ink, #17140f) 11%, var(--jr-paper, #f3eee4));
  --bf-skin-back: color-mix(in srgb, var(--jr-ink, #17140f) 7%, var(--jr-paper, #f3eee4));
}

.lh-fig svg.bf {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  color: var(--jr-ink, #17140f);
  touch-action: none;
}

/* ── ink and wash ──────────────────────────────────────────────────────────
   One fill for every body part: opaque paper tinted toward gold, so the far
   arm disappears behind the torso instead of showing through it. */
.bf-torso,
.bf-limb,
.bf-skull,
.bf-neck,
.bf-palm,
.bf-foot {
  fill: var(--bf-skin);
  stroke: none;
}

.bf-flood { flood-color: var(--jr-ink, #17140f); }

.bf-back {
  fill: var(--bf-skin-back);
}

.bf-det path {
  fill: none;
  stroke: var(--jr-ink, #17140f);
  stroke-width: 1;
  stroke-linecap: round;
  opacity: .3;
}

.bf-navel {
  fill: none;
  stroke: var(--jr-ink, #17140f);
  stroke-width: 1;
  opacity: .42;
}

.bf-ear { fill: none; stroke: var(--jr-ink, #17140f); stroke-width: 1.2; opacity: .5; }

.bf-hair {
  fill: none;
  stroke: var(--jr-ink, #17140f);
  stroke-width: 1.3;
  stroke-linecap: round;
  opacity: .22;
}

.bf-face { fill: none; stroke: var(--jr-ink, #17140f); stroke-width: 1.1; stroke-linecap: round; opacity: .42; }

.bf-digit { fill: none; stroke: var(--bf-skin); stroke-linecap: round; }
.bf-fing { fill: none; stroke: var(--jr-ink, #17140f); stroke-width: 1; stroke-linecap: round; opacity: .3; }
.bf-knuck { fill: none; stroke: var(--jr-ink, #17140f); stroke-width: 1; stroke-linecap: round; opacity: .24; }
.bf-toe { fill: none; stroke: var(--jr-ink, #17140f); stroke-width: 1; stroke-linecap: round; opacity: .3; }

.bf-shadow { fill: url(#bf-shade); opacity: .75; }
.bf-sh-a { stop-color: var(--jr-ink, #17140f); stop-opacity: .15; }
.bf-sh-b { stop-color: var(--jr-ink, #17140f); stop-opacity: 0; }

/* ── joints ────────────────────────────────────────────────────────────────
   A dot, not a knob: it says "this part moves" without turning the figure
   into a rubber doll. The ring only appears under the pointer. */
.bf-j .bf-hit { fill: transparent; cursor: grab; }
.bf-j .bf-dot { fill: var(--jr-ink, #17140f); opacity: .26; transition: opacity .18s ease; }
.bf-j .bf-ring {
  fill: none;
  stroke: var(--jr-gold, #946a08);
  stroke-width: 1;
  opacity: 0;
  transition: opacity .18s ease;
}
.bf-j:hover .bf-dot, .bf-j.is-drag .bf-dot { opacity: .9; fill: var(--jr-gold, #946a08); }
.bf-j:hover .bf-ring, .bf-j.is-drag .bf-ring { opacity: .55; }
.bf-j.is-drag .bf-hit { cursor: grabbing; }

/* ── the caption ─────────────────────────────────────────────────────────── */
.lh-fig-cap {
  display: flex;
  flex-direction: column;
  gap: .22rem;
  margin-top: .7rem;
  padding-top: .55rem;
  border-top: 1px solid var(--jr-rule, rgba(0, 0, 0, .16));
}

.lh-fig-k {
  font: 600 .6rem/1 var(--jr-text, inherit);
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--jr-gold, #946a08);
}

.lh-fig-t {
  font: italic 400 .85rem/1.4 var(--jr-text, inherit);
  color: var(--jr-ink2, #4b453b);
}

.lh-fig-h {
  font: 600 .55rem/1.3 var(--jr-text, inherit);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--jr-ink3, #857d6f);
}
