/* RUANG PROJECT - ARTICLE LAYOUT FIX v2
   Fixes the horizontal overflow seen on the live Article page.
   Article page only; no changes to Home/Layanan/Testimoni/etc. */

html, body {
  max-width: 100%;
  overflow-x: clip;
}

/* Listing */
.article-card {
  min-width: 0 !important;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.article-card .article-thumb {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  height: 220px !important;
  min-width: 0 !important;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: center;
  box-sizing: border-box;
}

.article-card .article-card-body {
  min-width: 0 !important;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  box-sizing: border-box;
}

/* Critical: grid columns must be allowed to shrink below image intrinsic width. */
.grid.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  min-width: 0;
}
.grid.grid-3 > * {
  min-width: 0 !important;
  max-width: 100%;
}

/* Detail */
.article-detail-wrap {
  width: 100% !important;
  max-width: 900px !important;
  min-width: 0 !important;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

.article-detail-wrap .article-cover {
  display: block;
  width: 100% !important;
  max-width: 900px !important;
  min-width: 0 !important;
  height: min(500px, 56.25vw) !important;
  min-height: 0 !important;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: center;
  box-sizing: border-box;
  border-radius: 18px;
  margin: 0 auto 24px;
}

.article-detail-wrap .article-content {
  width: 100% !important;
  max-width: 820px !important;
  min-width: 0 !important;
  margin-left: auto;
  margin-right: auto;
  overflow-wrap: anywhere;
  word-break: break-word;
  box-sizing: border-box;
}

.article-detail-wrap .article-content img,
.article-detail-wrap .article-content iframe,
.article-detail-wrap .article-content video,
.article-detail-wrap .article-content table {
  max-width: 100% !important;
  box-sizing: border-box;
}

@media (max-width: 900px) {
  .grid.grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 680px) {
  .grid.grid-3 {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .article-card .article-thumb {
    height: 190px !important;
  }
  .article-detail-wrap {
    width: 100% !important;
    max-width: 100% !important;
  }
  .article-detail-wrap .article-cover {
    width: 100% !important;
    height: 210px !important;
    max-height: 210px !important;
    border-radius: 14px;
  }
  .article-detail-wrap .article-content {
    width: 100% !important;
    max-width: 100% !important;
    font-size: .98rem;
    line-height: 1.75;
  }
}

@media (max-width: 480px) {
  .article-card .article-thumb {
    height: 180px !important;
  }
  .article-detail-wrap .article-cover {
    height: 190px !important;
    max-height: 190px !important;
  }
}
