
/* Section figures: inline SVG diagrams, ink and ember on the page's own
   ground, no external requests. They inherit the page font and take
   their ink from currentColor, so they restate the palette for free. */
.figure {
  display: block;
  width: 100%;
  max-width: 33rem;
  height: auto;
  margin-top: clamp(2.6rem, 4.5vw, 4rem);
  color: var(--ink);
}

.figure-wide {
  max-width: 44rem;
}

/* A figure that can be replayed is a keyboard stop; its focus ring is the
   page's ember, not the browser's blue. */
.figure[role="button"] {
  cursor: pointer;
  border-radius: 0.5rem;
}
.figure[role="button"]:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 0.5rem;
}

/* Each figure draws itself the first time it is seen: strokes trace in
   (a normalized dash slides off the path), labels fade, points pop, and
   a few motion-only parts ride along: a comet head that sits on the
   front of a drawing stroke (a zero-length round-capped dash walking the
   path), ripple rings, a ghosting pass, a hug that tightens an outline,
   and one slow orbit that never stops. Tap a figure to watch it again.
   The hidden starting state exists only once the trigger script has
   armed the page (html.figs-armed) and only for people who have not
   asked for reduced motion, so without JavaScript, and for anyone who
   prefers stillness, every figure is simply complete. The motion-only
   parts are hidden in that complete state. */
.figure .head,
.figure .ring,
.figure .orbit,
.figure .glow,
.figure .ghost {
  opacity: 0;
}

.figure .head,
.figure .orbit {
  fill: none;
  stroke-linecap: round;
  stroke-dasharray: 0 1;
}

.figure .ring,
.figure .flare,
.figure .hug {
  transform-box: fill-box;
  transform-origin: center;
}

@media (prefers-reduced-motion: no-preference) {
  html.figs-armed .figure .draw,
  html.figs-armed .figure .ghost {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
  }

  html.figs-armed .figure .fade {
    opacity: 0;
  }

  html.figs-armed .figure .pop {
    opacity: 0;
    transform: scale(0);
    transform-box: fill-box;
    transform-origin: center;
  }

  html.figs-armed .figure.in .draw {
    animation: fig-draw var(--dur, 900ms) var(--ease, ease-out) var(--d, 0ms) forwards;
  }

  html.figs-armed .figure.in .ghost {
    animation:
      fig-draw var(--dur, 900ms) var(--ease, ease-out) var(--d, 0ms) forwards,
      fig-ghost 700ms ease-out var(--gd, 0ms) both;
  }

  html.figs-armed .figure.in .head {
    animation:
      fig-head var(--dur, 900ms) var(--ease, ease-out) var(--d, 0ms) forwards,
      fig-head-out 500ms ease-out calc(var(--d, 0ms) + var(--dur, 900ms)) forwards;
  }

  html.figs-armed .figure.in .fade {
    animation: fig-fade 500ms ease-out var(--d, 0ms) forwards;
  }

  html.figs-armed .figure.in .pop {
    animation: fig-pop 420ms cubic-bezier(0.2, 0.8, 0.3, 1.2) var(--d, 0ms) forwards;
  }

  html.figs-armed .figure.in .ring {
    animation: fig-ring 800ms ease-out var(--d, 0ms) forwards;
  }

  html.figs-armed .figure.in .hug {
    animation: fig-hug var(--dur, 800ms) ease-out var(--d, 0ms) both;
  }

  html.figs-armed .figure.in .orbit {
    animation: fig-orbit 7s linear var(--d, 0ms) infinite;
  }

  html.figs-armed .figure.in .glow {
    animation: fig-glow 7s ease-in-out var(--d, 0ms) infinite;
  }

  html.figs-armed .figure.in .flare {
    animation: fig-flare 7s ease-in-out var(--d, 0ms) infinite;
  }
}

@keyframes fig-draw {
  to { stroke-dashoffset: 0; }
}

@keyframes fig-fade {
  to { opacity: 1; }
}

@keyframes fig-pop {
  to { opacity: 1; transform: scale(1); }
}

@keyframes fig-head {
  from { opacity: 1; stroke-dashoffset: 0; }
  to   { opacity: 1; stroke-dashoffset: -1; }
}

@keyframes fig-head-out {
  to { opacity: 0; }
}

@keyframes fig-ring {
  from { opacity: 0.85; transform: scale(0.2); }
  to   { opacity: 0; transform: scale(1); }
}

@keyframes fig-ghost {
  from { opacity: 1; }
  to   { opacity: 0; }
}

@keyframes fig-hug {
  from { transform: scale(1.16); }
  to   { transform: scale(1); }
}

@keyframes fig-orbit {
  from { opacity: 1; stroke-dashoffset: 0; }
  to   { opacity: 1; stroke-dashoffset: -1; }
}

@keyframes fig-glow {
  0%, 64% { opacity: 0; }
  84%     { opacity: 0.55; }
  100%    { opacity: 0; }
}

@keyframes fig-flare {
  0%, 66% { transform: scale(1); }
  76%     { transform: scale(1.45); }
  88%     { transform: scale(1); }
}


/* Phones. A 560-unit figure on a 390-pixel screen renders its 13-unit
   captions at 8 pixels, so below 520px (where the landscape captions fall
   under 11 pixels) the wide figures re-stack: each column is a group, and
   CSS transforms set the groups one under another at 1.25 to 1.4 times
   their size, arrows turned to point down. The viewBox stays landscape;
   the box gets the stacked height from --stack-h (set inline on each
   figure) and overflow is visible, so everything drawn below the
   viewBox's floor still shows. preserveAspectRatio="xMidYMin meet" keeps
   the viewBox at the top of the taller box. The whole thing is gated on
   aspect-ratio support, because without the taller box the stacked
   content would spill over the next section; a browser without it gets
   the landscape figure. The dense charts on the sub pages keep their
   layout and only raise their type; a long caption there has a two-line
   phone version (.ph) beside its one-line desktop one (.dt). */
.figure .ph {
  display: none;
}

@media (max-width: 520px) {
  .figure .ph {
    display: initial;
  }

  .figure .dt {
    display: none;
  }

  @supports (aspect-ratio: 1 / 1) {
    .fig-stack {
      overflow: visible;
      aspect-ratio: 560 / var(--stack-h);
    }

    .fig-stack .fc,
    .fig-stack .fa,
    .fig-stack .ff,
    .fig-stack .fl {
      transform-box: view-box;
      transform-origin: 0 0;
    }

    .fig-offer .fc1 { transform: translate(280px, 100px) scale(1.25); }
    .fig-offer .fa1 { transform: translate(280px, 272px) rotate(90deg) scale(1.25); }
    .fig-offer .fc2 { transform: translate(280px, 426px) scale(1.25); }
    .fig-offer .fa2 { transform: translate(280px, 598px) rotate(90deg) scale(1.25); }
    .fig-offer .fc3 { transform: translate(280px, 752px) scale(1.25); }

    .fig-own .fc1 { transform: translate(280px, 102px) scale(1.35); }
    .fig-own .fa1 { transform: translate(280px, 287px) rotate(90deg) scale(1.35); }
    .fig-own .fc2 { transform: translate(280px, 447px) scale(1.35); }
    .fig-own .fa2 { transform: translate(280px, 632px) rotate(90deg) scale(1.35); }
    .fig-own .fc3 { transform: translate(280px, 792px) scale(1.35); }

    .fig-fit .ffl { transform: translate(77px, -32px) scale(1.4); }
    .fig-fit .ffr { transform: translate(-272px, 339px) scale(1.4); }

    /* The loop sits in the middle of its box, so it grows to the box. */
    .fig-loop .fl { transform: translate(0, 0) scale(1.25); }

  }

  /* The sub pages' charts: larger type in place. */
  .fig-curve text { font-size: 20px; }
  .fig-curve .ph text { font-size: 19.5px; }
  .fig-sess text { font-size: 18px; }
  .fig-loop text { font-size: 16px; }
  .fig-release text { font-size: 19px; }
  .fig-release text[font-size="10"][fill-opacity=".65"] { font-size: 19.5px; }
  .fig-session text { font-size: 20px; }
  .fig-session text[font-size="12"] { font-size: 19.5px; }
  .fig-loop text.sub { display: none; }
  .fig-loop text[x="150"] { font-size: 13px; }
  .fig-time text { font-size: 18px; }
  .fig-time text[x="424"][fill="#f4581f"] { font-size: 16px; }
  .fig-time .ph text { font-size: 17px; }
}

/* The narrowest phones (320px) draw these charts at half size, so the
   labels go up again to stay at 11px or more. */
@media (max-width: 340px) {
  .fig-curve text,
  .fig-curve .ph text,
  .fig-session text,
  .fig-session text[font-size="12"],
  .fig-release text,
  .fig-release text[font-size="10"][fill-opacity=".65"] {
    font-size: 22.5px;
  }
}
