/* Holding page: a field of letters and digits drifting into waves (wave.js),
   a note typed over it (note.js). No inline styles anywhere: CSP is
   style-src 'self'. */

:root {
  --bg: #0a0a0b;
  --ink: #ececee;
  --muted: #8c8c92;
  --glacier: #aadae2;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
}

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

html, body { margin: 0; height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* The field sits behind everything and fills the viewport. */
.field {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

/* A soft dark pool under the text, so the waves never fight the words. */
.scrim {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 46rem 34rem at 50% 50%,
    rgba(10, 10, 11, .84) 0%, rgba(10, 10, 11, .62) 40%, rgba(10, 10, 11, 0) 78%);
}

.stage {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 64px 16px;
  /* Clicks fall through to the field; only links take them. */
  pointer-events: none;
}

.note {
  position: relative;
  width: 100%;
  max-width: 34rem;
}

.note__body {
  font-size: clamp(17px, 0.55vw + 15px, 21px);
  line-height: 1.6;
  letter-spacing: -0.011em;
  font-weight: 400;
  text-shadow: 0 0 18px var(--bg), 0 0 4px var(--bg);
}

.note__body p { margin: 0 0 1.15em; }
.note__body p:last-child { margin-bottom: 0; }

.note__date {
  color: var(--muted);
  font-size: .88em;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.note a {
  pointer-events: auto;
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
  text-decoration-color: rgba(170, 218, 226, .55);
  transition: color .2s ease, text-decoration-color .2s ease;
}

.note a:hover,
.note a:focus-visible {
  color: var(--glacier);
  text-decoration-color: var(--glacier);
}

.note a:focus-visible {
  outline: 1px solid var(--glacier);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection { background: rgba(170, 218, 226, .3); color: #fff; }

/* While typing, the real text keeps its place (and stays readable to screen
   readers) but is invisible; the typed copy sits exactly on top of it. */
.note.is-typing #noteBody,
.note.is-typing #noteBody * {
  color: transparent;
  text-shadow: none;
  text-decoration-color: transparent;
}

.note__type {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  pointer-events: none;
}

/* The caret takes no inline space, so lines wrap exactly as in the final text. */
.caret {
  display: inline-block;
  position: relative;
  width: 0;
  height: 1em;
  vertical-align: -0.12em;
}

.caret::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 0;
  width: 2px;
  height: 1.15em;
  border-radius: 1px;
  background: var(--glacier);
}

.caret.is-idle::after { animation: blink 1.1s steps(1, end) infinite; }

@keyframes blink {
  0%, 55% { opacity: 1; }
  56%, 100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .caret.is-idle::after { animation: none; }
}

.note.is-typing #noteBody a { pointer-events: none; }
