/* Rasepi Blog — Dark-first theme aligned with marketing design system */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Design tokens ───────────────────────────────────────────── */
:root {
  --brand: #EF4444;
  --brand-light: #F87171;
  --brand-pale: rgba(239,68,68,0.10);
  --brand-glow: rgba(239,68,68,0.15);
  --font-body: "DM Sans", system-ui, sans-serif;
  --font-display: "DM Serif Display", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --r: 12px;
  --r-lg: 20px;
  --r-pill: 999px;
}

/* Dark theme (default) */
[data-theme="dark"] {
  --bg: #0C0E14;
  --bg-warm: #12141C;
  --surface: #181B25;
  --surface-hover: #1F2230;
  --border: #2A2D3A;
  --border-light: #22252F;
  --text: #E8E9ED;
  --text-secondary: #9CA3AF;
  --text-muted: #6B7280;
  --navy: #F1F2F5;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --nav-bg: rgba(12,14,20,0.92);
  --code-bg: #1a1d28;
}

/* Light theme */
[data-theme="light"] {
  --bg: #FAFAF8;
  --bg-warm: #F5F3EF;
  --surface: #FFFFFF;
  --surface-hover: #F7F7F5;
  --border: #E2E0DC;
  --border-light: #EEECE8;
  --text: #1A1A2E;
  --text-secondary: #4A5568;
  --text-muted: #94A3B8;
  --navy: #0F1B2D;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.1);
  --nav-bg: rgba(255,255,255,0.92);
  --code-bg: #F5F3EF;
}

/* System preference fallback (no explicit theme chosen) */
:root:not([data-theme]) {
  --bg: #FAFAF8;
  --bg-warm: #F5F3EF;
  --surface: #FFFFFF;
  --surface-hover: #F7F7F5;
  --border: #E2E0DC;
  --border-light: #EEECE8;
  --text: #1A1A2E;
  --text-secondary: #4A5568;
  --text-muted: #94A3B8;
  --navy: #0F1B2D;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.1);
  --nav-bg: rgba(255,255,255,0.92);
  --code-bg: #F5F3EF;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0C0E14;
    --bg-warm: #12141C;
    --surface: #181B25;
    --surface-hover: #1F2230;
    --border: #2A2D3A;
    --border-light: #22252F;
    --text: #E8E9ED;
    --text-secondary: #9CA3AF;
    --text-muted: #6B7280;
    --navy: #F1F2F5;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
    --nav-bg: rgba(12,14,20,0.92);
    --code-bg: #1a1d28;
    color-scheme: dark;
  }
}

html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  line-height: 1.6;
  transition: background .3s ease, color .3s ease;
}
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-body); font-weight: 600; font-size: 15px; border-radius: var(--r); padding: 12px 24px; cursor: pointer; transition: all .2s ease; white-space: nowrap; border: none; text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-light); transform: translateY(-1px); box-shadow: 0 4px 20px var(--brand-glow); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--brand); }

/* ── Nav ─────────────────────────────────────────────────────── */
.nav { position: fixed; top: 0; left: 0; z-index: 100; width: 100%; background: var(--nav-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid transparent; transition: border-color .3s ease, box-shadow .3s ease, background .3s ease; }
.nav--scrolled { border-bottom-color: var(--border); box-shadow: 0 1px 8px rgba(0,0,0,0.08); }
.nav-pill { display: flex; align-items: center; max-width: 1200px; margin: 0 auto; padding: 12px 24px; }
.logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo-img { height: 28px; width: auto; display: block; }
.nav-links { display: flex; align-items: center; gap: 4px; margin-left: 32px; list-style: none; }
.nav-links a { font-size: 14px; font-weight: 500; color: var(--text-secondary); padding: 8px 14px; border-radius: var(--r-pill); transition: all .15s; }
.nav-links a:hover, .nav-links a.active { color: var(--brand); background: var(--brand-pale); }
.nav-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-left: auto; }
.nav-actions .btn-primary { border-radius: var(--r-pill); padding: 9px 20px; font-size: 14px; }
.nav-hamburger { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 8px; z-index: 101; }
.nav-hamburger span { display: block; width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: transform .25s ease, opacity .2s ease, background .3s; }
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-social { display: flex; align-items: center; gap: 8px; margin-right: 6px; }
.nav-social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  transition: all .18s ease;
}
.nav-social-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-pale);
}

/* ── Theme Toggle ────────────────────────────────────────────── */
.theme-toggle { background: var(--surface); border: 1px solid var(--border); border-radius: 50%; width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer; transition: all .2s; color: var(--text-secondary); }
.theme-toggle:hover { border-color: var(--brand); color: var(--brand); }

[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }
/* No explicit theme: follow system preference for toggle icon */
:root:not([data-theme]) .icon-sun { display: none; }
:root:not([data-theme]) .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .icon-sun { display: block; }
  :root:not([data-theme]) .icon-moon { display: none; }
}

/* ── Blog Index ──────────────────────────────────────────────── */
.blog-hero { padding: 140px 0 60px; text-align: center; }
.blog-hero h1 { font-family: var(--font-display); font-size: clamp(36px,4.5vw,52px); color: var(--navy); margin-bottom: 12px; }
.blog-hero p { font-size: 18px; color: var(--text-secondary); max-width: 560px; margin: 0 auto; line-height: 1.7; }

.featured-post { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 24px; align-items: end; background: linear-gradient(145deg, var(--surface) 0%, var(--bg-warm) 100%); border: 1px solid var(--border); border-radius: 28px; padding: 36px; margin-bottom: 36px; position: relative; overflow: hidden; transition: border-color .2s, box-shadow .2s, transform .2s; }
.featured-post--has-image { grid-template-columns: minmax(0, 1fr) minmax(280px, 42%); align-items: center; }
.featured-post::before { content: ""; position: absolute; inset: auto -40px -60px auto; width: 220px; height: 220px; background: radial-gradient(circle, var(--brand-glow) 0%, transparent 70%); pointer-events: none; }
.featured-post:hover { border-color: var(--brand); box-shadow: 0 16px 40px var(--brand-glow); transform: translateY(-2px); }
.featured-post-copy { position: relative; z-index: 1; }
.featured-badge { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; letter-spacing: 1.6px; text-transform: uppercase; color: var(--brand); padding: 6px 12px; background: var(--brand-pale); border: 1px solid rgba(239,68,68,0.22); border-radius: var(--r-pill); margin-bottom: 14px; }
.featured-date { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 10px; }
.featured-post h2 { font-family: var(--font-display); font-size: clamp(28px, 3vw, 40px); line-height: 1.12; color: var(--navy); margin-bottom: 14px; max-width: 18ch; }
.featured-post p { font-size: 16px; color: var(--text-secondary); line-height: 1.75; max-width: 62ch; }
.featured-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border-light); }
.featured-post-aside { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; text-align: right; }
.featured-kicker { font-size: 12px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--text-muted); }
.featured-arrow { font-size: 16px; font-weight: 600; color: var(--brand); }

.blog-tags-bar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 48px; }
.tag { display: inline-block; font-size: 13px; font-weight: 600; padding: 5px 14px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--border); color: var(--text-secondary); transition: all .15s; }
.tag:hover, .tag--active { background: var(--brand-pale); border-color: rgba(239,68,68,0.3); color: var(--brand); }

/* ── Pillar Navigation ────────────────────────────────────────── */
.blog-pillars-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 48px; flex-wrap: wrap; }
.blog-pillars-bar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.blog-view-toggle { display: inline-flex; align-items: center; gap: 8px; }
.view-toggle-btn { cursor: pointer; }
.view-toggle-btn--active { background: var(--brand); border-color: var(--brand); color: #fff; }
.view-toggle-btn--active:hover { background: var(--brand-light); border-color: var(--brand-light); color: #fff; }
.pillar { display: inline-block; font-size: 15px; font-weight: 700; padding: 8px 22px; border-radius: var(--r-pill); background: var(--surface); border: 1.5px solid var(--border); color: var(--text-secondary); transition: all .2s; letter-spacing: 0.01em; }
.pillar:hover { background: var(--brand-pale); border-color: rgba(239,68,68,0.4); color: var(--brand); }
.pillar--active { background: var(--brand); border-color: var(--brand); color: #fff; }
.pillar--active:hover { background: var(--brand-light); border-color: var(--brand-light); color: #fff; }

/* ── Card Pillar Badge ────────────────────────────────────────── */
.card-pillar { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: var(--r-pill); background: var(--brand); color: #fff; letter-spacing: 0.02em; }

.posts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 24px; margin-bottom: 80px; }

.card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 32px; transition: border-color .2s, box-shadow .2s, transform .2s; text-decoration: none; }
.card:hover { border-color: var(--brand); box-shadow: 0 8px 32px var(--brand-glow); transform: translateY(-2px); }
.posts-grid .card-content { display: flex; flex-direction: column; flex: 1; }
.posts-grid .card-headline { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.card-date { font-size: 13px; color: var(--text-muted); margin-bottom: 0; }
.card h3 { font-family: var(--font-display); font-size: 20px; color: var(--navy); line-height: 1.25; margin-bottom: 0; }
.card p, .card-description { font-size: 14px; color: var(--text-secondary); line-height: 1.65; flex: 1; }
.card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border-light); }
.card-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.card-tag { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: var(--r-pill); background: var(--brand-pale); color: var(--brand); }
.card-read { font-size: 13px; color: var(--text-muted); }

.card-likes-badge { position: absolute; top: 12px; right: 12px; display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--brand); background: var(--brand-pale); padding: 4px 10px; border-radius: var(--r-pill); pointer-events: none; line-height: 1; }
.card-likes-badge svg { flex-shrink: 0; }

/* ── Post Page ───────────────────────────────────────────────── */
.blog-post { padding: 140px 0 80px; }
.post-container { max-width: 1200px; }

.post-back { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--brand); margin-bottom: 28px; transition: color .15s, gap .15s; }
.post-back:hover { color: var(--brand-light); gap: 10px; }

.post-header { margin-bottom: 48px; }
.post-meta { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-muted); margin-bottom: 16px; flex-wrap: wrap; }
.meta-sep { color: var(--border); }
.post-title { font-family: var(--font-display); font-size: clamp(32px,4vw,48px); color: var(--navy); line-height: 1.15; margin-bottom: 16px; }
.post-description { font-size: 18px; color: var(--text-secondary); line-height: 1.7; margin-bottom: 20px; }
.post-pillars { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.post-tags { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Prose (article body) ────────────────────────────────────── */
.prose { font-size: 17px; line-height: 1.8; color: var(--text-secondary); }
.prose h2 { font-family: var(--font-display); font-size: 28px; color: var(--navy); margin: 48px 0 16px; line-height: 1.2; }
.prose h3 { font-size: 20px; font-weight: 700; color: var(--navy); margin: 36px 0 12px; }
.prose p { margin-bottom: 20px; }
.prose a { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.prose a:hover { color: var(--brand-light); }
.prose strong { color: var(--navy); font-weight: 600; }
.prose ul, .prose ol { padding-left: 1.4em; margin-bottom: 20px; display: flex; flex-direction: column; gap: 8px; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { line-height: 1.7; }
.prose blockquote { border-left: 3px solid var(--brand); background: var(--brand-pale); border-radius: 0 var(--r) var(--r) 0; padding: 16px 20px; margin: 24px 0; font-size: 16px; color: var(--text-secondary); }
.prose blockquote strong { color: var(--navy); }
.prose code { font-family: var(--font-mono); font-size: 0.88em; background: var(--code-bg); padding: 2px 6px; border-radius: 4px; }
.prose pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--r); padding: 20px; overflow-x: auto; margin: 24px 0; }
.prose pre code { background: none; padding: 0; font-size: 14px; }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 40px 0; }
.prose img { max-width: 100%; border-radius: var(--r); margin: 24px 0; }

/* ── Author (sidebar) ────────────────────────────────────────── */
.sidebar-author { padding-bottom: 24px; margin-bottom: 24px; border-bottom: 1px solid var(--border); }
.sidebar-author-header { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.sidebar-author .author-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); flex-shrink: 0; }
.sidebar-author-header-text { display: flex; flex-direction: column; }
.sidebar-author .author-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); line-height: 1; }
.sidebar-author .author-name { font-family: var(--font-display); font-size: 17px; color: var(--navy); white-space: nowrap; line-height: 1.3; }
.sidebar-author .author-bio { font-size: 13px; color: var(--text-secondary); line-height: 1.55; margin: 0 0 10px; }
.sidebar-author .author-links { display: flex; gap: 14px; }
.author-link { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 500; color: var(--text-muted); text-decoration: none; transition: color .2s; }
.author-link:hover { color: var(--brand); }
.author-link svg { opacity: .7; transition: opacity .2s; }
.author-link:hover svg { opacity: 1; }
.post-meta-author { color: inherit; text-decoration: none; transition: color .2s; }
.post-meta-author:hover { color: var(--brand); }

/* ── Related Posts ───────────────────────────────────────────── */
.related-posts { margin-top: 64px; padding-top: 48px; border-top: 1px solid var(--border); }
.related-posts h2 { font-family: var(--font-display); font-size: 24px; color: var(--navy); margin-bottom: 24px; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.related-grid .card { padding: 24px; }
.related-grid .card h3 { font-size: 16px; }

/* ── Post CTA ────────────────────────────────────────────────── */
.post-cta { margin-top: 64px; }
.cta-inner { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 40px; text-align: center; }
.cta-inner h3 { font-family: var(--font-display); font-size: 24px; color: var(--navy); margin-bottom: 10px; }
.cta-inner p { font-size: 16px; color: var(--text-secondary); margin-bottom: 24px; line-height: 1.7; }

/* ── Subscribe ────────────────────────────────────────────────── */
.blog-subscribe, .post-subscribe { margin-top: 64px; }
.subscribe-inner { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 40px; text-align: center; }
.subscribe-inner h3 { font-family: var(--font-display); font-size: 24px; color: var(--navy); margin-bottom: 8px; }
.subscribe-inner > p { font-size: 15px; color: var(--text-secondary); margin-bottom: 24px; line-height: 1.65; }
.subscribe-form { display: flex; gap: 10px; max-width: 440px; margin: 0 auto; }
.subscribe-input { flex: 1; font-family: var(--font-body); font-size: 15px; padding: 12px 18px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r); color: var(--text); transition: border-color .2s; outline: none; }
.subscribe-input::placeholder { color: var(--text-muted); }
.subscribe-input:focus { border-color: var(--brand); }
.subscribe-btn { flex-shrink: 0; border-radius: var(--r); }
.subscribe-success { font-size: 14px; font-weight: 600; color: var(--brand); margin-top: 16px; }
.subscribe-error { font-size: 14px; font-weight: 500; color: #EF4444; margin-top: 16px; }
.subscribe-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Tag Page ────────────────────────────────────────────────── */
.tag-hero { padding: 140px 0 40px; text-align: center; }
.tag-hero h1 { font-family: var(--font-display); font-size: clamp(28px,3.5vw,40px); color: var(--navy); }
.tag-hero h1 span { color: var(--brand); }
.tag-hero p { font-size: 16px; color: var(--text-muted); margin-top: 8px; }
.tag-back { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--brand); margin-bottom: 20px; }
.tag-back:hover { text-decoration: underline; }

/* ── Pillar Page ─────────────────────────────────────────────── */
.pillar-hero { padding: 140px 0 40px; text-align: center; }
.pillar-hero h1 { font-family: var(--font-display); font-size: clamp(28px,3.5vw,40px); color: var(--navy); }
.pillar-subtitle { max-width: 620px; margin: 12px auto 0; font-size: 16px; line-height: 1.55; color: var(--text-muted); }
.pillar-back { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--brand); margin-bottom: 20px; }
.pillar-back:hover { text-decoration: underline; }

/* ── Footer ──────────────────────────────────────────────────── */
.footer { padding: 64px 0 0; border-top: 1px solid var(--border); transition: border-color .3s; }
.footer-inner { display: flex; gap: 80px; flex-wrap: wrap; padding-bottom: 48px; }
.footer-brand { max-width: 260px; }
.footer-brand p { font-size: 14px; color: var(--text-muted); line-height: 1.65; margin-top: 14px; }
.footer-links { display: flex; gap: 48px; flex-wrap: wrap; margin-left: auto; }
.footer-col h4 { font-size: 13px; font-weight: 700; color: var(--navy); letter-spacing: 0.5px; margin-bottom: 16px; text-transform: uppercase; transition: color .3s; }
.footer-col ul { display: flex; flex-direction: column; gap: 10px; }
.footer-col a { font-size: 14px; color: var(--text-muted); transition: color .15s; }
.footer-col a:hover { color: var(--brand); }
.footer-bottom { border-top: 1px solid var(--border); padding: 18px 0; font-size: 13px; color: var(--text-muted); transition: border-color .3s; }
.footer-bottom .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* ── Featured Post Image ──────────────────────────────────────── */
.featured-post-image { position: relative; z-index: 1; border-radius: var(--r-lg); overflow: hidden; background: var(--bg-warm); border: 1px solid var(--border-light); }
.featured-post-image img { display: block; width: 100%; height: auto; border-radius: var(--r-lg); }

/* ── Card Images ─────────────────────────────────────────────── */
.card-image { margin: -32px -32px 6px; overflow: hidden; border-radius: var(--r-lg) var(--r-lg) 0 0; background: var(--bg-warm); border-bottom: 1px solid var(--border-light); height: 200px; }
.card-image img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center top; }

/* Blog list mode toggle */
.posts-grid[data-view="list"] { grid-template-columns: 1fr; gap: 16px; }
.posts-grid[data-view="list"] .card { display: grid; grid-template-columns: 180px 1fr; align-items: stretch; padding: 0; border-radius: var(--r); overflow: hidden; }
.posts-grid[data-view="list"] .card:not(.card--has-image) { grid-template-columns: 1fr; }
.posts-grid[data-view="list"] .card-image { margin: 0; height: auto; min-height: 100%; border-radius: 0; border: 0; border-right: 1px solid var(--border-light); }
.posts-grid[data-view="list"] .card-content { padding: 14px 16px; }
.posts-grid[data-view="list"] .card-headline { width: 100%; flex-direction: row; align-items: baseline; justify-content: space-between; gap: 12px; min-width: 0; margin-bottom: 8px; }
.posts-grid[data-view="list"] .card-headline h3 { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.posts-grid[data-view="list"] .card-date { flex: 0 0 auto; }
.posts-grid[data-view="list"] .card-description { margin-top: 0; }
.posts-grid[data-view="list"] .card-footer { margin-top: 10px; padding-top: 0; border-top: 0; }
.posts-grid[data-view="list"] .card-read { display: none; }

/* ── Post Hero Image ─────────────────────────────────────────── */
.post-hero-image { margin-top: 28px; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--border); background: var(--bg-warm); }
.post-hero-image img { display: block; width: 100%; height: auto; }

/* ── Audio player ────────────────────────────────────────────── */
.audio-player[hidden] { display: none; }
.audio-player {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--brand-pale);
  border: 1px solid var(--brand);
  border-radius: var(--r-lg);
  padding: 12px 20px;
  margin-bottom: 24px;
  color: var(--brand);
}
.audio-player svg { flex-shrink: 0; }
.audio-label { font-family: var(--font-body); font-size: 14px; font-weight: 600; white-space: nowrap; }
.audio-player audio { flex: 1; min-width: 0; height: 36px; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 900px) {
  .featured-post, .featured-post--has-image { grid-template-columns: 1fr; padding: 28px; }
  .featured-post h2 { max-width: none; }
  .featured-post-aside { align-items: flex-start; text-align: left; }
  .featured-footer { flex-direction: column; align-items: flex-start; }
  .featured-post-image { order: -1; }
  .posts-grid { grid-template-columns: 1fr; }
  .blog-pillars-row { justify-content: center; }
  .blog-view-toggle { width: 100%; justify-content: center; }
  .nav-pill { gap: 10px; }
  .logo-img { height: 24px; }
  .nav-actions { gap: 6px; }
  .nav-social { gap: 6px; margin-right: 2px; }
  .nav-social-btn { font-size: 12px; padding: 6px 10px; }
}
@keyframes blogMenuIn { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 700px) {
  .blog-hero { padding: 120px 0 40px; }
  .blog-post { padding: 120px 0 60px; }
  .post-title { font-size: 28px; }
  .prose { font-size: 16px; }
  .posts-grid[data-view="list"] .card { grid-template-columns: 112px 1fr; }
  .posts-grid[data-view="list"] .card-headline { flex-direction: column; align-items: flex-start; gap: 4px; }
  .posts-grid[data-view="list"] .card-headline h3 { white-space: normal; }
  .footer-inner { flex-direction: column; gap: 40px; }
  .footer-links { margin-left: 0; }
  .nav-pill { padding: 10px 16px; }
  .nav-social { display: none; }
  .related-grid { grid-template-columns: 1fr; }
  .subscribe-form { flex-direction: column; }
  .subscribe-inner { padding: 28px 20px; }
}

/* ── Comments ────────────────────────────────────────────────── */
.post-comments, .sidebar-comments { margin-top: 0; padding-top: 0; border-top: none; }
.comments-heading { font-family: var(--font-display); font-size: 20px; color: var(--navy); margin-bottom: 20px; }

/* ── Post Layout (sidebar) ───────────────────────────────────── */
.post-layout { display: grid; grid-template-columns: 1fr; gap: 48px; }
@media (min-width: 1080px) {
  .post-layout { grid-template-columns: 1fr 340px; }
}
.post-main { min-width: 0; }
.post-sidebar { display: flex; flex-direction: column; gap: 32px; }
@media (min-width: 1080px) {
  .post-sidebar-inner { position: sticky; top: 100px; display: flex; flex-direction: column; gap: 32px; }
}

/* Sidebar subscribe */
.sidebar-subscribe { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 28px; }
.sidebar-subscribe h3 { font-family: var(--font-display); font-size: 20px; color: var(--navy); margin-bottom: 8px; }
.sidebar-subscribe > p { font-size: 14px; color: var(--text-secondary); margin-bottom: 16px; line-height: 1.6; }
.subscribe-form--sidebar { flex-direction: column; max-width: none; }
.subscribe-form--sidebar .subscribe-input { width: 100%; }
.subscribe-form--sidebar .subscribe-btn { width: 100%; justify-content: center; }

/* Sidebar comments */
.sidebar-comments { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 28px; }

/* ── Share bar ───────────────────────────────────────────────── */
.share-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.share-bar--top { margin-bottom: 32px; }
.share-bar--bottom { margin-top: 48px; margin-bottom: 48px; }
.share-buttons { display: flex; align-items: center; gap: 8px; }
.share-label { font-size: 13px; font-weight: 600; color: var(--text-muted); margin-right: 4px; }
.share-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); color: var(--text-secondary); cursor: pointer; transition: all .2s; }
.share-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-pale); }

/* ── Like button ─────────────────────────────────────────────── */
.like-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--border); color: var(--text-secondary); cursor: pointer; font-family: var(--font-body); font-size: 14px; font-weight: 600; transition: all .2s; }
.like-btn:hover { border-color: #EF4444; color: #EF4444; }
.like-btn.liked { border-color: #EF4444; color: #EF4444; background: rgba(239,68,68,0.08); }
.like-count { min-width: 12px; text-align: center; }

/* Login prompt */
.comment-login-prompt { display: flex; align-items: center; gap: 16px; padding: 20px 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); margin-bottom: 24px; }
.comment-login-prompt[hidden] { display: none; }
.comment-login-prompt p { font-size: 15px; color: var(--text-secondary); margin: 0; flex: 1; }
.comment-login-btn { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); color: var(--text); font-family: var(--font-body); font-weight: 600; font-size: 14px; padding: 10px 20px; border-radius: var(--r); cursor: pointer; transition: all .2s; white-space: nowrap; }
.comment-login-btn:hover { border-color: var(--brand); color: var(--brand); }

/* User bar + form */
.comment-form-wrapper { margin-bottom: 24px; }
.comment-user-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.comment-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--bg-warm); flex-shrink: 0; }
.comment-username { font-size: 14px; font-weight: 600; color: var(--text); }
.comment-logout-btn { font-size: 13px; color: var(--text-muted); margin-left: auto; background: none; border: none; cursor: pointer; font-family: var(--font-body); text-decoration: underline; text-underline-offset: 2px; }
.comment-logout-btn:hover { color: var(--brand); }

.comment-form textarea { width: 100%; font-family: var(--font-body); font-size: 15px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); color: var(--text); resize: vertical; min-height: 80px; outline: none; transition: border-color .2s; line-height: 1.6; }
.comment-form textarea::placeholder { color: var(--text-muted); }
.comment-form textarea:focus { border-color: var(--brand); }
.comment-form-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.comment-submit-btn { flex-shrink: 0; border-radius: var(--r); padding: 10px 20px; font-size: 14px; }
.comment-submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.comment-replying-to { font-size: 13px; color: var(--text-muted); }
.comment-replying-to strong { color: var(--text); }
.comment-error { font-size: 14px; color: #EF4444; margin-top: 8px; }

/* Comment list */
.comment-list { display: flex; flex-direction: column; gap: 0; }
.comment-empty, .comment-loading { font-size: 15px; color: var(--text-muted); text-align: center; padding: 24px 0; }

/* Individual comment */
.comment { padding: 20px 0; border-bottom: 1px solid var(--border-light); }
.comment:last-child { border-bottom: none; }
.comment-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.comment-meta-info { display: flex; flex-direction: column; gap: 1px; }
.comment-author { font-size: 14px; font-weight: 600; color: var(--text); }
.comment-time { font-size: 12px; color: var(--text-muted); }
.comment .comment-body { font-size: 15px; color: var(--text-secondary); line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.comment-actions { display: flex; gap: 12px; margin-top: 8px; }
.comment-actions .btn-link { font-size: 13px; color: var(--text-muted); background: none; border: none; cursor: pointer; font-family: var(--font-body); padding: 0; }
.comment-actions .btn-link:hover { color: var(--brand); }
.comment-delete-btn:hover { color: #EF4444 !important; }

/* Threaded replies */
.comment-replies { margin-left: 32px; padding-left: 16px; border-left: 2px solid var(--border-light); }
.comment-replies .comment { padding: 16px 0; }
.comment-replies .comment-avatar { width: 26px; height: 26px; }

/* Responsive */
@media (max-width: 700px) {
  .comment-login-prompt { flex-direction: column; align-items: stretch; text-align: center; }
  .comment-login-prompt .comment-login-btn { align-self: center; }
  .comment-replies { margin-left: 16px; padding-left: 12px; }
  .comment-form-actions { flex-direction: column; align-items: stretch; }
  .comment-submit-btn { width: 100%; }
  .share-bar { flex-direction: column; gap: 8px; }
}

/* Sidebar comment adjustments */
.sidebar-comments .comment-login-prompt { flex-direction: column; align-items: stretch; text-align: center; padding: 16px; }
.sidebar-comments .comment-login-prompt .comment-login-btn { align-self: center; }
.sidebar-comments .comment-form textarea { min-height: 60px; font-size: 14px; }
.sidebar-comments .comment-form-actions { flex-direction: column; align-items: stretch; }
.sidebar-comments .comment-submit-btn { width: 100%; font-size: 13px; }
.sidebar-comments .comment-replies { margin-left: 16px; padding-left: 12px; }
.sidebar-comments .comment .comment-body { font-size: 14px; }
.sidebar-comments .comment-author { font-size: 13px; }
.sidebar-comments .comment-time { font-size: 11px; }
.sidebar-comments .comment-avatar { width: 26px; height: 26px; }

/* ── Landing Page ────────────────────────────────────────────── */
.landing-hero {
  padding: 160px 0 80px;
  text-align: center;
  background-image:
    linear-gradient(135deg, rgba(12, 14, 20, 0.72) 0%, rgba(12, 14, 20, 0.78) 60%, rgba(12, 14, 20, 0.86) 100%),
    url('/blog/img/headbg_landing.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.landing-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 30% 50%, rgba(239, 68, 68, 0.05) 0%, transparent 60%),
              radial-gradient(circle at 70% 50%, rgba(239, 68, 68, 0.03) 0%, transparent 50%);
  pointer-events: none;
}

.landing-hero .container {
  position: relative;
  z-index: 1;
}

.hero-content h1 {
  font-family: var(--font-display);
  font-size: clamp(48px, 6vw, 72px);
  color: var(--navy);
  margin: 0 0 16px 0;
  line-height: 1.1;
}

.hero-subtitle {
  font-size: 20px;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 32px;
  line-height: 1.6;
}

.hero-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.hero-cta .btn-secondary {
  background: var(--surface);
  border: 1px solid var(--border);
}

.hero-cta .btn-secondary:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-pale);
}

/* Landing sections */
.landing-section {
  padding: 80px 0;
  border-bottom: 1px solid var(--border);
}

.landing-section h2 {
  font-family: var(--font-display);
  font-size: clamp(32px, 4vw, 48px);
  color: var(--navy);
  margin: 0 0 48px 0;
  line-height: 1.1;
}

.landing-section:last-child {
  border-bottom: none;
  padding-bottom: 100px;
}

/* Posts grid */
.landing-posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  margin-bottom: 48px;
}

.landing-post-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: all .2s ease;
  text-decoration: none;
}

.landing-post-card:hover {
  border-color: var(--brand);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  transform: translateY(-4px);
}

.landing-post-card.has-image .card-image {
  height: 160px;
  overflow: hidden;
}

.landing-post-card.has-image .card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s ease;
}

.landing-post-card:hover .card-image img {
  transform: scale(1.05);
}

.landing-post-card .card-content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 12px;
}

.landing-post-card .card-date {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.landing-post-card h3 {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--navy);
  line-height: 1.3;
  margin: 0;
}

.landing-post-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
  flex: 1;
}

/* Repos grid */
.landing-repos-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin-bottom: 48px;
}

.repo-card {
  display: block;
  background: #dce4de;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 14px;
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  text-decoration: none;
  min-height: 0;
}

.repo-card:hover {
  border-color: rgba(34, 197, 94, 0.4);
  box-shadow: 0 12px 34px rgba(11, 18, 32, 0.22);
  transform: translateY(-3px);
}

.repo-cover {
  min-height: 300px;
  height: auto;
  background: #f8fafc;
  border-bottom: 4px solid #22a351;
  position: relative;
}

.repo-cover-inner {
  position: relative;
  height: 100%;
  padding: 18px 20px 72px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: visible;
}

.repo-cover-head {
  display: flex;
  align-items: baseline;
  gap: 0;
  flex-wrap: nowrap;
  max-width: 70%;
}

.repo-cover-owner {
  font-family: var(--font-body);
  font-size: 26px;
  font-weight: 500;
  color: #2f3a46;
  line-height: 1;
}

.repo-cover-name {
  font-family: var(--font-body);
  font-size: 26px;
  font-weight: 800;
  color: #2f3a46;
  line-height: 1;
  margin-top: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.repo-cover-description {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.35;
  color: #6b7280;
  margin: 6px 0 0;
  max-width: 70%;
  overflow-wrap: anywhere;
  word-break: normal;
  display: block;
  overflow: visible;
}

.repo-cover-stats {
  position: absolute;
  left: 20px;
  bottom: 16px;
  display: flex;
  gap: 20px;
  align-items: flex-end;
}

.repo-cover-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.repo-cover-stat-value {
  color: #374151;
  font-family: var(--font-body);
  font-size: 19px;
  font-weight: 600;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.repo-cover-stat-label {
  color: #7a8697;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  text-transform: none;
  letter-spacing: 0;
}

.repo-cover-stat-icon {
  font-size: 18px;
  line-height: 1;
  opacity: 0.75;
}

.repo-cover-avatar {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 72px;
  height: 72px;
  border-radius: 16px;
  object-fit: cover;
  border: 1px solid rgba(15, 23, 42, 0.15);
}

.repo-cover-github {
  position: absolute;
  right: 18px;
  bottom: 16px;
  font-size: 32px;
  line-height: 1;
  opacity: 0.35;
}

.repos-placeholder {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

/* Section footer with link arrow */
.section-footer {
  margin-top: 24px;
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--brand);
  font-weight: 600;
  font-size: 15px;
  transition: all .2s ease;
}

.link-arrow:hover {
  gap: 12px;
  color: var(--brand-light);
}

/* Responsive */
@media (max-width: 768px) {
  .landing-hero {
    padding: 100px 0 60px;
  }

  .hero-cta {
    flex-direction: column;
    width: 100%;
  }

  .hero-cta .btn {
    width: 100%;
    justify-content: center;
  }

  .landing-section {
    padding: 60px 0;
  }

  .landing-section h2 {
    margin-bottom: 32px;
  }

  .landing-posts-grid,
  .landing-repos-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .repo-card {
    min-height: 0;
  }

  .repo-cover {
    height: 250px;
  }

  .repo-cover-inner {
    padding: 16px 16px 64px;
  }

  .repo-cover-head,
  .repo-cover-description {
    max-width: 72%;
  }

  .repo-cover-owner {
    font-size: 20px;
  }

  .repo-cover-name {
    font-size: 20px;
  }

  .repo-cover-description {
    font-size: 15px;
  }

  .repo-cover-avatar {
    width: 56px;
    height: 56px;
    border-radius: 12px;
  }

  .repo-cover-stats {
    left: 16px;
    bottom: 12px;
    gap: 14px;
    flex-wrap: wrap;
  }

  .repo-cover-stat-value {
    font-size: 16px;
  }

  .repo-cover-stat-label {
    font-size: 10px;
  }

  .repo-cover-stat-icon {
    font-size: 15px;
  }

  .repo-cover-github {
    font-size: 26px;
  }
}
