/**
 * bbPress Modern / Centro Herzog palette
 * Scoped to #bbpress-forums: avoids changing global Elementor/theme UI.
 * Fonts are expected to be loaded by the site's design system.
 */

#bbpress-forums {
  --chm-primary: var(--e-global-color-primary, #3a509c);
  --chm-secondary: var(--e-global-color-secondary, #c2ad1d);
  --chm-secondary-accessible: #746508; /* readable small text on white */
  --chm-ink: #243047;
  --chm-muted: #5d6779;
  --chm-surface: #fff;
  --chm-soft: #f5f7fc;
  --chm-line: #e4e9f3;
  --chm-radius: 16px;
  --chm-focus: #233b92;
  --chm-shadow: 0 6px 22px rgba(32, 48, 89, .055);
  --chm-row: #f7f8fb;
  --chm-row-hover: #eef1f7;
  color: var(--chm-ink);
  font-family: "Open Sans", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  max-width: 100%;
  margin: 0;
}

#bbpress-forums *,
#bbpress-forums *::before,
#bbpress-forums *::after {
  box-sizing: border-box;
}

#bbpress-forums a {
  color: var(--chm-primary);
  text-decoration: none;
  text-underline-offset: .16em;
}

#bbpress-forums a:hover { color: var(--chm-secondary-accessible); }
#bbpress-forums a:focus-visible,
#bbpress-forums button:focus-visible,
#bbpress-forums input:focus-visible,
#bbpress-forums select:focus-visible,
#bbpress-forums textarea:focus-visible {
  outline: 3px solid var(--chm-focus);
  outline-offset: 3px;
}

/* Headings and useful links, rather than visual clutter. */
#bbpress-forums h1,
#bbpress-forums h2,
#bbpress-forums h3,
#bbpress-forums .bbp-forum-title,
#bbpress-forums .bbp-topic-permalink {
  overflow-wrap: anywhere;
}

#bbpress-forums h1,
#bbpress-forums h2,
#bbpress-forums h3,
#bbpress-forums fieldset.bbp-form legend {
  color: var(--chm-primary);
  font-family: "Oswald", "Arial Narrow", Arial, sans-serif;
  font-weight: 500;
  line-height: 1.18;
  text-transform: uppercase;
  letter-spacing: .02em;
}

#bbpress-forums h1 { font-size: clamp(2rem, 4.5vw, 3.2rem); }
#bbpress-forums h2 { font-size: clamp(1.65rem, 3vw, 2.35rem); }
#bbpress-forums h3 { font-size: clamp(1.35rem, 2.5vw, 1.8rem); }
#bbpress-forums .bbp-forum-title {
  color: var(--chm-primary);
  font-family: "Oswald", "Arial Narrow", Arial, sans-serif;
  font-size: clamp(1.28rem, 2vw, 1.55rem);
  font-weight: 500;
  line-height: 1.3;
  text-transform: uppercase;
}

#bbpress-forums .bbp-topic-permalink {
  color: var(--chm-primary);
  font-family: "Oswald", "Arial Narrow", Arial, sans-serif;
  font-size: clamp(1.18rem, 1.65vw, 1.4rem);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: .015em;
}
#bbpress-forums .bbp-topic-permalink:hover,
#bbpress-forums .bbp-forum-title:hover {
  color: var(--chm-secondary-accessible);
  text-decoration: underline;
}

/* Topic and forum lists: soft cards with a restrained hierarchy. */
#bbpress-forums ul.bbp-forums,
#bbpress-forums ul.bbp-topics,
#bbpress-forums ul.bbp-replies,
#bbpress-forums ul.bbp-search-results {
  background: transparent;
  border: 0;
  margin: 0 0 2rem;
  padding: 0;
}

#bbpress-forums li.bbp-header {
  background: var(--chm-soft);
  border: 0;
  border-radius: 12px;
  color: var(--chm-muted);
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .025em;
  margin-bottom: 12px;
  padding: .9rem 1.3rem;
}
#bbpress-forums li.bbp-footer { display: none; }
#bbpress-forums li.bbp-body { border: 0; padding: 0; }

#bbpress-forums .bbp-header ul.forum-titles,
#bbpress-forums li.bbp-body > ul.forum,
#bbpress-forums li.bbp-body > ul.topic {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 5.5rem 5.5rem 11rem;
  align-items: center;
  gap: 1rem;
}

#bbpress-forums .bbp-header ul.forum-titles {
  padding: 0;
  margin: 0;
  background: transparent;
}
#bbpress-forums li.bbp-header li,
#bbpress-forums li.bbp-body > ul.forum > li,
#bbpress-forums li.bbp-body > ul.topic > li {
  float: none;
  width: auto;
  min-width: 0;
  padding: 0;
  margin: 0;
}

#bbpress-forums li.bbp-body > ul.forum,
#bbpress-forums li.bbp-body > ul.topic {
  background: var(--chm-row);
  border: 0;
  border-radius: var(--chm-radius);
  box-shadow: none;
  margin: 0 0 12px;
  padding: 1.35rem 1.3rem;
  transition: background-color .18s ease;
}

#bbpress-forums li.bbp-body > ul.forum:hover,
#bbpress-forums li.bbp-body > ul.topic:hover {
  background: var(--chm-row-hover);
}

#bbpress-forums li.bbp-body > ul.forum > li:not(:first-child),
#bbpress-forums li.bbp-body > ul.topic > li:not(:first-child) {
  color: var(--chm-muted);
  font-size: .88rem;
  text-align: center;
}
#bbpress-forums li.bbp-body > ul.forum > li:last-child,
#bbpress-forums li.bbp-body > ul.topic > li:last-child {
  text-align: left;
}

#bbpress-forums .bbp-forum-content,
#bbpress-forums .bbp-forum-description,
#bbpress-forums .bbp-topic-description,
#bbpress-forums p.bbp-topic-meta,
#bbpress-forums p.bbp-forum-meta {
  color: var(--chm-muted);
  font-size: .9rem;
  line-height: 1.55;
  margin: .45rem 0 0;
}
#bbpress-forums p.bbp-topic-meta a,
#bbpress-forums p.bbp-forum-meta a { color: var(--chm-muted); }
#bbpress-forums .bbp-topic-started-in { display: none; } /* Avoid cross-forum navigation cues. */
#bbpress-forums .bbp-topic-pagination { font-size: .86rem; }
#bbpress-forums .bbp-forum-freshness a,
#bbpress-forums .bbp-topic-freshness a { font-size: .9rem; }

/* Replies: readable two-column messages, grouped as individual cards. */
#bbpress-forums ul.bbp-replies > li.bbp-header { display: none; }
#bbpress-forums ul.bbp-replies li.bbp-body > .bbp-reply-header {
  background: var(--chm-soft);
  border: 0;
  border-radius: 14px 14px 0 0;
  padding: .65rem 1.3rem;
  margin-top: 1rem;
  min-height: 0;
}
#bbpress-forums .bbp-reply-header .bbp-meta {
  color: var(--chm-muted);
  font-size: .82rem;
  line-height: 1.5;
}
#bbpress-forums ul.bbp-replies li.bbp-body > .bbp-reply-header + div {
  display: grid;
  grid-template-columns: minmax(0, 10.5rem) minmax(0, 1fr);
  gap: 1.5rem;
  background: var(--chm-surface);
  box-shadow: var(--chm-shadow);
  border: 0;
  border-radius: 0 0 14px 14px;
  padding: 1.45rem 1.3rem;
  margin: 0;
}
#bbpress-forums div.bbp-reply-author {
  float: none;
  width: auto;
  min-width: 0;
  padding: 0;
  margin: 0;
  text-align: left;
  font-size: .92rem;
}
#bbpress-forums div.bbp-reply-author .bbp-author-name {
  display: block;
  font-weight: 700;
  color: var(--chm-ink);
  overflow-wrap: anywhere;
}
#bbpress-forums div.bbp-reply-author .bbp-author-avatar img.avatar {
  display: block;
  width: 48px;
  height: 48px;
  max-width: 100%;
  border: 0;
  border-radius: 50%;
  margin: 0 0 .6rem;
  object-fit: cover;
}
#bbpress-forums .bbp-author-role,
#bbpress-forums .bbp-reply-ip { color: var(--chm-muted); font-size: .78rem; }
#bbpress-forums div.bbp-reply-content {
  color: var(--chm-ink);
  font-size: 1rem;
  line-height: 1.75;
  float: none;
  min-width: 0;
  min-height: 0;
  width: auto;
  margin: 0;
  padding: 0;
  overflow-wrap: anywhere;
}
#bbpress-forums div.bbp-reply-content p { margin: 0 0 1rem; }
#bbpress-forums div.bbp-reply-content p:last-child { margin-bottom: 0; }
#bbpress-forums div.bbp-reply-content img,
#bbpress-forums div.bbp-reply-content iframe,
#bbpress-forums div.bbp-reply-content video { max-width: 100%; height: auto; }
#bbpress-forums div.bbp-reply-content pre { max-width: 100%; overflow-x: auto; }

/* Forms: generous touch targets and simple, recognizable control states. */
#bbpress-forums fieldset.bbp-form {
  background: var(--chm-soft);
  border: 0;
  border-radius: var(--chm-radius);
  padding: clamp(1.25rem, 3vw, 2rem);
  margin: 2rem 0;
  min-width: 0;
}
#bbpress-forums fieldset.bbp-form > legend {
  /* Float cancels the legend's special border-placement behavior. */
  float: left;
  display: block;
  width: 100%;
  max-width: 100%;
  background: transparent;
  font-size: clamp(1.16rem, 1.6vw, 1.5rem);
  line-height: 1.35;
  padding: 0;
  margin: 0 0 1.25rem;
  overflow-wrap: anywhere;
}
#bbpress-forums fieldset.bbp-form > legend + * { clear: both; }
#bbpress-forums fieldset.bbp-form label {
  display: inline-block;
  color: var(--chm-ink);
  font-size: .95rem;
  font-weight: 700;
  margin: 15px 0;
}
#bbpress-forums fieldset.bbp-form input[type="checkbox"] + label {
  display: inline;
  margin: 0;
}
#bbpress-forums input[type="text"],
#bbpress-forums input[type="email"],
#bbpress-forums input[type="url"],
#bbpress-forums input[type="password"],
#bbpress-forums select,
#bbpress-forums textarea {
  background: #fff;
  color: var(--chm-ink);
  border: 1px solid #cbd4e5;
  border-radius: 10px;
  box-shadow: none;
  font-family: "Open Sans", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  min-height: 46px;
  max-width: 100%;
  padding: .72rem .9rem;
}
#bbpress-forums input[type="text"],
#bbpress-forums input[type="email"],
#bbpress-forums input[type="url"],
#bbpress-forums input[type="password"],
#bbpress-forums textarea { width: 100%; }
/* Taller text fields and native select controls, as requested. */
#bbpress-forums fieldset.bbp-form input[type="password"],
#bbpress-forums fieldset.bbp-form input[type="text"],
#bbpress-forums fieldset.bbp-form select {
  height: auto;
  min-height: calc(1.5em + 50px);
  padding: 25px 15px;
}
#bbpress-forums textarea { min-height: 145px; resize: vertical; }
#bbpress-forums .wp-editor-wrap,
#bbpress-forums .wp-editor-container { max-width: 100%; }
#bbpress-forums .bbp-submit-wrapper button,
#bbpress-forums .bbp-submit-wrapper .button,
#bbpress-forums fieldset.bbp-form input[type="submit"],
#bbpress-forums a.bbp-topic-reply-link,
#bbpress-forums a.bbp-reply-to-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  max-width: 100%;
  background: #3a509c;
  border: 0;
  border-radius: 9px;
  box-shadow: none;
  color: #fff;
  cursor: pointer;
  font-family: "Oswald", "Arial Narrow", Arial, sans-serif;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: .035em;
  text-decoration: none;
  text-transform: uppercase;
  padding: .8rem 1.25rem;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}
#bbpress-forums .bbp-submit-wrapper button:hover,
#bbpress-forums .bbp-submit-wrapper .button:hover,
#bbpress-forums fieldset.bbp-form input[type="submit"]:hover,
#bbpress-forums a.bbp-topic-reply-link:hover,
#bbpress-forums a.bbp-reply-to-link:hover {
  background: #c2ad1d;
  border-color: transparent;
  color: #fff;
}
#bbpress-forums .bbp-submit-wrapper button:focus-visible,
#bbpress-forums .bbp-submit-wrapper .button:focus-visible,
#bbpress-forums fieldset.bbp-form input[type="submit"]:focus-visible,
#bbpress-forums a.bbp-topic-reply-link:focus-visible,
#bbpress-forums a.bbp-reply-to-link:focus-visible {
  background: #3a509c;
  color: #fff;
}
#bbpress-forums .bbp-submit-wrapper { float: none; margin-top: 1rem; }

/* Feedback, notices and pagination. */
#bbpress-forums .bbp-template-notice,
#bbpress-forums div.bbp-template-notice {
  background: #eef2fb;
  color: var(--chm-ink);
  border: 0;
  border-left: 4px solid var(--chm-primary);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  margin: 1.5rem 0;
}
#bbpress-forums .bbp-template-notice.error,
#bbpress-forums .bbp-template-notice.warning {
  background: #fff3ee;
  border-left-color: #a43b1d;
}
#bbpress-forums .bbp-pagination { font-size: .9rem; margin: 1.1rem 0 1.7rem; }
#bbpress-forums .bbp-pagination-links a,
#bbpress-forums .bbp-pagination-links span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  background: var(--chm-soft);
  padding: .35rem .65rem;
  font-weight: 700;
}
#bbpress-forums .bbp-pagination-links .current {
  background: var(--chm-primary);
  color: #fff;
}
#bbpress-forums .bbp-pagination-count { color: var(--chm-muted); }

/* Breadcrumbs remain visible. Only the active forum is linked by PHP. */
#bbpress-forums .bbp-breadcrumb.chm-bbp-breadcrumb {
  display: block;
  max-width: 100%;
  color: var(--chm-muted);
  margin: 0 0 1.4rem;
  padding: 0;
  font-size: .875rem;
  line-height: 1.6;
}
#bbpress-forums .chm-bbp-breadcrumb-trail {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: .25rem .6rem;
  overflow-wrap: anywhere;
}
#bbpress-forums .chm-bbp-breadcrumb-sep { color: #9aa4b4; }
#bbpress-forums .chm-bbp-breadcrumb-forum-link {
  color: var(--chm-primary);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: .18em;
}
#bbpress-forums .chm-bbp-breadcrumb-forum-link:hover {
  color: var(--chm-secondary-accessible);
}

@media (max-width: 780px) {
  #bbpress-forums .bbp-header ul.forum-titles,
  #bbpress-forums li.bbp-body > ul.forum,
  #bbpress-forums li.bbp-body > ul.topic {
    grid-template-columns: minmax(0, 1fr) 5rem 5rem;
  }
  #bbpress-forums .bbp-header ul.forum-titles > li:last-child,
  #bbpress-forums li.bbp-body > ul.forum > li:last-child,
  #bbpress-forums li.bbp-body > ul.topic > li:last-child { display: none; }
}

@media (max-width: 560px) {
  #bbpress-forums { font-size: 1rem; }
  #bbpress-forums li.bbp-header { display: none; }
  #bbpress-forums li.bbp-body > ul.forum,
  #bbpress-forums li.bbp-body > ul.topic {
    display: block;
    padding: 1.1rem;
    margin-bottom: .9rem;
  }
  #bbpress-forums li.bbp-body > ul.forum > li:not(:first-child),
  #bbpress-forums li.bbp-body > ul.topic > li:not(:first-child) { display: none; }
  #bbpress-forums ul.bbp-replies li.bbp-body > .bbp-reply-header + div {
    display: block;
    padding: 1.1rem;
  }
  #bbpress-forums div.bbp-reply-author {
    display: flex;
    align-items: center;
    gap: .55rem;
    flex-wrap: wrap;
    margin-bottom: 1.1rem;
  }
  #bbpress-forums div.bbp-reply-author .bbp-author-avatar img.avatar { margin: 0; width: 38px; height: 38px; }
  #bbpress-forums div.bbp-reply-author .bbp-author-name { display: inline; }
  #bbpress-forums fieldset.bbp-form { padding: 1.15rem; }
  #bbpress-forums .bbp-pagination-count,
  #bbpress-forums .bbp-pagination-links { float: none; margin: .5rem 0; }
}

@media (prefers-reduced-motion: reduce) {
  #bbpress-forums li.bbp-body > ul.forum,
  #bbpress-forums li.bbp-body > ul.topic,
  #bbpress-forums .bbp-submit-wrapper button,
  #bbpress-forums .bbp-submit-wrapper .button,
  #bbpress-forums fieldset.bbp-form input[type="submit"] { transition: none; }
}


/*
 * Native bbPress topic/reply screens (including /edit/).
 * Select the closest .page-content ancestor containing #bbpress-forums.
 * Embedded JetEngine/Elementor forum landing pages under /meus-cursos/
 * have no chm-bbp-native-content-page body class and remain unchanged.
 */
body.chm-bbp-native-content-page .page-content:has(#bbpress-forums):not(:has(.page-content #bbpress-forums)) {
  padding: 30px 40px 30px 40px;
}

@media (max-width: 1023.98px) {
  body.chm-bbp-native-content-page .page-content:has(#bbpress-forums):not(:has(.page-content #bbpress-forums)) {
    padding: 20px;
  }
}
