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

/* ─── Root Variables ────────────────────────────────────── */
:root {
  --bg:        #000000;
  --fg:        #ffffff;
  --muted:     #aaaaaa;
  --border:    #222222;

  --accent:    #00ff88;
  --accent-h:  #00ffaa;

  --max-w:     720px;

  --font: "VT323", monospace;
  --pixel: "Press Start 2P", monospace;

  /* Syntax highlighting */
  --hl-keyword:   #00ffff;
  --hl-string:    #00ff88;
  --hl-comment:   #777777;
  --hl-number:    #ffff00;
  --hl-function:  #ff66ff;
  --hl-preproc:   #ff4444;
}

/* ─── Base ─────────────────────────────────────────────── */
html {
  font-size: 20px;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  padding: 0 1.25rem;

  /* CRT glow */
  text-shadow: 0 0 4px rgba(255,255,255,0.35);

  /* Subtle scanlines */
  background-image:
    repeating-linear-gradient(
      0deg,
      rgba(255,255,255,0.03),
      rgba(255,255,255,0.03) 1px,
      transparent 1px,
      transparent 3px
    );
}

/* ─── Layout ───────────────────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
}

/* ─── Header / Nav ─────────────────────────────────────── */
header {
  border-bottom: 1px solid var(--accent);
  padding: 1.5rem 0;
  margin-bottom: 3rem;
}

header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-title {
  font-family: var(--pixel);
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
}

.site-title::before {
  content: "nick@site:~$ ";
  color: var(--muted);
}

nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

nav a,
a.github,
a.download-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: 0.2s;
}

nav a:hover,
nav a.active,
a.github:hover,
a.download-link:hover {
  color: var(--accent);
  text-shadow: 0 0 6px var(--accent);
}

/* ─── Typography ───────────────────────────────────────── */
h1, h2, h3 {
  font-family: var(--pixel);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1 { font-size: 1rem; margin-bottom: 1rem; }
h2 { font-size: 0.85rem; margin: 2rem 0 1rem; color: var(--accent); }
h3 { font-size: 0.75rem; margin: 1.5rem 0 0.5rem; }

p { margin-bottom: 1.25rem; }

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-h);
  text-shadow: 0 0 6px var(--accent);
}

strong { font-weight: bold; }
em { font-style: italic; }

ul, ol {
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
}

li { margin-bottom: 0.3rem; }

blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 1rem;
  color: var(--muted);
  margin: 1.5rem 0;
}

/* ─── Code Blocks ─────────────────────────────────────── */
code {
  font-family: var(--font);
  background: #111111;
  padding: 0.2em 0.4em;
  border: 1px solid #222;
}

pre {
  background: #000000;
  border: 1px solid var(--accent);
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1.25rem;
}

pre code {
  background: none;
  border: none;
}

/* ─── Syntax Highlighting ─────────────────────────────── */
.hl-keyword  { color: var(--hl-keyword); }
.hl-string   { color: var(--hl-string); }
.hl-comment  { color: var(--hl-comment); font-style: italic; }
.hl-number   { color: var(--hl-number); }
.hl-function { color: var(--hl-function); }
.hl-preproc  { color: var(--hl-preproc); }

hr {
  border: none;
  border-top: 1px solid var(--accent);
  margin: 2.5rem 0;
}

/* ─── Post List (Filesystem Style) ────────────────────── */
.post-list {
  list-style: none;
  padding: 0;
}

.post-list li {
  padding: 0.6rem 0;
  border-bottom: 1px dashed #222;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.post-list li:first-child {
  border-top: 1px dashed #222;
}

.post-list .post-date {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.post-list a {
  color: var(--fg);
  text-decoration: none;
}

.post-list a::before {
  content: "> ";
  color: var(--accent);
}

.post-list a:hover {
  color: var(--accent);
}

/* ─── Post / Project Metadata ─────────────────────────── */
.post-meta,
.project-meta {
  display: flex;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.post-meta .tag,
.project-meta .tag {
  border: 1px solid var(--accent);
  padding: 0.1em 0.4em;
  color: var(--accent);
  text-decoration: none;
}

/* ─── Images ───────────────────────────────────────────── */
img {
  max-width: 100%;
  margin: 1rem 0;
  image-rendering: pixelated;
}

/* ─── Footer ───────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--accent);
  padding: 1.5rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}

footer .container {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

footer a {
  color: var(--muted);
  text-decoration: none;
}

footer a:hover {
  color: var(--accent);
}

/* ─── Dropdown ─────────────────────────────────────────── */
.nav-item {
  position: relative;
}

.dropdown-menu {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #000;
  border: 1px solid var(--accent);
  padding: 0.5rem 0;
  list-style: none;
  min-width: 160px;
  transition: opacity 0.2s;
  z-index: 100;
}

.nav-item.dropdown-open .dropdown-menu {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.dropdown-menu li a {
  display: block;
  padding: 0.4rem 1rem;
  color: var(--muted);
}

.dropdown-menu li a:hover {
  color: var(--accent);
}

/* ─── Blinking Cursor Utility ─────────────────────────── */
.cursor {
  display: inline-block;
  width: 8px;
  background: var(--accent);
  margin-left: 4px;
  animation: blink 1s infinite;
}

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

/* ─── Responsive ───────────────────────────────────────── */
@media (max-width: 520px) {
  html { font-size: 16px; }
  .post-list li { flex-direction: column; }
}