/* ==========================================================================
   AFTERPATH BLOG TEMPLATE
   All classes prefixed with .ap-blog-* to avoid conflicts.
   Design tokens match afterpath.life homepage (Outfit, teal accent, navy text).
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. RESET & BASE
   -------------------------------------------------------------------------- */
.ap-blog-article *,
.ap-blog-listing * {
  box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   2. ARTICLE PAGE — LAYOUT
   -------------------------------------------------------------------------- */
.ap-blog-article {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 80px;
  font-family: 'Outfit', sans-serif;
  color: #51545e;
}

/* — Header / Hero -------------------------------------------------------- */
.ap-blog-header {
  max-width: 720px;
  margin: 0 auto;
  padding: 60px 0 40px;
  text-align: left;
}

.ap-blog-title {
  font-family: 'Outfit', sans-serif;
  font-size: 48px;
  font-weight: 400;
  line-height: 1.2;
  color: #11111d;
  letter-spacing: -0.48px;
  margin: 0 0 24px;
}

.ap-blog-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.ap-blog-category {
  display: inline-block;
  background: #4ecdc4;
  color: #ffffff;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  padding: 6px 16px;
  border-radius: 80px;
  text-decoration: none;
  white-space: nowrap;
}

a.ap-blog-category:hover {
  background: #3dbdb5;
  color: #ffffff;
  text-decoration: none;
}

.ap-blog-read-time {
  display: inline-block;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: #8b8d97;
  white-space: nowrap;
}

/* — Featured Image ------------------------------------------------------- */
.ap-blog-featured-image {
  max-width: 720px;
  margin: 0 auto 40px;
}

.ap-blog-featured-image img {
  width: 100%;
  height: auto;
  border-radius: 16px;
  display: block;
}

/* — Content wrapper (body + sidebar) ------------------------------------- */
.ap-blog-content {
  display: flex;
  gap: 60px;
  align-items: flex-start;
  max-width: 1200px;
  margin: 0 auto;
}

/* — Body (rich text) ----------------------------------------------------- */
.ap-blog-body {
  flex: 1 1 0%;
  max-width: 720px;
  min-width: 0;
}

/* — Table of Contents sidebar -------------------------------------------- */
.ap-blog-toc {
  flex: 0 0 280px;
  position: sticky;
  top: 100px;
  align-self: flex-start;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  padding: 24px;
  background: #f7f8fa;
  border-radius: 16px;
}

.ap-blog-toc-heading {
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #11111d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 16px;
  cursor: default;
}

.ap-blog-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ap-blog-toc li {
  margin: 0 0 4px;
}

.ap-blog-toc li.ap-blog-toc-h3 {
  padding-left: 16px;
}

.ap-blog-toc a {
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  color: #51545e;
  text-decoration: none;
  display: block;
  padding: 4px 8px;
  border-radius: 6px;
  border-left: 2px solid transparent;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.ap-blog-toc a:hover {
  color: #11111d;
  background: #eef0f3;
}

.ap-blog-toc a.ap-blog-toc-active {
  color: #11111d;
  font-weight: 500;
  border-left-color: #4ecdc4;
  background: #eef0f3;
}

/* Mobile TOC toggle */
.ap-blog-toc-toggle {
  display: none;
  width: 100%;
  background: none;
  border: none;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #11111d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0;
  margin: 0 0 16px;
  cursor: pointer;
  text-align: left;
}

.ap-blog-toc-toggle::after {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-right: 2px solid #11111d;
  border-bottom: 2px solid #11111d;
  transform: rotate(45deg);
  margin-left: 8px;
  transition: transform 0.25s;
  vertical-align: middle;
}

.ap-blog-toc-toggle[aria-expanded="true"]::after {
  transform: rotate(-135deg);
}

/* --------------------------------------------------------------------------
   3. RICH TEXT STYLES (inside .ap-blog-body)
   -------------------------------------------------------------------------- */
.ap-blog-body h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 32px;
  font-weight: 400;
  line-height: 1.2;
  color: #11111d;
  margin: 48px 0 16px;
  letter-spacing: -0.32px;
}

.ap-blog-body h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 400;
  line-height: 1.2;
  color: #11111d;
  margin: 36px 0 12px;
}

.ap-blog-body h4 {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.3;
  color: #11111d;
  margin: 28px 0 10px;
}

.ap-blog-body p {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.6;
  color: #51545e;
  margin: 0 0 20px;
}

.ap-blog-body ul,
.ap-blog-body ol {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.6;
  color: #51545e;
  margin: 0 0 20px;
  padding-left: 28px;
}

.ap-blog-body li {
  margin-bottom: 8px;
}

.ap-blog-body li::marker {
  color: #4ecdc4;
}

.ap-blog-body blockquote {
  margin: 28px 0;
  padding: 16px 24px;
  border-left: 4px solid #4ecdc4;
  background: #f7f8fa;
  border-radius: 0 12px 12px 0;
  font-style: italic;
  color: #51545e;
}

.ap-blog-body blockquote p {
  margin-bottom: 0;
}

.ap-blog-body a {
  color: #4ecdc4;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, color 0.2s;
}

.ap-blog-body a:hover {
  color: #3dbdb5;
  border-bottom-color: #3dbdb5;
}

.ap-blog-body img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  margin: 28px 0;
  display: block;
}

.ap-blog-body figure {
  margin: 28px 0;
}

.ap-blog-body figcaption {
  font-size: 14px;
  color: #8b8d97;
  text-align: center;
  margin-top: 8px;
}

/* — Tables --------------------------------------------------------------- */
.ap-blog-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 28px 0;
  font-size: 16px;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.ap-blog-body thead th {
  background: #11111d;
  color: #ffffff;
  font-weight: 500;
  text-align: left;
  padding: 12px 16px;
}

.ap-blog-body thead th:first-child {
  border-radius: 8px 0 0 0;
}

.ap-blog-body thead th:last-child {
  border-radius: 0 8px 0 0;
}

.ap-blog-body tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid #eef0f3;
}

.ap-blog-body tbody tr:nth-child(even) {
  background: #f7f8fa;
}

.ap-blog-body tbody tr:last-child td:first-child {
  border-radius: 0 0 0 8px;
}

.ap-blog-body tbody tr:last-child td:last-child {
  border-radius: 0 0 8px 0;
}

/* — Code ----------------------------------------------------------------- */
.ap-blog-body code {
  font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;
  font-size: 0.875em;
  background: #f0f1f4;
  padding: 2px 6px;
  border-radius: 4px;
  color: #11111d;
}

.ap-blog-body pre {
  background: #11111d;
  color: #e8e8e8;
  padding: 20px 24px;
  border-radius: 12px;
  overflow-x: auto;
  margin: 28px 0;
  font-size: 14px;
  line-height: 1.6;
}

.ap-blog-body pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  color: inherit;
  font-size: inherit;
}

/* — Horizontal rule ------------------------------------------------------ */
.ap-blog-body hr {
  border: none;
  height: 1px;
  background: #eef0f3;
  margin: 40px 0;
}

/* --------------------------------------------------------------------------
   4. CTA BANNER
   -------------------------------------------------------------------------- */
.ap-blog-cta {
  max-width: 720px;
  margin: 60px auto 0;
  padding: 48px 40px;
  background: #11111d;
  border-radius: 20px;
  text-align: center;
}

.ap-blog-cta-title {
  font-family: 'Outfit', sans-serif;
  font-size: 28px;
  font-weight: 400;
  line-height: 1.2;
  color: #ffffff;
  margin: 0 0 12px;
}

.ap-blog-cta-text {
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 300;
  line-height: 1.5;
  color: #aaaab0;
  margin: 0 0 28px;
}

.ap-blog-cta-btn {
  display: inline-block;
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 500;
  color: #11111d;
  background: #4ecdc4;
  padding: 14px 32px;
  border-radius: 80px;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s;
  cursor: pointer;
  border: none;
}

.ap-blog-cta-btn:hover {
  background: #5fd6ce;
  transform: translateY(-1px);
  color: #11111d;
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   5. BLOG LISTING PAGE — DARK EDITORIAL MAGAZINE
   -------------------------------------------------------------------------- */
.ap-blog-listing {
  background: #11111d;
  font-family: 'Outfit', sans-serif;
  padding: 0 0 80px;
  margin: -65px 0 0;
  padding-top: 65px;
}

/* — Hero ----------------------------------------------------------------- */
.ap-blog-hero {
  position: relative;
  padding: 80px 24px 60px;
  text-align: center;
  overflow: hidden;
}

.ap-blog-hero-glow {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  width: 700px;
  height: 500px;
  background: radial-gradient(ellipse at center, rgba(78,205,196,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.ap-blog-hero-pinwheel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.04;
  pointer-events: none;
  z-index: 0;
}

.ap-blog-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 700px;
  margin: 0 auto;
  position: relative;
}

.ap-blog-eyebrow {
  display: block;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #4ecdc4;
  margin-bottom: 16px;
}

.ap-blog-hero-title {
  font-family: 'Outfit', sans-serif;
  font-size: 52px;
  font-weight: 400;
  color: #ffffff;
  margin: 0 0 16px;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.ap-blog-accent {
  color: #4ecdc4;
}

.ap-blog-hero-subtitle {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 300;
  color: #8b8d97;
  margin: 0 0 36px;
  line-height: 1.6;
}

/* Stats capsule */
.ap-blog-stats {
  display: inline-flex;
  align-items: center;
  gap: 24px;
  padding: 16px 32px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 60px;
}

.ap-blog-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.ap-blog-stat-num {
  font-family: 'Outfit', sans-serif;
  font-size: 22px;
  font-weight: 600;
  color: #4ecdc4;
}

.ap-blog-stat-label {
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  color: #8b8d97;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.ap-blog-stat-divider {
  width: 1px;
  height: 32px;
  background: rgba(255, 255, 255, 0.08);
}

/* — Section label (e.g. "Editor's Picks") -------------------------------- */
.ap-blog-section-label {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 16px;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #4ecdc4;
}

/* — Category sections ---------------------------------------------------- */
.ap-blog-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 52px;
}

.ap-blog-section-header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ap-blog-section-title {
  font-family: 'Outfit', sans-serif;
  font-size: 24px;
  font-weight: 400;
  color: #fff;
  margin: 0;
  letter-spacing: -0.2px;
}

.ap-blog-section-count {
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 400;
  color: #51545e;
  white-space: nowrap;
}

/* — Carousel ------------------------------------------------------------- */
.ap-blog-carousel {
  position: relative;
}

.ap-blog-carousel-track {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 4px 0 12px;
  mask-image: linear-gradient(to right, transparent, #000 2px, #000 calc(100% - 40px), transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, #000 2px, #000 calc(100% - 40px), transparent);
}

.ap-blog-carousel-track::-webkit-scrollbar {
  display: none;
}

/* — Carousel cards ------------------------------------------------------- */
.ap-blog-carousel-card {
  flex: 0 0 320px;
  scroll-snap-align: start;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 28px 24px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: transform 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease, background 0.35s ease;
  position: relative;
}

.ap-blog-carousel-card:hover {
  transform: translateY(-3px);
  border-color: rgba(78, 205, 196, 0.2);
  background: rgba(78, 205, 196, 0.03);
  box-shadow: 0 8px 32px rgba(78, 205, 196, 0.05);
}

.ap-blog-carousel-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.ap-blog-carousel-card-title {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.35;
  color: #fff;
  margin: 0 0 10px;
  transition: color 0.3s;
}

.ap-blog-carousel-card:hover .ap-blog-carousel-card-title {
  color: #4ecdc4;
}

.ap-blog-carousel-card-desc {
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 300;
  line-height: 1.55;
  color: #8b8d97;
  margin: 0;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ap-blog-carousel-card-arrow {
  display: inline-block;
  margin-top: 16px;
  font-size: 18px;
  color: #4ecdc4;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.3s, transform 0.3s;
}

.ap-blog-carousel-card:hover .ap-blog-carousel-card-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* — Carousel nav buttons ------------------------------------------------- */
.ap-blog-carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(17, 17, 29, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, opacity 0.3s;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.ap-blog-carousel-btn:hover {
  background: rgba(78, 205, 196, 0.15);
  border-color: rgba(78, 205, 196, 0.3);
}

.ap-blog-carousel-btn[disabled] {
  opacity: 0.15;
  cursor: default;
  pointer-events: none;
}

.ap-blog-carousel-prev {
  left: -16px;
}

.ap-blog-carousel-next {
  right: -16px;
}

/* — Shared card meta used in featured + carousel ------------------------- */
.ap-blog-card-category {
  display: inline-block;
  background: rgba(78, 205, 196, 0.12);
  color: #4ecdc4;
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 80px;
  white-space: nowrap;
}

.ap-blog-card-read-time {
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  color: #51545e;
}

/* — Bottom CTA ----------------------------------------------------------- */
.ap-blog-bottom-cta {
  max-width: 720px;
  margin: 60px auto 0;
  padding: 48px 40px 56px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  text-align: center;
}

.ap-blog-bottom-cta-title {
  font-family: 'Outfit', sans-serif;
  font-size: 28px;
  font-weight: 400;
  color: #ffffff;
  margin: 0 0 12px;
}

.ap-blog-bottom-cta-text {
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 300;
  color: #8b8d97;
  margin: 0 0 28px;
  line-height: 1.6;
}

.ap-blog-bottom-cta-btn {
  display: inline-block;
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 500;
  color: #11111d;
  background: #4ecdc4;
  padding: 14px 32px;
  border-radius: 80px;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s;
}

.ap-blog-bottom-cta-btn:hover {
  background: #5fd6ce;
  transform: translateY(-1px);
  color: #11111d;
  text-decoration: none;
}

/* — Grain texture overlay ------------------------------------------------ */
.ap-blog-grain {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  mix-blend-mode: overlay;
}

/* — Hero decorative line (rainbow gradient) ------------------------------ */
.ap-blog-hero-line {
  width: 60px;
  height: 3px;
  background-image: linear-gradient(110deg, #ce4a5e, #7b6dce 25%, #43b9e6 50%, #49e8af 75%, #f29161);
  background-size: 200% 200%;
  animation: blog-rainbow-line 8s linear infinite;
  margin: 0 auto 20px;
  border-radius: 2px;
}
@keyframes blog-rainbow-line {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* — Featured Articles Section -------------------------------------------- */
.ap-blog-featured-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 48px;
}
.ap-blog-featured {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Hero featured card — large, side-by-side layout */
.ap-blog-feat {
  display: flex;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}
.ap-blog-feat:hover {
  transform: translateY(-3px);
  border-color: rgba(78, 205, 196, 0.25);
  box-shadow: 0 12px 48px rgba(78, 205, 196, 0.06);
}

/* Hero featured — the main large one */
.ap-blog-feat--hero {
  background: rgba(78, 205, 196, 0.03);
  border-color: rgba(78, 205, 196, 0.1);
}
.ap-blog-feat--hero .ap-blog-feat-demo {
  flex: 0 0 50%;
  max-width: 50%;
  padding: 24px;
  display: flex;
  align-items: stretch;
}
.ap-blog-feat--hero .ap-blog-feat-demo .bp-demo-box,
.ap-blog-feat--hero .ap-blog-feat-demo .bp-demo-inner {
  width: 100%;
}
.ap-blog-feat--hero .ap-blog-feat-demo .bp-demo-canvas {
  height: 340px;
  min-height: 340px;
  max-height: 340px;
  overflow: hidden;
}
.ap-blog-feat--hero .ap-blog-feat-body {
  flex: 1;
  padding: 36px 36px 36px 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.ap-blog-feat-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.ap-blog-feat-title {
  font-family: 'Outfit', sans-serif;
  font-size: 32px;
  font-weight: 400;
  line-height: 1.2;
  color: #fff;
  margin: 0 0 14px;
  letter-spacing: -0.3px;
  transition: color 0.3s;
}
.ap-blog-feat:hover .ap-blog-feat-title {
  color: #4ecdc4;
}
.ap-blog-feat-desc {
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 300;
  line-height: 1.6;
  color: #8b8d97;
  margin: 0 0 20px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ap-blog-feat-link {
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #4ecdc4;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ap-blog-feat-arrow {
  display: inline-block;
  transition: transform 0.3s;
}
.ap-blog-feat:hover .ap-blog-feat-arrow {
  transform: translateX(4px);
}

/* Secondary featured — two smaller cards side by side */
.ap-blog-feat-secondary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.ap-blog-feat--small {
  flex-direction: column;
}
.ap-blog-feat-demo--small {
  padding: 16px 16px 0;
}
.ap-blog-feat-canvas--small {
  height: 200px !important;
  min-height: 200px !important;
  max-height: 200px !important;
  overflow: hidden !important;
}
.ap-blog-feat--small .ap-blog-feat-body {
  padding: 20px 24px 24px;
}
.ap-blog-feat-title--small {
  font-size: 22px !important;
  margin-bottom: 12px !important;
}

/* Featured entrance animation */
@keyframes featIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.ap-blog-feat--hero {
  animation: featIn 0.6s ease forwards;
}
.ap-blog-feat-secondary .ap-blog-feat:nth-child(1) {
  opacity: 0;
  animation: featIn 0.5s ease 0.15s forwards;
}
.ap-blog-feat-secondary .ap-blog-feat:nth-child(2) {
  opacity: 0;
  animation: featIn 0.5s ease 0.3s forwards;
}

/* — Latest badge --------------------------------------------------------- */
.ap-blog-card-badge {
  display: inline-block;
  background: #4ecdc4;
  color: #11111d;
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 80px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* — Section entrance animation ------------------------------------------- */
@keyframes sectionFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ap-blog-section {
  opacity: 0;
  animation: sectionFadeIn 0.5s ease forwards;
}

.ap-blog-section:nth-child(1) { animation-delay: 0s; }
.ap-blog-section:nth-child(2) { animation-delay: 0.06s; }
.ap-blog-section:nth-child(3) { animation-delay: 0.12s; }
.ap-blog-section:nth-child(4) { animation-delay: 0.18s; }
.ap-blog-section:nth-child(5) { animation-delay: 0.24s; }
.ap-blog-section:nth-child(6) { animation-delay: 0.30s; }
.ap-blog-section:nth-child(7) { animation-delay: 0.36s; }
.ap-blog-section:nth-child(8) { animation-delay: 0.42s; }

/* --------------------------------------------------------------------------
   6. RESPONSIVE
   -------------------------------------------------------------------------- */

/* Tablet (768-1024px) */
@media (max-width: 1024px) {
  /* Article page */
  .ap-blog-content {
    flex-direction: column;
  }

  .ap-blog-body {
    max-width: 100%;
  }

  .ap-blog-toc {
    flex: none;
    position: static;
    width: 100%;
    max-height: none;
    margin-bottom: 40px;
    order: -1;
  }

  .ap-blog-toc-heading {
    display: none;
  }

  .ap-blog-toc-toggle {
    display: block;
  }

  .ap-blog-toc ol {
    display: none;
  }

  .ap-blog-toc ol.ap-blog-toc-open {
    display: block;
  }

  /* Listing page */
  .ap-blog-hero-title {
    font-size: 42px;
  }

  .ap-blog-carousel-btn {
    width: 36px;
    height: 36px;
  }

  .ap-blog-carousel-prev {
    left: -12px;
  }

  .ap-blog-carousel-next {
    right: -12px;
  }

  .ap-blog-carousel-card {
    flex: 0 0 280px;
  }

  /* Featured section */
  .ap-blog-feat--hero {
    flex-direction: column;
  }
  .ap-blog-feat--hero .ap-blog-feat-demo {
    flex: none;
    max-width: 100%;
  }
  .ap-blog-feat--hero .ap-blog-feat-body {
    padding: 24px 28px 28px;
  }
  .ap-blog-feat-title {
    font-size: 26px;
  }
}

/* Mobile (<768px) */
@media (max-width: 767px) {
  /* Article page */
  .ap-blog-article {
    padding: 0 16px 60px;
  }

  .ap-blog-header {
    padding: 40px 0 28px;
  }

  .ap-blog-title {
    font-size: 32px;
    letter-spacing: -0.32px;
  }

  .ap-blog-body h2 {
    font-size: 26px;
    margin-top: 36px;
  }

  .ap-blog-body h3 {
    font-size: 18px;
  }

  .ap-blog-body p,
  .ap-blog-body ul,
  .ap-blog-body ol {
    font-size: 16px;
  }

  .ap-blog-body table {
    font-size: 14px;
  }

  .ap-blog-body thead th,
  .ap-blog-body tbody td {
    padding: 8px 10px;
  }

  .ap-blog-cta {
    padding: 36px 24px;
    border-radius: 16px;
  }

  .ap-blog-cta-title {
    font-size: 22px;
  }

  /* Listing page */
  .ap-blog-hero {
    padding: 60px 16px 40px;
  }

  .ap-blog-hero-title {
    font-size: 36px;
  }

  .ap-blog-hero-subtitle {
    font-size: 16px;
  }

  .ap-blog-stats {
    flex-direction: column;
    gap: 16px;
    border-radius: 20px;
    padding: 24px;
  }

  .ap-blog-stat-divider {
    width: 40px;
    height: 1px;
  }

  /* Carousel — mobile */
  .ap-blog-section {
    padding: 0 16px 40px;
  }

  .ap-blog-section-title {
    font-size: 20px;
  }

  .ap-blog-carousel-card {
    flex: 0 0 260px;
    padding: 22px 20px;
  }

  .ap-blog-carousel-card-title {
    font-size: 16px;
  }

  .ap-blog-carousel-card-desc {
    font-size: 13px;
    -webkit-line-clamp: 2;
  }

  .ap-blog-carousel-btn {
    display: none;
  }

  .ap-blog-carousel-track {
    mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 32px), transparent);
    -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 32px), transparent);
  }

  .ap-blog-section-label {
    padding: 0 16px 12px;
  }

  .ap-blog-bottom-cta {
    margin: 40px 16px 0;
    padding: 36px 24px;
    border-radius: 16px;
  }

  .ap-blog-bottom-cta-title {
    font-size: 22px;
  }

  /* Featured section — mobile */
  .ap-blog-featured-wrap {
    padding: 0 16px 32px;
  }
  .ap-blog-feat--hero {
    flex-direction: column;
  }
  .ap-blog-feat--hero .ap-blog-feat-demo {
    flex: none;
    max-width: 100%;
    padding: 16px 16px 0;
  }
  .ap-blog-feat--hero .ap-blog-feat-demo .bp-demo-canvas {
    height: 260px;
    min-height: 260px;
    max-height: 260px;
  }
  .ap-blog-feat--hero .ap-blog-feat-body {
    padding: 20px 20px 24px;
  }
  .ap-blog-feat-title {
    font-size: 22px;
  }
  .ap-blog-feat-desc {
    font-size: 14px;
    -webkit-line-clamp: 2;
  }
  .ap-blog-feat-secondary {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .ap-blog-feat-canvas--small {
    height: 180px !important;
    min-height: 180px !important;
    max-height: 180px !important;
  }
  .ap-blog-feat-title--small {
    font-size: 18px !important;
  }
  .ap-blog-feat--small .ap-blog-feat-body {
    padding: 16px 20px 20px;
  }
}

/* --------------------------------------------------------------------------
   7. PRINT
   -------------------------------------------------------------------------- */
@media print {
  .ap-blog-toc,
  .ap-blog-cta,
  .ap-blog-carousel-btn,
  .ap-blog-meta {
    display: none !important;
  }

  .ap-blog-article,
  .ap-blog-body {
    max-width: 100%;
    padding: 0;
  }

  .ap-blog-content {
    display: block;
  }

  .ap-blog-title {
    font-size: 28px;
  }

  .ap-blog-body a {
    color: #11111d;
    border-bottom: none;
  }

  .ap-blog-body a::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #8b8d97;
  }
}

/* --------------------------------------------------------------------------
   8. UTILITY — SCROLL-MARGIN FOR ANCHORED HEADINGS
   -------------------------------------------------------------------------- */
.ap-blog-body h2[id],
.ap-blog-body h3[id],
.ap-blog-body h4[id] {
  scroll-margin-top: 100px;
}

/* --------------------------------------------------------------------------
   9. BLOG POST ANIMATED DEMOS
   -------------------------------------------------------------------------- */
.bp-demo-section {
  margin: 0 0 36px;
}
.bp-demo-box {
  width: 100%;
  border-radius: 16px;
  padding: 2px;
  background: rgba(78, 205, 196, 0.2);
  box-shadow: 0 0 40px rgba(78, 205, 196, 0.06), 0 0 80px rgba(78, 205, 196, 0.03);
}
.bp-demo-inner {
  background: #11111d;
  border-radius: 14px;
  overflow: hidden;
}
.bp-demo-canvas {
  width: 100%;
  height: 340px;
  display: flex;
  flex-direction: column;
  font-family: 'Outfit', sans-serif;
  position: relative;
  overflow: hidden;
}
@media (max-width: 767px) {
  .bp-demo-section { margin: 0 auto 28px; }
  .bp-demo-canvas { height: 300px; }
}
