/* THE VISITOR -- browser build.
   The page is a frame around a 512x384 screen and nothing else, so the
   chrome stays out of the way: black ground, no borders, no rounded
   anything. Everything the visitor looks at is inside the canvas. */

:root {
  color-scheme: dark;
  --ink: #e8e4dc;
  --ink-faint: #8b857b;
  --rule: #2a2724;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #000;
  color: var(--ink);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic",
               "Noto Sans JP", system-ui, sans-serif;
  overscroll-behavior: none;
}

/* --- the screen ------------------------------------------------------- */

#stage {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
}

#screen {
  display: block;
  width: min(100vw, calc(100vh * 512 / 384));
  width: min(100vw, calc(100dvh * 512 / 384));
  height: auto;
  aspect-ratio: 512 / 384;
  /* The artwork is 512x384 dots. Every dot stays a dot. */
  image-rendering: pixelated;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  cursor: url("assets/cursor_hand.png") 19 17, pointer;
}

#screen.busy { cursor: url("assets/cursor_wait.png") 21 30, wait; }

/* --- full-screen button ----------------------------------------------- */

#fullscreen {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--rule);
  background: rgba(0, 0, 0, .55);
  color: var(--ink-faint);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  opacity: .25;
  transition: opacity .25s;
}

#fullscreen:hover,
#fullscreen:focus-visible { opacity: 1; color: var(--ink); }

/* Gone entirely while the piece is on, and not just faded: in a window that
   happens to be 4:3 the canvas reaches this corner, and a button sitting on
   top of it would swallow the hotspot underneath. Bringing the pointer up to
   the top edge brings it back. */
body.playing #fullscreen { opacity: 0; pointer-events: none; }
body.playing.show-controls #fullscreen { opacity: .55; pointer-events: auto; }
body.playing.show-controls #fullscreen:hover,
body.playing.show-controls #fullscreen:focus-visible { opacity: 1; }
body.playing #fullscreen:hover,
body.playing #fullscreen:focus-visible { opacity: 1; }

/* --- overlay panels --------------------------------------------------- */

#overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #000;
}

#overlay[hidden] { display: none; }

.panel {
  width: min(520px, 100%);
  text-align: center;
}

.panel[hidden] { display: none; }

.panel h1 {
  margin: 0;
  font-size: clamp(28px, 7vw, 44px);
  font-weight: 600;
  letter-spacing: .22em;
  text-indent: .22em;
}

.sub {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.8;
  color: var(--ink-faint);
  letter-spacing: .08em;
}

.status {
  margin: 28px 0 0;
  font-size: 14px;
  line-height: 1.9;
  color: var(--ink-faint);
}

.bar {
  margin: 14px auto 0;
  width: min(280px, 80%);
  height: 2px;
  background: var(--rule);
}

.bar i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--ink-faint);
  transition: width .2s linear;
}

.go {
  margin: 30px 0 0;
  padding: 13px 34px;
  border: 1px solid var(--ink-faint);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  letter-spacing: .18em;
  text-indent: .18em;
  cursor: pointer;
  transition: background .2s, color .2s;
}

.go:hover, .go:focus-visible { background: var(--ink); color: #000; }

.howto {
  margin: 34px auto 0;
  padding: 0;
  max-width: 400px;
  list-style: none;
  text-align: left;
  font-size: 12.5px;
  line-height: 1.95;
  color: var(--ink-faint);
}

.howto li { padding-left: 1.1em; text-indent: -1.1em; }
.howto li::before { content: "・"; }

@media (prefers-reduced-motion: reduce) {
  #fullscreen, .bar i, .go { transition: none; }
}
