/* ---------------- the programme ----------------
   Styles for host/programme.js. Notes: host/README.md */
/* Over everything the host draws on the prototype — the researcher scene, the researcher's
   panel and speech boxes (19–22) — and under the dev HUD (30). The whole window is the
   layer, so nothing underneath can be clicked while it's up. */
#programme {
  position: fixed; inset: 0; z-index: 28;
  background: rgba(0, 0, 0, .45);
}
#programme[hidden] { display: none; }
/* Always a spread wide, each page in its own half, `--pg-gap` between; a page alone is
   brought to the middle by shifting the lot half a page and half the gap (--pg-shift,
   programme.js SHIFT), gliding as the leaf turns. Only the pages and arrows take a
   click: an empty half is the backdrop's. The shadow goes on the pages, so none falls
   in the gap. */
.pg-book {
  position: absolute; pointer-events: none;
  transform: translateX(calc(var(--pg-shift, 0) * (25% + var(--pg-gap) / 4)));
  transition: transform var(--pg-turn) ease-in-out;
}
.pg-page {
  position: absolute; top: 0; display: block; width: calc((100% - var(--pg-gap)) / 2); height: 100%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .6); pointer-events: auto;
}
/* Each turns about the spine (programme.js flip()). */
.pg-page.pg-left { left: 0; transform-origin: right center; }
.pg-page.pg-right { right: 0; transform-origin: left center; }
/* On the spine, over the pages; a quick dip while a leaf turns over it (programme.js
   DIP). Alone, only the half beside the page. */
.pg-rings { position: absolute; top: 0; height: 100%; pointer-events: none; overflow: visible; z-index: 3; }
.pg-rings[data-sides="right"] .pg-rings-left, .pg-rings[data-sides="left"] .pg-rings-right { display: none; }
.pg-stubs { display: none; }
.pg-rings[data-stubs] .pg-stubs { display: inline; }
.pg-hole { fill: #1d1b18; }
.pg-wire-shadow { fill: rgba(0, 0, 0, .3); }
/* A hot line along the top; the brass and its sheen are programme.js's gradients. */
.pg-wire-spec { fill: #fffbe8; opacity: .7; }
@media (prefers-reduced-motion: reduce) { .pg-book { transition: none; } }

/* The leaves under the pages that are up, their edges showing past the outside edge:
   paper, a line of shade between each. As many as programme.js counts, `--pg-edge` each. */
.pg-edges {
  position: absolute; top: 0; bottom: 0; pointer-events: none;
  background: repeating-linear-gradient(var(--pg-edges-dir), #e4d7bc 0 calc(var(--pg-edge) - 1px),
    #8d8574 calc(var(--pg-edge) - 1px) var(--pg-edge));
  z-index: -1;   /* under the pages, and their shadow */
}
.pg-edges-left { right: 100%; width: calc(var(--pg-edges-left) * var(--pg-edge)); --pg-edges-dir: to left; }
.pg-edges-right { left: 100%; width: calc(var(--pg-edges-right) * var(--pg-edge)); --pg-edges-dir: to right; }

/* The arrow keys either side, level with its foot, past the edges of the leaves under it. */
.pg-arrow {
  position: absolute; bottom: 0; padding: 0; border: 0; cursor: pointer; pointer-events: auto;
  width: var(--pg-arrow-w); height: var(--pg-arrow-h);
  background: 0 0 / calc(var(--pg-beats) * 100%) 100% no-repeat;
  image-rendering: pixelated;
  animation: pg-wobble var(--pg-cycle) steps(var(--pg-beats), jump-none) infinite;
  outline: none; -webkit-tap-highlight-color: transparent;
}
.pg-arrow-left { right: calc(100% + var(--pg-arrow-gap) + var(--pg-edges-left) * var(--pg-edge)); }
.pg-arrow-right { left: calc(100% + var(--pg-arrow-gap) + var(--pg-edges-right) * var(--pg-edge)); }
.pg-arrow[hidden] { display: none; }
.pg-arrow:hover { filter: brightness(1.25); }
/* Not turning yet (Programme.stay): no arrows, and nothing turns. */
.pg-stay .pg-arrow { visibility: hidden; }
.pg-stay .pg-turn { cursor: default; }
@media (prefers-reduced-motion: reduce) { .pg-arrow { animation: none; } }

/* Plain on purpose: one paper — programme/paper.jpg; `--pg-paper` is its average, for
   what sits flat on it — black type in a book face, one ink for the lines, nothing
   pretending to be drawn by hand. */
.pg-page {
  --pg-ink: #1f6b47; --pg-text: #15120f; --pg-paper: #e8ddc3; --pg-water: #3c4fa0;
  --pg-serif: "Hoefler Text", "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --pg-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
.pg-paper { fill: var(--pg-paper); }
.pg-border { fill: none; stroke: var(--pg-ink); stroke-width: 3; }
/* Black. Dotted, but for the prototype's path (PATH), solid over them. */
.pg-lines polyline {
  fill: none; stroke: var(--pg-text); stroke-width: 3; stroke-linejoin: round;
  stroke-linecap: round; stroke-dasharray: 0 8;
}
.pg-lines .pg-path { stroke-linecap: butt; stroke-dasharray: none; }
.pg-water { fill: none; stroke: var(--pg-water); stroke-width: 3; }
.pg-depth { fill: var(--pg-water); opacity: .12; }
.pg-hours text { fill: var(--pg-text); font: 400 23px/1 var(--pg-serif); letter-spacing: .04em; }
/* The list is read line by line, small: a plain sans reads better there than the book face. */
.pg-list text { fill: var(--pg-text); font: 400 19px/1 var(--pg-sans); }
.pg-number { fill: var(--pg-text); font: 400 25px/1 var(--pg-serif); }
.pg-title { fill: var(--pg-text); font: 400 50px/1 var(--pg-serif); letter-spacing: .04em; }
/* A picture on a page is printed on it: its white is the paper's colour. */
.pg-art { mix-blend-mode: multiply; }
/* Lining figures — old-style, "10 PM" reads "IO PM". After the fonts, whose shorthand resets it. */
.pg-page text { font-variant-numeric: lining-nums; }
.pg-node { cursor: pointer; outline: none; }
/* Not in the prototype: drawn as any other, but nothing to press (a stand-in until the
   designer settles how the moments off the path look). */
.pg-node.pg-off { cursor: default; }
/* The corners that turn the page: nothing to see yet, just somewhere to press. */
.pg-turn { fill: transparent; cursor: pointer; outline: none; }
.pg-hit { fill: transparent; }
/* No ring drawn: only the paper behind the icon, so the lines stop short of it. */
.pg-ring { fill: var(--pg-paper); }
.pg-node image, .pg-list image { pointer-events: none; }
/* The marks in the deep, where each thread ends (programme.js MARK). */
.pg-deep text { fill: var(--pg-text); opacity: .7; font: 22px/1 ui-monospace, Menlo, Consolas, monospace; }
/* The prototype's path's mark (PATH_MARK): full black. */
.pg-deep .pg-path text { opacity: 1; }
/* The ring that points at a moment (programme.js RINGUI), on its string from the clip on
   the leaf's top edge — which stands up past the page, so the page lets it show. */
.pg-page { overflow: visible; }
.pg-clip rect { fill: #a19e96; stroke: #5d5b55; stroke-width: 1.5; }
.pg-clip .pg-clip-eye { fill: #5d5b55; stroke: none; }
.pg-string { stroke: #2a2620; stroke-width: 1.5; }
/* None of it takes the pointer: over an icon, the string would pull the hover off it. */
.pg-ring-ui, .pg-string, .pg-clip, .pg-deep { pointer-events: none; }
.pg-ring-ui circle { fill: none; stroke: url(#pg-brass); }

/* The HUD button. The element is the button's solid box (HUD_BOX in programme.js), and
   each state's picture hangs off it by that state's shadow margins — every number here is
   image px of the 4× art, times --pg-hud-u (screen px per image px). Above the survey
   scene (28), under the dev HUD (30). Crisp: it's pixel art. */
#pg-hud {
  position: fixed; z-index: 29; padding: 0; border: 0; background: none; cursor: pointer;
  outline: none; -webkit-tap-highlight-color: transparent;
  --art: url(programme/hud-default.png); --w: 272; --h: 140; --x: 16; --y: 12;
}
#pg-hud:enabled:hover  { --art: url(programme/hud-hover.png); --w: 288; --h: 156; --x: 24; --y: 16; }
#pg-hud:enabled:active { --art: url(programme/hud-down.png);  --w: 256; --h: 124; --x: 8;  --y: 6; }
#pg-hud[hidden] { display: none; }
/* Disabled — all through the researcher scene: the designer's greyed button, the icon
   faded into it (the same grey the time turns). */
#pg-hud:disabled { cursor: default; --art: url(programme/hud-disabled.png); }
#pg-hud:disabled .pg-hud-icon { opacity: .44; }

/* The icon and the time on it, placed and sized by layoutHud() in frame px. Over the art
   (::before), so after it in paint order. */
#pg-hud .pg-hud-icon, #pg-hud .pg-hud-time { position: absolute; z-index: 1; pointer-events: none; }
.pg-hud-icon {
  background: url(programme/hud-icon.png) 0 0 / 100% 100% no-repeat;
  image-rendering: pixelated;
}
/* Inter SemiBold, cut down to the characters an hour needs (host/fonts/). */
@font-face {
  font-family: "Inter HUD"; font-weight: 600; font-display: block;
  src: url(fonts/Inter-SemiBold-hud.woff) format("woff");
}
.pg-hud-time {
  white-space: nowrap;
  font: 600 20px/1 "Inter HUD", Inter, system-ui, sans-serif; letter-spacing: 0;
  color: #34322f;
}
#pg-hud:enabled:active .pg-hud-time { color: #fffcf8; }
#pg-hud:disabled .pg-hud-time { color: #89847f; }
/* The researcher's space: page 10's mark under the water, where the hour would be — a
   digit's width, a little taller than the caps, centred on them (Inter's caps sit .36em
   over the baseline). */
.pg-hud-mark { width: .8em; height: 1em; vertical-align: -.14em; overflow: visible; }
.pg-hud-mark text { fill: currentColor; font: 21px/1 ui-monospace, Menlo, Consolas, monospace; }
#pg-hud::before {
  content: ""; position: absolute; pointer-events: none;
  left: calc(var(--x) * var(--pg-hud-u) * -1); top: calc(var(--y) * var(--pg-hud-u) * -1);
  width: calc(var(--w) * var(--pg-hud-u)); height: calc(var(--h) * var(--pg-hud-u));
  background: var(--art) 0 0 / 100% 100% no-repeat;
  image-rendering: pixelated;
}
#pg-hud:focus-visible::before { outline: 2px solid #ebe7de; outline-offset: 2px; }

/* The booklet held out while the researcher hands it over: a sprite strip stepped
   through its wobble, crisp, centred on its spot. */
#pg-receive {
  position: fixed; z-index: 27; padding: 0; border: 0; cursor: pointer;
  transform: translate(-50%, -50%);
  background: url(programme/receive.png) 0 0 / calc(var(--pg-beats) * 100%) 100% no-repeat;
  image-rendering: pixelated;
  animation: pg-wobble var(--pg-cycle) steps(var(--pg-beats), jump-none) infinite;
  outline: none; -webkit-tap-highlight-color: transparent;
}
#pg-receive[hidden] { display: none; }
#pg-receive:hover { filter: brightness(1.25); }
@keyframes pg-wobble { from { background-position-x: 0% } to { background-position-x: 100% } }
@media (prefers-reduced-motion: reduce) { #pg-receive { animation: none; } }

/* The end card (programme.js endCard): black over everything but the dev HUD and the
   toast, and one page coming up out of it. */
#pg-end { position: fixed; inset: 0; z-index: 29; background: #000; }
#pg-end .pg-page {
  position: absolute; right: auto; opacity: 0; transition: opacity var(--pg-end-fade) ease-out;
}
#pg-end.pg-end-up .pg-page { opacity: 1; }
/* Its results. Sizes are page units (a page is 1000 tall): 20 is about 11px on the
   800×600 frame, so not much smaller is readable. */
.pg-end-head { fill: var(--pg-text); font-family: var(--pg-serif); font-size: 25px; font-style: italic; }
.pg-plane-box { fill: none; stroke: var(--pg-text); stroke-width: 1.5; opacity: .6; }
.pg-plane-axis { stroke: var(--pg-text); stroke-width: 1; opacity: .25; }
.pg-plane-label { fill: var(--pg-text); font-family: var(--pg-serif); font-size: 17px; opacity: .7; }
.pg-trail { fill: none; stroke: var(--pg-text); stroke-width: 1.2; opacity: .45; }
.pg-trail-dot { fill: var(--pg-text); opacity: .45; }
.pg-you { fill: var(--pg-text); }
.pg-feed-name, .pg-puzzle-name, .pg-feed-lead { fill: var(--pg-text); font-family: var(--pg-serif); font-size: 20px; }
.pg-feed-track { fill: var(--pg-text); opacity: .12; }
.pg-feed-fill { fill: var(--pg-text); }
.pg-puzzle-box { fill: none; stroke: var(--pg-text); stroke-width: 1.5; }
.pg-end-line { height: 100%; display: flex; align-items: center; }
.pg-end-line p {
  margin: 0; width: 100%; color: var(--pg-text); font: italic 400 21px/1.35 var(--pg-serif); text-align: center;
}
