/* ── Design tokens (mirrors website/src/styles/theme.css) ─────────────────── */
:root {
  --bg: #0a0a0f;
  --bg-card: #13131a;
  --bg-secondary: #1a1a24;
  --fg: #ffffff;
  --fg-muted: #6b7280;
  --cyan: #4eceea;       /* brand accent */
  --indigo: #6366f1;     /* primary / CTA */
  --border: rgba(255, 255, 255, 0.1);
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --header-height: 64px;
  --container-max: 1280px;
  --container-px: clamp(1.5rem, 5vw, 2rem);
}

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

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

body {
  background-color: var(--bg);
  color: var(--fg);
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 400;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }

/* ── Utility ──────────────────────────────────────────────────────────────── */
.container {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-px);
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  height: var(--header-height);
  background: rgba(10, 10, 15, 0.8);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.site-logo img {
  border-radius: var(--radius-sm);
}

.site-logo-text {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--cyan);
}

.site-nav { display: flex; align-items: center; }

.nav-list {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-link {
  font-size: 0.875rem;
  color: var(--fg-muted);
  transition: color 0.15s ease;
}
.nav-link:hover,
.nav-link.active { color: var(--cyan); }

/* Mobile toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.nav-toggle-bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--fg);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 767px) {
  .nav-toggle { display: flex; }

  .site-nav {
    position: absolute;
    top: var(--header-height);
    left: 0; right: 0;
    background: rgba(10, 10, 15, 0.96);
    border-bottom: 1px solid var(--border);
    padding: 1rem var(--container-px) 1.5rem;
    display: none;
  }
  .site-nav.is-open { display: flex; }

  .nav-list {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    gap: 0.75rem;
  }
}

/* ── Main content offset ──────────────────────────────────────────────────── */
.site-main {
  padding-top: var(--header-height);
}

/* ── Blog index ───────────────────────────────────────────────────────────── */
.blog-index {
  padding-block: 4rem 5rem;
}

.blog-index-header {
  text-align: center;
  margin-bottom: 3rem;
}

.blog-index-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
}

.blog-index-subtitle {
  color: var(--fg-muted);
  font-size: 1.125rem;
  max-width: 520px;
  margin-inline: auto;
}

/* Tag filter row */
.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 2.5rem;
}

.tag-filter-link {
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.375rem 0.875rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  transition: color 0.15s ease, border-color 0.15s ease;
}
.tag-filter-link:hover,
.tag-filter-link.active {
  color: var(--cyan);
  border-color: var(--cyan);
}

/* Post grid */
.post-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 640px) {
  .post-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .post-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ── Post card ────────────────────────────────────────────────────────────── */
.post-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.post-card:hover {
  border-color: rgba(78, 206, 234, 0.4);
  transform: translateY(-2px);
}

.post-card-image-link { display: block; overflow: hidden; }
.post-card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.post-card:hover .post-card-image { transform: scale(1.03); }

.post-card-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 1.25rem;
  gap: 0.5rem;
}

.post-card-tag {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--indigo);
}
.post-card-tag:hover { color: var(--cyan); }

.post-card-title {
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.01em;
}
.post-card-title a { transition: color 0.15s ease; }
.post-card-title a:hover { color: var(--cyan); }

.post-card-excerpt {
  font-size: 0.875rem;
  color: var(--fg-muted);
  line-height: 1.55;
  flex: 1;
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  color: var(--fg-muted);
  margin-top: 0.5rem;
}
.post-card-sep { opacity: 0.4; }

/* ── Pagination ───────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 3rem;
}
.pagination a {
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  transition: color 0.15s ease, border-color 0.15s ease;
}
.pagination a:hover {
  color: var(--cyan);
  border-color: var(--cyan);
}
.pagination .page-number { color: var(--fg-muted); font-size: 0.875rem; }

/* ── Single post ──────────────────────────────────────────────────────────── */
.post-article {
  padding-block: 4rem 5rem;
}

.post-header {
  max-width: 720px;
  margin-inline: auto;
  margin-bottom: 2.5rem;
  text-align: center;
}

.post-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--indigo);
  margin-bottom: 1rem;
  transition: color 0.15s ease;
}
.post-tag:hover { color: var(--cyan); }

.post-title {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.post-subtitle {
  font-size: 1.125rem;
  color: var(--fg-muted);
  line-height: 1.55;
  margin-bottom: 1.25rem;
}

.post-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.875rem;
  color: var(--fg-muted);
}
.post-meta-sep { opacity: 0.4; }

.post-feature-image {
  max-width: 960px;
  margin-inline: auto;
  margin-bottom: 3rem;
  border-radius: var(--radius-xl);
  overflow: hidden;
}
.post-feature-image img {
  width: 100%;
  max-height: 520px;
  object-fit: cover;
}
.post-feature-image figcaption {
  font-size: 0.8125rem;
  color: var(--fg-muted);
  text-align: center;
  padding: 0.75rem;
}

/* ── Koenig editor width classes ─────────────────────────────────────────── */
.kg-width-wide {
  margin-inline: calc(50% - 45vw);
  width: 90vw;
  max-width: 1200px;
}

.kg-width-full {
  margin-inline: calc(50% - 50vw);
  width: 100vw;
}

/* ── Post prose content ───────────────────────────────────────────────────── */
.post-content {
  max-width: 720px;
  margin-inline: auto;
}

.gh-content > * + * { margin-top: 1.5em; }

.gh-content h1,
.gh-content h2,
.gh-content h3,
.gh-content h4 {
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-top: 2.5em;
  margin-bottom: 0.75em;
}
.gh-content h1 { font-size: 1.875rem; }
.gh-content h2 { font-size: 1.5rem; }
.gh-content h3 { font-size: 1.25rem; }
.gh-content h4 { font-size: 1.0625rem; }

.gh-content p { color: rgba(255,255,255,0.87); line-height: 1.75; }

.gh-content a { color: var(--cyan); text-decoration: underline; text-underline-offset: 3px; }
.gh-content a:hover { opacity: 0.85; }

.gh-content ul, .gh-content ol {
  padding-left: 1.5rem;
}
.gh-content ul { list-style: disc; }
.gh-content ol { list-style: decimal; }
.gh-content li { color: rgba(255,255,255,0.87); line-height: 1.75; margin-bottom: 0.375em; }

.gh-content blockquote {
  border-left: 3px solid var(--indigo);
  padding: 0.75rem 1.25rem;
  background: var(--bg-card);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--fg-muted);
  font-style: italic;
}

.gh-content pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.6;
}
.gh-content code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.875em;
  background: var(--bg-secondary);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: var(--cyan);
}
.gh-content pre code {
  background: none;
  padding: 0;
  color: rgba(255,255,255,0.85);
}

.gh-content img {
  border-radius: var(--radius-lg);
  margin-inline: auto;
}

.gh-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin-block: 2.5rem;
}

/* Post footer */
.post-footer {
  max-width: 720px;
  margin-inline: auto;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.post-footer-tag {
  font-size: 0.8125rem;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  transition: color 0.15s ease, border-color 0.15s ease;
}
.post-footer-tag:hover {
  color: var(--cyan);
  border-color: var(--cyan);
}

.back-to-blog {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fg-muted);
  transition: color 0.15s ease;
}
.back-to-blog:hover { color: var(--cyan); }

/* ── Tag archive ──────────────────────────────────────────────────────────── */
.tag-post-count {
  font-size: 0.875rem;
  color: var(--fg-muted);
  margin-top: 0.5rem;
}

/* ── Footer ───────────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 3rem;
  margin-top: 2rem;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  text-align: center;
}

.footer-description {
  font-size: 0.875rem;
  color: var(--fg-muted);
  margin-top: 0.5rem;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
}

.footer-link {
  font-size: 0.875rem;
  color: var(--fg-muted);
  transition: color 0.15s ease;
}
.footer-link:hover { color: var(--cyan); }

.footer-copy {
  font-size: 0.8125rem;
  color: var(--fg-muted);
  opacity: 0.6;
}
