/* ============================================================================
   Splash — the doorway at /.
   Black field, lightning and cursor-sand on a canvas, the wordmark typing
   itself in the middle. The whole viewport is one link to /home/.
   ========================================================================= */

:root {
  --ink: #f2f1ed;
  --mono: 'DM Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: #000;
  color: var(--ink);
  font-family: var(--mono);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  /* The page is one big link; stop iOS from flashing a tap highlight over it
     and from offering to select the wordmark on a long press. */
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

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

/* ── The doorway ─────────────────────────────────────────────────────────── */

.enter {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 34px;
  padding: 24px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.enter:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: -14px;
}

/* ── The thunder switch ──────────────────────────────────────────────────────
   Above the doorway in the stacking order, so the one thing on this page that
   is not "go in" can actually be pressed. Deliberately faint: it should be
   findable when looked for and invisible when not, which is why it only comes
   up to full on hover or focus.

   It is also what unlocks the sound. A browser will not play audio until the
   page has been interacted with, and the only other interaction here is the
   click that leaves — so pressing this is, in practice, how the storm is
   allowed to be heard. */

.thunder-toggle {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 2;
  width: 30px;
  height: 30px;
  display: grid;
  place-content: center;
  padding: 0;
  border: 1px solid rgba(206, 216, 232, 0.16);
  border-radius: 50%;
  background: rgba(10, 11, 13, 0.5);
  color: rgba(206, 216, 232, 0.5);
  cursor: pointer;
  opacity: 0.5;
  transition:
    opacity 0.25s ease,
    color 0.25s ease,
    border-color 0.25s ease;
}

.thunder-toggle:hover,
.thunder-toggle:focus-visible {
  opacity: 1;
  color: rgba(206, 216, 232, 0.95);
  border-color: rgba(206, 216, 232, 0.4);
}

/* A speaker, drawn rather than fetched: a small square with a triangular
   mouth. The slash across it is the muted state. */
.thunder-icon {
  position: relative;
  width: 13px;
  height: 11px;
}

.thunder-icon::before {
  content: '';
  position: absolute;
  left: 0;
  top: 3px;
  width: 4px;
  height: 5px;
  background: currentColor;
  box-shadow: 2px -3px 0 0 currentColor;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
}

.thunder-icon::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 0;
  width: 0;
  height: 0;
  border-top: 5.5px solid transparent;
  border-bottom: 5.5px solid transparent;
  border-right: 6px solid currentColor;
}

/* Muted: the speaker dims and a slash cuts across it, so the state is legible
   without colour alone carrying it. */
.thunder-toggle[aria-pressed='false'] .thunder-icon {
  opacity: 0.4;
}

.thunder-toggle::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 17px;
  height: 1.2px;
  margin: -0.6px 0 0 -8.5px;
  background: currentColor;
  transform: rotate(-45deg) scaleX(0);
  transform-origin: center;
  transition: transform 0.2s ease;
}

.thunder-toggle[aria-pressed='false']::after {
  transform: rotate(-45deg) scaleX(1);
}

.word {
  display: inline-flex;
  align-items: baseline;
  font-size: clamp(1.75rem, 7.2vw, 5rem);
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
  /* Keeps the wordmark legible when a bolt flares directly behind it. */
  text-shadow:
    0 0 18px rgba(0, 0, 0, 0.85),
    0 0 46px rgba(0, 0, 0, 0.65);
}

/* totally·in·zen — the middle syllable picked out. */
.accent {
  color: #9e1b22;
}

.caret {
  display: inline-block;
  width: 0.56em;
  height: 1.02em;
  margin-left: 0.12em;
  background: var(--ink);
  transform: translateY(0.12em);
  animation: blink 1.06s steps(1, end) infinite;
}

@keyframes blink {
  0%,
  50% {
    opacity: 1;
  }
  50.01%,
  100% {
    opacity: 0;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Motion preferences ──────────────────────────────────────────────────────
   Lightning is high-contrast flashing by nature. Anyone who has asked for
   reduced motion gets the finished wordmark on a plain black field: no canvas
   loop is ever started, no caret blink, no typing. */

@media (prefers-reduced-motion: reduce) {
  #fx {
    display: none;
  }

  .caret {
    display: none;
    animation: none;
  }
}
