/* ==========================================================================
   HONEOYE — personal experiments
   After Serial Experiments Lain (1998): NAVI / Copland OS windows, dot-matrix type,
   power lines, red-flecked shadows, CRT scanlines, a 1998 hit counter.
   Type: DotGothic16 (a 16-dot Japanese face — keep sizes at multiples of 16px where it matters),
   Silkscreen at 8px for micro labels.
   ========================================================================== */

:root {
  --void: #07080c;
  --sky: #151b2e;
  --panel: #0c1019;
  --phosphor: #e8edf5;
  --dim: rgba(232, 237, 245, .66);
  --faint: rgba(232, 237, 245, .42);
  --line: rgba(232, 237, 245, .14);
  --navi: #4a6bff;
  --navi-hi: #9aacff;
  --navi-bar: #1a2b95;
  --red: #e3242b;

  --dot: 'DotGothic16', 'MS Gothic', Osaka, monospace;
  --micro: 'Silkscreen', 'DotGothic16', monospace;
  --pad: clamp(16px, 3vw, 48px);

  /* The shadows in Lain are black and full of red flecks. */
  --reddots: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96'%3E%3Cg fill='%23e3242b'%3E%3Ccircle cx='7' cy='11' r='1.6'/%3E%3Ccircle cx='23' cy='4' r='.9'/%3E%3Ccircle cx='41' cy='17' r='2.2'/%3E%3Ccircle cx='63' cy='9' r='1.2'/%3E%3Ccircle cx='84' cy='21' r='3.1'/%3E%3Ccircle cx='12' cy='38' r='1.1'/%3E%3Ccircle cx='31' cy='46' r='2.6'/%3E%3Ccircle cx='52' cy='33' r='1'/%3E%3Ccircle cx='77' cy='44' r='1.5'/%3E%3Ccircle cx='93' cy='58' r='.8'/%3E%3Ccircle cx='8' cy='67' r='2'/%3E%3Ccircle cx='27' cy='79' r='1.3'/%3E%3Ccircle cx='46' cy='62' r='3.4'/%3E%3Ccircle cx='58' cy='88' r='2.4'/%3E%3Ccircle cx='71' cy='71' r='1'/%3E%3Ccircle cx='88' cy='86' r='1.9'/%3E%3Ccircle cx='38' cy='93' r='.9'/%3E%3C/g%3E%3C/svg%3E");
  --arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='24' shape-rendering='crispEdges'%3E%3Cpath d='M1.5 1.5v16l4-4 3 7 2.5-1-3-7h5.5z' fill='%23fff' stroke='%23000'/%3E%3C/svg%3E");

  color-scheme: dark;
}

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

html {
  background: var(--void);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  font-family: var(--dot);
  font-size: 16px;
  line-height: 1.5;
  color: var(--phosphor);
  cursor: var(--arrow) 1 1, default;
  overflow-x: hidden;
}

::selection {
  background: var(--red);
  color: #fff;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

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

/* ── CRT: scanlines, vignette and a slow rolling bar over everything ───── */

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, .17) 0, rgba(0, 0, 0, .17) 1px, transparent 1px, transparent 3px),
    radial-gradient(130% 100% at 50% 50%, transparent 58%, rgba(0, 0, 0, .5) 100%);
}

body::before {
  content: '';
  position: fixed;
  left: 0;
  right: 0;
  top: -24vh;
  height: 24vh;
  z-index: 201;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent, rgba(154, 172, 255, .045) 50%, transparent);
  animation: roll 9s linear infinite;
}

@keyframes roll {
  to { transform: translateY(150vh); }
}

/* ── Sky and power lines ─────────────────────────────────────────────── */

.sky {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  z-index: 0;
  height: clamp(260px, 52vh, 540px);
  pointer-events: none;
  background: linear-gradient(to bottom, var(--sky) 0%, rgba(21, 27, 46, .5) 45%, rgba(7, 8, 12, 0) 100%);
}

.wires {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.wires path,
.wires rect {
  fill: none;
  stroke: rgba(232, 237, 245, .2);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.wires__pole path:first-child { stroke: rgba(232, 237, 245, .16); stroke-width: 6; }
.wires__pole path:nth-child(2) { stroke-width: 3; }
.wires__pole rect { fill: rgba(232, 237, 245, .07); }

/* The wires hum while the sound is on. */
.sound-on .wires .w { animation: hum .13s linear infinite alternate; }
.sound-on .wires .w2 { animation-duration: .11s; }
.sound-on .wires .w3 { animation-duration: .15s; }
.sound-on .wires .w5 { animation-duration: .12s; animation-delay: -.05s; }

@keyframes hum {
  from { transform: translateY(-.7px); }
  to   { transform: translateY(.7px); }
}

/* ── NAVI menu bar ───────────────────────────────────────────────────── */

.menubar,
.main,
.foot {
  position: relative;
  z-index: 2;
}

.menubar {
  z-index: 3;
  display: flex;
  align-items: center;
  gap: clamp(14px, 2vw, 26px);
  height: 32px;
  padding: 0 var(--pad);
  background: rgba(12, 15, 28, .92);
  border-bottom: 1px solid #24317a;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .6);
  line-height: 1;
  white-space: nowrap;
}

.menubar__logo {
  flex: none;
  width: 12px;
  height: 12px;
  background: var(--red);
  box-shadow: 0 0 8px rgba(227, 36, 43, .6);
}

.menubar__item { color: var(--dim); }
.menubar__item--app { color: var(--phosphor); }
.menubar__spacer { flex: 1; }

.menubar__clock,
.menubar__day {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.menubar__day { margin-right: 14px; }

.k {
  font-family: var(--micro);
  font-size: 8px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
}

.menubar__eq {
  display: none;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}

.sound-on .menubar__eq { display: inline-flex; }

.menubar__eq i {
  width: 3px;
  height: 12px;
  background: var(--red);
  transform: scaleY(.2);
  transform-origin: 50% 100%;
}

/* ── Main ────────────────────────────────────────────────────────────── */

.main {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: clamp(16px, 2.4vw, 40px);
  row-gap: clamp(18px, 3.2vh, 40px);
  align-content: center;
  padding: clamp(20px, 4vh, 56px) var(--pad);
}

.title,
.index { grid-column: 1 / span 7; }

.desk {
  grid-column: 8 / span 5;
  grid-row: 1 / span 2;
  align-self: center;
  justify-self: end;
  display: grid;
  gap: 24px;
  width: min(100%, 540px);
}

/* ── Title card ──────────────────────────────────────────────────────── */

.title__kicker {
  margin-bottom: 14px;
  line-height: 1;
  letter-spacing: .04em;
  color: var(--dim);
}

/* DotGothic16 at line-height 1: caps start .145em below the line-box top, the baseline is .037em
   above its bottom — the margins hug the caps. Latin glyphs are exactly .5em wide (JS fits the size). */
.wordmark {
  position: relative;
  z-index: 0;
  margin: -.145em 0 -.037em;
  font-size: 16vw;
  line-height: 1;
  white-space: nowrap;
  color: var(--phosphor);
  text-shadow: 0 0 .05em rgba(154, 172, 255, .55), 0 0 .2em rgba(74, 107, 255, .22);
}

/* Fixed .5em cells: a corrupted glyph (see scramble() in site.js) never shifts its neighbours. */
.wordmark > span {
  display: inline-block;
  width: .5em;
  text-align: center;
}

/* The shadow: black, full of red static that never sits still (three coprime tiles re-dealt ~8×/s). */
.wordmark::before {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  z-index: -1;
  transform: translate(.055em, .055em);
  color: transparent;
  text-shadow: none;
  background-color: #000;
  background-image: var(--reddots), var(--reddots), var(--reddots);
  background-size: 72px 72px, 113px 113px, 53px 53px;
  background-position: 0 0, 29px 41px, 11px 7px;
  -webkit-background-clip: text;
  background-clip: text;
  animation: boil .96s steps(1) infinite;
}

@keyframes boil {
  0%    { background-position: 0 0, 29px 41px, 11px 7px; }
  12.5% { background-position: 37px 19px, 83px 5px, 40px 31px; }
  25%   { background-position: 14px 58px, 7px 97px, 23px 48px; }
  37.5% { background-position: 61px 33px, 52px 70px, 5px 19px; }
  50%   { background-position: 25px 7px, 101px 29px, 47px 2px; }
  62.5% { background-position: 50px 66px, 18px 12px, 30px 40px; }
  75%   { background-position: 8px 41px, 66px 88px, 13px 26px; }
  87.5% { background-position: 68px 12px, 40px 50px, 51px 44px; }
}

.title__typed {
  min-height: 1.2em;
  margin-top: 20px;
  font-size: 32px;
  line-height: 1.2;
}

.cursor {
  display: inline-block;
  width: .5em;
  height: .9em;
  margin-left: .1em;
  vertical-align: -.1em;
  background: var(--red);
  box-shadow: 0 0 10px rgba(227, 36, 43, .6);
  animation: blink 1.06s steps(1) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.title__lede {
  max-width: 44ch;
  margin-top: 10px;
  color: var(--dim);
}

/* ── Index: layers ───────────────────────────────────────────────────── */

.index__head {
  display: flex;
  justify-content: space-between;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  color: var(--faint);
}

.index__list { list-style: none; }

.row {
  display: grid;
  grid-template-columns: 9ch minmax(0, 1fr) auto 2ch;
  grid-template-areas: "layer name meta go";
  align-items: center;
  column-gap: 16px;
  margin: 0 -10px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
}

.row__layer { grid-area: layer; color: var(--navi-hi); }

.row__name {
  grid-area: name;
  overflow: hidden;
  font-size: 32px;
  line-height: 1.25;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.row__meta {
  grid-area: meta;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  color: var(--dim);
}

.row__jp { display: none; }
.row__go { grid-area: go; justify-self: end; color: var(--faint); }

.lvl {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--lvl, var(--faint));
}

/* Selecting a layer = inverse video, like a 1998 terminal menu. */
.row:hover,
.row:focus-visible {
  outline: none;
  background: var(--phosphor);
  color: var(--void);
  text-shadow: none;
}

.row:hover .row__layer,
.row:focus-visible .row__layer { color: var(--red); }

.row:hover .row__meta,
.row:focus-visible .row__meta,
.row:hover .row__go,
.row:focus-visible .row__go { color: rgba(7, 8, 12, .72); }

.row:hover .row__jp,
.row:focus-visible .row__jp { display: inline; }

.row:hover .row__name::after,
.row:focus-visible .row__name::after {
  content: '';
  display: inline-block;
  width: .5em;
  height: .85em;
  margin-left: .15em;
  vertical-align: -.08em;
  background: var(--red);
  animation: blink 1.06s steps(1) infinite;
}

/* ── Copland-style windows ───────────────────────────────────────────── */

.win {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--navi);
  box-shadow: inset 0 0 0 1px #05060a;
}

/* Hard drop shadow, black with red flecks. No z-index on .win, so this lands behind the whole window. */
.win::before {
  content: '';
  position: absolute;
  inset: -1px;
  z-index: -1;
  transform: translate(12px, 12px);
  /* two tiles with coprime sizes, so the flecks never line up into a visible repeat */
  background: var(--reddots) 0 0 / 72px 72px, var(--reddots) 29px 41px / 113px 113px, #000;
}

.win__bar {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) 14px;
  align-items: center;
  gap: 10px;
  height: 24px;
  padding: 0 6px;
  background: repeating-linear-gradient(to bottom, #3656e6 0, #3656e6 1px, var(--navi-bar) 1px, var(--navi-bar) 2px);
  border-bottom: 1px solid var(--navi);
}

.win__box {
  position: relative;
  width: 13px;
  height: 13px;
  border: 1px solid #c9d3ff;
  background: var(--navi-bar);
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, .3), inset -1px -1px 0 rgba(0, 0, 0, .4);
}

.win__box--zoom::after {
  content: '';
  position: absolute;
  left: 1px;
  top: 1px;
  width: 6px;
  height: 6px;
  border: 1px solid #c9d3ff;
}

.win__title {
  justify-self: center;
  max-width: 100%;
  overflow: hidden;
  padding: 0 10px;
  background: var(--navi-bar);
  color: #fff;
  line-height: 24px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.win__screen {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #000;
}

.win__screen video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: contrast(.92) saturate(.85);
}

.win__screen::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, .3) 0, rgba(0, 0, 0, .3) 1px, transparent 1px, transparent 3px),
    radial-gradient(120% 95% at 50% 50%, transparent 55%, rgba(0, 0, 0, .6) 100%);
}

.win__status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 8px;
  border-top: 1px solid rgba(74, 107, 255, .45);
  line-height: 1.5;
  color: var(--faint);
  white-space: nowrap;
}

.win__toggle { padding: 0 2px; color: var(--phosphor); }
.win__toggle:hover { color: var(--red); }

/* ── Audio window ────────────────────────────────────────────────────── */

.audio {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "power track"
    "controls controls";
  align-items: center;
  gap: 10px 12px;
  padding: 10px;
}

.audio__power { grid-area: power; min-width: 12ch; }

.audio__track {
  grid-area: track;
  overflow: hidden;
  white-space: nowrap;
  color: var(--dim);
}

.audio__marquee { display: inline-block; }

.audio__track.is-scrolling {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
}

.audio__track.is-scrolling .audio__marquee {
  padding-left: 100%;
  animation: marquee var(--marquee, 14s) linear infinite;
}

@keyframes marquee {
  to { transform: translateX(-100%); }
}

.audio__controls {
  grid-area: controls;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn {
  padding: 4px 10px 5px;
  line-height: 1;
  color: var(--phosphor);
  background: var(--navi-bar);
  border: 1px solid #0a0f33;
  box-shadow: inset 1px 1px 0 rgba(201, 211, 255, .55), inset -1px -1px 0 rgba(0, 0, 0, .55);
}

.btn:hover:not(:disabled) { background: #2640c8; }

.btn:active:not(:disabled) {
  transform: translate(1px, 1px);
  box-shadow: inset -1px -1px 0 rgba(201, 211, 255, .4), inset 1px 1px 0 rgba(0, 0, 0, .6);
}

.btn:disabled {
  color: var(--faint);
  background: #10173d;
  cursor: var(--arrow) 1 1, default;
}

.btn--small { padding: 4px 8px 5px; }
.sound-on .audio__power { background: var(--red); }
.sound-on .audio__power:hover:not(:disabled) { background: #ff3b42; }

.vol {
  flex: 1;
  min-width: 60px;
  height: 16px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.vol::-webkit-slider-runnable-track { height: 6px; background: #05060a; border: 1px solid #2a3470; }
.vol::-moz-range-track { height: 6px; background: #05060a; border: 1px solid #2a3470; }

.vol::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 16px;
  margin-top: -6px;
  background: #c9d3ff;
  border: 1px solid #0a0f33;
  box-shadow: inset -1px -1px 0 rgba(0, 0, 0, .4);
}

.vol::-moz-range-thumb {
  width: 10px;
  height: 16px;
  border: 1px solid #0a0f33;
  border-radius: 0;
  background: #c9d3ff;
}

/* ── Footer: hit counter ─────────────────────────────────────────────── */

.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 28px;
  padding: 10px var(--pad);
  border-top: 1px solid var(--line);
  background: rgba(7, 8, 12, .88);
  line-height: 1.2;
}

.counter {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.counter__label {
  font-family: var(--micro);
  font-size: 8px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
}

.counter__digits {
  display: inline-flex;
  gap: 2px;
  color: var(--red);
  text-shadow: 0 0 6px rgba(227, 36, 43, .8);
}

.counter__digits .d {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 24px;
  background: #000;
  border: 1px solid #262b38;
  box-shadow: inset 0 10px 8px rgba(255, 255, 255, .04);
}

.counter__jp { color: var(--faint); }
.foot__tag { color: var(--dim); }
.foot__tag span { color: var(--red); }
.foot__copy { color: var(--faint); }

/* ── Boot: PRESENT DAY / PRESENT TIME (first visit per session) ───────── */

.boot {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  align-content: center;
  padding: 0 var(--pad);
  background: #000;
  font-size: 32px;
  line-height: 1.3;
  color: var(--phosphor);
  text-shadow: 0 0 .15em rgba(154, 172, 255, .6);
}

@media (min-width: 900px) {
  .boot { font-size: 48px; }
}

.boot__line { min-height: 1.3em; }
.boot__line .cursor { visibility: hidden; }
.boot__line.is-active .cursor { visibility: visible; }
.boot--off { animation: crtOff .52s cubic-bezier(.7, 0, .3, 1) forwards; }

@keyframes crtOff {
  0%   { transform: scale(1, 1); filter: brightness(1); }
  55%  { transform: scale(1, .006); filter: brightness(4); background: #fff; }
  100% { transform: scale(0, .006); filter: brightness(4); background: #fff; opacity: 0; }
}

/* ── Intro: things print in, windows zoom open (only with JS; see the boot script) ── */

@keyframes appear  { from { opacity: 0; } }
@keyframes openWin { from { transform: scale(.12); } }

.js:not(.is-ready) .sky,
.js:not(.is-ready) .menubar,
.js:not(.is-ready) .title__kicker,
.js:not(.is-ready) .wordmark > span,
.js:not(.is-ready) .wordmark::before,
.js:not(.is-ready) .title__typed,
.js:not(.is-ready) .title__lede,
.js:not(.is-ready) .index__head,
.js:not(.is-ready) .index__list li,
.js:not(.is-ready) .win,
.js:not(.is-ready) .foot { opacity: 0; }

/* Timeline (s): menu .1 · letters .5–1.16 · static 1.3 · windows .8 / 1.15 · index 1.5–2.01 · footer 2.2 ·
   tagline types 1.3–2.6 (site.js) · lede 2.85. */
.is-ready .sky                             { animation: appear 2s ease-out backwards; }
.is-ready .menubar                         { animation: appear .01s .1s backwards; }
.is-ready .title__kicker                   { animation: appear .01s .35s backwards; }
.is-ready .wordmark > span                 { animation: appear .01s .5s backwards; }
.is-ready .wordmark > span:nth-child(2)    { animation-delay: .61s; }
.is-ready .wordmark > span:nth-child(3)    { animation-delay: .72s; }
.is-ready .wordmark > span:nth-child(4)    { animation-delay: .83s; }
.is-ready .wordmark > span:nth-child(5)    { animation-delay: .94s; }
.is-ready .wordmark > span:nth-child(6)    { animation-delay: 1.05s; }
.is-ready .wordmark > span:nth-child(7)    { animation-delay: 1.16s; }
/* The static fades in with a transition, not an animation: the interference classes swap the ::before
   animation list, and a listed "appear" would restart (with its delay) every time they do. */
.wordmark::before                          { transition: opacity .9s ease-out 1.3s; }
.is-ready .title__typed                    { animation: appear .01s 1.25s backwards; }
.is-ready .title__lede                     { animation: appear .01s 2.85s backwards; }
.is-ready .index__head                     { animation: appear .01s 1.5s backwards; }
.is-ready .index__list li                  { animation: appear .01s 1.65s backwards; }
.is-ready .index__list li:nth-child(2)     { animation-delay: 1.77s; }
.is-ready .index__list li:nth-child(3)     { animation-delay: 1.89s; }
.is-ready .index__list li:nth-child(4)     { animation-delay: 2.01s; }
.is-ready .win                             { animation: openWin .48s steps(5) .8s backwards; }
.is-ready .win--audio                      { animation-delay: 1.15s; }
.is-ready .foot                            { animation: appear .01s 2.2s backwards; }

/* ── Interference (classes set by site.js every few seconds) ─────────── */
/* After the intro rules on purpose: same specificity, so these win while they run. */

.wordmark.g-tear  { animation: g-tear .24s steps(4); }
.wordmark.g-split { animation: g-split .22s steps(3); }
.wordmark.g-shift { animation: g-shift .16s steps(2); }
.wordmark.g-drop  { animation: g-drop .18s steps(2); }
.wordmark.g-static::before { animation: boil .24s steps(1) infinite, g-static .3s steps(5); }

@keyframes g-tear {
  0%   { clip-path: inset(0 0 58% 0); transform: translateX(-.05em); }
  25%  { clip-path: inset(42% 0 22% 0); transform: translateX(.04em); }
  50%  { clip-path: inset(16% 0 52% 0); transform: translateX(-.02em); }
  75%  { clip-path: inset(70% 0 0 0); transform: translateX(.03em); }
  100% { clip-path: inset(0); transform: none; }
}

@keyframes g-split {
  0%   { transform: skewX(-6deg) translateX(-.02em); text-shadow: -.06em 0 rgba(227, 36, 43, .9), .06em 0 rgba(74, 107, 255, .9); }
  33%  { transform: skewX(4deg) translateX(.03em); text-shadow: .05em 0 rgba(227, 36, 43, .9), -.05em 0 rgba(74, 107, 255, .9); }
  66%  { transform: none; text-shadow: -.02em 0 rgba(227, 36, 43, .8), .02em 0 rgba(74, 107, 255, .8); }
  100% { transform: none; }
}

@keyframes g-shift {
  0%   { transform: translateX(.04em); }
  50%  { transform: translateX(-.03em); }
  100% { transform: none; }
}

/* A dip, not a blackout: keeps the flash count far below the WCAG 2.3.1 threshold. */
@keyframes g-drop {
  0%   { opacity: .35; }
  50%  { opacity: .75; }
  100% { opacity: 1; }
}

@keyframes g-static {
  0%   { transform: translate(.14em, -.03em); }
  20%  { transform: translate(-.05em, .1em); }
  40%  { transform: translate(.1em, .12em); }
  60%  { transform: translate(-.02em, .02em); }
  80%  { transform: translate(.08em, .06em); }
  100% { transform: translate(.055em, .055em); }
}

/* ── 404 ─────────────────────────────────────────────────────────────── */

.nf {
  position: relative;
  z-index: 2;
  align-self: center;
  padding: 0 var(--pad);
}

.nf__code {
  margin: 10px 0 18px;
  font-size: clamp(64px, 12vw, 192px);
  line-height: 1;
  color: var(--phosphor);
  text-shadow: 0 0 .05em rgba(154, 172, 255, .55);
}

.nf__back {
  display: inline-block;
  margin-top: 22px;
  padding: 4px 10px;
  background: var(--phosphor);
  color: var(--void);
}

.nf__back:hover { background: var(--red); color: #fff; }

/* ── Responsive ──────────────────────────────────────────────────────── */

@media (max-width: 899px) {
  .main {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
  }

  .title,
  .index,
  .desk {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .desk {
    justify-self: stretch;
    width: 100%;
    max-width: 560px;
    margin: 8px 0 12px;
  }

  .menubar__item:not(.menubar__item--app),
  .menubar__day { display: none; }

  .wordmark { font-size: 26vw; }
}

@media (max-width: 599px) {
  .title__typed { font-size: 24px; }

  .row {
    grid-template-columns: minmax(0, 1fr) 2ch;
    grid-template-areas:
      "layer go"
      "name go"
      "meta go";
    row-gap: 2px;
    margin: 0 -8px;
    padding: 8px;
  }

  .foot {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* 320–359px phones: 16 half-width glyphs at 32px would not fit the row. */
@media (max-width: 359px) {
  .row__name { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
  }

  body::before { display: none; }
}
