/* Community Archive (C) — source: mockups/C-archive/css/style.css */
:root {
  --bg: #f5f5f5;
  --sidebar-bg: #3c1e1e;
  --sidebar-text: #fef3c7;
  --header-bg: #fee500;
  --header-text: #191919;
  --bubble-me: #fff;
  --bubble-other: #fff9c4;
  --text: #191919;
  --text-muted: #666;
  --accent: #3c1e1e;
  --link: #b45309;
  --border: #ddd;
  --font: Pretendard, -apple-system, sans-serif;
  --sidebar-w: 280px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
}

.top-bar {
  background: var(--header-bg);
  color: var(--header-text);
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-weight: 600;
  font-size: 0.9375rem;
}
.top-bar .room { flex: 1; }
.top-bar .members { font-size: 0.75rem; font-weight: 400; opacity: 0.7; }
.top-bar a { color: inherit; text-decoration: none; font-size: 0.8125rem; font-weight: 400; }
.top-bar .top-links { display: flex; gap: 0.75rem; }

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - 44px);
}

.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 1rem 0;
  overflow-y: auto;
}

.sidebar .logo {
  padding: 0 1rem 1rem;
  font-size: 0.8125rem;
  opacity: 0.7;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 0.75rem;
}

.timeline-item {
  display: block;
  padding: 0.65rem 1rem;
  text-decoration: none;
  color: inherit;
  border-left: 3px solid transparent;
  transition: background 0.15s;
}
.timeline-item:hover { background: rgba(255,255,255,0.06); }
.timeline-item.active { background: rgba(254, 229, 0, 0.12); border-left-color: #fee500; }
.timeline-date { font-size: 0.6875rem; opacity: 0.6; margin-bottom: 0.15rem; }
.timeline-title { font-size: 0.875rem; font-weight: 500; }
.timeline-badge {
  display: inline-block;
  font-size: 0.625rem;
  background: #fee500;
  color: #191919;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  margin-top: 0.25rem;
}

.nav-section {
  padding: 0.75rem 1rem 0.25rem;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.5;
}

main {
  padding: 1.5rem;
  max-width: 720px;
  background: #fff;
  min-height: calc(100vh - 44px);
}

.page-header {
  margin-bottom: 1.5rem;
}
.page-header h1 { font-size: 1.5rem; margin-bottom: 0.35rem; }
.page-header .meta { font-size: 0.8125rem; color: var(--text-muted); }

.tags { margin-bottom: 1rem; }
.tag {
  display: inline-block;
  font-size: 0.6875rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: var(--header-bg);
  color: var(--header-text);
  margin-right: 0.3rem;
  font-weight: 600;
}

h2 {
  font-size: 1rem;
  margin: 1.75rem 0 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
h2::before {
  content: "📌";
  font-size: 0.875rem;
}

.date-divider {
  text-align: center;
  margin: 1.5rem 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.date-divider span {
  background: #e5e5e5;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
}

.chat-quote {
  display: flex;
  gap: 0.65rem;
  margin: 0.85rem 0;
  align-items: flex-start;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.bubble-wrap { flex: 1; min-width: 0; }
.bubble-name { font-size: 0.75rem; font-weight: 600; margin-bottom: 0.2rem; color: var(--text-muted); }
.bubble {
  background: var(--bubble-other);
  border-radius: 4px 16px 16px 16px;
  padding: 0.65rem 0.85rem;
  font-size: 0.9375rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  display: inline-block;
  max-width: 100%;
}

.summary-box {
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem;
  margin: 1.25rem 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border: 1px solid var(--border);
}
.summary-box.lead {
  background: linear-gradient(135deg, #fff9c4, #fff);
  border-color: #fee500;
  font-size: 1.0625rem;
  font-weight: 500;
}

.card-list { margin: 1rem 0; }
.topic-card {
  display: block;
  background: #fff;
  border-radius: 10px;
  padding: 1rem 1.15rem;
  margin-bottom: 0.65rem;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border);
  transition: border-color 0.2s;
}
.topic-card:hover { border-color: var(--header-bg); }
.topic-card h3 { font-size: 0.9375rem; margin-bottom: 0.25rem; }
.topic-card p { font-size: 0.8125rem; color: var(--text-muted); margin: 0; }
.topic-card .pin { color: var(--link); font-size: 0.75rem; }

.digest-block {
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
}
.digest-num { font-size: 0.8125rem; font-weight: 700; color: var(--link); margin-bottom: 0.5rem; }
.digest-fact { margin-bottom: 0.5rem; font-size: 0.9375rem; }
.digest-point { font-size: 0.8125rem; color: var(--text-muted); padding-left: 0.75rem; border-left: 3px solid var(--header-bg); }

.conflict {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin: 1rem 0;
  font-size: 0.875rem;
}

.search-box {
  margin-bottom: 1.25rem;
}
.search-box input {
  width: 100%;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 0.875rem;
  background: #fff;
}
.search-box input:focus {
  outline: 2px solid var(--header-bg);
  border-color: var(--header-bg);
}
.search-results {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.search-results .search-hit {
  display: block;
  padding: 0.45rem 0.35rem;
  margin-bottom: 0.25rem;
  border-radius: 6px;
  text-decoration: none;
  color: inherit;
  border: 1px solid transparent;
}

.search-results .search-hit:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(254, 229, 0, 0.35);
}

.search-results .search-hit strong {
  display: block;
  font-size: 0.8125rem;
  color: #fef3c7;
  margin-bottom: 0.15rem;
}

.search-results .search-hit span {
  display: block;
  font-size: 0.75rem;
  color: rgba(254, 243, 199, 0.75);
  line-height: 1.35;
}

.search-results .search-empty {
  margin: 0;
  padding: 0.25rem 0.35rem;
  font-size: 0.8125rem;
}

p { margin-bottom: 0.85rem; }

.wiki-prose { margin: 1.25rem 0; }
.wiki-prose h2 { font-size: 1rem; margin: 1.75rem 0 0.75rem; }
.wiki-prose h2::before { content: "📌"; margin-right: 0.35rem; }
.wiki-prose h3 { font-size: 0.9375rem; margin: 1.25rem 0 0.5rem; color: var(--text-muted); }
.wiki-prose h3::before { content: none; }
.wiki-prose ul { margin: 0.5rem 0 1rem 1.25rem; }
.wiki-prose li { margin-bottom: 0.45rem; }
a.wiki-link {
  color: var(--link);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
a.wiki-link:hover { color: var(--accent); }
.wiki-link-missing {
  color: #b91c1c;
  text-decoration: line-through;
  font-weight: 600;
}
.related-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.15rem;
  margin: 1.5rem 0;
}
.related-panel h3 {
  font-size: 0.8125rem;
  margin-bottom: 0.65rem;
  color: var(--text-muted);
}
.related-panel ul { list-style: none; margin: 0; padding: 0; }
.related-panel li { margin-bottom: 0.35rem; }
.evidence-block {
  margin-top: 2rem;
  padding: 1rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.evidence-block summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9375rem;
  margin-bottom: 0.5rem;
}
.home-section { margin-top: 1.5rem; }
.home-section h3 { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 0.5rem; }

/* Wiki table */
.wiki-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin: 1rem 0;
}
.wiki-table th, .wiki-table td {
  border: 1px solid var(--border);
  padding: 0.45rem 0.75rem;
  text-align: left;
  vertical-align: top;
}
.wiki-table th {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  font-weight: 600;
  white-space: nowrap;
}
.wiki-table tr:nth-child(even) td { background: #fafafa; }

/* Category list page */
.category-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.85rem;
  margin-top: 1.25rem;
}
.category-card {
  display: block;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.15rem;
  text-decoration: none;
  color: var(--text);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.category-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.09);
  border-color: var(--link);
}
.category-card h3 { font-size: 0.9375rem; margin: 0 0 0.35rem; color: var(--accent); }
.category-card .meta { font-size: 0.8125rem; color: var(--text-muted); margin: 0; }
.category-card-inner { position: relative; }
.category-card .timeline-badge { position: absolute; top: 0; right: 0; }

/* External links in sidebar */
.external-link { opacity: 0.85; }
.external-link:hover { opacity: 1; }
.external-link .timeline-title { font-size: 0.8125rem; }

/* Community link (top of sidebar) — icon + 단톡방 링크 한 줄 */
.community-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem 0.75rem 15px;
  margin: 0;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  overflow: hidden;
}
.community-link:hover { background: rgba(255,255,255,0.06); }
.sidebar .community-link .community-icon {
  width: 60px;
  height: 40px;
  max-width: 60px;
  max-height: 40px;
  flex: 0 0 60px;
  object-fit: contain;
  display: block;
}
.community-link,
.community-link:link,
.community-link:visited,
.community-link:hover,
.community-link:active { color: #fff; }
.community-label {
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}
.community-link:visited .community-label { color: #fff; }

/* --- Doc pages: optional right TOC (wiki article only) --- */
/* 기본: TOC 숨김. 1024px 이상에서만 우측에 표시 */
.doc-toc {
  display: none;
}

@media (min-width: 1024px) {
  .layout.layout-doc-active {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr) 200px;
  }
  .layout.layout-doc-active main {
    max-width: 780px;
  }
  .doc-toc {
    display: block;
    position: sticky;
    top: 1rem;
    align-self: start;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    padding: 0.75rem 0 0 0.5rem;
    font-size: 0.75rem;
    border-left: 2px solid var(--border);
  }
  .doc-toc-title {
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  .doc-toc a {
    display: block;
    color: var(--link);
    text-decoration: none;
    padding: 0.2rem 0;
    line-height: 1.35;
  }
  .doc-toc a:hover { text-decoration: underline; }
  .doc-toc a.active { font-weight: 700; color: var(--accent); }
}

/* 768px~1023px: TOC를 본문 위에 가로 접기 블록으로 표시 */
@media (min-width: 768px) and (max-width: 1023px) {
  .doc-toc {
    display: block;
    margin: 0 1rem 1rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fafafa;
    font-size: 0.8125rem;
  }
  .doc-toc-title {
    font-weight: 700;
    margin-bottom: 0.35rem;
    color: var(--text-muted);
    font-size: 0.75rem;
  }
  .doc-toc a {
    display: inline-block;
    color: var(--link);
    text-decoration: none;
    padding: 0.15rem 0.5rem 0.15rem 0;
    line-height: 1.3;
  }
  .doc-toc a:hover { text-decoration: underline; }
  /* 768px~1023px: TOC를 본문 아래 전체 너비 블록으로 표시 */
  .layout.layout-doc-active {
    grid-template-columns: var(--sidebar-w) 1fr;
  }
  .doc-toc {
    grid-column: 1 / -1;
  }
}

.wiki-prose {
  font-size: 0.9375rem;
  line-height: 1.7;
}
.wiki-prose p { margin: 0.75rem 0; }
.wiki-prose ul, .wiki-prose ol { margin: 0.5rem 0 0.75rem 1.25rem; }
.wiki-prose a { color: var(--link); }

.evidence-block {
  margin-top: 2rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}
.evidence-block > summary {
  cursor: pointer;
  padding: 0.85rem 1rem;
  font-weight: 600;
  font-size: 0.875rem;
  background: linear-gradient(90deg, #fff9c4, #fff);
  list-style: none;
}
.evidence-block > summary::-webkit-details-marker { display: none; }
.evidence-block[open] > summary { border-bottom: 1px solid var(--border); }
.evidence-block .chat-quote { padding: 0 0.75rem; }
.evidence-block .date-divider:first-child { margin-top: 0.75rem; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--header-bg);
  padding: 0.5rem 1rem;
  z-index: 100;
}
.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

@media (max-width: 768px) {
  .layout { grid-template-columns: var(--sidebar-w) 1fr; }
  main { padding: 1rem; max-width: none; }
  .top-bar { flex-wrap: wrap; }
}

@media (max-width: 640px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { max-height: 200px; }
}
