/*
 * Bricolage Grotesque for the voice (bricolage: making things from what you have),
 * Gochi Hand for the child's notes, Lilita One only for the game's own logo.
 */
:root {
  --ink: #102C3A;
  --forest: #124B31;
  --kraft: #D3A56C;
  --paper: #F4E7CF;
  --sun: #FFCB45;
  --voice: "Bricolage", sans-serif;
  --hand: "Gochi", cursive;
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; overflow: hidden; }
body { touch-action: none; -webkit-tap-highlight-color: transparent; }

body {
  background: var(--ink);
  color: var(--ink);
  font: 500 40px/1.18 var(--voice);
  cursor: default;
  user-select: none;
}
body.idle { cursor: none; }

h1, h2, h3 { font-family: var(--voice); font-weight: 800; font-stretch: 75%; }
h2 { font-size: 152px; line-height: .88; }
img, video { display: block; }
img { -webkit-user-drag: none; }
ul, ol { list-style: none; padding: 0; }

#backdrops, #world { position: fixed; inset: 0; width: 100%; height: 100%; }
#world { pointer-events: none; }
#backdrops i {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: center bottom / cover no-repeat;
  transition: opacity .9s ease;
}
#backdrops i.on { opacity: 1; }
#backdrops [data-scene="day"] { background-image: url(../assets/scenes/day.svg); }
#backdrops [data-scene="dump"] { background-image: url(../assets/scenes/dump.svg); }
#backdrops [data-scene="hard"] { background-image: url(../assets/scenes/hard.svg); }
#backdrops [data-scene="meadow"] { background-image: url(../assets/scenes/meadow.svg); }
#backdrops [data-scene="night"] { background-image: url(../assets/scenes/night.svg); }
#backdrops [data-scene="dawn"] { background-image: url(../assets/scenes/dawn.svg); }
#backdrops [data-scene="sea"] { background-image: radial-gradient(circle at 70% 48%, #2BC0EA, #0D8FD3 55%, #075C9C); }
#backdrops [data-scene="paper"] { background-image: radial-gradient(circle at 73% 49%, #E9C48F 0, #D3A56C 42%, #AF7943 100%); }
#backdrops [data-scene="workshop"] { background-image: linear-gradient(#24130BE0 0, #24130B88 32%, #24130B00 60%), url(../assets/world/workshop.webp); }

#hint {
  position: fixed;
  z-index: 4;
  inset: auto 0 0;
  padding: 10px 24px;
  background: var(--ink);
  color: #fff;
  font-size: max(18px, calc(30px * var(--scale, 1)));
  text-align: center;
}
#hint[hidden] { display: none; }

#stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1920px;
  height: 1080px;
  transform: translate(-50%, -50%) scale(var(--scale, 1));
}

.slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity .22s ease, visibility 0s linear .22s;
}
/* Arrive after the world has started to travel, so text never rides over the tree. */
.slide.active { opacity: 1; visibility: visible; transition: opacity .5s ease .4s, visibility 0s; }

.slide [data-in], .slide [data-only] {
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility 0s linear .2s;
}
.slide.active [data-in].on, .slide.active [data-only].on {
  opacity: 1;
  visibility: visible;
  transition: opacity .4s ease .25s, visibility 0s;
}

.hand { font: 400 62px/.98 var(--hand); }

.wordmark { font: 400 310px/1 "Lilita One", sans-serif; white-space: nowrap; }
.wordmark > span { color: #fff; -webkit-text-stroke: 22px #1A2A3C; paint-order: stroke fill; }
.wordmark > span + span { color: var(--sun); }
.wordmark.small { font-size: 96px; }
.wordmark.small > span { -webkit-text-stroke-width: 9px; }

.kraft {
  background: var(--kraft);
  clip-path: polygon(0 9%, 8% 3%, 17% 8%, 29% 0, 41% 6%, 56% 1%, 70% 7%, 86% 2%, 100% 8%, 99% 36%, 100% 64%, 99% 96%, 87% 92%, 72% 100%, 58% 93%, 43% 98%, 28% 92%, 13% 99%, 0 94%, 1% 60%);
}
.tape { position: absolute; background: #FFF3B8B8; }

.phone {
  position: absolute;
  width: var(--w, 340px);
  padding: 11px;
  border-radius: 48px;
  background: #0A1B25;
}
.phone .screen { position: relative; aspect-ratio: 360 / 760; overflow: hidden; border-radius: 38px; }
.phone .screen > img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.focus { position: absolute; left: 13%; right: 11%; top: 7%; bottom: 14%; border: 5px solid var(--sun); border-radius: 18px; }
.focus b {
  position: absolute;
  left: -5px;
  top: -5px;
  padding: 5px 14px;
  border-radius: 14px 0 14px 0;
  background: var(--sun);
  color: var(--ink);
  font: 700 25px var(--voice);
}
.shutter { position: absolute; left: 50%; bottom: 3%; width: 62px; height: 62px; margin-left: -31px; border: 7px solid #fff; border-radius: 50%; }

#toast {
  position: fixed;
  left: 24px;
  bottom: 20px;
  padding: 10px 18px;
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
  font-size: 18px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
#toast.show { opacity: 1; }
#curtain { position: fixed; inset: 0; background: var(--ink); z-index: 5; }
#curtain[hidden] { display: none; }

/* Phones held upright */
#rotate {
  position: fixed; inset: 0; z-index: 6; display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  padding: 24px; background: var(--ink); color: #fff; text-align: center; font-size: 22px;
}
#rotate svg { width: 120px; fill: none; stroke: var(--sun); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; animation: turn 2.4s ease-in-out infinite; }
#rotate circle { fill: var(--sun); stroke: none; }
#rotate button { padding: 10px 22px; border: 2px solid #ffffff66; border-radius: 999px; background: none; color: #fff; font: inherit; font-size: 17px; }
@keyframes turn { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
/* Any touch screen held upright, or any narrow upright window (also in "desktop site" mode). */
@media (orientation: portrait) and (max-width: 900px), (orientation: portrait) and (pointer: coarse), (orientation: portrait) and (hover: none) {
  body:not(.upright-ok) #rotate { display: flex; }
}

body.still, body.still *, body.still *::before, body.still *::after {
  transition: none !important;
  animation: none !important;
}
