/* Terminal-prompt theme */
:root {
  --bg: #0c0c0c;
  --bg-window: #1a1a1a;
  --chrome: #2a2a2a;
  --text: #e6e6e6;
  --muted: #8a8a8a;
  --green: #5fff87;
  --cyan: #5ff7ff;
  --yellow: #f5e642;
  --pink: #ff79c6;
  --red: #ff5555;
  --purple: #bd93f9;
  --blue: #6ab0ff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "SF Mono", "Menlo", "Consolas", "Liberation Mono", "Courier New", monospace;
  font-size: 15px;
  line-height: 1.5;
}

body {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4vh 16px 8vh;
}

/* Subtle scanlines for nerdy vibe */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,0.02) 0px,
    rgba(255,255,255,0.02) 1px,
    transparent 1px,
    transparent 3px
  );
  z-index: 9999;
}

.window {
  width: 100%;
  max-width: 880px;
  background: var(--bg-window);
  border-radius: 8px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6), 0 0 0 1px #000;
  overflow: hidden;
}

.titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--chrome);
  padding: 9px 12px;
  border-bottom: 1px solid #000;
}

.dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #555;
  display: inline-block;
}
.dot.red    { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.green  { background: #27c93f; }

.title {
  flex: 1;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.05em;
}

.term {
  padding: 22px 22px 30px;
  min-height: 60vh;
  white-space: normal;
  word-break: break-word;
}

.term .line { margin: 0; white-space: pre-wrap; }
.term .out  { color: var(--text); }
.term .dim  { color: var(--muted); }
.term .ok   { color: var(--green); }
.term .warn { color: var(--yellow); }
.term .err  { color: var(--red); }
.term .info { color: var(--cyan); }
.term .acc  { color: var(--pink); }
.term .pur  { color: var(--purple); }

/* Prompt: user@host:path$ */
.prompt .user { color: var(--green); }
.prompt .at   { color: var(--text); }
.prompt .host { color: var(--green); }
.prompt .colon{ color: var(--text); }
.prompt .path { color: var(--blue); }
.prompt .sym  { color: var(--text); margin-right: 6px; }

.cmd { color: var(--text); }

/* Cursor */
.cursor {
  display: inline-block;
  width: 9px;
  height: 1.05em;
  background: var(--text);
  vertical-align: text-bottom;
  margin-left: 2px;
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* Clickable commands styled like links */
a.cmd-link {
  color: var(--yellow);
  text-decoration: none;
  border-bottom: 1px dashed rgba(245, 230, 66, 0.4);
}
a.cmd-link:hover {
  color: #fff;
  background: var(--yellow);
  color: #000;
  border-bottom-color: transparent;
}

a.ext {
  color: var(--cyan);
  text-decoration: none;
}
a.ext:hover { text-decoration: underline; }

.menu {
  margin: 14px 0 8px;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 18px;
}
.menu .k { color: var(--pink); }
.menu .v { color: var(--text); }

ul.bare {
  list-style: none;
  padding-left: 0;
  margin: 4px 0 10px;
  line-height: 1.5;
}
ul.bare li { margin: 2px 0; }
ul.bare li::before {
  content: "▸ ";
  color: var(--purple);
}

hr.sep {
  border: none;
  border-top: 1px dashed #333;
  margin: 12px 0;
}

.banner {
  color: var(--green);
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.15;
}

.small { font-size: 12px; color: var(--muted); }

/* ───────── Mobile / responsive ───────── */
@media (max-width: 720px) {
  html, body { font-size: 13px; line-height: 1.45; }
  body { padding: 2vh 8px 4vh; }

  .window { border-radius: 6px; }
  .titlebar { padding: 7px 10px; }
  .title { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  .term { padding: 14px 12px 18px; }

  /* Index page: shrink the figlet banner so it fits */
  #term pre,
  #term .line:has(pre) {
    font-size: 9px;
    line-height: 1.05;
  }

  /* Allow long unbroken prompts/cmds to wrap */
  .prompt { white-space: nowrap; }
  .line .cmd { word-break: break-word; }

  ul.bare { padding-left: 4px; }
}

/* Stack cheatsheet payloads + buttons vertically on narrow screens */
@media (max-width: 560px) {
  .pl {
    grid-template-columns: 1fr !important;
  }
  .pl button.copy {
    min-width: 0 !important;
    padding: 6px 12px !important;
    justify-self: end;
  }
  .pl code {
    font-size: 12px !important;
    padding: 8px 10px !important;
  }
  .warn-box { font-size: 12px; }

  /* Tighter banner / smaller cheatsheet category */
  .cat { font-size: 12px; }

  /* JWT decoder: smaller text on mobile */
  .editor { font-size: 12px !important; padding: 8px !important; }
  .box { font-size: 12px !important; padding: 10px !important; }
}

/* Tiny phones */
@media (max-width: 380px) {
  html, body { font-size: 12px; }
  #term pre { font-size: 7.5px; }
  .title { font-size: 10px; }
}

/* Hide everything after the typing prompt while the cmd is being typed,
   then fade in once typer.js removes .term-typing. */
.term.term-typing > *:not(.type-cmd) {
  opacity: 0;
}
.term:not(.term-typing) > * {
  transition: opacity 280ms ease-out;
  opacity: 1;
}

/* Hidden input that absorbs keystrokes (incl. mobile) */
#cli {
  position: fixed;
  left: -100px;
  top: -100px;
  width: 1px;
  height: 1px;
  opacity: 0;
  border: 0;
  padding: 0;
  margin: 0;
}
.line.prompt-active .input { white-space: pre; }
