/* The Internet — Gopher/CRT terminal. No images. Phosphor on black. */
:root {
  --bg: #020802;
  --bg-2: #041204;
  --fg: #86f986;
  --fg-dim: #3d8f3d;
  --fg-mid: #5cc45c;
  --fg-bright: #c8ffc8;
  --secret: #071407;
  --shadow: #1cff1c;
  --font: "IBM Plex Mono", "Cascadia Code", "Geist Mono", ui-monospace,
    "Cascadia Mono", "DejaVu Sans Mono", "Courier New", monospace;
  --max: 72ch;
  --pad: clamp(0.75rem, 3vw, 1.5rem);
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: clamp(14px, 2.4vw, 16px);
  line-height: 1.45;
  min-height: 100%;
}

body {
  min-height: 100dvh;
  text-rendering: optimizeLegibility;
}

.crt {
  position: relative;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse at center, #062006 0%, var(--bg) 72%);
}

.crt::before {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 2;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.12) 0px,
    rgba(0, 0, 0, 0.12) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: 0.35;
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: var(--max);
  margin: 0 auto;
  padding: var(--pad);
  padding-bottom: 3rem;
  text-shadow: 0 0 6px rgba(28, 255, 28, 0.28);
}

a {
  color: var(--fg-bright);
  text-decoration: none;
  border-bottom: 1px dotted var(--fg-dim);
}

a:hover, a:focus-visible {
  color: #fff;
  background: #0a3a0a;
  border-bottom-style: solid;
}

a:focus-visible {
  outline: 2px solid var(--fg-bright);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--bg);
  color: var(--fg-bright);
  padding: 0.5rem 0.75rem;
  z-index: 10;
}

.skip:focus {
  left: var(--pad);
  top: var(--pad);
  outline: 2px solid var(--fg-bright);
}

.banner {
  margin: 0 0 1rem;
  white-space: pre;
  overflow-x: auto;
  color: var(--fg-bright);
  font-size: clamp(10px, 2.15vw, 14px);
  line-height: 1.2;
  font-weight: 500;
}

.status {
  color: var(--fg-dim);
  margin: 0 0 1.25rem;
  font-size: 0.92em;
}

.status strong {
  color: var(--fg-mid);
  font-weight: 600;
}

.motd {
  border: 1px solid var(--fg-dim);
  padding: 0.75rem 1rem;
  margin: 0 0 1.25rem;
  background: rgba(0, 20, 0, 0.4);
}

.motd h2 {
  margin: 0 0 0.4rem;
  font-size: 1em;
  font-weight: 600;
  color: var(--fg-bright);
  letter-spacing: 0.04em;
}

.motd p {
  margin: 0 0 0.55rem;
}

.motd p:last-child { margin-bottom: 0; }

h1, h2 {
  font-size: 1em;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--fg-bright);
  margin: 0 0 0.75rem;
}

.doc h1 {
  border-bottom: 1px solid var(--fg-dim);
  padding-bottom: 0.4rem;
  margin-bottom: 1rem;
}

.doc p, .doc li { margin: 0 0 0.75rem; }
.doc ul, .doc ol { margin: 0 0 1rem; padding-left: 1.25rem; }
.doc pre {
  margin: 0 0 1rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.menu {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
}

.menu li {
  display: grid;
  grid-template-columns: 1.5ch 2.5ch minmax(0, 1fr);
  column-gap: 0.6ch;
  align-items: baseline;
  margin: 0;
  padding: 0.15rem 0.2rem;
}

.menu .type {
  color: var(--fg-dim);
  user-select: none;
}

.menu .num {
  color: var(--fg-mid);
}

.menu a {
  border-bottom: none;
  color: var(--fg);
  justify-self: start;
}

.menu a:hover, .menu a:focus-visible {
  color: var(--fg-bright);
}

.menu .info {
  display: block;
  color: var(--fg-dim);
  padding: 0.1rem 0;
}

.menu .info .type { margin-right: 0.6ch; }

.menu .info .msg {
  white-space: normal;
}

/* Hidden item: nearly invisible until hover, focus, or reveal. */
.menu .secret {
  opacity: 0.07;
  color: var(--secret);
}

.menu .secret .type,
.menu .secret .num,
.menu .secret a {
  color: inherit;
  border-bottom: none;
  text-shadow: none;
}

.menu .secret:hover,
.menu .secret:focus-within,
.menu.revealed .secret,
body.revealed .menu .secret {
  opacity: 1;
  color: var(--fg);
  outline: 1px dashed var(--fg-mid);
}

.menu .secret:hover a,
.menu .secret:focus-within a,
.menu.revealed .secret a,
body.revealed .menu .secret a {
  color: var(--fg-bright);
}

.menu li.selected {
  background: rgba(80, 255, 80, 0.1);
}

.quote {
  color: var(--fg-bright);
  margin: 1rem 0;
  padding-left: 1ch;
  border-left: 2px solid var(--fg-dim);
}

.prompt {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0;
  margin: 1.25rem 0 0.5rem;
  font-weight: 500;
}

.prompt label {
  color: var(--fg-mid);
  white-space: nowrap;
}

.prompt input {
  flex: 0 1 auto;
  width: auto;
  min-width: 1ch;
  max-width: calc(100% - 20ch);
  field-sizing: content;
  margin: 0;
  padding: 0 0 0 0.4ch;
  border: 0;
  background: transparent;
  color: var(--fg-bright);
  font: inherit;
  text-shadow: inherit;
  caret-color: transparent;
}

.prompt input:focus { outline: none; }

.cursor {
  display: inline-block;
  width: 0.85ch;
  height: 1.1em;
  background: var(--fg);
  box-shadow: 0 0 8px var(--shadow);
  vertical-align: text-bottom;
  animation: blink 1.05s steps(1, end) infinite;
  margin-left: 0;
  pointer-events: none;
  position: relative;
  top: 0.12em;
}

.prompt.has-text .cursor { /* JS repositions; stays visible at end of text */ }

.output {
  min-height: 1.4em;
  color: var(--fg-mid);
  white-space: pre-wrap;
  margin: 0 0 1rem;
}

.help kbd {
  font: inherit;
  color: var(--fg-bright);
  border: 1px solid var(--fg-dim);
  padding: 0 0.3ch;
}

footer.hint {
  color: var(--fg-dim);
  font-size: 0.9em;
  margin-top: 1.5rem;
}

.nav-back {
  margin: 0 0 1rem;
  color: var(--fg-dim);
}

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

@media (prefers-reduced-motion: reduce) {
  .cursor { animation: none; opacity: 1; }
  .crt::before { opacity: 0.18; }
  * {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 520px) {
  .banner { font-size: 10px; }
  .menu li {
    grid-template-columns: 1.5ch 2ch minmax(0, 1fr);
  }
}

@media (prefers-contrast: more) {
  :root {
    --fg: #b8ffb8;
    --fg-dim: #7adf7a;
    --bg: #000;
  }
  .crt::before { opacity: 0.1; }
  .wrap { text-shadow: none; }
}
