/*
 * EDC Community — Facebook-style social redesign
 * Full rebuild: replaces all previous broken community CSS
 * Loaded automatically by header.php for all community pages
 * ============================================================
 */

/* ── 0. RESET OLD BROKEN CLASS NAMES ──────────────────────────
   Neutralise anything left over from previous attempts
   without touching the existing community.css base rules.
─────────────────────────────────────────────────────────────── */
.edc-community--social,
.edc-hero-social,
.edc-hero-cover,
.edc-hero-identity,
.edc-hero-communityIcon,
.edc-hero-name,
.edc-hero-body,
.edc-hero-seoBlock,
.edc-compose-wrap,
.edc-compose-avatar,
.edc-compose-field,
.edc-compose-postBtn,
.edc-tabs-wrap,
.edc-tabs-row,
.edc-tab,
.edc-guest-cta,
.edc-lnav-createBtn,
.edc-lnav-shell,
.edc-lnav-link,
.edc-lnav-cat,
.edc-lnav-group,
.edc-lnav-boards,
.edc-lnav-board,
.edc-community-topicCard,
.edc-community-topicCard--compact,
.edc-boardSurface,
.edc-board-hero,
.edc-community-categories,
.edc-community-category,
.edc-community-board.edc-community-subsection-card,
.edc-lb-shell,
.edc-lb-card,
.edc-comm-layout,
.edc-comm-leftnav,
.edc-comm-feed,
.edc-comm-right {
  all: revert;
}

/* ── 1. DESIGN TOKENS (scoped to .edc-community) ──────────────
─────────────────────────────────────────────────────────────── */
.edc-community {
  --c-left:    232px;
  --c-right:   272px;
  --c-gap:     1.1rem;
  --c-r:       12px;
  --c-surface: rgba(15, 23, 42, 0.75);
  --c-border:  rgba(255, 255, 255, 0.09);
  --c-hover:   rgba(255, 255, 255, 0.04);
  --c-cyan:    #22d3ee;
  --c-indigo:  #6366f1;
  --c-grad:    linear-gradient(135deg, #22d3ee, #6366f1);
  --c-text:    #f1f5f9;
  --c-muted:   rgba(148, 163, 184, 0.6);
  --c-subtle:  rgba(148, 163, 184, 0.4);
}

html[data-theme="light"] .edc-community {
  --c-surface: rgba(255, 255, 255, 0.92);
  --c-border:  rgba(15, 23, 42, 0.1);
  --c-hover:   rgba(15, 23, 42, 0.03);
  --c-text:    #0f172a;
  --c-muted:   rgba(15, 23, 42, 0.55);
  --c-subtle:  rgba(15, 23, 42, 0.35);
}

/* ── 2. PAGE WRAPPER ──────────────────────────────────────────
─────────────────────────────────────────────────────────────── */
.edc-community {
  width: 100%;
  min-height: 100vh;
}

.edc-comm-page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 108px 1rem 5rem;
  box-sizing: border-box;
}

/* Parent (main.edc-community) always handles navbar clearance — never double-stack */
.edc-community > .edc-comm-page,
main > .edc-comm-page {
  padding-top: 0 !important;
}

@media (max-width: 899px) {
  .edc-comm-page { padding-top: 120px; }
}

@media (max-width: 639px) {
  .edc-comm-page { padding-left: 0.75rem; padding-right: 0.75rem; }
}

/* ── 3. THREE-COLUMN LAYOUT ───────────────────────────────────
─────────────────────────────────────────────────────────────── */
.edc-comm-layout {
  display: flex;
  flex-direction: column;
  gap: var(--c-gap);
  align-items: stretch;
}

@media (min-width: 900px) {
  .edc-comm-layout {
    flex-direction: row;
    align-items: flex-start;
  }
  [dir="rtl"] .edc-comm-layout { flex-direction: row-reverse; }
}

/* Left sidebar nav */
.edc-comm-leftnav {
  display: none;
}

@media (min-width: 900px) {
  .edc-comm-leftnav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: var(--c-left);
    flex-shrink: 0;
    position: sticky;
    top: 112px;
    max-height: calc(100vh - 124px);
    overflow-y: auto;
    scrollbar-width: none;
  }
  .edc-comm-leftnav::-webkit-scrollbar { display: none; }
}

/* Center feed */
.edc-comm-feed {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Right sidebar */
.edc-comm-right {
  display: none;
}

@media (min-width: 1100px) {
  .edc-comm-right {
    display: block;
    width: var(--c-right);
    flex-shrink: 0;
    position: sticky;
    top: 112px;
    max-height: calc(100vh - 124px);
    overflow-y: auto;
    scrollbar-width: none;
  }
  .edc-comm-right::-webkit-scrollbar { display: none; }
}

/* ── 4. COMMUNITY HERO ────────────────────────────────────────
─────────────────────────────────────────────────────────────── */
.edc-comm-hero {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--c-r);
  overflow: hidden;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Cover photo strip */
.edc-comm-cover {
  width: 100%;
  height: 110px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg,
    rgba(34, 211, 238, 0.22) 0%,
    rgba(99, 102, 241, 0.18) 50%,
    rgba(15, 23, 42, 0.5) 100%);
  background-color: #0f172a;
}

.edc-comm-cover::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(circle 200px at 12% 60%, rgba(34, 211, 238, 0.18), transparent 70%),
    radial-gradient(circle 160px at 80% 35%, rgba(99, 102, 241, 0.15), transparent 70%),
    radial-gradient(circle 120px at 50% 90%, rgba(34, 211, 238, 0.07), transparent 70%);
  pointer-events: none;
}

/* Identity bar (icon + name + create btn) */
.edc-comm-identity {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0 1.1rem 0.85rem;
  flex-wrap: wrap;
}

[dir="rtl"] .edc-comm-identity { flex-direction: row-reverse; }

.edc-comm-icon {
  width: 52px;
  height: 52px;
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.18), rgba(99, 102, 241, 0.14));
  border: 2px solid rgba(34, 211, 238, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #22d3ee;
  flex-shrink: 0;
  margin-top: -26px;
  box-shadow: 0 4px 18px rgba(34, 211, 238, 0.18), 0 2px 8px rgba(2, 6, 23, 0.4);
  position: relative;
  z-index: 1;
}

.edc-comm-icon svg { width: 24px; height: 24px; }

.edc-comm-name-group { flex: 1; min-width: 0; padding-top: 0.5rem; }

.edc-comm-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--c-text);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.edc-comm-meta {
  font-size: 0.75rem;
  color: var(--c-muted);
  margin-top: 2px;
}

.edc-comm-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1.1rem;
  border-radius: 9px;
  background: var(--c-grad);
  color: #020617;
  font-size: 0.8125rem;
  font-weight: 800;
  text-decoration: none;
  flex-shrink: 0;
  margin-top: 0.35rem;
  transition: opacity 0.15s;
}

.edc-comm-cta:hover { opacity: 0.88; color: #020617; }
.edc-comm-cta svg { width: 14px; height: 14px; flex-shrink: 0; }

/* Flash error */
.edc-comm-flash {
  margin: 0.75rem 1.1rem 0;
  padding: 0.65rem 1rem;
  border-left: 3px solid #f87171;
  border-radius: 0 8px 8px 0;
  background: rgba(248, 113, 113, 0.1);
  font-size: 0.8125rem;
  color: #fca5a5;
}

/* Compose box (logged-in) */
.edc-comm-compose {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1.1rem;
  border-top: 1px solid var(--c-border);
}

.edc-comm-compose-av {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.25), rgba(99, 102, 241, 0.18));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 800;
  color: #22d3ee;
}

.edc-comm-compose-av img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }

.edc-comm-compose-field {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  color: var(--c-muted);
  cursor: text;
  text-decoration: none;
  display: flex;
  align-items: center;
  transition: background 0.12s, border-color 0.12s;
}

.edc-comm-compose-field:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(34, 211, 238, 0.22);
}

html[data-theme="light"] .edc-comm-compose-field {
  background: #f0f2f5;
  border-color: #ced0d4;
  color: #65676b;
}

/* Etiquette note */
.edc-comm-etiquette {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 1.1rem 0.65rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--c-subtle);
  line-height: 1.4;
}

/* Guest CTA */
.edc-comm-guest {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.65rem 1.1rem;
  border-top: 1px solid var(--c-border);
  background: rgba(34, 211, 238, 0.04);
}

[dir="rtl"] .edc-comm-guest { flex-direction: row-reverse; }

.edc-comm-guest-msg {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--c-muted);
  flex: 1;
  min-width: 0;
}

.edc-comm-guest-btns {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.edc-comm-guest-join {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 1rem;
  border-radius: 8px;
  background: var(--c-grad);
  color: #020617;
  font-size: 0.8125rem;
  font-weight: 800;
  text-decoration: none;
  transition: opacity 0.12s;
}

.edc-comm-guest-join:hover { opacity: 0.88; color: #020617; }

.edc-comm-guest-login {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--c-border);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--c-muted);
  text-decoration: none;
  transition: background 0.12s;
}

.edc-comm-guest-login:hover { background: rgba(255, 255, 255, 0.08); color: var(--c-text); }

/* Tab bar */
.edc-comm-tabs {
  border-top: 1px solid var(--c-border);
  overflow-x: auto;
  scrollbar-width: none;
}

.edc-comm-tabs::-webkit-scrollbar { display: none; }

.edc-comm-tabs-row {
  display: flex;
  min-width: max-content;
  padding: 0 0.5rem;
}

.edc-comm-tab {
  display: inline-flex;
  align-items: center;
  padding: 0.7rem 0.9rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--c-muted);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: color 0.12s, border-color 0.12s;
}

.edc-comm-tab:hover { color: var(--c-text); border-bottom-color: rgba(255, 255, 255, 0.15); }

.edc-comm-tab.is-active {
  color: #22d3ee;
  border-bottom-color: #22d3ee;
}

html[data-theme="light"] .edc-comm-tab { color: #65676b; }
html[data-theme="light"] .edc-comm-tab.is-active { color: #0891b2; border-bottom-color: #0891b2; }

/* ── 5. LEFT NAV ──────────────────────────────────────────────
─────────────────────────────────────────────────────────────── */
.edc-lnav-create {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.6rem 1rem;
  border-radius: 9px;
  background: var(--c-grad);
  color: #020617;
  font-size: 0.875rem;
  font-weight: 800;
  text-decoration: none;
  box-sizing: border-box;
  transition: opacity 0.15s;
}

.edc-lnav-create:hover { opacity: 0.88; color: #020617; }
.edc-lnav-create svg { width: 15px; height: 15px; flex-shrink: 0; }

.edc-lnav-shell {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--c-r);
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.edc-lnav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.85rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: rgba(226, 232, 240, 0.75);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

[dir="rtl"] .edc-lnav-item { border-left: none; border-right: 3px solid transparent; }

.edc-lnav-item:hover { background: var(--c-hover); color: #f1f5f9; }

.edc-lnav-item.is-active {
  background: rgba(34, 211, 238, 0.08);
  color: #22d3ee;
  border-left-color: #22d3ee;
}

[dir="rtl"] .edc-lnav-item.is-active { border-right-color: #22d3ee; border-left-color: transparent; }

.edc-lnav-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.8; }
.edc-lnav-item.is-active svg { opacity: 1; }

.edc-lnav-divider {
  height: 1px;
  background: var(--c-border);
  margin: 0.1rem 0;
}

.edc-lnav-section {
  padding: 0.6rem 0.85rem 0.2rem;
  font-size: 0.6875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-subtle);
}

.edc-lnav-cat-label {
  display: flex;
  align-items: center;
  padding: 0.45rem 0.85rem 0.2rem;
}

.edc-lnav-cat-link {
  font-size: 0.8125rem;
  font-weight: 700;
  color: rgba(226, 232, 240, 0.6);
  text-decoration: none;
  transition: color 0.12s;
}

.edc-lnav-cat-link:hover { color: #f1f5f9; }

.edc-lnav-boards { padding: 0 0 0.2rem; }

.edc-lnav-board {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.38rem 0.85rem 0.38rem 1.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: rgba(148, 163, 184, 0.65);
  text-decoration: none;
  border-left: 3px solid transparent;
  gap: 0.4rem;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}

[dir="rtl"] .edc-lnav-board {
  padding: 0.38rem 1.75rem 0.38rem 0.85rem;
  border-left: none;
  border-right: 3px solid transparent;
}

.edc-lnav-board:hover { background: var(--c-hover); color: #e2e8f0; }

.edc-lnav-board.is-active {
  color: #22d3ee;
  background: rgba(34, 211, 238, 0.07);
  border-left-color: #22d3ee;
}

[dir="rtl"] .edc-lnav-board.is-active { border-right-color: #22d3ee; border-left-color: transparent; }

.edc-lnav-board-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.edc-lnav-board-count {
  font-size: 0.6875rem;
  font-weight: 700;
  color: rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 9999px;
  padding: 0.05rem 0.35rem;
  flex-shrink: 0;
}

/* ── 5b. LEFT NAV — LIGHT MODE OVERRIDES ─────────────────────
─────────────────────────────────────────────────────────────── */
html[data-theme="light"] .edc-lnav-cat-link {
  color: #475569;
}
html[data-theme="light"] .edc-lnav-cat-link:hover {
  color: #0f172a;
}
html[data-theme="light"] .edc-lnav-board {
  color: #475569;
}
html[data-theme="light"] .edc-lnav-board:hover {
  color: #0f172a;
  background: rgba(15, 23, 42, 0.04);
}
html[data-theme="light"] .edc-lnav-board-count {
  color: rgba(15, 23, 42, 0.45);
  background: rgba(15, 23, 42, 0.06);
}
html[data-theme="light"] .edc-lnav-item {
  color: #334155;
}
html[data-theme="light"] .edc-lnav-item:hover {
  color: #0f172a;
  background: rgba(15, 23, 42, 0.04);
}
html[data-theme="light"] .edc-lnav-item.is-active {
  color: #0e7490;
  background: rgba(14, 116, 144, 0.08);
}

/* ── 6. POST CARD ─────────────────────────────────────────────
   The heart of the social feed
─────────────────────────────────────────────────────────────── */
.edc-post {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--c-r);
  /* overflow: hidden removed — mod menu dropdown must escape the card boundary */
  /* Overflow restored via :has() for browsers that support it; JS class fallback below */
  overflow: hidden;
  backdrop-filter: blur(10px);
  transition: border-color 0.15s, box-shadow 0.15s;
  position: relative;
}

/* When the mod menu is open, allow it to overflow the card */
.edc-post:has(.edc-modMenu.is-open),
.edc-post.edc-topicCard--modOpen {
  overflow: visible;
  /* Keep backdrop-filter active via isolation workaround */
  backdrop-filter: none;
}

.edc-post:hover {
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 22px rgba(2, 6, 23, 0.24);
}

/* Card header */
.edc-post-hd {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1rem 0.5rem;
  position: relative;
}

[dir="rtl"] .edc-post-hd { flex-direction: row-reverse; }

/* Avatar */
.edc-post-av {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.2), rgba(99, 102, 241, 0.15));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9375rem;
  font-weight: 800;
  color: #22d3ee;
}

.edc-post-av img { width: 100%; height: 100%; object-fit: cover; }

/* Author meta */
.edc-post-meta { flex: 1; min-width: 0; }

.edc-post-author {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--c-text);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.edc-post-time {
  font-size: 0.75rem;
  color: var(--c-subtle);
  display: block;
  margin-top: 1px;
}

/* Pin / lock badges */
.edc-post-badges {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

.edc-post-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  white-space: nowrap;
}

.edc-post-badge--pin {
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.2);
  color: #fbbf24;
}

.edc-post-badge--featured {
  background: rgba(251, 191, 36, 0.14);
  border: 1px solid rgba(251, 191, 36, 0.28);
  color: #fbbf24;
}

/* Featured topic card — gold top banner */
.edc-post--featured {
  border-top: 3px solid #f59e0b;
  box-shadow: 0 -2px 16px rgba(245, 158, 11, 0.12), 0 4px 22px rgba(2, 6, 23, 0.24);
}

.edc-post-badge--lock {
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.18);
  color: #94a3b8;
}

.edc-post-badge svg { width: 11px; height: 11px; }

/* Moderation menu button — positioned last in header */
.edc-modMenuWrap {
  flex-shrink: 0;
  position: relative;
  margin-left: auto;  /* pushes ⋯ to far right */
  z-index: 1;         /* establishes stacking context for the menu */
}
[dir="rtl"] .edc-modMenuWrap { margin-left: 0; margin-right: auto; }

/* The dropdown uses position:fixed so backdrop-filter stacking contexts on sibling
   cards cannot clip it. JS sets top/right based on button's bounding rect. */
.edc-modMenu {
  z-index: 9000;
  position: fixed;
  top: 0;
  right: 0;
}

/* JS fallback: class added to card when menu opens */
.edc-post.edc-topicCard--modOpen { overflow: visible; }

/* Card body */
.edc-post-bd { padding: 0 1rem 0.65rem; }

.edc-post-link { display: block; text-decoration: none; }

.edc-post-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--c-text);
  line-height: 1.4;
  transition: color 0.12s;
}

.edc-post-link:hover .edc-post-title { color: #22d3ee; }

.edc-post-snippet {
  font-size: 0.8125rem;
  color: var(--c-muted);
  margin-top: 0.25rem;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Card footer */
.edc-post-ft {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 1rem 0.7rem;
  border-top: 1px solid var(--c-border);
}

[dir="rtl"] .edc-post-ft { flex-direction: row-reverse; }

.edc-post-stats { display: flex; gap: 0.75rem; align-items: center; }

.edc-post-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: var(--c-subtle);
  font-weight: 500;
}

.edc-post-stat svg { width: 14px; height: 14px; flex-shrink: 0; }

.edc-post-read {
  font-size: 0.75rem;
  font-weight: 700;
  color: rgba(34, 211, 238, 0.65);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: color 0.12s;
  flex-shrink: 0;
}

.edc-post-read:hover { color: #22d3ee; }
[dir="rtl"] .edc-post-read svg { transform: scaleX(-1); }

/* Empty state */
.edc-post-empty {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--c-r);
  padding: 2rem 1.5rem;
  text-align: center;
}

.edc-post-empty-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: rgba(226, 232, 240, 0.8);
  margin-bottom: 0.4rem;
}

.edc-post-empty-body {
  font-size: 0.8125rem;
  color: var(--c-muted);
  line-height: 1.55;
}

.edc-post-empty-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1rem;
  flex-wrap: wrap;
}

/* Topic list inside a board — cards share borders, no gap */
.edc-topic-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.edc-topic-list .edc-post {
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
  backdrop-filter: none;
}

.edc-topic-list li:last-child .edc-post { border-bottom: none; }

/* ── 7. BOARD HERO ────────────────────────────────────────────
─────────────────────────────────────────────────────────────── */
.edc-board-surface {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--c-r);
  /* overflow: hidden REMOVED — mod menu dropdown must float above the surface boundary */
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.edc-board-hd {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.1rem 1.25rem 0.9rem;
  border-bottom: 1px solid var(--c-border);
  flex-wrap: wrap;
}

[dir="rtl"] .edc-board-hd { flex-direction: row-reverse; }

.edc-board-hd-text { flex: 1; min-width: 0; }

.edc-board-kicker {
  font-size: 0.6875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(34, 211, 238, 0.65);
  margin-bottom: 0.3rem;
}

.edc-board-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--c-text);
  line-height: 1.3;
}

.edc-board-desc {
  font-size: 0.8125rem;
  color: var(--c-muted);
  margin-top: 0.3rem;
  line-height: 1.5;
}

.edc-board-stats {
  display: flex;
  gap: 0.85rem;
  margin-top: 0.55rem;
  flex-wrap: wrap;
}

.edc-board-stat {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8125rem;
  color: var(--c-muted);
  font-weight: 500;
}

.edc-board-stat svg { width: 14px; height: 14px; flex-shrink: 0; }

.edc-board-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.1rem;
  border-radius: 9px;
  background: var(--c-grad);
  color: #020617;
  font-size: 0.8125rem;
  font-weight: 800;
  text-decoration: none;
  flex-shrink: 0;
  transition: opacity 0.15s;
  align-self: flex-start;
}

.edc-board-cta:hover { opacity: 0.88; color: #020617; }
.edc-board-cta svg { width: 14px; height: 14px; }

/* Sub-boards */
.edc-board-subs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0.65rem 1.25rem;
  border-bottom: 1px solid var(--c-border);
}

.edc-board-subs-label {
  font-size: 0.6875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-subtle);
  display: flex;
  align-items: center;
  width: 100%;
  margin-bottom: 0.15rem;
}

.edc-board-sub-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.7rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(226, 232, 240, 0.75);
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s;
}

.edc-board-sub-chip:hover {
  background: rgba(34, 211, 238, 0.08);
  border-color: rgba(34, 211, 238, 0.2);
  color: #22d3ee;
}

/* Jump nav (multi-cluster) */
.edc-board-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  border-bottom: 1px solid var(--c-border);
}

.edc-board-jump-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.65rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(148, 163, 184, 0.65);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}

.edc-board-jump-link:hover { background: rgba(255, 255, 255, 0.07); color: #e2e8f0; }

.edc-board-jump-count {
  background: rgba(255, 255, 255, 0.07);
  border-radius: 9999px;
  padding: 0 0.28rem;
  font-size: 0.625rem;
  font-weight: 700;
}

/* Cluster (sub-section) header */
.edc-cluster-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  border-top: 1px solid var(--c-border);
}

[dir="rtl"] .edc-cluster-hd { flex-direction: row-reverse; }

.edc-cluster-title {
  font-size: 0.75rem;
  font-weight: 800;
  color: rgba(226, 232, 240, 0.65);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.edc-cluster-meta {
  font-size: 0.75rem;
  color: var(--c-subtle);
  display: flex;
  gap: 0.75rem;
}

/* ── 8. CATEGORIES DISCOVERY ──────────────────────────────────
─────────────────────────────────────────────────────────────── */
.edc-cats {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.edc-cat-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--c-r);
  overflow: hidden;
  backdrop-filter: blur(10px);
  transition: border-color 0.15s;
}

.edc-cat-card:hover { border-color: rgba(255, 255, 255, 0.15); }

.edc-cat-hd {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem 0.65rem;
}

[dir="rtl"] .edc-cat-hd { flex-direction: row-reverse; }

.edc-cat-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(34, 211, 238, 0.8);
}

.edc-cat-icon-wrap svg { width: 18px; height: 18px; }

.edc-cat-text { flex: 1; min-width: 0; }

.edc-cat-name {
  font-size: 0.9375rem;
  font-weight: 800;
  color: var(--c-text);
  display: block;
}

.edc-cat-desc {
  font-size: 0.8rem;
  color: var(--c-muted);
  margin-top: 2px;
  display: block;
}

.edc-cat-open-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 0.32rem 0.8rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.8rem;
  font-weight: 700;
  color: rgba(226, 232, 240, 0.8);
  text-decoration: none;
  transition: background 0.12s;
}

.edc-cat-open-btn:hover { background: rgba(255, 255, 255, 0.08); color: #f1f5f9; }

/* Stat pills */
.edc-cat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0 1.1rem 0.6rem;
}

.edc-cat-pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.18rem 0.6rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(226, 232, 240, 0.65);
}

/* Sub-category chips */
.edc-cat-sub-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 1.1rem 0.6rem;
}

.edc-cat-sub-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.65rem;
  border-radius: 8px;
  background: rgba(34, 211, 238, 0.07);
  border: 1px solid rgba(34, 211, 238, 0.15);
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(34, 211, 238, 0.85);
  text-decoration: none;
  transition: background 0.12s;
}

.edc-cat-sub-chip:hover { background: rgba(34, 211, 238, 0.12); }

/* Board rows */
.edc-cat-boards { border-top: 1px solid var(--c-border); }

.edc-cat-boards-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1.1rem 0.25rem;
  font-size: 0.6875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--c-subtle);
}

.edc-cat-board {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 1.1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  text-decoration: none;
  transition: background 0.12s;
}

[dir="rtl"] .edc-cat-board { flex-direction: row-reverse; }
.edc-cat-board:hover { background: var(--c-hover); }

.edc-cat-board-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(148, 163, 184, 0.55);
}

.edc-cat-board-icon svg { width: 15px; height: 15px; }

.edc-cat-board-text { flex: 1; min-width: 0; }

.edc-cat-board-name {
  font-size: 0.875rem;
  font-weight: 700;
  color: rgba(226, 232, 240, 0.9);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.edc-cat-board-meta {
  font-size: 0.72rem;
  color: var(--c-subtle);
  display: flex;
  gap: 0.5rem;
  margin-top: 2px;
}

.edc-cat-board-latest {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 160px;
  flex-shrink: 0;
}

.edc-cat-board-latest-link {
  font-size: 0.72rem;
  color: var(--c-muted);
  text-decoration: none;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.12s;
}

.edc-cat-board-latest-link::before {
  content: '·';
  margin-right: 0.25rem;
  opacity: 0.4;
}

[dir="rtl"] .edc-cat-board-latest-link::before { margin-right: 0; margin-left: 0.25rem; }

.edc-cat-board-latest-link:hover { color: #22d3ee; }

.edc-cat-board-open {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 0.75rem;
  font-weight: 700;
  color: rgba(34, 211, 238, 0.55);
  text-decoration: none;
  flex-shrink: 0;
  transition: color 0.12s;
}

.edc-cat-board-open:hover { color: #22d3ee; }

/* ── 9. LEADERBOARD WIDGET ────────────────────────────────────
─────────────────────────────────────────────────────────────── */
.edc-lb-widget {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--c-r);
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.edc-lb-hd {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1rem 0.7rem;
  border-bottom: 1px solid var(--c-border);
}

.edc-lb-hd-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.15), rgba(99, 102, 241, 0.12));
  border: 1px solid rgba(34, 211, 238, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #22d3ee;
  flex-shrink: 0;
}

.edc-lb-hd-icon svg { width: 14px; height: 14px; }

.edc-lb-title {
  font-size: 0.8125rem;
  font-weight: 800;
  color: var(--c-text);
  line-height: 1.2;
}

.edc-lb-subtitle {
  font-size: 0.6875rem;
  color: var(--c-subtle);
  margin-top: 1px;
}

.edc-lb-list { list-style: none; margin: 0; padding: 0.25rem 0; }

.edc-lb-row { border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.edc-lb-row:last-child { border-bottom: none; }

.edc-lb-entry {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  transition: background 0.12s;
}

.edc-lb-entry:hover { background: var(--c-hover); }
[dir="rtl"] .edc-lb-entry { flex-direction: row-reverse; }

.edc-lb-rank {
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  font-size: 0.6875rem;
  font-weight: 800;
  color: rgba(148, 163, 184, 0.4);
}

.edc-lb-rank--1 { color: #fbbf24; }
.edc-lb-rank--2 { color: #94a3b8; }
.edc-lb-rank--3 { color: #cd7f32; }

.edc-lb-av {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.2), rgba(99, 102, 241, 0.15));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: #22d3ee;
  flex-shrink: 0;
  overflow: hidden;
}

.edc-lb-av img { width: 100%; height: 100%; object-fit: cover; }

.edc-lb-info { flex: 1; min-width: 0; }

.edc-lb-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: rgba(226, 232, 240, 0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.edc-lb-spec {
  font-size: 0.68rem;
  color: var(--c-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  margin-top: 1px;
}

.edc-lb-bar-track {
  height: 3px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 9999px;
  margin-top: 5px;
  overflow: hidden;
}

.edc-lb-bar-fill {
  height: 100%;
  border-radius: 9999px;
  background: linear-gradient(90deg, #22d3ee, #6366f1);
}

.edc-lb-row:nth-child(1) .edc-lb-bar-fill { box-shadow: 0 0 6px rgba(34, 211, 238, 0.45); }

.edc-lb-side {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

[dir="rtl"] .edc-lb-side { align-items: flex-start; }

.edc-lb-level {
  font-size: 0.625rem;
  font-weight: 700;
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid rgba(34, 211, 238, 0.18);
  color: #22d3ee;
  border-radius: 9999px;
  padding: 0.05rem 0.35rem;
  white-space: nowrap;
}

.edc-lb-xp {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--c-subtle);
}

.edc-lb-empty {
  padding: 1rem;
  font-size: 0.8125rem;
  color: var(--c-muted);
  text-align: center;
}

/* ── 10. UTILITY BUTTONS ──────────────────────────────────────
─────────────────────────────────────────────────────────────── */
.edc-btn-primary-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1.1rem;
  border-radius: 10px;
  background: var(--c-grad);
  color: #020617;
  font-size: 0.875rem;
  font-weight: 800;
  text-decoration: none;
  min-height: 40px;
  transition: opacity 0.15s;
}

.edc-btn-primary-sm:hover { opacity: 0.88; color: #020617; }

.edc-btn-ghost-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1.1rem;
  border-radius: 10px;
  border: 1px solid var(--c-border);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(226, 232, 240, 0.8);
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
  min-height: 40px;
  transition: background 0.12s;
}

.edc-btn-ghost-sm:hover { background: rgba(255, 255, 255, 0.08); color: #f1f5f9; }

/* ── 11. LIGHT THEME OVERRIDES ────────────────────────────────
─────────────────────────────────────────────────────────────── */
html[data-theme="light"] .edc-post-title  { color: #0f172a; }
html[data-theme="light"] .edc-post-author { color: #1e293b; }
html[data-theme="light"] .edc-post-snippet { color: rgba(15, 23, 42, 0.55); }
html[data-theme="light"] .edc-post-ft { border-top-color: rgba(15, 23, 42, 0.08); }
html[data-theme="light"] .edc-cat-name { color: #0f172a; }
html[data-theme="light"] .edc-board-title { color: #0f172a; }
html[data-theme="light"] .edc-comm-name { color: #0f172a; }
html[data-theme="light"] .edc-lnav-item { color: rgba(15, 23, 42, 0.75); }
html[data-theme="light"] .edc-lnav-item.is-active { background: rgba(8, 145, 178, 0.08); color: #0891b2; }
html[data-theme="light"] .edc-board-kicker { color: rgba(8, 145, 178, 0.75); }
html[data-theme="light"] .edc-cat-board-name { color: #1e293b; }
html[data-theme="light"] .edc-lb-name { color: #1e293b; }
html[data-theme="light"] .edc-post-read { color: rgba(8, 145, 178, 0.7); }
html[data-theme="light"] .edc-post-read:hover { color: #0891b2; }

/* ── 12. MOBILE RESPONSIVE ────────────────────────────────────
─────────────────────────────────────────────────────────────── */
@media (max-width: 639px) {
  .edc-comm-compose { flex-wrap: wrap; }
  .edc-cat-board-latest { display: none; }
  .edc-post-hd { gap: 0.5rem; padding: 0.75rem 0.85rem 0.4rem; }
  .edc-post-av { width: 34px; height: 34px; font-size: 0.8125rem; }
  .edc-post-bd { padding: 0 0.85rem 0.55rem; }
  .edc-post-ft { padding: 0.5rem 0.85rem 0.65rem; }
  .edc-board-hd { padding: 0.9rem 0.9rem 0.75rem; }
  .edc-cat-hd { padding: 0.8rem 0.9rem 0.55rem; }
  .edc-cat-pills { padding: 0 0.9rem 0.55rem; }
  .edc-cat-board { padding: 0.55rem 0.9rem; }
}

@media (max-width: 899px) {
  .edc-comm-identity { padding: 0 0.9rem 0.75rem; }
  .edc-comm-compose { padding: 0.6rem 0.9rem; }
  .edc-comm-guest { padding: 0.6rem 0.9rem; }
  .edc-comm-etiquette { padding: 0 0.9rem 0.55rem; }
}

/* ── 13. SUPPLEMENTAL CLASSES ─────────────────────────────────
   Classes used in PHP templates not covered above
─────────────────────────────────────────────────────────────── */

/* Compose CTA button (logged-in create post) */
.edc-comm-compose-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.9rem;
  border-radius: 9px;
  background: var(--c-grad);
  color: #020617;
  font-size: 0.8125rem;
  font-weight: 800;
  text-decoration: none;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.edc-comm-compose-btn:hover { opacity: 0.88; color: #020617; }

/* SEO block — visually hidden but crawlable */
.edc-comm-seo {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

/* Flash error in hero */
[dir="rtl"] .edc-comm-flash { border-left: none; border-right: 3px solid #f87171; border-radius: 8px 0 0 8px; }

/* Category parent label */
.edc-cat-parent {
  font-size: 0.72rem;
  color: var(--c-subtle);
  margin-top: 1px;
  display: block;
}

/* Board description inside category board row */
.edc-cat-board-desc {
  font-size: 0.72rem;
  color: var(--c-subtle);
  display: block;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Empty category state */
.edc-cat-empty {
  padding: 0.75rem 1.1rem;
  font-size: 0.8125rem;
  color: var(--c-muted);
  border-top: 1px solid var(--c-border);
}

/* Board stack (contains cluster sections) */
.edc-board-stack { }

/* Board cluster */
.edc-board-cluster { }
.edc-board-cluster--solo .edc-cluster-hd { display: none; }

/* Cluster description */
.edc-cluster-desc {
  font-size: 0.75rem;
  color: var(--c-muted);
  margin-top: 2px;
  line-height: 1.45;
}

/* Leaderboard XP abbreviation */
.edc-lb-xp-abbr {
  font-size: 0.6rem;
  margin-left: 2px;
  text-decoration: none;
}

/* Left nav cat-link active highlight */
.edc-lnav-cat-link.is-active { color: #22d3ee; }

/* Left nav: ensure svg inside item is sized */
.edc-lnav-item svg { width: 17px; height: 17px; flex-shrink: 0; }

/* ── 14. POLISH & MICRO-INTERACTIONS ──────────────────────────
─────────────────────────────────────────────────────────────── */

/* Post card entrance animation (respects reduced-motion) */
@media (prefers-reduced-motion: no-preference) {
  .edc-cats .edc-cat-card,
  .edc-post {
    animation: edc-fadein 0.2s ease-out both;
  }
  .edc-topic-list li:nth-child(1) .edc-post { animation-delay: 0.00s; }
  .edc-topic-list li:nth-child(2) .edc-post { animation-delay: 0.04s; }
  .edc-topic-list li:nth-child(3) .edc-post { animation-delay: 0.08s; }
  .edc-topic-list li:nth-child(4) .edc-post { animation-delay: 0.12s; }
  .edc-topic-list li:nth-child(5) .edc-post { animation-delay: 0.16s; }
  .edc-topic-list li:nth-child(6) .edc-post { animation-delay: 0.20s; }
  .edc-cats .edc-cat-card:nth-child(2) { animation-delay: 0.06s; }
  .edc-cats .edc-cat-card:nth-child(3) { animation-delay: 0.12s; }
  @keyframes edc-fadein {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
  }
}

/* Avatar hover ring on post card */
.edc-post-av { transition: box-shadow 0.15s; }
.edc-post:hover .edc-post-av { box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.3); }

/* Left nav active board glow */
.edc-lnav-board.is-active { text-shadow: 0 0 10px rgba(34, 211, 238, 0.25); }

/* Compose field focus glow */
.edc-comm-compose-field:hover,
.edc-comm-compose-field:focus-within {
  border-color: rgba(34, 211, 238, 0.28);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.07);
}

/* Tab bar: smooth underline transition */
.edc-comm-tab { transition: color 0.15s, border-color 0.15s; }

/* ── 15. MOBILE — TOUCH TARGETS & PHONE LAYOUT ────────────────
─────────────────────────────────────────────────────────────── */

/* Minimum 44px touch targets on all touch devices */
@media (max-width: 1023px) {
  .edc-comm-tab        { min-height: 44px; display: inline-flex; align-items: center; }
  .edc-lnav-item       { min-height: 44px; }
  .edc-lnav-board      { min-height: 44px; }
  .edc-post-read       { min-height: 44px; display: inline-flex; align-items: center; }
  .edc-board-sub-chip  { min-height: 40px; display: inline-flex; align-items: center; }
  .edc-board-jump-link { min-height: 40px; display: inline-flex; align-items: center; }
  .edc-topicAdminMenu  { width: 44px !important; height: 44px !important; }
  .edc-cat-board       { min-height: 52px; }
  .edc-lnav-create     { min-height: 48px; }
  .edc-board-cta       { min-height: 44px; }
  .edc-cat-open-btn    { min-height: 40px; }
  /* Remove tap highlight flash */
  a, button { -webkit-tap-highlight-color: transparent; }
}

/* Phone layout — single column, tight spacing */
@media (max-width: 639px) {
  /* Hero */
  .edc-comm-cover  { height: 80px; }
  .edc-comm-icon   { width: 44px; height: 44px; margin-top: -22px; }
  .edc-comm-icon svg { width: 20px; height: 20px; }
  .edc-comm-name   { font-size: 0.9375rem; }
  .edc-comm-meta   { font-size: 0.7rem; }

  /* Compose box — wrap on small screens */
  .edc-comm-compose { gap: 0.5rem; }
  .edc-comm-compose-btn { width: 100%; justify-content: center; }

  /* Post card — full content preserved, tighter padding */
  .edc-post-title   { font-size: 0.9375rem; line-height: 1.45; }
  .edc-post-snippet { -webkit-line-clamp: 3; }
  .edc-post-ft      { flex-wrap: wrap; gap: 0.35rem; }
  .edc-post-read    { font-size: 0.8125rem; }
  .edc-post-hd      { padding: 0.75rem 0.85rem 0.4rem; gap: 0.5rem; }
  .edc-post-av      { width: 34px; height: 34px; font-size: 0.8rem; }
  .edc-post-bd      { padding: 0 0.85rem 0.55rem; }
  .edc-post-ft      { padding: 0.5rem 0.85rem 0.6rem; }

  /* Board hero — stack on mobile */
  .edc-board-hd     { flex-direction: column; gap: 0.65rem; padding: 0.9rem 0.9rem 0.75rem; }
  .edc-board-cta    { width: 100%; justify-content: center; }
  .edc-board-stats  { margin-top: 0; }

  /* Categories */
  .edc-cat-hd       { padding: 0.8rem 0.9rem 0.55rem; flex-wrap: wrap; }
  .edc-cat-open-btn { width: 100%; justify-content: center; margin-top: 0.25rem; }
  .edc-cat-pills    { padding: 0 0.9rem 0.55rem; }
  .edc-cat-board    { padding: 0.55rem 0.9rem; }
  .edc-cat-board-latest { display: none; }

  /* Mod menu — full width, drop down not up */
  .edc-modMenu {
    position: fixed !important;
    left: 0.75rem !important;
    right: 0.75rem !important;
    top: auto !important;
    bottom: env(safe-area-inset-bottom, 0.75rem) !important;
    min-width: unset !important;
    width: auto !important;
    border-radius: 16px;
  }
  [dir="rtl"] .edc-modMenu {
    left: 0.75rem !important;
    right: 0.75rem !important;
  }

  /* Leaderboard */
  .edc-lb-entry  { padding: 0.45rem 0.75rem; }
  .edc-lb-av     { width: 28px; height: 28px; font-size: 0.7rem; }

  /* Page padding — no padding-top: parent handles navbar clearance */
  .edc-comm-page { padding-left: 0; padding-right: 0; }
  .edc-comm-feed { gap: 0.5rem; }
}

/* Very small phones (≤ 375px) */
@media (max-width: 375px) {
  .edc-post-author { font-size: 0.8125rem; }
  .edc-post-time   { font-size: 0.6875rem; }
  .edc-post-title  { font-size: 0.875rem; }
  .edc-board-title { font-size: 1.1rem; }
  .edc-comm-name   { font-size: 0.875rem; }
}

/* Safe area insets — iOS home bar / notch */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .edc-comm-page {
    padding-bottom: calc(4rem + env(safe-area-inset-bottom));
  }
}

/* safe-area top inset handled by parent main element */

/* ══════════════════════════════════════════════════════════════
   §16. PREMIUM VISUAL ENHANCEMENTS — CSS-only, no HTML/JS changes
   ══════════════════════════════════════════════════════════════ */

/* ── Keyframes ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  @keyframes edc-shimmer {
    0%   { background-position: -200% center; }
    100% { background-position:  200% center; }
  }
  @keyframes edc-slide-fadein {
    from { opacity: 0; transform: translateY(12px) scale(0.99); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
  }
  @keyframes edc-pulse-scale {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.12); }
  }
}

/* ── 1. Post card left accent strip ────────────────────────── */
.edc-post::before {
  content: '';
  position: absolute;
  inset-block: 0;
  left: 0;
  width: 3px;
  background: linear-gradient(180deg, #22d3ee 0%, #6366f1 100%);
  opacity: 0;
  transition: opacity 0.20s ease, box-shadow 0.20s ease;
  border-radius: 3px 0 0 3px;
  pointer-events: none;
  z-index: 1;
}
.edc-post:hover::before {
  opacity: 1;
  box-shadow: 0 0 12px rgba(34,211,238,0.45), 0 0 28px rgba(99,102,241,0.18);
}
.edc-post.edc-topicCard--modOpen::before,
.edc-post:has(.edc-modMenu.is-open)::before {
  opacity: 0.3;
}
[dir="rtl"] .edc-post::before { left: auto; right: 0; border-radius: 0 3px 3px 0; }

/* ── 2. Post title hover underline animation ───────────────── */
.edc-post-title {
  position: relative;
}
.edc-post-title::after {
  content: '';
  position: absolute;
  left: 0; bottom: -1px;
  width: 100%; height: 1.5px;
  background: linear-gradient(90deg, #22d3ee, #6366f1);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.22s cubic-bezier(0.4,0,0.2,1);
  border-radius: 2px;
  pointer-events: none;
}
.edc-post-link:hover .edc-post-title::after { transform: scaleX(1); }
[dir="rtl"] .edc-post-title::after { transform-origin: right center; }

/* ── 3. Featured post border shimmer ───────────────────────── */
.edc-post--featured {
  border-top-color: transparent;
}
.edc-post--featured::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #f59e0b 0%, #fde68a 25%, #f59e0b 45%, #fbbf24 65%, #fde68a 80%, #f59e0b 100%);
  background-size: 200% auto;
  border-radius: var(--c-r) var(--c-r) 0 0;
  pointer-events: none;
  z-index: 2;
}
@media (prefers-reduced-motion: no-preference) {
  .edc-post--featured::after { animation: edc-shimmer 2.8s linear infinite; }
}

/* ── 4. Category icon glow ─────────────────────────────────── */
.edc-cat-icon-wrap {
  background: linear-gradient(135deg, rgba(34,211,238,0.10), rgba(99,102,241,0.07));
  transition: background 0.20s ease, box-shadow 0.20s ease, border-color 0.20s ease;
}
.edc-cat-card:hover .edc-cat-icon-wrap {
  background: linear-gradient(135deg, rgba(34,211,238,0.18), rgba(99,102,241,0.12));
  border-color: rgba(34,211,238,0.35);
  box-shadow: 0 0 0 3px rgba(34,211,238,0.08), 0 0 16px rgba(34,211,238,0.22), 0 0 32px rgba(99,102,241,0.10);
  color: #22d3ee;
}

/* ── 5. Tab active frosted pill ────────────────────────────── */
.edc-comm-tab.is-active {
  background: rgba(34,211,238,0.07);
  border-radius: 8px 8px 0 0;
  text-shadow: 0 0 18px rgba(34,211,238,0.45);
  box-shadow: inset 0 1px 0 rgba(34,211,238,0.18);
}
.edc-comm-tab:hover:not(.is-active) {
  background: rgba(255,255,255,0.035);
  border-radius: 8px 8px 0 0;
}

/* ── 6. Compose field rich focus glow ──────────────────────── */
.edc-comm-compose-field:hover,
.edc-comm-compose-field:focus-within {
  border-color: rgba(34,211,238,0.38);
  box-shadow: 0 0 0 3px rgba(34,211,238,0.09), 0 0 0 6px rgba(34,211,238,0.04), 0 4px 20px rgba(34,211,238,0.10);
  background: rgba(255,255,255,0.07);
}

/* ── 7. Cluster header gradient accent ─────────────────────── */
.edc-cluster-hd {
  position: relative;
  padding-left: 1.35rem;
}
.edc-cluster-hd::before {
  content: '';
  position: absolute;
  left: 0;
  inset-block: 6px;
  width: 3px;
  background: linear-gradient(180deg, #22d3ee 0%, #6366f1 100%);
  border-radius: 0 2px 2px 0;
  opacity: 0.65;
}
[dir="rtl"] .edc-cluster-hd { padding-left: 0; padding-right: 1.35rem; }
[dir="rtl"] .edc-cluster-hd::before { left: auto; right: 0; border-radius: 2px 0 0 2px; }
.edc-cluster-title {
  background: linear-gradient(90deg, rgba(226,232,240,0.9) 0%, rgba(148,163,184,0.65) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
html[data-theme="light"] .edc-cluster-title {
  background: none;
  -webkit-text-fill-color: unset;
  color: rgba(15,23,42,0.55);
}

/* ── 15. Leaderboard top-3 ambient glow ────────────────────── */
.edc-lb-list .edc-lb-row:nth-child(1) {
  background: linear-gradient(90deg, rgba(251,191,36,0.07) 0%, transparent 70%);
  border-left: 2px solid rgba(251,191,36,0.35);
  box-shadow: inset 0 0 20px rgba(251,191,36,0.04);
}
.edc-lb-list .edc-lb-row:nth-child(2) {
  background: linear-gradient(90deg, rgba(148,163,184,0.05) 0%, transparent 70%);
  border-left: 2px solid rgba(148,163,184,0.25);
}
.edc-lb-list .edc-lb-row:nth-child(3) {
  background: linear-gradient(90deg, rgba(180,110,50,0.05) 0%, transparent 70%);
  border-left: 2px solid rgba(180,110,50,0.25);
}
.edc-lb-list .edc-lb-row:nth-child(1) .edc-lb-rank--1 { text-shadow: 0 0 14px rgba(251,191,36,0.60); }
.edc-lb-list .edc-lb-row:nth-child(2) .edc-lb-rank--2 { text-shadow: 0 0 14px rgba(148,163,184,0.50); }
.edc-lb-list .edc-lb-row:nth-child(3) .edc-lb-rank--3 { text-shadow: 0 0 14px rgba(180,110,50,0.50); }
[dir="rtl"] .edc-lb-list .edc-lb-row:nth-child(1),
[dir="rtl"] .edc-lb-list .edc-lb-row:nth-child(2),
[dir="rtl"] .edc-lb-list .edc-lb-row:nth-child(3) { border-left: none; border-right: 2px solid currentColor; }

/* ── 16. Board surface top accent ──────────────────────────── */
.edc-board-surface {
  box-shadow: inset 0 1px 0 rgba(34,211,238,0.18), 0 1px 3px rgba(2,6,23,0.15);
}

/* ── 17. Left nav active gradient mesh ─────────────────────── */
.edc-lnav-item.is-active {
  background: linear-gradient(90deg, rgba(34,211,238,0.14) 0%, rgba(34,211,238,0.04) 60%, transparent 100%);
  border-left-color: transparent;
  box-shadow: inset 3px 0 0 0 #22d3ee, inset 0 0 20px rgba(34,211,238,0.04);
}
.edc-lnav-board.is-active {
  background: linear-gradient(90deg, rgba(34,211,238,0.10) 0%, rgba(34,211,238,0.02) 70%, transparent 100%);
  border-left-color: transparent;
  box-shadow: inset 3px 0 0 0 rgba(34,211,238,0.7);
}
[dir="rtl"] .edc-lnav-item.is-active,
[dir="rtl"] .edc-lnav-board.is-active {
  background: linear-gradient(270deg, rgba(34,211,238,0.14) 0%, rgba(34,211,238,0.04) 60%, transparent 100%);
  box-shadow: inset -3px 0 0 0 #22d3ee;
}
html[data-theme="light"] .edc-lnav-item.is-active {
  background: linear-gradient(90deg, rgba(8,145,178,0.10) 0%, rgba(8,145,178,0.03) 60%, transparent 100%);
  box-shadow: inset 3px 0 0 0 #0891b2;
}

/* ── 19. Post card entrance stagger ────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  .edc-topic-list .edc-post { animation: edc-slide-fadein 0.25s cubic-bezier(0.16,1,0.3,1) both; }
  .edc-topic-list li:nth-child(1) .edc-post { animation-delay: 0.00s; }
  .edc-topic-list li:nth-child(2) .edc-post { animation-delay: 0.05s; }
  .edc-topic-list li:nth-child(3) .edc-post { animation-delay: 0.10s; }
  .edc-topic-list li:nth-child(4) .edc-post { animation-delay: 0.14s; }
  .edc-topic-list li:nth-child(5) .edc-post { animation-delay: 0.18s; }
  .edc-topic-list li:nth-child(6) .edc-post { animation-delay: 0.22s; }
  .edc-topic-list li:nth-child(n+7) .edc-post { animation-delay: 0.25s; }
}

/* ── 22. "Read more" pill chip ─────────────────────────────── */
.edc-post-read {
  background: rgba(34,211,238,0.06);
  border: 1px solid rgba(34,211,238,0.16);
  border-radius: 9999px;
  padding: 0.22rem 0.7rem;
  font-size: 0.72rem;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.edc-post-read:hover {
  background: rgba(34,211,238,0.12);
  border-color: rgba(34,211,238,0.36);
  box-shadow: 0 0 10px rgba(34,211,238,0.15);
  color: #22d3ee;
}
html[data-theme="light"] .edc-post-read {
  background: rgba(8,145,178,0.07);
  border-color: rgba(8,145,178,0.18);
}

/* ── 23. Post footer stat icon hover color ─────────────────── */
.edc-post-stat { transition: color 0.15s; }
.edc-post-stat:hover { color: rgba(226,232,240,0.85); }
.edc-post-stat:hover svg { color: rgba(34,211,238,0.7); }

/* ── 25. Board kicker gradient text ────────────────────────── */
.edc-board-kicker {
  background: linear-gradient(90deg, #22d3ee, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
html[data-theme="light"] .edc-board-kicker {
  background: none;
  -webkit-text-fill-color: unset;
  color: rgba(8,145,178,0.75);
}

/* ══════════════════════════════════════════════════════════════
   §16b. MOBILE RESPONSIVE FIXES (phone gaps identified in audit)
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 639px) {
  /* Board sub-chips — wrap on phone */
  .edc-board-subs {
    flex-wrap: wrap;
    gap: 0.4rem;
  }
  .edc-board-sub-chip {
    font-size: 0.72rem;
  }

  /* Jump nav — hide on phone (too many items, no room) */
  .edc-board-jump {
    display: none;
  }

  /* Cluster header compact on phone */
  .edc-cluster-hd {
    padding: 0.55rem 0.75rem 0.55rem 1.65rem;
  }
  [dir="rtl"] .edc-cluster-hd {
    padding: 0.55rem 1.65rem 0.55rem 0.75rem;
  }

  /* Category board row — tighter gap on phone */
  .edc-cat-board {
    gap: 0.4rem;
  }

  /* Post card footer gap reduction */
  .edc-post-ft {
    gap: 0.3rem;
  }

  /* Mod menu full-width on phone */
  .edc-modMenu {
    min-width: unset;
    width: calc(100vw - 2rem);
    left: 0;
    right: auto;
    max-height: 70vh;
    overflow-y: auto;
  }
  [dir="rtl"] .edc-modMenu {
    left: auto;
    right: 0;
  }
}

@media (max-width: 375px) {
  /* Post card stats tighter on very small phones */
  .edc-post-ft { gap: 0.25rem; }

  /* Post title tiny phone */
  .edc-post-title { font-size: 0.875rem; }

  /* Post header padding */
  .edc-post-hd { padding: 0.65rem 0.6rem; gap: 0.5rem; }

  /* Avatar slightly smaller */
  .edc-post-av { width: 34px; height: 34px; font-size: 0.7rem; }
}

/* ══════════════════════════════════════════════════════════════
   §17. HERO BOARD-MODE — compact strip (no empty rectangle)
   ══════════════════════════════════════════════════════════════ */

/* When a specific board is selected, collapse hero into a minimal bar */
.edc-comm-hero--board {
  background: transparent;
  border: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
  margin-bottom: 0;
}

/* Breadcrumb in board mode becomes a standalone glass pill */
.edc-comm-hero--board .edc-breadcrumb {
  display: inline-flex;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 10px;
  padding: 0.45rem 0.85rem;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  margin: 0 0 0.65rem;
  flex-wrap: wrap;
  gap: 0.25rem 0.3rem;
}

/* Compose box and tabs sit flush right below the breadcrumb pill */
.edc-comm-hero--board .edc-comm-compose { margin-top: 0; }
.edc-comm-hero--board .edc-comm-tabs   { margin-top: 0.5rem; }
.edc-comm-hero--board .edc-comm-etiquette { margin-top: 0.4rem; }
.edc-comm-hero--board .edc-comm-guest  { margin-top: 0; }

/* Light theme */
html[data-theme="light"] .edc-comm-hero--board .edc-breadcrumb {
  background: rgba(255,255,255,0.88);
  border-color: rgba(15,23,42,0.1);
}

/* ══════════════════════════════════════════════════════════════
   §18. Category card boards section — clean card-row layout
   ══════════════════════════════════════════════════════════════ */

/* Section header "BOARDS · N TOTAL" */
.edc-cat-boards-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1.1rem 0.3rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-muted);
  border-top: 1px solid var(--c-border);
}

/* Wrapper — resets old border-top (header row handles separator) */
.edc-cat-boards { border-top: none; padding: 0.3rem 0.6rem 0.5rem; }

/* Each board row — resets old border-top hairline from earlier rule */
.edc-cat-board {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.55rem;
  border-radius: 10px;
  border-top: none;
  text-decoration: none;
  color: var(--c-text);
  transition: background 0.12s;
  min-height: 0;
}
.edc-cat-board:hover { background: var(--c-hover); }
[dir="rtl"] .edc-cat-board { flex-direction: row-reverse; }

/* Board icon */
.edc-cat-board-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  flex-shrink: 0;
  background: rgba(34, 211, 238, 0.12);
  border: 1px solid rgba(34, 211, 238, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #22d3ee;
}
.edc-cat-board-icon svg { width: 15px; height: 15px; }

/* Board text: name + meta — occupies remaining space */
.edc-cat-board-text { flex: 1; min-width: 0; }
.edc-cat-board-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--c-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  line-height: 1.3;
}
.edc-cat-board-desc {
  font-size: 0.7rem;
  color: var(--c-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  margin-top: 1px;
}
.edc-cat-board-meta {
  font-size: 0.68rem;
  color: var(--c-muted);
  margin-top: 2px;
  opacity: 0.8;
}

/* Latest topics — hidden by default, shown on desktop ≥1024px */
.edc-cat-board-latest { display: none; }
@media (min-width: 1024px) {
  .edc-cat-board-latest {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-width: 190px;
    flex-shrink: 0;
    min-width: 0;
  }
  .edc-cat-board-latest-link {
    font-size: 0.68rem;
    color: var(--c-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    text-decoration: none;
    opacity: 0.75;
    transition: color 0.12s, opacity 0.12s;
  }
  .edc-cat-board-latest-link::before { content: '· '; opacity: 0.5; }
  .edc-cat-board-latest-link:hover { color: #22d3ee; opacity: 1; }
  [dir="rtl"] .edc-cat-board-latest-link::before { content: '· '; }
}

/* Chevron arrow */
.edc-cat-board-open {
  color: var(--c-muted);
  opacity: 0.4;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  transition: opacity 0.12s, transform 0.12s;
}
.edc-cat-board:hover .edc-cat-board-open { opacity: 0.85; transform: translateX(2px); }
[dir="rtl"] .edc-cat-board:hover .edc-cat-board-open { transform: translateX(-2px); }
.edc-cat-board-open svg { width: 16px; height: 16px; }

/* Light mode overrides */
html[data-theme="light"] .edc-cat-boards { background: transparent; }
html[data-theme="light"] .edc-cat-boards-hd { border-color: rgba(15,23,42,0.08); }
html[data-theme="light"] .edc-cat-board { color: #1e293b; }
html[data-theme="light"] .edc-cat-board:hover { background: rgba(15,23,42,0.04); }
html[data-theme="light"] .edc-cat-board-icon {
  background: rgba(14,116,144,0.08);
  border-color: rgba(14,116,144,0.18);
  color: #0891b2;
}
html[data-theme="light"] .edc-cat-board-name { color: #0f172a; }
html[data-theme="light"] .edc-cat-board-meta { color: #64748b; }
html[data-theme="light"] .edc-cat-board-latest-link { color: #64748b; }
html[data-theme="light"] .edc-cat-board-latest-link:hover { color: #0891b2; }
html[data-theme="light"] .edc-cat-board-open { color: #94a3b8; }
