/* ==========================================================================
   DetailAhead Blog: design tokens + layout
   Same brand palette as the main app (assets/css/style.css), trimmed down to
   what an article-reading site actually needs: navbar, post cards, article
   typography, footer. Not the dashboard's design system.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

:root {
  --brand-indigo: #7C5CFF;
  --brand-indigo-deep: #583DF9;
  --brand-blue: #4C7DFF;
  --brand-orange: #E8703A;

  --bg: #F6F8FB;
  --surface: #FFFFFF;
  --surface-2: #F1F4F9;
  --border: rgba(11, 22, 40, 0.09);
  --ink: #0F172A;
  --ink-2: #334155;
  --ink-3: #64748B;
  --ink-4: #94A3B8;

  --font-body: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Helvetica, Arial, sans-serif;
  --font-display: "Space Grotesk", var(--font-body);
}

:root[data-theme="dark"] {
  --bg: #0B1220;
  --surface: #121A2B;
  --surface-2: #182338;
  --border: rgba(255, 255, 255, 0.08);
  --ink: #F1F5F9;
  --ink-2: #CBD5E1;
  --ink-3: #94A3B8;
  --ink-4: #64748B;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  transition: background-color 160ms ease, color 160ms ease;
}

.wrap { max-width: 1080px; margin: 0 auto; padding-inline: 24px; }
.wrap-narrow { max-width: 720px; margin: 0 auto; padding-inline: 24px; }

/* ---------------------------------- Navbar --------------------------------- */
.blog-nav {
  position: sticky; top: 0; z-index: 40;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.blog-nav-inner {
  max-width: 1080px; margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.blog-logo { display: flex; align-items: center; gap: 9px; font-family: var(--font-display); font-weight: 700; font-size: 17px; color: var(--ink); }
.blog-logo-mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--brand-indigo), var(--brand-blue));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 12px;
}
.blog-nav-links { display: flex; align-items: center; gap: 22px; }
.blog-nav-links a { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.blog-nav-links a:hover { color: var(--ink); }
.blog-nav-right { display: flex; align-items: center; gap: 14px; }

.theme-toggle {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--ink-2); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.theme-toggle:hover { color: var(--ink); }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.btn-cta {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--brand-indigo); color: #fff; font-size: 13.5px; font-weight: 700;
  padding: 9px 16px; border-radius: 9px;
}
.btn-cta:hover { background: var(--brand-indigo-deep); }

/* ---------------------------------- Hero ----------------------------------- */
.blog-hero { padding: 56px 0 40px; border-bottom: 1px solid var(--border); }
.blog-hero h1 { font-family: var(--font-display); font-size: clamp(30px, 5vw, 44px); font-weight: 700; letter-spacing: -0.02em; margin-bottom: 12px; }
.blog-hero p { font-size: 16.5px; color: var(--ink-3); max-width: 560px; }

/* ------------------------------- Post grid ---------------------------------- */
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; padding: 44px 0 70px; }
@media (max-width: 900px) { .post-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .post-grid { grid-template-columns: 1fr; } }

.post-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 22px; display: flex; flex-direction: column; gap: 10px;
  transition: border-color 140ms ease, transform 140ms ease;
}
.post-card:hover { border-color: rgba(124, 92, 255, 0.4); transform: translateY(-2px); }
.post-card-tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--brand-indigo); }
.post-card h2 { font-family: var(--font-display); font-size: 18px; font-weight: 700; line-height: 1.3; }
.post-card p { font-size: 14px; color: var(--ink-3); line-height: 1.55; flex: 1; }
.post-card-meta { font-size: 12.5px; color: var(--ink-4); }

/* --------------------------------- Article ----------------------------------- */
.article-head { padding: 48px 0 32px; }
.article-tag { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--brand-indigo); margin-bottom: 12px; display: block; }
.article-head h1 { font-family: var(--font-display); font-size: clamp(28px, 4.5vw, 40px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; margin-bottom: 14px; }
.article-meta { font-size: 13.5px; color: var(--ink-4); }

.article-body { padding-bottom: 60px; font-size: 17px; color: var(--ink-2); }
.article-body h2 { font-family: var(--font-display); font-size: 24px; font-weight: 700; color: var(--ink); margin: 38px 0 14px; letter-spacing: -0.01em; }
.article-body h3 { font-family: var(--font-display); font-size: 19px; font-weight: 700; color: var(--ink); margin: 28px 0 10px; }
.article-body p { margin-bottom: 18px; }
.article-body ul, .article-body ol { margin: 0 0 18px 22px; }
.article-body ul { list-style: disc; }
.article-body ol { list-style: decimal; }
.article-body li { margin-bottom: 8px; }
.article-body a { color: var(--brand-indigo); font-weight: 600; text-decoration: underline; }
.article-body strong { color: var(--ink); font-weight: 700; }
/* .article-body a above (two classes) otherwise beats .btn-cta (one class)
   on specificity, so the "Start free trial" button inside the article CTA
   card was inheriting the indigo underlined link style instead of staying
   a solid white-on-indigo button. */
.article-body .btn-cta { color: #fff; text-decoration: none; }

.article-cta {
  margin-top: 30px; padding: 26px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--border);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
}
.article-cta h3 { font-family: var(--font-display); font-size: 18px; margin-bottom: 4px; }
.article-cta p { font-size: 14px; color: var(--ink-3); }

/* --------------------------------- Footer ------------------------------------ */
.blog-footer { border-top: 1px solid var(--border); padding: 34px 0; margin-top: 20px; }
.blog-footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; font-size: 13.5px; color: var(--ink-4); }
.blog-footer a { color: var(--ink-3); font-weight: 600; }
.blog-footer a:hover { color: var(--ink); }
