/* The colours are the archbox desktop skin's, by its names and its law, as Ikkuna's look has them: teal is live
   signal only, periwinkle is identity only, red is state. */
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; src: url(vendor/plex/IBMPlexMono-Regular.ttf); font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; font-weight: 700; src: url(vendor/plex/IBMPlexMono-Bold.ttf); font-display: swap; }

:root {
  --bg: #04070b;        /* the field */
  --bar: #060b10;       /* a strip */
  --raised: #0b1419;    /* the raised plane */
  --hair: #132630;      /* hairlines */
  --fg: #d9eef0;        /* headline ink */
  --paper: #b2c4c8;     /* reading ink */
  --dim: #9cbcc2;       /* secondary ink */
  --muted: #6e9299;     /* recessed ink */
  --edge: #3e5c66;      /* furniture */
  --live: #6fe3d6;
  --name: #9aa6ff;
  --urgent: #ff5f6d;
  --literal: #cbb98d;   /* a string or number in code */
  --head: 30px;         /* a plane's head, two of the dump's lines; the shader reads it off the element */
  --mono: "IBM Plex Mono", ui-monospace, "DejaVu Sans Mono", monospace;
}

* { box-sizing: border-box; }

html { background: var(--bg); }
body { margin: 0; color: var(--fg); }

body { font: 14px/1.6 var(--mono); -webkit-font-smoothing: antialiased; }

.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 0 44px;
  overflow: hidden;
  isolation: isolate;
}

/* the under: a window of it higher than the screen, in the page so it scrolls with what stands on it; the script
   moves it to where the page is scrolled to. Its height is the screen's largest, so a phone's bars do not resize it */
#field { position: absolute; left: 0; top: 0; width: 100%; height: calc(100vh + 480px); height: calc(100lvh + 480px); z-index: -1; }

/* a strip above, the field under it */
.top { margin: 0 -44px; padding: 0 44px; background: var(--bar); }
.top { height: 52px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--hair); font-size: 14px; line-height: 1; }
.mark { font-weight: 700; color: var(--name); letter-spacing: .08em; font-size: 18px; }
.tag { color: var(--muted); }

.stage {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  grid-template-areas: "words scene";
  column-gap: clamp(40px, 5vw, 84px);
  align-items: center;
  padding: 18px 0;
}

.words { grid-area: words; }
.scene { grid-area: scene; min-width: 0; display: flex; justify-content: flex-end; }

/* a plane: the shader draws it, its head and its outline where this box is; the text is here. What has data-stand
   the script stands on the dump's cells: whole characters wide, whole lines high, on a line */
.plane { position: relative; display: flex; flex-direction: column; }
.head { flex: none; height: var(--head); padding: 0 12px 0 28px; display: flex; justify-content: space-between; align-items: center; font-size: 12px; line-height: 1; }
.head span { color: var(--muted); }

h1 { margin: 0; font: 700 clamp(26px, 3.2vw, 46px)/1.15 var(--mono); letter-spacing: -.02em; white-space: nowrap; }

/* the file a run is made by: its name, what is in it, and the command that runs it */
.name { margin: 38px 0 8px; font-size: 12px; line-height: 1; color: var(--muted); }
.file { margin: 0; font: 13px/1.5 var(--mono); color: var(--dim); }
.does { margin: 26px 0 0; font-size: 13px; line-height: 1; }
.does b { font-weight: 400; color: var(--fg); }
.does b::before { content: "$ "; color: var(--muted); }

/* the room, as wide as a column of the dump where there is room for it */
#room { width: 100%; max-width: 616px; height: 390px; }

/* the run, in the dump's own face and on its cells: a line a line. A summary, then each condition and its sessions: a
   session's name is teal while it works, its bar is how much of the corpus it has read, then its last tool call */
#session { flex: 1; min-height: 0; overflow: hidden; padding: 15px 14px; font-size: calc(35px / 3); line-height: 15px; white-space: pre; color: var(--dim); }
#session p { margin: 0; overflow: hidden; text-overflow: ellipsis; }
#session .summary { color: var(--fg); }
#session .condition { display: grid; grid-template-columns: 8ch minmax(0, 1fr) auto; column-gap: 1ch; margin-top: 15px; color: var(--muted); }
#session .condition b { color: var(--name); }
#session .condition .said { overflow: hidden; text-overflow: ellipsis; }
#session .condition em { font-style: normal; color: var(--fg); }
#session .row { display: grid; grid-template-columns: 8ch 22ch 5ch minmax(0, 1fr); column-gap: 1ch; }
#session .row b { font-weight: 400; color: var(--dim); }
#session .row[data-state="working"] b { color: var(--live); }
#session .row[data-state="waiting"] { opacity: .35; }
#session .row i { align-self: center; height: 7px; background: linear-gradient(var(--dim), var(--dim)) 0 0 / calc(var(--read, 0) * 100%) 100% no-repeat, var(--hair); }
#session .row .count { text-align: right; }
#session .row .last { overflow: hidden; text-overflow: ellipsis; color: var(--muted); }

/* time: a gauge to drag, three of the dump's lines high and on its cells. The shader shows it out of the dump: two
   lines of blocks across, lit as far as the replay is, and a mark a line taller where the run was armed, where it
   was started and where it ended. Here it is only where the pointer takes hold; without Skia it is a track. */
#time { position: relative; height: 45px; margin-bottom: 30px; cursor: ew-resize; touch-action: none; user-select: none; -webkit-user-select: none; }
#time > * { display: none; pointer-events: none; }
.plain #time::before { content: ""; position: absolute; left: 0; right: 0; top: 28px; height: 4px; background: var(--edge); }
.plain #time > * { display: block; position: absolute; }
.plain #time .mark { left: calc(100% * var(--at)); top: 24px; width: 1px; height: 12px; background: var(--fg); }
.plain #now { left: 0; top: 28px; width: calc(100% * var(--at, 0)); height: 4px; background: var(--dim); }

/* the hero's one plain sentence: what it is, before anything else */
.lede { margin: 22px 0 0; max-width: 52ch; white-space: normal; font-size: 14px; line-height: 1.6; color: var(--paper); }

/* three facts under it, a figure each */
.facts { margin: 22px 0 0; padding: 0; list-style: none; color: var(--paper); }
.facts b { display: inline-block; min-width: 6ch; color: var(--fg); }
.name span { color: var(--edge); }

/* the sections between the two screens: a sheet on the field, the field showing at its sides */
.part { padding: 30px 44px; }
.sheet { max-width: 1040px; margin: 0 auto; padding: 40px 44px 44px; background: var(--bg); border: 1px solid var(--hair); }
h2 { margin: 0 0 26px; font: 700 20px/1.3 var(--mono); color: var(--fg); letter-spacing: -.01em; }
h2 i { font-style: normal; font-weight: 400; color: var(--muted); margin-right: 2ch; }
.say { margin: 0 0 26px; max-width: 78ch; color: var(--paper); }
.say:last-child { margin-bottom: 0; }
code { font: inherit; color: var(--fg); }
a { color: var(--fg); text-decoration-color: var(--edge); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--fg); }

/* a term on its own line, its facts as short lines beside it */
.terms { margin: 0 0 26px; display: grid; grid-template-columns: 14ch minmax(0, 1fr); gap: 18px 3ch; }
.terms:last-child { margin-bottom: 0; }
.terms dt { color: var(--name); font-weight: 700; }
.terms dd { margin: 0; padding-left: 3ch; border-left: 1px solid var(--hair); }
.terms dd span { display: block; color: var(--paper); }
.terms dd b { color: var(--fg); }

/* a run of steps, numbered */
.steps { margin: 0 0 30px; padding: 0; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 4ch 1fr; color: var(--paper); }
.steps li::before { content: counter(step); color: var(--muted); }

/* the counts, side by side on hairlines */
.figures { display: flex; flex-wrap: wrap; margin: 0 0 30px; border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair); }
.figures p { flex: 1 1 160px; margin: 0; padding: 18px 0; display: flex; flex-direction: column; gap: 4px; }
.figures:last-child { margin-bottom: 0; }
.figures b { font-size: 30px; line-height: 1.1; color: var(--fg); }
.figures span { color: var(--muted); font-size: 13px; }

/* the diagram: furniture in the furniture's ink, names in identity's, the links in signal's */
.wide { overflow-x: auto; margin: 0 0 26px; }
.diagram { display: block; width: 100%; height: auto; font-family: var(--mono); }
.diagram .frame { fill: none; stroke: var(--edge); stroke-dasharray: 4 4; }
.diagram .box { fill: var(--raised); stroke: var(--edge); }
.diagram .outside { fill: none; }
.diagram .inner { fill: var(--bar); stroke: var(--hair); }
.diagram .name { fill: var(--name); font-size: 15px; font-weight: 700; }
.diagram .line { fill: var(--paper); font-size: 13px; }
.diagram .label { fill: var(--dim); font-size: 13px; }
.diagram .via { fill: var(--fg); font-size: 13px; }
.diagram .what { fill: var(--fg); font-weight: 700; }
.diagram .link { fill: none; stroke: var(--live); stroke-width: 1.5; }
.diagram .tip { fill: var(--live); }

/* the second screen's heading and what the rung shown is */
/* the scenarios' sheets stand in the same column as the sections' above, the ladder over them on the dump */
.picture, .listing { width: min(1040px, 100% - 88px); margin-left: auto; margin-right: auto; padding: 40px 44px 44px; background: var(--bg); border: 1px solid var(--hair); }
.heading { width: fit-content; max-width: calc(100% - 88px); margin: 110px auto 0; text-align: center; }
.heading p { margin: 0 0 16px; font-size: 13px; line-height: 1; color: var(--muted); }
.heading h2 { margin: 0; font: 700 clamp(17px, 1.5vw, 22px)/1.35 var(--mono); letter-spacing: -.01em; color: var(--fg); }
#question, #about { max-width: 90ch; }
#question { margin-top: 0; margin-bottom: 10px; font-size: 18px; font-weight: 700; line-height: 1.4; color: var(--fg); }
#about { margin-top: 0; margin-bottom: 26px; color: var(--paper); }
.key { margin-top: 22px; margin-bottom: 0; display: flex; flex-wrap: wrap; gap: 6px 4ch; font-size: 14px; color: var(--dim); }
.key b { font-weight: 400; font-size: 18px; margin-right: .5ch; }
.key .dot { color: var(--fg); }
.key .snap { color: var(--name); }
.key .arrow { color: var(--live); }

/* the scenario's script, on a sheet like the sections' */
.listing { margin-top: 0; margin-bottom: 60px; overflow-x: auto; }
.listing .name { margin: 0 0 14px; }
#script { margin: 0; font: 13px/1.5 var(--mono); color: var(--dim); }
#script > span { display: block; }

/* C#: types are names, so periwinkle; keywords and calls in headline ink; literals in --literal */
:is(.file, #script) .keyword, :is(.file, #script) .call { color: var(--fg); }
:is(.file, #script) .type { color: var(--name); }
:is(.file, #script) .string, :is(.file, #script) .number { color: var(--literal); }
:is(.file, #script) .comment { color: var(--muted); }

/* the foot: a strip like the top's */
.foot { height: 44px; padding: 0 44px; display: flex; justify-content: space-between; align-items: center; gap: 2ch; background: var(--bar); border-top: 1px solid var(--hair); font-size: 13px; color: var(--muted); }

/* the example scenarios, a screen of their own: the ladder's rungs at its head, each a button the size of its name
   in the under's big letters, which the shader shows; under them the rung's picture, one run of its script left to
   right, and its script. In the picture what the sweep has not reached yet is furniture's ink, and what it has passed
   is lit: a message in signal's, a snapshot in identity's. */
.flow { position: relative; min-height: 100svh; display: flex; flex-direction: column; }
#ladder { flex: none; padding: 30px 44px 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 30px 35px; }
#ladder button { flex: none; white-space: nowrap; width: calc(var(--chars) * 7px); height: 75px; padding: 0; border: 0; background: none; overflow: hidden; font: 700 13px/1 var(--mono); color: transparent; cursor: pointer; }
#ladder button:focus-visible { outline: 1px solid var(--edge); outline-offset: 7px; }
.picture { margin-top: 30px; margin-bottom: 30px; }
.picture .wide { margin: 0; }
.defs { position: absolute; }
.shape { margin: 0; }
.shape[hidden] { display: none; }
.shape .lane { fill: none; stroke: var(--edge); }
.shape .lane.later { stroke-dasharray: 2 5; }
.shape .msg { fill: none; stroke: var(--live); stroke-width: 1.5; marker-end: url(#tip-on); }
.shape .step circle { fill: var(--fg); stroke: var(--fg); }
.shape .snap path { fill: var(--name); stroke: var(--name); }
.shape .frame { fill: var(--raised); }
.shape .label, .shape .via { font-size: 12px; }
.shape .what { font-size: 13px; }
.shape .via { fill: var(--fg); paint-order: stroke; stroke: var(--raised); stroke-width: 5px; stroke-linejoin: round; }
.shape .via.open { stroke: var(--bg); }
.shape .playhead { stroke: var(--live); stroke-opacity: .35; }
.shape:not(.playing) .playhead, .shape .playhead.done { visibility: hidden; }
.playing .ev:not(.on) .msg { stroke: var(--edge); marker-end: url(#tip-off); }
.playing .ev:not(.on) circle, .playing .ev:not(.on) path:not(.msg) { fill: var(--bg); stroke: var(--edge); }
.playing .ev:not(.on) .via { fill: var(--muted); }

/* without Skia: the planes are CSS's, and the replay runs all the same */
.plain #field { visibility: hidden; }
.plain .plane { border: 1px solid var(--edge); background: var(--raised); }
.plain .head { position: relative; background: var(--bar); border-bottom: 1px solid var(--hair); }
.plain .head::before { content: ""; position: absolute; left: 11px; width: 7px; height: 7px; border: 1px solid var(--edge); }
.plain #ladder button { width: auto; height: auto; padding-right: 8px; font-size: 40px; line-height: 45px; text-transform: uppercase; color: var(--muted); }
.plain #ladder button[aria-pressed="true"] { color: var(--fg); }
.plain body:is([data-room="up"], [data-room="wreck"], [data-room="wrecked"]) #head::before { border-color: var(--live); background: var(--live); }
.plain body[data-room="wrecked"] #room, .plain body[data-room="down"] #room { background: none; }
.plain body[data-room="gone"] #room { visibility: hidden; }

@media (max-width: 1180px) {
  .stage { grid-template-columns: minmax(0, 1fr); grid-template-areas: "words" "scene"; row-gap: 28px; }
  .scene { justify-content: flex-start; }
}

@media (max-width: 880px) {
  .hero { padding: 0 20px; }
  .top { margin: 0 -20px; padding: 0 20px; }
  #ladder { padding: 45px 20px 0; }
  .heading { max-width: calc(100% - 40px); margin-top: 80px; }
  .shape { min-width: 900px; }
  .top { gap: 16px; }
  .tag { font-size: 12px; line-height: 1.25; text-align: right; }
  .file { overflow-x: auto; padding-bottom: 6px; }
  h1 { white-space: normal; }
  .part { padding: 30px 12px; }
  .sheet { padding: 28px 20px; }
  .terms { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .terms dd { padding-left: 2ch; margin-bottom: 12px; }
  .terms dd span + span { margin-top: 6px; }
  .diagram { min-width: 860px; }
  .picture, .listing { width: auto; margin-left: 12px; margin-right: 12px; padding: 28px 20px; }
  .foot { height: auto; padding: 14px 20px; flex-direction: column; align-items: flex-start; }
}
