:root {
  --bg: #070506;
  --bg-elevated: #0f0c10;
  --bg-window: #120f14;
  --fg: #ffffff;
  --fg-dim: #c3cef2;
  --fg-mute: #836f79;
  --prose: #d9d8e2;
  --accent: #979fec;
  --accent-soft: #e4e6fb;
  --pink: #e095b5;
  --blue: #648ed0;
  --red: #b37580;
  --border: rgba(151, 159, 236, 0.22);
  --border-soft: rgba(151, 159, 236, 0.12);
  --mono: "JetBrains Mono", "Fira Code", "Cascadia Code", ui-monospace, Menlo, Consolas, monospace;
  --prose-font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 8px;
  --measure: 700px;
}

* { box-sizing: border-box; }

html, body {
  background: var(--bg);
  color: var(--fg);
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.015) 0px,
    rgba(255, 255, 255, 0.015) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: overlay;
}

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

.site-shell {
  max-width: 920px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

/* single-post pages get a narrower column — long mono-grid lines are
   harder to track than a normal reading measure */
.post-template .site-shell {
  max-width: var(--measure);
}

/* ---- header ---- */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 24px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border-soft);
}

.site-logo {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.site-logo:hover { text-decoration: none; }
.site-logo-mark { color: var(--accent); }
.site-logo-name { color: var(--fg); }
.site-logo:hover .site-logo-name { color: var(--pink); }

.site-nav ul {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 4px;
}
.site-nav a {
  display: inline-block;
  padding: 7px 14px;
  border-radius: 6px;
  color: var(--prose);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}
.site-nav a:hover {
  color: var(--fg);
  background: var(--bg-elevated);
  text-decoration: none;
}

/* ---- terminal window chrome ---- */
.term-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
}
.term-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.term-dot-1 { background: var(--red); }
.term-dot-2 { background: var(--pink); }
.term-dot-3 { background: var(--blue); }
.term-path {
  margin-left: 10px;
  font-size: 12px;
  color: var(--fg-mute);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- hero ---- */
.hero { margin-bottom: 40px; }
.hero-body {
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--bg-window);
  padding: 28px 24px;
}
.hero-title {
  margin: 0 0 10px;
  font-size: 28px;
  color: var(--fg);
  letter-spacing: -0.02em;
}
.hero-desc {
  margin: 0;
  color: var(--prose);
  font-family: var(--prose-font);
  font-size: 15.5px;
  line-height: 1.6;
  min-height: 1.6em;
}
.typewriter-cursor {
  display: inline-block;
  margin-left: 2px;
  color: var(--accent);
  font-family: var(--mono);
  animation: blink 1s steps(1) infinite;
}

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

/* ---- post grid / cards ---- */
.post-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.post-card { border-radius: var(--radius); }
.post-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.post-card-link:hover { text-decoration: none; }
.post-card-link:hover .post-card-body { border-color: var(--accent); }
.post-card-link:hover .post-card-title { color: var(--accent); }

.post-card-body {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-window);
  padding: 20px;
}
.post-card-image {
  position: relative;
  width: 100%;
  height: 175px;
  border-radius: 4px;
  margin-bottom: 14px;
  background-size: cover;
  background-position: center;
  border: 1px solid var(--border-soft);
  overflow: hidden;
}
.post-card-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.3;
  mix-blend-mode: overlay;
  pointer-events: none;
}
.post-card-title {
  margin: 0 0 8px;
  font-size: 17px;
  color: var(--fg);
}
.post-card-excerpt {
  margin: 0 0 14px;
  font-family: var(--prose-font);
  font-size: 14px;
  color: var(--prose);
  line-height: 1.6;
}
.post-card-meta {
  font-size: 12px;
  color: var(--fg-mute);
}
.post-card-tags { color: var(--pink); }

/* ---- single post ---- */
.post-window { margin-bottom: 20px; }
.post-header {
  border: 1px solid var(--border);
  border-top: none;
  background: var(--bg-window);
  padding: 28px 28px 16px;
}
.post-title {
  margin: 0 0 10px;
  font-size: 30px;
  line-height: 1.25;
  color: var(--fg);
}
.post-meta {
  font-size: 13px;
  color: var(--fg-mute);
}
.post-tags, .post-author { color: var(--pink); }

.post-feature-image {
  display: block;
  width: 100%;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

.post-content {
  border: 1px solid var(--border);
  border-top: none;
  background: var(--bg-window);
  padding: 8px 32px 36px;
  font-family: var(--prose-font);
  font-size: 18px;
  line-height: 1.75;
}
.post-content h2 {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 22px;
  font-weight: 600;
  margin-top: 44px;
  margin-bottom: 18px;
  padding-left: 14px;
  border-left: 3px solid var(--accent);
}
.post-content h3 {
  font-family: var(--mono);
  color: var(--blue);
  font-size: 18px;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 14px;
  padding-left: 14px;
  border-left: 3px solid var(--blue);
}
.post-content p {
  color: var(--prose);
  margin: 0 0 20px;
  max-width: 68ch;
}
.post-content strong { color: var(--fg); font-weight: 700; }
.post-content em { color: var(--fg-dim); }
.post-content a {
  color: var(--accent-soft);
  border-bottom: 1px solid var(--accent);
}
.post-content a:hover { color: var(--pink); border-color: var(--pink); }
.post-content code {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--pink);
  font-size: 0.9em;
}
.post-content pre {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
}
.post-content pre code { background: none; border: none; padding: 0; color: var(--fg-dim); }
.post-content img, .post-content figure img {
  max-width: 100%;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.post-content figure { margin: 24px 0; }
.post-content figcaption {
  font-size: 12.5px;
  color: var(--fg-mute);
  margin-top: 8px;
  text-align: center;
}
.kg-width-wide {
  max-width: 1040px;
  margin-left: calc(50% - 520px);
  margin-right: calc(50% - 520px);
}
.kg-width-full {
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}
@media (max-width: 1040px) {
  .kg-width-wide, .kg-width-full { margin-left: 0; margin-right: 0; }
}
.post-content ul, .post-content ol {
  color: var(--prose);
  max-width: 68ch;
  padding-left: 22px;
}
.post-content li { margin-bottom: 8px; }
.post-content blockquote {
  margin: 24px 0;
  padding: 4px 20px;
  border-left: 3px solid var(--pink);
  color: var(--prose);
  font-style: italic;
  max-width: 68ch;
}

.post-footer { margin-top: 20px; }
.back-link {
  display: block;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--bg-window);
  padding: 14px 18px;
  color: var(--accent);
  font-size: 14px;
}
.back-link-label { color: var(--fg-mute); margin-left: 6px; }

/* ---- footer ---- */
.site-footer { margin-top: 48px; }
.footer-text {
  font-size: 12.5px;
  color: var(--fg-mute);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--bg-window);
  padding: 14px 18px;
}
.footer-text a { color: var(--fg-dim); }

/* ---- pagination ---- */
.pagination {
  display: flex;
  justify-content: space-between;
  margin-top: 32px;
  font-size: 13px;
  color: var(--fg-dim);
}
.pagination a { color: var(--accent); }

/* ---- responsive ---- */
@media (max-width: 760px) {
  .post-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .site-shell { padding: 20px 14px 40px; }

  .site-header { gap: 10px 16px; padding-bottom: 18px; margin-bottom: 24px; }
  .site-logo { font-size: 16px; }
  .site-nav ul { flex-wrap: wrap; gap: 2px; }
  .site-nav a { padding: 6px 10px; font-size: 13px; }

  .term-bar { padding: 8px 12px; }
  .term-path { font-size: 11px; }

  .hero-body { padding: 20px 16px; }
  .hero-title { font-size: 22px; }
  .hero-desc { font-size: 14.5px; }

  .post-card-body { padding: 16px; }
  .post-card-image { height: 135px; }
  .post-card-title { font-size: 16px; }

  .post-header { padding: 20px 18px 14px; }
  .post-title { font-size: 23px; }

  .post-content { padding: 6px 18px 24px; font-size: 16.5px; line-height: 1.7; }
  .post-content h2 { font-size: 19px; margin-top: 34px; padding-left: 10px; }
  .post-content h3 { font-size: 16.5px; margin-top: 26px; padding-left: 10px; }
  .post-content pre { padding: 12px; }

  .back-link, .footer-text { padding: 12px 14px; }
}

@media (max-width: 380px) {
  .site-header { flex-direction: column; align-items: flex-start; }
  .site-nav ul { width: 100%; }
}
