/**
 * DMEB Posts — blog index (featured article, toolbar, article grid) and blog
 * carousel.
 *
 * Design: flat light-grey section, white cards, navy display type, gold as the
 * editorial accent, teal reserved for functional moments (search focus, card
 * title on hover). Movement is deliberately restrained — fade plus 8–18px on
 * entrance, 2–5px lift on hover, 300–400ms position changes while filtering.
 *
 * Everything is scoped under `.dmeb-blog` or `.dmeb-carousel` so it cannot leak
 * into Elementor or theme styles.
 *
 * @package DMEB_Posts
 */

/* ------------------------------------------------------------------ *
 * Tokens
 * ------------------------------------------------------------------ */

.dmeb-blog,
.dmeb-carousel {
  /* Palette */
  --dmeb-navy: #0f2a3b;
  --dmeb-navy-soft: #29404d;
  --dmeb-body: #334b59;
  --dmeb-excerpt: #425865;
  --dmeb-meta: #455c68;
  --dmeb-gold: #b8934a;
  --dmeb-gold-hover: #a6813e;
  --dmeb-teal: #1c7c74;
  --dmeb-section-bg: #f2f3f1;
  --dmeb-chip-bg: #e8eae7;
  --dmeb-chip-hover: #dee2de;
  --dmeb-hairline: rgba(15, 42, 59, 0.1);
  --dmeb-field-border: rgba(15, 42, 59, 0.14);

  /* Surfaces */
  --dmeb-radius: 8px;
  --dmeb-radius-image: 8px;
  --dmeb-shadow-card: 0 4px 14px rgba(15, 42, 59, 0.035);
  --dmeb-shadow-card-hover: 0 14px 30px rgba(15, 42, 59, 0.1);
  --dmeb-shadow-featured: 0 8px 24px rgba(15, 42, 59, 0.06);
  --dmeb-shadow-button: 0 8px 18px rgba(184, 147, 74, 0.22);

  /* Metrics */
  --dmeb-prose-width: min(1180px, calc(100% - 48px));
  --dmeb-prose-max: 1180px;
  --dmeb-card-ratio: 1.55 / 1;
  --dmeb-card-gap-x: 24px;
  --dmeb-card-gap-y: 28px;

  /* Motion */
  --dmeb-ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --dmeb-ease-soft: ease;
  --dmeb-hover-fast: 0.22s;
  --dmeb-hover-mid: 0.28s;
  --dmeb-image-zoom: 0.45s;
  --dmeb-reveal: 0.48s;
  --dmeb-flip: 0.32s;
  --dmeb-filter-out: 0.16s;
  --dmeb-filter-in: 0.3s;

  box-sizing: border-box;
}

.dmeb-blog *,
.dmeb-blog *::before,
.dmeb-blog *::after,
.dmeb-carousel *,
.dmeb-carousel *::before,
.dmeb-carousel *::after {
  box-sizing: border-box;
}

/* ------------------------------------------------------------------ *
 * Shared: the article card
 * ------------------------------------------------------------------ */

.dmeb-blog .blog-card,
.dmeb-carousel .blog-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  margin: 0;
  background: #fff;
  border-radius: var(--dmeb-radius);
  overflow: hidden;
  box-shadow: var(--dmeb-shadow-card);
  transition:
    transform var(--dmeb-hover-mid) var(--dmeb-ease-out),
    box-shadow var(--dmeb-hover-mid) var(--dmeb-ease-soft);
}

/* The card sits in a `<figure>`-free wrapper so a post with no featured image
   still reserves the same box and every card stays the same height. */
.dmeb-blog .blog-card__image-wrap,
.dmeb-carousel .blog-card__image-wrap {
  overflow: hidden;
  aspect-ratio: var(--dmeb-card-ratio);
  background: #e9ece9;
}

.dmeb-blog .blog-card__image-wrap img,
.dmeb-carousel .blog-card__image-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: cover;
  transition: transform var(--dmeb-image-zoom) var(--dmeb-ease-out);
}

.dmeb-blog .blog-card__image-wrap--placeholder,
.dmeb-carousel .blog-card__image-wrap--placeholder {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #e6eae7 0%, #d9dfdb 100%);
  color: var(--dmeb-teal);
}

.dmeb-blog .blog-card__placeholder,
.dmeb-carousel .blog-card__placeholder {
  display: inline-flex;
  opacity: 0.75;
}

.dmeb-blog .blog-card__body,
.dmeb-carousel .blog-card__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  padding: 18px 18px 16px;
}

.dmeb-blog .blog-card__category,
.dmeb-carousel .blog-card__category {
  margin: 0 0 8px;
  color: var(--dmeb-gold);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.dmeb-blog .blog-card__title,
.dmeb-carousel .blog-card__title {
  display: -webkit-box;
  margin: 0 0 10px;
  overflow: hidden;
  color: var(--dmeb-navy);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.18;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.dmeb-carousel .blog-card__title {
  -webkit-line-clamp: 3;
}

.dmeb-blog .blog-card__link,
.dmeb-carousel .blog-card__link {
  color: inherit;
  text-decoration: none;
  transition: color var(--dmeb-hover-fast) var(--dmeb-ease-soft);
}

/* The whole card is the click target, not just the title. */
.dmeb-blog .blog-card__link[data-dmeb-stretch]::after,
.dmeb-carousel .blog-card__link[data-dmeb-stretch]::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}

.dmeb-blog .blog-card:focus-within,
.dmeb-carousel .blog-card:focus-within {
  outline: 2px solid var(--dmeb-teal);
  outline-offset: 3px;
}

.dmeb-blog .blog-card__excerpt,
.dmeb-carousel .blog-card__excerpt {
  display: -webkit-box;
  margin: 0 0 18px;
  overflow: hidden;
  color: var(--dmeb-excerpt);
  font-size: 15px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.dmeb-blog .blog-card__meta,
.dmeb-carousel .blog-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: auto;
  padding-top: 14px;
  color: var(--dmeb-meta);
  font-size: 13px;
}

/* Metadata pair: gold icon, 7px to the label. */
.article-meta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--dmeb-meta);
  font-size: 14px;
  line-height: 1.3;
}

.dmeb-blog .article-meta,
.dmeb-carousel .blog-card__meta .article-meta {
  font-size: 13px;
}

.article-meta__icon {
  display: inline-flex;
  flex: 0 0 auto;
  color: var(--dmeb-gold);
}

.article-meta__icon svg {
  display: block;
}

/* Decorative call to action inside a card — the card itself is the link. */
.blog-card__cta {
  margin: 16px 0 0;
}

.blog-card__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 18px;
  background: var(--dmeb-gold);
  border-radius: var(--dmeb-radius);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  transition:
    background-color var(--dmeb-hover-fast) var(--dmeb-ease-soft),
    transform var(--dmeb-hover-fast) var(--dmeb-ease-soft);
}

.blog-card__button-icon {
  display: inline-flex;
  transition: transform var(--dmeb-hover-fast) var(--dmeb-ease-soft);
}

/* Hover: 5px lift, 1.035 image zoom, slightly stronger shadow, title to teal.
   No surface colour change. */
@media (hover: hover) {
  .dmeb-blog .blog-card:hover,
  .dmeb-blog .blog-card:focus-within,
  .dmeb-carousel .blog-card:hover,
  .dmeb-carousel .blog-card:focus-within {
    transform: translateY(-5px);
    box-shadow: var(--dmeb-shadow-card-hover);
  }

  .dmeb-blog .blog-card:hover .blog-card__image-wrap img,
  .dmeb-blog .blog-card:focus-within .blog-card__image-wrap img,
  .dmeb-carousel .blog-card:hover .blog-card__image-wrap img,
  .dmeb-carousel .blog-card:focus-within .blog-card__image-wrap img {
    transform: scale(1.035);
  }

  .dmeb-blog .blog-card:hover .blog-card__title,
  .dmeb-blog .blog-card:focus-within .blog-card__title,
  .dmeb-carousel .blog-card:hover .blog-card__title,
  .dmeb-carousel .blog-card:focus-within .blog-card__title {
    color: var(--dmeb-teal);
  }

  .dmeb-carousel .blog-card:hover .blog-card__button,
  .dmeb-blog .blog-card:hover .blog-card__button {
    background: var(--dmeb-gold-hover);
    transform: translateY(-2px);
  }

  .dmeb-carousel .blog-card:hover .blog-card__button-icon,
  .dmeb-blog .blog-card:hover .blog-card__button-icon {
    transform: translateX(4px);
  }
}

/* ------------------------------------------------------------------ *
 * Utilities
 * ------------------------------------------------------------------ */

/* Kept in the plugin rather than assumed from the theme or from WordPress's own
   screen-reader-text rule, which block themes do not always ship. The plugin
   labels its search field with this class, so an undefined rule means a visible
   stray label above the field. */
.dmeb-blog .screen-reader-text,
.dmeb-carousel .screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------------ *
 * Blog index
 * ------------------------------------------------------------------ */

.dmeb-blog {
  --dmeb-blog-bg: #f2f3f1;
  --dmeb-blog-pad: 34px 0 64px;

  display: block;
  width: 100%;
  max-width: 100%;
  padding: var(--dmeb-blog-pad);
  background: var(--dmeb-blog-bg);
  color: var(--dmeb-navy);
}

/* Content column. 1160–1200px on desktop, with breathing room on small ones. */
.dmeb-blog > .featured-article,
.dmeb-blog > .blog-toolbar,
.dmeb-blog > .blog-grid,
.dmeb-blog > .blog-empty,
.dmeb-blog > .blog-pagination {
  width: var(--dmeb-prose-width);
  max-width: var(--dmeb-prose-max);
  margin-inline: auto;
}

/* Full-width-only variant of the index (no grey, no side padding). */
.dmeb-blog--flush {
  --dmeb-blog-bg: transparent;
  --dmeb-blog-pad: 0;
}

/* --- Featured article --- */

.dmeb-blog .featured-article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  gap: 38px;
  align-items: center;
  margin-bottom: 34px;
}

.dmeb-blog .featured-article__media {
  display: block;
  width: 100%;
  overflow: hidden;
  aspect-ratio: 1.55 / 1;
  background: #e9ece9;
  border-radius: var(--dmeb-radius-image);
  box-shadow: var(--dmeb-shadow-featured);
}

.dmeb-blog .featured-article__media img {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: cover;
  transition: transform 0.5s var(--dmeb-ease-out);
}

.dmeb-blog .featured-article__media--placeholder {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #e6eae7 0%, #d9dfdb 100%);
  color: var(--dmeb-teal);
}

.dmeb-blog .featured-article__body {
  min-width: 0;
}

.dmeb-blog .featured-article__eyebrow {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 16px;
  color: var(--dmeb-gold);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dmeb-blog .featured-article__eyebrow::after {
  content: "";
  width: 38px;
  height: 3px;
  background: var(--dmeb-gold);
  border-radius: 2px;
}

.dmeb-blog .featured-article__category {
  margin: 0 0 8px;
  color: var(--dmeb-navy);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.dmeb-blog .featured-article__title {
  max-width: 650px;
  margin: 0 0 14px;
  color: var(--dmeb-navy);
  font-size: clamp(30px, 3vw, 40px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.01em;
}

.dmeb-blog .featured-article__link {
  color: inherit;
  text-decoration: none;
  transition: color var(--dmeb-hover-fast) var(--dmeb-ease-soft);
}

.dmeb-blog .featured-article__excerpt {
  max-width: 630px;
  margin: 0 0 20px;
  color: var(--dmeb-body);
  font-size: 17px;
  line-height: 1.5;
}

.dmeb-blog .featured-article__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 22px;
  color: var(--dmeb-body);
  font-size: 14px;
}

.dmeb-blog .featured-article__cta {
  margin: 22px 0 0;
}

.dmeb-blog .featured-article__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 24px;
  background: var(--dmeb-gold);
  border: 0;
  border-radius: var(--dmeb-radius);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition:
    transform var(--dmeb-hover-fast) var(--dmeb-ease-soft),
    background-color var(--dmeb-hover-fast) var(--dmeb-ease-soft),
    box-shadow var(--dmeb-hover-fast) var(--dmeb-ease-soft);
}

.dmeb-blog .featured-article__button-icon {
  display: inline-flex;
  transition: transform var(--dmeb-hover-fast) var(--dmeb-ease-soft);
}

@media (hover: hover) {
  .dmeb-blog .featured-article:hover .featured-article__media img,
  .dmeb-blog .featured-article:focus-within .featured-article__media img {
    transform: scale(1.025);
  }

  .dmeb-blog .featured-article__button:hover,
  .dmeb-blog .featured-article__button:focus {
    background: var(--dmeb-gold-hover);
    transform: translateY(-2px);
    box-shadow: var(--dmeb-shadow-button);
  }

  .dmeb-blog .featured-article__button:hover .featured-article__button-icon,
  .dmeb-blog .featured-article__button:focus .featured-article__button-icon {
    transform: translateX(4px);
  }

  .dmeb-blog .featured-article:hover .featured-article__title,
  .dmeb-blog .featured-article:focus-within .featured-article__title {
    color: var(--dmeb-teal);
  }
}

/* --- Toolbar: filters + search read as one horizontal strip --- */

.dmeb-blog .blog-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 30px 0 24px;
}

.dmeb-blog .blog-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.dmeb-blog .blog-filter {
  min-height: 42px;
  padding: 0 18px;
  background: var(--dmeb-chip-bg);
  border: 0;
  border-radius: 7px;
  color: var(--dmeb-navy-soft);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition:
    background-color 0.2s var(--dmeb-ease-soft),
    color 0.2s var(--dmeb-ease-soft),
    transform 0.2s var(--dmeb-ease-soft);
}

.dmeb-blog .blog-filter.is-active {
  background: var(--dmeb-gold);
  color: #fff;
}

.dmeb-blog .blog-filter:not(.is-active):hover {
  background: var(--dmeb-chip-hover);
  color: var(--dmeb-navy);
  transform: translateY(-1px);
}

.dmeb-blog .blog-filter:active {
  transform: scale(0.97);
}

.dmeb-blog .blog-filter:focus-visible {
  outline: 2px solid var(--dmeb-teal);
  outline-offset: 2px;
}

/* --- Search --- */

.dmeb-blog .blog-search {
  position: relative;
  flex: 0 0 280px;
  width: 280px;
}

.dmeb-blog .blog-search__input {
  width: 100%;
  height: 44px;
  padding: 0 16px 0 44px;
  background: #fff;
  border: 1px solid var(--dmeb-field-border);
  border-radius: 7px;
  color: var(--dmeb-navy);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition:
    border-color 0.2s var(--dmeb-ease-soft),
    box-shadow 0.2s var(--dmeb-ease-soft);
}

.dmeb-blog .blog-search__input::placeholder {
  color: #7c8b95;
}

.dmeb-blog .blog-search__icon {
  position: absolute;
  top: 50%;
  left: 15px;
  display: inline-flex;
  color: var(--dmeb-navy);
  transform: translateY(-50%);
  pointer-events: none;
}

.dmeb-blog .blog-search__icon svg {
  display: block;
}

.dmeb-blog .blog-search__input:focus {
  border-color: var(--dmeb-teal);
  box-shadow: 0 0 0 3px rgba(28, 124, 116, 0.1);
}

/* --- Grid --- */

.dmeb-blog .blog-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--dmeb-card-gap-y) var(--dmeb-card-gap-x);
}

.dmeb-blog .blog-grid.is-empty {
  display: none;
}

/* Filtering: soften the old set, rearrange, fade the new set in. */
.dmeb-blog .blog-grid.is-filtering .blog-card {
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity var(--dmeb-filter-out) var(--dmeb-ease-soft),
    transform var(--dmeb-filter-out) var(--dmeb-ease-soft);
}

.dmeb-blog .blog-card.is-hidden {
  display: none;
}

/* A card the visitor has just brought into view. A keyframe rather than a
   transition, so the outcome does not depend on class-removal order and a card
   can never be left stranded at zero opacity. */
.dmeb-blog .blog-card.is-entering {
  animation: blogFadeUp var(--dmeb-filter-in) var(--dmeb-ease-out) both;
}

/* FLIP: cards slide to their new grid positions instead of jumping. */
.dmeb-blog.is-flipping .blog-card {
  transition: transform var(--dmeb-flip) var(--dmeb-ease-out) !important;
}

/* --- Empty state --- */

.dmeb-blog .blog-empty {
  padding: 56px 20px;
  text-align: center;
}

.dmeb-blog .blog-empty[hidden] {
  display: none;
}

.dmeb-blog .blog-empty__title {
  margin: 0 0 8px;
  color: var(--dmeb-navy);
  font-size: 20px;
  font-weight: 700;
}

.dmeb-blog .blog-empty__text {
  margin: 0;
  color: var(--dmeb-excerpt);
  font-size: 15px;
}

/* --- Pagination --- */

.dmeb-blog .blog-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 40px;
}

.dmeb-blog .blog-pagination[hidden] {
  display: none;
}

.dmeb-blog .blog-pagination__page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: 1px solid var(--dmeb-hairline);
  border-radius: 50%;
  color: var(--dmeb-navy);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 0.2s var(--dmeb-ease-soft),
    color 0.2s var(--dmeb-ease-soft),
    border-color 0.2s var(--dmeb-ease-soft),
    transform 0.2s var(--dmeb-ease-soft);
}

.dmeb-blog .blog-pagination__page.is-current {
  background: var(--dmeb-gold);
  border-color: var(--dmeb-gold);
  color: #fff;
}

.dmeb-blog .blog-pagination__page--nav {
  width: auto;
  min-width: 76px;
  padding: 0 18px;
  border-radius: 999px;
}

.dmeb-blog .blog-pagination__gap {
  color: var(--dmeb-meta);
  font-size: 14px;
}

.dmeb-blog .blog-pagination__page:hover {
  border-color: var(--dmeb-gold);
  transform: translateY(-1px);
}

.dmeb-blog .blog-pagination__page:focus-visible {
  outline: 2px solid var(--dmeb-teal);
  outline-offset: 2px;
}

/* --- Entrance animation --- */

@keyframes blogFadeUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Nothing is hidden unless the script confirms it can reveal again, so a
   failed or blocked bundle always leaves a readable page. */
.dmeb-blog--js.dmeb-blog--animate .blog-card {
  opacity: 0;
}

.dmeb-blog--js.dmeb-blog--animate.is-revealed .featured-article,
.dmeb-blog--js.dmeb-blog--animate.is-revealed .blog-toolbar,
.dmeb-blog--js.dmeb-blog--animate.is-revealed .blog-card,
.dmeb-blog--js.dmeb-blog--animate.is-revealed .blog-pagination,
.dmeb-blog--js.dmeb-blog--animate.is-revealed .blog-empty {
  animation: blogFadeUp var(--dmeb-reveal) var(--dmeb-ease-out) both;
}

/* Once the entrance has finished the animation is dropped and the cards are
   handed back to the filter transitions, so a later filter is not competing
   with a `both`-filled keyframe. Opacity is pinned by the rule below rather
   than by the animation, so nothing can flash out on the way. */
.dmeb-blog--js.dmeb-blog--animate.is-settled .blog-card,
.dmeb-blog--js.dmeb-blog--animate.is-settled .featured-article,
.dmeb-blog--js.dmeb-blog--animate.is-settled .blog-toolbar,
.dmeb-blog--js.dmeb-blog--animate.is-settled .blog-pagination,
.dmeb-blog--js.dmeb-blog--animate.is-settled .blog-empty {
  animation: none;
}

.dmeb-blog--js.dmeb-blog--animate.is-settled .blog-card {
  opacity: 1;
}

.dmeb-blog--js.dmeb-blog--animate.is-revealed .featured-article {
  animation-duration: 0.55s;
}

.dmeb-blog--js.dmeb-blog--animate.is-revealed .blog-toolbar {
  animation-duration: 0.5s;
  animation-delay: 0.12s;
}

.dmeb-blog--js.dmeb-blog--animate.is-revealed .blog-card:nth-child(1) { animation-delay: 0.16s; }
.dmeb-blog--js.dmeb-blog--animate.is-revealed .blog-card:nth-child(2) { animation-delay: 0.21s; }
.dmeb-blog--js.dmeb-blog--animate.is-revealed .blog-card:nth-child(3) { animation-delay: 0.26s; }
.dmeb-blog--js.dmeb-blog--animate.is-revealed .blog-card:nth-child(4) { animation-delay: 0.31s; }
.dmeb-blog--js.dmeb-blog--animate.is-revealed .blog-card:nth-child(5) { animation-delay: 0.36s; }
.dmeb-blog--js.dmeb-blog--animate.is-revealed .blog-card:nth-child(6) { animation-delay: 0.41s; }
.dmeb-blog--js.dmeb-blog--animate.is-revealed .blog-card:nth-child(n + 7) { animation-delay: 0.46s; }

/* The Elementor editor must never hide content while building. */
.elementor-editor-active .dmeb-blog--js.dmeb-blog--animate .blog-card,
body.elementor-editor-active .dmeb-blog--js.dmeb-blog--animate .blog-card {
  opacity: 1 !important;
  animation: none !important;
}

/* ------------------------------------------------------------------ *
 * Blog carousel
 * ------------------------------------------------------------------ */

.dmeb-carousel {
  --dmeb-carousel-per-view-attr: 1;
  --dmeb-carousel-per-view: var(--dmeb-carousel-per-view-attr);
  --dmeb-carousel-ratio: 1.55;
  --dmeb-carousel-bg: transparent;
  --dmeb-carousel-pad: 0;
  --dmeb-carousel-gap: 24px;
  --dmeb-card-ratio: var(--dmeb-carousel-ratio);

  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  padding: var(--dmeb-carousel-pad);
  background: var(--dmeb-carousel-bg);
  color: var(--dmeb-navy);
}

.dmeb-carousel--full {
  --dmeb-carousel-pad: 34px 0 42px;
}

.dmeb-carousel__heading {
  margin: 0;
  color: var(--dmeb-navy);
  font-size: clamp(22px, 2vw, 28px);
  font-weight: 700;
  line-height: 1.15;
}

.dmeb-carousel__rule {
  width: 64px;
  height: 4px;
  margin: 14px 0 22px;
  background: var(--dmeb-gold);
  border-radius: 3px;
}

.dmeb-carousel__viewport {
  position: relative;
}

.dmeb-carousel__track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - (var(--dmeb-carousel-per-view) - 1) * var(--dmeb-carousel-gap)) / var(--dmeb-carousel-per-view));
  gap: var(--dmeb-carousel-gap);
  padding: 0 0 4px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  list-style: none;
  scrollbar-width: none;
}

.dmeb-carousel__track::-webkit-scrollbar {
  display: none;
}

.dmeb-carousel__track:focus-visible {
  outline: 2px solid var(--dmeb-teal);
  outline-offset: 4px;
  border-radius: var(--dmeb-radius);
}

/* With everything on screen there is nothing to scroll or snap. */
.dmeb-carousel--fits .dmeb-carousel__track {
  scroll-snap-type: none;
  overflow-x: visible;
}

.dmeb-carousel__slide {
  min-width: 0;
}

/* One snap point per page rather than per card, so a swipe never lands
   mid-page and the dots, arrows and scroll position always agree. */
.dmeb-carousel--snapping .dmeb-carousel__slide:nth-of-type(1),
.dmeb-carousel--snapping .dmeb-carousel__slide:nth-of-type(2),
.dmeb-carousel--snapping .dmeb-carousel__slide:nth-of-type(3),
.dmeb-carousel--snapping .dmeb-carousel__slide:nth-of-type(4) {
  scroll-snap-align: start;
}

.dmeb-carousel__nav {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  /* Sits in the page margin, just outside the content column, on a wide
     viewport; tucks in close on a narrow one. */
  padding: 0 clamp(4px, calc((100vw - 1180px) / 2 - 58px), 260px);
  pointer-events: none;
  transform: translateY(-50%);
}

.dmeb-carousel--full .dmeb-carousel__nav {
  padding: 0 12px;
}

.dmeb-carousel__arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: #fff;
  border: 1px solid var(--dmeb-hairline);
  border-radius: 50%;
  color: var(--dmeb-navy);
  cursor: pointer;
  pointer-events: auto;
  transition:
    background-color 0.2s var(--dmeb-ease-soft),
    color 0.2s var(--dmeb-ease-soft),
    border-color 0.2s var(--dmeb-ease-soft),
    transform 0.2s var(--dmeb-ease-soft),
    opacity 0.2s var(--dmeb-ease-soft);
}

.dmeb-carousel__arrow svg {
  display: block;
}

.dmeb-carousel__arrow:hover {
  background: var(--dmeb-gold);
  border-color: var(--dmeb-gold);
  color: #fff;
  transform: translateY(-1px);
}

.dmeb-carousel__arrow:focus-visible {
  outline: 2px solid var(--dmeb-teal);
  outline-offset: 2px;
}

.dmeb-carousel__arrow[disabled] {
  opacity: 0.35;
  cursor: default;
  transform: none;
}

.dmeb-carousel__dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 22px;
}

.dmeb-carousel__dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
}

.dmeb-carousel__dot span {
  display: block;
  width: 8px;
  height: 8px;
  background: rgba(15, 42, 59, 0.22);
  border-radius: 50%;
  transition:
    background-color 0.22s var(--dmeb-ease-soft),
    transform 0.22s var(--dmeb-ease-soft);
}

.dmeb-carousel__dot.is-current span {
  background: var(--dmeb-gold);
  transform: scale(1.25);
}

.dmeb-carousel__dot:focus-visible {
  outline: 2px solid var(--dmeb-teal);
  outline-offset: 2px;
  border-radius: 50%;
}

/* Entrance */
.dmeb-carousel--js.dmeb-carousel--animate .dmeb-carousel__slide {
  opacity: 0;
}
.dmeb-carousel--js.dmeb-carousel--animate.is-revealed .dmeb-carousel__heading,
.dmeb-carousel--js.dmeb-carousel--animate.is-revealed .dmeb-carousel__rule,
.dmeb-carousel--js.dmeb-carousel--animate.is-revealed .dmeb-carousel__slide,
.dmeb-carousel--js.dmeb-carousel--animate.is-revealed .dmeb-carousel__dots,
.dmeb-carousel--js.dmeb-carousel--animate.is-revealed .dmeb-carousel__arrow {
  animation: blogFadeUp var(--dmeb-reveal) var(--dmeb-ease-out) both;
}

.dmeb-carousel--js.dmeb-carousel--animate.is-revealed .dmeb-carousel__slide:nth-child(1) { animation-delay: 0.08s; }
.dmeb-carousel--js.dmeb-carousel--animate.is-revealed .dmeb-carousel__slide:nth-child(2) { animation-delay: 0.13s; }
.dmeb-carousel--js.dmeb-carousel--animate.is-revealed .dmeb-carousel__slide:nth-child(3) { animation-delay: 0.18s; }
.dmeb-carousel--js.dmeb-carousel--animate.is-revealed .dmeb-carousel__slide:nth-child(4) { animation-delay: 0.23s; }
.dmeb-carousel--js.dmeb-carousel--animate.is-revealed .dmeb-carousel__slide:nth-child(n + 5) { animation-delay: 0.28s; }

.elementor-editor-active .dmeb-carousel--js.dmeb-carousel--animate .dmeb-carousel__slide,
body.elementor-editor-active .dmeb-carousel--js.dmeb-carousel--animate .dmeb-carousel__slide {
  opacity: 1 !important;
  animation: none !important;
}

/* The carousel keeps the same content column as the article grid, so it sits in
   the page rather than stretching to whatever the viewport happens to be. */
.dmeb-carousel__inner {
  width: min(1180px, calc(100% - 48px));
  max-width: 1180px;
  margin-inline: auto;
}

.dmeb-carousel--full .dmeb-carousel__inner {
  width: 100%;
  max-width: none;
}

/* Entrance settling, mirroring the blog index. */
.dmeb-carousel--js.dmeb-carousel--animate.is-settled .dmeb-carousel__slide,
.dmeb-carousel--js.dmeb-carousel--animate.is-settled .dmeb-carousel__heading,
.dmeb-carousel--js.dmeb-carousel--animate.is-settled .dmeb-carousel__rule,
.dmeb-carousel--js.dmeb-carousel--animate.is-settled .dmeb-carousel__dots,
.dmeb-carousel--js.dmeb-carousel--animate.is-settled .dmeb-carousel__arrow {
  animation: none;
}

.dmeb-carousel--js.dmeb-carousel--animate.is-settled .dmeb-carousel__slide {
  opacity: 1;
}

/* ------------------------------------------------------------------ *
 * Responsive
 * ------------------------------------------------------------------ */

@media (max-width: 1024px) {
  .dmeb-blog .blog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dmeb-blog {
    --dmeb-blog-pad: 32px 0 60px;
  }

  .dmeb-blog .featured-article {
    gap: 28px;
  }
}

@media (max-width: 900px) {
  .dmeb-carousel__nav {
    position: static;
    justify-content: flex-end;
    gap: 10px;
    margin: 16px 0 0;
    padding: 0;
    pointer-events: auto;
    transform: none;
  }

  .dmeb-carousel__arrow {
    width: 40px;
    height: 40px;
  }
}

/* Between the phone layout and a genuinely wide column, two cards read better
   than one very wide one — unless the author asked for a specific number. */
@media (min-width: 901px) and (max-width: 1199px) {
  .dmeb-carousel {
    --dmeb-carousel-per-view: min(2, var(--dmeb-carousel-per-view-attr));
  }
}

@media (max-width: 760px) {
  .dmeb-blog {
    --dmeb-blog-pad: 28px 0 52px;
    --dmeb-prose-width: calc(100% - 36px);
  }

  .dmeb-blog .featured-article {
    grid-template-columns: 1fr;
    gap: 22px;
    margin-bottom: 28px;
  }

  .dmeb-blog .featured-article__title {
    font-size: clamp(26px, 6vw, 32px);
  }

  .dmeb-blog .blog-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    margin: 26px 0 20px;
  }

  .dmeb-blog .blog-search {
    flex-basis: auto;
    width: 100%;
  }
}

@media (max-width: 620px) {
  .dmeb-blog {
    --dmeb-card-gap-x: 18px;
    --dmeb-card-gap-y: 20px;
  }

  .dmeb-blog .blog-grid {
    grid-template-columns: 1fr;
  }

  /* One scrollable row beats four wrapped rows of chips on a phone. */
  .dmeb-blog .blog-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .dmeb-blog .blog-filters::-webkit-scrollbar {
    display: none;
  }

  .dmeb-blog .blog-filter {
    flex: 0 0 auto;
  }

  .dmeb-blog .blog-pagination__page--nav {
    min-width: 56px;
  }

  .dmeb-carousel {
    --dmeb-carousel-gap: 16px;
  }
}

/* On a touch screen the native scroll is the interaction; snapping fights it. */
@media (hover: none) and (pointer: coarse) {
  .dmeb-carousel__track {
    scroll-snap-type: none;
  }
}

/* ------------------------------------------------------------------ *
 * Motion preferences
 * ------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  .dmeb-blog *,
  .dmeb-blog *::before,
  .dmeb-blog *::after,
  .dmeb-carousel *,
  .dmeb-carousel *::before,
  .dmeb-carousel *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .dmeb-blog--animate:not(.dmeb-blog--force-motion) .blog-card,
  .dmeb-carousel--animate:not(.dmeb-carousel--force-motion) .dmeb-carousel__slide {
    opacity: 1;
    transform: none;
  }

  .dmeb-carousel__track {
    scroll-behavior: auto;
  }
}
