/* Linking Books. A 1993 pre-rendered island: one still per step, a cross-fade between them, a hand for a cursor. */
:root {
  --fw: 1200px;
  --ink: #2c2016;
  --paper: #e7d8b8;
  --hand-open: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cg stroke='%23000' stroke-width='2.4'%3E%3Crect x='8' y='5' width='4.4' height='14' rx='2.2'/%3E%3Crect x='12.4' y='2.5' width='4.4' height='15' rx='2.2'/%3E%3Crect x='16.8' y='3.5' width='4.4' height='14' rx='2.2'/%3E%3Crect x='21.2' y='7' width='4' height='12' rx='2'/%3E%3Crect x='3' y='14' width='4.4' height='10' rx='2.2' transform='rotate(-32 5 19)'/%3E%3Crect x='8' y='13' width='17.2' height='16' rx='5'/%3E%3C/g%3E%3Cg fill='%23fff'%3E%3Crect x='8' y='5' width='4.4' height='14' rx='2.2'/%3E%3Crect x='12.4' y='2.5' width='4.4' height='15' rx='2.2'/%3E%3Crect x='16.8' y='3.5' width='4.4' height='14' rx='2.2'/%3E%3Crect x='21.2' y='7' width='4' height='12' rx='2'/%3E%3Crect x='3' y='14' width='4.4' height='10' rx='2.2' transform='rotate(-32 5 19)'/%3E%3Crect x='8' y='13' width='17.2' height='16' rx='5'/%3E%3C/g%3E%3C/svg%3E") 15 8, pointer;
  --hand-up: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cg stroke='%23000' stroke-width='2.4'%3E%3Crect x='12.5' y='2' width='5' height='16' rx='2.5'/%3E%3Crect x='17.5' y='10.5' width='4.5' height='9' rx='2.2'/%3E%3Crect x='22' y='12' width='4.2' height='8.5' rx='2.1'/%3E%3Crect x='5' y='16' width='4.4' height='9' rx='2.2' transform='rotate(-38 7 20)'/%3E%3Crect x='10.5' y='14.5' width='15.7' height='14.5' rx='5'/%3E%3C/g%3E%3Cg fill='%23fff'%3E%3Crect x='12.5' y='2' width='5' height='16' rx='2.5'/%3E%3Crect x='17.5' y='10.5' width='4.5' height='9' rx='2.2'/%3E%3Crect x='22' y='12' width='4.2' height='8.5' rx='2.1'/%3E%3Crect x='5' y='16' width='4.4' height='9' rx='2.2' transform='rotate(-38 7 20)'/%3E%3Crect x='10.5' y='14.5' width='15.7' height='14.5' rx='5'/%3E%3C/g%3E%3C/svg%3E") 15 2, pointer;
  --hand-down: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cg transform='rotate(180 16 16)'%3E%3Cg stroke='%23000' stroke-width='2.4'%3E%3Crect x='12.5' y='2' width='5' height='16' rx='2.5'/%3E%3Crect x='17.5' y='10.5' width='4.5' height='9' rx='2.2'/%3E%3Crect x='22' y='12' width='4.2' height='8.5' rx='2.1'/%3E%3Crect x='5' y='16' width='4.4' height='9' rx='2.2' transform='rotate(-38 7 20)'/%3E%3Crect x='10.5' y='14.5' width='15.7' height='14.5' rx='5'/%3E%3C/g%3E%3Cg fill='%23fff'%3E%3Crect x='12.5' y='2' width='5' height='16' rx='2.5'/%3E%3Crect x='17.5' y='10.5' width='4.5' height='9' rx='2.2'/%3E%3Crect x='22' y='12' width='4.2' height='8.5' rx='2.1'/%3E%3Crect x='5' y='16' width='4.4' height='9' rx='2.2' transform='rotate(-38 7 20)'/%3E%3Crect x='10.5' y='14.5' width='15.7' height='14.5' rx='5'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") 16 30, pointer;
  --hand-left: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cg transform='rotate(-90 16 16)'%3E%3Cg stroke='%23000' stroke-width='2.4'%3E%3Crect x='12.5' y='2' width='5' height='16' rx='2.5'/%3E%3Crect x='17.5' y='10.5' width='4.5' height='9' rx='2.2'/%3E%3Crect x='22' y='12' width='4.2' height='8.5' rx='2.1'/%3E%3Crect x='5' y='16' width='4.4' height='9' rx='2.2' transform='rotate(-38 7 20)'/%3E%3Crect x='10.5' y='14.5' width='15.7' height='14.5' rx='5'/%3E%3C/g%3E%3Cg fill='%23fff'%3E%3Crect x='12.5' y='2' width='5' height='16' rx='2.5'/%3E%3Crect x='17.5' y='10.5' width='4.5' height='9' rx='2.2'/%3E%3Crect x='22' y='12' width='4.2' height='8.5' rx='2.1'/%3E%3Crect x='5' y='16' width='4.4' height='9' rx='2.2' transform='rotate(-38 7 20)'/%3E%3Crect x='10.5' y='14.5' width='15.7' height='14.5' rx='5'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") 2 16, pointer;
  --hand-right: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cg transform='rotate(90 16 16)'%3E%3Cg stroke='%23000' stroke-width='2.4'%3E%3Crect x='12.5' y='2' width='5' height='16' rx='2.5'/%3E%3Crect x='17.5' y='10.5' width='4.5' height='9' rx='2.2'/%3E%3Crect x='22' y='12' width='4.2' height='8.5' rx='2.1'/%3E%3Crect x='5' y='16' width='4.4' height='9' rx='2.2' transform='rotate(-38 7 20)'/%3E%3Crect x='10.5' y='14.5' width='15.7' height='14.5' rx='5'/%3E%3C/g%3E%3Cg fill='%23fff'%3E%3Crect x='12.5' y='2' width='5' height='16' rx='2.5'/%3E%3Crect x='17.5' y='10.5' width='4.5' height='9' rx='2.2'/%3E%3Crect x='22' y='12' width='4.2' height='8.5' rx='2.1'/%3E%3Crect x='5' y='16' width='4.4' height='9' rx='2.2' transform='rotate(-38 7 20)'/%3E%3Crect x='10.5' y='14.5' width='15.7' height='14.5' rx='5'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") 30 16, pointer;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; color: #e9e0cc; overflow: hidden; overscroll-behavior: none; }
body { font-family: "IM Fell English", Georgia, serif; -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }

/* the game window: a 16:10 still, centred in black; on a portrait phone it fills the height and you drag to look */
#view { position: fixed; inset: 0; overflow: hidden; background: #000; touch-action: none; cursor: var(--hand-open); user-select: none; -webkit-user-select: none; }
#frame { position: absolute; left: 0; top: 0; width: var(--fw); height: calc(var(--fw) / 1.6); will-change: transform; }
#scenes { position: absolute; inset: 0; transform-style: preserve-3d; }
.scene { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity .48s linear; display: block; }
.scene.on { opacity: 1; }
#scenes.turn-out { transition: transform .62s cubic-bezier(.5, 0, .9, .5); transform: perspective(1400px) rotateY(88deg); }
#scenes.turn-in { transition: none; transform: perspective(1400px) rotateY(-88deg); }
#scenes.turn-done { transition: transform .62s cubic-bezier(.1, .5, .5, 1); transform: perspective(1400px) rotateY(0); }

#hots { position: absolute; inset: 0; pointer-events: none; }
.hot { position: absolute; display: block; pointer-events: auto; margin: 0; padding: 0; border: 0; background: transparent; cursor: var(--hand-up); border-radius: 2px; }
.hot[data-cur="back"] { cursor: var(--hand-down); }
.hot[data-cur="left"] { cursor: var(--hand-left); }
.hot[data-cur="right"] { cursor: var(--hand-right); }
.hot[data-cur="touch"] { cursor: var(--hand-open); }
.hot:focus { outline: none; }
.hot:focus-visible { outline: 2px solid rgba(255, 222, 160, .85); outline-offset: -2px; }
.hot.spine { cursor: var(--hand-open); transition: background .25s; }
.hot.spine:hover, .hot.spine:focus-visible { background: radial-gradient(ellipse 80% 60% at 50% 35%, rgba(255, 224, 168, .24), rgba(255, 224, 168, 0) 75%); mix-blend-mode: screen; }

/* firelight on the shelves and the chimney breast */
#glow { position: absolute; inset: 0; pointer-events: none; opacity: 0; mix-blend-mode: screen; transition: opacity .5s; }
#glow.fire-l { background: radial-gradient(ellipse 22% 38% at 2% 74%, rgba(255, 150, 60, .5), rgba(255, 120, 40, 0) 100%); }
#glow.fire-b { background: radial-gradient(ellipse 45% 30% at 50% 100%, rgba(255, 150, 60, .55), rgba(255, 120, 40, 0) 100%); }
#glow.lamp { background: radial-gradient(ellipse 9% 12% at 63.5% 44%, rgba(255, 210, 130, .35), rgba(255, 200, 120, 0) 100%); }

/* the open book: the left page in ink, the right page's moving panel */
#page { position: absolute; left: 22.6%; top: 27.6%; width: 23.8%; height: 40.4%; display: none; color: #2d1f12; mix-blend-mode: multiply; transform: rotate(-.5deg); pointer-events: none; overflow: hidden; }
#page.on { display: block; }
#pt { margin: 0 0 .25em; font: 400 calc(var(--fw) * .029)/1.15 "La Belle Aurore", cursive; color: #24180d; }
#pc { margin: 0 0 1.1em; font: calc(var(--fw) * .0118)/1.2 "IM Fell English SC", Georgia, serif; letter-spacing: .08em; color: #4a3520; }
#pd { margin: 0; font: calc(var(--fw) * .0152)/1.55 "La Belle Aurore", cursive; color: #2d1f12; }
#panel { position: absolute; left: 0; top: 0; width: 420px; height: 274px; padding: 0; border: 0; margin: 0; background: #000; transform-origin: 0 0; display: none; cursor: var(--hand-open); overflow: hidden; }
#panel.on { display: block; }
#panel canvas { display: block; width: 100%; height: 100%; filter: brightness(1.12) saturate(1.12) contrast(1.04); }
#panel::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .16) 0 1px, rgba(0, 0, 0, 0) 1px 3px); box-shadow: inset 0 0 18px rgba(255, 246, 220, .35); }
#panel.glowing { box-shadow: 0 0 34px 10px rgba(255, 238, 200, .42), 0 0 10px 2px rgba(255, 248, 228, .65); }
#panel.linking::after { opacity: 0; transition: opacity .9s; }
#panel:focus-visible { outline: 2px solid rgba(255, 230, 180, .9); }

/* the brass plate over the fireplace */
#keys { position: absolute; left: 39.84%; top: 17.92%; width: 19.92%; height: 30.83%; display: none; pointer-events: none; }
#keys.on { display: block; }

/* on a touch screen there is no cursor to show "turn around", so the hand shows itself */
#backhand { position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); width: 44px; height: 44px; margin-left: -22px; border: 0; padding: 0; background-color: transparent; background-position: center; background-size: 30px 30px; background-repeat: no-repeat; opacity: .62; z-index: 5; }
#backhand { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cg transform='rotate(180 16 16)'%3E%3Cg stroke='%23000' stroke-width='2.4'%3E%3Crect x='12.5' y='2' width='5' height='16' rx='2.5'/%3E%3Crect x='17.5' y='10.5' width='4.5' height='9' rx='2.2'/%3E%3Crect x='22' y='12' width='4.2' height='8.5' rx='2.1'/%3E%3Crect x='5' y='16' width='4.4' height='9' rx='2.2' transform='rotate(-38 7 20)'/%3E%3Crect x='10.5' y='14.5' width='15.7' height='14.5' rx='5'/%3E%3C/g%3E%3Cg fill='%23fff'%3E%3Crect x='12.5' y='2' width='5' height='16' rx='2.5'/%3E%3Crect x='17.5' y='10.5' width='4.5' height='9' rx='2.2'/%3E%3Crect x='22' y='12' width='4.2' height='8.5' rx='2.1'/%3E%3Crect x='5' y='16' width='4.4' height='9' rx='2.2' transform='rotate(-38 7 20)'/%3E%3Crect x='10.5' y='14.5' width='15.7' height='14.5' rx='5'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"); }

/* the closed book on black */
#title { position: fixed; inset: 0; z-index: 20; background: #000; display: grid; place-items: center; transition: opacity 1s linear; }
#title.gone { opacity: 0; pointer-events: none; }
#title[hidden] { display: none; }
#cover { border: 0; padding: 0; margin: 0; background: none; cursor: var(--hand-open); width: min(96vw, 152vh); aspect-ratio: 16 / 10; }
#title { overflow: hidden; }
@media (max-aspect-ratio: 1/1) { #cover { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 158vw; max-width: none; } }
#cover img { display: block; width: 100%; height: 100%; image-rendering: auto; }
#cover:focus-visible { outline: 1px solid rgba(255, 220, 150, .5); outline-offset: -8%; }

/* the wristwatch while the island loads */
#loader { position: fixed; inset: 0; z-index: 30; background: #000; display: grid; place-items: center; transition: opacity .5s linear; }
#loader.gone { opacity: 0; pointer-events: none; }
#loader svg { image-rendering: pixelated; }
#hand-m, #hand-h { transform-origin: 16px 16px; transition: transform .25s steps(2); }

/* arriving in a world: the world fills the screen and its journal lies open on it */
#age { position: fixed; inset: 0; z-index: 10; background: #000; }
#age[hidden] { display: none; }
#age.fade { opacity: 0; transition: opacity .7s linear; }
#agebg { position: fixed; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 40%; }
#agescroll { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 40vh 16px 14vh; }
.journal { position: relative; max-width: 900px; margin: 0 auto; padding: clamp(22px, 5vw, 58px) clamp(18px, 5vw, 64px) clamp(28px, 5vw, 60px); color: var(--ink); font-size: 19px; line-height: 1.55;
  background-color: var(--paper);
  background-image: radial-gradient(ellipse 90% 60% at 50% 0%, rgba(255, 250, 232, .55), rgba(255, 250, 232, 0) 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .42 0 0 0 0 .3 0 0 0 0 .16 0 0 0 .11 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  box-shadow: inset 0 0 90px rgba(112, 70, 24, .38), inset 0 0 6px rgba(80, 50, 20, .5), 0 24px 70px rgba(0, 0, 0, .65);
  transform: translateY(26px); opacity: 0; transition: transform .9s cubic-bezier(.2, .7, .2, 1), opacity .9s linear; }
.journal.in { transform: none; opacity: 1; }
.jt:focus { outline: none; }
.cap-i { font-family: "IM Fell English", Georgia, serif; font-style: italic; font-size: .92em; }
.jt { margin: 0; font: 400 clamp(34px, 5.2vw, 54px)/1.15 "La Belle Aurore", cursive; color: #22170c; }
.jc { margin: .2em 0 1.4em; font: 15px/1.3 "IM Fell English SC", Georgia, serif; letter-spacing: .12em; color: #5a4027; }
.jk { --ab-fg: #2c2016; --ab-muted: #5d4630; --ab-accent: #7a4a12; --ab-chrome: 96px; }
.jk .ab-media { gap: 30px; }
.jk .ab-lede { font-style: italic; font-size: 21px; line-height: 1.5; }
.jk .ab-heading { font: 400 27px/1.3 "La Belle Aurore", cursive; color: #2a1c10; margin-top: 8px; }
.jk .ab-text { font-size: 18.5px; }
.jk .ab-frame, .jk .ab-image img { outline: 7px solid #f5ecd6; box-shadow: 0 0 0 8px rgba(90, 60, 25, .25), 0 10px 26px rgba(60, 38, 14, .45); }
.jk .ab-portrait .ab-frame { outline-width: 6px; }
.jk figcaption { font: 18px/1.3 "La Belle Aurore", cursive; color: #4b3520; margin-top: 14px; }
.jk .ab-credits { font-style: italic; font-size: 15px; border-top: 1px solid rgba(80, 55, 25, .3); padding-top: 14px; }
.jk audio { filter: sepia(.5); }
.jk a { color: #6e3f10; }
.about-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.about-list b { font-weight: 400; font-family: "IM Fell English SC", Georgia, serif; letter-spacing: .06em; }
.about-list span { display: block; font-style: italic; font-size: 16.5px; color: #4d3822; }

#home { position: fixed; left: max(14px, env(safe-area-inset-left)); bottom: max(14px, env(safe-area-inset-bottom)); width: 84px; height: 62px; padding: 0; border: 0; z-index: 12; cursor: var(--hand-open);
  background: url("art/closed.png") 50% 50% / 162% auto no-repeat; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .7)); transition: transform .2s; border-radius: 4px; }
#home:hover { transform: translateY(-3px) rotate(-2deg); }
#home:focus-visible { outline: 2px solid rgba(255, 220, 150, .8); outline-offset: 3px; }

/* on a tall screen the world is a band across the top, and the journal rises over its lower edge */
@media (max-aspect-ratio: 1/1) {
  #agebg { height: 42vh; bottom: auto; }
  #agescroll { padding-top: 37vh; }
  #home { top: max(12px, env(safe-area-inset-top)); bottom: auto; left: max(12px, env(safe-area-inset-left)); width: 64px; height: 48px; }
}
@media (max-width: 640px) {
  #agescroll { padding-left: 0; padding-right: 0; padding-bottom: 80px; }
  .journal { font-size: 17.5px; box-shadow: inset 0 0 60px rgba(112, 70, 24, .38), 0 18px 50px rgba(0, 0, 0, .6); }
  .jk .ab-lede { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) {
  .scene, #title, #loader, .journal { transition: none !important; }
}

/* on a tall screen the still is wider than the glass: a hand at the edge says there's more that way */
.look { position: fixed; top: 50%; width: 40px; height: 52px; margin-top: -26px; border: 0; padding: 0; background-color: transparent; background-position: center; background-size: 28px 28px; background-repeat: no-repeat; opacity: .5; z-index: 5; }
#lookl { left: max(2px, env(safe-area-inset-left)); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cg transform='rotate(-90 16 16)'%3E%3Cg stroke='%23000' stroke-width='2.4'%3E%3Crect x='12.5' y='2' width='5' height='16' rx='2.5'/%3E%3Crect x='17.5' y='10.5' width='4.5' height='9' rx='2.2'/%3E%3Crect x='22' y='12' width='4.2' height='8.5' rx='2.1'/%3E%3Crect x='5' y='16' width='4.4' height='9' rx='2.2' transform='rotate(-38 7 20)'/%3E%3Crect x='10.5' y='14.5' width='15.7' height='14.5' rx='5'/%3E%3C/g%3E%3Cg fill='%23fff'%3E%3Crect x='12.5' y='2' width='5' height='16' rx='2.5'/%3E%3Crect x='17.5' y='10.5' width='4.5' height='9' rx='2.2'/%3E%3Crect x='22' y='12' width='4.2' height='8.5' rx='2.1'/%3E%3Crect x='5' y='16' width='4.4' height='9' rx='2.2' transform='rotate(-38 7 20)'/%3E%3Crect x='10.5' y='14.5' width='15.7' height='14.5' rx='5'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"); }
#lookr { right: max(2px, env(safe-area-inset-right)); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cg transform='rotate(90 16 16)'%3E%3Cg stroke='%23000' stroke-width='2.4'%3E%3Crect x='12.5' y='2' width='5' height='16' rx='2.5'/%3E%3Crect x='17.5' y='10.5' width='4.5' height='9' rx='2.2'/%3E%3Crect x='22' y='12' width='4.2' height='8.5' rx='2.1'/%3E%3Crect x='5' y='16' width='4.4' height='9' rx='2.2' transform='rotate(-38 7 20)'/%3E%3Crect x='10.5' y='14.5' width='15.7' height='14.5' rx='5'/%3E%3C/g%3E%3Cg fill='%23fff'%3E%3Crect x='12.5' y='2' width='5' height='16' rx='2.5'/%3E%3Crect x='17.5' y='10.5' width='4.5' height='9' rx='2.2'/%3E%3Crect x='22' y='12' width='4.2' height='8.5' rx='2.1'/%3E%3Crect x='5' y='16' width='4.4' height='9' rx='2.2' transform='rotate(-38 7 20)'/%3E%3Crect x='10.5' y='14.5' width='15.7' height='14.5' rx='5'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"); }
.look[hidden], #backhand[hidden] { display: none; }
