/* The wall (how-it-works.html): the region whose scroll range is the story
   (.how-wall, 100svh taller than the story's 7.26 viewports of scroll:
   src/how/storyboard.js BEATS), the sticky stage inside it
   (#experience: the canvas, the vignette, the page's nav, the title, the
   curtain and the edit prompt), and the loading line. The stage keeps the
   wall's own look: its #111210 black, and Arial in the prompt and the
   loading line. The nav, the title and the error panel are the site's
   (src/base.css, how.css). */

.how-wall { position: relative; height: 826svh; }
#experience { position: sticky; top: 0; width: 100%; height: 100vh; height: 100dvh; overflow: clip; isolation: isolate; background: #111210; color: #f5f3ee; }
#wall { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: pan-y pinch-zoom; }
/* The top band keeps the nav's links at WCAG AA (4.5:1) over the wall's
   brightest edits; below it the vignette is as it was. */
.vignette { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, #111210b8 0, #111210a6 100px, #11121000 190px), linear-gradient(180deg, #0006, transparent 22%, transparent 78%, #0003); }
/* The nav rides the stage over the whole wall, as the wall's own top line did. */
#experience .nav { z-index: 5; }
.prompt, .loading { font-family: Arial, Helvetica, sans-serif; }
.prompt {
  --prompt-gap: 22px;
  --prompt-half: min(185px, calc(var(--screen-width, 370px) / 2), calc((100vw - 44px) / 2));
  position: absolute;
  top: calc(var(--screen-bottom, 70vh) + var(--prompt-gap));
  left: clamp(calc(22px + var(--prompt-half)), var(--screen-center, 50%), calc(100% - 22px - var(--prompt-half)));
  width: min(370px, var(--screen-width, 370px), calc(100% - 44px));
  padding: 7px 7px 7px 17px;
  border: 1px solid #00000015;
  border-radius: 12px;
  background: #fff;
  color: #141414;
  box-shadow: 0 8px 32px #0003;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  opacity: 0;
  pointer-events: auto;
  z-index: 4;
  transform: translateX(-50%);
}
#prompt-text { font-size: 14px; letter-spacing: -.015em; flex: 1; min-width: 0; }
.prompt::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 2px; background: #20221f; transform-origin: left; transform: scaleX(var(--submit-progress, 0)); opacity: 0; }
.prompt[data-phase="sending"] { box-shadow: 0 0 0 3px #ffffff24, 0 10px 36px #0003; }
.prompt[data-phase="sending"] #prompt-text { opacity: calc(1 - var(--send-progress, 0) * .3); transform: translateY(calc(var(--send-progress, 0) * -2px)); }
.prompt[data-phase="sending"]::after, .prompt[data-phase="working"]::after { opacity: 1; }
.prompt[data-phase="applied"] #prompt-text { color: #454a43; }
.prompt[data-phase="pausing"][data-retained-applied="true"] #prompt-text { color: #454a43; }
.prompt[data-phase="typing"] #prompt-text::after { content: ""; display: inline-block; width: 1px; height: 1em; margin-left: 2px; background: currentColor; vertical-align: -.12em; animation: prompt-caret .75s step-end infinite; }
@keyframes prompt-caret { 50% { opacity: 0; } }
.prompt svg { display: block; width: 22px; height: 22px; }
.loading { position: absolute; right: 24px; bottom: 18px; margin: 0; color: #c7c5bf; font-size: 11px; line-height: 1.5; z-index: 6; pointer-events: none; }
.loading[hidden] { display: none; }
/* A wall that cannot be drawn shows its still (src/errors.js), not a loading line. */
.scene-failed .loading { display: none; }
#experience .stage-error { z-index: 6; }
@media (max-width: 650px) {
  .prompt { --prompt-gap: 18px; padding: 6px 6px 6px 14px; }
  #prompt-text { font-size: 14px; }
}
@media (max-height: 500px) { .prompt { padding-top: 8px; padding-bottom: 8px; } }
@media (prefers-reduced-motion: reduce) { #experience *, #experience *::before, #experience *::after { animation: none !important; transition: none !important; } }
/* A quiet input-like bar keeps the next edit available to pointer and keyboard. */
#advance { position: relative; flex: none; display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 7px; background: #1011140c; color: #1a1a1a; padding: 0; cursor: pointer; }
#advance:hover { background: #10111416; }
#advance:disabled { opacity: .45; cursor: default; }
#advance .send-icon { transform: translateY(calc(var(--send-progress, 0) * -10px)); opacity: calc(1 - var(--send-progress, 0)); }
#advance .submit-spinner, #advance .applied-icon { position: absolute; opacity: 0; }
#advance .submit-spinner { width: 16px; height: 16px; border: 1.5px solid #1a1a1a26; border-top-color: #1a1a1a; border-radius: 50%; }
.prompt[data-phase="working"] #advance, .prompt[data-phase="applied"] #advance { background: transparent; opacity: 1; }
.prompt[data-phase="working"] #advance .submit-spinner { opacity: 1; animation: submit-spin .8s linear infinite; }
.prompt[data-phase="applied"] #advance .applied-icon { opacity: 1; }
.prompt[data-phase="pausing"] #advance { background: transparent; }
.prompt[data-phase="pausing"] #advance .send-icon { opacity: 0; }
.prompt[data-phase="pausing"][data-retained-applied="true"] #advance { opacity: 1; }
.prompt[data-phase="pausing"][data-retained-applied="true"] #advance .applied-icon { opacity: 1; }
@keyframes submit-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .prompt #prompt-text, #advance .send-icon { transform: none; } .prompt[data-phase="typing"] #prompt-text::after { display: none; } }
#wall:focus-visible { outline: 2px solid #ff8c7080; outline-offset: -5px; }
#advance:focus-visible { outline: 2px solid #ff8c70; outline-offset: 5px; }
#scene-fade { position: absolute; inset: 0 0 auto; height: 160%; background: linear-gradient(180deg, #11121000 0%, #11121099 12%, #111210 24%, #111210 100%); transform: translate3d(0, 62.5%, 0); opacity: 0; pointer-events: none; z-index: 2; will-change: transform, opacity; }
@media (max-width: 650px) { .prompt { gap: 12px; } }
