/* BriConstrain project page: standard academic layout. Colours shared with the viewers (Okabe-Ito). */
:root{
  --ink:#1A1D23; --ink2:#4A4F5A; --mute:#7A808C; --line:#E4E6EB; --soft:#F5F6F8;
  --con:#0072B2; --unc:#E69F00; --bad:#D62828; --ok:#009E73;
  --sans:"Noto Sans",system-ui,-apple-system,"Segoe UI",sans-serif; --mono:"Noto Sans Mono",ui-monospace,monospace;
  --w:clamp(1000px,68vw,1320px); --wide:clamp(1100px,84vw,1760px); --gut:20px;   /* text column and viewer width grow with the screen */
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{margin:0;background:#fff;color:var(--ink);font:clamp(17px,.35vw + 12.5px,20px)/1.65 var(--sans);-webkit-font-smoothing:antialiased}
a{color:var(--con)}
img{max-width:100%;display:block}
.container{max-width:calc(var(--w) + 2*var(--gut));margin:0 auto;padding:0 var(--gut)}
.container.wide{max-width:calc(var(--wide) + 2*var(--gut))}
main>section.container{margin-top:72px}
main>section.container:first-child{margin-top:8px}

/* header */
.hero{text-align:center;padding-top:56px;padding-bottom:28px}
h1{font-weight:600;font-size:clamp(26px,3.6vw,40px);line-height:1.25;letter-spacing:-.01em;margin:0}
h1 sup{font-size:.45em}
.authors{font-size:19px;color:var(--ink2);margin:20px 0 0}
.authors sup{font-size:.6em;margin-left:1px}
.authors .aff{display:inline-block;margin-top:6px;font-size:.82em;color:var(--mute)}
.authors .au{white-space:nowrap;margin:0 .45em}
.links{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin-top:20px}
.btn{display:inline-flex;align-items:center;gap:7px;padding:8px 18px 8px 14px;border-radius:999px;background:#363636;color:#fff;text-decoration:none;font-weight:500;font-size:16px;line-height:1.2}
.btn:hover{background:#222}
.btn[aria-disabled=true]{opacity:.5;pointer-events:none}
.btn svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:2;stroke-linejoin:round;stroke-linecap:round}
.btn svg.fill{fill:currentColor;stroke:none}

h2{font-weight:600;font-size:clamp(28px,1.1vw + 14px,38px);line-height:1.2;text-align:center;margin:0 0 20px}
.text p{margin:0 0 1em;text-align:justify;hyphens:auto}
.lead{text-align:center;color:var(--ink2);margin:-8px auto 22px;max-width:min(100%,62em)}
.caption{font-size:.88em;line-height:1.55;color:var(--ink2);text-align:center;margin:12px auto 0;max-width:min(100%,70em)}

.vid{display:block;width:100%;aspect-ratio:16/9;border-radius:8px;background:#000}
.video-slot{aspect-ratio:16/9;border-radius:8px;background:var(--soft);display:grid;place-items:center;color:var(--mute);font-weight:500}

/* embedded viewers */
.frame{position:relative;width:100%;margin:0 auto}
/* comparison: wider than the text column */
.frame-compare{width:76.5vw;max-width:none;margin-left:calc(50% - 38.25vw)}   /* the three views span ~76.5% of the screen width */
.frame iframe{display:block;width:100%;border:0;background:transparent}
.frame-compare iframe{height:640px}
.frame-explore iframe{height:800px}
.frame:not(.loaded)::after{content:"Loading viewer…";position:absolute;inset:0;display:grid;place-items:center;color:var(--mute);border-radius:14px;background:var(--soft);pointer-events:none}

/* ---------------- method walkthrough: the paper's method figure (static/live/method_live.svg, built by tools/build_method_live.py)
   brought to life. #mfig is the figure; .live = walkthrough running; .aw = panel (a) widened (its steps);
   .f-<flag> = what has been revealed so far. Layout transforms of the wide (a) and the token flights are in the SVG's own <style>. ---------------- */
.walk{border:1px solid var(--line);border-radius:14px;overflow:hidden;background:#fff;outline:none;container-type:inline-size;container-name:walk}
/* the heading, figure, narration and controls fit in one screen height: the figure's width follows the viewport height */
#method .walk{max-width:max(560px,calc((100svh - 225px) * 1100 / 383));margin:0 auto}
.vp{position:relative;aspect-ratio:1100/383;border-bottom:1px solid var(--line);background:#fff;overflow:hidden}
/* the camera: a composited transform on this wrapper (method.js); the figure, veils and overlays move together */
.cam{position:absolute;left:0;top:0;width:100%;aspect-ratio:1100/531;transform-origin:0 0}   /* full figure; the .vp window (1100/383) shows it below the format band */
.cam.anim{transition:transform 1s cubic-bezier(.65,0,.35,1)}
#mfig,.veil{position:absolute;inset:0;width:100%;height:100%;display:block}
#mfig{overflow:visible}
#mfig #band,#mfig>path[d^="M24 152"]{display:none}   /* the format band (BrickNet / ICLF rows + legend) is cropped out of the walkthrough (method.js T0) */
.veil{pointer-events:none;opacity:0;transition:opacity .7s;overflow:visible;will-change:opacity}
.veil.on{opacity:1}
#mfig #ctx-box{transition:height .7s cubic-bezier(.65,0,.35,1)}
#mfig g,#mfig image{transition:opacity .6s ease var(--d,0s),transform .9s cubic-bezier(.65,0,.35,1) var(--d,0s)}
#mfig .card{transform-box:view-box;transform-origin:0 0}
#mfig .ex{opacity:0}
/* the context box: typed lines, row highlights, scrolling context lines */
#mfig .hl{fill:#f0ecfa;stroke:#6450a4;stroke-width:1;opacity:0;transition:opacity .4s,width .3s}
#mfig .hl.on{opacity:1}
#mfig .hlh{fill:#FDECEC;stroke:#C62828}
.aw.f-a3 #mfig #hlh,.aw.f-a4 #mfig #hlg{opacity:1}
#mfig #cur{animation:mblink 1s steps(1) infinite;opacity:0}
.live #mfig #cur{opacity:1}
@keyframes mblink{50%{fill-opacity:0}}
/* the build S */
.live #mfig .sc-hl{opacity:0}
.live.f-a4 #mfig .sc-hl,.live:not(.aw).f-b1 #mfig .sc-hl{opacity:1}
.aw.f-a3 #mfig .sc-veto{opacity:1}
.live.f-end #mfig .sc-placed{opacity:1;transition-delay:.9s}
/* the new part: outlined and bobbing beside the build, titled; a ghost of it hovers over the chosen parent */
.aw.f-a1 #mfig #arch-lab,.aw.f-a1 .arch-ov{opacity:1}
.aw.f-a1:not(.f-a2) #mfig #arch-lab,.aw.f-a1:not(.f-a2) .arch-ov{animation:fadein .6s ease 3.4s both}
@keyframes fadein{from{opacity:0}}
@keyframes fillin{0%{opacity:0}60%{opacity:1}}
@keyframes grow{from{transform:scaleY(0)}}
/* the bobbing arch is an HTML overlay inside the camera: its motion is composited, the SVG is not repainted */
.arch-ov{position:absolute;opacity:0;pointer-events:none;transition:opacity .6s;will-change:transform}
.aw .arch-ov{animation:bob 2.4s ease-in-out infinite}
@keyframes bob{50%{transform:translateY(-6px) rotate(-3deg)}}
.aw.f-a4 #mfig #arch-ghost{opacity:.65}
.off #mfig *{animation-play-state:paused!important}
/* parent-index labels on the build */
.aw.f-a2 #mfig #plabs{opacity:1}
.aw.f-a3 #mfig #lab-hx,.aw.f-a4 #mfig #lab-gx{opacity:1}
.aw.f-a3 #mfig #lab-h{opacity:0}
/* (a) */
.live #mfig #ctx-more,.live #mfig #ctx-arrow,.live #mfig #loop{opacity:0}
.live #mfig #typed{opacity:1}
.live:not(.aw) #mfig #ctx-arrow2,.aw #mfig #ctx-arrow3{opacity:1}
#mfig #ctx-dot{opacity:0;offset-rotate:0deg}
.aw.f-a1:not(.f-a2) #mfig #ctx-dot{animation:travel 1.8s ease-in-out .2s both}
.aw.f-a2:not(.f-a3) #mfig #ctx-dot{animation:travel2 .9s ease-in-out .15s both}
@keyframes travel{0%{opacity:0;offset-distance:0%}12%{opacity:1}88%{opacity:1;offset-distance:100%}100%{opacity:0;offset-distance:100%}}
@keyframes travel2{0%{opacity:0;offset-distance:0%}12%{opacity:1}88%{opacity:1;offset-distance:100%}100%{opacity:0;offset-distance:100%}}
#mfig #llm>rect{transform-box:fill-box;transform-origin:center}
.aw.f-a1:not(.f-a2) #mfig #llm>rect{animation:think .8s ease 1.9s}
.aw.f-a2:not(.f-a3) #mfig #llm>rect{animation:think2 .7s ease .9s}
@keyframes think{40%{transform:scale(1.12);fill:#d9d0f2}}
@keyframes think2{40%{transform:scale(1.12);fill:#d9d0f2}}
.aw.f-a1:not(.f-a2) #mfig #ctx-box{animation:boxflash 1.2s ease}
@keyframes boxflash{30%{stroke:#6450a4;stroke-width:2.4}}
.live:not(.f-a1) #mfig [id^="pt-"]{opacity:0}
.live.f-a1 #mfig #pt-1o{opacity:1}
.aw.f-a1:not(.f-a2) #mfig [id^="pt-"]{animation:fadein .6s ease 2.5s both}
.aw.f-a1:not(.f-a2) #mfig #pt-1{animation:fadein .6s ease 3.4s both}
.live:not(.f-a2) #mfig #pa-0,.live:not(.f-a2) #mfig #pa-h{opacity:0}
.live.f-a2:not(.f-a4) #mfig #pa-1o,.live.f-a2:not(.f-a3) #mfig #pa-2o{opacity:1}
.aw.f-a2:not(.f-a3) #mfig #pa-0,.aw.f-a2:not(.f-a3) #mfig #pa-1o,.aw.f-a2:not(.f-a3) #mfig #pa-2o,.aw.f-a2:not(.f-a3) #mfig #pa-h{animation:fadein .6s ease 1.1s both}
.live:not(.f-a3) #mfig #pa-2,.live:not(.f-a3) #mfig #veto-box,.live:not(.f-a3) #mfig #veto-lab{opacity:0}
.live:not(.f-a4) #mfig #pa-1{opacity:0}
#mfig #pa-1,#mfig #pt-1{transform-box:fill-box;transform-origin:left center}
/* the wide (a): (b) and its arrow are out of the way */
.aw #mfig #panel-b,.aw #mfig #bc-arrow{opacity:0}
/* (b) */
.live:not(.f-b1) #mfig #tuple,.live:not(.f-b1) #mfig #tuple-arrow,.live:not(.f-b1) #mfig #veto-arrow,.live:not(.f-b1) #mfig #oracle{opacity:0}
.live:not(.f-b2) #mfig .card,.live:not(.f-b2) #mfig #or-arrow{opacity:0}
.live:not(.f-b3) #mfig .card .cf{stroke:#C3C9D3;stroke-dasharray:none}
.live:not(.f-b3) #mfig .card .cap text{fill:#4B5563}
.live:not(.f-b3) #mfig .card .mk{opacity:0}
#mfig .mk{transform-box:fill-box;transform-origin:center}
.live.f-b3:not(.f-c1) #mfig .card .mk{animation:pop .5s cubic-bezier(.3,1.6,.5,1) var(--d,0s) both}
@keyframes pop{0%{transform:scale(.2);opacity:0}100%{transform:scale(1);opacity:1}}
/* (c): decoded stage by stage; the token flights, stage charts and sampling fills are timed in the SVG's own <style> */
#mfig .fly{transform-box:view-box;transform-origin:0 0}
.live:not(.f-c1) #mfig #bc-arrow,.live:not(.f-c1) #mfig #ft-root{opacity:0}
.live:not(.f-s3) #mfig #chart-1,.live:not(.f-s3) #mfig #chart-arrow{opacity:0}
#mfig .bar{transform-box:fill-box;transform-origin:50% 100%;transition:transform .8s cubic-bezier(.3,1.25,.5,1) calc(var(--d,0s) + .2s)}
.live:not(.f-s3) #mfig #chart-0 .bar,.live:not(.f-s3) #mfig #chart-1 .bar{transform:scaleY(0)}
#mfig .beta{transition:opacity .4s ease .7s,transform .5s ease .7s}
.live:not(.f-s3) #mfig #chart-1 .beta{opacity:0;transform:translateY(-8px)}
/* the loop: the arrow back to (a) flows once the part is placed */
.live.f-end #mfig #loop{opacity:1}
.live.f-end #mfig #loop path{stroke-dasharray:6 5;animation:flow 1s linear infinite}
@keyframes flow{to{stroke-dashoffset:-11}}
@media (prefers-reduced-motion:reduce){#mfig .arch,#mfig #loop path{animation:none}}

.narr{padding:14px 22px 12px;display:flex;flex-direction:column;gap:10px}
.narr .txt{min-height:4.6em;transition:opacity .3s}
.narr .txt.fade{opacity:0}
.narr .kick{display:block;font-size:.72em;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--mute);margin-bottom:3px}
.narr .kick i{font-style:normal;color:var(--ink2)}
.narr p{margin:0;font-size:.95em;line-height:1.5}
.narr p b{font-weight:600}.narr code{font-family:var(--mono);font-size:.92em;background:var(--soft);padding:0 4px;border-radius:3px}
.ctl{display:flex;align-items:center;justify-content:center;gap:8px}
.ctl button{width:32px;height:32px;border-radius:50%;border:1px solid var(--line);background:#fff;color:var(--ink);font-size:18px;line-height:1;cursor:pointer;display:grid;place-items:center}
.ctl button.play{font-size:10px;letter-spacing:-1px}
.ctl button:hover{background:var(--soft)}
.dots{display:flex;gap:5px;margin:0 6px}
.dots button{position:relative;width:8px;height:8px;padding:0;border:0;border-radius:4px;background:#D3D6DC;cursor:pointer;overflow:hidden;transition:width .3s}
.dots button.on{width:28px}
.dots button i{position:absolute;inset:0;background:var(--ink);transform-origin:left;transform:scaleX(0)}
.dots button.done i{transform:scaleX(1)}
.dots button.on i{transform:scaleX(var(--p,1))}

/* bibtex */
.bib{position:relative;background:var(--soft);border-radius:8px;padding:18px 20px;overflow-x:auto}
.bib pre{margin:0;font:400 14px/1.6 var(--mono)}
.copy{position:absolute;top:10px;right:10px;font:500 13px var(--sans);padding:5px 12px;border-radius:999px;border:1px solid var(--line);background:#fff;color:var(--ink);cursor:pointer}

.foot{margin-top:72px;padding-top:24px;padding-bottom:36px;border-top:1px solid var(--line);font-size:13px;color:var(--mute);text-align:center}

/* theme-only elements (static/css/theme-*.css); hidden in the default look */
.stats{display:none}
.theme-pick{position:fixed;right:14px;bottom:14px;z-index:50;display:flex;gap:4px;align-items:center;background:#1A1D23;color:#fff;border-radius:999px;padding:5px 6px 5px 14px;font:500 13px var(--sans);box-shadow:0 4px 16px #0003}
.theme-pick[hidden]{display:none}
.theme-pick span{opacity:.6;margin-right:4px}
.theme-pick a{color:#fff;text-decoration:none;padding:4px 11px;border-radius:999px}
.theme-pick a.on{background:#fff;color:#1A1D23}
.secnav{display:none}

/* phones: viewers use the full text width (the comparison stacks its three views itself) */
@media (max-width:700px){
  .frame-compare{width:100%;margin-left:0}
  main>section.container{margin-top:48px}
  .authors{font-size:17px}
}
