/* Infinite Productions teaser. Dark only, one accent (magenta), cyan only as the RGB ghost. Square corners. */
@font-face { font-family: "Montserrat"; src: url("assets/fonts/montserrat.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("assets/fonts/jetbrains-mono.woff2") format("woff2"); font-weight: 100 800; font-display: swap; }

:root {
  --bg: #0a0a0a; --line: #26262b; --ink: #ecebe7; --ink-2: #a3a3a8; --ink-3: #6f6f76;
  --mag: #e8197d; --mag-hi: #ff3d95; --cyan: #38e1ee;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.6 var(--mono);
  overflow: hidden; -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--mag); outline-offset: 3px; }
::selection { background: var(--mag); color: #fff; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#field { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.stage {
  position: relative; min-height: 100dvh; display: grid; place-items: center; align-content: center; gap: clamp(36px, 7vh, 72px);
  padding: 48px 16px 120px; pointer-events: none;
}
.logo { width: min(640px, 86vw); display: grid; justify-items: center; gap: clamp(22px, 4vh, 40px); }
.logo__mark { width: 100%; height: auto; }
.logo__word { width: 74%; height: auto; opacity: 0; transform: translateY(8px); transition: opacity 1s .2s, transform 1s .2s cubic-bezier(.16,1,.3,1); }
.ready .logo__word { opacity: 1; transform: none; }
.live .logo__mark { opacity: 0; }          /* pixels on the canvas take over */

/* terminal */
.term-slot { width: min(560px, 92vw); pointer-events: auto; }
.term { position: relative; width: 100%; opacity: 0; transition: opacity .8s .9s; }
.ready .term { opacity: 1; }
.term__bar { display: none; }
.term__out {
  height: 11.2em; /* fixed so new lines never shift the logo the pixels are pinned to */
  display: flex; flex-direction: column; overflow-y: auto; scrollbar-width: none; color: var(--ink-2); font-size: 14px; white-space: pre-wrap;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 2.2em); mask-image: linear-gradient(to bottom, transparent, #000 2.2em);
}
.term__out::-webkit-scrollbar { display: none; }
.term__out p:first-child { margin-top: auto; }
.term__out .mag { color: var(--mag); }
.term__out p { margin: 0; }
.term__out .me { color: var(--ink-3); }
.term__out .hi { color: var(--ink); }
.term__out a { color: var(--ink); text-decoration-color: var(--mag); text-underline-offset: 3px; }
.term__line { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); padding: 10px 2px; transition: border-color .2s; }
.term__line:focus-within { border-bottom-color: var(--mag); }
.term__ps { color: var(--mag); }
.term input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; padding: 0; font-size: 16px; caret-color: transparent; }
.term input::placeholder { color: var(--ink-3); }
.term__cursor { width: 9px; height: 18px; background: var(--mag); animation: blink 1.05s steps(1) infinite; }

/* ---- expanded terminal: floats over the page like a monitor window ---- */
.term-backdrop {
  position: fixed; inset: 0; z-index: 29; background: rgba(4, 4, 6, .7); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none; transition: opacity .35s;
}
.term-open .term-backdrop { opacity: 1; pointer-events: auto; }
.term-open .term {
  position: fixed; inset: 0; margin: auto; z-index: 30; transition: none;
  width: min(880px, calc(100vw - 32px)); height: min(600px, calc(100dvh - 48px));
  display: flex; flex-direction: column; overflow: hidden;
  background: rgba(9, 9, 11, .985); border: 1px solid #2d2d33;
  box-shadow: -2px 0 0 rgba(56,225,238,.35), 2px 0 0 rgba(232,25,125,.45), 0 30px 90px rgba(0,0,0,.7);
  transform-origin: 0 0;
}
.term-open .term::before { /* glass: scanlines + edge falloff */
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,.03) 0 1px, transparent 1px 3px),
              radial-gradient(ellipse at center, transparent 62%, rgba(0,0,0,.5) 100%);
}
.term-open .term__bar {
  display: flex; align-items: center; gap: 12px; height: 40px; flex: none; padding: 0 8px 0 18px;
  border-bottom: 1px solid #222227; font-size: 12px; color: var(--ink-3);
}
.term__title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.term__title::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 10px; background: var(--mag); }
.term__hint { border: 1px solid #2d2d33; padding: 1px 6px; font-size: 11px; }
.term__close { width: 30px; height: 30px; border: 0; background: none; cursor: pointer; font-size: 20px; line-height: 1; color: var(--ink-2); position: relative; z-index: 3; }
.term__close:hover { color: var(--mag-hi); }
.term-open .term__out { flex: 1; height: auto; padding: 18px 20px 8px; font-size: 14.5px; }
.term-open .term__line { margin: 0 20px 16px; }

/* CRT power-off: collapse to a bright line, then to a dot, then gone */
.term-off .term { animation: crtOff .62s cubic-bezier(.7, 0, .3, 1) forwards; transform-origin: 50% 50%; }
.term-off .term::after { content: ""; position: absolute; inset: 0; z-index: 4; background: #f6f5f1; pointer-events: none; animation: crtFlash .62s forwards; }
.term-off .term-backdrop { opacity: 0; transition-delay: .25s; }
@keyframes crtOff {
  0%   { transform: none; }
  42%  { transform: scale(1, .006); }
  72%  { transform: scale(.02, .006); }
  86%  { transform: scale(.02, .006); opacity: 1; }
  100% { transform: scale(0, 0); opacity: 0; }
}
@keyframes crtFlash { 0% { opacity: 0; } 30% { opacity: .85; } 100% { opacity: 1; } }

@media (max-width: 560px) {
  .term-open .term { inset: 12px 12px auto; margin: 0 auto; height: 60dvh; width: auto; }
}
@keyframes blink { 50% { opacity: 0; } }

/* the invader that wanders across the bottom now and then */
.invader {
  position: fixed; left: 0; bottom: 64px; width: 44px; height: 32px; padding: 0; border: 0; cursor: pointer;
  background: none; z-index: 5; animation: walk 14s linear forwards;
}
.invader svg { width: 100%; height: 100%; display: block; overflow: visible; }
.invader .b { display: none; }
.invader.step .a { display: none; }
.invader.step .b { display: inline; }
.invader:hover svg, .invader:focus-visible svg { filter: drop-shadow(-2px 0 0 var(--cyan)) drop-shadow(2px 0 0 var(--mag)); }
@keyframes walk { from { transform: translateX(-60px); } to { transform: translateX(calc(100vw + 60px)); } }

.shake .stage, .shake #field { animation: shake .6s steps(8); }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translate(-8px, 3px); } 40% { transform: translate(7px, -4px); } 60% { transform: translate(-5px, -2px); } 80% { transform: translate(4px, 3px); } }

.corner {
  position: fixed; right: 20px; bottom: 18px; z-index: 5; font-size: 12px; color: var(--ink-3); text-decoration: none;
  letter-spacing: .04em; transition: color .2s;
}
.corner:hover { color: var(--mag-hi); }

.crt-overlay {
  position: fixed; inset: 0; pointer-events: none; z-index: 50;
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,.025) 0 1px, transparent 1px 3px),
              radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.55) 100%);
}

/* arcade */
.arcade { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(5,5,7,.9); padding: 16px; }
.arcade[hidden] { display: none; }
.arcade__box { width: min(560px, 100%); border: 1px solid var(--line); background: var(--bg); padding: 14px; }
.arcade__hud { display: flex; gap: 24px; align-items: center; font-size: 13px; color: var(--ink-2); margin-bottom: 10px; }
.arcade__hud b { color: var(--ink); }
.arcade__close { margin-left: auto; background: none; border: 1px solid var(--line); width: 34px; height: 34px; cursor: pointer; font-size: 20px; line-height: 1; }
.arcade canvas { display: block; width: 100%; height: auto; background: #050507; touch-action: none; }
.arcade__help { font-size: 12px; line-height: 1.5; color: var(--ink-3); margin: 10px 0 0; }

@media (max-width: 560px) {
  .stage { padding-bottom: 96px; }
  .corner { left: 0; right: 0; text-align: center; bottom: 14px; }
  .invader { bottom: 46px; }
}
@media (prefers-reduced-motion: reduce) {
  .logo__word, .term { transition: none; }
  .term__cursor { animation: none; }
}
