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

  html, body {
    height: 100%;
    margin: 0;
    background: #000;
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: none;
    -webkit-text-size-adjust: 100%;
  }

  body {
    color: #fff;
    font-family: "DM Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    opacity: 0;
    transition: opacity .9s ease;
  }
  body.ready { opacity: 1; }

  /* fallback if WebGL is unavailable: the photo, plainly */
  body.flat {
    background-size: cover;
    background-position: 50% 50%;
    background-repeat: no-repeat;
  }

  /* ---------- the surface ---------- */

  #stage {
    position: fixed;
    inset: 0;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
  }

  /* vignette + grain, both non-interactive */
  #overlay {
    position: fixed;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    background:
      radial-gradient(120% 90% at 50% 50%,
        rgba(0,0,0,0) 24%,
        rgba(0,0,0,.34) 68%,
        rgba(0,0,0,.80) 100%);
  }

  #grain {
    position: fixed;
    inset: -50%;
    z-index: 4;
    pointer-events: none;
    opacity: .10;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'>\
<filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/></filter>\
<rect width='160' height='160' filter='url(%23n)'/></svg>");
    animation: drift 1.6s steps(3) infinite;
  }
  @keyframes drift {
    0%   { transform: translate(0,0); }
    50%  { transform: translate(-1.5%, 1%); }
    100% { transform: translate(1%, -1.5%); }
  }

  /* ---------- wordmark ---------- */

  #mark {
    position: fixed;
    left: auto;
    top: auto;
    right: calc(env(safe-area-inset-right, 0px) + clamp(.5rem, 2vw, 1.4rem));
    bottom: calc(env(safe-area-inset-bottom, 0px) + clamp(.5rem, 2vh, 1.4rem));
    z-index: 6;
    display: block;
    padding: 1rem;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
    outline: none;
  }
  #mark:focus-visible #word { outline: 1px solid rgba(255,255,255,.55); outline-offset: .6rem; }

  #word {
    display: block;
    font-family: "DM Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    font-weight: 500;
    font-size: clamp(1.1rem, 5vw, 2.1rem);
    line-height: 1;
    letter-spacing: 0;
    text-transform: lowercase;
    white-space: nowrap;
    color: #fff;
    opacity: .78;
    text-shadow: 0 0 2.4rem rgba(0,0,0,.55);
    transition: opacity .2s ease, text-shadow .2s ease;
    will-change: transform;
  }

  /* hover: the word comes up out of the water. desktop only. */
  @media (hover: hover) {
    #mark:hover #word {
      opacity: 1;
      text-shadow:
        0 0 .9rem rgba(255,255,255,.75),
        0 0 2.8rem rgba(255,255,255,.38),
        0 0 2.4rem rgba(0,0,0,.6);
    }
  }

  /* press: goes hard white, on desktop and on touch */
  #mark:active #word {
    opacity: 1;
    transition: opacity .06s ease, text-shadow .06s ease;
    text-shadow:
      0 0 .5rem rgba(255,255,255,.98),
      0 0 1.6rem rgba(255,255,255,.7),
      0 0 3.6rem rgba(255,255,255,.4),
      0 0 2.4rem rgba(0,0,0,.6);
  }

  /* ---------- exit flash ---------- */

  #flash {
    position: fixed;
    inset: 0;
    z-index: 30;
    background: #fff;
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s linear;
  }
  #flash.on { opacity: 1; }

  @media (prefers-reduced-motion: reduce) {
    #grain { animation: none; }
    #word { opacity: 1; }
  }
