/* The page is a desktop (the wallpaper of the Store pictures). Up top the real Mino demonstrates;
   below him a bigger Mino tells the story, one slide at a time. */
:root {
  --sky: #e8e4da;
  --sea: #93a9bf;
  --ink: #14151a;
  --panel: #0a0a0b;
  --cream: #fff1da;
  --soft: #c9bfae;
  --edge: rgba(255, 255, 255, .16);
  --lift: 0 6px 18px rgba(0, 0, 0, .4);
  --demo: 236px;           /* room for the island at its tallest; page.js sets the real figure */
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --sky: #232a38; --sea: #10131b; --ink: #f1eadc; }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--sea); }
body {
  min-height: 100vh;
  color: var(--ink);
  font: 400 1.125rem/1.55 "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(155deg, var(--sky), var(--sea));
}

/* Mino's layer. It only takes the mouse while the cursor is on something of his. */
#cv { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; z-index: 10; pointer-events: none; touch-action: none; }
.unseen, .said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#kb { left: 0; top: 0; }
#kb:focus, #kb button:focus { outline: none; }

/* ---------- the deck ---------- */
/* Without scripts the slides simply follow one another down the page. */
.deck { padding: 2rem 1rem; }
.teller, .bar { display: none; }
.slide { max-width: 36rem; margin: 0 auto 1.5rem; }
.plain { text-align: center; padding: 1rem; }

.js, .js body { height: 100%; overflow: hidden; }
.js body { min-height: 0; }
.js .deck { position: fixed; inset: 0; display: flex; flex-direction: column; padding: var(--demo) 0 0; outline: none; }
/* never a scrollbar: on a short window page.js shrinks the story until it fits */
.js .show { flex: 1; min-height: 0; overflow: hidden; display: flex; padding: .5rem 1rem; }
.js .row { margin: auto; width: min(100%, 54rem); display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 2.5rem; }
.js .slides { display: grid; position: relative; }
/* all the slides share one cell, so the speech panel never jumps in size between them */
.js .slide { grid-area: 1 / 1; visibility: hidden; margin: 0; max-width: none; display: flex; flex-direction: column; justify-content: center; }
.js .slide.on { visibility: visible; }

.teller { border: 0; background: none; cursor: pointer; line-height: 0; border-radius: 16px; }
.who { display: none; }
.js .who { display: flex; flex-direction: column; align-items: center; gap: 1rem; position: relative; }
.voice { border: 0; background: var(--panel); border-radius: 8px; padding: 4px; line-height: 0; cursor: pointer; box-shadow: var(--lift); }
.voice canvas { display: block; }
.voice:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.js .teller { display: block; }
.teller:focus-visible { outline: 3px solid var(--ink); outline-offset: 6px; }
/* teller.js moves him; his canvas is bigger than the button and must not catch clicks meant for others */
.teller canvas { display: block; pointer-events: none; }

/* what Mino says, on a piece of his own screen */
.slide {
  position: relative;
  color: var(--cream);
  padding: 1.75rem clamp(1.25rem, 3vw, 2.25rem);
  border-radius: 30px;
  border: 1px solid var(--edge);
  /* the unlit dots of the screen */
  background: radial-gradient(circle, rgba(255, 255, 255, .055) 1.3px, transparent 1.6px) 0 0 / 8px 8px, var(--panel);
}
.js .slides { filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .32)); }
/* the tail that shows who is talking */
.js .slides::before {
  content: "";
  position: absolute;
  left: -15px;
  top: 50%;
  margin-top: -14px;
  border: 14px solid transparent;
  border-right-color: var(--panel);
  border-left: 0;
  border-right-width: 16px;
}
.js .slide.on { animation: arrive .32s cubic-bezier(.2, .8, .3, 1); }
.js .deck.back .slide.on { animation-name: arrive-back; }
@keyframes arrive { from { opacity: 0; transform: translateX(26px); } }
@keyframes arrive-back { from { opacity: 0; transform: translateX(-26px); } }

h1, h2 { width: 100%; line-height: 0; margin-bottom: 1.1rem; min-height: 1px; }
h1 canvas, h2 canvas { display: inline-block; pointer-events: none; }
.speech { font-size: clamp(1.05rem, .95rem + .55vw, 1.3rem); line-height: 1.5; max-width: 38ch; }
.speech .unsaid { visibility: hidden; }
.note { margin-top: 1rem; font-size: .9rem; color: var(--soft); }
a { color: inherit; }
kbd { font: inherit; font-size: .9em; border: 1px solid var(--edge); border-radius: 6px; padding: 0 .35em; }

/* Buttons are drawn as the app draws them: 4px dots, 11 dots tall. */
.keys { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.25rem; }
.key { border: 0; background: var(--panel); border-radius: 8px; line-height: 0; cursor: pointer; font: inherit; }
.key canvas { display: block; }
.key:active { transform: translateY(2px); }
.key:focus-visible { outline: 2px solid var(--cream); outline-offset: 3px; }

/* ---------- Mino showing how: a copy of him flies up with a cursor (demo.js) ---------- */
#puppet, #cursor, #ripple { position: fixed; left: 0; top: 0; display: none; pointer-events: none; }
#puppet { z-index: 11; }
#cursor { z-index: 13; transform-origin: 0 0; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .45)); }
#cursor.down { scale: .8; }
#ripple { z-index: 12; width: 14px; height: 14px; margin: -7px; border: 3px solid #ff6b4a; border-radius: 50%; opacity: 0; }
#ripple.go { animation: ripple .45s ease-out; }
@keyframes ripple { from { opacity: 1; scale: 1; } to { opacity: 0; scale: 3.6; } }
.demoing #puppet, .demoing #cursor, .demoing #ripple { display: block; }
.demoing .teller { visibility: hidden; }
/* while he is touching the island, the visitor's pointer passes by it */
.demoing #cv { pointer-events: none !important; }

/* ---------- getting about: quiet, along the bottom ---------- */
.js .bar { display: flex; justify-content: center; align-items: flex-end; gap: clamp(.25rem, 2vw, 1.25rem); padding: .25rem .5rem max(.75rem, env(safe-area-inset-bottom)); }
.arrow, .sections button { border: 0; background: none; color: inherit; font: inherit; cursor: pointer; border-radius: 8px; }
.arrow { width: 44px; height: 44px; display: grid; place-items: center; opacity: .7; }
.arrow:hover { opacity: 1; }
.arrow:disabled { opacity: .2; cursor: default; }
.sections { display: flex; list-style: none; gap: clamp(.4rem, 2.5vw, 1.75rem); align-items: flex-end; }
.sections li { display: flex; flex-direction: column; align-items: center; }
.sections .name { font-size: .8rem; line-height: 1.2; padding: .25rem .35rem; opacity: .75; white-space: nowrap; }
.sections .name:hover { opacity: 1; }
.sections li.here .name { opacity: 1; font-weight: 600; }
.pips { display: flex; }
.pips button { width: 22px; height: 24px; display: grid; place-items: center; }
.pips button::before { content: ""; width: 6px; height: 6px; border-radius: 3px; background: currentColor; opacity: .35; transition: width .2s; }
.pips button:hover::before { opacity: .7; }
.pips button[aria-current]::before { width: 16px; opacity: 1; }
.arrow:focus-visible, .sections button:focus-visible { outline: 2px solid var(--ink); outline-offset: 0; }

/* ---------- narrow: Mino stands above what he says ---------- */
@media (max-width: 44rem) {
  body { font-size: 1.0625rem; }
  .js .row { grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 1.1rem; }
  /* he stays in the middle, with the voice button beside him */
  .js .who { width: 100%; }
  .voice { position: absolute; right: 0; bottom: 0; }
  .js .slides { width: 100%; }
  .js .slides::before { left: 50%; top: -15px; margin: 0 0 0 -14px; border: 14px solid transparent; border-top: 0; border-bottom: 16px solid var(--panel); }
  .slide { padding: 1.25rem 1.15rem; }
  .keys { margin-top: 1rem; }
  .pips button { width: 18px; }
  .sections .name { font-size: .75rem; padding-inline: .1rem; }
  .arrow { width: 32px; }
}
/* short screens: tighten up before anything has to scroll */
@media (max-height: 42rem) {
  .slide { padding-block: 1.1rem; }
  h1, h2 { margin-bottom: .75rem; }
  .speech { font-size: 1rem; line-height: 1.4; }
  .keys { margin-top: .75rem; }
  .note { margin-top: .5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .js .slide.on { animation: none; }
}
