:root {
  --ink: 222 240 255;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #04162a;
}

body {
  color: rgb(var(--ink));
  font:
    400 12px/1.4 ui-sans-serif,
    system-ui,
    -apple-system,
    'Segoe UI',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

#sea,
#whales {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  animation: dawn 4s ease-out both;
}

/* the water fades up out of the dark as the page opens */
@keyframes dawn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* the edges of your view, darker; darker still in stillness */
#veil {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 80% 75% at 50% 50%, rgb(0 5 13 / 0) 40%, rgb(0 5 13 / 0.6) 100%);
  opacity: 0.9;
  transition: opacity 2.5s ease;
}
.still #veil {
  opacity: 1;
}

/* --- intro ---------------------------------------------------------------- */

#intro {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  transition:
    opacity 2.4s ease,
    filter 2.4s ease,
    transform 3.2s ease;
}

/* a single ring of light, breathing: touch it, or anywhere, to go in */
#intro .ring {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 1px solid rgb(var(--ink) / 0.55);
  box-shadow:
    0 0 24px rgb(150 220 255 / 0.35),
    inset 0 0 18px rgb(150 220 255 / 0.18);
  animation: breathe 6s ease-in-out infinite;
}
#intro .ring::after {
  content: '';
  position: absolute;
  inset: 31px;
  border-radius: 50%;
  background: rgb(var(--ink) / 0.8);
  box-shadow: 0 0 14px rgb(170 230 255 / 0.9);
}

.entered #intro {
  opacity: 0;
  filter: blur(10px);
  transform: scale(1.6);
}

@keyframes breathe {
  0%,
  100% {
    transform: scale(0.86);
    opacity: 0.55;
  }
  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

/* --- hud ------------------------------------------------------------------ */

#hud {
  opacity: 0;
  pointer-events: none;
  transition: opacity 3s ease 1.8s;
}
.entered #hud {
  opacity: 1;
}
.entered.still #hud {
  opacity: 0.25;
  transition-delay: 0s;
}

#gauge {
  position: fixed;
  right: 30px;
  top: 50%;
  height: 36vh;
  width: 1px;
  transform: translateY(-50%);
  background: linear-gradient(to bottom, rgb(var(--ink) / 0), rgb(var(--ink) / 0.28) 15%, rgb(var(--ink) / 0.28) 85%, rgb(var(--ink) / 0));
}

#gauge-pos {
  position: absolute;
  left: 0;
  top: 0;
}
#gauge-pos::before {
  content: '';
  position: absolute;
  left: -3px;
  top: -3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgb(var(--ink) / 0.9);
  box-shadow: 0 0 12px rgb(150 220 255 / 0.8);
}

#sound {
  position: fixed;
  left: 18px;
  bottom: max(16px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  padding: 10px;
  border: 0;
  background: none;
  color: inherit;
  opacity: 0.5;
  cursor: pointer;
  pointer-events: auto;
  transition: opacity 0.4s;
}
#sound:hover,
#sound:focus-visible {
  opacity: 0.95;
}
#sound:focus-visible {
  outline: 1px solid rgb(var(--ink) / 0.5);
  outline-offset: 2px;
  border-radius: 4px;
}

.bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}
.bars i {
  width: 2px;
  height: 100%;
  border-radius: 1px;
  background: currentColor;
  transform-origin: bottom;
  animation: eq 2.4s ease-in-out infinite;
}
.bars i:nth-child(2) {
  animation-delay: -0.8s;
}
.bars i:nth-child(3) {
  animation-delay: -1.6s;
}
#sound[aria-pressed='false'] .bars i {
  animation: none;
  transform: scaleY(0.18);
}

@keyframes eq {
  0%,
  100% {
    transform: scaleY(0.3);
  }
  50% {
    transform: scaleY(1);
  }
}

/* --- odds and ends -------------------------------------------------------- */

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

#debug {
  position: fixed;
  left: 12px;
  top: 56px;
  margin: 0;
  font:
    11px/1.5 ui-monospace,
    monospace;
  color: #9fe;
  opacity: 0.8;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  #intro .ring,
  .bars i {
    animation: none;
  }
}
@media (max-width: 600px) {
  #gauge {
    right: 18px;
  }
}
