/* © 2026 김용현 */
* { box-sizing: border-box; }

/* hidden 속성은 브라우저 기본 규칙이 display:none을 주지만, 이 파일의
   .view-counts{display:flex} 같은 선언이 특이도로 그걸 이긴다. 게다가 Chromium은
   SVG 루트에는 기본 규칙 자체를 적용하지 않는다. 두 경우 모두 여기서 막는다. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100dvh;
  overflow: hidden;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: 1.6;
  letter-spacing: -0.01em;
  color: var(--foreground);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
}

.app {
  display: grid;
  grid-template-rows: var(--header-height) var(--tabs-height) 1fr;
  height: 100dvh;
}

/* ---------- 헤더 ---------- */
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
  background: var(--accent);
  color: #fff;
}

.brand { display: flex; align-items: baseline; gap: 8px; }
.brand h1 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -0.02em; }
.brand .edition { font-size: var(--text-caption); color: rgba(255, 255, 255, 0.6); }

.masthead-controls { display: flex; align-items: center; gap: 8px; }

.masthead select {
  height: 30px;
  padding: 0 30px 0 10px;
  font-family: inherit;
  font-size: 12px;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.masthead select option { color: var(--foreground); background: #fff; }

.masthead-meta { display: flex; align-items: center; gap: 12px; }

.view-counts { display: flex; gap: 10px; font-size: var(--text-caption); color: rgba(255, 255, 255, 0.7); }
.view-counts strong { color: #fff; font-weight: 600; }

.ghost-btn {
  height: 30px;
  padding: 0 10px;
  font-family: inherit;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius);
  cursor: pointer;
}
.ghost-btn:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

/* ---------- 탭 ---------- */
.module-tabs {
  display: flex;
  align-items: stretch;
  background: var(--background);
  border-bottom: 1px solid var(--border);
}

.module-tab {
  padding: 0 18px;
  font-family: inherit;
  font-size: var(--text-body);
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}
.module-tab:hover { color: var(--foreground); }
.module-tab.active { color: var(--foreground); font-weight: 600; border-bottom-color: var(--accent); }

/* ---------- 본문 ---------- */
.workspace {
  display: grid;
  grid-template-columns: 1fr var(--sidebar-width);
  min-height: 0;
}

.map-pane { position: relative; min-width: 0; background: var(--surface); }
#map { position: absolute; inset: 0; }
#map-svg { position: absolute; inset: 0; width: 100%; height: 100%; }

.legend {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 500;
  min-width: 180px;
  max-height: 55%;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.legend-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.legend-title { font-size: 12px; font-weight: 600; }
.legend-body { padding: 6px; overflow-y: auto; max-height: 40vh; }
.legend.collapsed .legend-body { display: none; }

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow-y: auto;
}
.sidebar-section { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.sidebar-section:last-child { border-bottom: none; }
.sidebar-section[hidden] { display: none; }

@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; grid-template-rows: 1fr 50vh; }
  .sidebar { border-left: none; border-top: 1px solid var(--border); }
}

/* 개발로그 새 글 배지 */
.ghost-btn { position: relative; }
.new-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff5c5c;
}
.new-badge[hidden] { display: none; }
