/* 全站右侧栏 — 对齐线上 bayase.com 渲染样式（Chrome 抓取对照） */

#sidebar .ct-sidebar .widget_block {
  background-color: unset;
  padding: unset;
  box-shadow: unset;
}

#sidebar .ct-sidebar .widget_block .widget-title {
  margin-block-end: calc(var(--has-theme-content-spacing, 1) * (0.3em + 10px));
}

/* 分享 / 目录 / 行动卡 / 续读：白底圆角卡片，固定 20px padding */
#sidebar .ct-sidebar [data-bp-srs="share"] .wp-widget-group__inner-blocks,
#sidebar .ct-sidebar [data-bp-srs="toc"] .wp-widget-group__inner-blocks,
#sidebar .ct-sidebar [data-bp-srs="actions"] .wp-widget-group__inner-blocks,
#sidebar .ct-sidebar [data-bp-srs="continue"] .wp-widget-group__inner-blocks,
#sidebar .ct-sidebar [data-bp-srs="popular"] .wp-widget-group__inner-blocks {
  background-color: var(--theme-palette-color-11, #ffffff);
  padding: 20px;
  box-sizing: border-box;
  border-radius: 25px;
}

/*
 * 右栏 sticky / 板块间距：不覆盖主题变量。
 * Blocksy global.css 已提供 --sidebar-offset、--sidebar-widgets-spacing 等，
 * 主题自身会用它们算 .ct-sidebar 的 sticky top 与 widget margin-bottom。
 */

/* 搜索框 — palette-10/11 本地可能为空，给回退色 */
#sidebar .ct-sidebar .app-sidebar-search {
  background-color: var(--theme-palette-color-11, #ffffff);
  box-shadow:
    0px 4px 8px rgba(0, 0, 0, 0.04),
    0px 0px 2px rgba(0, 0, 0, 0.06),
    0px 0px 1px rgba(0, 0, 0, 0.04);
  border-radius: 25px;
  padding: 30px 20px 15px 20px;
  position: relative;
}

#sidebar .ct-sidebar .app-sidebar-search .wp-block-search__inside-wrapper {
  border: unset;
  padding: unset;
  padding-right: 20px;
}

#sidebar .ct-sidebar .app-sidebar-search .wp-block-search__label {
  font-size: 13px;
  color: var(--theme-palette-color-10, #767676);
  position: absolute;
  top: 10px;
  left: 20px;
  line-height: 1;
}

#sidebar .ct-sidebar .app-sidebar-search .wp-block-search__input::placeholder {
  color: var(--theme-palette-color-10, #767676);
}

#sidebar .ct-sidebar .app-sidebar-search .wp-block-search__input {
  color: var(--theme-palette-color-3, #3a4f66);
  padding-left: unset;
  font-size: 16px;
  height: 16px;
  background: transparent;
  border: 0;
  box-shadow: none;
}

#sidebar .ct-sidebar .app-sidebar-search .wp-block-search__button {
  background-color: unset;
  position: absolute;
  top: 50%;
  right: 20px;
  transform: translateY(-8px);
  color: var(--theme-palette-color-9, #868686);
  width: 16px;
  height: 16px;
  padding: unset;
  margin: unset;
  min-height: unset;
}

/* 联系横幅比例，防止 LCP 抖动 */
.site-contact-banner .g-site-slot {
  aspect-ratio: 96 / 35;
}

.site-contact-banner .g-site-slot img {
  display: block;
  width: 100%;
  height: auto;
}

/* ——— TOC：对齐 blog-system site-widget-toc ——— */
#sidebar .ct-sidebar .sidebar-toc {
  --bp-toc-text: var(--theme-text-color, var(--theme-palette-color-4, #1e293b));
  --bp-toc-primary: var(--theme-palette-color-1, var(--theme-palette-color-2, #eb6924));
}

.site-widget-toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  max-height: 22rem;
  overflow: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.site-widget-toc__list::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.site-widget-toc__item {
  margin: 0;
  list-style: none;
}

.site-widget-toc__link {
  display: block;
  padding: 0.35rem 0.4rem;
  border-radius: 6px;
  color: color-mix(in srgb, var(--bp-toc-text, #1e293b) 72%, transparent);
  font-size: 0.875rem;
  line-height: 1.45;
  text-decoration: none;
  border: 0 !important;
  box-shadow: none !important;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.site-widget-toc__link:hover,
.site-widget-toc__link:focus-visible {
  color: var(--bp-toc-text, #1e293b);
  background: color-mix(in srgb, var(--bp-toc-text, #1e293b) 5%, transparent);
  text-decoration: none;
  outline: none;
  border: 0 !important;
}

.site-widget-toc__link.is-active {
  color: var(--bp-toc-primary, #eb6924);
  background: color-mix(in srgb, var(--bp-toc-primary, #eb6924) 10%, transparent);
  font-weight: 600;
}

.site-widget-toc__item--h2 > .site-widget-toc__link {
  font-weight: 600;
  color: color-mix(in srgb, var(--bp-toc-text, #1e293b) 88%, transparent);
}

.site-widget-toc__item--h2 > .site-widget-toc__link.is-active,
.site-widget-toc__item--h3 > .site-widget-toc__link.is-active,
.site-widget-toc__item--h4 > .site-widget-toc__link.is-active,
.site-widget-toc__item--h5 > .site-widget-toc__link.is-active,
.site-widget-toc__item--h6 > .site-widget-toc__link.is-active {
  color: var(--bp-toc-primary, #eb6924);
}

.site-widget-toc__item--h3 > .site-widget-toc__link {
  padding-left: 1.1rem;
  font-size: 0.8125rem;
}

.site-widget-toc__item--h4 > .site-widget-toc__link,
.site-widget-toc__item--h5 > .site-widget-toc__link,
.site-widget-toc__item--h6 > .site-widget-toc__link {
  padding-left: 1.85rem;
  font-size: 0.8125rem;
  color: color-mix(in srgb, var(--bp-toc-text, #1e293b) 58%, transparent);
}

.entry-content :is(h2, h3, h4, h5, h6)[id] {
  scroll-margin-top: calc(var(--header-height, 60px) + 16px);
}

/* ——— 分享：对齐 blog-system site-widget-share（左二维码 + 右品牌色小图标） ——— */
.ct-sidebar .sidebar-page-share {
  margin-bottom: unset !important;
}

.site-widget-share.sidebar-page-share {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 14px;
  margin: 0;
  height: auto;
}

.site-widget-share__qr {
  flex: 0 0 auto;
  margin: 0;
  line-height: 0;
}

.site-widget-share__qr-img {
  display: block;
  width: 120px;
  height: 120px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.site-widget-share__actions {
  --share-icon-size: 18px;
  --share-icon-gap: 6px;
  /* 一行最多 4 个；多余换行后由 place-content:center 整组居中（第二行 3 个也会居中） */
  --share-actions-width: calc(var(--share-icon-size) * 4 + var(--share-icon-gap) * 3);
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: center;
  gap: var(--share-icon-gap);
  width: var(--share-actions-width);
  max-width: 100%;
  min-width: 0;
  flex: 0 0 auto;
  height: auto;
}

.site-widget-share__actions > li {
  margin: 0;
  padding: 0;
  list-style: none;
  line-height: 0;
}

.site-widget-share__btn {
  box-sizing: border-box;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 3px;
  background: #64748b;
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  line-height: 0;
  overflow: hidden;
  transition: opacity 0.15s ease, transform 0.12s ease, filter 0.15s ease;
}

.site-widget-share__btn img {
  display: block;
  width: 18px;
  height: 18px;
  border: 0;
}

.site-widget-share__btn--x {
  background: #111111;
}

.site-widget-share__btn--weibo {
  background: #e6162d;
}

.site-widget-share__btn--facebook {
  background: #1877f2;
}

.site-widget-share__btn--linkedin {
  background: #0a66c2;
}

.site-widget-share__btn--telegram {
  background: #2aabee;
}

.site-widget-share__btn--whatsapp {
  background: #25d366;
}

.site-widget-share__btn--email {
  background: #0166ff;
}

.site-widget-share__btn--copy {
  background: #1a73e8;
}

.site-widget-share__btn:hover,
.site-widget-share__btn:focus-visible {
  opacity: 0.84;
  text-decoration: none;
  outline: none;
  filter: brightness(1.05);
}

.site-widget-share__btn:active {
  transform: scale(0.96);
}

.site-widget-share__btn.is-copied {
  background: #16a34a;
  opacity: 1;
}

@media (min-width: 690px) and (max-width: 999.98px) {
  .site-widget-share.sidebar-page-share {
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
  }

  .site-widget-share__qr {
    width: 100%;
    max-width: 200px;
  }

  .site-widget-share__qr-img {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
  }

  .site-widget-share__actions {
    flex: 0 0 auto;
  }
}

/* 分类 / 标签云 — 对齐线上白底圆角胶囊 */
#sidebar .ct-sidebar .wp-block-tag-cloud .tag-cloud-link {
  display: inline-block;
  padding: 8px 20px;
  font-size: 14px !important;
  line-height: 16px;
  border-radius: 12px;
  margin: 0 5px 10px 0;
  box-shadow:
    0px 4px 8px rgba(0, 0, 0, 0.04),
    0px 0px 2px rgba(0, 0, 0, 0.06),
    0px 0px 1px rgba(0, 0, 0, 0.04);
  background-color: #fff;
  color: inherit;
  text-decoration: none;
}

/* ——— 本篇推荐行动 ——— */
.srs-action-cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.srs-action-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  width: 100%;
  margin: 0;
  padding: 0.7rem 0.75rem;
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
  color: inherit;
  border: 1px solid color-mix(in srgb, var(--theme-palette-color-3, #3a4f66) 10%, transparent);
  background: color-mix(in srgb, var(--theme-palette-color-1, #eb6924) 4%, #fff);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  font: inherit;
  box-sizing: border-box;
}

.srs-action-card:hover,
.srs-action-card:focus-visible {
  border-color: color-mix(in srgb, var(--theme-palette-color-1, #eb6924) 35%, transparent);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--theme-palette-color-1, #eb6924) 12%, transparent);
  transform: translateY(-1px);
  outline: none;
}

.srs-action-card__head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.srs-action-card__thumb {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  object-fit: cover;
  background: #f3f4f6;
}

.srs-action-card__title {
  min-width: 0;
  font-size: 0.9375rem;
  font-weight: 650;
  line-height: 1.3;
  color: var(--theme-palette-color-3, #3a4f66);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.srs-action-card__desc {
  font-size: 0.75rem;
  line-height: 1.45;
  color: color-mix(in srgb, var(--theme-palette-color-3, #3a4f66) 62%, transparent);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.srs-action-card .article-nav-code {
  margin: 0.1rem 0 0;
}

.srs-action-card .article-nav-code__capsule {
  width: 100%;
}

.srs-action-card__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.15rem;
  min-height: 2rem;
  padding: 0 0.75rem;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 650;
  color: #fff;
  background: var(--theme-palette-color-1, #eb6924);
}

/* ——— 同题续读 ——— */
.srs-continue-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.srs-continue-item {
  margin: 0;
}

.srs-continue-item__link {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  text-decoration: none !important;
  color: inherit;
}

.srs-continue-item__link:hover .srs-continue-item__title,
.srs-continue-item__link:focus-visible .srs-continue-item__title {
  color: var(--theme-palette-color-1, #eb6924);
}

.srs-continue-item__thumb {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  background: color-mix(in srgb, var(--theme-palette-color-3, #3a4f66) 8%, #fff);
}

.srs-continue-item__thumb--empty {
  display: block;
}

.srs-continue-item__title {
  min-width: 0;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--theme-palette-color-3, #3a4f66);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.15s ease;
}
