/* Blog Posts uses Work carousel markup (.cew-work-*). Blog-only layout + responsive overrides. */

.cew-work-section.cew-blog-posts {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.cew-work-section.cew-blog-posts .cew-work-layout {
  min-width: 0;
}

.cew-work-section.cew-blog-posts .cew-work-scroll {
  min-width: 0;
}

/* Bottom toolbar: CTA on the left, prev/next on the right (no dot column). */
.cew-work-section.cew-blog-posts .cew-work-bottom-row-box {
  justify-content: space-between !important;
  flex-wrap: wrap;
  row-gap: 0.5rem;
  column-gap: 0.75rem;
}

.cew-work-section.cew-blog-posts .cew-work-pagination-wrap {
  display: none !important;
}

.cew-work-section.cew-blog-posts .cew-work-cta-wrap {
  flex: 0 1 auto;
  justify-content: flex-start;
  min-width: 0;
}

.cew-work-section.cew-blog-posts .cew-work-nav-wrap {
  flex: 0 0 auto;
  justify-content: flex-end;
  min-width: 0;
}

/* CTA can shrink on narrow rows without breaking the bar */
.cew-work-section.cew-blog-posts .cew-work-cta-wrap .cta-wrapper {
  max-width: 100%;
  min-width: 0;
}

.cew-work-section.cew-blog-posts .cew-work-cta-wrap .cta-btn {
  max-width: 100%;
}

.cew-work-section .cew-blog-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.cew-work-section .cew-blog-author-avatar {
  display: block;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  overflow: hidden;
  flex-shrink: 0;
}

.cew-work-section .cew-blog-author-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ─── Tablet: tune card width so the 2-up carousel breathes on medium widths ─── */
@media (min-width: 768px) and (max-width: 1024px) {
  .cew-work-section.cew-blog-posts .cew-work-card {
    width: clamp(240px, calc(45vw - 1rem), 520px);
    min-width: min(240px, calc(100vw - 2rem));
  }

  .cew-work-section.cew-blog-posts .cew-work-scroll {
    gap: 1rem;
  }

  .cew-work-section.cew-blog-posts .cew-work-bottom-row-box {
    padding-left: max(0px, env(safe-area-inset-left, 0px));
    padding-right: max(0px, env(safe-area-inset-right, 0px));
  }
}

@media (min-width: 640px) {
  .cew-work-section .cew-blog-author-avatar {
    width: 1.75rem;
    height: 1.75rem;
  }
}

/* ─── Mobile: horizontal carousel + toolbar (Work stacks non-blog at this breakpoint) ─── */
@media (max-width: 767px) {
  .cew-work-section.cew-blog-posts .cew-work-scroll {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap;
    gap: clamp(0.75rem, 2.5vw, 1rem) !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x mandatory;
    padding: 0 0 0.25rem !important;
    padding-left: max(0.25rem, env(safe-area-inset-left, 0px)) !important;
    padding-right: max(0.25rem, env(safe-area-inset-right, 0px)) !important;
    scrollbar-width: none;
    -ms-overflow-style: none;
    width: 100%;
    max-width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }

  .cew-work-section.cew-blog-posts .cew-work-scroll::-webkit-scrollbar {
    display: none;
  }

  .cew-work-section.cew-blog-posts .cew-work-card {
    /* One card per slide: width follows the carousel track (column), not 100vw — avoids two-up + clipping */
    box-sizing: border-box;
    width: min(560px, 100%) !important;
    flex: 0 0 min(560px, 100%) !important;
    min-width: 0 !important;
    max-width: 100%;
    flex-shrink: 0 !important;
    scroll-snap-align: center;
    scroll-snap-stop: always;
  }

  .cew-work-section.cew-blog-posts .cew-work-nav {
    display: flex !important;
  }

  .cew-work-section.cew-blog-posts .cew-work-pagination {
    display: flex !important;
  }

  .cew-work-section.cew-blog-posts .cew-work-bottom-row {
    display: block !important;
    margin-top: 0.5rem;
    padding-left: max(0px, env(safe-area-inset-left, 0px));
    padding-right: max(0px, env(safe-area-inset-right, 0px));
  }

  .cew-work-section.cew-blog-posts .cew-work-nav .cew-nav-btn {
    width: 3rem;
    height: 3rem;
  }

  /* Slightly more readable type on small screens */
  .cew-work-section.cew-blog-posts .cew-card-title {
    font-size: clamp(0.9375rem, 4.2vw, 1.25rem);
  }

  .cew-work-section.cew-blog-posts .cew-card-excerpt {
    font-size: clamp(0.8125rem, 3.4vw, 1rem);
  }

  .cew-work-section.cew-blog-posts .cew-card-tags {
    font-size: clamp(0.75rem, 3.2vw, 0.9375rem);
  }

  .cew-work-section.cew-blog-posts .cew-work-image-wrap {
    margin-bottom: 0.625rem;
  }
}

/* Very narrow phones: smaller nav + tighter bottom bar */
@media (max-width: 380px) {
  .cew-work-section.cew-blog-posts .cew-work-nav .cew-nav-btn {
    width: 2.75rem;
    height: 2.75rem;
  }

  .cew-work-section.cew-blog-posts .cew-work-bottom-row-box {
    column-gap: 0.5rem;
  }
}
