/* ── Fonts ─────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,300;0,400;0,500;1,400&family=Spectral:ital,wght@0,400;0,600;1,400&display=swap');

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

/* ── Tokens ────────────────────────────────────── */
:root {
  --bg:         #0b0d0a;
  --bg-raised:  #111710;
  --fg:         #cde0ba;
  --fg-dim:     #84a070;
  --muted:      #4d6340;
  --green:      #5bff8f;
  --green-dim:  #2a7848;
  --green-glow: rgba(91, 255, 143, 0.12);
  --amber:      #f0aa45;
  --amber-dim:  rgba(240, 170, 69, 0.15);
  --border:     #192417;
  --max-w:      680px;
  --font-mono:  'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --font-serif: 'Spectral', Georgia, serif;
}

/* ── Base ──────────────────────────────────────── */
html {
  font-size: 18px;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-serif);
  line-height: 1.75;
  padding: 3rem 1.5rem;
  min-height: 100vh;
}

/* Scanline overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0, 0, 0, 0.045) 3px,
    rgba(0, 0, 0, 0.045) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

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

/* ── Header ────────────────────────────────────── */
.site-header {
  margin-bottom: 4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-title {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--green);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: text-shadow 0.2s;
}

.site-title::before {
  content: '~/';
  color: var(--muted);
}

.site-title:hover {
  text-shadow: 0 0 16px var(--green-glow), 0 0 32px var(--green-glow);
}

.site-nav {
  display: flex;
  gap: 0.25rem;
}

.site-nav a {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--fg-dim);
  text-decoration: none;
  padding: 0.2rem 0.6rem;
  border: 1px solid transparent;
  letter-spacing: 0.02em;
  transition: color 0.15s, border-color 0.15s;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--green);
  border-color: var(--green-dim);
}

/* ── Footer ────────────────────────────────────── */
.site-footer {
  margin-top: 5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  letter-spacing: 0.02em;
}

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

.site-footer a:hover {
  color: var(--fg-dim);
}

/* ── Section label ─────────────────────────────── */
.section-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 2rem;
  letter-spacing: 0.05em;
}

.section-label::before {
  content: '// ';
  color: var(--green-dim);
}

/* ── Tags ──────────────────────────────────────── */
.tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--fg-dim);
  border: 1px solid var(--border);
  padding: 0.05rem 0.45rem;
  letter-spacing: 0.03em;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  white-space: nowrap;
}

.tag::before {
  content: '#';
  color: var(--muted);
}

.tag:hover {
  color: var(--amber);
  border-color: var(--amber);
  background: var(--amber-dim);
}

.tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}

/* ── Post list ─────────────────────────────────── */
.post-list {
  list-style: none;
}

.post-list li {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0 1rem;
  margin-bottom: 1.75rem;
  align-items: start;
}

.post-list time {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  white-space: nowrap;
  padding-top: 0.25rem;
  letter-spacing: 0.02em;
}

.post-entry {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.post-entry a {
  color: var(--fg);
  text-decoration: none;
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.35;
  transition: color 0.15s;
}

.post-entry a:hover {
  color: var(--green);
}

/* ── Single article ────────────────────────────── */
article h1 {
  font-family: var(--font-serif);
  font-size: 1.65rem;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 0.5rem;
  color: var(--fg);
}

.post-meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 2.75rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  letter-spacing: 0.02em;
}

article h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 2.5rem 0 0.75rem;
  color: var(--fg);
}

article h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 2rem 0 0.5rem;
  color: var(--fg);
}

article p {
  margin-bottom: 1.4rem;
}

article a {
  color: var(--green);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--green-dim);
  transition: text-decoration-color 0.15s;
}

article a:hover {
  text-decoration-color: var(--green);
}

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

article li {
  margin-bottom: 0.3rem;
}

article blockquote {
  border-left: 2px solid var(--green-dim);
  padding-left: 1.25rem;
  color: var(--fg-dim);
  margin: 2rem 0;
  font-style: italic;
}

article code {
  background: var(--bg-raised);
  color: var(--green);
  padding: 0.1em 0.4em;
  border-radius: 2px;
  font-size: 0.8em;
  font-family: var(--font-mono);
  border: 1px solid var(--border);
}

article pre {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-left: 2px solid var(--green-dim);
  padding: 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.4rem;
  border-radius: 0 2px 2px 0;
}

article pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.8rem;
  color: var(--fg);
}

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

.post-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

/* ── Book review ───────────────────────────────── */
.book-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  border-left: 2px solid var(--green-dim);
  padding: 0.75rem 0 0.75rem 1rem;
  margin-bottom: 2.75rem;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.4rem 1.25rem;
  align-items: center;
}

.book-meta .meta-key {
  color: var(--muted);
  letter-spacing: 0.04em;
}

.book-meta .meta-val {
  color: var(--fg-dim);
}

.book-meta .meta-val.author {
  color: var(--fg);
  font-style: italic;
}

.rating-blocks {
  font-family: var(--font-mono);
  color: var(--amber);
  letter-spacing: 0.15em;
  font-size: 0.9em;
}

.rating-num {
  color: var(--muted);
  margin-left: 0.5rem;
  font-size: 0.85em;
}

/* ── Review list ───────────────────────────────── */
.review-list {
  list-style: none;
}

.review-list li {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0 1rem;
  margin-bottom: 2rem;
  align-items: start;
}

.review-list .review-date {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  white-space: nowrap;
  padding-top: 0.25rem;
  letter-spacing: 0.02em;
}

.review-entry {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.review-entry a {
  color: var(--fg);
  text-decoration: none;
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.35;
  transition: color 0.15s;
}

.review-entry a:hover {
  color: var(--green);
}

.review-entry .review-author {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--fg-dim);
  font-style: italic;
}

.review-entry .review-rating {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--amber);
  letter-spacing: 0.1em;
}

/* ── Homepage ──────────────────────────────────── */
.home-prompt {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.8;
  color: var(--fg-dim);
  margin-bottom: 3.5rem;
}

.prompt-line {
  display: block;
}

.prompt-line::before {
  content: '> ';
  color: var(--green);
}

.prompt-response {
  display: block;
  color: var(--fg-dim);
  padding-left: 1.25rem;
}

.cursor {
  display: inline-block;
  width: 0.5em;
  height: 1.1em;
  background: var(--green);
  vertical-align: text-bottom;
  margin-left: 1px;
  animation: blink 1.1s step-end infinite;
}

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

.home-sections {
  display: flex;
  flex-direction: column;
  gap: 3.5rem;
}

.home-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.home-section-head h2 {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.home-section-head h2::before {
  content: '// ';
  color: var(--green-dim);
}

.home-section-head .see-all {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: color 0.15s;
}

.home-section-head .see-all::after {
  content: ' →';
}

.home-section-head .see-all:hover {
  color: var(--green);
}

/* ── Responsive ────────────────────────────────── */
@media (max-width: 540px) {
  html { font-size: 16px; }
  body { padding: 2rem 1.1rem; }

  .post-list li,
  .review-list li {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .post-list time,
  .review-list .review-date {
    padding-top: 0;
  }

  .book-meta {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .book-meta .meta-key {
    display: none;
  }
}
