/* ============================================================
   LIVIO EDITORIAL DESIGN SYSTEM — blog.css
   Modern, high-authority SaaS publication design.
   Deep obsidian dark mode (#06060f) with electric royal blue (#0000E1 / #1F5EFF).
   WCAG AA/AAA compliant contrast, 60fps micro-animations,
   PageSpeed Mobile 90+ optimized.
   ============================================================ */

:root {
  --color-primary: #0000E1;
  --color-primary-hover: #1F5EFF;
  --color-accent: #1F5EFF;
  --color-accent-light: rgba(31, 94, 255, 0.12);
  --color-accent-border: rgba(31, 94, 255, 0.25);
  --color-accent-glow: rgba(31, 94, 255, 0.35);

  /* Dark Theme (Default) */
  --bg-base: #06060f;
  --bg-surface: #0b0b18;
  --bg-card: rgba(16, 16, 32, 0.85);
  --bg-card-hover: rgba(24, 24, 48, 0.95);
  --bg-code: #121226;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --border-color: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.05);
  --border-strong: rgba(255, 255, 255, 0.16);

  --nav-bg: rgba(6, 6, 15, 0.82);
  --nav-border: rgba(255, 255, 255, 0.08);

  --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --container-max: 1240px;
  --article-max: 760px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  --shadow-subtle: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 12px 40px -10px rgba(31, 94, 255, 0.25);
}

[data-theme="light"] {
  --bg-base: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-code: #f1f5f9;

  --text-primary: #090d16;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --border-color: rgba(0, 0, 0, 0.08);
  --border-subtle: rgba(0, 0, 0, 0.04);
  --border-strong: rgba(0, 0, 0, 0.16);

  --nav-bg: rgba(248, 250, 252, 0.88);
  --nav-border: rgba(0, 0, 0, 0.08);
  --shadow-subtle: 0 4px 20px rgba(0, 0, 0, 0.06);
  --shadow-glow: 0 12px 40px -10px rgba(0, 0, 225, 0.12);
}

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

html {
  font-family: var(--font-family);
  background-color: var(--bg-base);
  color: var(--text-primary);
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-base);
  color: var(--text-primary);
  position: relative;
  overflow-x: hidden;
}

/* Ambient Radial Top Glow */
body::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 1000px;
  height: 500px;
  background: radial-gradient(circle at 50% 0%, rgba(31, 94, 255, 0.14) 0%, rgba(0, 0, 225, 0.04) 50%, transparent 80%);
  pointer-events: none;
  z-index: 0;
}

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

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ── Sticky Top Navbar ─────────────────────────────────────── */
.blog-nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--nav-border);
  padding: 0.9rem 1.5rem;
}

.blog-nav-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.blog-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: 1.15rem;
}

.blog-logo img {
  height: 28px;
  width: auto;
}

[data-theme="light"] .logo-img--dark { display: none; }
[data-theme="light"] .logo-img--light { display: block; }
:root:not([data-theme="light"]) .logo-img--light { display: none; }
:root:not([data-theme="light"]) .logo-img--dark { display: block; }

.blog-nav-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.nav-link {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: color 0.15s ease;
}

.nav-link:hover, .nav-link.active {
  color: var(--text-primary);
}

.nav-cta {
  background: linear-gradient(135deg, #0000E1 0%, #1F5EFF 100%);
  color: #ffffff;
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 4px 14px rgba(31, 94, 255, 0.3);
  transition: all 0.2s ease;
}

.nav-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(31, 94, 255, 0.45);
}

/* ── Hero Banner (Index) ───────────────────────────────────── */
.blog-hero {
  position: relative;
  z-index: 1;
  padding: 4.5rem 1.5rem 2.5rem;
  text-align: center;
  max-width: 860px;
  margin: 0 auto;
}

.blog-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  border-radius: var(--radius-full);
  background: var(--color-accent-light);
  border: 1px solid var(--color-accent-border);
  color: var(--color-accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}

.blog-badge-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 10px #22c55e;
}

.blog-hero-title {
  font-size: clamp(2.4rem, 5.5vw, 3.75rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.035em;
  margin-bottom: 1.25rem;
}

.gradient-text {
  background: linear-gradient(135deg, #ffffff 30%, #93c5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .gradient-text {
  background: linear-gradient(135deg, #090d16 30%, #1F5EFF 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.blog-hero-sub {
  font-size: 1.2rem;
  line-height: 1.65;
  color: var(--text-secondary);
  max-width: 680px;
  margin: 0 auto;
}

/* ── Category Filter Bar ───────────────────────────────────── */
.category-filter-bar {
  position: relative;
  z-index: 1;
  max-width: var(--container-max);
  margin: 1.5rem auto 2.5rem;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.category-filter-bar::-webkit-scrollbar {
  display: none;
}

.filter-pill {
  white-space: nowrap;
  padding: 0.45rem 1.1rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-pill:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.filter-pill.active {
  background: var(--color-primary);
  color: #ffffff;
  border-color: var(--color-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 225, 0.3);
}

/* ── Main Container ────────────────────────────────────────── */
.blog-container {
  position: relative;
  z-index: 1;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1.5rem 6rem;
  flex: 1;
  width: 100%;
}

/* ── Featured Post Card ────────────────────────────────────── */
.featured-post-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin-bottom: 3.5rem;
  box-shadow: var(--shadow-subtle);
  transition: all 0.3s ease;
}

.featured-post-card:hover {
  border-color: var(--color-accent-border);
  box-shadow: var(--shadow-glow);
  transform: translateY(-3px);
}

.featured-cover-wrap {
  position: relative;
  overflow: hidden;
  background: var(--bg-surface);
  width: 100%;
  aspect-ratio: 2.5 / 1;
  max-height: 420px;
  display: block;
  border-bottom: 1px solid var(--border-color);
}

.featured-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.featured-post-card:hover .featured-cover-img {
  transform: scale(1.02);
}

.featured-content {
  padding: 2.25rem 2.75rem 2.5rem;
  display: flex;
  flex-direction: column;
}

.featured-meta-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.featured-badge {
  background: linear-gradient(135deg, #0000E1, #1F5EFF);
  color: #ffffff;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.meta-time {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.featured-title {
  font-size: clamp(1.75rem, 3vw, 2.35rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 1.25rem;
  color: var(--text-primary);
  transition: color 0.15s ease;
}

.featured-post-card:hover .featured-title {
  color: var(--color-accent);
}

.featured-excerpt {
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.featured-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
}

.author-chip {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.author-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0000E1, #1F5EFF);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(31, 94, 255, 0.25);
}

.author-avatar svg {
  width: 20px;
  height: 20px;
  display: block;
}

.author-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.author-info-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

.author-info-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.read-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--color-accent);
  transition: gap 0.2s ease;
}

.featured-post-card:hover .read-btn {
  gap: 0.75rem;
}

/* ── Standard Posts Grid ───────────────────────────────────── */
.section-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
}

.section-heading-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 2rem;
}

.post-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-subtle);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.post-card:hover {
  transform: translateY(-5px);
  border-color: var(--color-accent-border);
  box-shadow: var(--shadow-glow);
}

.post-card-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--bg-surface);
  overflow: hidden;
  position: relative;
}

.post-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.post-card:hover .post-card-cover img {
  transform: scale(1.04);
}

.post-card-body {
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

.post-tag {
  background: var(--color-accent-light);
  color: var(--color-accent);
  padding: 0.22rem 0.65rem;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.75rem;
  border: 1px solid var(--color-accent-border);
}

.post-card-title {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.02em;
  margin-bottom: 0.85rem;
  color: var(--text-primary);
  transition: color 0.15s ease;
}

.post-card:hover .post-card-title {
  color: var(--color-accent);
}

.post-card-excerpt {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.post-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1.15rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.875rem;
  font-weight: 600;
}

/* ── Mid-Page Callout Banner ───────────────────────────────── */
.mid-banner {
  margin: 5rem 0 3rem;
  padding: 3.5rem 2.5rem;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, rgba(0, 0, 225, 0.22) 0%, rgba(31, 94, 255, 0.12) 100%);
  border: 1px solid var(--color-accent-border);
  box-shadow: var(--shadow-glow);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.mid-banner-title {
  font-size: clamp(1.75rem, 3.5vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

.mid-banner-sub {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

/* ── Breadcrumbs ───────────────────────────────────────────── */
.breadcrumbs {
  max-width: var(--article-max);
  margin: 1.75rem auto 0;
  padding: 0 1.25rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.breadcrumbs a {
  color: var(--text-secondary);
  transition: color 0.15s ease;
}

.breadcrumbs a:hover {
  color: var(--color-accent);
}

.breadcrumbs span.separator {
  opacity: 0.5;
}

.breadcrumbs span.current {
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

/* ── Article Layout ────────────────────────────────────────── */
.article-container {
  max-width: var(--article-max);
  margin: 0 auto;
  padding: 2.5rem 1.25rem 6rem;
  width: 100%;
  position: relative;
  z-index: 1;
}

.article-header {
  margin-bottom: 2.75rem;
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.article-title {
  font-size: clamp(2.2rem, 5vw, 3.1rem);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.035em;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
}

.article-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.25rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.92rem;
  color: var(--text-secondary);
}

.article-cover-wrap {
  margin: 2.5rem 0 3rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  position: relative;
  aspect-ratio: 16 / 9;
}

.article-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── Article Body Content Typography ───────────────────────── */
.article-body {
  font-size: 1.15rem;
  line-height: 1.85;
  color: var(--text-primary);
  word-break: break-word;
}

.article-body > * + * {
  margin-top: 1.75rem;
}

.article-body p.lead {
  font-size: 1.25rem;
  line-height: 1.75;
  color: var(--text-secondary);
  font-weight: 400;
}

.article-body h2 {
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.025em;
  margin-top: 3.25rem;
  margin-bottom: 1.15rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.5rem;
}

.article-body h3 {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.015em;
  margin-top: 2.5rem;
  margin-bottom: 0.85rem;
  color: var(--text-primary);
}

.article-body strong {
  font-weight: 700;
  color: var(--text-primary);
}

.article-body a {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 4px;
  transition: color 0.15s ease;
}

.article-body a:hover {
  color: #3b82f6;
}

.article-body ul, .article-body ol {
  padding-left: 1.85rem;
}

.article-body li {
  margin-bottom: 0.65rem;
}

.article-body blockquote {
  border-left: 4px solid var(--color-accent);
  padding: 1.25rem 1.75rem;
  margin: 2.25rem 0;
  background: var(--color-accent-light);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: 1.15rem;
  line-height: 1.7;
  font-style: italic;
  color: var(--text-primary);
}

.article-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
  background: var(--bg-code);
  padding: 0.2rem 0.45rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.article-body pre {
  background: var(--bg-code);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.35rem;
  overflow-x: auto;
  font-size: 0.92rem;
  line-height: 1.5;
}

.article-body img {
  border-radius: var(--radius-md);
  margin: 2.25rem auto;
  box-shadow: var(--shadow-subtle);
}

/* ── Author Box & Bottom CTA ───────────────────────────────── */
.article-footer {
  margin-top: 4rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border-color);
}

.author-bio-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2rem;
  display: flex;
  gap: 1.5rem;
  align-items: center;
  margin-bottom: 3rem;
}

.author-bio-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0000E1, #1F5EFF);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(31, 94, 255, 0.4);
  overflow: hidden;
}

.author-bio-avatar svg {
  width: 34px;
  height: 34px;
  display: block;
}

.author-bio-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.author-bio-name {
  font-weight: 800;
  font-size: 1.15rem;
  margin-bottom: 0.35rem;
}

.author-bio-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ── Footer ────────────────────────────────────────────────── */
.blog-footer {
  border-top: 1px solid var(--border-color);
  background: var(--bg-surface);
  padding: 3rem 1.5rem;
  margin-top: auto;
  position: relative;
  z-index: 1;
}

.blog-footer-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.footer-copy {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 1.75rem;
  flex-wrap: wrap;
}

.footer-link {
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: color 0.15s;
}

.footer-link:hover {
  color: var(--text-primary);
}

/* ── Mobile Breakpoints ────────────────────────────────────── */
@media (max-width: 900px) {
  .featured-content {
    padding: 1.75rem 1.5rem 2rem;
  }
  .featured-cover-wrap {
    aspect-ratio: 16 / 9;
    max-height: 320px;
  }
}

@media (max-width: 640px) {
  .posts-grid {
    grid-template-columns: 1fr;
  }
  .blog-hero {
    padding: 3rem 1rem 2rem;
  }
  .article-title {
    font-size: 1.95rem;
  }
  .author-bio-card {
    flex-direction: column;
    text-align: center;
  }
}
