/* =========================================
   FRONT PAGE: LATEST CONTENT (HERO + CAROUSEL)
========================================= */

.mdm-latest{
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ---------- HERO ---------- */

.mdm-latest-hero{
  border: 1px solid var(--mdm-gray-150);
  border-radius: 16px;
  overflow: hidden;
  background: var(--mdm-white);
  box-shadow: 0 16px 40px rgba(18,20,23,.06);
}

.mdm-latest-hero-link{
  display: grid;
  grid-template-columns: 1.35fr 1fr; /* ~60/40 */
  gap: 0;
  text-decoration: none;
  color: inherit;
  align-items: stretch;
}

.mdm-latest-hero-media{
  position: relative;
  background: var(--mdm-gray-100);
  min-height: 220px;
}

.mdm-latest-hero-img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mdm-latest-hero-img--placeholder{
  width: 100%;
  height: 100%;
  min-height: 220px;
  background: linear-gradient(135deg, rgba(18,20,23,.06), rgba(18,20,23,.02));
}

.mdm-latest-hero-content{
  padding: 1.15rem 1.2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.mdm-latest-hero-title{
  margin: 0 0 .6rem 0;
  font-weight: 950;
  letter-spacing: -.03em;
  line-height: 1.03;

  /* "oomph" + adaptive sizing */
  font-size: clamp(1.65rem, 2.35vw, 2.65rem);
  text-wrap: balance;

  /* keep long titles from overflowing the column */
  overflow-wrap: anywhere;
}

.mdm-latest-hero-meta{
  display: flex;
  flex-direction: column; /* author first, date below */
  gap: .18rem;
  color: rgba(18,20,23,.68);
  font-size: .95rem;
}

.mdm-latest-hero-author{
  font-weight: 800;
  letter-spacing: -.01em;
}

.mdm-latest-hero-date{
  font-weight: 650;
  opacity: .9;
}

/* subtle hover polish */
.mdm-latest-hero-link:hover .mdm-latest-hero-title{
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

/* ---------- CAROUSEL ---------- */

.mdm-latest-carousel{
  position: relative;
  border-radius: 16px;
}

.mdm-latest-viewport{
  overflow: hidden;
  border-radius: 16px;
}

.mdm-latest-track{
  --mdm-latest-index: 0;
  display: flex;
  gap: .9rem;
  transition: transform 260ms ease;
  transform: translateX(calc(var(--mdm-latest-index) * -1 * (min(320px, 80vw) + .9rem)));
  will-change: transform;
  padding: .1rem; /* keep focus ring from clipping */
}

.mdm-latest-slide{
  flex: 0 0 min(320px, 80vw);
  border: 1px solid var(--mdm-gray-150);
  border-radius: 16px;
  overflow: hidden;
  background: var(--mdm-white);
  box-shadow: 0 14px 34px rgba(18,20,23,.06);
}

.mdm-latest-slide-link{
  display: block;
  text-decoration: none;
  color: inherit;
}

.mdm-latest-slide-media{
  background: var(--mdm-gray-100);
}

.mdm-latest-slide-img{
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
}

.mdm-latest-slide-img--placeholder{
  width: 100%;
  height: 140px;
  background: linear-gradient(135deg, rgba(18,20,23,.06), rgba(18,20,23,.02));
}

.mdm-latest-slide-body{
  padding: .8rem .9rem .9rem .9rem;
}

.mdm-latest-slide-title{
  font-weight: 900;
  letter-spacing: -.02em;
  line-height: 1.12;
  margin-bottom: .35rem;

  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mdm-latest-slide-date{
  color: rgba(18,20,23,.62);
  font-size: .92rem;
  font-weight: 650;
}

/* ---------- ARROWS ---------- */

.mdm-carousel-btn{
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 999px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border: 1px solid rgba(18,20,23,.12);
  background: rgba(255,255,255,.92);
  box-shadow: 0 18px 40px rgba(18,20,23,.12);

  cursor: pointer;
  z-index: 5;
}

.mdm-carousel-btn[hidden]{
  display: none !important;
}

.mdm-carousel-btn--prev{ left: -14px; }
.mdm-carousel-btn--next{ right: -14px; }

.mdm-carousel-btn-icon{
  font-size: 26px;
  line-height: 1;
  font-weight: 900;
  color: rgba(18,20,23,.78);
}

.mdm-carousel-btn:hover{
  background: var(--mdm-white);
}

.mdm-carousel-btn:disabled{
  opacity: .6;
  cursor: default;
}

.mdm-carousel-btn.is-loading .mdm-carousel-btn-icon{
  opacity: .55;
}

/* ---------- RESPONSIVE ---------- */

@media (max-width: 991.98px){
  .mdm-latest-hero-link{
    grid-template-columns: 1fr; /* stacked on mobile/tablet */
  }

  .mdm-latest-hero-media{
    min-height: 200px;
  }

  .mdm-latest-hero-content{
    padding: 1rem 1rem;
  }

  .mdm-latest-hero-title{
    font-size: clamp(1.55rem, 4.3vw, 2.15rem);
    line-height: 1.06;
  }

  .mdm-carousel-btn--prev{ left: 8px; }
  .mdm-carousel-btn--next{ right: 8px; }
}

@media (max-width: 575.98px){
  .mdm-latest-track{
    gap: .75rem;
    transform: translateX(calc(var(--mdm-latest-index) * -1 * (min(300px, 86vw) + .75rem)));
  }

  .mdm-latest-slide{
    flex-basis: min(300px, 86vw);
  }
}
