/* =================================================================
 * DMEC Latest News & Resources — single-source render styles.
 *
 * Pairs with dmec-latest-news.php and dmec-latest-news.js.
 *
 * Pinned to Figma node 201:7181 (Latest News & Resources InfoBox).
 * Layout, typography, and color tokens come from the design system —
 * see _tokens.scss for the variable origins:
 *
 *   bg                      Neutral/cold/100  #F4F6FA
 *   eyebrow (H6)            12px PT Sans Bold #404040, +4 letter-spacing, uppercase
 *   heading (H2)            24px PT Sans Regular #2B2B2B
 *   list-link               20px PT Sans Bold #356EBD (Primary/600)
 *   list-link active/hover  Tertiary/600 #9A239C
 *   card-title              20px PT Sans Bold #2455A6 (Primary/700)
 *   card-excerpt            16px PT Sans Regular #404040 Neutral/warm/800
 *   nav arrow               Primary/700 chevron in transparent button
 *
 * Layout proportions (Figma):
 *   - Outer section: 80px vertical, 120px horizontal padding
 *   - 80px gap between text-box and carousel columns
 *   - Card image: 16:9 aspect, 300px tall reference
 *   - List dividers: 1px Neutral/warm/400 #B4B1AE
 * ================================================================= */

.dmec-latest-news {
  background-color: #f4f6fa;
  padding: 80px 120px;
  margin-top: 0;
}

.dmec-latest-news__inner {
  display: grid;
  grid-template-columns: 1fr minmax(0, 480px);
  gap: 80px;
  max-width: 1200px;
  margin-inline: auto;
}

/* ----- Text-box column (left) ------------------------------------ */

.dmec-latest-news__text-box {
  display: flex;
  flex-direction: column;
  gap: 60px;
  min-width: 0;
}

.dmec-latest-news__head {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dmec-latest-news__eyebrow {
  margin: 0;
  font-family: "PT Sans", sans-serif;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.32;
  /* BugZap #16: legacy 4px tracking read far too wide; use the
     canonical all-caps caption tracking (0.04em). */
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #404040;
}

.dmec-latest-news__heading {
  margin: 0;
  font-family: "PT Sans", sans-serif;
  font-size: 24px;
  font-weight: 400;
  line-height: 1.32;
  color: #2b2b2b;
  max-width: 700px;
}

/* ----- Post-title list with dividers ----------------------------- */

.dmec-latest-news__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.dmec-latest-news__list-item {
  display: block;
  border-top: 1px solid #b4b1ae;
}

.dmec-latest-news__list-item:last-child {
  border-bottom: 1px solid #b4b1ae;
}

.dmec-latest-news__list-link {
  display: block;
  padding: 20px 0;
  font-family: "PT Sans", sans-serif;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.32;
  color: #356ebd;
  text-decoration: none;
}

/* Specificity guards against the foundation a{font-weight:inherit} rule at (0,1,2)
   and the BugZap-76 hover rule at (0,4,2) — both in dmec-base.css which loads at
   priority 50 (after this file's default priority 10). Use the full DOM ancestry
   to reach (0,3,1) for default and (0,5,1) for hover, beating both foundation rules. */
body.dmec-redesign-active .page-section__latest-news .dmec-latest-news__list-link {
  font-weight: 700;
}

body.dmec-redesign-active .dmec-latest-news .dmec-latest-news__list-item .dmec-latest-news__list-link.is-active,
body.dmec-redesign-active .dmec-latest-news .dmec-latest-news__list-item .dmec-latest-news__list-link:hover {
  font-weight: 700;
}

/* BugZap #75/#14: link states must match the component library —
   hovered/active links darken to Primary/900, not legacy magenta. */
.dmec-latest-news__list-link.is-active,
.dmec-latest-news__list-link:hover {
  color: #17386f;
}

.dmec-latest-news__list-link:focus-visible {
  outline: 4px solid #cb45cc;
  outline-offset: 2px;
  border-radius: 2px;
}

/* ----- Right column: carousel block ------------------------------ */

.dmec-latest-news__carousel {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  position: relative;
}

/* Specificity bumped intentionally:
 *  - `.entry-content button` and `.elementor-element button` style every
 *    button under content / Elementor wrappers as solid-navy / white-icon
 *    pill at (0,1,1). A bare `.dmec-latest-news__nav` rule is (0,1,0)
 *    and loses to those.
 *  - Chaining `.dmec-latest-news` and scoping under `body` gives us
 *    (0,3,1) which is more than enough to win without resorting to
 *    `!important`. We also reset the bg/border/color on the
 *    descendant-selector form so the cascade order doesn't matter.
 */
body .dmec-latest-news .dmec-latest-news__nav,
body.dmec-redesign-active .dmec-latest-news .dmec-latest-news__nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  border-radius: 4px;
  padding: 8px;
  color: #2455a6;
  cursor: pointer;
  line-height: 0;
  box-shadow: none;
}

body .dmec-latest-news .dmec-latest-news__nav:hover,
body.dmec-redesign-active .dmec-latest-news .dmec-latest-news__nav:hover {
  background-color: rgba(36, 85, 166, 0.08);
  color: #2455a6;
}

body .dmec-latest-news .dmec-latest-news__nav:focus-visible,
body.dmec-redesign-active .dmec-latest-news .dmec-latest-news__nav:focus-visible {
  outline: 4px solid #cb45cc;
  outline-offset: 2px;
}

body .dmec-latest-news .dmec-latest-news__nav svg,
body.dmec-redesign-active .dmec-latest-news .dmec-latest-news__nav svg {
  display: block;
}

.dmec-latest-news__cards {
  position: relative;
  min-width: 0;
}

.dmec-latest-news__card {
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px;
  width: 100%;
  max-width: 480px;
  margin-inline: auto;
}

/* BugZap #18 — Figma card/news State=Hovered (211:4587): the text
   block inverts to Primary/900 with white underlined title and
   Neutral/warm/100 body copy. (The earlier shadow-lift treatment was
   not the spec.) */
.dmec-latest-news__card-body {
  transition: background-color 180ms ease;
}

.dmec-latest-news__card:hover .dmec-latest-news__card-body,
.dmec-latest-news__card:focus-within .dmec-latest-news__card-body {
  background: #17386f;
}

/* Round-4 #131-family: underline ONLY the anchor. Decorating the H3
   too painted a second line — the heading's decoration propagates
   through the inline link while the link paints its own at the
   foundation 0.15em offset (double underline on hover). */
.dmec-latest-news__card:hover .dmec-latest-news__card-title,
.dmec-latest-news__card:focus-within .dmec-latest-news__card-title {
  color: #ffffff;
  text-decoration: none;
}

.dmec-latest-news__card:hover .dmec-latest-news__card-title a,
.dmec-latest-news__card:focus-within .dmec-latest-news__card-title a {
  color: #ffffff;
  text-decoration: underline;
  text-decoration-thickness: from-font;
  text-underline-position: from-font;
}

.dmec-latest-news__card:hover .dmec-latest-news__card-excerpt,
.dmec-latest-news__card:focus-within .dmec-latest-news__card-excerpt {
  color: #fbf7f5;
}

/* Inactive cards — collapsed but kept in DOM for ARIA + JS swapping. */
.dmec-latest-news__card:not(.is-active) {
  display: none;
}

.dmec-latest-news__card-image {
  display: block;
  background: #f5f7fb;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
}

.dmec-latest-news__card-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dmec-latest-news__card-image--placeholder {
  background:
    repeating-linear-gradient(
      45deg,
      #f5f7fb 0,
      #f5f7fb 14px,
      #ebeef5 14px,
      #ebeef5 28px
    );
}

.dmec-latest-news__card-body {
  background: #f5f7fb;
  border-radius: 8px;
  padding: 24px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dmec-latest-news__card-title {
  margin: 0;
  font-family: "PT Sans", sans-serif;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.32;
  color: #2455a6;
}

.dmec-latest-news__card-title a {
  color: inherit;
  text-decoration: none;
}

.dmec-latest-news__card-title a:hover {
  color: #17386f; /* Primary/900 — canonical link hover */
}

.dmec-latest-news__card-title a:focus-visible {
  outline: 4px solid #cb45cc;
  outline-offset: 2px;
  border-radius: 2px;
}

.dmec-latest-news__card-excerpt {
  margin: 0;
  font-family: "PT Sans", sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.4;
  color: #404040;
}

/* ----- Carousel indicators (4 dots) ------------------------------ */

.dmec-latest-news__indicators {
  grid-column: 2 / 3;
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
}

.dmec-latest-news__indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c0c4cf;
  transition: background 160ms ease;
}

.dmec-latest-news__indicator.is-active {
  background: #9a239c;
}

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

@media (max-width: 1024px) {
  .dmec-latest-news {
    padding: 64px 60px;
  }

  .dmec-latest-news__inner {
    grid-template-columns: 1fr;
    gap: 48px;
  }

  .dmec-latest-news__text-box {
    gap: 40px;
  }
}

@media (max-width: 600px) {
  .dmec-latest-news {
    padding: 48px 24px;
  }

  .dmec-latest-news__heading {
    font-size: 22px;
  }

  .dmec-latest-news__list-link {
    font-size: 18px;
  }

  .dmec-latest-news__card-body {
    padding: 20px 20px 32px;
  }
}
