/* Physical RSI: a graybox plan of a proposed plant. Palette and type come from the site's :root. */
/* The shared stylesheet fades #maincontent in with a transform, which would become the containing block of the fixed stage. */
#maincontent.prsi-main { max-width: none; margin: 0; padding: 0; animation: none; transform: none; }
/* The copy column and the picture beside it are laid out as on the Platform page (/tekton/styles.css). */
.prsi { --hdr: var(--header-h); --copy-w: min(420px, 31vw); --visual-left: calc(5vw + var(--copy-w) + 3vw); background-image: none; }
.prsi p:not(.lead) { text-align: left; -webkit-hyphens: manual; hyphens: manual; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: fixed; left: 15px; top: -60px; z-index: 40; padding: 10px 15px; background: var(--paper); border: 1px solid var(--lavender); color: var(--ink-strong); }
.skip-link:focus { top: 15px; }

.stage { position: fixed; z-index: 1; top: var(--hdr); right: 0; height: calc(100vh - var(--hdr)); height: calc(100svh - var(--hdr)); left: calc(var(--visual-left) - 24px); overflow: hidden; background: var(--paper); }
/* The picture has no edge on the copy's side: it fades into the page. */
.stage::before { content: ""; position: absolute; z-index: 2; inset: 0 auto 0 0; width: 44px; background: linear-gradient(90deg, var(--paper), #16141a00); pointer-events: none; }
/* The picture ends above the schedule board: a heading, four rows and a line of text. */
.stage svg { position: absolute; inset: 0 0 152px 0; width: 100%; height: calc(100% - 152px); }


/* Isometric site (iso3d.mjs). Fills are written by the renderer from one palette; every line is a hairline
   that keeps its width at any zoom: widths are in screen pixels times --u, the drawing units to a pixel at
   the current zoom (scene-iso.mjs keeps it up to date). Inside a group that is already drawn at pixel size
   (.px: cards and their leaders) --u is 1. */
.site { --u: 1; }
.site .px { --u: 1; }
.site .e { fill: none; stroke-width: calc(var(--u) * .9px); stroke-linejoin: round; }
.site .bv { fill: none; stroke-width: calc(var(--u) * .7px); stroke-linecap: round; stroke-linejoin: round; }
.site .sc { fill: var(--ink-muted); fill-opacity: .5; }
.site .pad { fill: #19171e; stroke: var(--rule); stroke-width: calc(var(--u) * 1px); }
.site .road { fill: #18161d; stroke: #23212a; stroke-width: calc(var(--u) * 1px); }
.site .grid { fill: none; stroke: #23212a; stroke-width: calc(var(--u) * 1px); }
.site .plinth { fill: #201e27; stroke: #2e2a35; stroke-width: calc(var(--u) * .8px); }
.site .hot { fill: none; stroke: var(--lavender); stroke-width: calc(var(--u) * 1.3px); }
.site .ret { fill: none; stroke: var(--lavender); stroke-width: calc(var(--u) * 1.6px); }
.site .trc { fill: none; stroke: var(--pink); stroke-width: calc(var(--u) * 1.8px); }
.site .trp { fill: none; stroke: var(--ink-strong); stroke-width: calc(var(--u) * 1.8px); }
.site .refc { fill: none; stroke: var(--ink-muted); stroke-width: calc(var(--u) * 1px); stroke-dasharray: calc(var(--u) * 3px) calc(var(--u) * 3px); }
.site .trk { fill: var(--pink); }
.site .card { fill: var(--surface); stroke: var(--rule); stroke-width: calc(var(--u) * 1px); }
.site .tags { font-family: var(--mono); font-weight: 500; letter-spacing: .14em; fill: var(--ink-muted); }
.site .ft { font-family: var(--mono); font-weight: 500; letter-spacing: .06em; fill: #cfc9d6a6; }
.site .swarf { fill: none; stroke: #f0eef6b8; stroke-width: calc(var(--u) * .7px); stroke-linecap: round; }
/* A cell out of focus is dimmed by a paper-coloured cover over each solid, as strong as --dim on its group;
   a group that is not dimmed has no covers drawn. (A fill opacity, not an opacity: no offscreen layer each.) */
.site .dm { display: none; fill: var(--paper); stroke: none; }
.site .dim .dm { display: inline; fill-opacity: var(--dim); }
.site .coil { fill: none; stroke: #100f14; stroke-width: calc(var(--u) * 1px); stroke-linejoin: round; stroke-linecap: round; }
.site .ctag { font: 500 10px var(--mono); letter-spacing: .12em; fill: var(--ink-muted); }
.site .ck { font: 500 10.5px var(--mono); letter-spacing: .12em; fill: var(--lavender); }
.site .cl { font: 500 11.5px var(--mono); letter-spacing: .02em; fill: var(--ink-strong); }
.site .cbad { font: 500 10px var(--mono); letter-spacing: .1em; fill: var(--pink); }
.site .cok { font: 500 10px var(--mono); letter-spacing: .1em; fill: var(--ink-strong); }
.site .lead { fill: none; stroke: var(--lavender); stroke-width: calc(var(--u) * 1px); }
.site .pin { fill: var(--lavender); }
.captions-off .site .tags { display: none; }

.section .cut { fill: url(#hatch); stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; }
.section .cut2 { fill: url(#hatch2); stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; }
.section rect:not(.solid):not(.pat) { fill: var(--paper); stroke: var(--ink); stroke-width: 2.5; }
.section .axis { stroke: var(--ink-muted); stroke-width: 1.5; stroke-dasharray: 14 5 3 5; }
.section .stop { stroke: var(--ink-strong); stroke-width: 7; }
.section line { stroke: var(--ink); stroke-width: 2.5; }
.section line.axis, .section line.stop { stroke-width: inherit; }
.section .solid { fill: var(--ink-strong); }

.stage svg.inset { position: absolute; z-index: 3; inset: auto 12px 158px auto; width: min(260px, 40%); height: auto; aspect-ratio: 340 / 300; border: 1px solid var(--rule); border-radius: 4px; background: var(--paper); opacity: 0; pointer-events: none; }
.hud { position: absolute; z-index: 3; inset: auto 16px 10px 40px; pointer-events: none; font: 500 11px/1.5 var(--mono); letter-spacing: .4px; color: var(--ink-muted); }
.hud p { margin: 0; max-width: none; }
.vision { margin-left: auto; padding: 2px 8px; border: 1px solid var(--lavender); border-radius: 4px; color: var(--lavender); letter-spacing: 1.1px; font-size: 10px; }
/* Tekton's schedule (schedule.mjs, main.mjs): a row for each part, a chip for each step, left to right in
   the order the steps run. --show brings the board up when the order arrives; a chip is placed by its row
   and column (--row, --col; a column is a share of the width), and --k is how far its step has run. */
.board { --show: 0; --rh: 22px; --label: 96px; --gap: 6px; }
.hud .board-head { display: flex; align-items: center; gap: 14px; height: 22px; margin-bottom: 8px; text-transform: uppercase; letter-spacing: .12em; font-size: 10.5px; white-space: nowrap; }
.board-title, .board-order, .board-status, .board-now { opacity: var(--show); }
.board-title { display: flex; align-items: center; gap: 8px; color: var(--ink-strong); }
.board-title i { width: 14px; height: 1px; background: #a29ca999; }
.board-status { padding: 1px 7px; border: 1px solid var(--rule); border-radius: 4px; color: var(--ink); transition: color .2s ease-out, border-color .2s ease-out; }
.board-status:empty { display: none; }
.board[data-status="complete"] .board-status { border-color: var(--lavender); color: var(--lavender); }
.board-grid { display: flex; height: calc(var(--rh) * 4); }
.board-rows { flex: none; width: var(--label); }
.board-rows span { display: block; height: var(--rh); line-height: calc(var(--rh) - 4px); font-size: 10.5px; letter-spacing: .12em; }
.board-lanes { position: relative; flex: 1; max-width: 720px; }
.chip { position: absolute; left: calc(var(--col) * 100% / var(--cols)); top: calc(var(--row) * var(--rh)); width: calc(100% / var(--cols) - var(--gap)); height: calc(var(--rows) * var(--rh) - 4px); box-sizing: border-box; display: flex; align-items: center; justify-content: center; overflow: hidden; border: 1px solid var(--rule); border-radius: 3px; font-size: 10.5px; letter-spacing: .1em; transition: color .2s ease-out, border-color .2s ease-out, background-color .2s ease-out; }
.chip b { font-weight: 500; white-space: nowrap; }
/* A step that spans several rows has its mark under its name. */
.chip.tall b { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.chip i { position: absolute; left: 0; bottom: 0; width: calc(var(--k) * 100%); height: 2px; background: var(--lavender); }
.chip[data-state="running"] { border-color: var(--lavender); color: var(--ink-strong); }
.chip[data-state="done"] { border-color: #bfa1f566; background: var(--surface); color: var(--ink-strong); }
.chip[data-state="done"] i { background: #bfa1f599; }
.chip[data-state="done"] b::after { content: " ✓"; color: var(--lavender); }
.chip[data-state="failed"] b::after { content: " ✕"; }
/* The step that failed is the one thing in pink while the plan is being changed; afterwards it is history. */
.chip[data-state="failed"] { border-color: var(--pink); color: var(--pink); }
.chip[data-state="failed"] i { background: var(--pink); }
.board:not([data-status="issue found"]) .chip[data-state="failed"] { border-color: var(--rule); color: var(--ink-muted); }
.board:not([data-status="issue found"]) .chip[data-state="failed"] i { background: #a29ca966; }
.hud .board-now { height: 17px; margin-top: 6px; font-size: 11.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-now:not(:empty)::before { content: "▸ "; color: var(--lavender); }

[data-frozen] .chapter:not(.current) { display: none; }
[data-frozen] .chapter.current { min-height: 100svh; }
.chapters { position: relative; z-index: 3; pointer-events: none; }
.chapter { position: relative; min-height: 240svh; }
/* A chapter is as long as it is busy: the ones where the gantry carries and the machines run get more scroll, so nothing has to hurry. */
.chapter[data-chapter="5"] { min-height: 440svh; }
.chapter[data-chapter="4"], .chapter[data-chapter="6"], .chapter[data-chapter="7"] { min-height: 400svh; }
.chapter[data-chapter="1"], .chapter[data-chapter="8"] { min-height: 340svh; }
.chapter[data-chapter="3"] { min-height: 220svh; }
.chapter[data-chapter="9"] { min-height: 200svh; }
.chapter[data-chapter="0"] { min-height: 160svh; }
/* Chapter copy, as on the Platform page: no box. Each chapter's copy holds its place beside the picture while
   the chapter plays, rises a little as it fades in and fades out before the next (main.mjs sets --o and --y from
   the scroll). */
.copy { position: sticky; top: var(--top, max(26svh, 150px)); width: var(--copy-w); margin-left: 5vw; pointer-events: auto; opacity: var(--o, 1); transform: translate3d(0, var(--y, 0px), 0); will-change: opacity, transform; }
.eyebrow { display: flex; align-items: center; gap: 12px; margin: 0 0 24px; font: 500 12px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-muted); }
.eyebrow i { width: 22px; height: 1px; background: #a29ca999; }
.eyebrow .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--lavender); }
.accent { color: var(--lavender); }
.chapter h2 .accent { display: inline-block; }
.chapter h2 { margin: 0 0 22px; font: 700 clamp(26px, 2.8vw, 40px)/1.1 var(--sans); letter-spacing: 0; color: var(--ink-strong); text-wrap: balance; }
/* The opening headline is the page's title: set like the Platform page's. */
.chapter[data-chapter="0"] h2 { font: 700 clamp(28px, 3.1vw, 44px)/1.1 var(--mono); letter-spacing: -.03em; }
.copy > p:not(.eyebrow) { margin: 0; font-size: clamp(14.5px, 1.18vw, 17px); line-height: 1.65; color: var(--ink); text-wrap: pretty; }

.static { position: relative; z-index: 3; display: none; max-width: 760px; margin: 0 auto; padding: 60px 24px; background: var(--paper); }
.static h2 { margin: 0 0 18px; font: 700 clamp(24px, 2.6vw, 34px)/1.15 var(--sans); color: var(--ink-strong); }
.static ol { margin: 0 0 24px; padding-left: 1.3em; color: var(--ink); line-height: 1.65; }
.static li { margin: 0 0 8px; }
.static li b { color: var(--ink-strong); }
.static .note { color: var(--ink-muted); font-size: 13px; }
html:not(.js) .static, .static:target { display: block; scroll-margin-top: var(--hdr); }
html:not(.js) .stage { display: none; }
html:not(.js) .chapter { min-height: 0; padding: 10px 0; }
html:not(.js) .copy { position: static; margin: 0 auto; width: min(640px, 90vw); }
.closing { position: relative; z-index: 3; min-height: 80svh; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 120px 24px; background: var(--paper); }
.closing h2 { font: 500 clamp(32px, 4.8vw, 56px)/1.05 var(--mono); letter-spacing: -.03em; color: var(--ink-strong); margin: 0 0 12px; }
.cta { color: var(--lavender); font: 500 16px var(--mono); }
.tk-footer { position: relative; z-index: 3; display: flex; gap: 20px; padding: 24px 5vw 30px; border-top: 1px solid var(--rule); font: 13px var(--mono); background: var(--paper); }
.tk-footer a { color: var(--ink-muted); }
.tk-footer a:last-child { margin-left: auto; color: var(--lavender); }

.rail-nav { position: fixed; z-index: 5; right: 22px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 9px; }
.rail-nav button { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-height: 10px; padding: 2px 0; border: 0; background: none; cursor: pointer; color: var(--ink-muted); font: 9px var(--mono); letter-spacing: .5px; }
.rail-nav button i { width: 14px; height: 1px; background: #a29ca94d; transition: width .2s, background .2s; }
.rail-nav button[aria-current="step"] { color: var(--lavender); }
.rail-nav button[aria-current="step"] i { width: 22px; background: var(--lavender); }
.rail-nav button:focus-visible { outline: 2px solid var(--lavender); outline-offset: 2px; }

.captions-off .copy, .captions-off .hud, .captions-off .rail-nav { display: none; }
.captions-off .stage { left: 0; }
.captions-off .stage svg { inset: 0; height: 100%; }
.captions-off .stage svg.inset { inset: auto 12px 20px auto; width: min(260px, 40%); height: auto; }


@media (max-width: 820px) and (orientation: portrait) {
  .stage { left: 0; height: calc(52svh - 16px); }
  .stage::before { content: none; }
  .stage svg { inset: 0 0 102px 0; height: calc(100% - 102px); }
  .hud { inset: auto 10px 6px 10px; font-size: 9px; line-height: 1.4; }
  .vision { padding: 1px 6px; font-size: 8px; }
  .board { --rh: 14px; --label: 50px; --gap: 3px; }
  .hud .board-head { height: 16px; margin-bottom: 5px; gap: 8px; font-size: 8px; }
  .board-order { display: none; }
  .board-status { padding: 0 5px; }
  .board-rows span { line-height: calc(var(--rh) - 3px); font-size: 7.5px; letter-spacing: .08em; }
  .chip { height: calc(var(--rows) * var(--rh) - 3px); font-size: 7.5px; letter-spacing: .02em; }
  .hud .board-now { height: 13px; margin-top: 3px; font-size: 9.5px; }
  .stage svg.inset { inset: auto 8px 108px auto; width: 38%; }
  .chapter { min-height: 200svh; }
  .chapter[data-chapter="4"], .chapter[data-chapter="5"], .chapter[data-chapter="6"] { min-height: 340svh; }
  .chapter[data-chapter="1"], .chapter[data-chapter="7"], .chapter[data-chapter="8"] { min-height: 300svh; }
  .chapter[data-chapter="2"], .chapter[data-chapter="3"] { min-height: 240svh; }
  /* The copy scrolls with the page, as on the Platform page: a chapter's copy rises into its place under the
     picture, holds there, and the next one pushes it out. Its lines fade out in the strip above that place
     (main.mjs sets --cut from the scroll), before they reach the picture. A copy too long for the screen
     moves up through the middle of its chapter by what does not fit (--shift), so its end can be read. */
  .chapter { display: flow-root; }
  .copy { --line: calc(52svh - 16px + var(--hdr) + 16px); top: calc(var(--line) - var(--shift, 0px)); width: auto; margin: var(--line) 6vw calc(56px - var(--line)); will-change: auto;
    -webkit-mask-image: linear-gradient(#0000 calc(var(--cut, 0px) - 24px), #000 var(--cut, 0px)); mask-image: linear-gradient(#0000 calc(var(--cut, 0px) - 24px), #000 var(--cut, 0px)); }
  .chapter h2 { font-size: clamp(24px, 6.6vw, 30px); margin-bottom: 12px; }
  .chapter[data-chapter="0"] h2 { font-size: clamp(24px, 6.8vw, 32px); }
  .copy > p:not(.eyebrow) { font-size: 14.5px; line-height: 1.55; }
  .eyebrow { margin-bottom: 12px; font-size: 9px; }
  .rail-nav { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .js .static { display: block; }
  .copy { max-height: calc(100svh - var(--hdr) - 40px); overflow: auto; opacity: 1 !important; transform: none !important; will-change: auto; }
  .chip, .board-status { transition: none; }
}
