/* Pomputer BBS — Terminal Styles
   Ported from chrisp.eu + extended for full BBS interface */

@font-face {
  font-family: 'DOS';
  src: url('../fonts/Web437_IBM_VGA_8x16.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'AmigaDemo';
  src: url('../fonts/amiga-demo-pixel-type-8x8.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

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

:root {
  --bg: #0a0a0c;
  --fg: #8a9a7c;
  --fg-bright: #b4c8a0;
  --fg-dim: #3a4a32;
  --amber: #c4a050;
  --amber-dim: #6a5828;
  --cyan: #5a9a9a;
  --cyan-dim: #2a4a4a;
  --red: #c45050;
  --white: #d0d0d0;
  --border: #2a3a22;
  --glow: rgba(138, 154, 124, 0.15);
  --font-size: 16px;
  --line-height: 1.4;
  --char-width: 9.6px;
}

html, body { height: 100%; }

body {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: 'DOS', 'Courier New', monospace;
  font-size: var(--font-size);
  line-height: var(--line-height);
  overflow: hidden;
  position: relative;
}

/* === Canvases === */

canvas#starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
}

canvas#sinescroll {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 820px;
  height: 60px;
  z-index: 10;
  pointer-events: none;
}

/* === CRT Effects === */

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.6) 100%);
  pointer-events: none;
  z-index: 3;
}

/* Scanline overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.08) 2px,
    rgba(0, 0, 0, 0.08) 4px
  );
  pointer-events: none;
  z-index: 4;
}

/* === Terminal Container === */

#terminal {
  position: relative;
  z-index: 2;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
  padding: 1rem 2rem;
  padding-bottom: 50px; /* room for sine scroller */
  overflow: hidden;
}

/* === Screen Area (scrollable content) === */

#screen {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--fg-dim) var(--bg);
}

#screen::-webkit-scrollbar {
  width: 6px;
}
#screen::-webkit-scrollbar-track {
  background: var(--bg);
}
#screen::-webkit-scrollbar-thumb {
  background: var(--fg-dim);
}


/* === Dividers & Headers (full-width) === */

.divider-line {
  border-top: 1px solid var(--border);
  margin: 0.3rem 0;
}

.header-box {
  border: 1px solid var(--cyan-dim);
  padding: 0.4rem 1rem;
  margin: 0.3rem 0;
  text-align: center;
}

.header-box-title {
  color: var(--cyan);
}

.footer-box {
  border-top: 1px solid var(--border);
  margin: 0.3rem 0;
}

/* === Output Lines === */

.line {
  white-space: pre-wrap;
  word-break: break-all;
  min-height: 1.4em;
}

/* === Color Classes (ANSI 16-color) === */

.c-black { color: #000000; }
.c-red { color: #aa0000; }
.c-green { color: #00aa00; }
.c-yellow { color: #aa5500; }
.c-blue { color: #0000aa; }
.c-magenta { color: #aa00aa; }
.c-cyan { color: #00aaaa; }
.c-white { color: #aaaaaa; }
.c-bright-black { color: #555555; }
.c-bright-red { color: #ff5555; }
.c-bright-green { color: #55ff55; }
.c-bright-yellow { color: #ffff55; }
.c-bright-blue { color: #5555ff; }
.c-bright-magenta { color: #ff55ff; }
.c-bright-cyan { color: #55ffff; }
.c-bright-white { color: #ffffff; }

/* Theme color shortcuts */
.c-fg { color: var(--fg); }
.c-fg-bright { color: var(--fg-bright); }
.c-fg-dim { color: var(--fg-dim); }
.c-amber { color: var(--amber); }
.c-amber-dim { color: var(--amber-dim); }
.c-theme-cyan { color: var(--cyan); }

/* Bold */
.bold { font-weight: bold; }

/* === Command Prompt === */

#prompt-bar {
  position: relative;
  z-index: 5;
  padding: 0.5rem 0;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0;
  color: var(--cyan);
  font-size: var(--font-size);
  flex-shrink: 0;
}

#prompt-label {
  color: var(--cyan);
  text-shadow: 0 0 6px rgba(90, 154, 154, 0.2);
  white-space: nowrap;
}

#prompt-wrap {
  display: inline-flex;
  align-items: center;
  flex: 1;
  margin-left: 0.5em;
}

#prompt-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--fg-bright);
  font-family: inherit;
  font-size: inherit;
  width: auto;
  min-width: 1ch;
  caret-color: transparent;
}

#block-cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.15em;
  background: var(--cyan);
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
  flex-shrink: 0;
}

#prompt-cursor {
  display: inline-block;
  width: 0.55em;
  height: 1.1em;
  background: var(--cyan);
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
}

/* === Logo === */

.logo {
  max-width: 50%;
  height: auto;
  image-rendering: pixelated;
  display: block;
  margin: 0 auto;
}

.logo.logo-small {
  max-width: 25%;
}

@media (max-width: 520px) {
  .logo {
    max-width: 100%;
  }
  .logo.logo-small {
    max-width: 60%;
  }
}

/* === Menu Items (clickable) === */

.menu-item {
  cursor: pointer;
  transition: color 0.1s;
}

.menu-item:hover {
  color: var(--fg-bright);
  text-shadow: 0 0 6px var(--glow);
}

.menu-item .key {
  color: var(--amber);
}

/* === Blog Message Headers === */

.msg-header {
  cursor: pointer;
}

.msg-header:hover {
  color: var(--fg-bright);
}

/* === One-liner Input === */

#oneliner-form {
  display: flex;
  gap: 0;
  align-items: center;
  margin-top: 0.5rem;
}

#oneliner-form input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  outline: none;
  color: var(--fg-bright);
  font-family: inherit;
  font-size: inherit;
  flex: 1;
  padding: 2px 4px;
}

#oneliner-form input::placeholder {
  color: var(--fg-dim);
}

/* === Corner Decorations === */

.corner {
  position: fixed;
  pointer-events: none;
  z-index: 6;
  font-family: 'DOS', 'Courier New', monospace;
  font-size: 0.55rem;
  color: var(--fg-dim);
  opacity: 0.4;
}
.corner--tl { top: 12px; left: 16px; }
.corner--tr { top: 12px; right: 16px; }
.corner--bl { bottom: 50px; left: 16px; }
.corner--br { bottom: 50px; right: 16px; }

/* === Animations === */

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

@keyframes fadein {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* === Mobile === */

@media (max-width: 520px) {
  :root {
    --font-size: 13px;
  }
  #terminal {
    padding: 0.5rem 0.75rem;
    padding-bottom: 50px;
  }
  .corner { display: none; }
}
