/* Latest News page styles */

.latest-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.latest-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 425px;
  gap: 30px;
}

.latest-layout__main {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.latest-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.latest-card {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(15, 36, 63, 0.16);
  background-color: #ffffff;
  min-height: 220px;
  /* base desktop height, but allow card to grow to avoid overlap */
  box-sizing: border-box;
  border: 1px solid transparent;
  color: inherit;
}

a.latest-card {
  text-decoration: none;
}

.latest-card__media {
  position: relative;
  width: 320px;
  height: 180px;
  border-radius: 8px;
  overflow: hidden;
}

.latest-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Corner status badge on image (LATEST / SAFETY etc.), aligned with index page style */
.latest-card .status-chip {
  position: absolute;
  top: 5px;
  right: 5px;
  background: #004494;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  text-transform: uppercase;
  z-index: 10;
  border-radius: 5px;
}

.latest-card__body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.latest-card__title {
  font-size: 21px;
  color: #333333;
  line-height: 1.5;
  overflow: hidden;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.latest-card__summary {
  font-size: 21px;
  color: #333333;
  line-height: 1.5;
  overflow: hidden;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.latest-card:hover {
  border-color: #004494;
  background-color: #f3fafd;
}

.latest-card:hover .latest-card__summary {
  color: #004494;
}

.latest-card__meta {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  font-size: 16px;
  color: #333333;
}

.latest-card__meta-left {
  color: #333333;
  display: flex;
  align-items: center;
  gap: 4px;
}

.latest-card__meta-left .latest-card__meta-label {
  color: #004493;
  margin-right: 4px;
}

.latest-card__meta-right {
  color: #333333;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.latest-card__meta-right .latest-card__meta-label {
  color: #004493;
}

.latest-card__meta-right span+span,
.latest-card__meta-right span+time,
.latest-card__meta-right time+span {
  margin-left: 4px;
}

.latest-banner {
  overflow: hidden;
}

.latest-banner img {
  width: 100%;
  height: auto;
  display: block;
}

.latest-banner-bar {
  width: 100%;
  border-radius: 12px;
}

.latest-layout__aside {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.latest-aside-ad {
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  box-sizing: border-box;
  transition:
    border-color 0.3s ease,
    transform 0.3s ease;
}

/* Heights for .latest-aside-ad--top and --bottom will be controlled dynamically via JavaScript
   to match exactly three and two news card heights at different resolutions. */

.latest-aside-ad img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.latest-aside-ad:hover {
  border-color: #004494;
  transform: translateY(-2px);
}

/* 分页样式已移到 common.css，此处移除重复定义 */

@media (max-width: 1200px) {
  .latest-layout {
    grid-template-columns: minmax(0, 1.6fr) 320px;
  }

  .latest-card {
    grid-template-columns: 200px minmax(0, 1fr);
    min-height: auto;
    /* in 1200px and below, let card height fully follow content */
    height: auto;
  }

  .latest-card__media {
    width: 200px;
    /* match the left grid column width to avoid overflow */
    height: auto;
  }

  .latest-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

@media (max-width: 1024px) {
  /* 移动端仅保留横幅广告，隐藏侧边广告位 */
  .latest-layout__aside {
    display: none !important;
  }

  .latest-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .latest-layout__aside {
    order: 1;
    /* move ads below main content on narrower screens */
    flex-direction: column;
    /* stack ads vertically, single column */
  }

  .latest-aside-ad {
    flex: none;
    height: auto;
    max-height: 260px;
  }
}

@media (max-width: 768px) {
  .latest-list {
    gap: 0 !important;
  }

  /* Default: Left Text, Right Image layout for latest news */
  .latest-card {
    display: flex;
    flex-direction: row-reverse !important;
    align-items: stretch;
    gap: 12px;
    padding: 16px;
    border-radius: 0;
    border-bottom: 1px solid #eee;
    box-shadow: none !important;
    height: auto !important;
    min-height: auto !important;
    aspect-ratio: auto !important;
    background: #fff;
    margin: 0 !important;
    border-bottom: 1px solid #e5e7eb !important;
  }

  .latest-card__media {
    width: 110px !important;
    height: 75px !important;
    flex-shrink: 0;
    border-radius: 4px;
    aspect-ratio: auto !important;
  }

  .latest-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .latest-card__body {
    padding: 0 !important;
    justify-content: space-between;
    min-width: 0;
    gap: 8px;
    flex: 1;
  }

  /* .latest-card__summary acts as the title here (兼容旧字段) */
  .latest-card__title,
  .latest-card__summary {
    font-size: 15px !important;
    line-height: 1.4 !important;
    -webkit-line-clamp: 2 !important;
    line-clamp: 2 !important;
    font-weight: 500 !important;
    color: #333 !important;
  }

  .latest-card__meta,
  .latest-card__meta-left,
  .latest-card__meta-right {
    font-size: 11px !important;
    color: #999 !important;
  }

  .latest-card__meta {
    margin-top: 8px !important;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px !important;
  }

  .latest-card__meta-left,
  .latest-card__meta-right {
    width: 100%;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .latest-card__meta-left .latest-card__author {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .latest-card .status-chip {
    display: none !important;
  }

  .latest-aside-ad {
    max-height: 220px;
  }

  .latest-aside-ad img,
  .latest-aside-ad video {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  /* Hero Card for the very first item in the list */
  .latest-list--top .latest-card:first-child {
    flex-direction: column !important;
    gap: 0 !important;
    padding: 0 !important;
    border-bottom: none !important;
    background: transparent !important;
    margin-bottom: 8px !important;
    aspect-ratio: auto !important;
  }

  .latest-list--top .latest-card:first-child .latest-card__media {
    width: 100% !important;
    height: 200px !important;
    border-radius: 0 !important;
  }

  .latest-list--top .latest-card:first-child .latest-card__body {
    padding: 16px !important;
    background: #0e3051 !important;
    color: #fff !important;
    position: relative !important;
  }

  .latest-list--top .latest-card:first-child .latest-card__title,
  .latest-list--top .latest-card:first-child .latest-card__summary {
    color: #fff !important;
    font-size: 18px !important;
    font-weight: 600 !important;
  }

  .latest-list--top .latest-card:first-child .latest-card__meta-left,
  .latest-list--top .latest-card:first-child .latest-card__meta-right {
    color: rgba(255, 255, 255, 0.6) !important;
  }

  .latest-list--top .latest-card:first-child .latest-card__meta-label {
    color: rgba(255, 255, 255, 0.8) !important;
  }

  .latest-list--top .latest-card:first-child .status-chip {
    display: block !important;
    top: -16px !important;
    left: 16px !important;
    z-index: 10;
  }
}
