/* 广告样式自定义 */

/* 广告容器基础样式 */
.md-content__ads {
  margin: 2rem 0;
  text-align: center;
}

.md-content__ads--top {
  margin-bottom: 2rem;
}

/* 腾讯广告容器 */
.tencent-ad-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

/* 广告位样式 */
.ad-slot {
  position: relative;
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
}

/* 顶部横幅广告 */
.ad-slot--banner {
  width: 100%;
  max-width: 970px;
  min-height: 90px;
  background: var(--md-default-bg-color);
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 4px;
  padding: 1rem;
}

/* 侧边栏广告（桌面端） */
.ad-slot--sidebar {
  width: 100%;
  max-width: 300px;
  min-height: 250px;
  background: var(--md-default-bg-color);
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 4px;
  padding: 1rem;
}

/* 文章底部广告 */
.ad-slot--article-bottom {
  width: 100%;
  max-width: 728px;
  min-height: 90px;
  background: var(--md-default-bg-color);
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 4px;
  padding: 1rem;
  margin: 2rem auto;
}

/* 广告加载中占位样式 */
.ad-slot::before {
  content: '';
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    var(--md-default-fg-color--lightest) 25%,
    var(--md-default-fg-color--lighter) 50%,
    var(--md-default-fg-color--lightest) 75%
  );
  background-size: 200% 100%;
  animation: loading 1.5s ease-in-out infinite;
  border-radius: 4px;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* 广告加载完成后隐藏占位符 */
.ad-slot.loaded::before {
  display: none;
}

/* 广告提示文字 */
.ad-disclaimer {
  margin-top: 0.5rem;
  text-align: center;
  opacity: 0.6;
}

/* 自定义广告容器 */
.custom-ad-container {
  margin: 2rem auto;
  max-width: 970px;
  text-align: center;
}

/* 移动端适配 */
@media screen and (max-width: 76.1875em) {
  .ad-slot--banner {
    max-width: 728px;
    min-height: 90px;
  }

  .ad-slot--sidebar {
    display: none; /* 移动端隐藏侧边栏广告 */
  }

  .ad-slot--article-bottom {
    max-width: 100%;
    padding: 0.5rem;
  }
}

@media screen and (max-width: 45em) {
  .ad-slot--banner {
    max-width: 100%;
    min-height: 60px;
    padding: 0.5rem;
  }

  .ad-slot--article-bottom {
    min-height: 60px;
  }
}

/* 深色模式适配 */
[data-md-color-scheme="slate"] .ad-slot {
  background: var(--md-code-bg-color);
  border-color: var(--md-default-fg-color--lightest);
}

/* 评论区样式（在 comments.html 中已包含内联样式） */
.md-content__comments {
  margin-top: 3rem;
  padding-top: 2rem;
}

/* 提升广告容器层级，确保不被其他元素遮挡 */
.md-content__ads {
  position: relative;
  z-index: 1;
}

/* 广告错误处理 */
.ad-slot.error {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--md-default-fg-color--light);
  font-size: 0.875rem;
}

.ad-slot.error::before {
  display: none;
}

.ad-slot.error::after {
  content: '广告加载失败';
}


