/* ---------- CRUMB ---------- */
.crumb {
  font-size: 13px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 28px;
}

.crumb a:hover { color: var(--lake-deep); }

/* ---------- PAGE HEAD ---------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: 14px;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-head h1 { font-size: 28px; font-weight: 700; }

.page-head p {
  color: var(--ink-soft);
  font-size: 14.5px;
  margin-top: 6px;
}

/* ---------- MAIN ---------- */
main { padding-bottom: 64px; }

/* ---------- TOPIC LIST ---------- */
.topic-list {
  display: flex;
  flex-direction: column;
}

.topic {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 4px;
  border-bottom: 1px solid var(--stone-line);
}

.topic:first-child { padding-top: 4px; }

.topic-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bitter', serif;
  font-weight: 600;
  font-size: 14px;
  color: #fff;
  overflow: hidden;
}

.topic-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.topic-author {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.topic-author:hover { color: var(--lake-deep); }

.topic-author-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  vertical-align: middle;
}

.topic-author-letter {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--lake);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #fff;
  font-family: 'Bitter', serif;
  font-weight: 600;
  flex: none;
}

.topic-body { flex: 1; min-width: 0; }

.topic-title {
  font-size: 15px;
  font-weight: 500;
}

.topic-title a:hover { color: var(--lake-deep); }

.topic-sub {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-top: 3px;
}

.topic-sub .cat-tag {
  color: var(--lake-deep);
  font-weight: 500;
}

.topic-stats {
  text-align: right;
  flex: none;
}

.topic-stats b {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
}

.topic-stats span {
  font-size: 11px;
  color: var(--ink-soft);
}

/* ---------- ADMIN DELETE ---------- */
.delete-btn {
  margin-left: 8px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--stone);
  border-radius: 6px;
  transition: all .15s ease;
}

.delete-btn:hover {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}

/* ---------- NEW TOPIC CARD ---------- */
.new-topic-card {
  margin-top: 22px;
  border: 1px dashed var(--stone);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--paper-raised);
}

.new-topic-card p {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-soft);
}

/* ---------- EMPTY ---------- */
.empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--ink-soft);
  background: var(--paper-raised);
  border: 1px dashed var(--stone);
  border-radius: var(--radius);
}

.empty p { margin: 0; font-size: 14.5px; }

/* ---------- BACK LINKS ---------- */
.back-links {
  margin-top: 34px;
  display: flex;
  gap: 18px;
  font-size: 13.5px;
  color: var(--ink-soft);
}

.back-links a:hover { color: var(--lake-deep); }

/* ---------- INFINITE SCROLL ---------- */
.loading {
  text-align: center;
  padding: 24px;
  color: var(--ink-soft);
  font-size: 13.5px;
}
.end-note {
  text-align: center;
  padding: 24px;
  color: var(--ink-soft);
  font-size: 13px;
  border-top: 1px solid var(--stone-line);
  margin-top: 4px;
}

/* ---------- AVATAR POPUP ---------- */
.avatar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.78);
  z-index: 999;
}

.avatar-popup {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.avatar-popup-inner {
  background: #fff;
  border-radius: 50%;
  padding: 4px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.38);
  width: min(88vmin, 640px);
  height: min(88vmin, 640px);
  max-width: 90vw;
  max-height: 90vh;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  overflow: hidden;
}

.avatar-popup-inner img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

/* ---------- FORUM HERO (category directory) ---------- */
.forum-hero {
  margin: 18px 0 28px;
  padding: 28px 24px;
  background: #fff;
  border: 1px solid var(--stone-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.forum-hero h1 {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

.forum-hero p {
  margin: 8px 0 0;
  font-size: 14.5px;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* ---------- CATEGORY GRID ---------- */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.cat-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 18px 16px;
  background: #fff;
  border: 1px solid var(--stone-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
  min-height: 148px;
}

.cat-card:hover {
  border-color: var(--lake);
  box-shadow: 0 8px 22px rgba(36, 38, 32, 0.10);
  transform: translateY(-1px);
}

.cat-card:focus-visible {
  outline: 2px solid var(--lake);
  outline-offset: 2px;
}

.cat-card-icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper-raised);
  border: 1px solid var(--stone-line);
  color: var(--lake-deep);
  flex: none;
}

.cat-card-title {
  font-family: 'Bitter', serif;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
  color: var(--ink);
}

.cat-card-desc {
  margin: 0;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.55;
  flex: 1;
}

.cat-card-count {
  display: inline-flex;
  align-items: center;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--lake-deep);
  margin-top: 2px;
}

.cat-card-count .mono {
  font-weight: 600;
}

/* ---------- FORUM CTA ---------- */
.forum-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 28px;
  flex-wrap: wrap;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 960px) {
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .page-head h1 { font-size: 24px; }
  .topic { flex-wrap: wrap; }
  .topic-stats { text-align: left; }
  .forum-hero { padding: 22px 18px; }
  .forum-hero h1 { font-size: 26px; }
  .cat-grid { grid-template-columns: 1fr; }
}
