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

:root {
  --bg:         #0f1117;
  --bg-card:    #161b27;
  --bg-card2:   #1c2333;
  --border:     rgba(255,255,255,0.08);
  --fg:         #e2e8f0;
  --fg-muted:   #8b98b1;
  --blue:       #3b82f6;
  --blue-light: #60a5fa;
  --green:      #22c55e;
  --gradient:   linear-gradient(135deg, #3b82f6, #22c55e);
  --mono:       'JetBrains Mono', 'Fira Code', monospace;
  --sans:       'Inter', system-ui, -apple-system, sans-serif;
  --radius:     0.75rem;
  --shadow:     0 4px 32px rgba(0,0,0,0.5);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 10% 10%, rgba(59,130,246,0.07) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 90% 80%, rgba(34,197,94,0.06)  0%, transparent 60%);
}

/* ── Layout ── */
.site-wrapper { position: relative; z-index: 1; display: flex; flex-direction: column; min-height: 100vh; }
.site-main    { flex: 1; }
.container        { max-width: 1100px; margin: 0 auto; padding: 4rem 1.5rem 6rem; }
.container-narrow { max-width:  760px; margin: 0 auto; padding: 4rem 1.5rem 6rem; }

/* ── Nav ── */
.site-nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(15,17,23,0.9);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1100px; margin: 0 auto; padding: 0 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.nav-logo {
  font-size: 1.15rem; font-weight: 800; letter-spacing: -0.02em;
  text-decoration: none;
  background: var(--gradient);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.nav-links { display: flex; align-items: center; gap: 2rem; }
.nav-links a {
  color: var(--fg-muted); text-decoration: none;
  font-size: 0.9rem; font-weight: 500;
  position: relative; padding-bottom: 3px; transition: color .2s;
}
.nav-links a::after {
  content: ''; position: absolute; bottom: 0; left: 0;
  width: 0; height: 2px; background: var(--gradient);
  border-radius: 2px; transition: width .25s;
}
.nav-links a:hover { color: var(--fg); }
.nav-links a:hover::after,
.nav-links a.active::after { width: 100%; }
.nav-links a.active { color: var(--fg); }

/* ── Page header ── */
.page-header { margin-bottom: 3rem; }
.page-header h1 {
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 800; line-height: 1.1; letter-spacing: -0.03em; margin-bottom: 0.6rem;
}
.page-header h1 span {
  background: var(--gradient);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.page-header p { color: var(--fg-muted); font-size: 1.05rem; }

/* ── Post cards ── */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
}

.post-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
  text-decoration: none; color: inherit;
  position: relative;
  transition: transform .25s, box-shadow .25s, border-color .25s;
}
.post-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--gradient); transform: scaleX(0); transform-origin: left;
  transition: transform .3s; z-index: 1;
}
.post-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: rgba(59,130,246,0.3); }
.post-card:hover::before { transform: scaleX(1); }

/* Cover image */
.post-card__cover {
  width: 100%; aspect-ratio: 16/9;
  object-fit: cover; display: block;
  background: var(--bg-card2);
}

.post-card__body { padding: 1.5rem; display: flex; flex-direction: column; flex: 1; }

.post-card__date {
  font-family: var(--mono); font-size: 0.75rem; color: var(--fg-muted);
  margin-bottom: 0.65rem; display: flex; align-items: center; gap: 0.4rem;
}
.post-card__date::before {
  content: ''; display: inline-block; width: 6px; height: 6px;
  background: var(--gradient); border-radius: 50%; flex-shrink: 0;
}
.post-card__title { font-size: 1.1rem; font-weight: 700; line-height: 1.35; margin-bottom: 0.6rem; }
.post-card__excerpt {
  font-size: 0.875rem; color: var(--fg-muted);
  line-height: 1.65; flex: 1; margin-bottom: 1.25rem;
}
.post-card__footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: auto; gap: 0.75rem;
}

/* ── Tags & categories ── */
.tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tag {
  font-size: 0.7rem; font-weight: 600; padding: 0.2rem 0.55rem;
  border-radius: 999px; background: rgba(59,130,246,0.1);
  color: var(--blue-light); border: 1px solid rgba(59,130,246,0.2);
  text-decoration: none; transition: background .2s;
}
a.tag:hover { background: rgba(59,130,246,0.2); }

.cat {
  font-size: 0.7rem; font-weight: 600; padding: 0.2rem 0.55rem;
  border-radius: 999px; background: rgba(34,197,94,0.1);
  color: #4ade80; border: 1px solid rgba(34,197,94,0.2);
  text-decoration: none; transition: background .2s;
}
a.cat:hover { background: rgba(34,197,94,0.2); }

.read-more {
  font-size: 0.8rem; color: var(--blue); font-weight: 600;
  display: flex; align-items: center; gap: 0.3rem; white-space: nowrap;
}
.read-more svg { transition: transform .2s; }
.post-card:hover .read-more svg { transform: translateX(4px); }

/* ── Post page ── */
.back-link {
  display: inline-flex; align-items: center; gap: 0.45rem;
  color: var(--fg-muted); text-decoration: none; font-size: 0.875rem;
  font-weight: 500; margin-bottom: 2.5rem; transition: color .2s;
}
.back-link:hover { color: var(--fg); }
.back-link:hover svg { transform: translateX(-4px); }
.back-link svg { transition: transform .2s; }

.post-hero__cover {
  width: 100%; max-height: 420px; object-fit: cover;
  border-radius: var(--radius); display: block; margin-bottom: 2rem;
}

.post-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800; line-height: 1.2; letter-spacing: -0.03em; margin-bottom: 1rem;
}
.post-meta {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 0.75rem; margin-bottom: 1rem;
}
.post-date { font-family: var(--mono); font-size: 0.82rem; color: var(--fg-muted); }
.post-description { color: var(--fg-muted); font-size: 1.05rem; margin-bottom: 1.5rem; }
.post-divider { border: none; border-top: 1px solid var(--border); margin-bottom: 2.75rem; }

/* ── Prose ── */
.prose { font-size: 1rem; line-height: 1.8; }
.prose h2 {
  font-size: 1.45rem; font-weight: 700; letter-spacing: -0.02em;
  margin: 2.75rem 0 0.9rem; padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.prose h3 { font-size: 1.15rem; font-weight: 600; margin: 2rem 0 0.5rem; }
.prose h4 { font-size: 1rem;    font-weight: 600; margin: 1.5rem 0 0.4rem; }
.prose p  { margin-bottom: 1.3rem; }
.prose a  { color: var(--blue-light); text-decoration: underline; text-underline-offset: 3px; }
.prose a:hover { color: var(--blue); }
.prose ul, .prose ol { margin: 0.5rem 0 1.3rem 1.5rem; }
.prose li { margin-bottom: 0.4rem; }
.prose li::marker { color: var(--blue); }
.prose strong { color: #f1f5f9; font-weight: 700; }
.prose em { font-style: italic; color: #cbd5e1; }
.prose blockquote {
  border-left: 3px solid var(--blue); padding: 0.5rem 0 0.5rem 1.25rem;
  margin: 1.75rem 0; color: var(--fg-muted); font-style: italic;
}
.prose hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }
.prose img { max-width: 100%; border-radius: var(--radius); margin: 1.75rem auto; display: block; }
.prose table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; font-size: 0.9rem; }
.prose th { background: var(--bg-card2); padding: 0.6rem 1rem; text-align: left; font-weight: 600; border-bottom: 1px solid var(--border); }
.prose td { padding: 0.6rem 1rem; border-bottom: 1px solid var(--border); }
.prose code {
  font-family: var(--mono); font-size: 0.875em;
  background: rgba(255,255,255,0.07); border: 1px solid var(--border);
  border-radius: 0.3rem; padding: 0.15em 0.45em;
}
.prose pre {
  background: #0d1117; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.4rem 1.5rem;
  overflow-x: auto; margin: 1.75rem 0;
}
.prose pre code { background: transparent; border: none; padding: 0; font-size: 0.875rem; line-height: 1.7; }

/* ── Taxonomy pages ── */
.taxonomy-grid { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }
.taxonomy-item {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.4rem 0.9rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg-card);
  color: var(--fg-muted); text-decoration: none; font-size: 0.875rem;
  font-weight: 500; transition: color .2s, border-color .2s, background .2s;
}
.taxonomy-item:hover { color: var(--fg); border-color: rgba(59,130,246,0.4); background: var(--bg-card2); }
.taxonomy-item__count {
  font-family: var(--mono); font-size: 0.72rem;
  background: rgba(59,130,246,0.15); color: var(--blue-light);
  padding: 0.1rem 0.4rem; border-radius: 999px;
}

/* ── Pagination ── */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 1rem; margin-top: 3rem; flex-wrap: wrap;
}
.pagination a {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 1.1rem; border-radius: 0.5rem;
  border: 1px solid var(--border); background: var(--bg-card);
  color: var(--fg-muted); text-decoration: none; font-size: 0.875rem;
  font-weight: 500; transition: color .2s, border-color .2s, background .2s;
}
.pagination a:hover { color: var(--fg); border-color: rgba(59,130,246,0.4); background: var(--bg-card2); }
.pagination__info { color: var(--fg-muted); font-size: 0.875rem; font-family: var(--mono); }

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem; text-align: center;
  color: var(--fg-muted); font-size: 0.875rem;
}
.site-footer a {
  background: var(--gradient);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; text-decoration: none; font-weight: 700;
}

/* ── 404 ── */
.error-page { text-align: center; padding: 6rem 1rem; }
.error-page h1 {
  font-size: 6rem; font-weight: 800; line-height: 1;
  background: var(--gradient);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  margin-bottom: 1rem;
}
.error-page p { color: var(--fg-muted); font-size: 1.1rem; margin-bottom: 2rem; }
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.6rem 1.4rem; border-radius: 0.5rem;
  background: var(--blue); color: #fff; text-decoration: none;
  font-weight: 600; font-size: 0.9rem; transition: background .2s;
}
.btn:hover { background: var(--blue-light); }

/* ── Responsive ── */
@media (max-width: 768px) { .posts-grid { grid-template-columns: 1fr; } }
@media (max-width: 480px) {
  .nav-links { gap: 1.25rem; }
  .container, .container-narrow { padding: 2.5rem 1rem 4rem; }
}
