@font-face {
  font-family: "Press Start 2P";
  src: url("../fonts/PressStart2P.woff2") format("woff2");
  font-display: swap;
}

/* Themes: swap these variables only. */
:root, [data-theme="green"] {
  --bg: #04100a; --panel: #07200f; --fg: #33ff66; --dim: #1f9a40; --accent: #b6ff5c;
  --border: #1f9a40; --glow: 0 0 6px rgba(51,255,102,.55);
  --tok-kw: #b6ff5c; --tok-str: #7df9c8; --tok-com: #1f9a40; --tok-num: #ffd84d;
  --crt: 1;
}
[data-theme="amber"] {
  --bg: #120a00; --panel: #1e1100; --fg: #ffb000; --dim: #a06a00; --accent: #ffe08a;
  --border: #a06a00; --glow: 0 0 6px rgba(255,176,0,.55);
  --tok-kw: #ffe08a; --tok-str: #ff8c42; --tok-com: #a06a00; --tok-num: #ffd84d;
  --crt: 1;
}
[data-theme="blue"] {
  --bg: #06061c; --panel: #0c0c34; --fg: #7aa2ff; --dim: #4a5fb0; --accent: #ff6ec7;
  --border: #4a5fb0; --glow: 0 0 6px rgba(122,162,255,.55);
  --tok-kw: #ff6ec7; --tok-str: #5cf2d6; --tok-com: #4a5fb0; --tok-num: #ffd84d;
  --crt: 1;
}
[data-theme="gameboy"] {
  --bg: #0f380f; --panel: #306230; --fg: #9bbc0f; --dim: #8bac0f; --accent: #e0f8b0;
  --border: #9bbc0f; --glow: none;
  --tok-kw: #e0f8b0; --tok-str: #c8e870; --tok-com: #8bac0f; --tok-num: #e0f8b0;
  --crt: 0;
}
[data-theme="paper"] {
  --bg: #f4efe1; --panel: #e9e2cd; --fg: #2b2b2b; --dim: #6b6657; --accent: #b3261e;
  --border: #2b2b2b; --glow: none;
  --tok-kw: #b3261e; --tok-str: #1b6e3c; --tok-com: #7a7567; --tok-num: #8a5a00;
  --crt: 0;
}
[data-theme="violet"] {
  --bg: #0e0620; --panel: #1a0b38; --fg: #c9a2ff; --dim: #7d56c2; --accent: #ff8bd8;
  --border: #7d56c2; --glow: 0 0 6px rgba(201,162,255,.55);
  --tok-kw: #ff8bd8; --tok-str: #7df9ff; --tok-com: #7d56c2; --tok-num: #ffd84d;
  --crt: 1;
}
[data-theme="orange-grey"] {
  --bg: #1f2022; --panel: #2b2c2f; --fg: #d4d4d4; --dim: #8a8b8f; --accent: #ff8c1a;
  --border: #5a5b60; --glow: none;
  --tok-kw: #ff8c1a; --tok-str: #9fc5a0; --tok-com: #7a7b80; --tok-num: #ffc266;
  --crt: 0;
}

* { box-sizing: border-box; }
html { background: var(--bg); font-size: 112.5%; } /* 18px; all rem sizes scale with it */
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 1rem/1.6 ui-monospace, "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
  text-shadow: var(--glow);
}
.wrap { max-width: 860px; margin: 0 auto; padding: 16px; }

/* CRT scanlines overlay */
.crt {
  position: fixed; inset: 0; pointer-events: none; z-index: 10;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,.18) 0 1px, transparent 1px 3px);
  opacity: var(--crt);
}

a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
a:hover { background: var(--fg); color: var(--bg); text-shadow: none; }

h1, h2, h3, .logo, .prompt, .tag, .meta, select, .btn {
  font-family: "Press Start 2P", ui-monospace, monospace; font-weight: normal;
}
h1 { font-size: 1.05rem; line-height: 1.6; margin: 1.2rem 0 .6rem; }
h2 { font-size: .9rem; line-height: 1.6; margin: 2rem 0 .6rem; color: var(--accent); }
h3 { font-size: .8rem; margin: 1.5rem 0 .5rem; color: var(--accent); }
h2::before { content: "## "; color: var(--dim); }
h3::before { content: "### "; color: var(--dim); }

.bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 2px solid var(--border); }
.logo { font-size: .85rem; text-decoration: none; }
.theme { display: flex; align-items: baseline; gap: 8px; font-size: .6rem; color: var(--dim); font-family: "Press Start 2P", monospace; }
select {
  font-size: .6rem; background: var(--panel); color: var(--fg); border: 2px solid var(--border);
  padding: 6px; border-radius: 0; cursor: pointer;
}

.prompt { font-size: .7rem; margin: 20px 0 8px; color: var(--dim); }
.cursor { display: inline-block; width: .6em; height: .875em; background: var(--fg); margin-left: 6px; vertical-align: baseline; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.about { border-left: 4px solid var(--border); padding-left: 14px; margin-bottom: 28px; }
.about p { margin: .4rem 0; }
.social { display: flex; gap: 10px; margin: -14px 0 28px 18px; }
.social a { display: inline-flex; padding: 6px; border: 2px solid var(--border); line-height: 0; text-decoration: none; }
.social svg { width: 1.3rem; height: 1.3rem; }

/* Post list */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.tag {
  font-size: .6rem; padding: 5px 8px; border: 2px solid var(--border); background: transparent;
  color: var(--fg); cursor: pointer; text-shadow: inherit;
}
.tag.on, .tag:hover { background: var(--fg); color: var(--bg); text-shadow: none; }
.post-item { display: block; padding: 14px 0; border-bottom: 1px dashed var(--border); text-decoration: none; color: inherit; }
.post-item:hover { background: var(--panel); text-shadow: var(--glow); color: inherit; }
.post-item .t { font-family: "Press Start 2P", monospace; font-size: .75rem; line-height: 1.7; color: var(--accent); }
.post-item .meta { font-size: .62rem; color: var(--dim); margin: 6px 0; }
.post-item .s { color: var(--fg); }
.meta { font-size: .65rem; color: var(--dim); }
.empty { color: var(--dim); padding: 24px 0; }

/* Post body */
.post p { margin: .8rem 0; }
.post ul, .post ol { padding-left: 1.4rem; }
.post li { margin: .25rem 0; }
.post code.inline { background: var(--panel); padding: 1px 5px; border: 1px solid var(--border); }
.post blockquote {
  margin: 1rem 0; padding: 8px 14px; background: var(--panel);
  border-left: 4px solid var(--accent);
}
.post blockquote p { margin: .3rem 0; }
.back { font-family: "Press Start 2P", monospace; font-size: .6rem; }

/* Code + ascii frames */
.code, .ascii { margin: 1.2rem 0; border: 2px solid var(--border); background: var(--panel); }
figure.ascii { margin: 1.2rem 0; }
.code-head, .ascii-cap {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  font-family: "Press Start 2P", monospace; font-size: .55rem; color: var(--dim);
  padding: 6px 10px; border-bottom: 2px solid var(--border);
}
.ascii-cap { border-bottom: 0; border-top: 2px solid var(--border); justify-content: center; }
.btn {
  font-size: .5rem; background: transparent; color: var(--fg); border: 2px solid var(--border);
  padding: 4px 6px; cursor: pointer; text-shadow: inherit;
}
.btn:hover { background: var(--fg); color: var(--bg); text-shadow: none; }
pre { margin: 0; padding: 12px; overflow-x: auto; line-height: 1.35; tab-size: 2; }
pre code { font: inherit; white-space: pre; }
.ascii pre { text-align: center; display: block; line-height: 1.15; font-size: .95rem; }
.k { color: var(--tok-kw); }
.tk-str { color: var(--tok-str); } .tk-com { color: var(--tok-com); font-style: italic; } .tk-num { color: var(--tok-num); }

footer { margin: 48px 0 24px; color: var(--dim); font-family: "Press Start 2P", monospace; font-size: .55rem; }

@media (max-width: 520px) {
  body { font-size: 15px; }
  .theme span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .cursor { animation: none; }
  .crt { display: none; }
}
