/* ==========================================================================
   OPGDI 首页区块样式（Blocksy + GreenShift 专用）
   
   文件：home-sections.css
   用途：放入子主题 assets/css/ 目录，通过 functions.php 仅在首页加载
   
   命名规范：
   - 所有 class 以 "opgdi-home-" 开头，避免与主题/插件冲突
   - 每个区块完全独立，不依赖外层容器选择器
   - 不使用 :root 变量（Blocksy 可能覆盖），直接写色值
   
   三个区块：
   1. opgdi-home-news    — Latest News 两列卡片 + 轮播控件
   2. opgdi-home-clusters — Research Clusters 四列网格
   3. opgdi-home-events  — Upcoming Events 三列卡片
   ========================================================================== */


/* ==========================================================================
   0. 首页基础设置
   
   DOM 结构：
   ct-container-full > article > entry-content.is-layout-constrained
     > gspb_row.alignfull > gspb_row__col > opgdi-home-news/clusters/events
   
   策略：
   - alignfull 突破 is-layout-constrained 限制，section 背景满屏
   - 内容不用 max-width，用 padding 控制左右边距
   - padding 用 Blocksy 变量，自动和 header 菜单对齐
   - 2560px 大屏也能对齐
   ========================================================================== */

body.home,
body.page-template-front-page {
  overflow-x: hidden;
}

/* 让 GreenShift 的 alignfull 行真正全屏 */
body.home .entry-content.is-layout-constrained > .alignfull,
body.page-template-front-page .entry-content.is-layout-constrained > .alignfull {
  max-width: none !important;
  width: 100vw !important;
  margin-left: calc(-50vw + 50%) !important;
  margin-right: calc(-50vw + 50%) !important;
}

/* 三个 section 自身全屏 + 背景色 */
.opgdi-home-news,
.opgdi-home-clusters,
.opgdi-home-events {
  box-sizing: border-box;
  padding-top: 60px;
  padding-bottom: 60px;
}

.opgdi-home-news,
.opgdi-home-events {
  background: #f0f0ec;
}

.opgdi-home-clusters {
  background: #ffffff;
}

/* 内容区居中 — 用 padding 控制边距，和导航菜单对齐
   
   计算方式和 Blocksy header 一致：
   padding = max(Content Edge Spacing, (100vw - Max Site Width) / 2 + Content Edge Spacing)
   这样在任何屏幕宽度下都能和菜单对齐
*/

/* 组 A：3 个标题 — padding 公式（跟 Header menu 对齐）*/
.opgdi-home-news__title,
.opgdi-home-clusters__title,
.opgdi-home-events__title {
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: max(var(--theme-content-edge-spacing, 5vw), calc((100vw - var(--theme-normal-container-max-width, 1600px)) / 2));
  padding-right: max(var(--theme-content-edge-spacing, 5vw), calc((100vw - var(--theme-normal-container-max-width, 1600px)) / 2));
  box-sizing: border-box;
}

/* 组 B：3 个内容容器（轮播/网格）— max-width 1600 居中，不加 padding
   这样箭头 absolute left:10px 自然叠加在卡片左右两侧 */
.opgdi-home-news__carousel,
.opgdi-home-clusters__grid,
.opgdi-home-events__wrap {
  width: var(--theme-container-width, 90vw);
  max-width: var(--theme-normal-container-max-width, 1600px);
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

/* 响应式 - 小屏上下 padding 缩小 */
@media (max-width: 768px) {
  .opgdi-home-news,
  .opgdi-home-clusters,
  .opgdi-home-events {
    padding-top: 36px;
    padding-bottom: 36px;
  }
}


/* ==========================================================================
   1. LATEST NEWS — 两列新闻卡片 + 轮播控件
   ========================================================================== */

.opgdi-home-news {
  /* padding 和 background 由第0节统一控制 */
}

.opgdi-home-news__title {
  font-family: 'Lora', Georgia, 'Times New Roman', serif;
  font-size: 16px;
  font-weight: 400;
  color: #444444;
  margin: 0 auto 25px;
  transition: color 0.25s ease;
}

.opgdi-home-news__carousel {
  position: relative;
}

/* 轮播 track + slide 淡入淡出 */
.opgdi-home-news__track {
  position: relative;
  overflow: hidden;
}

.opgdi-home-news__slide {
  display: none;
  animation: opgdiFadeIn 0.5s ease;
}

.opgdi-home-news__slide.is-active {
  display: block;
}

.opgdi-home-news__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
}

.opgdi-home-news__card {
  background: #fff;
  text-decoration: none !important;
  color: inherit;
  display: flex;
  flex-direction: column;
}

.opgdi-home-news__card:link,
.opgdi-home-news__card:visited {
  text-decoration: none !important;
  color: inherit;
}

.opgdi-home-news__card:hover .opgdi-home-news__card-title {
  text-decoration: underline;
  color: #694002;
}

.opgdi-home-news__card-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: center;
  display: block;
}

.opgdi-home-news__card-body {
  padding: 20px 24px 24px;
  background: #fff;
  flex: 1;
}

.opgdi-home-news__card-title {
  font-family: 'Lora', Georgia, 'Times New Roman', serif;
  font-size: 22px;
  font-weight: 400;
  color: #002147;
  margin: 0 0 10px;
  line-height: 1.35;
}

.opgdi-home-news__card-date {
  font-family: 'Lora', Georgia, 'Times New Roman', serif;
  font-size: 15px;
  color: #444;
  font-style: italic;
}

/* 轮播左右箭头 — 叠在卡片上方内侧 */
.opgdi-home-news__prev,
.opgdi-home-news__next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 70px;
  background: rgba(134, 36, 51, 0.8);
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 22px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: background 0.2s;
}

.opgdi-home-news__prev:hover,
.opgdi-home-news__next:hover {
  background: rgba(134, 36, 51, 1);
}

.opgdi-home-news__prev { left: 10px; }
.opgdi-home-news__next { right: 10px; }

/* 轮播圆点 */
.opgdi-home-news__dots {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 30px;
  max-width: 100%;
  padding: 0 16px;
  box-sizing: border-box;
}

.opgdi-home-news__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: none;
  background: #ccc;
  cursor: pointer;
  padding: 0;
  flex: 0 0 auto;
}

.opgdi-home-news__dot.is-active {
  background: #862433;
}

.opgdi-home-news__pause {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #333;
  color: #fff;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  margin-left: 16px;
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  flex: 0 0 auto;
}

/* 响应式 */
@media (max-width: 768px) {
  .opgdi-home-news__grid { grid-template-columns: 1fr; }
  .opgdi-home-news__title { font-size: 16px; margin-bottom: 14px; }

  /* 移动端圆点缩小 + 间距压缩，超过一行自动换行 */
  .opgdi-home-news__dot { width: 6px; height: 6px; }
  .opgdi-home-news__dots { gap: 5px; margin-top: 20px; padding: 0 12px; }
  .opgdi-home-news__pause { width: 24px; height: 24px; margin-left: 8px; }
}

@media (max-width: 480px) {
  /* 超小屏：圆点更小 + 间距更紧 */
  .opgdi-home-news__dot { width: 5px; height: 5px; }
  .opgdi-home-news__dots { gap: 4px; padding: 0 8px; }
}

@media (max-width: 600px) {
  .opgdi-home-news__prev,
  .opgdi-home-news__next {
    width: 28px;
    height: 50px;
    font-size: 16px;
    left: 5px;
  }
  .opgdi-home-news__next { left: auto; right: 5px; }
  .opgdi-home-news__card-title { font-size: 19px; }
}


/* ==========================================================================
   2. RESEARCH CLUSTERS — 四列图片网格
   ========================================================================== */

.opgdi-home-clusters {
  /* padding 和 background 由第0节统一控制 */
}

.opgdi-home-clusters__title {
  font-family: 'Lora', Georgia, 'Times New Roman', serif;
  font-size: 16px;
  font-weight: 400;
  color: #444444;
  margin: 0 auto 25px;
  transition: color 0.25s ease;
}

.opgdi-home-clusters__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 30px 20px;
}

.opgdi-home-clusters__card {
  text-decoration: none !important;
  color: inherit;
  display: block;
}

.opgdi-home-clusters__card:link,
.opgdi-home-clusters__card:visited {
  text-decoration: none !important;
  color: inherit;
}

.opgdi-home-clusters__card:hover .opgdi-home-clusters__card-title {
  color: #694002;
  text-decoration: underline;
}

.opgdi-home-clusters__card-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: center;
  display: block;
  background: #f0f0ec;
}

.opgdi-home-clusters__card-title {
  font-family: 'Lora', Georgia, 'Times New Roman', serif;
  font-size: 18px;
  font-weight: 400;
  color: #002147;
  margin: 16px 0 0;
  padding-top: 4px;
}

/* 响应式 */
@media (max-width: 900px) {
  .opgdi-home-clusters__grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .opgdi-home-clusters__title { font-size: 16px; margin-bottom: 14px; }
}

@media (max-width: 500px) {
  .opgdi-home-clusters__grid { grid-template-columns: 1fr; }
}


/* ==========================================================================
   3. UPCOMING EVENTS — 三列事件卡片
   ========================================================================== */

.opgdi-home-events {
  /* padding 和 background 由第0节统一控制 */
}

.opgdi-home-events__title {
  font-family: 'Lora', Georgia, 'Times New Roman', serif;
  font-size: 16px;
  font-weight: 400;
  color: #444444;
  margin: 0 auto 25px;
  transition: color 0.25s ease;
}

.opgdi-home-events__wrap {
  position: relative;
}

/* 轮播 track + slide 淡入淡出 */
.opgdi-home-events__track {
  position: relative;
  overflow: hidden;
}

.opgdi-home-events__slide {
  display: none;
  animation: opgdiFadeIn 0.5s ease;
}

.opgdi-home-events__slide.is-active {
  display: block;
}

.opgdi-home-events__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.opgdi-home-events__card {
  background: #fff;
  display: flex;
  flex-direction: column;
}

.opgdi-home-events__card-img-wrap {
  position: relative;
  overflow: hidden;
}

.opgdi-home-events__card-img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
  background: #f0f0ec;
}

/* 日期徽章 */
.opgdi-home-events__date-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: #862433;
  color: #fff;
  padding: 8px 14px;
  font-family: 'Lora', Georgia, 'Times New Roman', serif;
  font-size: 15px;
  font-weight: bold;
  z-index: 2;
}

/* 链接按钮 */
.opgdi-home-events__link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  background: #ffe296;
  color: #694002;
  padding: 14px 22px;
  font-family: 'Lora', Georgia, 'Times New Roman', serif;
  font-size: 18px;
  text-decoration: none !important;
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 3;
  min-width: 220px;
  max-width: 100%;
  box-sizing: border-box;
}

.opgdi-home-events__link-btn:link,
.opgdi-home-events__link-btn:visited {
  text-decoration: none !important;
  color: #694002;
}

.opgdi-home-events__link-btn::after {
  content: '\203A';
  margin-left: 16px;
  font-size: 24px;
  font-weight: bold;
  color: #694002;
  line-height: 1;
}

.opgdi-home-events__link-btn:hover {
  background: #fcce51;
  color: #694002;
  text-decoration: none;
}

.opgdi-home-events__card-body {
  padding: 16px 20px 20px;
}

.opgdi-home-events__card-type {
  font-size: 13px;
  color: #666;
  font-weight: bold;
  font-family: 'Lora', Georgia, 'Times New Roman', serif;
  margin-bottom: 4px;
  text-transform: capitalize;
}

.opgdi-home-events__card-title {
  font-family: 'Lora', Georgia, 'Times New Roman', serif;
  font-size: 16px;
  font-weight: 400;
  color: #002147;
  margin: 4px 0 8px;
  line-height: 1.35;
  text-decoration: none;
}

.opgdi-home-events__card-location {
  font-size: 13px;
  color: #666;
  line-height: 1.4;
}

/* 左右箭头 — 叠在卡片上方内侧 */
.opgdi-home-events__prev,
.opgdi-home-events__next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 70px;
  background: rgba(134, 36, 51, 0.8);
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 22px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: background 0.2s;
}

.opgdi-home-events__prev:hover,
.opgdi-home-events__next:hover {
  background: rgba(134, 36, 51, 1);
}

.opgdi-home-events__prev { left: 10px; }
.opgdi-home-events__next { right: 10px; }

/* 响应式 */
@media (max-width: 900px) {
  .opgdi-home-events__grid { grid-template-columns: 1fr; }
  .opgdi-home-events__link-btn { min-width: 0; }
}

@media (max-width: 768px) {
  .opgdi-home-events__title { font-size: 16px; margin-bottom: 14px; }

  .opgdi-home-events__dot { width: 6px; height: 6px; }
  .opgdi-home-events__dots { gap: 5px; margin-top: 20px; padding: 0 12px; }
  .opgdi-home-events__pause { width: 24px; height: 24px; margin-left: 8px; }
}

@media (max-width: 480px) {
  .opgdi-home-events__dot { width: 5px; height: 5px; }
  .opgdi-home-events__dots { gap: 4px; padding: 0 8px; }
}

@media (max-width: 600px) {
  .opgdi-home-events__link-btn {
    font-size: 15px;
    padding: 12px 16px;
    min-width: 0;
    width: 100%;
    position: static;
  }
  .opgdi-home-events__prev,
  .opgdi-home-events__next {
    width: 28px;
    height: 50px;
    font-size: 16px;
    left: 5px;
  }
  .opgdi-home-events__next { left: auto; right: 5px; }
}


/* ==========================================================================
   Events 圆点导航
   ========================================================================== */

.opgdi-home-events__dots {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 30px;
  max-width: 100%;
  padding: 0 16px;
  box-sizing: border-box;
}

.opgdi-home-events__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: none;
  background: #ccc;
  cursor: pointer;
  padding: 0;
  flex: 0 0 auto;
}

.opgdi-home-events__dot.is-active {
  background: #862433;
}

.opgdi-home-events__pause {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #333;
  color: #fff;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  margin-left: 16px;
  cursor: pointer;
  font-size: 12px;
  padding: 0;
}


/* ==========================================================================
   淡入动画（News + Events 共用）
   ========================================================================== */

@keyframes opgdiFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
