/* AI article + redesigned /blogs/ — CRM Messaging blues (#2046D0 / #4B6CE3) */
:root {
  --crm-blue: #2046d0;
  --crm-blue-2: #4b6ce3;
  --crm-ink: #0a0d16;
  --crm-muted: #5b6475;
  --crm-line: #e3e8f2;
  --crm-bg: #f5f7fb;
}

body.crm-ai-blog,
body.crm-blogs-home {
  margin: 0;
  background: #fff;
  color: var(--crm-ink);
  font-family: "Nunito", system-ui, sans-serif;
}

/* —— Article —— */
.blog-hero-band {
  background: linear-gradient(135deg, #13297a 0%, var(--crm-blue) 48%, var(--crm-blue-2) 100%);
  color: #fff;
  padding: 3.5rem 1.5rem 4rem;
}
.blog-hero-inner {
  max-width: 920px;
  margin: 0 auto;
}
.blog-crumb {
  opacity: 0.85;
  font-size: 0.9rem;
  margin: 0 0 1rem;
}
.blog-crumb a {
  color: #fff;
  text-decoration: none;
}
.blog-hero-band h1 {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  line-height: 1.2;
  margin: 0 0 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
}
.blog-hero-band .blog-meta {
  margin: 0;
  opacity: 0.9;
  font-size: 0.95rem;
}

.blog-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 760px);
  gap: 2.5rem;
  max-width: 1100px;
  margin: -2rem auto 3rem;
  padding: 0 1.5rem;
  align-items: start;
}
.blog-toc-wrap {
  position: sticky;
  top: 6rem;
}
/* Desktop: unwrap details so sticky TOC still works. */
@media (min-width: 901px) {
  .blog-toc-details {
    display: contents;
  }
  .blog-toc-summary {
    display: none !important;
  }
}
.blog-toc-summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.9rem 1.1rem;
  list-style: none;
  font-family: "Nunito", system-ui, sans-serif;
  color: var(--crm-ink);
}
.blog-toc-summary::-webkit-details-marker {
  display: none;
}
.blog-toc-summary::after {
  content: "+";
  float: right;
  color: var(--crm-blue);
  font-weight: 700;
}
.blog-toc-details[open] > .blog-toc-summary::after {
  content: "–";
}
.blog-toc {
  background: #fff;
  border: 1px solid var(--crm-line);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  box-shadow: 0 8px 24px rgba(32, 70, 208, 0.06);
  font-size: 0.9rem;
}
.blog-toc h2 {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--crm-muted);
}
.blog-toc ol {
  margin: 0;
  padding-left: 1.25rem;
}
.blog-toc-root {
  list-style: decimal;
}
.blog-toc .toc-sub {
  list-style: none;
  padding-left: 0.85rem;
  margin: 0.35rem 0 0.5rem;
}
.blog-toc .toc-sub > li {
  list-style: none;
  position: relative;
  padding-left: 0.75rem;
  margin-bottom: 0.25rem;
}
.blog-toc .toc-sub > li::before {
  content: "–";
  position: absolute;
  left: 0;
  color: var(--crm-muted);
}
.blog-toc a {
  color: var(--crm-ink);
  text-decoration: none;
}
.blog-toc a:hover {
  color: var(--crm-blue);
}
.blog-toc .toc-l3 {
  font-size: 0.92em;
}

.blog-article {
  background: #fff;
  border-radius: 16px;
  padding: 2rem 2rem 1rem;
  border: 1px solid var(--crm-line);
  box-shadow: 0 12px 40px rgba(10, 13, 22, 0.06);
}
.blog-hero-img {
  width: 100%;
  border-radius: 12px;
  margin-bottom: 1.75rem;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.blog-content {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.125rem;
  line-height: 1.8;
  color: #1f2937;
}
.blog-content h1,
.blog-content h2 {
  font-family: "Nunito", system-ui, sans-serif;
  font-size: 1.5rem;
  margin: 2.25rem 0 0.85rem;
  color: var(--crm-ink);
  line-height: 1.3;
  font-weight: 700;
}
.blog-content h3 {
  font-family: "Nunito", system-ui, sans-serif;
  font-size: 1.2rem;
  margin: 1.75rem 0 0.6rem;
}
.blog-content p {
  margin: 0 0 1.1rem;
}
.blog-content a {
  color: var(--crm-blue);
}
.blog-content ul,
.blog-content ol {
  margin: 0 0 1.25rem;
  padding-left: 1.35rem;
}
.blog-content li {
  margin-bottom: 0.4rem;
}
.blog-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-family: "Nunito", system-ui, sans-serif;
  font-size: 0.95rem;
}
.blog-content th,
.blog-content td {
  border: 1px solid var(--crm-line);
  padding: 0.55rem 0.75rem;
  text-align: left;
}
.blog-content th {
  background: var(--crm-bg);
}
.blog-content pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 1rem 1.15rem;
  border-radius: 10px;
  overflow-x: auto;
  font-size: 0.85rem;
}
.blog-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.blog-cta {
  background: linear-gradient(135deg, var(--crm-blue), var(--crm-blue-2));
  color: #fff;
  border-radius: 14px;
  padding: 2rem;
  margin: 2.5rem 0;
  text-align: center;
  font-family: "Nunito", system-ui, sans-serif;
}
/* Elementor/global h2 can override inherited white — force CTA copy */
.blog-article .blog-cta h2,
.blog-article .blog-cta p {
  margin: 0 0 0.5rem;
  color: #fff !important;
}
.blog-article .blog-cta h2 {
  font-size: 1.4rem;
}
.blog-article .blog-cta p {
  margin: 0;
  opacity: 0.95;
}
.blog-cta .btn {
  display: inline-block;
  background: #fff;
  color: var(--crm-blue);
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
  margin-top: 1.1rem;
}

.blog-related {
  margin: 2rem 0 1rem;
  font-family: "Nunito", system-ui, sans-serif;
}
.blog-related h3 {
  margin: 0 0 1rem;
}
.blog-related-grid {
  display: grid;
  gap: 0.75rem;
}
.blog-related-card {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--crm-line);
  border-radius: 10px;
  text-decoration: none;
  color: var(--crm-ink);
  transition: border-color 0.2s, transform 0.2s;
}
.blog-related-card:hover {
  border-color: var(--crm-blue);
  transform: translateY(-2px);
}
.blog-related-card em {
  color: var(--crm-blue);
  font-style: normal;
  white-space: nowrap;
}

.blog-header-fallback,
.blog-footer-fallback {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--crm-line);
}
.blog-footer-fallback {
  border-top: 1px solid var(--crm-line);
  border-bottom: 0;
  justify-content: center;
  color: var(--crm-muted);
  font-size: 0.9rem;
}
.blog-header-fallback nav a {
  margin-left: 1rem;
  color: var(--crm-blue);
  text-decoration: none;
}

@media (max-width: 900px) {
  .blog-hero-band {
    padding: 2rem 1rem 2.75rem;
  }
  .blog-layout {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: -1rem;
    padding: 0 1rem;
  }
  /* Article first — TOC was eating the fold on phones. */
  .blog-article {
    order: -1;
    padding: 1.15rem;
    border-radius: 12px;
  }
  .blog-toc-wrap {
    position: static;
    order: 0;
  }
  .blog-toc-details {
    background: #fff;
    border: 1px solid var(--crm-line);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(32, 70, 208, 0.06);
    overflow: hidden;
  }
  .blog-toc-details .blog-toc {
    border: 0;
    box-shadow: none;
    border-radius: 0;
    border-top: 1px solid var(--crm-line);
    max-height: none;
    padding: 0.85rem 1rem 1rem;
  }
  .blog-toc-details .blog-toc h2 {
    display: none;
  }
  .blog-toc {
    max-height: none;
    overflow: visible;
    padding: 0.85rem 1rem;
  }
  .blog-content {
    font-size: 1.05rem;
    line-height: 1.7;
    overflow-wrap: anywhere;
  }
  .blog-content img,
  .blog-content video,
  .blog-hero-img {
    max-width: 100%;
    height: auto;
  }
  /* Wide comparison tables scroll instead of blowing the viewport. */
  .blog-content table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .blog-content pre {
    max-width: 100%;
  }
  .blog-related-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }
  .blog-related-card em {
    white-space: normal;
  }
  .blog-cta {
    padding: 1.5rem 1.1rem;
  }
}

/* —— Blogs home (HelloCRM-inspired) —— */
.blogs-home-hero {
  background: linear-gradient(135deg, #13297a, var(--crm-blue) 55%, var(--crm-blue-2));
  color: #fff;
  padding: 4rem 1.5rem 3.5rem;
  text-align: center;
}
.blogs-home-hero h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  color: #fff;
}
.blogs-home-hero p {
  margin: 0 auto;
  max-width: 560px;
  opacity: 0.92;
  font-size: 1.1rem;
}

.blogs-home-wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.blogs-featured {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}
.blogs-featured-main {
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--crm-line);
  background: #fff;
}
.blogs-featured-main .thumb {
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--crm-bg);
}
.blogs-featured-main .thumb img,
.blogs-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.45s ease;
}
.blogs-featured-main:hover .thumb img,
.blogs-card:hover .thumb img {
  transform: scale(1.08);
}
.blogs-featured-main .body {
  padding: 1.25rem 1.4rem 1.5rem;
}
.blogs-featured-main h2 {
  margin: 0 0 0.5rem;
  font-size: 1.45rem;
  line-height: 1.3;
}
.blogs-featured-main p {
  margin: 0;
  color: var(--crm-muted);
  font-size: 0.95rem;
}
.blogs-popular {
  background: var(--crm-bg);
  border-radius: 16px;
  padding: 1.25rem 1.35rem;
  border: 1px solid var(--crm-line);
}
.blogs-popular h3 {
  margin: 0 0 1rem;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--crm-muted);
}
.blogs-popular a {
  display: block;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--crm-line);
  color: var(--crm-ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}
.blogs-popular a:last-child {
  border-bottom: 0;
}
.blogs-popular a:hover {
  color: var(--crm-blue);
}

.blogs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.35rem;
}
.blogs-card {
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--crm-line);
  background: #fff;
  transition: box-shadow 0.25s, transform 0.25s;
}
.blogs-card:hover {
  box-shadow: 0 14px 36px rgba(32, 70, 208, 0.12);
  transform: translateY(-3px);
}
.blogs-card .thumb {
  overflow: hidden;
  aspect-ratio: 16 / 10;
  background: var(--crm-bg);
}
.blogs-card .body {
  padding: 1rem 1.1rem 1.2rem;
}
.blogs-card h3 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  line-height: 1.35;
}
.blogs-card .date {
  color: var(--crm-muted);
  font-size: 0.85rem;
}
.blogs-card .more {
  display: inline-block;
  margin-top: 0.65rem;
  color: var(--crm-blue);
  font-weight: 700;
  font-size: 0.9rem;
}

.blogs-pager {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin: 2.5rem 0 1rem;
}
.blogs-pager a,
.blogs-pager span {
  min-width: 2.4rem;
  height: 2.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--crm-line);
  text-decoration: none;
  color: var(--crm-ink);
  font-weight: 600;
}
.blogs-pager a:hover {
  border-color: var(--crm-blue);
  color: var(--crm-blue);
}
.blogs-pager .is-active {
  background: var(--crm-blue);
  border-color: var(--crm-blue);
  color: #fff;
}

.blogs-newsletter {
  margin-top: 2rem;
  padding: 2rem;
  border-radius: 16px;
  background: var(--crm-bg);
  text-align: center;
  border: 1px solid var(--crm-line);
}
.blogs-newsletter h2 {
  margin: 0 0 0.5rem;
}
.blogs-newsletter p {
  margin: 0 0 1rem;
  color: var(--crm-muted);
}
.blogs-newsletter .btn {
  display: inline-block;
  background: var(--crm-blue);
  color: #fff;
  padding: 0.75rem 1.4rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
}

@media (max-width: 900px) {
  .blogs-home-hero {
    padding: 2.75rem 1rem 2.25rem;
  }
  .blogs-home-wrap {
    padding: 1.75rem 1rem 3rem;
  }
  .blogs-featured {
    grid-template-columns: 1fr;
    gap: 1.15rem;
    margin-bottom: 1.75rem;
  }
  .blogs-featured-main h2 {
    font-size: 1.25rem;
  }
  .blogs-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }
  .blogs-newsletter {
    padding: 1.5rem 1.1rem;
  }
}
@media (max-width: 560px) {
  .blogs-home-hero {
    padding: 2.25rem 1rem 1.75rem;
  }
  .blogs-home-hero p {
    font-size: 1rem;
  }
  .blogs-grid {
    grid-template-columns: 1fr;
  }
  .blogs-card .body {
    padding: 0.9rem 1rem 1.05rem;
  }
  .blogs-pager a,
  .blogs-pager span {
    min-width: 2.2rem;
    height: 2.2rem;
  }
}
