/* ==========================================================================
   AppHub Blog — shares the landing page's design language (Space Grotesk +
   DM Sans, zinc neutrals, #e94560 accent, light/dark themes). The landing
   page keeps its own inline CSS; this file is the self-contained stylesheet
   for the generated /blog/ pages so index.html is never touched by the build.
   ========================================================================== */

/* === Reset === */
*{margin:0;padding:0;box-sizing:border-box}

/* === Theme — Zinc-based neutrals (mirrors index.html) === */
:root, [data-theme="light"] {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-alt: #f4f4f5;
  --text: #18181b;
  --text-secondary: #3f3f46;
  --muted: #71717a;
  --accent: #e94560;
  --accent-hover: #d63b56;
  --accent-light: #ff6b81;
  --accent-subtle: rgba(233,69,96,.04);
  --accent-glow: rgba(233,69,96,.12);
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --grid-line: rgba(0,0,0,.035);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.03);
  --shadow-md: 0 4px 24px rgba(0,0,0,.06);
  --shadow-lg: 0 16px 48px rgba(0,0,0,.08);
  --nav-bg: rgba(250,250,250,.82);
  --code-bg: #f4f4f5;
  --radius: 12px;
  --radius-sm: 8px;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #09090b;
  --surface: #18181b;
  --surface-alt: #27272a;
  --text: #fafafa;
  --text-secondary: #a1a1aa;
  --muted: #71717a;
  --accent: #f06480;
  --accent-hover: #ff7a96;
  --accent-light: #ff8fa3;
  --accent-subtle: rgba(240,100,128,.06);
  --accent-glow: rgba(240,100,128,.18);
  --border: #27272a;
  --border-strong: #3f3f46;
  --grid-line: rgba(255,255,255,.025);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.2);
  --shadow-md: 0 4px 24px rgba(0,0,0,.3);
  --shadow-lg: 0 16px 48px rgba(0,0,0,.4);
  --nav-bg: rgba(9,9,11,.82);
  --code-bg: #27272a;
  color-scheme: dark;
}
html.themed body,
html.themed .nav,
html.themed .post-card,
html.themed footer { transition: background-color .35s ease, border-color .35s ease, color .2s ease, box-shadow .35s ease; }

/* === Base === */
html { scroll-behavior: smooth }
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
h1,h2,h3,h4 { font-family: 'Space Grotesk', sans-serif; font-weight: 700; letter-spacing: -.03em }
a { color: var(--accent); text-decoration: none }
a:hover { text-decoration: underline }
body::before {
  content: ''; position: fixed; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-light)); z-index: 1001;
}

/* === Nav (mirrors landing page) === */
.nav {
  position: fixed; top: 2px; left: 0; right: 0; z-index: 100;
  padding: 0 40px; height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--nav-bg);
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  border-bottom: 1px solid var(--border);
}
.nav-logo { display: flex; align-items: center; gap: 10px; text-decoration: none }
.nav-logo-img { height: 28px; width: auto; display: block }
[data-theme="dark"] .nav-logo-img { filter: invert(1) }
.nav-links { display: flex; gap: 32px; align-items: center }
.nav-links a { color: var(--muted); font-size: 14px; font-weight: 500; text-decoration: none; transition: color .2s }
.nav-links a:hover, .nav-links a.active { color: var(--text); text-decoration: none }
.nav-actions { display: flex; align-items: center; gap: 12px }
.nav-login { color: var(--text-secondary); font-size: 14px; font-weight: 500; text-decoration: none; transition: color .2s }
.nav-login:hover { color: var(--text); text-decoration: none }
.nav-cta {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff; padding: 8px 22px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 14px; border: none; cursor: pointer;
  transition: box-shadow .25s, transform .15s; text-decoration: none; display: inline-block;
}
.nav-cta:hover { box-shadow: 0 0 24px var(--accent-glow); transform: translateY(-1px); text-decoration: none; color: #fff }

/* === Theme toggle === */
.theme-toggle {
  background: var(--surface-alt); border: 1px solid var(--border); border-radius: 50%;
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .2s, border-color .2s;
}
.theme-toggle:hover { background: var(--border); border-color: var(--border-strong) }
.theme-toggle svg { width: 16px; height: 16px; stroke: var(--text); stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round }
[data-theme="light"] .moon-icon { display: none }
[data-theme="dark"] .sun-icon { display: none }

/* === Mobile === */
.hamburger { display: none; background: none; border: none; cursor: pointer; padding: 4px }
.hamburger svg { width: 22px; height: 22px; stroke: var(--text); stroke-width: 2; fill: none }
.mobile-menu {
  display: none; position: fixed; inset: 0; background: var(--bg); z-index: 200;
  flex-direction: column; align-items: center; justify-content: center; gap: 28px;
  opacity: 0; transition: opacity .3s ease;
}
.mobile-menu.open { display: flex; opacity: 1 }
.mobile-menu a { color: var(--text); font-size: 18px; font-weight: 500; text-decoration: none }
.mobile-menu .close-btn { position: absolute; top: 20px; right: 24px; background: none; border: none; cursor: pointer }
.mobile-menu .close-btn svg { width: 24px; height: 24px; stroke: var(--text); stroke-width: 2; fill: none }

/* === Buttons === */
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff; padding: 14px 32px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 15px; border: none; cursor: pointer;
  transition: box-shadow .3s cubic-bezier(.16,1,.3,1), transform .2s;
  display: inline-block; text-decoration: none;
}
.btn-primary:hover { box-shadow: 0 0 32px var(--accent-glow); transform: translateY(-1px); text-decoration: none; color: #fff }
.btn-secondary {
  background: transparent; color: var(--text); padding: 14px 32px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 15px; border: 1px solid var(--border); cursor: pointer;
  transition: border-color .2s, background .2s; display: inline-block; text-decoration: none;
}
.btn-secondary:hover { border-color: var(--border-strong); background: var(--surface); text-decoration: none }

/* === Reveal === */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s cubic-bezier(.16,1,.3,1), transform .8s cubic-bezier(.16,1,.3,1) }
.reveal.visible { opacity: 1; transform: none }
.reveal-d1 { transition-delay: .06s } .reveal-d2 { transition-delay: .12s }
.reveal-d3 { transition-delay: .18s } .reveal-d4 { transition-delay: .24s }

/* === Shared shells === */
.section-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .14em; color: var(--accent); margin-bottom: 16px }
.tag {
  display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--accent);
  background: var(--accent-subtle); border: 1px solid var(--accent-glow);
  padding: 3px 10px; border-radius: 100px; text-decoration: none;
}
a.tag:hover { text-decoration: none; border-color: var(--accent) }

/* === Blog header === */
.blog-hero-wrapper { position: relative; overflow: hidden; border-bottom: 1px solid var(--border) }
.blog-hero-grid {
  position: absolute; inset: 0;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(ellipse 70% 80% at 50% 0%, black 20%, transparent 100%);
  mask-image: radial-gradient(ellipse 70% 80% at 50% 0%, black 20%, transparent 100%);
}
.blog-hero { position: relative; z-index: 1; max-width: 1120px; margin: 0 auto; padding: 150px 40px 64px; text-align: center }
.blog-hero h1 { font-size: clamp(34px, 5vw, 56px); line-height: 1.1; margin-bottom: 18px }
.blog-hero .gradient-text { background: linear-gradient(135deg, var(--accent), var(--accent-light)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text }
.blog-hero p { color: var(--muted); font-size: 18px; line-height: 1.7; max-width: 560px; margin: 0 auto }

/* === Post grid === */
.blog-main { max-width: 1120px; margin: 0 auto; padding: 64px 40px 100px }
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px }
.post-card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm); text-decoration: none; color: inherit;
  transition: border-color .3s, transform .3s cubic-bezier(.16,1,.3,1), box-shadow .3s;
}
.post-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; z-index: 2;
  background: linear-gradient(90deg, var(--accent), var(--accent-light)); opacity: 0; transition: opacity .3s;
}
.post-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow-md); text-decoration: none }
.post-card:hover::before { opacity: 1 }
.post-card-media { aspect-ratio: 16 / 9; background: var(--surface-alt); overflow: hidden; border-bottom: 1px solid var(--border) }
.post-card-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s cubic-bezier(.16,1,.3,1) }
.post-card:hover .post-card-media img { transform: scale(1.04) }
.post-card-media.placeholder {
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 120% at 0% 0%, var(--accent-subtle), transparent 60%), var(--surface-alt);
}
.post-card-media.placeholder span { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 40px; color: var(--accent); opacity: .35 }
.post-card-body { padding: 22px 22px 24px; display: flex; flex-direction: column; flex: 1 }
.post-card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px }
.post-card h2 { font-size: 19px; line-height: 1.3; margin-bottom: 10px; letter-spacing: -.02em }
.post-card p { font-size: 14.5px; color: var(--muted); line-height: 1.6; flex: 1 }
.post-card-meta { display: flex; align-items: center; gap: 8px; margin-top: 18px; font-size: 13px; color: var(--muted) }
.post-card-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--border-strong) }

/* Featured (first) post spans the full width on wide screens */
.post-card.featured { grid-column: 1 / -1; flex-direction: row }
.post-card.featured .post-card-media { aspect-ratio: auto; width: 52%; border-bottom: none; border-right: 1px solid var(--border) }
.post-card.featured .post-card-body { padding: 40px 40px 40px; justify-content: center }
.post-card.featured h2 { font-size: clamp(22px, 2.6vw, 30px); margin-bottom: 14px }
.post-card.featured p { font-size: 16px; flex: none; margin-bottom: 6px }

/* Empty state */
.blog-empty { text-align: center; padding: 60px 20px; color: var(--muted); border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface) }
.blog-empty h2 { font-size: 22px; color: var(--text); margin-bottom: 10px }

/* === Article === */
.article { max-width: 740px; margin: 0 auto; padding: 130px 24px 40px }
.article-back { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; color: var(--muted); margin-bottom: 28px }
.article-back:hover { color: var(--accent); text-decoration: none }
.article-back svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round }
.article-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px }
.article h1 { font-size: clamp(30px, 4.4vw, 46px); line-height: 1.12; margin-bottom: 22px }
.article-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; font-size: 14.5px; color: var(--muted); padding-bottom: 30px; border-bottom: 1px solid var(--border); margin-bottom: 8px }
.article-meta .author { color: var(--text); font-weight: 600 }
.article-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--border-strong) }
.article-cover { margin: 36px 0 8px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow-md) }
.article-cover img { width: 100%; display: block }

/* === Prose (rendered Markdown) === */
.prose { font-size: 17.5px; line-height: 1.8; color: var(--text-secondary); padding: 40px 0 8px }
.prose > *:first-child { margin-top: 0 }
.prose h2 { font-size: 27px; line-height: 1.25; color: var(--text); margin: 48px 0 16px }
.prose h3 { font-size: 21px; line-height: 1.3; color: var(--text); margin: 36px 0 12px }
.prose h4 { font-size: 17px; color: var(--text); margin: 28px 0 10px }
.prose p { margin: 0 0 22px }
.prose a { color: var(--accent); border-bottom: 1px solid var(--accent-glow); transition: border-color .2s }
.prose a:hover { border-bottom-color: var(--accent); text-decoration: none }
.prose ul, .prose ol { margin: 0 0 22px; padding-left: 26px }
.prose li { margin-bottom: 8px }
.prose li::marker { color: var(--accent) }
.prose img { max-width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--border); margin: 12px 0 }
.prose blockquote {
  margin: 28px 0; padding: 4px 24px; border-left: 3px solid var(--accent);
  color: var(--text); font-style: italic; background: var(--accent-subtle);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.prose blockquote p { margin: 14px 0 }
.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em;
  background: var(--code-bg); border: 1px solid var(--border); padding: 1px 6px; border-radius: 5px;
}
.prose pre {
  background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 18px 20px; overflow-x: auto; margin: 0 0 24px; font-size: 14px; line-height: 1.6;
}
.prose pre code { background: none; border: none; padding: 0; font-size: inherit }
.prose hr { border: none; height: 1px; background: var(--border); margin: 40px 0 }
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 24px; font-size: 15px }
.prose th, .prose td { border: 1px solid var(--border); padding: 10px 14px; text-align: left }
.prose th { background: var(--surface-alt); font-weight: 600; color: var(--text) }

/* Article footer / share */
.article-foot { margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px }
.article-foot .share { display: flex; gap: 10px; align-items: center }
.article-foot .share span { font-size: 13px; color: var(--muted) }
.article-foot .share a {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center; color: var(--muted); transition: all .2s;
}
.article-foot .share a:hover { color: var(--accent); border-color: var(--accent); text-decoration: none }
.article-foot .share svg { width: 16px; height: 16px; fill: currentColor }

/* CTA band under the article */
.article-cta {
  max-width: 740px; margin: 56px auto 0; padding: 40px 32px; text-align: center;
  background: var(--accent-subtle); border: 1px solid var(--accent-glow); border-radius: var(--radius);
}
.article-cta h3 { font-size: 22px; margin-bottom: 10px }
.article-cta p { color: var(--muted); margin-bottom: 22px; font-size: 15.5px }

/* === Footer (mirrors landing page) === */
footer { padding: 60px 40px 40px; max-width: 1120px; margin: 0 auto }
.footer-top { display: flex; justify-content: space-between; align-items: flex-start; padding-bottom: 40px; border-bottom: 1px solid var(--border); margin-bottom: 32px }
.footer-brand { display: flex; align-items: center; gap: 10px }
.footer-brand img { height: 24px; width: auto }
[data-theme="dark"] .footer-brand img { filter: invert(1) }
.footer-brand span { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 16px; color: var(--text) }
.footer-links { display: flex; gap: 32px; flex-wrap: wrap }
.footer-links a { color: var(--muted); font-size: 14px; font-weight: 500; text-decoration: none; transition: color .2s }
.footer-links a:hover { color: var(--text); text-decoration: none }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; gap: 8px }
.footer-copy, .footer-origin { font-size: 13px; color: var(--muted) }
.footer-origin { font-style: italic }

/* === Responsive === */
@media (max-width: 900px) {
  .post-grid { grid-template-columns: repeat(2, 1fr) }
  .post-card.featured { flex-direction: column }
  .post-card.featured .post-card-media { width: 100%; aspect-ratio: 16/9; border-right: none; border-bottom: 1px solid var(--border) }
  .post-card.featured .post-card-body { padding: 28px 24px }
  .footer-top { flex-direction: column; gap: 24px }
  .footer-bottom { flex-direction: column; text-align: center }
}
@media (max-width: 600px) {
  .nav { padding: 0 18px; height: 56px }
  .nav-links { display: none }
  .nav-actions .nav-login, .nav-actions .nav-cta { display: none }
  .hamburger { display: block }
  .blog-hero { padding: 120px 20px 48px }
  .blog-main { padding: 48px 20px 80px }
  .post-grid { grid-template-columns: 1fr }
  .article { padding: 110px 20px 40px }
  .prose { font-size: 17px }
  .footer-links { gap: 16px }
}
