/* media.css: styles for the new media grid (replaces per-item inline styles and Bootstrap column layout) */
#media-section { padding: 40px 0; }
#media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 24px;
  align-items: start;
}

/* Make cards visually seamless (no border or shadow) */
.media-card {
  background: transparent;
  border: 0 !important;
  box-shadow: none !important;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  transition: transform 160ms ease, box-shadow 160ms ease;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

/* Image area: fixed height but keep original aspect ratio.
   Use contain so images are not cropped; center them with flexbox.
   Blank space at top/bottom is acceptable. */
.media-card .article-img {
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent; /* <-- changed: default to transparent */
  overflow: hidden;
  position: relative;
  transition: background-color 200ms ease; /* keep transition */
}
.media-card .article-img img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  transition: transform 350ms ease;
  transform-origin: center center;
}

/* Hover/focus: subtle zoom of the image (won't crop due to contain) */
.media-card:hover .article-img img,
.media-card:focus .article-img img,
.media-card:focus-visible .article-img img {
  transform: scale(1.06);
}

/* Make the top/bottom fill color appear on hover/focus (inverted behavior) */
.media-card:hover .article-img,
.media-card:focus .article-img,
.media-card:focus-visible .article-img {
  background-color: #f4f4f4; /* <-- show fill on hover/focus */
}

/* Body / title */
.media-card .article-body {
  padding-top: 12px;
  flex: 1 0 auto;
  background: transparent;
}

/* Add explicit styling for the date (article-meta) so it never changes on hover */
.media-card .article-meta {
  margin: 0;
  padding-top: 10px;
  list-style: none;
}
.media-card .article-meta li {
  color: #afaeae;
  font-weight: 400;
  font-size: 12.5px;
  line-height: 1;
  text-transform: uppercase; /* <-- added: make the date all caps */
}

/* Ensure hover/focus/visited states do not alter the date color or casing */
.media-card:hover .article-meta,
.media-card:focus .article-meta,
.media-card:focus-visible .article-meta,
.media-card:visited .article-meta,
.media-card:hover .article-meta li,
.media-card:focus .article-meta li,
.media-card:focus-visible .article-meta li,
.media-card:visited .article-meta li {
  color: #afaeae;
  text-transform: uppercase; /* <-- enforce uppercase on all states */
}

/* Title */
.media-card .article-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 8px 0;
  line-height: 1.2;
  color: inherit;
  transition: color 160ms ease, text-decoration 160ms ease;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  display: block;
  text-decoration: none;
  text-align: left; /* <-- changed: left-align the title */
}

/* Title behaves like a link when the card is hovered/focused */
.media-card:hover .article-title,
.media-card:focus .article-title,
.media-card:focus-visible .article-title {
  color: #cc4232; /* <-- changed: hover/focus color */
  text-decoration: none; /* <-- changed: remove underline on hover */
}

/* Keep visited titles from forcing hover colour */
.media-card:visited .article-title {
  color: inherit;
}

/* Accessible focus ring for keyboard users */
.media-card:focus-visible {
  box-shadow: 0 0 0 3px rgba(51,122,183,0.18);
  border-radius: 4px;
}
#media-pagination {
  margin-top: 28px;
  text-align: center;
}
.media-page-btn {
  display: inline-block;
  margin: 0 4px;
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid #ddd;
  background: #fff;
  color: #333;
  text-decoration: none;
  cursor: pointer;
}
.media-page-btn.active {
  background: #337ab7;
  color: #fff;
  border-color: #2e6da4;
}
@media (max-width: 520px) {
  .media-card .article-title { font-size: 14px; }
  #media-grid { gap: 16px; }
}
