/* HHC sidebar layout contract.
   Owns sidebar shells, sidebar cards and first-party sidebar module markup. */

:root {
  --hhc-sidebar-top: var(--wp--custom--component--sidebar-sticky-top, 96px);
  --hhc-sidebar-stack-gap: var(--wp--custom--spacing--sidebar-stack-gap, 16px);
  --hhc-sidebar-card-padding: var(--wp--custom--component--sidebar-card-padding, 20px);
  --hhc-sidebar-card-radius: var(--wp--custom--radius--sidebar-card, 18px);
  --hhc-sidebar-module-gap: 12px;
  --hhc-sidebar-list-gap: 10px;
  --hhc-sidebar-comment-item-gap: 8px;
  --hhc-sidebar-comment-avatar: 42px;
  --hhc-sidebar-inner-card-bg: color-mix(in srgb, var(--hhc-color-card-bg, var(--hhc-surface)) 88%, var(--hhc-color-page-bg, transparent));
}


.hhc-sidebar,
.hhc-front-sidebar,
.hhc-home-sidebar,
.hhc-sidebar-inner {
  display: grid;
  gap: var(--hhc-sidebar-stack-gap, 16px);
  min-width: 0;
  width: 100%;
}

.hhc-sidebar {
  position: sticky;
  top: var(--hhc-sidebar-top, 96px);
  align-self: start;
  grid-template-columns: 1fr;
  height: auto;
  max-height: none;
  overflow: visible;
  padding: 0;
}

.hhc-sidebar-inner,
.hhc-sidebar-section,
.hhc-sidebar-card,
.hhc-sidebar .hhc-widget,
.hhc-front-sidebar .hhc-sidebar-card,
.hhc-home-sidebar .hhc-sidebar-card {
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
  max-width: none;
}

.hhc-sidebar-section,
.hhc-sidebar-card,
.hhc-sidebar .hhc-widget,
.hhc-front-sidebar .hhc-sidebar-card,
.hhc-home-sidebar .hhc-sidebar-card {
  display: grid;
  gap: var(--hhc-sidebar-module-gap, 12px);
  padding: var(--hhc-sidebar-card-padding, clamp(16px, 2vw, 22px));
  border: 1px solid var(--hhc-color-card-border, var(--hhc-border-soft));
  border-radius: var(--hhc-sidebar-card-radius, var(--hhc-radius-lg));
  background: var(--hhc-color-card-bg, var(--hhc-surface));
  color: var(--hhc-color-card-text, var(--hhc-text));
  box-shadow: var(--hhc-shadow-soft);
  overflow: hidden;
}

.hhc-sidebar-title,
.hhc-sidebar-card h2,
.hhc-sidebar .widget-title,
.hhc-widget .widget-title {
  margin: 0;
  color: var(--hhc-color-text-strong, var(--hhc-text-strong));
  font-family: var(--hhc-font-heading);
  font-size: var(--hhc-size-widget-title);
  font-weight: var(--hhc-weight-widget-title);
  line-height: 1.25;
  letter-spacing: var(--hhc-tracking-snug);
}

.hhc-sidebar :where(ul, ol),
.hhc-sidebar-section :where(ul, ol),
.hhc-sidebar-card :where(ul, ol),
.hhc-widget :where(ul, ol) {
  margin: 0;
  padding: 0;
  list-style: none;
}

.hhc-sidebar :where(p, li, a),
.hhc-sidebar-section :where(p, li, a),
.hhc-sidebar-card :where(p, li, a) {
  min-width: 0;
  font-size: var(--hhc-font-size-sidebar);
  line-height: var(--hhc-leading-snug);
  overflow-wrap: anywhere;
}

.hhc-sidebar :where(a) {
  color: var(--hhc-color-text, var(--hhc-text));
  text-decoration: none;
}

.hhc-sidebar :where(a:hover, a:focus-visible) {
  color: var(--hhc-color-link-hover, var(--hhc-color-link));
  text-decoration: none;
}

/* Light-mode latest-post links use the canonical link token for contrast. */
html[data-hhc-color-mode="gunduz"] .hhc-sidebar-latest-posts :where(a),
html[data-hhc-color-mode="gunduz"] .hhc-sidebar .wp-block-latest-posts :where(a) {
  color: var(--hhc-color-link);
}

html[data-hhc-color-mode="gunduz"] .hhc-sidebar-latest-posts :where(a:hover, a:focus-visible),
html[data-hhc-color-mode="gunduz"] .hhc-sidebar .wp-block-latest-posts :where(a:hover, a:focus-visible) {
  color: var(--hhc-color-link-hover);
}

.hhc-sidebar-navigation,
.hhc-sidebar-page-list,
.hhc-sidebar-categories,
.hhc-sidebar-latest-posts,
.hhc-sidebar-latest-comments,
.hhc-sidebar-tag-cloud,
.hhc-sidebar-search,
.hhc-sidebar .wp-block-search,
.hhc-sidebar .wp-block-categories,
.hhc-sidebar .wp-block-page-list,
.hhc-sidebar .wp-block-latest-posts,
.hhc-sidebar .wp-block-latest-comments,
.hhc-sidebar .wp-block-tag-cloud {
  width: 100%;
  max-width: none;
  min-width: 0;
}

/* Menu module: plain link stack, no dividers. */
.hhc-sidebar-menu .wp-block-navigation,
.hhc-sidebar-navigation,
.hhc-sidebar-navigation .wp-block-navigation__container {
  display: grid;
  gap: 9px;
  align-items: stretch;
  width: 100%;
  margin: 0;
  padding: 0;
}

.hhc-sidebar-menu .wp-block-navigation-item,
.hhc-sidebar-menu .wp-block-navigation__container > li,
.hhc-sidebar-menu li.wp-block-navigation-item {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.hhc-sidebar-menu a,
.hhc-sidebar-menu .wp-block-navigation-item__content {
  display: inline-flex;
  align-items: center;
  width: auto;
  min-height: 1.35em;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--hhc-color-text, var(--hhc-text));
  text-decoration: none;
}

.hhc-sidebar-menu a:hover,
.hhc-sidebar-menu .wp-block-navigation-item__content:hover,
.hhc-sidebar-menu a:focus-visible,
.hhc-sidebar-menu .wp-block-navigation-item__content:focus-visible {
  color: var(--hhc-color-link);
}

/* Search module. */
.hhc-sidebar-search-wrap .wp-block-search__inside-wrapper,
.hhc-sidebar .wp-block-search__inside-wrapper {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.hhc-sidebar-search-wrap .wp-block-search__input,
.hhc-sidebar .wp-block-search__input,
.hhc-sidebar .search-field {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
}

.hhc-sidebar-search-wrap .wp-block-search__button,
.hhc-sidebar .wp-block-search__button,
.hhc-sidebar .search-submit {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Companion plugin module: use the sidebar card surface, not a second inner card. */
.hhc-sidebar-gunun-sozu .hhc-gs-box {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  background-image: none;
  color: inherit;
  box-shadow: none;
}

.hhc-sidebar-gunun-sozu .hhc-gs-kicker {
  margin: 0;
  color: var(--hhc-sidebar-highlight-title, var(--hhc-color-link));
  font-family: var(--hhc-font-ui);
  font-size: var(--hhc-font-size-meta);
  font-weight: var(--hhc-weight-tag);
  letter-spacing: var(--hhc-tracking-wide);
  line-height: var(--hhc-leading-tight);
  text-transform: uppercase;
}

.hhc-sidebar-gunun-sozu .hhc-gs-quote,
.hhc-sidebar-gunun-sozu blockquote.hhc-gs-quote {
  margin: 0;
  padding: 0 0 0 16px;
  border: 0 !important;
  border-left: 3px solid transparent !important;
  border-image: var(--hhc-sidebar-highlight-rule, linear-gradient(180deg, var(--hhc-color-link), var(--hhc-color-link-hover))) 1 !important;
  border-radius: 0 !important;
  background: transparent !important;
  background-image: none !important;
  color: var(--hhc-color-card-text, var(--hhc-text));
  box-shadow: none !important;
}

.hhc-sidebar-gunun-sozu .hhc-gs-quote p {
  margin: 0;
  padding: 0;
  background: transparent !important;
  color: inherit;
}

.hhc-sidebar-gunun-sozu .hhc-gs-quote cite {
  display: block;
  margin-top: 8px;
  color: var(--hhc-color-text-muted, var(--hhc-muted));
  font-size: var(--hhc-size-sm);
  font-style: normal;
}

/* Latest posts module. */
.hhc-sidebar-latest-posts,
.hhc-sidebar .wp-block-latest-posts {
  display: grid;
  gap: var(--hhc-sidebar-list-gap, 10px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.hhc-sidebar-latest-posts.wp-block-latest-posts__list li,
.hhc-sidebar .wp-block-latest-posts > li {
  display: grid;
  gap: 5px;
  margin: 0;
}

.hhc-sidebar-latest-posts .wp-block-latest-posts__post-title,
.hhc-sidebar .wp-block-latest-posts__post-title {
  font-family: var(--hhc-font-heading);
  font-size: var(--hhc-font-size-sidebar);
  font-weight: var(--hhc-weight-semibold);
  line-height: var(--hhc-leading-snug);
}

.hhc-sidebar-latest-posts .wp-block-latest-posts__featured-image {
  margin: 0 0 7px;
}

.hhc-sidebar-latest-posts .wp-block-latest-posts__featured-image img {
  display: block;
  width: 100%;
  max-width: none;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--hhc-radius-md, 14px);
}

.hhc-sidebar-latest-posts .wp-block-latest-posts__post-date {
  color: var(--hhc-color-text-muted, var(--hhc-muted));
  font-size: var(--hhc-font-size-sidebar-meta);
  line-height: var(--hhc-leading-snug);
}

/* Taxonomy/page lists remain simple lists. */
.hhc-sidebar-page-list,
.hhc-sidebar-categories,
.hhc-sidebar .wp-block-page-list,
.hhc-sidebar .wp-block-categories {
  display: grid;
  gap: 8px;
}

.hhc-sidebar-page-list li,
.hhc-sidebar-categories li,
.hhc-sidebar .wp-block-page-list > li,
.hhc-sidebar .wp-block-categories > li {
  margin: 0;
}

/* Sidebar tag cloud: PHP sets equal tag-cloud sizes; CSS owns chip surface. */
.hhc-sidebar-tags .wp-block-tag-cloud,
.hhc-sidebar-tag-cloud,
.hhc-sidebar .tagcloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.hhc-sidebar-tags .tag-cloud-link,
.hhc-sidebar-tags a,
.hhc-sidebar-tag-cloud .tag-cloud-link,
.hhc-sidebar-tag-cloud a,
.hhc-sidebar .tagcloud .tag-cloud-link,
.hhc-sidebar .tagcloud a {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid color-mix(in srgb, var(--hhc-color-link) 24%, var(--hhc-color-card-border, var(--hhc-border-soft)));
  border-radius: 999px;
  background: color-mix(in srgb, var(--hhc-color-link) 10%, transparent);
  color: var(--hhc-color-text, var(--hhc-text));
  font-family: var(--hhc-font-ui);
  font-size: var(--hhc-font-size-sidebar);
  font-weight: var(--hhc-weight-semibold);
  line-height: 1.2;
  text-decoration: none;
}

.hhc-sidebar-tags .tag-cloud-link:hover,
.hhc-sidebar-tags a:hover,
.hhc-sidebar-tag-cloud .tag-cloud-link:hover,
.hhc-sidebar-tag-cloud a:hover,
.hhc-sidebar .tagcloud .tag-cloud-link:hover,
.hhc-sidebar .tagcloud a:hover {
  border-color: color-mix(in srgb, var(--hhc-color-link) 46%, var(--hhc-color-card-border, var(--hhc-border-soft)));
  background: color-mix(in srgb, var(--hhc-color-link) 16%, transparent);
  color: var(--hhc-color-text-strong, var(--hhc-text-strong));
}

/* Latest comments module: carded items, scoped to the comments module only.
   Core wp:latest-comments output keeps the 2.3.108 visual contract.
   HHC dynamic recent-comments output is excluded and owned by comments.css. */
.hhc-sidebar-comments .hhc-sidebar-latest-comments:not(.hhc-recent-comments-list),
.hhc-sidebar-comments .wp-block-latest-comments:not(.hhc-recent-comments-list) {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.hhc-sidebar-comments .wp-block-latest-comments:not(.hhc-recent-comments-list) .wp-block-latest-comments__comment,
.hhc-sidebar-comments .has-avatars:not(.hhc-recent-comments-list) .wp-block-latest-comments__comment {
  display: grid;
  grid-template-columns: var(--hhc-sidebar-comment-avatar, 42px) minmax(0, 1fr);
  gap: 11px;
  align-items: start;
  min-height: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--hhc-color-card-border, var(--hhc-border-soft));
  border-radius: 16px;
  background: var(--hhc-sidebar-inner-card-bg);
  box-shadow: none;
}

.hhc-sidebar-comments .wp-block-latest-comments:not(.hhc-recent-comments-list) .wp-block-latest-comments__comment + .wp-block-latest-comments__comment {
  margin-top: var(--hhc-sidebar-comment-item-gap, 8px);
}

.hhc-sidebar-comments .wp-block-latest-comments:not(.hhc-recent-comments-list):not(.has-avatars) .wp-block-latest-comments__comment {
  display: block;
}

.hhc-sidebar-comments .wp-block-latest-comments:not(.hhc-recent-comments-list) .wp-block-latest-comments__comment-avatar,
.hhc-sidebar-comments .wp-block-latest-comments:not(.hhc-recent-comments-list) .wp-block-latest-comments__comment .avatar {
  grid-column: 1;
  width: var(--hhc-sidebar-comment-avatar, 42px);
  height: var(--hhc-sidebar-comment-avatar, 42px);
  max-width: var(--hhc-sidebar-comment-avatar, 42px);
  max-height: var(--hhc-sidebar-comment-avatar, 42px);
  margin: 0;
  object-fit: cover;
  border: 1px solid color-mix(in srgb, var(--hhc-color-link) 26%, transparent);
  border-radius: var(--hhc-radius-pill, 999px);
}

.hhc-sidebar-comments .has-avatars:not(.hhc-recent-comments-list) .wp-block-latest-comments__comment .wp-block-latest-comments__comment-meta,
.hhc-sidebar-comments .has-avatars:not(.hhc-recent-comments-list) .wp-block-latest-comments__comment .wp-block-latest-comments__comment-excerpt,
.hhc-sidebar-comments .wp-block-latest-comments:not(.hhc-recent-comments-list) .wp-block-latest-comments__comment article,
.hhc-sidebar-comments .wp-block-latest-comments:not(.hhc-recent-comments-list) .wp-block-latest-comments__comment-meta,
.hhc-sidebar-comments .wp-block-latest-comments:not(.hhc-recent-comments-list) .wp-block-latest-comments__comment-excerpt {
  grid-column: 2;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.hhc-sidebar-comments .wp-block-latest-comments:not(.hhc-recent-comments-list) .wp-block-latest-comments__comment-meta {
  color: var(--hhc-color-text, var(--hhc-text));
  font-family: var(--hhc-font-ui);
  font-size: var(--hhc-font-size-sidebar);
  line-height: var(--hhc-leading-snug);
}

.hhc-sidebar-comments .wp-block-latest-comments:not(.hhc-recent-comments-list) .wp-block-latest-comments__comment-date {
  display: block;
  margin-top: 2px;
  color: var(--hhc-color-text-muted, var(--hhc-muted));
  font-size: var(--hhc-font-size-sidebar-meta);
  line-height: var(--hhc-leading-snug);
}

.hhc-sidebar-comments .wp-block-latest-comments:not(.hhc-recent-comments-list) .wp-block-latest-comments__comment-excerpt p {
  margin: 4px 0 0;
  color: var(--hhc-color-text-muted, var(--hhc-muted));
  font-size: var(--hhc-font-size-sidebar-meta);
  line-height: var(--hhc-leading-snug);
}


.hhc-sidebar-custom-area {
  overflow-wrap: anywhere;
}

.hhc-sidebar-custom-area :where(p, figure, ul, ol, blockquote),
.hhc-sidebar-promo p {
  margin-block: 0;
}

.hhc-sidebar-custom-area :where(img, iframe) {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--hhc-radius-sm, 12px);
}

@media (max-width: 1180px) {
  .hhc-front-sidebar,
  .hhc-home-sidebar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .hhc-sidebar {
    position: static;
  }

  .hhc-blog-layout > .hhc-sidebar,
  .hhc-archive-layout > .hhc-sidebar,
  .hhc-single-layout > .hhc-sidebar,
  .hhc-page-layout > .hhc-sidebar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 782px) {
  .hhc-sidebar,
  .hhc-front-sidebar,
  .hhc-home-sidebar,
  .hhc-blog-layout > .hhc-sidebar,
  .hhc-archive-layout > .hhc-sidebar,
  .hhc-single-layout > .hhc-sidebar,
  .hhc-page-layout > .hhc-sidebar {
    grid-template-columns: 1fr;
  }

  .hhc-sidebar-search-wrap .wp-block-search__inside-wrapper,
  .hhc-sidebar .wp-block-search__inside-wrapper {
    flex-wrap: wrap;
  }

  .hhc-sidebar-search-wrap .wp-block-search__button,
  .hhc-sidebar .wp-block-search__button,
  .hhc-sidebar .search-submit {
    width: 100%;
  }
}



/* Sidebar column width is canonical across page/single/list templates. */
@media (min-width: 1101px) {
  .hhc-layout-with-sidebar > :where(.hhc-sidebar, .hhc-fse-sidebar) {
    width: 100%;
    max-width: var(--hhc-layout-sidebar);
  }
}
