/* Hallmark · route: custom (bespoke) · genre: atmospheric · structure: print stage · idea: "the print turns the name to light"
 * nav: none (brief) · footer: single address · enrichment: E-video (user asset) + hand-built CSS printer light · motion: one orchestrated print
 * pre-emit critique: P5 H5 E5 S5 R4 V5 · contrast: pass (caption is aria-hidden print marking) · mobile: 320–1920 verified
 */

/* ───────────────────────── Base ───────────────────────── */

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

html,
body {
  margin: 0;
  overflow-x: clip;
  background: var(--color-bg);
  color: var(--color-aqua);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

html { color-scheme: dark; }

body {
  min-height: 100svh;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.5;
}

button { font: inherit; color: inherit; }

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

::selection { background: var(--color-violet); color: var(--color-bg); }

/* ───────────────────────── Stage ───────────────────────── */

.stage {
  /* Defaults so the first paint is sane; JS replaces them with measured geometry. */
  --slot-h: 30px;
  --sheet-w: min(56vw, 88svh);
  --sheet-h: calc(var(--sheet-w) * 0.7305);
  --sheet-x: calc(54vw - var(--sheet-w) / 2);
  --sheet-y: calc(var(--slot-h) + 5svh);
  --sheet-m: calc(var(--sheet-w) * 0.035);
  --sheet-cap: calc(var(--sheet-w) * 0.084);
  --head-w: calc(var(--sheet-w) * 0.25);
  --word-fs: 16vw;
  --word-x: 3vw;
  --word-y: 30svh;
  --deck-x: 3vw;
  --deck-y: 55svh;
  --deck-w: 12rem;
  --deck-h: 12rem;
  --foot-x: 0px;
  --foot-w: 100%;
  --foot-y: calc(100svh - 5rem);
  --key: 8.5rem;

  position: relative;
  height: var(--stage-h, 100svh);
  min-height: 100svh;
  overflow: clip;
  isolation: isolate;
}

.stage.is-compact { --key: 5rem; }
.stage.is-short { --key: clamp(3.5rem, 24vh, 5rem); }

.stage__main {
  position: absolute;
  inset: 0;
}

/* Controls power on like machine lamps rather than sliding in. */
.deck,
.sound,
.foot { opacity: 0; }

.stage.is-on .deck  { animation: power-on 420ms linear 700ms both; }
.stage.is-on .sound { animation: power-on 420ms linear 820ms both; }
.stage.is-on .foot  { animation: power-on 420ms linear 900ms both; }

@keyframes power-on {
  0%   { opacity: 0; }
  18%  { opacity: 1; }
  30%  { opacity: 0.2; }
  46%  { opacity: 1; }
  58%  { opacity: 0.55; }
  100% { opacity: 1; }
}

/* ───────────────────────── Printer ───────────────────────── */

.printer {
  --hx: -9999px;
  position: absolute;
  inset: 0 0 auto 0;
  height: var(--slot-h);
  z-index: 40;
  pointer-events: none;
}

/* The housing: a machined top, a lighter lip, vents at either end */
.printer__body {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, var(--color-bg-2) 0%, var(--color-bg-3) 100%);
  border-bottom: 2px solid var(--color-housing-lip);
  box-shadow: 0 0.5rem 1.25rem -0.25rem var(--color-shadow);
}

.printer__body::before,
.printer__body::after {
  content: "";
  position: absolute;
  top: 28%;
  bottom: 28%;
  width: clamp(2.5rem, 9vw, 7rem);
  background: repeating-linear-gradient(to right, var(--vent, var(--color-slit)) 0 2px, transparent 2px 6px);
  opacity: 0.85;
}

/* The vents glow while the machine works */
[data-state="printing"] .printer__body { --vent: var(--color-laser-red); }
[data-state="printing"] .printer__body::before,
[data-state="printing"] .printer__body::after { opacity: 0.6; }

.printer__body::before { left: clamp(1rem, 3vw, 2.5rem); }
.printer__body::after  { right: clamp(1rem, 3vw, 2.5rem); }

.printer__slit {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 3px;
  background: var(--color-slit);
}

/* Standby lamp along the loaded paper, breathing on the pulsar period */
.printer__slit::before {
  content: "";
  position: absolute;
  left: var(--sheet-x);
  width: var(--sheet-w);
  top: 0;
  height: 3px;
  background: linear-gradient(to right, transparent, var(--color-laser-red) 22%, var(--color-laser-red) 78%, transparent);
  opacity: 0;
}

[data-state="idle"] .printer__slit::before {
  animation: standby calc(var(--dur-pulsar) * 2) var(--ease-in-out) 5 alternate both;
}

@keyframes standby {
  from { opacity: 0.12; }
  to   { opacity: 0.6; }
}

/* The slot lights up where the head is */
.printer__slit::after {
  content: "";
  position: absolute;
  left: calc(var(--sheet-x) + var(--hx) - var(--head-w) * 0.4);
  width: calc(var(--head-w) * 1.8);
  top: -1px;
  height: 4px;
  border-radius: var(--radius-full);
  background: radial-gradient(closest-side, var(--color-laser-core), var(--color-laser-red) 55%, transparent);
  opacity: 0;
  transition: opacity var(--dur-short) var(--ease-out);
}

[data-state="printing"] .printer__slit::after { opacity: 1; }

/* ───────────────────────── Light spill on the desk ───────────────────────── */

.spill {
  position: absolute;
  top: calc(var(--slot-h) + 3px);
  left: 0;
  width: 52rem;
  height: 24rem;
  margin-left: -26rem;
  background:
    radial-gradient(ellipse 16% 5% at 50% 0, var(--color-laser-core), transparent 100%),
    radial-gradient(ellipse 30% 26% at 50% 0, var(--color-laser-hot), transparent 100%),
    radial-gradient(ellipse 50% 70% at 50% 0, var(--color-laser-spill), transparent 100%);
  mix-blend-mode: screen;
  opacity: 0;
  z-index: 35;
  pointer-events: none;
  transition: opacity var(--dur-long) var(--ease-out);
  will-change: transform;
}

[data-state="printing"] .spill { opacity: 1; }

/* ───────────────────────── Ambient light from the running print ───────────────────────── */

.ambient {
  position: absolute;
  left: calc(var(--sheet-x) - var(--sheet-w) * 0.25);
  top: calc(var(--sheet-y) - var(--sheet-h) * 0.2);
  width: calc(var(--sheet-w) * 1.5);
  height: calc(var(--sheet-h) * 1.45);
  filter: blur(64px);
  -webkit-mask-image: radial-gradient(closest-side, #000 35%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 35%, transparent 100%);
  opacity: 0;
  z-index: 1;
  pointer-events: none;
  transition: opacity 1600ms var(--ease-out);
}

.stage.is-glowing .ambient { opacity: 0.24; }

/* ───────────────────────── The sheet ───────────────────────── */

.sheet {
  position: absolute;
  left: var(--sheet-x);
  top: var(--sheet-y);
  width: var(--sheet-w);
  height: var(--sheet-h);
  margin: 0;
  padding: var(--sheet-mt, var(--sheet-m)) var(--sheet-m) 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: var(--color-sheet);
  border-radius: 2px;
  box-shadow:
    0 1px 1px var(--color-shadow-tight),
    0 2.25rem 5rem -1.5rem var(--color-shadow);
  transform-origin: 50% 50%;
  z-index: 10;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  will-change: transform;
  transition: filter 380ms var(--ease-out);
  /* Hidden inside the printer until JS positions it */
  transform: translate3d(0, calc(var(--slot-h) - var(--sheet-y) - var(--sheet-h) + 3px), 0);
}

/* Freshly-fed paper sits in the printer's shadow near the slot */
.sheet::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, var(--color-shadow) 0, transparent 5.5rem);
  opacity: var(--slot-shade, 0);
  pointer-events: none;
}

.sheet__image {
  position: relative;
  aspect-ratio: 1168 / 768;
  overflow: hidden;
  background: var(--color-bg);
}

.sheet__video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

/* The still wakes as it starts to move */
.sheet__video.is-waking { animation: wake 1100ms var(--ease-out) both; }

@keyframes wake {
  from { filter: saturate(0.15) contrast(1.35) brightness(1.2); }
  to   { filter: none; }
}

.sheet__sheen {
  position: absolute;
  inset: 0;
  background: linear-gradient(118deg, var(--color-sheen) 0%, transparent 38%, transparent 70%, var(--color-sheen-2) 100%);
  pointer-events: none;
}

.sheet__caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: clamp(0.5625rem, calc(var(--sheet-w) * 0.0145), 0.75rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  color: var(--color-violet);
  white-space: nowrap;
}

.sheet__marks {
  display: flex;
  align-items: center;
  gap: calc(var(--sheet-cap) * 0.22);
}

/* The garita illustration, printed small in the brand inks as the print's stamp */
.sheet__stamp {
  width: calc(var(--sheet-cap) * 0.62);
  aspect-ratio: 1194 / 1235.75;
  background: url("../media/garita-mark.svg") center / contain no-repeat;
}

/* Play/pause state, printed small beside the stamp when the print is live */
.sheet__playstate {
  width: calc(var(--sheet-cap) * 0.26);
  height: calc(var(--sheet-cap) * 0.26);
  fill: var(--color-violet);
  opacity: 0;
  transition: opacity var(--dur-short) var(--ease-out);
}

.sheet__pause { display: none; }
.sheet:not(.is-paused) .sheet__play { display: none; }
.sheet:not(.is-paused) .sheet__pause { display: inline; }

[data-state="done"] .sheet:is(:hover, :focus-visible, .is-paused) .sheet__playstate { opacity: 1; }

[data-state="done"] .sheet { cursor: grab; touch-action: none; }
.sheet.is-dragging { cursor: grabbing; }

.sheet:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 6px;
}

/* ───────────────────────── Printer head light ───────────────────────── */

.laser {
  --hx: -9999px;
  position: absolute;
  left: var(--sheet-x);
  top: calc(var(--slot-h) + 3px);
  width: var(--sheet-w);
  height: min(12rem, calc(var(--sheet-h) * 0.42));
  overflow: hidden;
  z-index: 30;
  pointer-events: none;
  opacity: 0;
  transition: opacity 600ms var(--ease-out);
}

[data-state="printing"] .laser { opacity: 1; }

/* Fresh rows come out as a halftone that resolves as they leave the slot */
.laser__develop {
  position: absolute;
  inset: 0 0 auto 0;
  height: min(7rem, calc(var(--sheet-h) * 0.2));
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 22%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 22%, transparent 100%);
}

.laser__develop > span {
  position: absolute;
  inset: 0;
  background: var(--color-sheet);
  -webkit-mask-image: url("../media/dither.png");
  mask-image: url("../media/dither.png");
  -webkit-mask-size: 128px 128px;
  mask-size: 128px 128px;
  -webkit-mask-position: var(--dither-pos, 0 0);
  mask-position: var(--dither-pos, 0 0);
  image-rendering: pixelated;
}

/* Light the head throws on the fresh paper, riding with it */
.laser__wash {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse calc(var(--head-w) * 0.95) 85% at calc(var(--hx) + var(--head-w) / 2) 0%, var(--color-laser-wash), transparent 100%),
    linear-gradient(to bottom, var(--color-laser-tint) 0, transparent 38%);
}

.laser__bar {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--head-w);
  height: 0.75rem;
  will-change: transform;
}

.laser__beam {
  position: absolute;
  top: 0;
  left: -20%;
  right: -20%;
  height: 9rem;
  background: radial-gradient(ellipse 50% 100% at 50% 0%, var(--color-laser-hot), var(--color-laser-beam) 34%, transparent 72%);
}

.laser__halo {
  position: absolute;
  inset: -1.25rem -2.25rem;
  border-radius: var(--radius-full);
  background: var(--color-laser);
  filter: blur(16px);
}

.laser__core {
  position: absolute;
  top: 0;
  left: 0.5rem;
  right: 0.5rem;
  height: 0.625rem;
  border-radius: var(--radius-full);
  background: linear-gradient(to right, transparent, var(--color-laser-core) 14%, var(--color-laser-core) 86%, transparent);
  box-shadow: 0 0 0.5rem 0.125rem var(--color-laser-hot);
}

/* ───────────────────────── The word ───────────────────────── */

.word {
  position: absolute;
  left: var(--word-x);
  top: var(--word-y);
  margin: 0;
  z-index: 5;           /* the base copy lies on the desk, under the sheet */
  pointer-events: none;
  font-family: var(--font-display);
  font-size: var(--word-fs);
  font-weight: 900;
  font-stretch: 125%;
  font-style: normal;
  font-variation-settings: "wdth" 125, "wght" 900;
  line-height: 1;
  letter-spacing: -0.035em;
  white-space: nowrap;
  opacity: 0;
  transition: filter 380ms var(--ease-out);
}

.word--print { z-index: 20; }   /* the printed copies sit on the sheet */

.word.is-ready {
  animation: word-in 1100ms var(--ease-out) 80ms both;
}

@keyframes word-in {
  from { opacity: 0; transform: translateY(0.06em); }
  to   { opacity: 1; transform: none; }
}

.word.is-measuring,
.word.is-measuring * { transition: none !important; }

.word__layer {
  display: block;
  line-height: 1;
  text-box: trim-both cap alphabetic;
}

.word__layer + .word__layer {
  position: absolute;
  left: 0;
  top: 0;
}

.word__base { color: var(--color-violet); }

.word__ink { color: var(--color-violet); }

.word__light { color: var(--color-aqua); }

/* Before any paper exists, nothing is printed */
.word__ink,
.word__light { clip-path: inset(50% 50% 50% 50%); }

/* ───────────────────────── Deck (the control) ───────────────────────── */

.deck {
  position: absolute;
  left: var(--deck-x);
  top: var(--deck-y);
  z-index: 50;
  transition: filter 380ms var(--ease-out);
}

.deck__well {
  position: relative;
  display: grid;
  place-items: center;
  padding: calc(var(--key) * 0.24);
}

.stage.is-compact .deck__well,
.stage.is-portrait .deck__well { padding: 0.25rem; }

/* ───────────────────────── Pulsar — a physical latching key ───────────────────────── */

.pulsar {
  --travel: calc(var(--key) * 0.052);
  position: relative;
  width: var(--key);
  height: calc(var(--key) + var(--travel));
  padding: 0;
  border: 0;
  border-radius: var(--radius-full);
  background: none;
  cursor: pointer;
  z-index: 1;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transform: translate3d(var(--mx, 0px), var(--my, 0px), 0);
  transition: transform var(--dur-short) var(--ease-out);
}

/* The key's wall — seen below the face while the key is up */
.pulsar::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--key);
  border-radius: var(--radius-full);
  background: var(--color-violet);
}

.pulsar__face {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: var(--key);
  height: var(--key);
  border-radius: var(--radius-full);
  background: var(--color-bg-2);
  border: 2px solid var(--color-aqua);
  transition:
    transform var(--dur-micro) var(--ease-out),
    background-color var(--dur-micro) var(--ease-out),
    border-color var(--dur-micro) var(--ease-out);
}

.pulsar__label {
  font-family: var(--font-display);
  font-size: calc(var(--key) * 0.162);
  font-weight: 900;
  font-stretch: 125%;
  font-variation-settings: "wdth" 125, "wght" 900;
  letter-spacing: -0.01em;
  line-height: 1;
  color: var(--color-aqua);
  white-space: nowrap;
  transition: color var(--dur-micro) var(--ease-out);
}

.pulsar:hover .pulsar__face,
.pulsar.is-hover .pulsar__face { background: var(--color-bg-3); }

.pulsar:focus-visible,
.pulsar.is-focus {
  outline: 2px dashed var(--color-focus);
  outline-offset: 7px;
}

.pulsar:active .pulsar__face,
.pulsar.is-active .pulsar__face {
  transform: translateY(var(--travel));
  background: var(--color-aqua);
}

.pulsar:active .pulsar__label,
.pulsar.is-active .pulsar__label { color: var(--color-violet); }

/* Latched down while the printer runs */
.pulsar[aria-disabled="true"] { cursor: progress; }

.pulsar[aria-disabled="true"] .pulsar__face {
  transform: translateY(var(--travel));
  border-color: var(--color-violet);
  background: var(--color-bg);
}

.pulsar[aria-disabled="true"] .pulsar__label { color: var(--color-violet); }

.stage.is-error .pulsar__face { border-color: var(--color-violet); }

/* The rings: one pulse per period of PSR B1919+21 — a single burst, then still
   (WCAG 2.2.2). Hovering the key replays it. */
.pulsar__rings {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.pulsar__rings i {
  grid-area: 1 / 1;
  width: var(--key);
  height: var(--key);
  margin-top: calc(var(--key) * -0.052);
  border-radius: var(--radius-full);
  border: 1.5px solid var(--color-aqua);
  opacity: 0;
}

[data-state="idle"] .pulsar__rings i {
  animation: pulse calc(var(--dur-pulsar) * 2) var(--ease-out) 1 both;
}

.stage.is-on[data-state="idle"] .pulsar__rings i:nth-child(1) { animation-delay: 1200ms; }
.stage.is-on[data-state="idle"] .pulsar__rings i:nth-child(2) { animation-delay: calc(1200ms + var(--dur-pulsar)); }
.stage.is-on[data-state="idle"] .pulsar__rings i:nth-child(3) { animation-delay: calc(1200ms + var(--dur-pulsar) * 2); }

/* Pointer arriving at the key replays the burst (JS alternates the two classes to restart it) */
.stage.is-on .deck__well.replay-a .pulsar__rings i { animation: pulse-a calc(var(--dur-pulsar) * 2) var(--ease-out) 1 both; }
.stage.is-on .deck__well.replay-b .pulsar__rings i { animation: pulse-b calc(var(--dur-pulsar) * 2) var(--ease-out) 1 both; }
.stage.is-on .deck__well:is(.replay-a, .replay-b) .pulsar__rings i:nth-child(1) { animation-delay: 0ms; }
.stage.is-on .deck__well:is(.replay-a, .replay-b) .pulsar__rings i:nth-child(2) { animation-delay: var(--dur-pulsar); }
.stage.is-on .deck__well:is(.replay-a, .replay-b) .pulsar__rings i:nth-child(3) { animation-delay: calc(var(--dur-pulsar) * 2); }

@keyframes pulse   { 0% { opacity: 0.8; transform: scale(1); } 100% { opacity: 0; transform: scale(var(--ring-scale, 1.9)); } }
@keyframes pulse-a { 0% { opacity: 0.8; transform: scale(1); } 100% { opacity: 0; transform: scale(var(--ring-scale, 1.9)); } }
@keyframes pulse-b { 0% { opacity: 0.8; transform: scale(1); } 100% { opacity: 0; transform: scale(var(--ring-scale, 1.9)); } }

.stage.is-compact .pulsar__rings i { --ring-scale: 1.45; }

/* One shockwave across the stage per press */
.shock {
  position: absolute;
  width: var(--key);
  height: var(--key);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-aqua);
  pointer-events: none;
  z-index: 45;
}

/* ───────────────────────── Sound toggle ───────────────────────── */

.sound {
  position: absolute;
  top: calc(var(--slot-h) + var(--space-sm));
  right: max(var(--space-sm), env(safe-area-inset-right));
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  padding: 0;
  border: var(--rule-hair) solid var(--color-aqua-faint);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--color-aqua);
  cursor: pointer;
  z-index: 50;
  transition: background-color var(--dur-micro) var(--ease-out), border-color var(--dur-micro) var(--ease-out), filter 380ms var(--ease-out);
}

/* Portrait: the toggle sits on the centre line under the key, never over the print */
.stage.is-portrait .sound {
  top: calc(var(--deck-y) + var(--deck-h) + var(--space-xs));
  right: auto;
  left: calc(50% - 1.375rem);
}

.sound:hover { background: var(--color-bg-2); border-color: var(--color-aqua-dim); }
.sound:active svg { transform: translateY(1px); }
.sound:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 3px; }

.sound svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.sound__cone { fill: currentColor; stroke: none; }
.sound__mute { display: none; }
.sound[aria-pressed="false"] .sound__wave { display: none; }
.sound[aria-pressed="false"] .sound__mute { display: inline; }
.sound[aria-pressed="false"] { color: var(--color-violet); border-color: var(--color-violet-faint); }

/* ───────────────────────── The address ───────────────────────── */

.foot {
  position: absolute;
  left: var(--foot-x);
  width: var(--foot-w);
  top: var(--foot-y);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2xs);
  z-index: 50;
}

/* The garita illustration, large, on the centre line above the address (portrait only) */
.emblem {
  display: none;
  width: clamp(3.5rem, min(26vw, 10vh), 8rem);
  aspect-ratio: 1194 / 1235.75;
  margin-bottom: clamp(0.125rem, 1vh, 0.5rem);
  background: url("../media/garita-mark.svg") center / contain no-repeat;
}

.stage.is-portrait .emblem { display: block; }

/* Short landscape (phones on their side): a tighter address block */
.stage.is-short .foot { gap: 0.125rem; }
.stage.is-short .mail { font-size: clamp(0.8125rem, 4.4vh, 1.0625rem); padding-block: 0.125rem; }
.stage.is-short .addr { font-size: clamp(0.5rem, 2.9vh, 0.6875rem); line-height: 1.5; }

/* Street address: small, thin, under the email */
.addr {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: clamp(0.625rem, 0.56rem + 0.25vw, 0.8125rem);
  font-weight: 300;
  line-height: 1.7;
  letter-spacing: 0.14em;
  text-align: center;
  color: var(--color-violet);
  white-space: nowrap;
}

.mail {
  position: relative;
  display: inline-block;
  padding: var(--space-2xs) var(--space-3xs);
  font-family: var(--font-mono);
  font-size: var(--text-md);
  font-weight: 500;
  font-stretch: 100%;
  letter-spacing: 0;
  line-height: 1.2;
  color: var(--color-violet);
  text-decoration: none;
  white-space: nowrap;
  border-radius: var(--radius-sm);
  -webkit-tap-highlight-color: transparent;
}

/* Fallback if scripting is off: the address still answers the pointer */
.mail:hover .mail__chars { color: var(--color-aqua); }
.mail:active .mail__line { transform: translateY(1px); }

.mail:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 4px;
}

.mail__line {
  position: relative;
  display: inline-block;
}

.mail__chars {
  display: inline-block;
  transition: color var(--dur-micro) var(--ease-out);
}

.mail__chars > span {
  display: inline-block;
  transition: color var(--dur-micro) var(--ease-out), text-shadow var(--dur-micro) var(--ease-out);
}

.mail__chars > span.is-noise { color: var(--color-aqua-dim); }

/* Printed: aqua with the same violet plate offset as the name */
.mail__chars > span.is-lit {
  color: var(--color-aqua);
  text-shadow: 0.05em 0.07em 0 var(--color-violet);
}

/* A miniature printer head */
.mail__head {
  position: absolute;
  top: -0.45em;
  bottom: -0.45em;
  left: 0;
  width: 0.2em;
  margin-left: -0.1em;
  border-radius: var(--radius-full);
  background: var(--color-laser-core);
  box-shadow: 0 0 0.35em 0.08em var(--color-laser-hot);
  opacity: 0;
  pointer-events: none;
}

.mail__head::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -1.6em;
  right: -1.6em;
  background: radial-gradient(ellipse 50% 60% at 50% 50%, var(--color-laser-beam), transparent 75%);
}

.mail__head::after {
  content: "";
  position: absolute;
  inset: -0.6em -1.2em;
  border-radius: var(--radius-full);
  background: var(--color-laser);
  filter: blur(12px);
  opacity: 0.55;
}

/* Spotlight: everything else steps back while the address is printed */
.stage.is-mail :is(.sheet, .word, .deck, .sound) { filter: brightness(0.3) saturate(0.7); }
.stage.is-mail .ambient { opacity: 0.1; }

/* ───────────────────────── Grain ───────────────────────── */

.grain {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  background: url("../media/grain.png") repeat;
  background-size: 256px 256px;
  opacity: 0.07;
}

/* ───────────────────────── Reduced motion ───────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 150ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    /* Paint-only crossfades; never let geometry (e.g. inherited font-size) animate. */
    transition-property: opacity, color, background-color, border-color, filter !important;
    transition-duration: 150ms !important;
  }
  .pulsar__rings,
  .laser__bar,
  .laser__develop,
  .spill,
  .mail__head { display: none; }
  .stage.is-on :is(.deck, .sound, .foot) { animation: none; opacity: 1; }
  .pulsar { transform: none; }
}
