/* retro webcore brutalist: OG Macintosh meets Linux rice terminal BBS core */
:root {
  --bg: #1a1612;
  --bg2: #221d17;
  --panel: #2a241c;
  --ink: #d8d2c4;
  --ink-dim: #9a9284;
  --amber: #9bb37a;
  --red: #c47a5a;
  --blue: #8aa0b8;
  --border: #3a332a;
  --border-bright: #5a5040;
  --mac-white: #cfc6b4;
  --mac-black: #14110d;
  --font-mono: "JetBrains Mono", "Fira Code", "Cascadia Mono", "IBM Plex Mono", "Menlo", "Consolas", monospace;
  --font-mac: "Chicago", "Geneva", "Lucida Grande", "Helvetica Neue", sans-serif;
  --scan: rgba(0, 0, 0, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* scanlines */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    var(--scan) 2px,
    var(--scan) 3px
  );
  z-index: 9999;
  mix-blend-mode: multiply;
}

/* CRT vignette */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.55) 100%);
  z-index: 9998;
}

a { color: var(--amber); text-decoration: none; border-bottom: 1px dotted var(--amber); }
a:hover { color: var(--red); border-bottom-color: var(--red); }

/* Mac menu bar */
.menubar {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--mac-white);
  color: var(--mac-black);
  font-family: var(--font-mac);
  font-size: 13px;
  font-weight: 600;
  padding: 2px 6px;
  border-bottom: 2px solid var(--mac-black);
  position: sticky;
  top: 0;
  z-index: 50;
}
.menubar .apple { padding: 0 8px; font-size: 16px; }
.menubar .menu { padding: 0 10px; cursor: default; }
.menubar .menu:hover { background: var(--mac-black); color: var(--mac-white); }
.menubar .spacer { flex: 1; }
.menubar .clock { font-family: var(--font-mono); font-size: 12px; }

/* Hero */
.hero {
  padding: 24px 20px 12px;
  border-bottom: 3px solid var(--border-bright);
  background: linear-gradient(180deg, var(--bg2), var(--bg));
}
.hero h1 {
  margin: 0 0 6px;
  font-family: var(--font-mac);
  font-size: 42px;
  letter-spacing: -1px;
  color: var(--amber);
  text-shadow: 2px 2px 0 #000, 0 0 12px rgba(255,179,71,0.35);
}
.hero .sub {
  color: var(--ink-dim);
  max-width: 760px;
}
.hero .prompt {
  margin-top: 10px;
  font-family: var(--font-mono);
  color: var(--ink);
}
.hero .prompt::before { content: "bbs> "; color: var(--amber); }

/* Layout */
.wrap {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 14px;
  padding: 14px 20px 40px;
  max-width: 1280px;
  margin: 0 auto;
}
@media (max-width: 860px) {
  .wrap { grid-template-columns: 1fr; }
}

/* Mac window */
.window {
  background: var(--panel);
  border: 2px solid var(--mac-white);
  box-shadow: 4px 4px 0 #000;
  margin-bottom: 14px;
}
.window .titlebar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--mac-white);
  color: var(--mac-black);
  font-family: var(--font-mac);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 6px;
  border-bottom: 2px solid var(--mac-black);
  user-select: none;
}
.window .titlebar .close {
  width: 12px; height: 12px;
  border: 1.5px solid var(--mac-black);
  background: #fff;
  box-shadow: inset 0 0 0 1px #000;
}
.window .titlebar .zoom { margin-left: auto; letter-spacing: 2px; }
.window .body { padding: 10px; }

/* Sidebar */
.sidebar .window { position: sticky; top: 46px; }
.sidebar h3 {
  margin: 0 0 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--amber);
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}
.cat-list { list-style: none; padding: 0; margin: 0; }
.cat-list li {
  padding: 4px 6px;
  cursor: pointer;
  border: 1px solid transparent;
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}
.cat-list li:hover { background: var(--bg2); border-color: var(--border); }
.cat-list li.active { background: var(--amber); color: var(--mac-black); font-weight: 700; border-color: var(--mac-black); }
.cat-list li .count { color: var(--ink-dim); font-size: 11px; }
.cat-list li.active .count { color: var(--mac-black); }

/* Search terminal */
.search {
  display: flex;
  align-items: center;
  border: 2px solid var(--mac-white);
  background: #000;
  padding: 6px 8px;
  font-family: var(--font-mono);
}
.search .caret { color: var(--amber); margin-right: 6px; }
.search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 14px;
}
.search input::placeholder { color: var(--ink-dim); }

/* Stats bar */
.stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--ink-dim);
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  margin-bottom: 10px;
}
.stats b { color: var(--amber); }

/* BBS entry list */
.entries { display: flex; flex-direction: column; gap: 10px; }
.entry {
  border: 2px solid var(--border-bright);
  background: var(--bg2);
  padding: 0;
  position: relative;
}
.entry:hover { border-color: var(--amber); }
.entry .head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.entry .num { color: var(--amber); font-weight: 700; }
.entry .name { font-weight: 700; color: var(--mac-white); font-size: 15px; }
.entry .url { color: var(--ink-dim); font-size: 11px; margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40%; }
.entry .body { padding: 8px; }
.entry .desc { margin: 0 0 6px; }
.entry .meta { display: flex; gap: 6px; flex-wrap: wrap; font-size: 11px; }
.tag {
  border: 1px solid var(--border-bright);
  padding: 1px 6px;
  background: #000;
  color: var(--ink-dim);
}
.tag:hover { color: var(--amber); border-color: var(--amber); }
.cat-badge {
  border: 1px solid var(--mac-black);
  background: var(--amber);
  color: var(--mac-black);
  padding: 1px 6px;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 10px;
}
.entry .foot {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--ink-dim);
  padding: 4px 8px;
  border-top: 1px dashed var(--border);
}

/* Submit panel */
.submit {
  margin-top: 16px;
  padding: 12px;
  border: 2px dashed var(--amber);
  background: #0b0f0b;
}
.submit h3 { margin: 0 0 6px; color: var(--amber); }
.submit ol { margin: 6px 0 6px 18px; padding: 0; }
.submit code {
  background: #000;
  border: 1px solid var(--border);
  padding: 1px 4px;
  color: var(--amber);
}
.btn {
  display: inline-block;
  border: 2px solid var(--mac-white);
  background: var(--mac-white);
  color: var(--mac-black);
  font-family: var(--font-mac);
  font-weight: 700;
  padding: 4px 10px;
  cursor: pointer;
  box-shadow: 3px 3px 0 #000;
  margin: 4px 0;
}
.btn:hover { background: var(--amber); border-color: var(--amber); }
.btn:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 #000; }

/* Footer */
.footer {
  padding: 16px 20px;
  border-top: 3px solid var(--border-bright);
  color: var(--ink-dim);
  font-size: 11px;
  text-align: center;
}

/* ASCII decoration */
.ascii {
  white-space: pre;
  font-size: 10px;
  color: var(--ink-dim);
  line-height: 1;
  margin: 4px 0;
}

/* Loading */
.loading { color: var(--amber); font-style: italic; }
.empty { color: var(--ink-dim); font-style: italic; padding: 20px 0; }

/* 88x32 button wall */
.button-wall {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 4px;
  border: 1px solid var(--border);
  background: #000;
  padding: 6px;
}
.button-wall img {
  width: 88px;
  height: 32px;
  image-rendering: pixelated;
  border: 1px solid var(--border-bright);
  background: #000;
  display: block;
  margin: 0 auto;
}
.button-wall a { border: none; display: block; text-align: center; }
.button-wall .empty { grid-column: 1 / -1; color: var(--ink-dim); font-style: italic; font-size: 11px; }

/* button in entry */
.entry .site-button {
  margin: 6px 0 4px;
}
.entry .site-button img {
  width: 88px;
  height: 32px;
  image-rendering: pixelated;
  border: 1px solid var(--border-bright);
  background: #000;
  display: block;
}
