/*
 * Shared "matrix" theme for TBJIT.
 * Black and dark navy, lit only by glowing green code.
 */

:root {
  color-scheme: dark;
  --background: #010603;
  --text: #a9ffc4;
  --muted: #4f9a6a;
  --faint: #235339;
  --line: rgba(60, 255, 140, .22);
  --panel: rgba(10, 40, 24, .35);
  --accent: #35ff7a;
  --accent-dim: rgba(53, 255, 122, .38);
  --focus: #b6ffd2;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 15%, rgba(53, 255, 122, .10), transparent 34rem),
    radial-gradient(circle at 84% 82%, rgba(10, 35, 70, .35), transparent 30rem),
    var(--background);
  background-attachment: fixed, fixed, fixed;
  animation: drift 26s ease-in-out infinite alternate;
  color: var(--text);
  font-family: 'Courier New', ui-monospace, Consolas, monospace;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    180deg,
    rgba(53, 255, 122, .05) 0px,
    rgba(53, 255, 122, .05) 1px,
    transparent 1px,
    transparent 3px
  );
  animation: rain 9s linear infinite;
  opacity: .5;
  mix-blend-mode: screen;
}

@keyframes rain {
  from { background-position: 0 0; }
  to   { background-position: 0 240px; }
}

@keyframes drift {
  from { background-position: 0% 0%, 100% 100%, 0 0; }
  to   { background-position: 4% 6%, 94% 92%, 0 0; }
}

main {
  width: min(720px, 100%);
  padding: clamp(32px, 7vw, 72px);
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  backdrop-filter: blur(16px);
  text-align: center;
  position: relative;
  box-shadow: 0 0 60px rgba(53, 255, 122, .10), 0 30px 90px rgba(0, 0, 0, .6);
}

main::before,
main::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 1px solid var(--accent-dim);
  opacity: .7;
}

main::before {
  top: -1px;
  left: -1px;
  border-right: none;
  border-bottom: none;
}

main::after {
  bottom: -1px;
  right: -1px;
  border-left: none;
  border-top: none;
}

.logo {
  display: block;
  width: min(240px, 70%);
  max-height: 160px;
  margin: 0 auto 28px;
  object-fit: contain;
  border-radius: 6px;
  filter: grayscale(1) brightness(1.05) sepia(1) hue-rotate(70deg) saturate(4);
  opacity: .9;
}

h1 {
  margin: 0;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
  animation: flicker 3.4s linear infinite;
}

@keyframes flicker {
  0%, 2%, 4%, 6%, 30%, 32%, 34%, 36%, 100% {
    opacity: 1;
    text-shadow: 0 0 6px var(--accent), 0 0 24px var(--accent-dim), 0 0 60px var(--accent-dim);
  }
  3% { opacity: .84; text-shadow: 0 0 4px var(--accent-dim); }
  5% { opacity: .7; text-shadow: none; }
  31% { opacity: .8; text-shadow: 0 0 4px var(--accent-dim); }
  33% { opacity: .6; text-shadow: none; }
  35% { opacity: .9; text-shadow: 0 0 8px var(--accent-dim); }
}

/*
 * Terminal-style typed headings.
 * Add class="typed" to an h1 and toggle "booting" then "lit" via script
 * once the text has finished typing out.
 */
h1.typed {
  display: inline-flex;
  align-items: baseline;
  animation: none;
}

h1.typed::after {
  content: '';
  display: inline-block;
  width: .12ch;
  height: .72em;
  margin-left: .12em;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent), 0 0 14px var(--accent-dim);
  animation: caret 900ms step-end infinite;
}

@keyframes caret {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

h1.typed.booting {
  animation: boot-flicker 900ms steps(2, jump-none) 1;
}

h1.typed.lit {
  animation: flicker-hot 2.6s linear infinite;
}

@keyframes boot-flicker {
  0%   { opacity: .2; text-shadow: none; }
  8%   { opacity: 1;  text-shadow: 0 0 10px var(--accent), 0 0 40px var(--accent-dim), 0 0 90px var(--accent-dim); }
  16%  { opacity: .3; text-shadow: none; }
  24%  { opacity: 1;  text-shadow: 0 0 10px var(--accent), 0 0 40px var(--accent-dim); }
  32%  { opacity: .5; text-shadow: 0 0 4px var(--accent-dim); }
  40%  { opacity: 1;  text-shadow: 0 0 12px var(--accent), 0 0 50px var(--accent-dim), 0 0 100px var(--accent-dim); }
  100% { opacity: 1;  text-shadow: 0 0 12px var(--accent), 0 0 50px var(--accent-dim), 0 0 100px var(--accent-dim); }
}

@keyframes flicker-hot {
  0%, 4%, 8%, 12%, 45%, 49%, 53%, 57%, 100% {
    opacity: 1;
    text-shadow: 0 0 10px var(--accent), 0 0 40px var(--accent-dim), 0 0 90px var(--accent-dim);
  }
  6% { opacity: .75; text-shadow: 0 0 4px var(--accent-dim); }
  10% { opacity: .55; text-shadow: none; }
  11% {
    opacity: 1;
    text-shadow: 0 0 10px var(--accent), 0 0 40px var(--accent-dim), 0 0 90px var(--accent-dim);
  }
  47% { opacity: .7; text-shadow: 0 0 4px var(--accent-dim); }
  51% { opacity: .5; text-shadow: none; }
  55% { opacity: .9; text-shadow: 0 0 8px var(--accent-dim); }
}

.tagline,
.message {
  margin: 24px 0 0;
  color: var(--muted);
  font-size: clamp(15px, 2.2vw, 18px);
  letter-spacing: .03em;
}

.email {
  margin: 12px 0 0;
  color: var(--faint);
  font-family: 'Courier New', ui-monospace, monospace;
  font-size: 13px;
  letter-spacing: .04em;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 150px;
  margin-top: 36px;
  padding: 14px 28px;
  border: 1px solid var(--accent-dim);
  border-radius: 2px;
  background: transparent;
  color: var(--accent);
  font-family: 'Courier New', ui-monospace, monospace;
  font-size: 13px;
  letter-spacing: .18em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background 200ms ease, box-shadow 200ms ease, color 200ms ease;
}

.button:hover {
  background: rgba(53, 255, 122, .12);
  box-shadow: 0 0 30px var(--accent-dim);
  color: var(--focus);
}

.button:focus-visible {
  outline: 1px solid var(--focus);
  outline-offset: 4px;
}

footer {
  margin-top: 44px;
  color: var(--faint);
  font-family: 'Courier New', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: .28em;
  text-transform: uppercase;
}

.error {
  color: #ff8a7a;
}

@media (max-width: 480px) {
  body {
    padding: 16px;
  }

  main {
    padding: 36px 22px;
  }

  .button {
    width: 100%;
  }
}
