/* Opening figure of the looped-transformers post: the model drawn top to bottom and driven by the page scroll
   (loop_scroll.js). The drawing and the read-out reuse the rules of loop_l6.css (everything under .l6); the rules
   below add the pinned stage, the camera's window and the panel on the right. The second half styles the two
   figures of the section on how a pass reads the one before (loop_join.js). */
figure.ls-fig { margin: 44px 0 48px; max-width: none; }
figure.ls-fig > figcaption { max-width: calc(var(--wide) + 40px); margin: 18px auto 0; padding: 0 20px; }
.ls { position: relative; margin: 0; }
.ls-stage { position: sticky; top: 0; height: 100vh; height: 100svh; }
.ls .l6 { height: 100%; max-width: 1240px; margin: 0 auto; overflow: hidden; }
.ls .l6 > svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ls .l6 .tx tspan { transition: fill .15s; }

.ls-side { position: absolute; z-index: 2; right: 24px; top: max(96px, calc(50% - 236px)); width: clamp(310px, 33%, 410px); }
.ls-rail { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)) auto; column-gap: 4px; align-items: start; margin: 0 0 24px; }
.ls-st { all: unset; box-sizing: border-box; display: block; min-width: 0; padding: 8px 0 2px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.ls-st > i { display: block; height: 2px; background: rgba(233,223,201,.14); position: relative; overflow: hidden; }
.ls-st > i > u { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--ink-2); }
.ls-st.lp > i > u { background: var(--violet); }
.ls-st b { display: block; margin-top: 7px; font: 600 12px/1 var(--lab); letter-spacing: .02em; color: var(--ink-3); font-variant-numeric: tabular-nums; transition: color .2s; }
.ls-st.done b { color: var(--ink-2); }
.ls-st[aria-current="step"] b { color: var(--ink); }
.ls-st.lp[aria-current="step"] b { color: var(--violet); }
.ls-st:focus-visible b { outline: 1px dashed var(--ink-2); outline-offset: 3px; }
@media (hover: hover) { .ls-st:hover b { color: var(--ink); } }
.ls-skip { all: unset; box-sizing: border-box; margin: 13px 0 0 10px; font: 500 9px/1 var(--lab); letter-spacing: .12em; color: var(--ink-3); cursor: pointer; white-space: nowrap; }
.ls-skip:focus-visible { outline: 1px dashed var(--ink-2); outline-offset: 3px; }
@media (hover: hover) { .ls-skip:hover { color: var(--ink); } }
.ls .l6-s { font-size: 15px; }
.ls .l6-r { margin-top: 20px; }

/* the parts a step talks about blink a few times when the step comes up */
.ls .pt.talk { animation: ls-talk .75s ease-in-out 3; }
@keyframes ls-talk { 50% { opacity: .28; } }
@media (prefers-reduced-motion: reduce) { .ls .pt.talk { animation: none; } }

/* the pop-up sits next to the pointer, so it needs no notch */
.ls .l6-tip::before { display: none; }

@media (max-width: 820px) {
  .ls-side { left: 0; right: 0; top: auto; bottom: 0; width: auto; height: 46%; padding: 6px 16px 12px; background: var(--bg); border-top: 1px solid var(--line); overflow: hidden; }
  .ls-side.clip { overflow-y: auto; }   /* a very short screen: the panel scrolls rather than lose its last lines */
  .ls-rail { margin-bottom: 12px; }
  .ls .l6-x { display: none; }
  .ls .l6-r { margin-top: 12px; padding: 10px 12px 11px; }
  .ls .l6-s { margin-top: 8px; font-size: 13px; }
}

/* ---- #fig-unroll and the strip on #fig-patch (loop_join.js); the panel cards of the second scroll figure (loop_gate.js) ---- */
.lj svg { width: 100%; height: auto; overflow: visible; }
.lj .pt { cursor: default; }
.lj-sc { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; padding: 2px 0 8px; }
.lj-sc::-webkit-scrollbar { display: none; }
.lj .lj-plain { opacity: .62; }
.lj .lu-bx { transition: opacity .3s; }
.lj .lu-fr { transition: stroke .25s, fill .25s; }
.lj .lu-blink { animation: lu-blink .8s ease-in-out infinite; }
@keyframes lu-blink { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.lj .lu-say { min-height: 4.8em; margin: 12px 0 0; max-width: none; color: var(--fig-ink-2, var(--ink-2)); }
.lj .lu-say b { color: var(--ink); font-weight: 500; }
.lj .lu-say i { font-style: normal; color: var(--violet); }
.lj .lu-tag { display: inline-block; margin-right: 10px; padding: 3px 7px; border: 1px solid rgba(233,223,201,.3); font: 500 9px/1 var(--lab); letter-spacing: .12em; color: var(--ink); vertical-align: 1px; }
@media (max-width: 680px) { .lj .lu-say { min-height: 8em; } }
@media (hover: hover) { .lj .pt:hover { opacity: 1; } .lj .lj-plain:hover { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .lj .lu-bx, .lj .lu-fr { transition: none; } .lj .lu-blink { animation: none; } }
@media (max-width: 680px) { .lj svg { width: 660px; } }
.lj-sc.fl { -webkit-mask-image: linear-gradient(90deg, transparent, #000 32px); mask-image: linear-gradient(90deg, transparent, #000 32px); }
.lj-sc.fr { -webkit-mask-image: linear-gradient(270deg, transparent, #000 32px); mask-image: linear-gradient(270deg, transparent, #000 32px); }
.lj-sc.fl.fr { -webkit-mask-image: linear-gradient(90deg, transparent, #000 32px, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(90deg, transparent, #000 32px, #000 calc(100% - 32px), transparent); }
.lj-how { margin: 0 0 22px; padding: 0 0 14px; border-bottom: 1px solid var(--line); }

#lg .ls-rail { grid-template-columns: repeat(5, 44px) 1fr; }
#lg .ls-skip { justify-self: end; }
#lg .l6-r .acc { line-height: 1.6; }
/* while the camera is on the two passes, the opened layer on the right stays in the background */
#lg .far .pt.dim[data-k^="c-"], #lg .far .pt.dim[data-k="wedge"] { opacity: .13; }
.lg-kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 11px 0 2px; font: 500 10px/1.3 var(--lab); letter-spacing: .1em; color: var(--violet); }
.lg-kv em { font: 400 11.5px/1.3 var(--sen); font-style: normal; letter-spacing: 0; color: var(--ink); }
.lg-eq { margin: 12px 0 10px; padding: 9px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font: 400 12px/1.4 var(--sen); color: var(--ink-2); }
.lg-eq b { font-weight: 500; color: var(--violet); }
.lg-tb { display: grid; grid-template-columns: minmax(0, 1fr) repeat(3, auto); gap: 6px 14px; align-items: baseline; margin: 11px 0 2px; font: 500 9px/1.3 var(--lab); letter-spacing: .1em; color: var(--ink-2); }
.lg-tb i { font-style: normal; color: var(--ink-3); text-align: right; }
.lg-tb em { font: 500 11.5px/1.3 var(--lab); font-style: normal; letter-spacing: .02em; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }
.lg-tb .cut { color: var(--violet); }
.lg-sw { display: inline-flex; gap: 4px; }
.lg-sw button { all: unset; box-sizing: border-box; cursor: pointer; padding: 4px 7px; border: 1px solid rgba(233,223,201,.22); font: 500 9px/1 var(--lab); letter-spacing: .1em; color: var(--ink-2); -webkit-tap-highlight-color: transparent; }
.lg-sw button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.lg-sw button:focus-visible { outline: 1px dashed var(--ink-2); outline-offset: 2px; }
.lg-hm { display: grid; grid-template-columns: auto repeat(12, minmax(0, 1fr)); gap: 2px; align-items: center; margin: 12px 0 4px; font: 500 8.5px/1 var(--lab); letter-spacing: .08em; color: var(--ink-2); }
.lg-hm > span { padding-right: 8px; white-space: nowrap; }
.lg-hm > i { font-style: normal; text-align: center; color: var(--ink-3); padding-bottom: 3px; }
.lg-hm > em { font-style: normal; text-align: center; padding: 5px 0; letter-spacing: 0; font-variant-numeric: tabular-nums; }
@media (max-width: 820px) { #lg .ls-rail { grid-template-columns: repeat(5, 40px) 1fr; } .lg-hm > em { padding: 4px 0; } }

/* ---- #tb: the 24 layers in a row (under the first paragraph of "How the loop is built"); .tb-t are the words that name its parts ---- */
/* it is a <figure>, so that the copy-as-Markdown button (assets/share.js) leaves its labels out of the text */
figure.tb { --ink: var(--fig-ink); --ink-2: var(--fig-ink-2); --ink-3: var(--fig-ink-3); --vio: var(--o0); position: relative; margin: 30px 0 30px; padding: 26px 0 0; }
.tb-row { display: flex; gap: 3px; transition: gap .35s cubic-bezier(.2,.8,.2,1); }
.tb-g { position: relative; flex: 6 1 0; min-width: 0; transition: opacity .25s; cursor: default; }
.tb-g.tb-lp { flex-grow: 12; }
.tb-c { position: relative; display: flex; gap: 3px; border-radius: 3px; outline: 1.3px solid transparent; outline-offset: 5px; transition: outline-color .35s; }
.tb-c i { flex: 1 1 0; height: 30px; border: 1px solid color-mix(in srgb, var(--ink) 30%, transparent); background: color-mix(in srgb, var(--ink) 8%, transparent); border-radius: 2px; transition: background-color .35s, border-color .35s; }
.tb-c u { flex: none; width: 0; margin-left: -3px; transition: width .35s cubic-bezier(.2,.8,.2,1), margin .35s; }   /* no extra gap in the middle of the plain row */
.tb-g p { margin: 14px 0 0; font: 500 9px/1.5 var(--fig); letter-spacing: .1em; color: var(--ink-3); opacity: 0; transition: opacity .3s; }
.tb-g p b, .tb-g p span { display: block; white-space: nowrap; }
.tb-g p b { font-weight: 600; font-size: 10px; letter-spacing: .12em; color: var(--ink); margin-bottom: 2px; }
.tb-g em { position: absolute; right: 0; top: -24px; font: 600 11px/1 var(--fig); font-style: normal; letter-spacing: .08em; color: var(--vio); opacity: 0; transition: opacity .3s; }
.tb-h { position: absolute; left: 0; top: 70px; margin: 0; font: 500 9px/1.5 var(--fig); letter-spacing: .12em; color: var(--ink-3); transition: opacity .3s; }
/* split into its three parts */
.tb.open .tb-row { gap: 22px; }
.tb.open .tb-c u { width: 7px; margin-left: 0; }
.tb.open .tb-g p, .tb.open .tb-g em { opacity: 1; }
.tb.open .tb-h { opacity: 0; }
.tb.open .tb-c i { border-color: color-mix(in srgb, var(--ink) 55%, transparent); background: color-mix(in srgb, var(--ink) 14%, transparent); }
.tb.open .tb-lp .tb-c { outline-color: color-mix(in srgb, var(--vio) 55%, var(--bg)); }
.tb.open .tb-lp .tb-c i { border-color: var(--vio); background: color-mix(in srgb, var(--vio) 22%, transparent); }
.tb.open .tb-lp p b { color: var(--vio); }
/* one part picked: on the row, or through the words that name it */
.tb[data-on] .tb-g { opacity: .5; }   /* dimmed, but the flow through it stays readable */
.tb[data-on="pre"] .tb-g[data-part="pre"], .tb[data-on="loop"] .tb-g[data-part="loop"], .tb[data-on="coda"] .tb-g[data-part="coda"] { opacity: 1; }
.tb[data-on="pre"] .tb-g[data-part="pre"] i, .tb[data-on="coda"] .tb-g[data-part="coda"] i { border-color: var(--ink); background: color-mix(in srgb, var(--ink) 34%, transparent); }
.tb[data-on="loop"] .tb-lp .tb-c i { background: color-mix(in srgb, var(--vio) 46%, transparent); }
.tb-t { border-bottom: 1px dashed color-mix(in srgb, var(--fig-ink) 38%, transparent); cursor: default; transition: background-color .2s, border-color .2s; }
.tb-t.on { background: color-mix(in srgb, var(--fig-ink) 13%, transparent); border-bottom-color: var(--fig-ink); }
.tb-t[data-part="loop"].on { background: color-mix(in srgb, var(--o0) 20%, transparent); border-bottom-color: var(--o0); }
/* the flow: an arrow from part to part, an arrowhead on the loop's frame (the way back), and the moving dots */
.tb-g + .tb-g::before, .tb-g + .tb-g::after { content: ""; position: absolute; opacity: 0; transition: opacity .3s; pointer-events: none; }
.tb-g + .tb-g::before { top: 14.4px; height: 1.3px; width: 10px; background: var(--ink-2); }
.tb-g + .tb-g::after { top: 12px; width: 5px; height: 5px; border-top: 1.3px solid var(--ink-2); border-right: 1.3px solid var(--ink-2); transform: rotate(45deg); }
.tb-lp::before { left: -20px; } .tb-lp::after { left: -15px; }
.tb-lp + .tb-g::before { left: -14px; } .tb-lp + .tb-g::after { left: -9px; }
.tb-lp .tb-c::after { content: ""; position: absolute; left: calc(50% - 3px); top: -9.4px; width: 6px; height: 6px; border-left: 1.4px solid var(--vio); border-bottom: 1.4px solid var(--vio); transform: rotate(45deg); opacity: 0; transition: opacity .3s; }
.tb.open .tb-g + .tb-g::before, .tb.open .tb-g + .tb-g::after, .tb.open .tb-lp .tb-c::after { opacity: 1; }
.tb-d { position: absolute; left: 0; top: 0; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 1.5px var(--bg); opacity: 0; pointer-events: none; }
.tb-dm { background: var(--vio); }
.tb.open .tb-g .tb-c i.hot { border-color: var(--ink); background: color-mix(in srgb, var(--ink) 46%, transparent); }
.tb.open .tb-lp .tb-c i.hot { border-color: var(--vio); background: color-mix(in srgb, var(--vio) 62%, transparent); }
@media (hover: none) { .tb-h { display: none; } }
@media (prefers-reduced-motion: reduce) { .tb-row, .tb-c, .tb-c i, .tb-c u, .tb-g, .tb-g p, .tb-g em, .tb-h { transition: none; } }
