/* The experience, the film. Builds on the site's stylesheet (tokens, fonts, buttons, the cover hero). */

html, body.proto { height: 100%; }
[hidden] { display: none !important; }
body.proto { background: var(--paper); overflow: hidden; }

#stage { position: fixed; inset: 0; overflow: hidden; touch-action: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
/* The film is vertical everywhere: full screen on a phone, a tall page in the middle of a laptop. */
#frame { position: absolute; top: 0; height: 100%; left: 50%; transform: translateX(-50%); overflow: hidden;
  width: min(100vw, 100vh * 9 / 16); width: min(100vw, calc(100svh * 9 / 16));
  container-type: inline-size;   /* so words over the picture can be sized to the frame, not the window */
  transition: width 1.6s cubic-bezier(.4, 0, .2, 1); }
#frame.full { width: 100vw; }
/* The clip, on the page under the picture. With no heat on it, it plays as itself and the picture stands aside
   (#stage.native, set by proto.js), the push-in done here; it fades in and out with the picture. 18 October 2026. */
#clip { position: absolute; inset: 0; overflow: hidden; pointer-events: none; opacity: 0; transition: opacity .7s ease; }
#stage.pic #clip { opacity: 1; }
#clip video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
#stage.native #picture { visibility: hidden; }
#picture { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity .7s ease; }
#picture.on { opacity: 1; }

.layer { position: absolute; inset: 0; opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .5s ease, visibility 0s linear .5s; }
.layer.on { opacity: 1; visibility: visible; transition: opacity .5s ease; }
.layer.on.interactive { pointer-events: auto; }

/* Threshold */
#threshold { background: var(--paper); display: grid; place-items: center; padding: 24px; text-align: center; }
#threshold .booktitle { font-family: var(--display); text-transform: uppercase; letter-spacing: .03em;
  font-size: clamp(44px, 9vw, 96px); line-height: .9; margin: 0 0 .5em; }
#threshold .returning { font-size: clamp(19px, 2vw, 24px); max-width: 26rem; margin: 0 auto 1em; }
#threshold .headphones { font-size: 15px; letter-spacing: .16em; text-transform: uppercase; margin: 0 0 1.6em; }
#threshold .buttons, #cover .buttons { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
#cover .buttons { justify-content: flex-start; }
#threshold .buttons { gap: 18px 44px; align-items: baseline; }

/* The threshold's controls: a word and a line under it, drawn like a ruled line in a ledger once the page is up,
   instead of a slab (the author, 13 October 2026: the button felt cheap). The line thickens on hover and the
   word settles a pixel when pressed. The end card's buy links and "Relive it" are the same. */
.act { font-family: var(--display); font-size: clamp(32px, 3.6vw, 46px); line-height: 1; text-transform: uppercase;
  letter-spacing: .16em; color: var(--slate); background: none; border: 0; border-radius: 0; margin: 0;
  padding: .12em 0 .3em .16em; position: relative; cursor: pointer; text-decoration: none;
  transition: transform .15s ease; -webkit-tap-highlight-color: transparent; }
.act.quiet { font-size: clamp(22px, 2.2vw, 28px); }
.act::after { content: ""; position: absolute; left: .16em; right: .16em; bottom: 0; height: 2px; background: currentColor;
  transform: scaleX(0); transform-origin: left center; transition: transform 1.1s cubic-bezier(.6, 0, .2, 1) .5s; }
.act.quiet::after { height: 1.5px; }
.layer.on .act::after { transform: scaleX(1); }
.act:hover::after { height: 3px; }
.act:active { transform: translateY(1px); }
.act:focus-visible { outline: 2px solid var(--slate); outline-offset: 8px; }

/* "Tap to continue" (or "Click", with a mouse): wherever the film waits for the visitor. Under the words at the
   distance the title card has (the author, 13 October 2026: "here the distance is perfect"; at the bottom it was
   too far, right under the caption too close); at full strength after a pause, then breathing, fading slowly down
   and back, nothing drawn and nothing quick (the drawn line drew too much attention). */
.next { display: inline-block; margin: max(2.6em, 6vh) 0 0; padding: 0 0 0 .2em; font-size: clamp(16px, 1.25vw, 19px); line-height: 1.2;
  letter-spacing: .2em; text-transform: uppercase; color: var(--slate); opacity: 0; transition: opacity .9s ease;
  pointer-events: none; }
.next.in { opacity: 1; animation: breathe 5s ease-in-out 1s infinite; }
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }
.mouse { display: none; }   /* words for a finger, or for a mouse */
@media (hover: hover) and (pointer: fine) { .touch { display: none; } .mouse { display: inline; } }

/* Reading beats: the book's page */
#read { background: var(--paper); display: grid; place-items: center; padding: 10vh 24px 14vh; }
#read .text { max-width: 34rem; font-size: clamp(21px, 2.4vw, 30px); line-height: 1.5; }
#read .text p { margin: 0 0 .9em; opacity: 0; transform: translateY(8px); transition: opacity 1s ease, transform 1s ease; }
#read .text p.in { opacity: 1; transform: none; }
#read .text p.ledger { font-family: var(--display); font-size: 1.6em; line-height: 1.05; }
#read .text p:last-child { margin-bottom: 0; }

/* Captions over the picture, on every screen (the author, 14 October 2026: reading them beside the film pulled the
   eye away from what was going on). The book's lines sit in the middle of the frame, light, on a soft dark pool with
   no edge; "Click to continue" waits at the bottom, on a shade that rises from the frame's bottom edge (the author,
   14 October 2026). The words stay light in the orange, where pictures go dark in places (slate vanished on the
   hotel's carpet); on the page of the second hold (the ledger's empty lines), turning a warm orange, slate, no shade,
   as on the cover. At the trays they move to the top of the frame, off the stacks. */
#caption { display: block; }
#caption .col { position: relative; isolation: isolate; height: 100%; display: grid; grid-template-rows: 1fr auto auto 1fr;
  justify-items: center; text-align: center; color: var(--paper); text-shadow: 0 1px 3px rgba(30, 39, 49, .45);
  padding: max(54px, calc(env(safe-area-inset-top) + 48px)) 8cqi max(6cqi, calc(env(safe-area-inset-bottom) + 18px)); }
#caption:not(.text):not(.cued) .col { display: none; }   /* no words and no "Tap to continue": nothing to show */
#caption .box { grid-row: 2; position: relative; max-width: 22em; font-size: clamp(18px, 4.6cqi, 24px); line-height: 1.42; text-wrap: pretty; }
#caption .box:empty { display: none; }
#caption .box::before, #caption .hint::before { content: ""; position: absolute; z-index: -1; inset: -70% -30%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(30, 39, 49, .6), rgba(30, 39, 49, .42) 50%, rgba(30, 39, 49, 0)); }
#caption .next { grid-row: 4; align-self: end; margin: 0; color: inherit; }
#caption .col::before { content: ""; position: absolute; z-index: -1; left: 0; right: 0; bottom: 0; height: 26%; pointer-events: none;
  opacity: 0; transition: opacity .9s ease; background: linear-gradient(to top, rgba(30, 39, 49, .55), rgba(30, 39, 49, 0)); }
#caption.cued .col::before { opacity: 1; }
#stage.paper #caption .col { color: var(--slate); text-shadow: none; }
#stage.paper #caption .box::before, #stage.paper #caption .hint::before, #stage.paper #caption .col::before { opacity: 0; }
#caption.top .col { grid-template-rows: auto auto 1fr auto; }
#caption.top .box { grid-row: 1; }
#caption.top .hint { grid-row: 2; }

/* The prompt */
#prompt { display: grid; place-content: center; text-align: center; padding: 24px; }
/* No box behind the words (the author, 13 October 2026: the white band looked cheap). Before the hold a soft
   pool of light with no edge sits behind them, so they read on any picture; in the orange it goes, and the slate
   reads on the orange as it does on the cover. */
#prompt .inner { position: relative; isolation: isolate; display: grid; justify-items: center; }
#prompt .inner::before { content: ""; position: absolute; z-index: -1; left: 50%; top: 50%; width: 170%; height: 300%;
  transform: translate(-50%, -50%); pointer-events: none; transition: opacity .6s ease;
  background: radial-gradient(closest-side, rgba(241, 239, 234, .8), rgba(241, 239, 234, .55) 40%, rgba(241, 239, 234, 0)); }
#prompt.hot .inner::before { opacity: 0; }
/* Sized to the frame: on a laptop the frame is far narrower than the window, and "Concentrate" ran past its edges.
   At 12.5% of the frame's width the word and its band fill about four-fifths of it. */
#prompt .word { margin: 0; font-family: var(--caslon); font-style: italic; line-height: 1;
  font-size: clamp(44px, 8vw, 92px); font-size: clamp(32px, 12.5cqi, 92px); }
#prompt .word.plain { font-family: var(--display); font-style: normal; text-transform: uppercase; letter-spacing: .08em; }
/* "Let go" while a line is up: at the bottom of the frame, where "Click to continue" waits, so the line keeps the
   middle; light, on a shade rising from the bottom edge (on the ledger's page, slate on the orange). */
#prompt.low { align-content: end; padding-bottom: max(6cqi, calc(env(safe-area-inset-bottom) + 18px)); }
#prompt.low::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 34%; pointer-events: none;
  background: linear-gradient(to top, rgba(30, 39, 49, .6), rgba(30, 39, 49, 0)); }
#prompt.low .word { color: var(--paper); text-shadow: 0 1px 3px rgba(30, 39, 49, .45); }
#stage.paper #prompt.low::before { opacity: 0; }
#stage.paper #prompt.low .word { color: var(--slate); text-shadow: none; }
/* "press and hold": large enough to ask for something, with the same line as "Tap to continue". */
#prompt .how { margin: .75em 0 0; opacity: 1; font-size: clamp(16px, 5.2cqi, 26px); }
#prompt .how:not([hidden]) { animation: breathe 5s ease-in-out 1.2s infinite; }

/* The trays: her file and the two day labels are drawn into the picture by proto.js (they take the heat with it);
   here only the dashed place on that morning's stack, breathing. What to do and how is said under the caption
   (the author, 13 October 2026: nothing told the visitor the file could be moved, or where, or how). */
#trays { pointer-events: none; }
#target { position: absolute; left: 0; top: 0; border: 2px dashed rgba(241, 239, 234, .95); border-radius: 3px;
  transition: opacity .4s; animation: breathe 3s ease-in-out infinite; }
#target.done { opacity: 0; animation: none; }
#caption .hint { grid-row: 3; position: relative; display: none; margin: .8em auto 0; max-width: 22em; font-family: var(--caslon);
  font-style: italic; line-height: 1.3; font-size: clamp(16px, 4.2cqi, 22px); animation: breathe 5s ease-in-out .8s infinite; }
#caption.trays .hint { display: block; }
#caption.trays.placed .hint { display: none; }

/* The count */
#reveal { background: var(--paper); display: grid; place-items: center; text-align: center; padding: 8vh 24px; }
#reveal .lines p { font-size: clamp(20px, 2.2vw, 28px); line-height: 1.45; max-width: 32rem; margin: 0 auto .8em;
  opacity: 0; transition: opacity 1s ease; }
#reveal .lines p.in, #reveal .num.in, #reveal .unit.in { opacity: 1; }
#reveal .num { font-family: var(--display); font-size: clamp(130px, 24vw, 280px); line-height: .85; margin: .15em 0 0;
  opacity: 0; transition: opacity 1.2s ease; }
/* "seconds" in proportion to the number (the author, 13 October 2026: it was far too small). */
#reveal .unit { font-size: clamp(20px, 3.6vw, 42px); letter-spacing: .3em; text-transform: uppercase; margin: .35em 0 0 .3em;
  opacity: 0; transition: opacity 1.2s ease; }

/* The cover, assembling over the flat orange */
#cover { overflow-y: auto; touch-action: pan-y; background: transparent; }
#cover .front { background: transparent; }
#cover .title span, #cover .novel, #cover .author { opacity: 0; transform: translateY(18px);
  transition: opacity 1.1s ease, transform 1.1s ease; }
#cover .title span:nth-child(2) { transition-delay: .15s; }
#cover .title span:nth-child(3) { transition-delay: .3s; }
#cover .title span:nth-child(4) { transition-delay: .45s; }
#cover .novel { transition-delay: .9s; }
#cover .author { transition-delay: 1.1s; }
#cover .page { opacity: 0; transform: translate(26vw, 32vh) rotate(-3.5deg); transition: opacity 1.4s ease .5s, transform 1.6s cubic-bezier(.2, .7, .2, 1) .5s; }
#cover.lit .title span, #cover.lit .novel, #cover.lit .author { opacity: 1; transform: none; }
#cover.lit .page { opacity: 1; transform: rotate(-3.5deg); }
#cover .actions { background: var(--orange); padding: 28px var(--pad) 72px; opacity: 0; transition: opacity 1s ease 2s; }
#cover.lit .actions { opacity: 1; }
#cover .actions p { margin: 0 0 .9em; }
/* The end card at reading size, in one left-aligned column (the author, 13 October 2026: the text was too small). */
#cover .actions { font-size: clamp(20px, 1.7vw, 26px); line-height: 1.45; }
#cover .actions .buttons { gap: 14px 52px; align-items: baseline; margin-bottom: .55em; }
#cover .actions .act { font-size: clamp(30px, 3.2vw, 46px); padding-left: 0; }
#cover .actions .act::after { left: 0; }
#cover .actions .act.quiet { font-size: clamp(24px, 2.4vw, 32px); padding-left: 0; }
#cover .act::after { transition-delay: 2.5s; }   /* drawn once the actions have faded in */
#cover .lifetime { font-family: var(--display); font-size: clamp(26px, 3vw, 36px); line-height: 1.05; margin-top: 1.2em !important; }
#cover .credit a { text-decoration: underline; }
/* The photo credit runs up beside the notebook page's left edge, centered on the part that shows, as on the home
   page (site.css places it; the author, 13 October 2026). It does not ride in with the page: it fades in, already
   in place, once the page has landed (the page moves from 0.5 to 2.1 seconds after the cover lights). */
#cover .page figcaption { opacity: 0; transition: opacity 1s ease; }
#cover.lit .page figcaption { opacity: 1; transition-delay: 2.2s; }
/* On a phone the page's edge runs too close to the author's name, so the credit sits under the page instead, in line
   with its left edge where it leaves the cover; proto.js measures the turned page and sets the indent. */
#cover .actions .credit { display: none; width: fit-content; max-width: 100%; margin-bottom: 1.3em; font-size: 17px; }
@media (max-width: 760px), (orientation: portrait) and (max-width: 1100px) { #cover .actions .credit { display: block; } }
/* After all the tapping, the cover needs scrolling: an arrow at the bottom, bouncing gently once the cover has
   assembled, gone as soon as the visitor scrolls; a tap on it scrolls down to the book (the author, 13 October 2026). */
#more { position: fixed; left: 50%; bottom: max(2vh, env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: none; border: 0; padding: 14px 18px; margin: 0; color: var(--slate); cursor: pointer; opacity: 0;
  transition: opacity .8s ease; -webkit-tap-highlight-color: transparent; }
#more svg { display: block; width: 36px; height: 20px; }
#cover.lit #more { opacity: 1; transition-delay: 3s; }
#cover.lit #more svg { animation: bounce 2.2s ease-in-out 3s infinite; }
#cover #more.gone { opacity: 0; transition-delay: 0s; pointer-events: none; }
#more:focus-visible { outline: 2px solid var(--slate); outline-offset: 2px; }
@keyframes bounce {
  0%, 30%, 60%, 100% { transform: translateY(0); }
  15% { transform: translateY(10px); }
  45% { transform: translateY(5px); }
}

/* A picture still on its way: "Click to continue" reads "Loading" until it is in (a spinning cursor looked like
   the page had frozen). */
#stage.waiting .next.in > span { display: none !important; }
#stage.waiting .next.in::after { content: "Loading"; }
/* ?debug: the clip's own state, for a screen recording on a phone. */
#dbg { position: absolute; z-index: 30; left: 6px; top: 6px; margin: 0; padding: 3px 6px; max-width: 70%; pointer-events: none;
  font: 11px/1.35 ui-monospace, Menlo, monospace; color: #fff; background: rgba(0, 0, 0, .55); white-space: pre-wrap; }
/* Without JavaScript (the page's own fallback, written by tools/build.py) or when the book's words would not load:
   the book's title, a line, and the way to the book, on page white. */
.noscript, .failed { position: fixed; inset: 0; z-index: 20; margin: 0; display: grid; place-content: center;
  padding: 24px max(24px, 8vw); background: var(--paper); color: var(--slate); text-align: center; }
.noscript p { max-width: 34em; margin: 0 auto .9em; }
.noscript .booktitle { font-family: var(--display); text-transform: uppercase; letter-spacing: .03em;
  font-size: clamp(44px, 9vw, 88px); line-height: .9; margin-bottom: .45em; }
.noscript a, .failed a { color: var(--slate); }
/* "Skip to the book": words and a thin underline, no box (the author, 13 October 2026: the box looked like
   Windows 98). On a phone, where it sits over the picture, a soft light behind the letters keeps it readable. */
#skip { position: absolute; z-index: 5; right: max(18px, env(safe-area-inset-right)); top: max(12px, env(safe-area-inset-top));
  padding: 6px 0; font-size: 13px; line-height: 1.2; letter-spacing: .14em; text-transform: uppercase; color: var(--slate);
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
@media (max-aspect-ratio: 5/4) {
  #stage.pic #skip { text-shadow: 0 0 6px rgba(241, 239, 234, .95), 0 0 16px rgba(241, 239, 234, .8); }
}
/* Back and on: thin chevrons beside the picture, or beside the page's words, level with their middle (the author,
   14 October 2026, in place of a "Back" link in the corner). On a phone, where the picture fills the screen, they
   sit inside its edges with a soft light behind them, and the words keep clear of them. Back waits for Begin and
   hides while the visitor holds, on the first page and on the cover; on shows where a tap goes on, not where only a
   hold does. The arrow keys do the same. */
.step { position: absolute; z-index: 5; top: 50%; width: 44px; height: 88px; margin: -44px 0 0; padding: 0; border: 0;
  background: none; color: var(--slate); cursor: pointer; display: grid; place-items: center;
  -webkit-tap-highlight-color: transparent; opacity: 0; visibility: hidden;
  transition: opacity .6s ease, visibility 0s linear .6s;
  --side: calc(min(100vw, 100vh * 9 / 16) / 2); --side: calc(min(100vw, 100svh * 9 / 16) / 2); }
.step svg { display: block; width: 18px; height: 34px; }
#step-back { left: calc(50% - var(--side) - 60px); }
#step-on { left: calc(50% + var(--side) + 16px); }
#stage.reading .step { --side: calc(max(min(100vw, 100svh * 9 / 16), min(34rem, 100vw - 48px)) / 2); }
#stage.begun.canback:not(.hot) #step-back, #stage.begun.canon:not(.hot) #step-on {
  opacity: .55; visibility: visible; transition: opacity .6s ease; }
#stage.begun .step:hover { opacity: 1; }
.step:focus-visible { outline: 2px solid var(--slate); outline-offset: -6px; }
@media (max-aspect-ratio: 5/4) {
  #step-back { left: 0; }
  #step-on { left: auto; right: 0; }
  #stage.pic .step svg { filter: drop-shadow(0 0 3px rgba(241, 239, 234, .95)) drop-shadow(0 0 9px rgba(241, 239, 234, .8)); }
  #read { padding-left: 44px; padding-right: 44px; }
  #caption .col { padding-left: max(8cqi, 46px); padding-right: max(8cqi, 46px); }
}
/* It waits until the visitor has begun (the author, 13 October 2026: while the page loaded it showed before anything
   else). The title shows at once; Begin arrives, its line drawing, once the film has loaded. */
#skip { opacity: 0; visibility: hidden; transition: opacity .6s ease, visibility 0s linear .6s; }
#stage.begun #skip { opacity: 1; visibility: visible; transition: opacity .6s ease; }
#threshold .buttons, #threshold .returning { opacity: 0; transition: opacity .8s ease; }
#threshold.ready .buttons, #threshold.ready .returning { opacity: 1; }
#threshold .act::after { transform: scaleX(0); }
#threshold.ready .act::after { transform: scaleX(1); }

@media (prefers-reduced-motion: reduce) {
  #read .text p, #reveal .lines p, #reveal .num, #reveal .unit, #cover *, .layer, #picture, #title .t span, .next,
  #caption .col::before { transition: none !important; }
  .act, .act::after { transition: none; }
  .next.in, #prompt .how:not([hidden]), #target, #caption .hint { animation: none; }
  #cover.lit #more svg { animation: none; }
}


/* The title card after the hotel, like a film's title after its cold open. */
#title { background: var(--orange); display: grid; place-items: center; align-content: center; padding: 24px; }
#title .t { margin: 0; font-family: var(--display); text-transform: uppercase; letter-spacing: .01em; line-height: .806;
  font-size: min(24vw, 15vh); }
#title .t span { display: block; opacity: 0; transform: translateY(16px); transition: opacity 1.2s ease, transform 1.2s ease; }
#title.on .t span { opacity: 1; transform: none; }
#title.on .t span:nth-child(2) { transition-delay: .25s; }
#title.on .t span:nth-child(3) { transition-delay: .5s; }
#title.on .t span:nth-child(4) { transition-delay: .75s; }

/* The flashlight across the camera: one pass, then gone. A placeholder until the footage. */
#beam { position: absolute; top: -25%; bottom: -25%; left: -60%; width: 38%; pointer-events: none; opacity: 0;
  background: linear-gradient(90deg, rgba(255, 250, 236, 0), rgba(255, 250, 236, .55) 50%, rgba(255, 250, 236, 0));
  transform: rotate(12deg); }
#beam.sweep { animation: beam 1.4s ease-in-out forwards; }
@keyframes beam {
  0% { left: -60%; opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { left: 125%; opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { #beam.sweep { animation: none; } }
