/**
 * 全主题通用小工具样式（页脚 / 侧栏 / 首页区块）
 * 各主题可在自身 CSS 中覆盖 .yh-widgets 下的细节
 */
.yh-widgets {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.yh-widgets--footer {
  gap: 1.25rem;
}

/* 页脚小工具列：嵌入各主题 footer grid 时使用 */
.yh-footer-widgets-col {
  min-width: 0;
  grid-column: 1 / -1;
}

@media (min-width: 768px) {
  .yh-footer-widgets-col {
    grid-column: auto;
  }

  /* 3 列页脚网格 + 小工具列 → 扩展为 4 列 */
  .if-footer-grid:has(.yh-footer-widgets-col),
  .ph-footer-grid:has(.yh-footer-widgets-col),
  .tx-footer-grid:has(.yh-footer-widgets-col),
  .ag-footer-grid:has(.yh-footer-widgets-col),
  .ts-footer-grid:has(.yh-footer-widgets-col) {
    grid-template-columns: 1.25fr 1fr 1fr 1fr;
  }
}

@media (min-width: 1024px) {
  .if-footer-grid:has(.yh-footer-widgets-col),
  .ph-footer-grid:has(.yh-footer-widgets-col),
  .tx-footer-grid:has(.yh-footer-widgets-col) {
    grid-template-columns: 1.35fr 1fr 1fr 1.1fr;
  }

  .ag-footer-grid:has(.yh-footer-widgets-col),
  .ts-footer-grid:has(.yh-footer-widgets-col) {
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
  }
}

.yh-widgets--homepage-top,
.yh-widgets--homepage-before-posts,
.yh-widgets--homepage-after-posts {
  margin: 1.5rem 0;
}

.yh-widgets .widget,
.yh-widgets section.widget {
  background: var(--yh-widget-bg, #fff);
  border: 1px solid var(--yh-widget-border, rgba(0, 0, 0, 0.08));
  border-radius: var(--yh-widget-radius, 8px);
  padding: 1rem 1.125rem;
  font-size: 0.9375rem;
  line-height: 1.65;
}

.yh-widgets--footer .widget,
.yh-widgets--footer section.widget {
  background: var(--yh-widget-footer-bg, transparent);
  border: 0;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  color: var(--yh-widget-footer-text, inherit);
}

.yh-widgets--footer .widget h3,
.yh-widgets--footer section.widget h3 {
  margin-bottom: 0.65rem;
  font-size: 0.8125rem;
  font-weight: 650;
}

.yh-widgets .widget h3,
.yh-widgets section.widget h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.yh-widgets .widget ul,
.yh-widgets section.widget ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.yh-widgets .widget li + li,
.yh-widgets section.widget li + li {
  margin-top: 0.35rem;
}

.yh-widgets .widget a,
.yh-widgets section.widget a {
  color: inherit;
  text-decoration: none;
}

.yh-widgets .widget a:hover,
.yh-widgets section.widget a:hover {
  text-decoration: underline;
}

.yh-widgets .widget-search input[type="search"],
.yh-widgets .widget-search input[type="text"] {
  width: 100%;
  box-sizing: border-box;
}

.yh-widgets .widget-ad-media,
.yh-widgets .widget-ad-media img,
.yh-widgets .widget-ad-media video {
  max-width: 100%;
  height: auto;
  display: block;
}

.yh-widgets .widget-text p:last-child {
  margin-bottom: 0;
}

.yh-sidebar-widgets.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}
