/* Scoped to community pages: keep navigation and adverts independent. */
.community-page {
  --community-surface: #fff;
  --community-soft: #f1f6f4;
  --community-text: #243d33;
  --community-muted: #536b60;
  --community-border: #dce7df;
  --community-accent: #245f55;
}
[data-theme="dark"] .community-page {
  --community-surface: #192a23;
  --community-soft: #22392f;
  --community-text: #e8f1ec;
  --community-muted: #b5c8bd;
  --community-border: #3b5347;
  --community-accent: #a1dfc4;
}
.community-page .container { color: var(--community-text); line-height: 1.65; padding-bottom: calc(6rem + env(safe-area-inset-bottom)); }
.community-page .forum-main-container { width: min(100% - 2rem, 1140px); margin-inline: auto; }
.community-page :is(.forum-card, .forum-base-card) { background: var(--community-surface); color: var(--community-text); border: 1px solid var(--community-border); border-radius: 16px; padding: clamp(1rem, 3vw, 1.75rem); }
.community-page :is(.forum-section, .forum-card) { margin-bottom: 1.5rem; }
.community-page :is(.forum-welcome-row, .post-header) { flex-wrap: wrap; gap: .75rem; }
.community-page :is(.post-content, .forum-post-item, .grid > *) { min-width: 0; }
.community-page :is(.forum-rules, .post-message, .post-form-container) { background: var(--community-soft); color: var(--community-text); border-color: var(--community-border); }
.community-page :is(.forum-rules-content, .message-content, .post-message, .forum-card p) { line-height: 1.7; overflow-wrap: anywhere; }
.community-page .forum-post-item { padding-block: 1.25rem; border-bottom: 1px solid var(--community-border); }
.community-page .container :is(h1, h2, h3, h4) { line-height: 1.3; overflow-wrap: anywhere; }
.community-page .container :is(input:not([type="checkbox"]):not([type="radio"]), textarea, select) { max-width: 100%; background: var(--community-surface); color: var(--community-text); border: 1px solid var(--community-border); border-radius: 10px; }
.community-page .container :is(input, textarea)::placeholder { color: var(--community-muted); opacity: 1; }
.community-page .container :is(a, button, input, textarea, select):focus-visible { outline: 3px solid var(--community-accent); outline-offset: 3px; }
.community-page .container .btn { min-height: 44px; white-space: normal; }
[data-theme="dark"] .community-page .container :is(h1, h2, h3, h4, .forum-section-title, .forum-rules-title, .forum-username, .stat-value, .post-header strong) { color: var(--community-text) !important; }
[data-theme="dark"] .community-page .container :is(.text-muted, .text-gray-500, .text-gray-600, .stat-title, .no-posts) { color: var(--community-muted) !important; }
[data-theme="dark"] .community-page :is(.forum-rules, .post-message, .post-form-container, .chat-container, .chat-message) { background: var(--community-soft) !important; color: var(--community-text) !important; border-color: var(--community-border); }
[data-theme="dark"] .community-page .container :is([class*="text-[#1e5959]"], .message-link, .reply-post-btn, .btn-outline-secondary) { color: var(--community-accent) !important; }
[data-theme="dark"] .community-page .container [class*="bg-[#e6f4f4]"] { background: var(--community-soft) !important; }
[data-theme="dark"] .community-page .container [class*="border-gray"] { border-color: var(--community-border) !important; }
[data-theme="dark"] .community-page .deleted-message { color: #ffc4c4 !important; }
@media (max-width: 640px) {
  .community-page .forum-main-container { width: 100%; padding-inline: 1rem; }
  .community-page .forum-header-title { font-size: 1.8rem; line-height: 1.25; }
  .community-page .forum-card { padding: 1rem; }
  .community-page .container .grid { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .community-page .post-header { align-items: flex-start !important; }
}
/* Legacy inline text colours also occur in replies and community dialogs. */
[data-theme="dark"] .community-page :is(.container, .modal) :is([style*="color: #64748b"], [style*="color: #6b7280"]) { color: var(--community-muted) !important; }
[data-theme="dark"] .community-page :is(.container, .modal) :is([style*="color: #1e293b"], [style*="color: #1E5359"], [style*="color: #1E535E"]) { color: var(--community-text) !important; }
[data-theme="dark"] .community-page .modal :is(.modal-header, .modal-footer) { border-color: var(--community-border); }

/* The outer panel and welcome gradient must switch with their text. */
.community-page .forum-main-container {
  background: var(--community-surface);
  color: var(--community-text);
  border-color: var(--community-border);
}
.community-page .forum-welcome-row {
  background: var(--community-soft);
  color: var(--community-text);
  border-color: var(--community-border);
}
[data-theme="dark"] .community-page .forum-main-container {
  background: var(--community-surface) !important;
  border-color: var(--community-border);
  box-shadow: 0 4px 20px rgb(0 0 0 / 15%);
}
[data-theme="dark"] .community-page .forum-section > h2 :is(i, span) {
  color: var(--community-text) !important;
}

/* Community landing header. */
.community-page .community-hub-intro { max-width:1120px; margin:80px auto 24px; padding:28px 32px; border:1px solid var(--community-border); border-radius:24px; background:var(--community-surface); color:var(--community-text); box-sizing:border-box; }
.community-hub-topline { display:flex; justify-content:space-between; align-items:center; gap:16px; margin-bottom:24px; }
.community-hub-back { color:var(--community-muted); font-size:14px; text-decoration:none; }
.community-hub-kicker { color:var(--community-muted); font-size:10px; letter-spacing:.14em; }
.community-hub-heading { display:flex; justify-content:space-between; align-items:center; gap:32px; }
.community-hub-heading h1 { margin:0; font-size:clamp(28px,4vw,42px); font-weight:750; line-height:1.16; letter-spacing:-.035em; color:var(--community-text); }
.community-hub-heading h1 span { display:block; color:var(--community-accent); }
.community-hub-heading p { max-width:470px; margin:14px 0 0; color:var(--community-muted); font-size:15px; line-height:1.65; }
.community-hub-actions { display:flex; flex-direction:column; gap:10px; flex-shrink:0; }
.community-hub-actions a { display:flex; justify-content:center; align-items:center; gap:16px; padding:13px 18px; border-radius:12px; font-size:14px; font-weight:600; text-decoration:none; }
.community-hub-primary { background:#236450; color:#fff !important; }
.community-hub-secondary { background:var(--community-soft); color:var(--community-text) !important; border:1px solid var(--community-border); }
.community-hub-actions a:hover { filter:brightness(.94); }
.community-hub-intro a:focus-visible { outline:3px solid var(--community-accent); outline-offset:4px; }
#community-list { scroll-margin-top:90px; }
@media (max-width:700px) {
  .community-page .community-hub-intro { margin:76px 16px 20px; padding:20px; border-radius:20px; }
  .community-hub-topline { margin-bottom:18px; }
  .community-hub-heading { flex-direction:column; align-items:stretch; gap:18px; }
  .community-hub-heading p { font-size:14px; margin-top:12px; }
  .community-hub-actions a { min-height:44px; box-sizing:border-box; }
}
