/* 模組最外層容器 */
.rgy-news-grid .d-flex {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  clear: both;
  justify-content: flex-start;
  align-items: stretch; /* 讓同一列的卡片高度等高 */
  margin: 0 0 70px 0;
}

/* 單一卡片外觀設定 */
.rgy-news-grid .d-flex .rgy-article-box {
  box-sizing: border-box;
  margin: 0 5px 20px 5px;
  background-color: #ffffff;
  border-radius: 12px;                  /* 圓角邊框 */
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08); /* 柔和卡片陰影 */
  border: 1px solid #eef0f2;            /* 較柔和的邊框線，取代原本生硬的深灰框 */
  overflow: hidden;                     /* 確保頂部圖片圓角不溢出 */
  display: flex;
  flex-direction: column;               /* 垂直排列 */
}

/* 響應式欄位寬度 */
@media screen and (min-width: 768px) {
  .rgy-news-grid .d-flex .rgy-article-box {
    width: calc(100% / 3 - 10px);       /* 平板橫放 / 桌機：一列 3 欄 */
  }
}

@media screen and (min-width: 480px) and (max-width: 767px) {
  .rgy-news-grid .d-flex .rgy-article-box {
    width: calc(100% / 2 - 10px);       /* 平板直放 / 大手機：一列 2 欄 */
  }
}

@media screen and (max-width: 479px) {
  .rgy-news-grid .d-flex .rgy-article-box {
    width: calc(100% / 1 - 10px);       /* 小手機：一列 1 欄 */
  }
}

/* 1. 圖片容器：強制 4:3 比例與遮罩裁切 */
.rgy_custom_news_img {
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background-color: #f7f9fa;
}

.rgy_custom_news_img img {
  width: 100%;
  height: 100%;
  object-fit: cover;                    /* 自動居中裁切，保留最佳比例 */
  display: block;
  transition: transform 0.3s ease;
}

.rgy-article-box:hover .rgy_custom_news_img img {
  transform: scale(1.03);               /* 滑鼠懸停時微放大 */
}

.rgy_custom_news_img iframe {
  width: 100%;
  height: 100%;
  border: 0 none !important;
}

/* 2. 內容本體容器 (包覆 Date, Title, Desc, Tags) */
.rgy-article-box-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;                         /* 撐滿剩餘空間，確保 Tags 齊底 */
}

/* 3. 日期 (Date) */
.rgy-article-box-date {
  font-size: 13px;
  color: #8c98a4;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
}

/* 若有使用 FontAwesome，可自動帶出日曆小圖示 */
.rgy-article-box-date::before {
  content: "📅";
  font-size: 12px;
  margin-right: 5px;
}

/* 4. 標題 (Title) */
.rgy-article-box-title {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.45;
  margin-bottom: 10px;
}

.rgy-article-box-title a {
  color: #212529;
  text-decoration: none;
}

.rgy-article-box-title a:hover {
  color: #0b3c5d;
}

/* 5. 簡介內文 (Desc / 120字元) */
.rgy-article-box-main {
  font-size: 14px;
  line-height: 1.6;
  color: #6c757d;
  margin-bottom: 15px;
  flex-grow: 1;                         /* 當字數不一時代理撐開高度 */
}

/* 6. 標籤清單 (Tags) */
.rgy-article-box-tags {
  margin-top: auto;                     /* 自動推到底部 */
  padding-top: 8px;
}

/* 將輸出的 %T 轉為膠囊樣式 */
.rgy-article-box-tags a,
.rgy-article-box-tags span {
  display: inline-block;
  background-color: #b99a6b;            /* 範例圖中的卡其棕色標籤底色 */
  color: #ffffff !important;
  font-size: 12px;
  line-height: 1.2;
  padding: 4px 8px;
  border-radius: 4px;
  margin-right: 6px;
  margin-bottom: 6px;
  text-decoration: none;
}

.rgy-article-box-tags a:hover {
  background-color: #a08253;
}

/* ===================================================
 * 覆蓋 Joomla 預設 Tags 樣式，符合卡片示意圖
 * =================================================== */

/* 1. 外層容器：推到底部並消除溢出間距 */
.rgy-article-box-tags {
  margin-top: auto;
  padding-top: 10px;
}

/* 2. 重設 Joomla 原生 ul 清單樣式 */
.rgy-article-box-tags ul.tags {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px 6px !important;            /* 標籤之間保持固定間距 (行距 8px、欄距 6px) */
  align-items: center;
}

/* 3. 重設 li 項目樣式 */
.rgy-article-box-tags ul.tags li {
  list-style: none !important;
  display: inline-flex !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* 4. 針對 a 連結標籤 (.label-info) 的外觀與留白調整 */
.rgy-article-box-tags ul.tags li a,
.rgy-article-box-tags ul.tags li a.label {
  display: inline-flex !important;
  align-items: center !important;
  
  /* 參考示意圖的內縮留白 (padding) */
  padding: 4px 10px !important;
  margin: 0 !important;
  
  /* 字體大小與字重 */
  font-size: 12px !important;
  font-weight: 500 !important;
  line-height: 1.3 !important;
  
  /* 圓角弧度 (依示意圖約 4px~6px 圓角) */
  border-radius: 5px !important;
  
  text-decoration: none !important;
  white-space: nowrap !important;
  transition: opacity 0.2s ease, transform 0.2s ease;
  
  /* 如需微調預設的文字底線或陰影 */
  text-shadow: none !important;
  box-shadow: none !important;
}

/* 滑鼠懸停效果 (保留原色，僅做透明度與微抬反饋) */
.rgy-article-box-tags ul.tags li a:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}