/* ── Fix 1: 卡片列表使用当前明暗主题的不透明背景 ── */
.dream-grid .dream-column > .card,
.dream-grid .dream-column > .card:hover,
.dream-grid .dream-column > .card:focus,
.dream-grid .dream-column > .card:focus-visible,
.dream-grid .dream-column > .card > figure,
.dream-grid .dream-column > .card > .card-body,
.dream-grid .dream-column > .card:hover > .card-body,
.dream-grid .dream-column > .card:focus > .card-body {
  background: var(--color-base-100) !important;
  background-color: var(--color-base-100) !important;
}

.dream-grid .dream-column > .card,
.dream-grid .dream-column > .card:hover,
.dream-grid .dream-column > .card:focus,
.dream-grid .dream-column > .card:focus-visible {
  border-color: color-mix(in oklab, var(--color-base-content) 18%, transparent) !important;
  opacity: 1 !important;
  overflow: hidden;
}

.dream-grid .dream-column > .card > figure {
  border-start-start-radius: inherit;
  border-start-end-radius: inherit;
}

.dream-grid .dream-column > .card > .card-body {
  border-end-start-radius: inherit;
  border-end-end-radius: inherit;
}

.dream-grid .dream-column > .card:hover,
.dream-grid .dream-column > .card:focus,
.dream-grid .dream-column > .card:focus-visible {
  box-shadow: 0 1rem 3rem color-mix(in oklab, var(--color-base-content) 12%, transparent) !important;
}

/* ── Fix 2: 文章详情页内容区域使用不透明背景 ── */
#dream-single-post-main {
  background-color: var(--color-base-100) !important;
  padding: 2rem;
  border-radius: 1rem;
  box-shadow: 0 1rem 3rem color-mix(in oklab, var(--color-base-content) 8%, transparent);
}

@media (max-width: 1024px) {
  #dream-single-post-main {
    padding: 1.25rem;
  }
}

html.dark #dream-single-post-main {
  background-color: var(--color-base-100) !important;
}

/* ── Fix 3: 宽屏下内容区自适应 ── */
@media (min-width: 1024px) {
  /* grid 改 flex，内容撑满，TOC固定200px */
  .lg\:grid-cols-4 {
    display: flex !important;
    flex-direction: row;
    gap: 1.5rem;
    align-items: flex-start;
  }

  /* 隐藏左侧空白列 */
  .lg\:grid-cols-4 > div:first-child {
    display: none !important;
  }

  /* 内容区自适应 */
  .lg\:col-span-2 {
    flex: 1 1 auto;
    min-width: 0;
    width: max(50vw, 960px);
    max-width: calc(100vw - 280px);
    margin: 0 auto;
  }

  #dream-single-post-main {
    width: 100%;
    max-width: none;
  }

  /* TOC固定200px */
  .lg\:grid-cols-4 > div:last-child {
    display: block !important;
    width: 200px;
    flex-shrink: 0;
    position: sticky;
    top: 1rem;
  }
}

@media (min-width: 1600px) {
  .lg\:col-span-2 {
    width: 60vw;
    max-width: 1280px;
  }
}

/* ── 内容区表格和图片自适应 ── */
#dream-single-post-content table {
  display: block;
  overflow-x: auto;
  max-width: 100%;
}

@media (min-width: 768px) {
  #dream-single-post-content table {
    white-space: normal;
  }
}

#dream-single-post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
}

#dream-single-post-content pre {
  max-width: 100%;
  overflow-x: auto;
}
