/* Oriel — shell.css (v89)
   Loaded last on Oriel's page. Four things, none of which changes the look of the house:

   1. The room. The page never scrolls; each screen is a room of fixed height that scrolls inside itself. That is what
      lets the text bar rest on the keyboard (keyboard.js) and keeps every bar where it belongs.
   2. The text bar and the tops of the chat and the Desk: words pass under them and are gone, never read through them.
   3. The call, opened as a layer inside the house, so it always covers the whole screen.
   4. A cooler phone: the floor of pores is a still painting moved only by the compositor, the metal's sheen passes
      once, and the big still lights are painted small and stretched. */

/* ---------------------------------------------------------------- 1. the room
   v91: the whole glass. Through v88 the house covered the phone because the page was an ordinary page, as tall as the
   screen. v89 and v90 locked the page (overflow: hidden) so it could not scroll, and an iPhone opened from its
   home-screen icon then draws only as far as its own short measure of the page: a status bar's height was left bare
   at the foot. The page is an ordinary page again, exactly as tall as the glass, with nothing in it to scroll; every
   room is a layer of that same height. Where the phone is known to be an iPhone running from its icon, the height is
   the screen's own (--full-h, set in the head of index.html), which does not depend on what the page reports. */
html { overscroll-behavior: none; }
body { min-height: 100vh; min-height: var(--full-h, 100dvh); overscroll-behavior: none; touch-action: manipulation; }
/* the room's still layers are given the same height outright, so they reach the foot of the glass however the phone
   measures the page */
.chamber, .edge-aura, .veil:not(.live) { bottom: auto; height: 100vh; height: var(--full-h, 100dvh); }
.screen {
  --col: 460px; --pad: max(20px, calc((100vw - var(--col)) / 2 + 20px));
  /* laid on the page as in v80 to v88 (position: relative, in the flow), not floated over it: the one screen showing
     is what makes the page as tall as the glass, which is the arrangement those builds covered the phone with */
  position: relative; top: var(--app-y, 0px); width: 100%; height: var(--app-h, 100vh); height: var(--app-h, var(--full-h, 100dvh));
  max-width: none; min-height: 0; margin: 0;
  padding-left: var(--pad); padding-right: var(--pad);
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.screen::-webkit-scrollbar { display: none; }
/* the unseen file picker sat at the foot of the page and made the page 30px taller than the glass, enough to let it
   slide; it is pinned to the corner, where it adds nothing */
#attachInput { position: fixed; top: 0; left: 0; overflow: hidden; }
.screen > * { flex-shrink: 0; }
@media (min-width: 720px) {
  .screen { --pad: max(24px, calc((100vw - var(--col)) / 2 + 24px)); }
  html[data-layout="gallery"] #s-desk { --col: min(1000px, 92vw); max-width: none; }
}
/* the door stays centred while it fits, and can be reached to its top when it doesn't (a short phone, big type) */
.door { justify-content: flex-start; }
.door > :first-child { margin-top: auto; }
.door > :last-child { margin-bottom: auto; }

/* the keyboard: the room is as tall as what can be seen, and rides with the keys */
body.kb-glide .screen { transition: height .3s cubic-bezier(.25, .8, .25, 1); }
@media (prefers-reduced-motion: reduce) { body.kb-glide .screen { transition: none; } }
body.kb .screen { padding-bottom: 10px; }

/* ---------------------------------------------------------------- 2. the chat, and the top of the Desk
   v91: no bands, no lines. The chat is three pieces in a column: her name at the top, the thread, the text bar at the
   foot. Only the thread scrolls (keyboard.js asks it, data-room). Her words thin into the paper itself at the top
   and the foot of the thread, so the paper, its texture and its painting run unbroken behind the whole chat. v89 hid
   the words under a band of flat colour above and below, and the edge of that band showed as a line across the chat. */
html:not(#x) #s-chat { --foot: calc(env(safe-area-inset-bottom, 0px) + 12px); padding-top: 0; padding-bottom: 0; overflow: hidden; }
html:not(#x) body.kb #s-chat { --foot: 8px; padding-bottom: 0; }
html:not(#x):not(#y) #s-chat .bar.sticky { position: relative; top: auto; margin-top: 0; margin-bottom: 0; flex: none; }
html:not(#x):not(#y):not(#z) #s-chat .bar.sticky::before { content: none; }
html:not(#x):not(#y) #thread {
  flex: 1 1 0; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  margin: 0 calc(-1 * var(--pad)); padding: 26px var(--pad) 30px;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 26px, #000 calc(100% - 30px), transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0, #000 26px, #000 calc(100% - 30px), transparent 100%);
}
#thread::-webkit-scrollbar { display: none; }
#thread > * { flex-shrink: 0; }
html:not(#x):not(#y) #s-chat .composer.docked { position: relative; top: auto; bottom: auto; margin: 0 0 var(--foot); flex: none; }
html:not(#x) .chat::after, html:not(#x) .composer.docked::before { content: none; }
html:not(#x) #s-chat .relisten { position: relative; bottom: auto; margin: -48px auto 10px; }

/* the Desk's top: a bar that sticks is measured from the room's own edge, so the Desk carries no padding of its own
   at the top; the bar brings it. Under it the paper's colour is whole down to the bar's foot and only then thins. */
#s-desk { padding-top: 0; }
html:not(#x):not(#y) .desk-top { top: 0; margin-top: 0; }
html:not(#x):not(#y):not(#z) .desk-top::before {
  top: 0; bottom: -22px; opacity: 1; transition: none; -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
  background: linear-gradient(180deg, var(--air) 0, var(--air) calc(100% - 26px), color-mix(in srgb, var(--air) 0%, transparent) 100%);
}

/* the key at home (v91): the text bar is gone from home. One wide key opens the chat with her, the keyboard already
   up; it is a wafer like the keys of the dock beneath it, lying in the same kind of groove. */
.chat-key-well { padding: 5px; border-radius: 34px; background: var(--m-well);
  box-shadow: inset calc(var(--rest-x, -.35) * -2px) calc(var(--rest-y, -.45) * -2px + 1.5px) 5px rgba(var(--m-shadow), calc(var(--m-shadow-a) * 1.15)), inset 0 -1px 0 var(--m-rim-light), 0 1px 0 var(--m-rim-light); }
.chat-key { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; min-height: 58px; padding: 0 16px 0 20px;
  border-radius: 29px; text-align: left; font-family: var(--sans); font-size: 16.5px; letter-spacing: .005em; color: var(--ink);
  background: linear-gradient(168deg, var(--m-surface-hi), var(--m-surface) 72%);
  box-shadow: inset 0 1px 0 var(--m-rim-light), inset 0 -1px 0 var(--m-rim-shade), 0 2px 0 -.5px color-mix(in srgb, var(--m-surface) 72%, rgb(var(--m-shadow))),
    calc(var(--rest-x, -.35) * -5px) calc(var(--rest-y, -.45) * -5px + 5px) 9px -3px rgba(var(--m-shadow), calc(var(--m-shadow-a) * 1.05));
  transition: transform .18s var(--spring-heavy, ease), box-shadow .18s var(--spring-heavy, ease); }
.chat-key:active { transform: translateY(2px); box-shadow: inset 0 1px 0 var(--m-rim-light), inset 0 -1px 0 var(--m-rim-shade), 0 1px 2px rgba(var(--m-shadow), var(--m-shadow-a)); }
.chat-key > svg:first-child { width: 22px; height: 22px; color: rgb(var(--m-pigment)); }
.chat-key > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-key > svg:last-child { width: 20px; height: 20px; color: var(--ink-2); opacity: .7; }

/* ---------------------------------------------------------------- 3. the call, inside the house
   The call opens as a layer over the house instead of a page of its own. Opened as its own page from the home-screen
   icon, an iPhone gave it a height that ran past the foot of the glass and its keys were cut off. Inside the house it
   takes the house's own measure, which is right. */
.call-layer { position: fixed; top: 0; left: 0; width: 100%; height: 100vh; height: var(--full-h, 100dvh); z-index: 200; background: var(--air); opacity: 0; transition: opacity .32s cubic-bezier(.25, .8, .25, 1); }
.call-layer.on { opacity: 1; }
.call-layer iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; display: block; background: transparent; }
/* while he is on a call the house behind it rests: nothing there is drawn or moved */
body.in-call > .screen, body.in-call > canvas, body.in-call > .horizon, body.in-call > .eclipse, body.in-call > .aura, body.in-call > .edge-aura { visibility: hidden; }

/* ---------------------------------------------------------------- 4. a cooler phone
   Measured at v88 on home, at rest: the whole screen was repainted about fifteen times a second and some twenty-four
   screens' worth of layers were held in memory. That is the lag, and the torn rectangles are the phone dropping
   layers it can no longer hold. Each thing below is the same to the eye and close to free. */

/* the floor of pores: two still paintings (stars.js) that pass into one another on a slow breath, and a sheet of
   pearl light that glides across now and then. Only on the door and at home; nothing moves anywhere else, with the
   keyboard up, or with motion reduced. */
.tide-floor { position: fixed; left: 0; right: 0; bottom: auto; top: 50vh; top: calc(var(--full-h, 100dvh) / 2); height: 50vh; height: calc(var(--full-h, 100dvh) / 2); z-index: 0; pointer-events: none; overflow: hidden; contain: strict; opacity: 0; transition: opacity 1.8s var(--ease); }
body[data-screen="door"] .tide-floor, body[data-screen="home"] .tide-floor { opacity: 1; }
html:not(#x) .tide-floor canvas.tide { position: absolute; left: 0; top: 0; right: auto; bottom: auto; width: 100%; height: 100%; opacity: 1; transition: none; }
html:not(#x) .tide-floor canvas.tide.b { opacity: 0; }
/* the light is an ellipse low in the floor that thins to nothing on every side, so it has no edge to show */
.tide-glide { position: absolute; top: 0; bottom: 0; left: 0; width: 90%; opacity: 0; transform: translate3d(-110%, 0, 0);
  background: radial-gradient(ellipse 50% 52% at 50% 64%, rgba(var(--tide-light, 255, 255, 255), var(--tide-light-a, .1)), rgba(var(--tide-light, 255, 255, 255), 0) 100%); }
html[data-theme="light"] { --tide-light: 255, 255, 255; --tide-light-a: .5; }
html:not([data-theme="light"]) { --tide-light: var(--m-metal, 229, 215, 184); --tide-light-a: .09; }
@media (prefers-reduced-motion: no-preference) {
  body:is([data-screen="door"], [data-screen="home"]):not(.kb):not(.in-call) .tide-floor canvas.tide { animation: tide-ebb 8s ease-in-out infinite alternate; }
  body:is([data-screen="door"], [data-screen="home"]):not(.kb):not(.in-call) .tide-floor canvas.tide.b { animation-name: tide-flow; }
  body:is([data-screen="door"], [data-screen="home"]):not(.kb):not(.in-call) .tide-glide { animation: tide-glide 17s cubic-bezier(.4, 0, .3, 1) 3s infinite; }
}
@keyframes tide-ebb { 0%, 8% { opacity: 1; } 50% { opacity: .72; } 92%, 100% { opacity: 0; } }
@keyframes tide-flow { 0%, 8% { opacity: 0; } 50% { opacity: .72; } 92%, 100% { opacity: 1; } }
@keyframes tide-glide { 0% { opacity: 0; transform: translate3d(-110%, 0, 0); } 6% { opacity: 1; } 36% { opacity: 1; } 44%, 100% { opacity: 0; transform: translate3d(125%, 0, 0); } }

/* the metal's sheen. A gradient sliding through lettering is a repaint of the whole screen on every frame, and it ran
   for thirty seconds each time a screen opened (measured: her name and the greeting, fifteen repaints a second). The
   lettering is the same brushed metal, held still; the light on it is the room's. */
html:not(#x) :is(.word, .brand, .hello, .metal, .play-name, .sheet-tt h3, .comp-card h3, .wname) { animation: none; }

/* the big still lights. The pool of light on the floor and the fibres that catch it were painted at nearly twice the
   screen each way and then moved; they are painted at half that and stretched, which a soft light never shows. The
   slow drift of the room's glow and of the floor's light was too slow to see and kept the screen composing all day:
   they rest. */
html:not(#x) .chamber .floor { left: 5%; top: 5%; width: 90%; height: 90%; scale: 2; }
html:not(#x) .chamber .floor b { translate: calc(var(--light-x) * -11.5vw) calc(var(--light-y) * -10vh); background-size: calc(var(--tex-lit-grain-size, 256px) / 2) calc(var(--tex-lit-grain-size, 256px) / 2); }
html:not(#x) .aura, html:not(#x) .horizon i { animation: none; }

/* ---------------------------------------------------------------- 5. the first light (Fable's own piece, v89)
   Once a day, the first time home is seen, one sheet of pearl light crosses the paper from the left: over the painting,
   behind her orb, and gone. One still layer moved by a transform, played once and taken away (app.js, firstLight). */
.first-light { position: fixed; z-index: 0; pointer-events: none; top: -30%; bottom: -30%; left: 0; width: 85%; opacity: 0;
  background: linear-gradient(90deg, rgba(var(--tide-light, 255, 255, 255), 0), rgba(var(--tide-light, 255, 255, 255), calc(var(--tide-light-a, .1) * 1.3)) 50%, rgba(var(--tide-light, 255, 255, 255), 0));
  transform: translate3d(-130%, 0, 0) skewX(-18deg); animation: first-light 3.6s cubic-bezier(.4, 0, .2, 1) .15s both; }
@keyframes first-light { 0% { opacity: 0; transform: translate3d(-130%, 0, 0) skewX(-18deg); } 14%, 80% { opacity: 1; } 100% { opacity: 0; transform: translate3d(250%, 0, 0) skewX(-18deg); } }

/* === v91k carried over into v95: pin the chat header to the status bar + keep the back key touchable ===
   v95 kept Fable's shell.css, which never had this block, so it is restored here unchanged. The header was
   position: relative in flow, so the keyboard/page scroll could push it and the back key went dead; its frosted
   backdrop was killed (content: none); the bar carried safe-area + 8px of top padding, leaving a dead gap under
   the status bar. The bar's in-flow content is 40px (the 40px icon buttons; the breath canvas is position:
   absolute, so it adds no height) + 6px bottom padding, so the fixed bar is 46px + safe-area tall; #s-chat gets
   48px + safe-area of top padding so the thread never slides under it. The thread's bottom fade mask and the
   composer's glass are untouched. These rules reuse the exact selectors above so they win by position. */
html:not(#x):not(#y) #s-chat .bar.sticky {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
  margin: 0; padding-top: env(safe-area-inset-top, 0px);
  pointer-events: auto;
}
html:not(#x):not(#y):not(#z) #s-chat .bar.sticky::before { content: ""; }
#s-chat #chatBack { pointer-events: auto; }
html:not(#x) #s-chat { padding-top: calc(env(safe-area-inset-top, 0px) + 48px); }
