/* The assistant's page — a letter. A centred letterhead with the address at the top-left, the date at
   the top-right, and the conversation set as the letter's body at the foot: the assistant's lines
   indented like paragraphs, the visitor's flush. No dashes. Composition from Johan's third frame
   (Fred-Perry file, node 15193-22608, 26 Oct 2026).

   DRAFT FLAGS:
   1. The typewriter face has no studio token (type.family has primary and ui only) — a local
      variable until the site's type decision; Courier New (Courier Prime was tried on 26 Oct and set aside).
   2. The frame's line pitch is 15 at 12; the studio pairs are 12/14 and 12/16 — 16 taken, to be judged.
   3. The measures (letterhead 32ch, body 55ch), the body's left at a quarter of the width, the
      paragraph indent (4ch): read from the frame in characters of the face — typographic, flagged.
   4. The page inset is space.32 all round (the frame's ~90 was tried as space.96 and brought back
      to 32, Johan, 26 Oct); the bottom of the body space.80 — read from the frame.
   5. The 768 breakpoint literal, as in site.css. */
:root { --site-family-mono: "Courier New", Courier, monospace; } /* Courier Prime was tried for a morning and set aside (Johan, 26 Oct) */

* { box-sizing: border-box; margin: 0; }
html, body { min-height: var(--fence-screen-h); }
/* The page on Johan's grid (frame 6864, 26 Oct 2026): twelve equal columns inside the 32 inset; the
   letterhead on the last three, the date and the conversation on columns four to seven. Three rows:
   the head, the empty middle, the foot the conversation rests on. */
body {
  position: relative;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: auto 1fr auto;
  padding: var(--space-24) var(--space-32) var(--space-32); /* 24 at the top, 32 at the sides and foot (Johan, 26 Oct) */
  color: var(--color-text-primary);
  font-family: var(--site-family-mono);
  font-weight: var(--type-weight-regular);
  font-size: var(--type-size-sm);   /* one step up from xs/16 (Johan, 26 Oct 2026) */
  line-height: var(--type-leading-16);  /* 14 on 16: a touch tighter than the 18 pair (Johan, 26 Oct 2026) */
  letter-spacing: var(--type-tracking-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-underline-offset: 20%;
}
a { color: inherit; }
/* A link in the dialogue wears brackets, not an underline — a typewriter's way of marking (Johan, 26 Oct 2026) */
.dialogue a { text-decoration: none; }
.dialogue a::before { content: "["; }
.dialogue a::after { content: "]"; }
.dialogue a:hover { color: var(--color-text-secondary); }

/* The letterhead: columns ten to twelve, centred on itself, in the display face (Arial Black 20 on 110%) */
:root { --site-family-display: "Arial Black", "Archivo Black", "Arial Bold", Arial, sans-serif; } /* no studio token for a display face yet — flagged */
/* Phones ship no Arial Black (Android has no Arial at all), so the letterhead fell to a synthesised bold there (Johan, 26 Oct).
   Archivo Black (SIL OFL) is its near-twin and stands in; the browser fetches it only where the real face is missing, since
   "Arial Black" is consulted first in the stack. A draft choice — Johan to judge it against the real one. */
@font-face { font-family: "Archivo Black"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("vendor/fonts/archivo-black.woff2") format("woff2"); }
/* The letterhead is always at the top: pinned to the viewport over the last four columns, so a long
   conversation scrolls beneath it (Johan, 26 Oct) */
.letterhead { position: fixed; top: var(--space-24); right: var(--space-32); width: calc((100vw - 2 * var(--space-32)) / 3); display: flex; justify-content: center; align-items: flex-start; z-index: 1; }
.sender {
  text-decoration: none; /* mobile Chrome underlines what it takes for an address; the page also switches that detection off */
  font-family: var(--site-family-display);
  font-weight: var(--type-weight-bold);
  font-size: var(--type-size-xl);
  line-height: var(--type-leading-20); /* 20 on 20 (Johan, 26 Oct; 22 before) */
  font-style: normal;
  text-align: center;
}
/* The date: column four, a way down the page */
.dateline { grid-column: 4 / 8; grid-row: 1; margin-top: var(--space-256); transition: transform var(--motion-duration-base) var(--motion-easing-standard); } /* rises out of the conversation's way (set from the script) */
@media (prefers-reduced-motion: reduce) { .dateline { transition: none; } }

/* The letter's body: columns four to seven, resting on the foot. It is bounded: when the exchange outgrows the
   room above the foot, the dialogue scrolls inside it and the oldest lines leave the top, so your line never
   moves and is never lost below the screen (Johan, 26 Oct). */
.letter { grid-column: 4 / 8; grid-row: 3; padding-bottom: var(--space-64); display: flex; flex-direction: column; max-height: calc(100svh - var(--space-256) - var(--space-128)); }
.dialogue { flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: none; overscroll-behavior: contain; }
.dialogue::-webkit-scrollbar { display: none; }
.ask { flex: none; }

/* Demonstrations (Johan, 26 Oct 2026): a button in an answer, dressed like a link */
.dialogue button.demo { all: unset; cursor: pointer; text-indent: 0; } /* a button keeps an inner box that would inherit the paragraph's indent (26 Oct) */
.dialogue button.demo::before { content: "["; }
.dialogue button.demo::after { content: "]"; }
.dialogue button.demo:hover { color: var(--color-text-secondary); }
.dialogue button.demo:focus-visible { outline: var(--stroke-hairline) solid var(--color-stroke-primary); outline-offset: var(--space-4); }
/* the face: the relief canvas fills the page behind everything */
#relief { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; display: block; }
#relief[hidden] { display: none; } /* the stop hides it by attribute; the rule above must not win (it did, 26 Oct) */
/* All the page's type blends by DIFFERENCE, always (Johan, 26 Oct): white ink in difference reads dark on the
   light page and light on the dark page by itself, and over the face's relief it reads on light and dark parts
   alike. The ground is painted on the root so the blend can reach it and the relief canvas. */
html { background: var(--color-bg-primary); }
body { background: transparent; }
.letter, .dateline, .letterhead { mix-blend-mode: difference; color: var(--color-text-inverse); }
[data-color-mode="dark"] .letter, [data-color-mode="dark"] .dateline, [data-color-mode="dark"] .letterhead { color: var(--color-text-primary); }
/* the letterhead turned in three dimensions: it moves to the centre of the page and can be turned by hand;
   depth is the type itself stacked a few times behind (no engine for this one) */
.letterhead.stage { position: fixed; inset: 0; width: auto; z-index: 1; display: grid; place-items: center; perspective: calc(var(--space-512) * 4); pointer-events: none; background: none; mix-blend-mode: normal; color: var(--color-text-primary); } /* a deep perspective, and no difference layer over the whole page while it turns (26 Oct) */
.letterhead.stage .sender { font-size: calc(var(--type-size-xl) * var(--k, 1)); line-height: 1; transform-style: preserve-3d; transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); cursor: grab; pointer-events: auto; user-select: none; touch-action: none; } /* --k: grown to three-fifths of the screen's width as real type, crisp (Johan, 26 Oct) */
.letterhead.stage .sender.turning { cursor: grabbing; }
/* while the real object is up, the type is hidden where it stands — only once the object covers it fully, so the
   text is never less than fully visible (Johan, 26 Oct: a dissolve, not a cross-fade) */
.sender.handed { visibility: hidden; }
@media (prefers-reduced-motion: reduce) { .letterhead.stage .sender { transition: none; } }

/* The dialogue as BLOCKS that step across the page (Johan's references, 26 Oct 2026: the interview spread
   whose answers stair rightward, the playlist whose tab stops wander, the page with numbers in its margin).
   The opening is a plain block (the salutation “Welcome.” was tried and removed). Then each exchange: the visitor's
   question a short block stepped in by 48, in the ink (grey, roman numerals and [sjw]/[you] labels were tried and removed);
   the assistant's answer a ragged block flush with the opening, so the assistant's voice is always flush left
   (the other way round, and a drifting stair, were tried first). */
.dialogue { list-style: none; padding: 0; }
.dialogue li { text-wrap: pretty; }
.dialogue .salutation { margin-bottom: 3lh; } /* the salutation stands alone, three blank rows above the paragraphs, as a letter (Johan, 26 Oct) */
.dialogue .them { max-width: 60ch; text-indent: var(--space-48); }
/* A quotation in verse, as a book sets it: a block in from the margin, air above and below, each line its own with
   runovers hung by two characters, the source a step further in (Johan, 28 Oct 2026) */
.dialogue .verse { display: block; margin: var(--space-16) 0 var(--space-16) var(--space-48); text-indent: 0; }
.dialogue .verse .vl { display: block; padding-left: 2ch; text-indent: -2ch; }
.dialogue .verse .source { margin-top: var(--space-8); padding-left: var(--space-48); } /* the assistant's paragraphs: a first-line indent of 48 (Johan's mock, 26 Oct) */
.dialogue .salutation { text-indent: 0; } /* no first-line indents: position is the page's one structural device (26 Oct); 54 since the morning ("a bit wider") */ /* the opening: a block of the answers' measure (justification was tried and removed — it breaks the monospace grid) */

.dialogue .you {                                  /* the question: a short block stepped in by one stop, in the ink like everything else */
  position: relative;
  max-width: calc(60ch - var(--space-96));        /* the same right end as the answers */
  margin-top: var(--space-16);
  margin-bottom: var(--space-2);                  /* a hair of air before the answer: 2 (Johan, 26 Oct; 6 before) */
  margin-left: var(--space-96);                   /* the visitor's question: 48 further in than the paragraphs' indent (Johan's mock, 26 Oct) */
  text-indent: 0;
}
.dialogue .answer {                               /* the answer: a ragged block, flush with the opening, first line indented like the paragraphs */
  max-width: 60ch;
}

/* The visitor's line: a bare input in the same voice, flush, no box, no button; Enter sends.
   The caret is a BLOCK, one cell wide, as on a terminal or a typewriter's ribbon guide: the native
   caret is hidden and the block follows the real caret position (set from the script, in ch). */
.ask { margin-top: 0; }
.line { display: flex; position: relative; cursor: text; margin-left: var(--space-96); } /* the I-beam over the whole line, ghost and caret included; the line sits at the visitor's stop */
.line input {
  all: unset;
  flex: 1;
  min-width: 0;
  padding: 0;
  text-indent: 0;
  font: inherit;
  color: inherit;
  caret-color: transparent;
  cursor: text; /* all: unset dropped the I-beam */
}
.line input:focus-visible { outline: none; }
/* The ghost: an example question typed into the empty line in grey, behind the input, erased when the visitor writes */
.ghost { position: absolute; left: 0; top: 0; color: var(--color-text-secondary); white-space: pre; pointer-events: none; }
.cursor {
  position: absolute;
  left: var(--at, 0ch);
  top: calc((1lh - 1em) / 2); /* the em box, centred on the line: the block covers the type, not the leading */
  width: 1ch;
  height: 1em;
  background: var(--color-bg-primary);
  mix-blend-mode: difference; /* page-white in difference: a black block on the empty cell, and the letter under it inverted, as a terminal does */
  animation: blink calc(var(--motion-duration-slow) * 2) step-end infinite; /* a terminal’s blink, on for half and off for half: an 800 cycle, twice the slow duration (the 2000 linger read as sleepy, Johan 26 Oct) */
  pointer-events: none;
}
.line input:not(:focus) + .cursor { visibility: hidden; }
/* One caret on the page: while the assistant types, the block rides the end of its text (inline) and the
   line's own block is hidden; when the assistant has "hit enter", the line's block takes over. */
.cursor.inline { position: static; display: inline-block; vertical-align: text-bottom; margin-bottom: calc((1lh - 1em) / 2); }
body.assistant-typing .line .cursor, body.assistant-typing .line .who { visibility: hidden; } /* the line's block and its [you] arrive together, once the answer has ended */
.line.ghosting .cursor { background: var(--color-text-secondary); mix-blend-mode: normal; } /* while a suggestion types itself, its caret is a ghost too */
[data-color-mode="dark"] .cursor { background: var(--color-text-primary); } /* on the dark ground the block is the ink; the letter under it still inverts (the rule was lost with the switch, 26 Oct) */
[data-color-mode="dark"] .line.ghosting .cursor { background: var(--color-text-secondary); }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cursor { animation: none; } }

@media (max-width: 767px) {
  body { display: flex; flex-direction: column; padding: var(--space-16); padding-right: var(--space-40); } /* a right margin of 40 on the phone (Johan, 26 Oct) */
  /* the body rests on the foot here too: pushed down by the empty page, growing upward as the exchange goes on */
  .letter { margin-top: auto; padding-top: var(--space-64); padding-bottom: 0; max-height: calc(100svh - var(--space-192)); } /* the keyboard now resizes the page, so the line rises with it; no extra air needed (Johan, 26 Oct) */
  .letterhead { position: sticky; top: var(--space-16); right: auto; width: auto; justify-content: flex-start; } /* sticky in the phone's column */
  .sender { text-align: left; }
  body { font-size: var(--type-size-md); line-height: var(--type-leading-18); } /* 16 on 18 on the phone: under 16 iOS zooms into the line when it takes focus (Johan, 26 Oct) */
  .dateline { margin-top: var(--space-96); } /* 96 between the letterhead and the date on the phone (Johan, 26 Oct) */
  .dialogue li { text-wrap: auto; } /* below the line phones wrap greedily (studio rule, 5 Sep 2026) */
  .dialogue .them { max-width: none; }
  .dialogue .verse { margin-left: var(--space-24); } .dialogue .verse .source { padding-left: var(--space-24); } /* the block sits in by 24 on the phone's narrow measure */
  .dialogue .you { max-width: none; }                   /* the same stop on the phone */
  .dialogue .answer { margin-left: 0; }                /* flush with the opening on the phone (Johan, 26 Oct) */
}
