:root {
  /* ===== 广告变量 ===== */
  --ad-margin-y: 20px;
  --ad-min-height: 90px;
  --ad-max-width: 728px;

  /* ===== 卡片变量 ===== */
  --card-hover-translate: -2px;
  --card-shadow-color: rgba(0, 0, 0, 0.1);
  --card-transition-duration: 0.2s;

  /* ===== 颜色变量 ===== */
  --ad-placeholder-bg: #f5f5f5;
  --ad-placeholder-border: #ddd;
  --ad-placeholder-text: #999;
}

/* ===== 广告容器基础样式 ===== */
.ad-container {
  margin: var(--ad-margin-y) 0;
  text-align: center;
  min-height: var(--ad-min-height);
}

.ad-container--hidden {
  display: none !important;
  min-height: 0 !important;
  margin: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}

/* 广告在网格中跨整行 */
.articles-grid .ad-container {
  grid-column: 1 / -1;
}

.ad-container iframe {
  max-width: 100%;
}

.ad-container ins.adsbygoogle {
  display: block;
  min-height: inherit;
}

/* ===== 首页广告位特定样式 ===== */
.ad-home-1 {
  margin: var(--ad-margin-y) auto;
  max-width: var(--ad-max-width);
}

.ad-home-inline {
  margin: 30px 0;
  padding: 0 16px;
}

/* ===== 主题页广告位 ===== */
.ad-theme-hero {
  margin: 20px auto 30px;
  max-width: var(--ad-max-width);
}

.ad-theme-inline {
  margin: 25px 0;
}

/* ===== 文章页广告位 ===== */
.ad-article-top {
  margin: var(--ad-margin-y) auto;
  max-width: var(--ad-max-width);
}

.ad-article-inline {
  margin: 30px 0;
}

/* ===== 响应式广告位置控制 ===== */

/* 移动端默认显示，PC端隐藏 */
.ad-mobile-only {
  display: block;
}

@media (min-width: 768px) {
  .ad-mobile-only {
    display: none;
  }
}

/* PC端默认显示，移动端隐藏 */
.ad-desktop-only {
  display: none;
}

@media (min-width: 768px) {
  .ad-desktop-only {
    display: block;
  }
}

/* ===== 卡片点击扩大（关键样式） ===== */
.article-card {
  cursor: pointer;
  position: relative;
  transition:
    transform var(--card-transition-duration) ease,
    box-shadow var(--card-transition-duration) ease;
}

.article-card:hover {
  transform: translateY(var(--card-hover-translate));
  box-shadow: 0 4px 12px var(--card-shadow-color);
}

/* 卡片内链接保持可点击 */
.article-card a,
.article-card .card-title a {
  position: relative;
  z-index: 2;
}

/* 广告在卡片内时，确保广告可点击（不被卡片拦截） */
.article-card .adsbygoogle,
.article-card ins.adsbygoogle {
  position: relative;
  z-index: 3;
  pointer-events: auto !important;
}

/* 卡片图片区域 */
.article-card .card-image {
  pointer-events: none;
}

.article-card .card-image img {
  pointer-events: none;
}

/* ===== 可点击标题样式 ===== */
.clickable-title {
  cursor: pointer;
  position: relative;
}

.clickable-title:hover {
  opacity: 0.8;
}

.clickable-title::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.clickable-title:hover::after {
  transform: scaleX(1);
}

/* ===== 响应式调整 ===== */
@media (max-width: 768px) {
  .ad-container {
    margin: 16px 0;
  }

  .ad-home-inline,
  .ad-theme-inline {
    padding: 0 12px;
  }
}

/* ===== 广告加载占位符 ===== */
.ad-placeholder {
  background: var(--ad-placeholder-bg);
  border: 1px dashed var(--ad-placeholder-border);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--ad-min-height);
  color: var(--ad-placeholder-text);
  font-size: 12px;
}
