/* One project per screen; the whole room takes its colour. */
@property --glow { syntax: "<color>"; inherits: true; initial-value: #8a3fb8; }
@property --deep { syntax: "<color>"; inherits: true; initial-value: #230f3d; }
* { box-sizing: border-box; margin: 0; }
html { overflow: hidden; } /* or phones widen the page for the slides turned to the sides */
body {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  --glow: #8a3fb8;
  --deep: #230f3d;
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-columns: minmax(0, 1fr);
  overflow: hidden;
  overflow: clip;
  background: radial-gradient(60vmax 60vmax at 50% 45%, var(--glow), var(--deep) 75%);
  color: #fff;
  font: 400 clamp(1rem, 2.2vh, 1.2rem)/1.5 "Bricolage Grotesque", system-ui, sans-serif;
  transition: --glow .6s, --deep .6s;
}
body[data-on="ratscanner"] { --glow: #b0243f; --deep: #2b0712; }
body[data-on="namechecker"] { --glow: #4b52d6; --deep: #0f1245; }
body[data-on="bio"] { --glow: #0f8f88; --deep: #052a30; }
body[data-on="verhost"] { --glow: #1f6fc4; --deep: #07203f; }

/* The 3D models, behind the text. */
#scene { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
header, #stage, nav { position: relative; z-index: 1; }
body.webgl .logo img { visibility: hidden; }
.hint { display: none; margin-left: auto; font-size: .9rem; opacity: .8; text-align: right; line-height: 1.25; }
body.webgl .hint { display: block; transition: opacity .5s; }
body.webgl.played .hint { opacity: 0; }
body.webgl .hint + p { margin-left: 1rem; }
@media (max-width: 560px) { body.webgl .hint + p { display: none; } }
#snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }

header { display: flex; align-items: center; gap: .6rem; padding: 1rem clamp(1rem, 4vw, 3rem); }
header img { width: 40px; height: 40px; }
h1 { font-size: 1.4rem; font-weight: 800; }
header p { margin-left: auto; opacity: .75; font-size: .95rem; }

/* The ring: app.js places the sections in depth. */
#stage { position: relative; min-height: 0; perspective: 1400px; transform-style: preserve-3d; touch-action: none; cursor: grab; }
#stage:active { cursor: grabbing; }
section {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  text-align: center;
  padding: 0 1.25rem;
}
@media (scripting: none) { #stage { overflow: auto; } section { position: static; height: 100%; } }
h2 {
  font-size: min(13vw, 17vh);
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1;
  white-space: nowrap;
  text-shadow: 0 1px 0 #ffffffb0, 0 2px 0 var(--glow), 0 3px 0 var(--glow), 0 4px 0 var(--glow), 0 5px 0 var(--deep), 0 6px 0 var(--deep), 0 14px 22px #0008;
}
.logo {
  height: 100%;
  aspect-ratio: 1;
  max-width: 100%;
  min-height: 0;
  margin-top: -3vh; /* the glass sits over the lower edge of the name */
  position: relative;
  transform-style: preserve-3d;
  animation: float 6s ease-in-out infinite;
}
section > img { height: 100%; max-width: 100%; min-height: 0; object-fit: contain; } /* before app.js runs */
.logo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
@keyframes float { 50% { translate: 0 -1.5vh; } }
section p { max-width: 38ch; margin: 1.5vh 0 2vh; transform: translateZ(40px); }
section > a {
  transform: translateZ(60px);
  background: #fff;
  color: var(--deep);
  font-weight: 800;
  text-decoration: none;
  padding: .75rem 1.75rem;
  border-radius: 99px;
}
section > a:hover { background: #ffe9f6; }

nav {
  justify-self: center;
  display: flex;
  gap: clamp(.25rem, 1.5vw, .75rem);
  margin: 2.5vh 0 max(2vh, env(safe-area-inset-bottom));
  padding: .5rem;
  border-radius: 99px;
  background: #ffffff1c;
}
nav a { display: grid; place-items: center; width: clamp(52px, 8vh, 72px); aspect-ratio: 1; border-radius: 50%; }
nav img { width: 76%; height: 76%; }
nav a { transition: scale .15s ease-out, translate .15s ease-out; }
nav a[aria-current] { background: #ffffff40; }
a:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

/* Entrance of the current slide, and the way out of the previous one. */
h2 span { display: inline-block; }
section > a { transition: scale .2s; }
section > a:hover { scale: 1.06; }
nav a[aria-current] img { animation: hop .5s ease; }
@keyframes hop { 40% { translate: 0 -10px; } }

/* Plays even with reduced motion set in the system: the owner's choice. */
@media (scripting: enabled) {
  section { --spring: cubic-bezier(.34, 1.56, .64, 1); }
  h2 span { opacity: 0; translate: 0 .6em; rotate: 14deg; transition: opacity .25s, translate .25s, rotate .25s; }
  .logo { scale: .8; transition: scale .25s; }
  section > p, section > a { opacity: 0; translate: 0 30px; transition: opacity .25s, translate .25s, scale .2s; }

  section.on h2 span {
    opacity: 1; translate: 0; rotate: 0deg;
    transition: opacity .4s, translate .6s var(--spring), rotate .6s var(--spring);
    transition-delay: calc(var(--i) * 40ms);
  }
  section.on .logo { scale: 1; transition: scale .8s var(--spring) .15s; }
  section.on > p { opacity: 1; translate: 0; transition: opacity .5s .35s, translate .6s var(--spring) .35s; }
  section.on > a { opacity: 1; translate: 0; transition: opacity .5s .45s, translate .6s var(--spring) .45s, scale .2s; }
}

/* On the way out everything but the flying logo steps aside. */
body.leaving section.on :is(h2, p, a), body.leaving section:not(.on) .logo img, body.leaving header, body.leaving nav {
  opacity: 0;
  transition: opacity .3s;
}
.logo { cursor: grab; }
