@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  --accent: #00ff88;
  --bg: #0c0c0c;
  --surface: #0f0f0f;
  --border: #1a1a1a;
  --text: #cccccc;
  --text-bright: #e0e0e0;
  --muted: #555555;
  --dim: #333333;
  --code-string: #e8c87a;
  --code-keyword: #7ec8e3;
  --font-mono: 'JetBrains Mono', 'Consolas', 'Monaco', monospace;
  --font-display: 'Space Grotesk', sans-serif;
  --max-width: 820px;
  --scanline: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 255, 136, 0.012) 2px,
    rgba(0, 255, 136, 0.012) 4px
  );
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.7;
  min-height: 100vh;
  position: relative;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--scanline);
  pointer-events: none;
  z-index: 9999;
}

::selection {
  background: rgba(0, 255, 136, 0.2);
  color: var(--text-bright);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.15s;
}

a:hover {
  opacity: 0.8;
}

/* ── Layout ── */

.site-wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 28px 36px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Navigation ── */

.site-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.site-logo {
  color: var(--accent);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.site-logo a {
  color: inherit;
  text-decoration: none;
}

.site-logo a:hover { opacity: 1; }

.site-logo a.logo-sep {
  color: var(--muted);
  font-weight: 400;
}

.nav-links {
  display: flex;
  gap: 18px;
  list-style: none;
}

.nav-links a {
  color: var(--muted);
  font-size: 12px;
  transition: color 0.15s;
}

.nav-links a:hover {
  color: var(--accent);
}

/* ── Prompt / Breadcrumb ── */

.prompt-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.prompt {
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.breadcrumb {
  font-size: 13px;
  color: var(--muted);
}

.breadcrumb a {
  color: #888;
  transition: color 0.15s;
}

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

.breadcrumb .current {
  color: var(--accent);
}

.breadcrumb .sep {
  margin: 0 2px;
  color: var(--dim);
}

.cursor {
  display: inline-block;
  width: 7px;
  height: 13px;
  background: var(--accent);
  animation: blink 1s step-end infinite;
  vertical-align: middle;
  margin-left: 3px;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* ── Directory Listing (post list) ── */

.dir-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}

.dir-title {
  font-size: 11px;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.dir-count {
  font-size: 11px;
  color: var(--dim);
}

.ls-header {
  display: grid;
  grid-template-columns: 100px 70px 1fr 90px;
  gap: 8px;
  font-size: 10px;
  color: var(--dim);
  padding: 6px 0;
  border-bottom: 1px solid #141414;
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.back-row {
  padding: 10px 0;
  font-size: 12px;
}

.back-row a {
  color: var(--muted);
}

.back-row a:hover {
  color: var(--accent);
}

.post-row {
  display: grid;
  grid-template-columns: 100px 70px 1fr 90px;
  gap: 8px;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid #111;
  transition: background 0.15s;
}

.post-row:hover {
  background: rgba(0, 255, 136, 0.03);
}

.post-link {
  text-decoration: none;
  display: block;
}

.post-perms {
  font-size: 11px;
  color: var(--dim);
}

.post-size {
  font-size: 11px;
  color: var(--dim);
}

.post-title {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
  margin-bottom: 3px;
}

.post-excerpt {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-date {
  font-size: 11px;
  color: var(--dim);
  text-align: right;
}

.post-tags {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.tag {
  font-size: 10px;
  color: var(--accent);
  opacity: 0.5;
  padding: 2px 6px;
  border: 1px solid rgba(0, 255, 136, 0.15);
  border-radius: 3px;
  text-decoration: none;
  transition: opacity 0.15s;
}

.tag:hover {
  opacity: 1;
}

.ls-footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #111;
}

.ls-status {
  font-size: 12px;
  color: var(--dim);
}

.ls-status .accent {
  color: var(--muted);
}

/* ── Home Page (all categories listing) ── */

.home-intro {
  margin-bottom: 32px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
}

.category-section {
  margin-bottom: 32px;
}

.category-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.category-name {
  font-size: 13px;
  color: var(--accent);
}

.category-count {
  font-size: 11px;
  color: var(--dim);
}

.home-post-row {
  display: grid;
  grid-template-columns: 1fr 90px;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #111;
  transition: background 0.15s;
}

.home-post-row:hover {
  background: rgba(0, 255, 136, 0.03);
}

/* ── Article / Single Post ── */

.config-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px 20px;
  margin-bottom: 28px;
  position: relative;
}

.config-label {
  position: absolute;
  top: -9px;
  left: 16px;
  background: var(--bg);
  padding: 0 8px;
  font-size: 10px;
  color: var(--dim);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.cfg-line {
  display: flex;
  gap: 0;
  font-size: 12px;
  line-height: 2;
}

.cfg-num {
  color: var(--dim);
  min-width: 28px;
  text-align: right;
  margin-right: 16px;
  user-select: none;
  font-size: 11px;
}

.cfg-key { color: var(--accent); }
.cfg-eq { color: var(--muted); margin: 0 6px; }
.cfg-str { color: var(--code-string); }
.cfg-comment { color: var(--dim); font-style: italic; }

.article-layout {
  display: flex;
  gap: 32px;
}

.article {
  flex: 1;
  min-width: 0;
}

.article-sidebar {
  min-width: 150px;
  max-width: 180px;
  flex-shrink: 0;
}

.article h1 {
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--text-bright);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 24px;
}

.article h2 {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--text);
  font-weight: 600;
  margin-top: 36px;
  margin-bottom: 14px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.article h3 {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--text);
  font-weight: 600;
  margin-top: 24px;
  margin-bottom: 10px;
}

.article p {
  font-size: 14px;
  color: #999;
  line-height: 1.85;
  margin-bottom: 18px;
}

.article ul, .article ol {
  margin: 0 0 18px 20px;
  color: #999;
  font-size: 14px;
  line-height: 1.85;
}

.article li {
  margin-bottom: 6px;
}

.article code {
  background: #161616;
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
  font-family: var(--font-mono);
}

.article pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  margin: 16px 0;
  overflow-x: auto;
}

.article pre code {
  background: none;
  padding: 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.7;
}

.article blockquote {
  border-left: 3px solid var(--accent);
  padding: 8px 16px;
  margin: 16px 0;
  background: var(--surface);
  border-radius: 0 4px 4px 0;
}

.article blockquote p {
  color: #888;
  margin: 0;
  font-size: 13px;
  font-style: italic;
}

.article img {
  max-width: 100%;
  border-radius: 4px;
  border: 1px solid var(--border);
  margin: 16px 0;
}

.article a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.article hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}

/* ── Table of Contents sidebar ── */

.toc {
  padding: 12px 16px;
  border: 1px solid #141414;
  border-radius: 6px;
  position: sticky;
  top: 28px;
}

.toc-title {
  font-size: 11px;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.toc a {
  font-size: 12px;
  color: var(--muted);
  padding: 3px 0;
  display: block;
  transition: color 0.15s;
}

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

.toc ul {
  list-style: none;
}

.toc li ul {
  padding-left: 12px;
}

.toc li ul a {
  font-size: 11px;
  color: var(--dim);
}

/* ── Article Footer / Prev-Next ── */

.article-footer {
  margin-top: 36px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.prev-next a {
  color: var(--muted);
}

.prev-next a:hover {
  color: var(--accent);
}

.prev-next .arrow {
  color: var(--accent);
}

/* ── Site Footer ── */

.site-footer {
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--dim);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 20px;
}

.site-footer a {
  color: var(--muted);
}

/* ── Tags Page ── */

.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tags-list .tag {
  font-size: 12px;
  padding: 4px 10px;
  opacity: 0.7;
}

.tags-list .tag:hover {
  opacity: 1;
}

/* ── 404 ── */

.not-found {
  text-align: center;
  padding: 80px 0;
}

.not-found h1 {
  font-family: var(--font-display);
  font-size: 48px;
  color: var(--accent);
  margin-bottom: 12px;
}

.not-found p {
  color: var(--muted);
  font-size: 14px;
}

/* ── Responsive ── */

@media (max-width: 700px) {
  .site-wrapper {
    padding: 20px 16px;
  }

  .ls-header,
  .post-row {
    grid-template-columns: 1fr 80px;
  }

  .post-perms,
  .post-size,
  .ls-header span:nth-child(1),
  .ls-header span:nth-child(2) {
    display: none;
  }

  .article-layout {
    flex-direction: column;
  }

  .article-sidebar {
    max-width: 100%;
    order: -1;
  }

  .toc {
    position: static;
  }

  .site-nav {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
}
