:root {
  --black: #000;
  --green: #71ff00;
  --green-hot: #adff00;
  --green-mid: #2ee900;
  --green-dim: #087f0c;
  --green-ghost: rgba(78, 255, 0, 0.16);
  --line: rgba(90, 255, 24, 0.68);
  --edge: clamp(1.6rem, 3vw, 3rem);
  --mono: "Cascadia Mono", "SFMono-Regular", "Roboto Mono", Consolas, "Liberation Mono", monospace;
}

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

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--black);
}

body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background: var(--black);
  color: var(--green);
  font-family: var(--mono);
  font-synthesis: none;
  letter-spacing: 0.075em;
  text-shadow:
    0 0 0.18rem var(--green-hot),
    0 0 0.75rem rgba(98, 255, 0, 0.45);
}

button,
a {
  font: inherit;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 0.75rem;
  left: 0.75rem;
  translate: 0 -180%;
  border: 1px solid var(--green);
  padding: 0.7rem 0.9rem;
  background: #001900;
  color: var(--green-hot);
}

.skip-link:focus {
  translate: 0;
}

.terminal {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: 100%;
  min-height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 52% 48%, rgba(27, 112, 0, 0.12), transparent 39%),
    var(--black);
}

.terminal::before {
  position: absolute;
  z-index: -1;
  inset: -8%;
  content: "";
  pointer-events: none;
  background: radial-gradient(ellipse, transparent 44%, rgba(0, 0, 0, 0.78) 83%);
}

.terminal__header {
  z-index: 4;
  padding: clamp(1.7rem, 4vh, 3.25rem) var(--edge) 0;
}

.domain,
.signal,
.identity,
.terminal__footer {
  font-size: clamp(0.69rem, 1.18vw, 1.08rem);
  font-weight: 700;
  line-height: 1.55;
}

.domain {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.terminal__stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(10rem, 1fr) minmax(23rem, 2.25fr) minmax(13rem, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 0;
  padding: 0 var(--edge);
}

.portrait {
  position: relative;
  z-index: 1;
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: stretch;
  justify-self: center;
  width: min(38vw, 35rem);
  min-width: 22rem;
  height: calc(100dvh - 7rem);
  max-height: 61rem;
  margin: -3.5rem 0 0;
  overflow: visible;
  pointer-events: none;
  filter:
    drop-shadow(0 0 0.3rem rgba(111, 255, 0, 0.9))
    drop-shadow(0 0 1.35rem rgba(66, 255, 0, 0.42));
  transition: filter 340ms ease, transform 340ms ease;
}

.portrait::before,
.portrait::after {
  position: absolute;
  z-index: -1;
  inset: 7% -15% 4%;
  content: "";
  background: radial-gradient(ellipse, rgba(36, 255, 0, 0.17), transparent 65%);
  filter: blur(1.6rem);
  opacity: 0.55;
}

.portrait::after {
  inset: 22% -30% 1%;
  background: repeating-linear-gradient(0deg, transparent 0 1.8rem, rgba(70, 255, 0, 0.07) 1.85rem 1.95rem);
  filter: none;
}

.portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: 50% 58%;
  image-rendering: pixelated;
  opacity: 0.93;
  mask-image: linear-gradient(to bottom, transparent 0%, #000 7%, #000 85%, transparent 100%);
}

.portrait__scan {
  position: absolute;
  inset: 6% -4% 4%;
  overflow: hidden;
  opacity: 0.7;
}

.portrait__scan::before {
  position: absolute;
  inset: -15% 0 auto;
  height: 8%;
  content: "";
  background: linear-gradient(to bottom, transparent, rgba(163, 255, 0, 0.23), transparent);
  filter: blur(0.25rem);
  animation: scan 5.5s linear infinite;
}

.signal {
  z-index: 3;
  grid-column: 1;
  grid-row: 1;
  align-self: center;
  display: grid;
  justify-items: start;
  gap: 0.8rem;
  color: var(--green);
}

.signal i,
.identity i {
  display: block;
  width: 1.2rem;
  height: 1px;
  margin-top: 0.25rem;
  background: currentColor;
  box-shadow: 0 0 0.5rem currentColor;
}

.signal b {
  display: block;
  width: 0.2rem;
  height: 0.2rem;
  margin-left: 0.05rem;
  background: currentColor;
}

.identity {
  z-index: 3;
  grid-column: 3;
  grid-row: 1;
  align-self: center;
  justify-self: end;
  min-width: 13.5rem;
  color: var(--green);
  text-align: left;
  transition: color 220ms ease, text-shadow 220ms ease;
}

.identity p {
  margin: 0;
}

.identity p + p {
  margin-top: 0.25rem;
}

.command {
  z-index: 5;
  grid-column: 1 / 3;
  grid-row: 2;
  align-self: end;
  min-width: 0;
  padding-bottom: clamp(1.2rem, 2.4vh, 2.3rem);
}

.command__button {
  display: inline-flex;
  align-items: baseline;
  gap: clamp(0.9rem, 2vw, 2rem);
  margin: 0;
  border: 0;
  padding: 0.12em 0.08em;
  background: transparent;
  color: var(--green);
  font-size: clamp(3rem, 6.8vw, 6.7rem);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: 0.025em;
  text-align: left;
  text-shadow:
    0 0 0.16rem var(--green-hot),
    0 0 0.7rem rgba(145, 255, 0, 0.72),
    0 0 1.5rem rgba(75, 255, 0, 0.32);
  cursor: pointer;
  transition: color 180ms ease, translate 180ms ease, text-shadow 180ms ease;
}

.command__button:hover {
  color: var(--green-hot);
  translate: 0.14em 0;
  text-shadow:
    0 0 0.22rem #c5ff2b,
    0 0 1rem rgba(174, 255, 0, 0.95),
    0 0 2.4rem rgba(74, 255, 0, 0.55);
}

.command__button:focus-visible {
  outline: 2px solid var(--green-hot);
  outline-offset: 0.2rem;
}

.command__hint,
.command__response {
  display: flex;
  align-items: center;
  min-height: 1.4em;
  margin: 0.85rem 0 0 0.3rem;
  color: var(--green);
  font-size: clamp(0.86rem, 1.55vw, 1.35rem);
  font-weight: 700;
}

.command__response {
  position: absolute;
  margin-top: 0.45rem;
  color: var(--green-mid);
  font-size: clamp(0.65rem, 1vw, 0.9rem);
  opacity: 0;
  transition: opacity 240ms ease;
}

.cursor {
  display: inline-block;
  width: 0.65em;
  height: 1.1em;
  margin-left: 0.7em;
  background: currentColor;
  box-shadow: 0 0 0.6rem currentColor;
  vertical-align: -0.15em;
  animation: blink 1s steps(1, end) infinite;
}

.cursor--small {
  width: 0.45em;
  height: 0.85em;
  margin-left: 0.4em;
}

.terminal__footer {
  z-index: 6;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 var(--edge);
  border-top: 1px solid var(--line);
  padding: clamp(0.65rem, 1.5vh, 1rem) 0 clamp(0.8rem, 2vh, 1.5rem);
  color: var(--green);
  box-shadow: 0 -0.25rem 0.85rem -0.55rem var(--green);
}

.footer__status {
  color: var(--green-dim);
  text-shadow: 0 0 0.45rem currentColor;
}

.crt,
.flash {
  position: fixed;
  z-index: 10;
  inset: 0;
  pointer-events: none;
}

.crt {
  background:
    repeating-linear-gradient(to bottom, transparent 0 2px, rgba(0, 0, 0, 0.31) 3px 4px),
    linear-gradient(90deg, rgba(255, 0, 0, 0.012), rgba(0, 255, 0, 0.016), rgba(0, 0, 255, 0.012));
  background-size: 100% 4px, 3px 100%;
  mix-blend-mode: multiply;
  opacity: 0.92;
}

.flash {
  background: rgba(123, 255, 0, 0.13);
  opacity: 0;
}

.terminal.is-active .portrait {
  transform: scale(1.018);
  filter:
    drop-shadow(0 0 0.45rem var(--green-hot))
    drop-shadow(0 0 2rem rgba(86, 255, 0, 0.75));
}

.terminal.is-active .identity {
  color: var(--green-hot);
  text-shadow: 0 0 0.9rem currentColor;
}

.terminal.is-active .command__response {
  opacity: 1;
}

.terminal.is-active .footer__status {
  color: var(--green-hot);
}

.terminal.is-glitching .portrait {
  translate: -0.18rem 0;
  clip-path: polygon(0 0, 100% 0, 100% 38%, 98% 38%, 98% 43%, 100% 43%, 100% 100%, 0 100%, 0 71%, 2% 71%, 2% 67%, 0 67%);
}

.terminal.is-glitching .domain,
.terminal.is-glitching .identity {
  translate: 0.1rem 0;
}

.flash.is-visible {
  animation: flash 280ms steps(2, end);
}

@keyframes blink {
  0%, 46% { opacity: 1; }
  47%, 100% { opacity: 0; }
}

@keyframes scan {
  from { translate: 0 -20%; }
  to { translate: 0 1380%; }
}

@keyframes flash {
  0% { opacity: 0; }
  22% { opacity: 1; }
  44% { opacity: 0.16; }
  70% { opacity: 0.72; }
  100% { opacity: 0; }
}

@media (max-width: 760px) {
  :root {
    --edge: 1.15rem;
  }

  .terminal__header {
    padding-top: 1.25rem;
  }

  .terminal__stage {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto minmax(20rem, 1fr) auto;
    align-items: start;
    padding-top: 1.3rem;
  }

  .portrait {
    grid-column: 1 / 3;
    grid-row: 1 / 4;
    align-self: center;
    width: min(95vw, 29rem);
    min-width: 0;
    height: min(75dvh, 45rem);
    margin: -1.5rem auto 0;
    opacity: 0.85;
  }

  .signal {
    grid-column: 1;
    grid-row: 1;
    align-self: start;
    gap: 0.55rem;
  }

  .signal b:nth-of-type(n + 3) {
    display: none;
  }

  .identity {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
    justify-self: end;
    min-width: 0;
    max-width: 11rem;
    text-align: right;
  }

  .identity i {
    margin-left: auto;
  }

  .command {
    grid-column: 1 / 3;
    grid-row: 3;
    padding-bottom: 0.8rem;
  }

  .command__button {
    gap: 0.7rem;
    font-size: clamp(2.75rem, 14vw, 5rem);
  }

  .command__hint {
    margin-top: 0.55rem;
  }

  .terminal__footer {
    font-size: 0.58rem;
  }
}

@media (max-width: 430px) {
  .domain,
  .signal,
  .identity {
    font-size: 0.61rem;
  }

  .portrait {
    width: 112vw;
    max-width: none;
    margin-left: -6vw;
    opacity: 0.78;
  }

  .identity {
    max-width: 9.2rem;
  }

  .footer__status {
    display: none;
  }

  .terminal__footer {
    justify-content: flex-end;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
