/* ============================================================
   AI Marketing Automation — Demo Blog
   Clean modern neutral theme with per-niche accent theming
   ============================================================ */

:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --ink: #1a1d23;
  --ink-soft: #5b6270;
  --ink-faint: #8a91a0;
  --border: #e7e9ef;
  --border-soft: #eef0f5;
  --accent: #4a5568;
  --accent-soft: #eef1f6;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 6px 24px rgba(16, 24, 40, 0.07);
  --shadow-lg: 0 24px 60px rgba(16, 24, 40, 0.16);
  --maxw: 1180px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------------- Top Bar ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,0.82);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: grid; place-items: center; color: #fff; font-size: 16px;
  box-shadow: 0 4px 12px rgba(99,102,241,0.35);
}
.brand .badge {
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: #6366f1; background: #eef0ff;
  padding: 3px 8px; border-radius: 999px; margin-left: 4px;
}
.topbar-cta {
  font-size: 0.85rem; font-weight: 600; color: #fff;
  background: var(--ink); padding: 9px 16px; border-radius: 999px;
  transition: transform .15s ease, opacity .15s ease;
}
.topbar-cta:hover { transform: translateY(-1px); opacity: .9; }

/* ---------------- Hero ---------------- */
.hero {
  padding: 72px 0 40px;
  text-align: center;
  background:
    radial-gradient(900px 380px at 50% -120px, #eef0ff 0%, rgba(238,240,255,0) 70%);
}
.hero .eyebrow {
  display: inline-block; font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase; color: #6366f1;
  background: #eef0ff; padding: 6px 14px; border-radius: 999px; margin-bottom: 20px;
}
.hero h1 {
  font-size: clamp(2rem, 4.5vw, 3.3rem); line-height: 1.08;
  letter-spacing: -0.03em; font-weight: 800; margin-bottom: 18px;
}
.hero h1 .grad {
  background: linear-gradient(120deg, #6366f1, #8b5cf6 60%, #ec4899);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p {
  max-width: 680px; margin: 0 auto; font-size: 1.08rem; color: var(--ink-soft);
}
.hero .stats {
  display: flex; justify-content: center; gap: 40px; margin-top: 34px; flex-wrap: wrap;
}
.hero .stat strong { display: block; font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; }
.hero .stat span { font-size: 0.82rem; color: var(--ink-faint); }

/* ---------------- Niche Filter ---------------- */
.filterbar { position: sticky; top: 64px; z-index: 40; background: var(--bg); padding: 18px 0 10px; }
.filters {
  display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
}
.filter-pill {
  font-size: 0.85rem; font-weight: 600; color: var(--ink-soft);
  background: var(--surface); border: 1px solid var(--border);
  padding: 9px 16px; border-radius: 999px; cursor: pointer;
  transition: all .18s ease; display: inline-flex; align-items: center; gap: 8px;
}
.filter-pill .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-faint); }
.filter-pill:hover { border-color: var(--ink-faint); transform: translateY(-1px); }
.filter-pill.active { color: #fff; background: var(--ink); border-color: var(--ink); }
.filter-pill.active .dot { background: #fff; }

/* ---------------- Niche Sections ---------------- */
.niche-section { padding: 38px 0 14px; }
.niche-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 22px; gap: 16px; flex-wrap: wrap; }
.niche-head .left { display: flex; align-items: center; gap: 14px; }
.niche-icon {
  width: 44px; height: 44px; border-radius: 12px; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 20px; color: #fff;
}
.niche-head h2 { font-size: 1.5rem; letter-spacing: -0.02em; font-weight: 800; }
.niche-head .tagline { font-size: 0.9rem; color: var(--ink-faint); }
.niche-count { font-size: 0.78rem; font-weight: 600; color: var(--ink-soft); background: var(--surface); border: 1px solid var(--border); padding: 6px 12px; border-radius: 999px; }

/* ---------------- Card Grid ---------------- */
.grid {
  display: grid; gap: 22px;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
}
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; cursor: pointer;
  display: flex; flex-direction: column;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--border-soft); }
.card-media { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--accent-soft); }
.card-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease; }
.card:hover .card-media img { transform: scale(1.04); }
.card-cat {
  position: absolute; top: 12px; left: 12px;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: #fff; padding: 5px 10px; border-radius: 999px; backdrop-filter: blur(4px);
}
.card-body { padding: 18px 18px 20px; display: flex; flex-direction: column; flex: 1; }
.card-body h3 { font-size: 1.08rem; line-height: 1.32; letter-spacing: -0.01em; font-weight: 700; margin-bottom: 9px; }
.card-body p { font-size: 0.9rem; color: var(--ink-soft); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-foot { margin-top: auto; padding-top: 14px; display: flex; align-items: center; justify-content: space-between; }
.card-read { font-size: 0.78rem; color: var(--ink-faint); display: flex; align-items: center; gap: 6px; }
.card-link { font-size: 0.82rem; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.card-link .arr { transition: transform .18s ease; }
.card:hover .card-link .arr { transform: translateX(3px); }

/* ---------------- Modal (full article) ---------------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100; display: none;
  background: rgba(16, 24, 40, 0.55); backdrop-filter: blur(4px);
  align-items: flex-start; justify-content: center; padding: 40px 20px; overflow-y: auto;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface); border-radius: 20px; max-width: 760px; width: 100%;
  box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .25s ease;
  margin: auto;
}
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-media { position: relative; aspect-ratio: 16 / 8; overflow: hidden; }
.modal-media img { width: 100%; height: 100%; object-fit: cover; }
.modal-close {
  position: absolute; top: 16px; right: 16px; width: 38px; height: 38px;
  border-radius: 50%; border: none; cursor: pointer; font-size: 18px;
  background: rgba(255,255,255,0.92); color: var(--ink); display: grid; place-items: center;
  box-shadow: var(--shadow-sm); transition: transform .15s ease;
}
.modal-close:hover { transform: scale(1.08); }
.modal-body { padding: 30px 36px 38px; }
.modal-cat {
  display: inline-block; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: #fff; padding: 5px 11px; border-radius: 999px; margin-bottom: 14px;
}
.modal-body h2 { font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1.18; letter-spacing: -0.02em; font-weight: 800; margin-bottom: 12px; }
.modal-meta { display: flex; align-items: center; gap: 14px; font-size: 0.82rem; color: var(--ink-faint); margin-bottom: 22px; padding-bottom: 22px; border-bottom: 1px solid var(--border); }
.modal-text p { color: var(--ink); margin-bottom: 16px; font-size: 1rem; }
.modal-demo-note {
  margin-top: 26px; padding: 16px 18px; border-radius: 12px;
  background: var(--accent-soft); border: 1px dashed var(--border);
  font-size: 0.86rem; color: var(--ink-soft); display: flex; gap: 10px; align-items: flex-start;
}
.modal-demo-note strong { color: var(--ink); }

/* ---------------- Footer ---------------- */
.footer { margin-top: 60px; border-top: 1px solid var(--border); background: var(--surface); }
.footer-inner { padding: 40px 0; display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.footer .brand { font-size: 1rem; }
.footer p { font-size: 0.85rem; color: var(--ink-faint); }
.footer .made { font-size: 0.82rem; color: var(--ink-soft); }

/* ---------------- Hidden state for filter ---------------- */
.niche-section.hidden { display: none; }

/* ---------------- Responsive ---------------- */
@media (max-width: 600px) {
  .hero { padding: 50px 0 26px; }
  .hero .stats { gap: 26px; }
  .modal-body { padding: 24px 22px 30px; }
  .niche-head h2 { font-size: 1.3rem; }
}
