.cew-work-section {
  padding: 0 !important;
  padding-top: 0 !important;
  padding-right: 0 !important;
  padding-bottom: 0 !important;
  padding-left: 0 !important;
}

.cew-work-container {
  margin: 0;
  padding: 0 !important;
  width: 100%;
  max-width: 100%;
}

.cew-work-layout {
  display: flex;
  flex-direction: column;
  width: 100%;
  align-items: stretch;
  /* Space between cards row and nav; overridden by Style → Navigation → Space between nav & cards */
  gap: 0.75rem;
}

/* Tablet + desktop: horizontal strip + nav */
.cew-work-scroll {
  display: flex;
  flex-direction: row;
  gap: 20px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 0 0.25rem;
  /*
   * Disable forced scroll snapping.
   * Our JS centers a 2-card window by controlling scrollLeft + padding.
   * "mandatory" snapping can override that and cause the first card to drift
   * relative to the active dot.
   */
  scroll-snap-type: none;
  scrollbar-width: none;
  -ms-overflow-style: none;
  width: 100%;
  max-width: 100%;
  flex: 1 1 auto;
  min-height: 0;
}

.cew-work-scroll::-webkit-scrollbar {
  display: none;
}

.cew-work-nav {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  width: 100%;
  margin: 0;
  clear: both;
}

.cew-work-bottom-row {
  width: 100%;
  margin-top: 0.5rem;
}

.cew-work-bottom-row-box {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.cew-work-pagination-wrap {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
}

.cew-work-cta-wrap {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cew-work-nav-wrap {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

/* Work bottom toolbar: keep dots centered (Blog overrides its own layout). */
.cew-work-section:not(.cew-blog-posts) .cew-work-bottom-row-box {
  justify-content: space-between;
}

.cew-work-section:not(.cew-blog-posts) .cew-work-cta-wrap {
  flex: 0 0 auto;
  justify-content: flex-start;
}

.cew-work-section:not(.cew-blog-posts) .cew-work-pagination-wrap {
  flex: 1 1 auto;
  justify-content: center;
}

.cew-work-section:not(.cew-blog-posts) .cew-work-nav-wrap {
  flex: 0 0 auto;
  justify-content: flex-end;
}

/* Scoped under .cew-work-section so Elementor/theme div rules cannot flatten layout */
.cew-work-section .cew-work-pagination {
  display: flex !important;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: center;
  margin-top: 0;
  width: auto;
  min-width: 0;
}

.cew-work-section .cew-work-pagination-dots {
  display: flex !important;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
}

.cew-work-dot {
  width: 10px;
  height: 10px;
  padding: 0;
  border-radius: 999px;
  border: none;
  background: rgba(17, 17, 17, 0.35);
  cursor: pointer;
  box-sizing: border-box;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.cew-work-dot:hover {
  transform: scale(1.1);
}

.cew-work-dot.is-active {
  background: #111;
}

.cew-work-section .cew-work-nav .cew-nav-btn {
  padding: 0 !important;
}

.cew-work-nav .cew-nav-btn {
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 999px;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  background: var(--e-global-color-accent, #111);
  cursor: pointer;
  line-height: 1;
  transition: background-color 0.2s ease;
  flex-shrink: 0;
}

.cew-work-nav .cew-nav-btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  line-height: 1;
  color: #fff;
  pointer-events: none;
}

.cew-work-nav .cew-nav-btn-icon svg {
  display: block;
  margin: 0;
  flex-shrink: 0;
}

.cew-work-nav .cew-nav-btn-icon i {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  line-height: 1;
  flex-shrink: 0;
}

.cew-work-nav .cew-nav-prev .cew-nav-btn-icon {
  transform: translateX(-4%);
}

.cew-work-nav .cew-nav-next .cew-nav-btn-icon {
  transform: translateX(4%);
}

.cew-work-nav .cew-nav-btn:hover {
  background: #333;
}

.cew-work-nav .cew-nav-btn.cew-is-disabled {
  cursor: not-allowed;
  background: #cfcfcf;
  opacity: 1;
  pointer-events: none;
}

.cew-work-nav .cew-nav-btn.cew-is-disabled .cew-nav-btn-icon {
  color: #6f6f6f;
}

.cew-work-nav .cew-nav-btn.cew-is-disabled .cew-nav-btn-icon svg,
.cew-work-nav .cew-nav-btn.cew-is-disabled .cew-nav-btn-icon svg path {
  fill: #6f6f6f;
}

.cew-work-nav .cew-nav-btn:focus:not(:focus-visible) {
  outline: none;
}

.cew-work-nav .cew-nav-btn:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.cew-work-dot:focus:not(:focus-visible) {
  outline: none;
}

.cew-work-dot:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.cew-work-card {
  width: clamp(260px, calc(100vw - 4rem), 560px);
  min-width: 260px;
  max-width: 100%;
  flex-shrink: 0;
  scroll-snap-align: center;
  text-decoration: none !important;
  color: inherit;
  border: none;
  box-shadow: none;
}

.cew-work-card:hover,
.cew-work-card:focus,
.cew-work-card:focus-visible,
.cew-work-card:active,
.cew-work-card:visited {
  text-decoration: none !important;
}

.cew-work-card .cew-card-title,
.cew-work-card .cew-card-excerpt,
.cew-work-card .cew-card-tags {
  text-decoration: none !important;
}

.cew-work-card-content {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.cew-work-image-wrap {
  width: 100%;
  /* Height optional: Style → Cards → Image height (responsive) sets height + aspect-ratio: auto */
  aspect-ratio: 508 / 286;
  overflow: hidden;
  border-radius: 1rem;
  background: #ececec;
  margin-bottom: 0.75rem;
}

.cew-work-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.cew-work-card:hover .cew-work-image {
  transform: scale(1.05);
}

.cew-work-card .cew-card-title {
  margin: 0;
  font-size: clamp(1rem, 2vw, 1.5rem);
  line-height: 1.25;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cew-work-card .cew-card-excerpt {
  margin: 0;
  color: #111;
  line-height: 1.5;
  font-size: clamp(0.75rem, 1.5vw, 1rem);
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cew-work-card .cew-card-excerpt:last-child {
  margin-bottom: 0;
}

/* Tags / services line under title + description (plain text, regular weight) */
.cew-work-card .cew-card-tags {
  margin: 0;
  padding: 0;
  color: #111;
  font-size: clamp(0.75rem, 1.5vw, 1rem);
  line-height: 1.5;
  font-weight: 400;
}

.cew-work-empty {
  width: 100%;
  text-align: center;
  padding: 3rem 0;
  color: #666;
}

/* Mobile: vertical stack, hide arrows/dots, show CTA only */
@media (max-width: 767px) {
  .cew-work-scroll {
    flex-direction: column;
    overflow-x: visible;
    overflow-y: visible;
    scroll-snap-type: none;
    padding: 0;
  }

  .cew-work-card {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    scroll-snap-align: none;
  }

  .cew-work-nav {
    display: none !important;
  }

  .cew-work-section .cew-work-pagination {
    display: none !important;
  }

  /*
   * For the Work widget we stack cards on mobile, so carousel arrows are hidden.
   * Keep the CTA visible by showing the bottom row and hiding only dot/nav areas.
   * (Blog posts have their own mobile toolbar layout in blog-posts/style.css.)
   */
  .cew-work-section:not(.cew-blog-posts) .cew-work-bottom-row {
    display: block !important;
    margin-top: 0.5rem;
  }

  .cew-work-section:not(.cew-blog-posts) .cew-work-bottom-row-box {
    justify-content: center !important;
  }

  .cew-work-section:not(.cew-blog-posts) .cew-work-pagination-wrap {
    display: none !important;
  }

  .cew-work-section:not(.cew-blog-posts) .cew-work-nav-wrap {
    display: none !important;
  }
}

.cew-work-bottom-row .cew-work-nav {
  width: auto;
  margin-left: auto;
}

@media (min-width: 768px) {
  .cew-work-scroll {
    /* Keep gap small so JS "two-card centered" math can fit inside ~1140px view */
    gap: 1rem;
  }

  .cew-work-nav .cew-nav-btn {
    width: 3rem;
    height: 3rem;
  }
}
