/* ── /core/, the system map (coretwo5.mjs, v5-core-two.js): the section pins under the header for one screen of scroll
   per step, inside a framed box (a hairline above and below, from frame line to frame line). Words on the left, the
   panels on the right; the lines where the request enters x-arc core and leaves it run across the whole box. The
   drawing's colours are the board's own names, set here from the site's theme. ── */
.ct5 {
  --t-ink: var(--fg-rgb); --t-draw: var(--fg-rgb); --t-bg: var(--bg-rgb); --t-acc: var(--ma-rgb);
  --t-card: 13, 18, 18; --t-tile: 21, 26, 26;
  --t-top: 59px;   /* under the header: the box's top line lies under the header's own bottom rule (its last pixel
                      row once scrolled), so the two read as one line */
  --t-gap: 0px;    /* the box runs from the header to the bottom of the screen (user, 15 Nov evening: "why do we need
                      to keep these spaces?"; it sat 48px inside both until then) */
  --t-tk: 26px;    /* the corner marks' arms */
  --t-tki: 18px;   /* and how far in from the box's corners they sit */
}
html[data-theme="light"] .ct5 { --t-draw: 92, 100, 98; --t-card: 255, 255, 255; --t-tile: 244, 245, 242; }
.s5.ct5 { border-top: 0; margin-bottom: -1px; }
.s5.ct5 > .fr5.ct5-run { padding-block: 0 var(--t-x, 0px); }
.ct5-track { height: calc(var(--n, 6) * (100vh - var(--t-top)) - 2 * var(--t-gap)); height: calc(var(--n, 6) * (100svh - var(--t-top)) - 2 * var(--t-gap)); }
.ct5-pin { position: sticky; top: calc(var(--t-top) + var(--t-gap)); display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 40px; height: calc(100vh - var(--t-top) - 2 * var(--t-gap)); height: calc(100svh - var(--t-top) - 2 * var(--t-gap)); margin-inline: calc(-1 * var(--pad)); padding-inline: var(--pad); background: linear-gradient(var(--ln), var(--ln)) top left / 100% 1px no-repeat; }
/* the box's bottom line, held at the bottom of the screen while the box is pinned; it leaves with the section and
   sits on the next one's top line */
.ct5-endw { position: absolute; left: 0; right: 0; top: calc(100vh - var(--t-top) - 2 * var(--t-gap) - 1px); top: calc(100svh - var(--t-top) - 2 * var(--t-gap) - 1px); bottom: 0; display: flex; flex-direction: column; justify-content: flex-end; pointer-events: none; }
.ct5-endl { position: sticky; bottom: var(--t-gap); display: block; height: 1px; background: var(--ln); }

/* crossing in and out of x-arc core: the line across the box where the request crosses, and a line that runs out
   from the crossing to both edges; both cut at the box's lines */
.ct5-cut { position: absolute; inset: 0; overflow: clip; pointer-events: none; }
.ct5-seg { position: absolute; left: 0; top: 0; width: 100%; height: 0; }
.ct5-seg > i { position: absolute; top: 0; display: block; height: 1px; }
.ct5-cl { left: 0; width: 100%; background: rgb(var(--t-draw)); opacity: 0; transition: opacity .4s; }
.ct5-trl { background: rgb(var(--t-ink)); opacity: 0; }
/* inside x-arc core (round 3, user: "smooth and minimalistic", no fill, no name): the box is framed by the site's mint
   corner marks, the reticle of the home page's "applied layer" (.hx-k, v5.css), a little in from its corners. A
   corner's mark closes in when that corner is inside (the script sets .tk-b for the lower pair, .tk-t for the upper)
   and lets go when it is not; the box keeps its plain lines throughout. The marks are clipped to the box, so one
   waiting outside its corner never makes the page wider than the screen */
.ct5-tks { position: absolute; inset: 0; overflow: clip; pointer-events: none; }
.ct5-tk { position: absolute; width: var(--t-tk); height: var(--t-tk); border: 0 solid var(--ma); opacity: 0; transform: translate(calc(var(--kx) * 14px), calc(var(--ky) * 14px)); transition: transform .75s var(--ease), opacity .45s linear; }
.ct5-tk[data-c="tl"] { left: var(--t-tki); top: var(--t-tki); border-width: 1.5px 0 0 1.5px; --kx: -1; --ky: -1; }
.ct5-tk[data-c="tr"] { right: var(--t-tki); top: var(--t-tki); border-width: 1.5px 1.5px 0 0; --kx: 1; --ky: -1; }
.ct5-tk[data-c="bl"] { left: var(--t-tki); bottom: var(--t-tki); border-width: 0 0 1.5px 1.5px; --kx: -1; --ky: 1; }
.ct5-tk[data-c="br"] { right: var(--t-tki); bottom: var(--t-tki); border-width: 0 1.5px 1.5px 0; --kx: 1; --ky: 1; }
.ct5.tk-t:not(.ended) .ct5-tk[data-c^="t"], .ct5.tk-b:not(.ended) .ct5-tk[data-c^="b"] { opacity: 1; transform: none; }

/* the words: one step per panel, level with it */
.ct5-tx { position: relative; z-index: 1; height: 100%; overflow: hidden; }
.ct5-sec { position: absolute; left: 0; right: 0; top: 50%; height: 0; }
.ct5-b { transform: translateY(-50%); }
.ct5-k { display: block; width: 36px; height: 1px; margin: 0 0 24px; background: rgba(var(--t-ink), .55); }
.ct5-b h2 { margin: 0; max-width: 11em; font: 500 44px/1.06 var(--head); letter-spacing: -.035em; color: rgb(var(--t-ink)); text-wrap: balance; }
.ct5-b p { margin: 18px 0 0; max-width: 440px; font-size: 17px; line-height: 1.6; color: rgba(var(--t-ink), .68); text-wrap: pretty; }

/* the drawing */
.ct5-stage { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; height: 100%; min-height: 0; }
.ct5-stg { position: relative; height: calc(100% - 40px); aspect-ratio: 600 / 700; max-width: 100%; }
/* the drawing fades out at its top and bottom edges itself, so the tone behind it shows through */
.ct5-svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; overflow: hidden; font-family: var(--sans); --t-ink: var(--t-draw);
  -webkit-mask-image: linear-gradient(transparent, #000 70px, #000 calc(100% - 70px), transparent); mask-image: linear-gradient(transparent, #000 70px, #000 calc(100% - 70px), transparent); }
.ct5-svg .mo { font-family: var(--mono); }
/* the shapes that change with the words' size on phones: the desktop one (.dk) shows above 900px, the phone one (.ph)
   below (coretwo5.mjs) */
.ct5-svg .ph { display: none; }

/* a panel: its outline draws, then its parts come in one after another (--i of --n1), all within about half a second
   of its step becoming active; it goes quicker the other way. The one in view is bright. Every panel, the output too,
   arrives, builds and rests the same way. */
.ct5-fr { stroke: rgba(var(--t-ink), .14); stroke-width: 1.4; stroke-dasharray: 100 100; stroke-dashoffset: 100; fill-opacity: 0; transition: stroke-dashoffset .2s, fill-opacity .2s, stroke .3s; }
.ct5-c.on .ct5-fr { stroke-dashoffset: 0; fill-opacity: 1; transition: stroke-dashoffset .3s var(--ease), fill-opacity .3s var(--ease), stroke .3s; }
.ct5-c.f .ct5-fr { stroke: rgba(var(--t-ink), .42); }
.ct5-p { opacity: 0; transform: translateY(6px); transition: opacity .15s, transform .15s; }
.ct5-c.on .ct5-p { opacity: 1; transform: none; transition: opacity .2s var(--ease), transform .26s var(--ease); transition-delay: calc(.06s + .26s * var(--i) / var(--n1)); }
.ct5-led { opacity: .2; transition: opacity .3s; }
.ct5-c.f .ct5-led { opacity: 1; }
/* the input: once the story moves on, the problem it follows keeps its mint and the others turn grey */
.ct5-q rect, .ct5-q text { transition: fill .5s, fill-opacity .5s; }
.ct5-c.pick .ct5-q:not(.pk) rect { fill: rgba(var(--t-ink), .3); }
.ct5-c.pick .ct5-q:not(.pk) text { fill-opacity: .5; }
.ct5-c [data-m], .ct5-c [data-m="ag"] .ch { transition: stroke .25s, fill .25s; }
/* configure: the structure's options, their chips' outlines lit together when it lands (v5-core-two.js) */
.ct5-c [data-m="ag"].lit .ch { stroke: rgb(var(--t-acc)); }
/* coming back to the section mid-way, the panels up to there are whole at once */
.ct5.now .ct5-c *, .ct5.now .ct5-tk { transition: none !important; }

/* until the script has drawn the first frame, the drawing waits unseen and only the first step's words show */
.ct5:not(.on) .ct5-svg, .ct5:not(.on) .ct5-seg, .ct5:not(.on) .ct5-tks { opacity: 0; }
.ct5:not(.on) .ct5-sec + .ct5-sec { visibility: hidden; }

/* phone and narrow screens: the drawing on top, edge to edge and cropped round the panel so it fills the width; the
   words start right under it */
@media (max-width: 900px) {
  .ct5 { --t-tk: 13px; --t-tki: 7px; }
  .ct5-pin { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 0; }
  .ct5-stage { order: -1; height: auto; margin-inline: calc(-1 * var(--pad)); padding-top: 24px; }
  .ct5-stg { width: 100%; height: auto; aspect-ratio: 496 / 364; }
  .ct5-svg { -webkit-mask-image: none; mask-image: none; }
  /* the panels' words: here a panel is drawn at 1.2 on a board cropped to 496 units, so no label is set under 10.4
     units (9.3px on a 390 screen, 8.5px on a 360 one); each label carries its own size (--fs) and keeps it when it is
     larger. The shapes that hold the words follow (.ph) */
  .ct5-svg .ct5-c text { font-size: max(var(--fs), 10.4px); }
  .ct5-svg .dk { display: none; }
  .ct5-svg .ph { display: inline; }
  .ct5-sec { top: 26px; }
  .ct5-b { transform: none; }
  .ct5-b h2 { font-size: 30px; }
  .ct5-b p { margin-top: 14px; font-size: 16px; }
  .ct5-k { margin-bottom: 18px; }
}
/* on narrow screens the scroll selects the step and the way to it plays by itself (v5-core-two.js, measure), so under
   a thumb a step does not need a whole screen of scroll: seven tenths of one, and never under 480px (a phone held
   sideways), about one swipe per step. A narrow window on a computer keeps a whole screen per step, so the space bar
   and the page keys still land on every step */
@media (max-width: 900px) and (pointer: coarse) {
  .ct5-track { height: calc(100vh - var(--t-top) - 2 * var(--t-gap) + (var(--n, 6) - 1) * max(0.7 * (100vh - var(--t-top)), 480px)); height: calc(100svh - var(--t-top) - 2 * var(--t-gap) + (var(--n, 6) - 1) * max(0.7 * (100svh - var(--t-top)), 480px)); }
}
/* a short upright phone (an iPhone SE, a 640-high Android): the panel keeps its size and the words step down a size,
   so a step's whole text stands under its panel inside the box */
@media (max-width: 900px) and (max-height: 720px) and (orientation: portrait) {
  .ct5-stage { padding-top: 16px; }
  .ct5-sec { top: 18px; }
  .ct5-b h2 { font-size: 25px; }
  .ct5-b p { margin-top: 10px; font-size: 15px; line-height: 1.5; }
  .ct5-k { margin-bottom: 12px; }
}
/* a phone held sideways: too short to stack the panel over its words, so they stand side by side, the words on the
   left, the panel's crop on the right, both sized to the height */
@media (max-width: 900px) and (max-height: 520px) and (orientation: landscape) {
  .ct5-pin { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); grid-template-rows: none; gap: 28px; }
  .ct5-stage { order: 0; height: 100%; margin-inline: 0; padding-top: 0; }
  .ct5-stg { width: auto; height: calc(100% - 24px); max-width: 100%; aspect-ratio: 496 / 364; }
  .ct5-sec { top: 50%; }
  .ct5-b { transform: translateY(-50%); }
  .ct5-b h2 { font-size: 24px; }
  .ct5-b p { margin-top: 10px; font-size: 14px; line-height: 1.5; }
  .ct5-k { margin-bottom: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .ct5-p, .ct5-fr, .ct5-cl, .ct5-tk, .ct5-q rect, .ct5-q text, .ct5-c [data-m], .ct5-c [data-m="ag"] .ch { transition: none !important; }
}
