/* base.css
 *
 * The page itself and what all three scenes share. Each scene's own look
 * is in its own file (day-beach.css, underwater.css, night-beach.css).
 */

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  /* The words written over the paintings (the day beach's sky, the
     underwater scene): a warm off-white. */
  --warm-white: #f4ede0;

  /* A soft shadow under those words, so they read over the painting: a
     close, crisp one and a wide, soft one, in the sea's deep blue. The
     handwriting has it as drop-shadow filters (after its paint, see
     hand-paint.js), whose blur is half a text-shadow's for the same
     softness. */
  --words-shadow: 0 1px 2px rgba(10, 35, 80, 0.4), 0 3px 18px rgba(10, 35, 80, 0.4);
  --hand-shadow: drop-shadow(0 1px 1px rgba(10, 35, 80, 0.4)) drop-shadow(0 3px 9px rgba(10, 35, 80, 0.4));
}

html {
  /* The underwater painting's average blue: if a phone's scroll bounces
     past an edge, this shows instead of white. */
  background: #3b7cc6;
  /* Stop the rubber-band bounce at the top and bottom of the underwater
     scroll, which would pull the painting away from the screen edge. */
  overscroll-behavior: none;
}

body {
  margin: 0;
  /* Inter (from Google Fonts, see index.html) for everything but the
     handwriting; the system's own font until it arrives. */
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.4;
}

/* Some scenes set `display` themselves, which would otherwise win over the
   browser's own rule for `hidden`. Hidden must always mean hidden. */
[hidden] {
  display: none !important;
}

/* A scene is a layer. The beaches are fixed to the screen; the underwater
   scene is a tall, normal part of the page, so it scrolls the native way. */
.scene {
  overflow: hidden;
}

/* Scenes take keyboard focus when they are switched to (so a screen reader
   announces the new scene), but are not controls themselves: no ring. */
.scene:focus {
  outline: none;
}

.scene--full-screen {
  position: fixed;
  inset: 0;
  /* Above the underwater scene, so later the dive can show the beach above
     the waterline and the underwater painting below it. */
  z-index: 2;
}

.scene--tall {
  position: relative;
  width: 100%;
  /* The height is set by underwater.js. */
  z-index: 1;
}

/* The painting fills its scene like a cover photo. Which part of it shows
   on a screen of a different shape (object-position) is set by each
   scene's script, so the campfire or the coral stays in view. */
.scene-painting {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* The paintings are scenery, not pictures to drag, select or save. */
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* A beach's gentle motion, drawn exactly over its painting (see
   day-beach-motion.js and night-beach-motion.js). Clicks go through it to
   whatever is above. Invisible until its files have loaded; each scene's
   motion then shows it. */
.scene-motion {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
}
