/* クジョシル / サイドバー仕上げ v1.2
   対象はトップページ以外のCocoonサイドバーのみ。
   v1.1の .ks-cat-tree と開閉ボタンには触れません。 */
body:not(.kujosiru-custom-home) #sidebar,
body:not(.kujosiru-custom-home) .sidebar {
  --ks-sidebar-green: #0f5c4a;
  --ks-sidebar-text: #1f2b28;
  --ks-sidebar-line: #e2e9e6;
  color: var(--ks-sidebar-text);
}

/* セクションの距離・見出しを統一。既存ウィジェットの位置や順番は保持。 */
body:not(.kujosiru-custom-home) #sidebar .widget,
body:not(.kujosiru-custom-home) .sidebar .widget {
  margin-bottom: 28px;
}
body:not(.kujosiru-custom-home) #sidebar .widget-title,
body:not(.kujosiru-custom-home) .sidebar .widget-title,
body:not(.kujosiru-custom-home) #sidebar .widget > h2:first-child,
body:not(.kujosiru-custom-home) .sidebar .widget > h2:first-child,
body:not(.kujosiru-custom-home) #sidebar .widget .wp-block-group > h2:first-child,
body:not(.kujosiru-custom-home) .sidebar .widget .wp-block-group > h2:first-child {
  box-sizing: border-box;
  margin: 0 0 14px !important;
  padding: 12px 15px !important;
  border: 0 !important;
  border-radius: 8px !important;
  background: var(--ks-sidebar-green) !important;
  color: #fff !important;
  font-size: 17px !important;
  font-weight: 800 !important;
  line-height: 1.45 !important;
  letter-spacing: .02em;
  box-shadow: none !important;
}

/* 新着記事・アーカイブ・最近のコメントだけ：カテゴリー階層は既存v1.1に任せる。 */
body:not(.kujosiru-custom-home) #sidebar .wp-block-latest-posts,
body:not(.kujosiru-custom-home) #sidebar .wp-block-archives-list,
body:not(.kujosiru-custom-home) #sidebar .wp-block-latest-comments,
body:not(.kujosiru-custom-home) .sidebar .wp-block-latest-posts,
body:not(.kujosiru-custom-home) .sidebar .wp-block-archives-list,
body:not(.kujosiru-custom-home) .sidebar .wp-block-latest-comments {
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
}
body:not(.kujosiru-custom-home) #sidebar .wp-block-latest-posts > li,
body:not(.kujosiru-custom-home) #sidebar .wp-block-archives-list > li,
body:not(.kujosiru-custom-home) #sidebar .wp-block-latest-comments > li,
body:not(.kujosiru-custom-home) .sidebar .wp-block-latest-posts > li,
body:not(.kujosiru-custom-home) .sidebar .wp-block-archives-list > li,
body:not(.kujosiru-custom-home) .sidebar .wp-block-latest-comments > li {
  box-sizing: border-box;
  margin: 0 !important;
  padding: 11px 2px !important;
  border-bottom: 1px solid var(--ks-sidebar-line);
  font-size: 14px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
body:not(.kujosiru-custom-home) #sidebar .wp-block-latest-posts > li:last-child,
body:not(.kujosiru-custom-home) #sidebar .wp-block-archives-list > li:last-child,
body:not(.kujosiru-custom-home) #sidebar .wp-block-latest-comments > li:last-child,
body:not(.kujosiru-custom-home) .sidebar .wp-block-latest-posts > li:last-child,
body:not(.kujosiru-custom-home) .sidebar .wp-block-archives-list > li:last-child,
body:not(.kujosiru-custom-home) .sidebar .wp-block-latest-comments > li:last-child {
  border-bottom: 0;
}
body:not(.kujosiru-custom-home) #sidebar .wp-block-latest-posts a,
body:not(.kujosiru-custom-home) #sidebar .wp-block-archives-list a,
body:not(.kujosiru-custom-home) #sidebar .wp-block-latest-comments a,
body:not(.kujosiru-custom-home) .sidebar .wp-block-latest-posts a,
body:not(.kujosiru-custom-home) .sidebar .wp-block-archives-list a,
body:not(.kujosiru-custom-home) .sidebar .wp-block-latest-comments a {
  color: var(--ks-sidebar-text);
  text-decoration: none;
  transition: color .15s ease;
}
body:not(.kujosiru-custom-home) #sidebar .wp-block-latest-posts a:hover,
body:not(.kujosiru-custom-home) #sidebar .wp-block-archives-list a:hover,
body:not(.kujosiru-custom-home) #sidebar .wp-block-latest-comments a:hover,
body:not(.kujosiru-custom-home) .sidebar .wp-block-latest-posts a:hover,
body:not(.kujosiru-custom-home) .sidebar .wp-block-archives-list a:hover,
body:not(.kujosiru-custom-home) .sidebar .wp-block-latest-comments a:hover {
  color: var(--ks-sidebar-green);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* 検索欄の高さ・角丸をトップの共通デザインに寄せる。 */
body:not(.kujosiru-custom-home) #sidebar .wp-block-search__inside-wrapper,
body:not(.kujosiru-custom-home) .sidebar .wp-block-search__inside-wrapper {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
body:not(.kujosiru-custom-home) #sidebar .wp-block-search__input,
body:not(.kujosiru-custom-home) .sidebar .wp-block-search__input {
  min-width: 0;
  border: 1px solid #cbdcd3;
  border-radius: 7px;
  padding: 10px 12px;
  font-size: 14px;
}
body:not(.kujosiru-custom-home) #sidebar .wp-block-search__button,
body:not(.kujosiru-custom-home) .sidebar .wp-block-search__button {
  margin: 0 !important;
  border: 0;
  border-radius: 7px;
  background: var(--ks-sidebar-green);
  color: #fff;
  padding: 9px 15px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}
body:not(.kujosiru-custom-home) #sidebar a:focus-visible,
body:not(.kujosiru-custom-home) #sidebar button:focus-visible,
body:not(.kujosiru-custom-home) .sidebar a:focus-visible,
body:not(.kujosiru-custom-home) .sidebar button:focus-visible {
  outline: 3px solid #f97316;
  outline-offset: 2px;
}
@media (max-width: 767px) {
  body:not(.kujosiru-custom-home) #sidebar .widget-title,
  body:not(.kujosiru-custom-home) .sidebar .widget-title,
  body:not(.kujosiru-custom-home) #sidebar .widget .wp-block-group > h2:first-child,
  body:not(.kujosiru-custom-home) .sidebar .widget .wp-block-group > h2:first-child {
    font-size: 16px !important;
    padding: 11px 13px !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  body:not(.kujosiru-custom-home) #sidebar a,
  body:not(.kujosiru-custom-home) .sidebar a { transition: none; }
}
