:root {
  --bg: #030705;
  --bg-elevated: rgba(5, 15, 8, 0.78);
  --bg-solid: #07110a;
  --panel: rgba(4, 12, 7, 0.72);
  --text: #cfe9d6;
  --muted: #7ea88a;
  --dim: #4e7058;
  --green: #00ff41;
  --green-bright: #7dff9e;
  --green-soft: rgba(0, 255, 65, 0.16);
  --green-glow: 0 0 8px rgba(0, 255, 65, 0.35), 0 0 24px rgba(0, 255, 65, 0.12);
  --border: rgba(0, 255, 65, 0.22);
  --border-strong: rgba(0, 255, 65, 0.38);
  --danger: #ff5c7a;
  --mono: "Share Tech Mono", "Fira Code", "Cascadia Mono", "Consolas", ui-monospace, monospace;
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --radius: 14px;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  --content-width: 860px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: radial-gradient(ellipse at top, #07140b 0%, var(--bg) 55%, #010302 100%);
  font-family: var(--sans);
  line-height: 1.7;
  overflow-x: hidden;
}

#matrix-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -3;
  opacity: 0.22;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.018) 0px,
    rgba(255, 255, 255, 0.018) 1px,
    transparent 2px,
    transparent 4px
  );
  mix-blend-mode: soft-light;
}

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

a { color: var(--green-bright); text-decoration: none; }
a:hover { color: #baffc9; text-shadow: 0 0 8px rgba(0,255,65,0.25); }

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--bg-solid);
  color: var(--green);
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  z-index: 100;
}
.skip-link:focus { left: 8px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: linear-gradient(to bottom, rgba(3, 8, 5, 0.88), rgba(3, 8, 5, 0.55));
  border-bottom: 1px solid var(--border);
}

.nav-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  font-family: var(--mono);
  color: var(--green);
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  text-shadow: var(--green-glow);
  white-space: nowrap;
}
.brand .prompt-user { color: var(--green-bright); }
.brand .prompt-path { color: #9fffb4; }
.brand .cursor {
  display: inline-block;
  width: 0.6ch;
  height: 1.1em;
  vertical-align: -0.15em;
  background: var(--green);
  margin-left: 2px;
  animation: blink 1.1s steps(1) infinite;
  box-shadow: 0 0 8px rgba(0,255,65,0.5);
}
@keyframes blink { 50% { opacity: 0; } }

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.nav-links a {
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--muted);
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: all 0.18s ease;
}
.nav-links a:hover, .nav-links a[aria-current="page"] {
  color: var(--green-bright);
  border-color: var(--border);
  background: var(--green-soft);
  text-shadow: none;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 34px 20px 70px;
}

.hero {
  max-width: var(--content-width);
  margin: 10px auto 34px;
  padding: 28px 28px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(0,255,65,0.06), rgba(0,255,65,0.02)), var(--panel);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(0,255,65,0.04);
}
.terminal-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-family: var(--mono);
  color: var(--dim);
  font-size: 0.85rem;
}
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.r { background: #ff5f56; } .dot.y { background: #ffbd2e; } .dot.g { background: #27c93f; }
.terminal-bar span:last-child { margin-left: 6px; }

.hero h1 {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.2;
  color: #eaffef;
  text-shadow: 0 0 18px rgba(0,255,65,0.18);
}
.hero h1 .accent { color: var(--green); text-shadow: var(--green-glow); }
.hero p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 70ch;
}
.hero .meta-line {
  font-family: var(--mono);
  color: var(--dim);
  font-size: 0.92rem;
}
.hero .meta-line strong { color: var(--green-bright); font-weight: 500; }

.section-head {
  max-width: var(--content-width);
  margin: 0 auto 14px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}
.section-head h2 {
  margin: 0;
  font-family: var(--mono);
  font-size: 1.15rem;
  color: var(--green-bright);
  font-weight: 500;
}
.section-head h2::before { content: "> "; color: var(--green); }
.section-head .hint { color: var(--dim); font-family: var(--mono); font-size: 0.85rem; }

.post-search {
  max-width: var(--content-width);
  margin: 0 auto 18px;
}
.post-search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px rgba(0, 255, 65, 0.03);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.post-search-box:focus-within {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 1px rgba(0, 255, 65, 0.08), 0 0 24px rgba(0, 255, 65, 0.08);
}
.post-search-prompt {
  color: var(--green);
  font-family: var(--mono);
  text-shadow: var(--green-glow);
}
.post-search-input {
  flex: 1;
  min-width: 0;
  padding: 2px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.98rem;
}
.post-search-input::placeholder { color: var(--dim); }
.post-search-input::-webkit-search-cancel-button { -webkit-appearance: none; }
.post-search-kbd,
.post-search-meta kbd {
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-bottom-color: var(--border-strong);
  border-radius: 5px;
  background: rgba(0, 255, 65, 0.04);
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.75rem;
}
.post-search-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  transition: all 0.18s ease;
}
.post-search-clear:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(255, 92, 122, 0.08);
}
.post-search-clear[hidden] { display: none; }
.post-search-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 7px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.78rem;
}
.post-search-count { color: var(--green-bright); white-space: nowrap; }
.post-search-count:empty { display: none; }

.post-list {
  max-width: var(--content-width);
  margin: 0 auto;
  display: grid;
  gap: 14px;
}
.post-card {
  display: block;
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.post-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: 0 0 0 1px rgba(0,255,65,0.08), 0 16px 40px rgba(0,0,0,0.35);
  background: rgba(6, 18, 10, 0.82);
  text-shadow: none;
}
.post-date {
  font-family: var(--mono);
  color: var(--dim);
  font-size: 0.85rem;
  margin-bottom: 4px;
}
.post-card h3 {
  margin: 0 0 6px;
  font-size: 1.25rem;
  line-height: 1.35;
  color: #e8ffee;
  font-weight: 650;
}
.post-card p { margin: 0 0 10px; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--green-bright);
  border: 1px solid var(--border);
  background: rgba(0,255,65,0.06);
  padding: 2px 8px;
  border-radius: 999px;
}

.empty, .status {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 18px 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-family: var(--mono);
  background: rgba(0,255,65,0.03);
}
.status.error { border-color: rgba(255,92,122,0.4); color: #ffb3c1; }

/* Article / post page */
.article-wrap { max-width: var(--content-width); margin: 0 auto; }
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 0.9rem; color: var(--muted);
  margin-bottom: 16px; padding: 6px 10px; border-radius: 8px;
  border: 1px solid transparent;
}
.back-link:hover { color: var(--green-bright); border-color: var(--border); background: var(--green-soft); }

.article-header {
  margin-bottom: 26px;
  padding: 26px 26px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(0,255,65,0.05), rgba(0,255,65,0.015)), var(--panel);
}
.article-header .post-date { margin-bottom: 8px; font-size: 0.9rem; }
.article-header h1 {
  margin: 0 0 10px;
  font-size: clamp(1.7rem, 3.5vw, 2.3rem);
  line-height: 1.25;
  color: #effff3;
}
.article-header .desc { margin: 0 0 12px; color: var(--muted); font-size: 1.05rem; }

.prose {
  padding: 28px 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(4, 11, 7, 0.7);
  color: #d9eede;
  font-size: 1.05rem;
}
.prose > *:first-child { margin-top: 0; }
.prose > *:last-child { margin-bottom: 0; }
.prose h1, .prose h2, .prose h3, .prose h4 {
  color: #f0fff4;
  line-height: 1.3;
  margin: 1.6em 0 0.6em;
  font-weight: 650;
}
.prose h1 { font-size: 1.8rem; }
.prose h2 { font-size: 1.45rem; color: var(--green-bright); font-family: var(--mono); font-weight: 500; }
.prose h2::before { content: "## "; color: var(--dim); }
.prose h3 { font-size: 1.2rem; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.1em; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: 0.3em 0; }
.prose strong { color: #f4fff7; }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 2em 0; }
.prose blockquote {
  margin: 1.2em 0;
  padding: 0.2em 1em;
  border-left: 3px solid var(--green);
  color: var(--muted);
  background: rgba(0,255,65,0.04);
  border-radius: 0 8px 8px 0;
}
.prose a { text-decoration: underline; text-decoration-color: rgba(0,255,65,0.35); text-underline-offset: 3px; }
.prose img { max-width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--border); }
.prose code {
  font-family: var(--mono);
  font-size: 0.92em;
  color: #b7ffd0;
  background: rgba(0,255,65,0.08);
  border: 1px solid rgba(0,255,65,0.18);
  padding: 0.12em 0.4em;
  border-radius: 6px;
}
.prose pre {
  margin: 1.2em 0;
  padding: 16px 18px;
  overflow: auto;
  background: #020a05;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(0,255,65,0.03);
}
.prose pre code {
  background: none; border: none; padding: 0; color: #dfffe8; font-size: 0.9rem;
  line-height: 1.6; display: block;
}
.prose table { width: 100%; border-collapse: collapse; margin: 1.2em 0; font-size: 0.98rem; }
.prose th, .prose td { border: 1px solid var(--border); padding: 10px 12px; text-align: left; }
.prose th { color: var(--green-bright); background: rgba(0,255,65,0.06); font-family: var(--mono); font-weight: 500; }

/* Tables scroll inside their own box instead of stretching the page on small screens. */
.prose .table-scroll {
  margin: 1.2em 0;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-color: var(--border-strong) transparent;
}
.prose .table-scroll:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.prose .table-scroll table {
  width: 100%;
  min-width: 620px;
  margin: 0;
}

.site-footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 26px 20px 40px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.88rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.site-footer a { color: var(--muted); }

@media (max-width: 720px) {
  .nav-wrap { flex-direction: column; align-items: flex-start; padding: 12px 16px; }
  .brand { font-size: 0.92rem; white-space: normal; }
  main { padding: 22px 14px 50px; }
  .hero, .article-header, .prose, .post-card { padding-left: 16px; padding-right: 16px; }
  .section-head { flex-direction: column; align-items: flex-start; }
  .post-search-meta { flex-direction: column; gap: 2px; }
  .post-search-kbd { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
