/* CodingMa forum — premium community layout */

:root {
  --cm-ink: #12110f;
  --cm-ink-soft: #171512;
  --cm-paper: #f4f0e8;
  --cm-paper-card: #fffdf9;
  --cm-copper: #d08a45;
  --cm-copper-soft: rgba(208, 138, 69, 0.14);
  --cm-text: #1c1915;
  --cm-muted: #6f685f;
  --cm-border: rgba(28, 25, 21, 0.1);
  --cm-side: 240px;
  --cm-latest: 280px;
}

.forum-page [hidden] { display: none !important; }
.forum-page .site-main { background: var(--cm-paper); padding: 0 0 3rem; }

/* Header matches homepage */
.forum-page .site-header {
  background: rgba(18, 17, 15, 0.92);
  border-bottom: 1px solid rgba(246, 241, 234, 0.08);
  box-shadow: none;
  backdrop-filter: blur(16px);
}
.forum-page .brand-wordmark { color: #f6f1ea !important; }
.forum-page .brand-wordmark span {
  background: none !important;
  -webkit-text-fill-color: var(--cm-copper) !important;
  color: var(--cm-copper) !important;
}
.forum-page .site-nav { background: transparent; border: 0; box-shadow: none; padding: 0; }
.forum-page .site-nav a { color: #e7e0d6; }
.forum-page .site-nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }
.forum-page .site-nav a.active { color: var(--cm-copper); }
.forum-page .site-nav a.btn-nav-download {
  background: var(--cm-copper);
  color: #1a120c;
}
.forum-page .site-nav a.btn-nav-download:hover { background: #e0a15f; color: #1a120c; }
.forum-page .nav-toggle { color: #f6f1ea; border-color: rgba(246, 241, 234, 0.16); }

.forum-page .site-footer {
  background: var(--cm-ink);
  color: #b7aea3;
  border-top: 0;
}
.forum-page .footer-col h3,
.forum-page .footer-col a,
.forum-page .footer-brand strong { color: #e7e0d6; }
.forum-page .footer-col a:hover { color: var(--cm-copper); }
.forum-page .footer-bottom { border-top-color: rgba(246, 241, 234, 0.1); }

/* Hero banner */
.fm-hero {
  background:
    radial-gradient(700px 320px at 85% 0%, rgba(208, 138, 69, 0.2), transparent 55%),
    var(--cm-ink);
  color: #f6f1ea;
  padding: 2.5rem 0 2.75rem;
  margin-bottom: 0;
}
.fm-hero__inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: center;
}
.fm-hero h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.65rem, 3vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.fm-hero p {
  margin: 0;
  max-width: 32rem;
  color: #c9c1b6;
  line-height: 1.6;
  font-size: 1rem;
}
.fm-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: flex-end;
}
.fm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 1.1rem;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
}
.fm-btn--solid { background: #f4efe6; color: #1a140f; }
.fm-btn--solid:hover { background: #fff; color: #1a140f; }
.fm-btn--line { border-color: rgba(246, 241, 234, 0.22); color: #f6f1ea; background: transparent; }
.fm-btn--line:hover { border-color: var(--cm-copper); color: #f6f1ea; }
.fm-btn--copper { background: var(--cm-copper); color: #1a120c; }
.fm-btn--copper:hover { background: #e0a15f; color: #1a120c; }

.dc-page {
  display: grid;
  grid-template-columns: var(--cm-side) minmax(0, 1fr) var(--cm-latest);
  gap: 24px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  align-items: start;
}

.dc-sidebar {
  position: sticky;
  top: 88px;
  background: var(--cm-paper-card);
  border: 1px solid var(--cm-border);
  border-radius: 16px;
  padding: 1rem 0.85rem;
  box-shadow: 0 8px 24px rgba(18, 17, 15, 0.04);
}
.dc-side-nav { display: flex; flex-direction: column; gap: 2px; margin-bottom: 1rem; }
.dc-side-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  color: var(--cm-text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
}
.dc-side-link:hover,
.dc-side-link.is-active {
  background: var(--cm-copper-soft);
  color: #8a5a28;
}
.dc-ico {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  background: rgba(28, 25, 21, 0.06);
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--cm-muted);
  letter-spacing: 0.02em;
}
.dc-side-link.is-active .dc-ico {
  background: var(--cm-copper);
  color: #1a120c;
}
.dc-side-block { margin-top: 0.25rem; padding-top: 0.75rem; border-top: 1px solid var(--cm-border); }
.dc-side-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cm-muted);
  margin: 0 0 0.45rem 0.75rem;
}
.dc-cat-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  color: var(--cm-text);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
}
.dc-cat-link:hover { background: rgba(208, 138, 69, 0.08); }
.dc-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }

.dc-main { min-width: 0; }
.dc-topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.1rem;
}
.dc-search { flex: 1; }
.dc-search input {
  width: 100%;
  padding: 0.65rem 1rem;
  border: 1px solid var(--cm-border);
  border-radius: 12px;
  background: var(--cm-paper-card);
  font: inherit;
  box-shadow: 0 2px 8px rgba(18, 17, 15, 0.03);
}
.dc-search input:focus {
  outline: 2px solid var(--cm-copper);
  outline-offset: -1px;
  border-color: transparent;
}
.dc-top-links { display: flex; gap: 0.85rem; flex-wrap: wrap; }
.dc-top-links a {
  color: var(--cm-muted);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 600;
}
.dc-top-links a:hover { color: #8a5a28; }

.dc-featured { margin-bottom: 1.25rem; }
.dc-featured h2 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--cm-text);
}
.dc-featured-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.dc-feat-card {
  background: var(--cm-paper-card);
  border: 1px solid var(--cm-border);
  border-radius: 16px;
  padding: 1.1rem 1.15rem;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 4px 16px rgba(18, 17, 15, 0.04);
  min-height: 120px;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  transition: border-color 0.15s, transform 0.15s;
}
.dc-feat-card:hover {
  border-color: rgba(208, 138, 69, 0.45);
  transform: translateY(-1px);
}
.dc-feat-card strong { font-size: 0.96rem; line-height: 1.35; color: var(--cm-text); font-weight: 650; }
.dc-feat-meta {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--cm-muted);
  font-size: 0.8rem;
  margin-top: auto;
}

.dc-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--cm-border);
  margin-bottom: 0;
  background: var(--cm-paper-card);
  border-radius: 14px 14px 0 0;
  border: 1px solid var(--cm-border);
  border-bottom: 0;
  padding: 0 0.35rem;
}
.dc-tab {
  padding: 0.75rem 1rem;
  color: var(--cm-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.dc-tab.is-active { color: #8a5a28; border-bottom-color: var(--cm-copper); }

.dc-cat-table,
.forum-list {
  background: var(--cm-paper-card);
  border: 1px solid var(--cm-border);
  border-top: 0;
  border-radius: 0 0 16px 16px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(18, 17, 15, 0.04);
}
.dc-cat-row {
  display: grid;
  grid-template-columns: 6px 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 0.9rem 1rem 0.9rem 0;
  border-top: 1px solid var(--cm-border);
  text-decoration: none;
  color: inherit;
}
.dc-cat-row:first-child { border-top: 0; }
.dc-cat-row:hover { background: rgba(208, 138, 69, 0.06); }
.dc-cat-bar { align-self: stretch; border-radius: 0 3px 3px 0; }
.dc-cat-name { font-weight: 700; color: var(--cm-text); }
.dc-cat-desc { font-size: 0.84rem; color: var(--cm-muted); margin-top: 0.15rem; }
.dc-cat-count { font-weight: 700; color: var(--cm-text); min-width: 2.5rem; text-align: right; }
.dc-cat-sub { font-size: 0.76rem; color: var(--cm-muted); }

.forum-list > .sub { padding: 2rem; text-align: center; color: var(--cm-muted); }
.forum-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1.1rem;
  border-top: 1px solid var(--cm-border);
  text-decoration: none;
  color: var(--cm-text);
}
.forum-item:first-child { border-top: 0; }
.forum-item:hover { background: rgba(208, 138, 69, 0.06); }
.forum-item-main { min-width: 0; }
.forum-item-title {
  font-weight: 650;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}
.forum-item:hover .forum-item-title { color: #8a5a28; }
.forum-item-meta {
  font-size: 0.8rem;
  color: var(--cm-muted);
  margin-top: 0.12rem;
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  align-items: center;
}
.f-cat {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  color: #fff;
  letter-spacing: 0.02em;
}
.forum-item-stats { text-align: right; color: var(--cm-muted); font-size: 0.85rem; min-width: 2.2rem; }
.f-replies { font-weight: 700; color: var(--cm-text); }
.forum-item-time { color: var(--cm-muted); font-size: 0.8rem; white-space: nowrap; }

.f-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--cm-copper-soft);
  color: #8a5a28;
  font-weight: 700;
  font-size: 1rem;
  text-transform: uppercase;
  flex: 0 0 auto;
  overflow: hidden;
}
.f-avatar.f-avatar-sm { width: 34px; height: 34px; font-size: 0.85rem; }
.f-avatar.f-avatar-xs { width: 28px; height: 28px; font-size: 0.75rem; }
.f-avatar.f-avatar-svg { padding: 0; background: transparent; }
.f-avatar-svg svg { width: 100%; height: 100%; display: block; }

.f-avatar-picker { display: grid; grid-template-columns: repeat(6, 48px); gap: 10px; margin-top: 0.15rem; }
.f-avatar-opt {
  width: 48px; height: 48px; padding: 0; border: 2px solid transparent;
  border-radius: 50%; background: none; cursor: pointer; overflow: hidden; line-height: 0;
}
.f-avatar-opt svg { width: 100%; height: 100%; display: block; }
.f-avatar-opt:hover { transform: translateY(-1px); }
.f-avatar-opt.is-selected {
  border-color: var(--cm-copper);
  box-shadow: 0 0 0 3px rgba(208, 138, 69, 0.2);
}

.f-avatar-modal,
.f-forum-modal {
  position: fixed; inset: 0; z-index: 10050;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.f-avatar-modal[hidden],
.f-forum-modal[hidden] { display: none !important; }
.f-avatar-modal__backdrop,
.f-forum-modal__backdrop {
  position: absolute; inset: 0; background: rgba(18, 17, 15, 0.55);
  backdrop-filter: blur(3px);
}
.f-avatar-modal__dialog,
.f-forum-modal__dialog {
  position: relative; z-index: 1; width: min(520px, 100%);
  background: var(--cm-paper-card); border: 1px solid var(--cm-border); border-radius: 18px;
  padding: 1.15rem 1.25rem 1.25rem;
  box-shadow: 0 28px 64px rgba(18, 17, 15, 0.22);
}

.dc-latest {
  position: sticky;
  top: 88px;
  background: var(--cm-paper-card);
  border: 1px solid var(--cm-border);
  border-radius: 16px;
  padding: 1rem 1.1rem;
  box-shadow: 0 8px 24px rgba(18, 17, 15, 0.04);
}
.dc-latest h2 {
  margin: 0 0 0.7rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--cm-text);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.dc-late-item {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  padding: 0.55rem 0;
  text-decoration: none;
  color: inherit;
  border-top: 1px solid var(--cm-border);
}
.dc-late-item:first-child { border-top: 0; }
.dc-late-title { font-size: 0.84rem; font-weight: 650; color: var(--cm-text); line-height: 1.35; }
.dc-late-meta { font-size: 0.74rem; color: var(--cm-muted); margin-top: 0.15rem; }

.forum-auth,
.forum-new {
  background: var(--cm-paper-card);
  border: 1px solid var(--cm-border);
  border-radius: 16px;
  padding: 1.25rem 1.4rem;
  margin: 0 0 1.1rem;
  box-shadow: 0 4px 16px rgba(18, 17, 15, 0.04);
}
.forum-new h2 { margin: 0 0 1rem; font-size: 1.05rem; font-weight: 700; }
#forum-signed-as { color: var(--cm-muted); margin: 0 0 0.75rem; display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
#forum-signed-as strong { color: #8a5a28; }

.forum-back { margin-bottom: 1rem; }
.forum-back a { color: #8a5a28; text-decoration: none; font-weight: 600; }
.forum-topic,
.forum-comment {
  background: var(--cm-paper-card);
  border: 1px solid var(--cm-border);
  border-radius: 16px;
  padding: 1.4rem 1.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 4px 16px rgba(18, 17, 15, 0.04);
}
.forum-topic h1 { margin: 0 0 0.75rem; font-size: 1.5rem; font-weight: 800; color: var(--cm-text); letter-spacing: -0.02em; }
.forum-body { margin-top: 1rem; line-height: 1.7; color: var(--cm-text); white-space: pre-wrap; }
.forum-comment--reply {
  margin-left: 1.75rem;
  margin-top: 0.65rem;
  padding-left: 1rem;
  border-left: 3px solid var(--cm-copper-soft);
  background: rgba(208, 138, 69, 0.04);
}
.forum-reply-hint {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
  margin: 0 0 0.75rem; padding: 0.55rem 0.75rem; border-radius: 10px;
  background: var(--cm-copper-soft); color: var(--cm-text); font-size: 0.88rem;
}
.forum-reply-hint strong { color: #8a5a28; font-weight: 650; }
.forum-comments h2 {
  font-size: 0.88rem; color: var(--cm-muted); font-weight: 700;
  margin: 0 0 0.9rem; text-transform: uppercase; letter-spacing: 0.06em;
}

.dc-user-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 1rem;
}
.dc-user-card {
  background: var(--cm-paper-card);
  border: 1px solid var(--cm-border);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  display: flex;
  gap: 0.7rem;
  align-items: center;
}

.forum-page .btn-primary {
  background: var(--cm-copper);
  border-color: var(--cm-copper);
  color: #1a120c;
  box-shadow: none;
  font-weight: 650;
}
.forum-page .btn-primary:hover { background: #e0a15f; border-color: #e0a15f; color: #1a120c; }
.forum-page .btn-outline { border-color: var(--cm-border); color: var(--cm-muted); background: #fff; }

.field textarea,
.field input[type="text"],
.field select {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--cm-border);
  border-radius: 10px;
  font: inherit;
  resize: vertical;
  box-sizing: border-box;
  background: #fff;
}
.field textarea:focus,
.field input[type="text"]:focus,
.field select:focus {
  outline: 2px solid var(--cm-copper);
  outline-offset: -1px;
  border-color: transparent;
}
.field label { font-weight: 600; color: var(--cm-text); font-size: 0.9rem; display: block; margin-bottom: 0.3rem; }

@media (max-width: 1020px) {
  .dc-page { grid-template-columns: 200px minmax(0, 1fr); }
  .dc-latest { display: none; }
  .fm-hero__inner { grid-template-columns: 1fr; }
  .fm-hero__actions { justify-content: flex-start; }
}
@media (max-width: 760px) {
  .dc-page { grid-template-columns: 1fr; padding: 1rem 0.8rem 2.5rem; }
  .dc-sidebar { position: static; }
  .dc-side-nav { flex-direction: row; flex-wrap: wrap; }
  .dc-featured-grid { grid-template-columns: 1fr; }
  .dc-top-links { display: none; }
  .forum-item { grid-template-columns: 36px minmax(0, 1fr) auto; }
  .forum-item-time { display: none; }
  .forum-page .site-nav {
    background: var(--cm-ink-soft);
    border-bottom: 1px solid rgba(246, 241, 234, 0.08);
  }
  .forum-page .site-nav a { color: #f6f1ea; }
}
