/* AYAM24 Article Cards — layout-only repair (v1.0.0)
   Does not change article text, excerpts, Ad Inserter shortcodes,
   themes, menus, ad slots, or Dark / Light Mode color palettes. */

/* The homepage intentionally gave the first card more width. Use equal columns. */
@media (min-width: 901px) {
  .editorial-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
  }
}

/* Shared presentation for the homepage editorial cards and blog article archive. */
.editorial-grid .story-card,
.article-index .story-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
}

/* Same photo ratio for the first featured card and its neighbors. */
.editorial-grid .story-cover,
.editorial-grid .story-card-feature .story-cover,
.article-index .story-cover,
.article-index .story-card-feature .story-cover {
  position: relative;
  display: flex;
  width: 100%;
  height: auto !important;
  aspect-ratio: 16 / 9;
  flex: 0 0 auto;
  overflow: hidden;
}

.editorial-grid .story-cover img,
.article-index .story-cover img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Keep text and the date/read link in a consistent vertical structure. */
.editorial-grid .story-body,
.article-index .story-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
}

.editorial-grid .story-body h3,
.editorial-grid .story-card-feature .story-body h3,
.article-index .story-body h3,
.article-index .story-card-feature .story-body h3 {
  font-size: 19px;
  line-height: 1.4;
  min-height: 4.2em; /* space for roughly 3 lines; no title truncation */
}

.editorial-grid .story-body p,
.article-index .story-body p {
  min-height: 5.1em; /* space for roughly 3 lines; never hide ad shortcodes */
}

.editorial-grid .story-bottom,
.article-index .story-bottom {
  margin-top: auto;
  gap: 8px;
}

/* Tablet: no full-row featured card, so both columns remain visually consistent. */
@media (min-width: 641px) and (max-width: 900px) {
  .editorial-grid .story-card-feature {
    grid-column: auto;
  }
}

/* Mobile: a single column; do not add unnecessary blank space. */
@media (max-width: 640px) {
  .editorial-grid .story-body h3,
  .editorial-grid .story-card-feature .story-body h3,
  .article-index .story-body h3,
  .article-index .story-card-feature .story-body h3 {
    min-height: 0;
  }
  .editorial-grid .story-body p,
  .article-index .story-body p {
    min-height: 0;
  }
}
