/* The app's window, drawn as the app draws it: its frame and top bar, the objective's page, and the
   reader's card (appWindow/). Sizes are the app's own px; the stage sets how near the window stands.
   Each part is shown by the data-state its stage carries. blocks.css draws what a project's page and the
   card's drawing hold of their own.
   The page without script shows pictures of this window: after a change to how it or a feature draws, here or in
   another sheet, run `node scripts/stills.mjs` (src/stillPictures.js). */

.cam {
  /* Two colours stet.css has no name for: a canvas shape's fill, and a property in code. */
  --shape: #f1e4d8; --code-property: #2f7d86;
  /* The look of the writer's own project, which the reader's drawing and the project's page wear. */
  --own-paper: #ffffff; --own-ink: #14171a; --own-soft: #5a6470; --own-line: #e3e6ea; --own-surface: #f3f5f7; --own-accent: #1f4fd8; --own-on: #ffffff;
  /* Where the window's parts stand, from the window's own corner: the hero's window, in every section.
     The page stands --aside left of the window's middle, and what stands beside it keeps its place from the middle.
     The build's panel takes what the page leaves at the window's right side, less the card's 28 px, up to the app's least, 360. */
  --win-w: calc(var(--stage) - 200px); --win-h: 2000px; --page-y: 88px; --page-w: 520px; --aside: 60px; --page-x: calc((var(--win-w) - var(--page-w)) / 2 - var(--aside)); --panel-w: min(360px, var(--win-w) - var(--page-x) - var(--page-w) - 36px);
  position: absolute; left: 0; top: 0; transform-origin: 0 0;
}
@media (prefers-color-scheme: dark) { .cam { --shape: #2e2620; --code-property: #7fc4cb; --own-paper: #121416; --own-ink: #e8eaed; --own-soft: #9aa3ad; --own-line: #2a2f36; --own-surface: #1d2126; --own-accent: #7da2ff; --own-on: #0b1020; } }

.win { position: absolute; left: 0; top: 0; width: var(--win-w); height: var(--win-h); background: var(--panel); border: 1px solid var(--hairline); border-radius: 12px; box-shadow: 0 18px 44px -24px var(--deep); }
.paper { position: absolute; left: 8px; right: 8px; top: 52px; bottom: 8px; overflow: hidden; background: var(--paper); border-radius: 14px; box-shadow: 0 1px 3px var(--lift); }
.cam svg { display: block; flex: none; }

/* ---- the top bar ---- */
.winbar { position: absolute; left: 0; right: 0; top: 0; height: 52px; padding: 8px 16px 0 0; display: flex; align-items: center; gap: 4px; font-size: 13px; line-height: 1.3; color: var(--muted); white-space: nowrap; }
/* The bar stands back while the words beside it are the page's own. */
:is([data-state^="hero"], [data-state^="reader"], [data-state^="cue"], [data-state^="ending"]) .winbar { opacity: .45; }
.winbar > * { flex: none; }
.winbar .lights { width: 78px; padding-left: 16px; display: flex; gap: 8px; }
.winbar .lights i { width: 12px; height: 12px; border-radius: 50%; background: var(--hairline); }
.winbar .tool { width: 30px; height: 26px; display: grid; place-items: center; color: var(--faint); }
.winbar .project { padding: 0 6px 0 8px; }
.winbar .project i { font-style: normal; color: var(--faint); margin-left: 6px; }
.winbar .tab { align-self: stretch; display: flex; align-items: center; padding: 0 16px; background: var(--paper); border-radius: 10px 10px 0 0; color: var(--ink); }
.winbar .tab b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.winbar .right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.winbar .chip { height: 24px; padding: 0 8px; border-radius: 6px; display: grid; place-items: center; }
.winbar .settings { padding: 0 8px; font-size: 11px; font-weight: 500; }
.winbar .me { width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: var(--paper); display: grid; place-items: center; font-size: 11px; font-weight: 600; }
.winbar .pen { display: none; }
[data-state="project-start"][data-moving=""] .winbar .compass { background: var(--hairline); color: var(--ink); }
[data-state^="project"]:not([data-state="project-start"]) .winbar .pen { display: grid; }
[data-state^="project"]:not([data-state="project-start"]) .winbar .compass, :is([data-moving="point"], [data-state="project-2"], [data-state="project-sent"]) .winbar .pen { background: var(--paper); box-shadow: 0 1px 3px var(--lift); color: var(--ink); }

/* ---- the objective's page ---- */
.doc { position: absolute; left: var(--page-x); top: var(--page-y); width: var(--page-w); }
[data-state^="project"]:not([data-state="project-start"]) .doc { display: none; }
.doc .t { font-size: 24px; line-height: 1.2; font-weight: 650; letter-spacing: -0.018em; color: var(--ink-strong); white-space: nowrap; }
.doc .t .caret { height: 23px; visibility: hidden; }
[data-state^="hero"] .doc .t .caret { visibility: visible; }
.doc .body { display: flow-root; }
.doc h5 { margin: 1.15em 0 0; font-size: 18.9px; line-height: 1.3; font-weight: 600; letter-spacing: -0.012em; color: var(--ink-strong); }
.doc .body > p { margin: .6em 0 0; }
.doc ul { margin: .5em 0 0; padding-left: 1.1em; }
.doc li::marker { color: var(--faint); }
.doc .body b { font-weight: 600; }
.doc .canvas { margin: .8em 0 0; height: 96px; border: 1px solid var(--hairline); border-radius: 6px; background-image: radial-gradient(var(--hairline) 1px, transparent 1px); background-size: 14px 14px; background-position: 7px 7px; display: flex; align-items: center; justify-content: center; }
.shape { flex: none; font: 12px/1.5 var(--face-mono); color: var(--ink-strong); background: var(--shape); border: 1.5px solid var(--ink); border-radius: 7px; padding: 7px 20px; white-space: nowrap; }
.arrow { position: relative; width: 54px; height: 1.5px; background: var(--ink); }
.arrow::after { content: ""; position: absolute; right: -1px; top: -4px; border-left: 8px solid var(--ink); border-top: 4.5px solid transparent; border-bottom: 4.5px solid transparent; }
.doc pre { margin: .8em 0 0; background: var(--panel); border-radius: 6px; padding: 12px 16px; font: 12.5px/1.6 var(--face-mono); }
.doc pre .k { color: var(--red); } .doc pre .n { color: var(--whisper); } .doc pre .p { color: var(--code-property); }
.cam code { font: .9em var(--face-mono); background: var(--hairline); border-radius: 4px; padding: 0 3px; color: var(--muted); }

/* The sentence the reader asks about, and, from the cue's section on, the sentence its change left. Its
   line is drawn by appWindow/threadLine.js. */
.claim.asked { padding-bottom: 2px; }
.cam .inkline { display: none; position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; }
:is([data-state^="hero"], [data-state^="reader"]) .cam .inkline { display: block; }
.inkline path { fill: none; stroke: var(--hue-slate); stroke-width: 1.4px; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1 2; stroke-dashoffset: 1.01; }
.cam.drawing .inkline path { stroke-dashoffset: 0; transition: stroke-dashoffset var(--takes) cubic-bezier(.35, .1, .45, 1) var(--after); }
.cam.drawn .inkline path { stroke-dasharray: none; stroke-dashoffset: 0; transition: none; }
.claim.settled { display: none; }
:is([data-state^="cue"], [data-state="project-start"], [data-state^="plan"], [data-state^="ending"]) .claim.settled { display: inline; }
:is([data-state^="cue"], [data-state="project-start"], [data-state^="plan"], [data-state^="ending"]) .claim.asked { display: none; }

/* ---- the reader's card ---- */
/* It hangs from the end of its sentence's paragraph: up and to the right of the page, level with the sentence. */
.beside { position: relative; z-index: 2; height: 0; }
.card { display: none; position: absolute; left: calc(548px + var(--aside)); top: -63px; width: 278px; padding: 16px; background: var(--paper); border: 1px solid var(--hairline); border-radius: 10px; box-shadow: 0 1px 3px var(--lift); }
:is([data-state^="hero"], [data-state^="reader"]) .card { display: block; }
/* The reader's card comes once its line is drawn. */
.cam:not(.drawn) .card { visibility: hidden; opacity: 0; }
.card { transition: opacity var(--duration) linear; }
.card .top { position: absolute; left: 10px; right: 10px; top: -9px; display: flex; justify-content: space-between; font: 500 11px/18px var(--face-sans); color: color-mix(in srgb, var(--hue-slate) 70%, var(--ink)); }
.card .top > span { display: flex; align-items: center; gap: 9px; padding: 0 6px; background: var(--paper); }
.card .kind::before { content: "●"; margin-right: -4px; font-size: 9px; color: var(--hue-slate); }
.card :is(.top svg, .open) { color: var(--muted); }
.card .turn { font: 15px/23.25px var(--face-serif); color: var(--ink); }
.card .v { display: none; }
:is([data-state^="hero"], [data-state="reader-1"]) .v1 { display: block; }
[data-state="reader-2"] .v2, [data-state="reader-3"] .v3 { display: flex; flex-direction: column; }
.card .v1 .turn { padding-right: 24px; }
.card .open { position: absolute; right: 10px; bottom: 10px; }

/* Open: the drawing under the card's line, the conversation, and the field to reply in. */
.card .frame { flex: none; border: 1px solid var(--hairline); border-radius: 6px; overflow: hidden; }
/* Opened, the card is no taller than the screen has room for, and the conversation stands at its newest turn, as the app's does.
   The card's top stands 171 down the stage and is drawn at 1.1 at most (the reader's framing in stage/framings.js). */
.card :is(.v2, .v3) { max-height: calc((100vh / var(--k) - 187px) / 1.1 - 34px); }
.card .talk { position: relative; display: flex; flex-direction: column; justify-content: flex-end; gap: 10px; min-height: 0; padding-top: 8px; overflow: hidden; }
.card .talk > * { flex: none; }
/* A turn cut by the drawing above it fades under its edge; with room for every turn this stands over the space between them. */
.card .talk::before { content: ""; position: absolute; left: 0; right: 0; top: 0; z-index: 1; height: 8px; background: linear-gradient(var(--paper), transparent); }
/* The question is the first turn, and has scrolled part way off. */
.card .turn.faded { max-height: 69.75px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.card .said { width: fit-content; max-width: 88%; margin-left: auto; padding: 8px 16px; border-radius: 14px; background: color-mix(in srgb, var(--ink) 10%, var(--paper)); font-size: 15px; line-height: 1.5; color: var(--ink-strong); }
/* Under the answer it was drawn with, nearer than one turn is to the next. */
.card .caption { margin-top: -2px; font-size: 12px; line-height: 1.4; color: var(--muted); }
.card .replyrow { flex: none; margin-top: 12px; display: flex; align-items: center; gap: 8px; color: var(--muted); }
.card .reply { flex: 1; height: 32px; padding: 0 12px; display: flex; align-items: center; border: 1px solid var(--hairline); border-radius: 6px; background: var(--panel); font-size: 12px; color: var(--faint); }

/* The change the reader offers: the writer's words struck, the new ones under them, how many changed, and the writer's answer. */
.card .change { padding: 8px 14px 12px; border-radius: 4px; background: var(--panel); color: var(--muted); }
.change .edit, .change .count { font-size: 11px; }
.change .count { margin-top: 4px; }
.change .old, .change .new { font: 13px/1.45 var(--face-serif); }
.change .old { margin-top: 8px; text-decoration: line-through; }
.change .new { margin-top: 4px; color: var(--ink-strong); text-decoration: underline; text-decoration-color: var(--whisper-underline); text-underline-offset: 3px; }
.change .answers { margin-top: 10px; display: flex; gap: 16px; font-size: 12.5px; }
.change .answers b { font-weight: 600; color: var(--whisper); }
