/* The community pages (the cx- rules at the end, redesign of 2026-11-09), and older cm- pieces that listings, the dashboard and the inbox share. See DESIGN.md. */

:root {
  --cm-danger-bg: rgba(139,26,26,0.07);
  --cm-danger-line: rgba(139,26,26,0.4);
  --cm-avatar: 44px;
}

/* Everything members write, and long translated words, must wrap rather than widen the page */
 .cm-main, .cm-tools { overflow-wrap: anywhere; }

/* ---- Page parts the dashboard, inbox and account pages share ---- */
.cm-main .pv-banner { overflow-wrap: anywhere; }
.cm-unavailable { margin: 0 auto; max-width: 620px; }
.cm-unavailable .pv-title { margin-bottom: 8px; }
.cm-unavailable .pv-btn { margin-top: 16px; }
.cm-unavailable .pv-banner { margin-bottom: 0; }

/* ---- Author line ---- */
.cm-avatar {
  align-items: center;
  background: var(--secondary);
  border-radius: 50%;
  color: var(--sandal-light);
  display: flex;
  flex: none;
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 800;
  height: var(--cm-avatar);
  justify-content: center;
  line-height: 1;
  overflow: hidden;
  width: var(--cm-avatar);
}
.cm-avatar img { display: block; height: 100%; object-fit: cover; width: 100%; }
.cm-avatar svg { height: 58%; width: 58%; }
.cm-author { align-items: flex-start; display: flex; gap: 12px; min-width: 0; }
.cm-author-text { min-width: 0; }
.cm-author-line { align-items: center; display: flex; flex-wrap: wrap; gap: 2px 10px; }
.cm-author-name { color: var(--gray-900); font-size: 1rem; font-weight: 700; line-height: 1.4; min-width: 0; }
a.cm-author-name { text-decoration: underline; text-decoration-color: var(--gray-300); text-underline-offset: 3px; }
a.cm-author-name:hover { color: var(--secondary); text-decoration-color: currentColor; }
.cm-author-line .pv-verified { font-size: 0.7rem; padding: 2px 9px 2px 7px; }
.cm-you { color: var(--gray-600); font-size: 0.88rem; }
.cm-expert {
  background: var(--sandal-cream);
  border: 1px solid var(--sandal);
  border-radius: var(--radius-full);
  color: var(--gray-800);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.3;
  padding: 2px 10px;
}
.cm-author-meta { color: var(--gray-600); font-size: 0.9rem; line-height: 1.45; margin-top: 1px; overflow-wrap: anywhere; }
.cm-username { font-weight: 600; }
.cm-public-note { background: var(--pv-tint, #F4EFE6); border-radius: 8px; margin: 14px 0; padding: 10px 12px; }
.cm-dot { margin: 0 5px; }

/* ---- Chips ---- */
.cm-chips { align-items: center; display: flex; flex-wrap: wrap; gap: 6px 8px; min-width: 0; }
.cm-chip {
  align-items: center;
  background: var(--pv-tint);
  border: 1px solid var(--pv-tint-line);
  border-radius: var(--radius-full);
  color: var(--secondary-dark);
  display: inline-flex;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.3;
  max-width: 100%;
  padding: 5px 12px;
}
a.cm-chip { min-height: 32px; transition: background-color var(--transition-fast); }
a.cm-chip:hover { background: rgba(27,94,32,0.18); color: var(--secondary-dark); }
.cm-chip-quiet { background: var(--gray-100); border-color: var(--gray-200); color: var(--gray-700); font-weight: 400; }

/* ---- Notes, counts and checkboxes ---- */
.cm-check {
  align-items: center;
  color: var(--gray-800);
  cursor: pointer;
  display: flex;
  font-size: 0.98rem;
  gap: 10px;
  line-height: 1.4;
  margin-top: 14px;
  min-height: 44px;
}
.cm-check input { accent-color: var(--secondary); flex: none; height: 22px; width: 22px; }

.cm-note {
  background: var(--sandal-cream);
  border: 1px solid var(--sandal-light);
  border-radius: var(--radius-lg);
  color: var(--gray-800);
  font-size: 0.92rem;
  line-height: 1.55;
  margin: 0 0 22px;
  padding: 11px 16px;
}
.cm-list-count { background: var(--gray-100); border-radius: var(--radius-full); color: var(--gray-700); font-size: 0.9rem; font-weight: 700; line-height: 1.4; padding: 2px 11px; }

/* Links that sit above a card's own whole-card link (community questions, listings) */
.cm-above { position: relative; z-index: 1; }
.cm-count { color: var(--secondary-dark); flex: none; font-size: 0.95rem; line-height: 1.4; }
.cm-count.is-none { color: var(--gray-600); }

/* ---- Sidebar ---- */
.cm-side-text { color: var(--gray-700); font-size: 0.98rem; line-height: 1.6; margin-bottom: 14px; }
.cm-side-small { color: var(--gray-600); font-size: 0.86rem; line-height: 1.5; margin-top: 8px; }
.cm-side-list { list-style: none; }
.cm-side-list a {
  align-items: center;
  border-radius: var(--radius-md);
  color: var(--gray-800);
  display: flex;
  font-size: 1rem;
  gap: 8px;
  line-height: 1.35;
  margin: 0 -8px;
  min-height: 44px;
  padding: 6px 8px;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}
.cm-side-list a:hover { background: var(--pv-tint); color: var(--secondary); }
.cm-side-list a[aria-current] { background: var(--pv-tint); color: var(--secondary-dark); font-weight: 700; }
.cm-org-list { list-style: none; margin-bottom: 4px; }
.cm-org-list a { align-items: center; color: inherit; display: flex; gap: 12px; min-height: 44px; padding: 6px 0; }
.cm-org-list a:hover strong { color: var(--secondary); }
.cm-org-text { min-width: 0; }
.cm-org-text strong { color: var(--gray-900); display: block; font-size: 0.98rem; line-height: 1.35; }
.cm-org-text small { color: var(--gray-600); display: block; font-size: 0.86rem; line-height: 1.35; }
.cm-full { width: 100%; }

/* ---- A question and its answers ---- */
.cm-post-status { background: var(--sandal-cream); border-radius: var(--radius-md); color: var(--gray-800); font-size: 0.92rem; line-height: 1.5; margin-top: 14px; padding: 8px 12px; }
.cm-status { font-weight: 700; }
.cm-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.cm-textarea { min-height: 140px; resize: vertical; }

/* ---- Report, block and delete ---- */
.cm-tool-link, .cm-tools summary {
  align-items: center;
  color: var(--gray-600);
  cursor: pointer;
  display: inline-flex;
  font-size: 0.9rem;
  gap: 8px;
  line-height: 1.3;
  list-style: none;
  min-height: 44px;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.cm-show-name { align-items: flex-start; cursor: pointer; display: flex; gap: 10px; line-height: 1.5; margin: 16px 0; }
.cm-show-name input { accent-color: var(--secondary); flex: none; height: 22px; margin-top: 1px; width: 22px; }
.cm-show-name-help { color: var(--gray-600); display: block; font-size: 0.92rem; font-weight: 400; margin-top: 2px; }
.cm-tools summary::-webkit-details-marker { display: none; }
.cm-tools summary::after {
  border-bottom: 2px solid currentColor;
  border-right: 2px solid currentColor;
  content: '';
  flex: none;
  height: 7px;
  transform: rotate(45deg) translate(-1px, -1px);
  transition: transform var(--transition-fast);
  width: 7px;
}
.cm-tools[open] summary::after { transform: rotate(225deg) translate(-1px, -1px); }
.cm-tool-link:hover, .cm-tools summary:hover { color: var(--secondary); }
.cm-tool-form { background: var(--cream); border: 1px solid var(--gray-200); border-radius: var(--radius-lg); margin-top: 6px; padding: 16px; }
.cm-tool-block { margin-top: 12px; }
.cm-tool-gap { margin-top: 12px; }
.cm-tool-text { color: var(--gray-800); font-size: 0.95rem; line-height: 1.55; }
.cm-note-input { min-height: 72px; resize: vertical; }
.cm-btn-small { font-size: 0.92rem; margin-top: 12px; min-height: 44px; padding: 8px 18px; }
.cm-btn-danger { background: var(--white); border-color: var(--red-sandal); color: var(--red-sandal); }
.cm-btn-danger:hover { background: var(--cm-danger-bg); }

/* ---- Asking ---- */
.cm-field-row { display: grid; gap: 0 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cm-hint { align-items: baseline; color: var(--gray-600); display: flex; flex-wrap: wrap; font-size: 0.88rem; gap: 2px 12px; justify-content: space-between; line-height: 1.45; margin-top: 6px; }
.cm-counter { flex: none; font-variant-numeric: tabular-nums; }

/* ---- Smaller screens ---- */
@media (max-width: 760px) {
  .cm-field-row { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .cm-tools summary::after { transition: none; }
}

/* ==== The community pages (redesign of 2026-11-09) ====
   /community, /community/q/<id> and /community/ask in the dashboard's three columns: a Browse menu on the left, the page in
   the middle, guidance and shortcuts on the right. Shared pieces are in includes/community-ui.php. Classes start with cx-,
   so the older cm- rules that listings and the dashboard share stay as they were. */
.cx { overflow-wrap: anywhere; padding: 20px 0 64px; }
.cx-layout {
  --cx-nav-w: clamp(232px, 15vw, 300px);
  --cx-side-w: clamp(280px, 18vw, 360px);
  align-items: start;
  display: grid;
  gap: clamp(20px, 2vw, 40px);
  grid-template-columns: var(--cx-nav-w) minmax(0, 1fr) var(--cx-side-w);
}
.cx-main { align-content: start; display: grid; gap: 16px; justify-self: center; max-width: clamp(680px, 50vw, 860px); min-width: 0; width: 100%; }
/* The Browse menu stays in view; the right column scrolls with the page, so none of its cards is cut off */
.cx-side { align-content: start; display: grid; gap: 16px; min-width: 0; }
.cx-card {
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  min-width: 0;
  padding: 18px 20px;
}
.cx-ico { flex: none; height: 18px; width: 18px; }
.cx-full { width: 100%; }
.cx-main .pv-banner { margin: 0; }
.cx-main .cm-note { margin: 0; }

/* A section's choices as chips (css/members.css lays them out in the hero band) */
.cx-topic-row { display: none; gap: 8px; margin: 0 -2px; overflow-x: auto; padding: 2px; scrollbar-width: none; }
.cx-topic-row::-webkit-scrollbar { display: none; }
.cx-topic-chip {
  align-items: center;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-full);
  color: var(--gray-800);
  display: inline-flex;
  flex: none;
  font-size: 0.92rem;
  font-weight: 600;
  gap: 6px;
  line-height: 1.25;
  min-height: 42px;
  padding: 6px 14px;
  white-space: nowrap;
}
.cx-topic-chip:hover { border-color: var(--secondary); color: var(--secondary-dark); }
.cx-topic-chip.is-active { background: var(--secondary); border-color: var(--secondary); color: var(--white); }

/* Latest and Unanswered (css/members.css draws them as a cream pill) */
.cx-tabs { border-top: 1px solid var(--gray-100); display: flex; gap: 4px; margin: 16px -24px 0; overflow-x: auto; padding: 0 14px; scrollbar-width: none; }
.cx-tabs::-webkit-scrollbar { display: none; }
.cx-tab {
  align-items: center;
  border-bottom: 3px solid transparent;
  color: var(--gray-700);
  display: inline-flex;
  font-size: 0.98rem;
  font-weight: 700;
  min-height: 50px;
  padding: 4px 14px;
  white-space: nowrap;
}
.cx-tab:hover { color: var(--secondary); }
.cx-tab[aria-current="page"] { border-bottom-color: var(--secondary); color: var(--secondary); }

/* Results */
.cx-results, .cx-answers { display: grid; gap: 12px; scroll-margin-top: 90px; }
.cx-results-head { align-items: center; display: flex; flex-wrap: wrap; gap: 8px 14px; justify-content: space-between; }
.cx-section-title { align-items: center; color: var(--gray-900); display: flex; font-size: 1.2rem; font-weight: 800; gap: 8px; line-height: 1.3; }
.cx-count { background: var(--gray-100); border-radius: var(--radius-full); color: var(--gray-700); font-size: 0.85rem; font-weight: 700; line-height: 1.4; padding: 2px 10px; }
.cx-filters { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; }
.cx-filter-chip {
  align-items: center;
  background: var(--pv-tint);
  border: 1px solid var(--pv-tint-line);
  border-radius: var(--radius-full);
  color: var(--secondary-dark);
  display: inline-flex;
  font-size: 0.88rem;
  font-weight: 700;
  gap: 6px;
  min-height: 36px;
  padding: 4px 12px;
}
.cx-filter-chip:hover { background: var(--white); }
.cx-x { font-size: 1.1rem; line-height: 1; }
.cx-clear { min-height: 36px; }
.cx-list { display: grid; gap: 12px; list-style: none; }
.cx-list > li { min-width: 0; }

/* A question in a list: the whole card opens it */
.cx-q { position: relative; transition: box-shadow var(--transition-fast); }
.cx-q:hover { box-shadow: var(--shadow-md); }
.cx-q-title { font-size: 1.18rem; font-weight: 800; line-height: 1.35; margin-top: 12px; }
.cx-q-title a { color: var(--gray-900); }
.cx-q:hover .cx-q-title a { color: var(--secondary); }
.cx-stretch::before { border-radius: var(--radius-xl); content: ''; inset: 0; position: absolute; }
.cx-stretch:focus-visible { outline: none; }
.cx-stretch:focus-visible::before { outline: 3px solid var(--secondary); outline-offset: 2px; }
.cx-q-excerpt {
  color: var(--gray-700);
  display: -webkit-box;
  font-size: 1rem;
  line-height: 1.55;
  margin-top: 6px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}
.cx-q-foot, .cx-post-foot {
  align-items: center;
  border-top: 1px solid var(--gray-100);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 10px;
}
.cx-q-answers { align-items: center; color: var(--gray-700); display: inline-flex; font-size: 0.95rem; gap: 7px; min-height: 40px; }
.cx-q-answers strong { color: var(--gray-900); }
a.cx-q-answers:hover { color: var(--secondary); }
.cx-q-answers.is-none { color: var(--secondary); font-weight: 700; }
.cx-q-answers.is-none:hover { text-decoration: underline; text-underline-offset: 3px; }

/* One question and its answers */
.cx-post { padding: 20px 22px; scroll-margin-top: 90px; }
.cx-post-body { color: var(--gray-800); font-size: 1.05rem; line-height: 1.7; margin-top: 10px; white-space: normal; }
.cx-post.is-answer { padding: 16px 20px; }
.cx-post.is-answer .cx-post-body { font-size: 1rem; margin-top: 8px; }
.cx-post-foot .cm-tools { margin: 0; }
.cx-post.is-answer .cx-post-foot { justify-content: flex-end; }

/* The reply box */
.cx-reply { scroll-margin-top: 90px; }
.cx-reply-head { align-items: center; display: flex; gap: 12px; margin-bottom: 10px; }
.cx-reply-warn { background: var(--sandal-cream); border-radius: var(--radius-md); color: var(--gray-800); display: flex; font-size: 0.92rem; gap: 8px; line-height: 1.5; margin-bottom: 12px; padding: 10px 12px; }
.cx-reply-text { min-height: 120px; }
.cx-reply-actions { display: flex; justify-content: flex-end; margin-top: 4px; }

/* Asking */
.cx-warn { background: var(--sandal-cream); border-color: var(--sandal-light); }
.cx-ask { padding: 22px 24px; }
.cx-field { margin-top: 18px; min-width: 0; }
.cx-field-half { max-width: 420px; }
.cx-topics { border: 0; margin-left: 0; margin-right: 0; padding: 0; }
.cx-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.cx-pill { cursor: pointer; display: inline-flex; position: relative; }
.cx-pill input { height: 1px; left: 50%; opacity: 0; position: absolute; top: 100%; width: 1px; }
.cx-pill > span {
  align-items: center;
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-full);
  color: var(--gray-800);
  display: inline-flex;
  font-size: 0.95rem;
  font-weight: 600;
  gap: 6px;
  line-height: 1.25;
  min-height: 44px;
  padding: 6px 14px;
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
}
.cx-pill:hover > span { border-color: var(--secondary); }
.cx-pill input:checked + span { background: var(--pv-tint); border-color: var(--secondary); color: var(--secondary-dark); font-weight: 700; }
.cx-pill input:focus-visible + span { outline: 3px solid var(--secondary); outline-offset: 2px; }

/* Empty and unavailable states */
.cx-empty { align-items: center; display: flex; flex-direction: column; gap: 10px; padding: 32px 24px; text-align: center; }
.cx-empty-small { padding: 24px 20px; }
.cx-empty-ico { font-size: 2.2rem; line-height: 1; }
.cx-empty-sub { color: var(--gray-700); font-size: 1rem; font-weight: 700; margin-top: 12px; }
.cx-empty-topics { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; list-style: none; }
.cx-pages { align-items: center; display: flex; flex-wrap: wrap; gap: 12px 18px; justify-content: center; margin-top: 8px; }
.cx-pages-now { color: var(--gray-700); font-size: 0.98rem; }

/* Right column */
.cx-side-card { padding: 16px 18px; }
.cx-side-title { align-items: center; color: var(--gray-900); display: flex; font-size: 1.02rem; font-weight: 800; gap: 8px; line-height: 1.35; margin-bottom: 10px; }
.cx-side-text { color: var(--gray-700); font-size: 0.97rem; line-height: 1.6; }
.cx-side-small { color: var(--gray-600); font-size: 0.86rem; line-height: 1.5; margin: 8px 0 4px; }
.cx-ask-card .cx-side-text { margin-bottom: 12px; }
.cx-rules { background: var(--sandal-cream); border-color: var(--sandal-light); }
.cx-rules-list { display: grid; gap: 10px; list-style: none; }
.cx-rules-list li { color: var(--gray-800); font-size: 0.92rem; line-height: 1.5; padding-left: 18px; position: relative; }
.cx-rules-list li::before { background: var(--sandal-dark); border-radius: 50%; content: ''; height: 6px; left: 2px; position: absolute; top: 0.6em; width: 6px; }
.cx-related { display: grid; list-style: none; margin-bottom: 4px; }
.cx-related a { border-bottom: 1px solid var(--gray-100); color: inherit; display: grid; gap: 2px; padding: 10px 0; }
.cx-related li:last-child a { border-bottom: 0; }
.cx-related strong { color: var(--gray-900); font-size: 0.96rem; line-height: 1.4; }
.cx-related a:hover strong { color: var(--secondary); }
.cx-related small { color: var(--gray-600); font-size: 0.84rem; }

/* A link inside a rule (the listings' "see the rules") stays in its sentence */
.cx-rules-list .pv-inline-link, .cx-rules .cx-side-text .pv-inline-link { display: inline; min-height: 0; padding: 0; }
.cx-rules > .pv-inline-link { margin-top: 10px; }

/* The verified badge as a round tick beside a name (directory and listing cards); the word stays for screen readers */
.cx-tick { align-items: center; background: var(--secondary); border-radius: 50%; color: var(--white); display: inline-flex; flex: none; height: 18px; justify-content: center; margin-left: 6px; position: relative; top: -1px; vertical-align: middle; width: 18px; }
.cx-tick svg { height: 11px; width: 11px; }

/* The directory's organisation cards: cover, round photo, name with the badge, then type, place and intro */
.dx-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); list-style: none; }
.dx-grid > li { display: flex; min-width: 0; }
.dx-card { color: inherit; display: flex; flex-direction: column; overflow: hidden; padding: 0; transition: box-shadow var(--transition-fast); width: 100%; }
.dx-card:hover { box-shadow: var(--shadow-md); }
.dx-card:hover .dx-name { color: var(--secondary); }
.dx-card:focus-visible { outline: 3px solid var(--secondary); outline-offset: 2px; }
.dx-cover { aspect-ratio: 3 / 1; background: var(--pv-pattern), var(--pv-hero); display: block; flex: none; overflow: hidden; }
.dx-cover img { display: block; height: 100%; object-fit: cover; width: 100%; }
.dx-avatar {
  align-items: center;
  background: var(--pv-forest);
  border: 4px solid var(--white);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  color: var(--white);
  display: flex;
  flex: none;
  font-size: 1.6rem;
  font-weight: 800;
  height: 76px;
  justify-content: center;
  margin: -38px 0 0 16px;
  overflow: hidden;
  position: relative;
  width: 76px;
}
.dx-avatar img { display: block; height: 100%; object-fit: cover; width: 100%; }
.dx-body { display: flex; flex: 1; flex-direction: column; gap: 4px; min-width: 0; padding: 8px 18px 18px; }
.dx-name-line { align-items: center; display: flex; flex-wrap: wrap; gap: 4px 8px; }
.dx-name { color: var(--gray-900); font-size: 1.1rem; font-weight: 800; line-height: 1.3; min-width: 0; }
.dx-user { color: var(--gray-600); font-size: 0.88rem; line-height: 1.4; }
.dx-meta { align-items: center; color: var(--gray-700); display: flex; font-size: 0.9rem; gap: 6px; line-height: 1.4; min-width: 0; }
.dx-meta .cx-ico { color: var(--gray-500); flex: none; height: 16px; width: 16px; }
.dx-intro { -webkit-box-orient: vertical; border-top: 1px solid var(--gray-100); color: var(--gray-700); display: -webkit-box; font-size: 0.92rem; -webkit-line-clamp: 3; line-clamp: 3; line-height: 1.5; margin-top: 8px; overflow: hidden; padding-top: 10px; }

/* Below 1280px the Browse menu becomes the row of chips; below 1024px one column, the right column after the page */
@media (max-width: 1279px) {
  .cx-layout { grid-template-columns: minmax(0, 1fr) var(--cx-side-w); }
  .cx-topic-row { display: flex; }
  .cx-main { max-width: 780px; }
}
@media (max-width: 1023px) {
  .cx-layout { grid-template-columns: minmax(0, 1fr); }
  .cx-main, .cx-side { justify-self: center; max-width: 760px; width: 100%; }
  }
@media (max-width: 760px) {
  .cx { padding-top: 14px; }
  .cx-card { padding: 16px; }
  .cx-tabs { margin: 14px -16px 0; padding: 0 6px; }
  .cx-tab { flex: 1; justify-content: center; }
  .cx-post { padding: 16px; }
  .cx-ask { padding: 18px 16px; }
  .cx-field-half { max-width: none; }
  .cx .pv-btn { width: auto; }
}
/* Phones: the Search button keeps only its icon, so the State list has room for its longest names in every language */
@media (prefers-reduced-motion: reduce) {
   .cx-q, .cx-pill > span, .dx-card { transition: none; }
}
