/* TechVault UI 강화 — GitHub형 Knowledge Space */
:root {
  --bg: #0a0e14;
  --panel: #12181f;
  --panel2: #182029;
  --text: #e8eef5;
  --muted: #8b98a8;
  --accent: #3ecf8e;
  --accent-dim: #1a3d2e;
  --link: #6cb6ff;
  --line: #2a3542;
  --danger: #ff6b6b;
  --warn: #e6b84d;
  --label: #2a4a6a66;
  --label-border: #4a7ab088;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "IBM Plex Sans KR", "IBM Plex Sans", sans-serif;
  --radius: 10px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  position: relative;
  line-height: 1.5;
}
.bg-atmosphere {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(900px 480px at 8% -10%, #163528 0%, transparent 55%),
    radial-gradient(700px 420px at 92% 0%, #132033 0%, transparent 50%),
    radial-gradient(600px 400px at 50% 110%, #101820 0%, transparent 45%),
    var(--bg);
}
.top, main { position: relative; z-index: 1; }
.top {
  border-bottom: 1px solid var(--line);
  background: rgba(6, 10, 14, 0.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.top-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 14px 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 22px;
  align-items: center;
}
.brand-wrap { display: flex; align-items: center; gap: 10px; }
.brand {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.03em;
  text-shadow: 0 0 24px rgba(62, 207, 142, 0.25);
  transition: text-shadow 0.25s ease;
}
.brand:hover { text-shadow: 0 0 32px rgba(62, 207, 142, 0.45); }
.pill {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent);
  border: 1px solid #2f6b4e;
  border-radius: 999px;
  padding: 3px 9px;
  background: var(--accent-dim);
  letter-spacing: 0.02em;
}
.nav { display: flex; gap: 4px; }
.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}
.nav a:hover { color: var(--text); background: var(--panel2); }
.nav a.active {
  color: var(--text);
  background: var(--panel2);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.tag { color: var(--muted); margin: 0; font-size: 0.8rem; }
.header-right {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.lang-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: var(--panel);
}
.lang-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 5px 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.lang-btn.active {
  background: var(--accent-dim);
  color: var(--accent);
}
.lang-btn:hover:not(.active) { color: var(--text); }
@media (max-width: 860px) {
  .header-right { width: 100%; align-items: flex-start; margin-left: 0; }
}

main { max-width: 1120px; margin: 0 auto; padding: 22px 22px 56px; }

.fade-root > * {
  animation: rise 0.35s ease both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-hero {
  margin-bottom: 22px;
  padding: 22px 0 8px;
}
.page-hero h1 {
  margin: 0 0 8px;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  letter-spacing: -0.03em;
  font-weight: 700;
}
.page-hero p {
  margin: 0;
  color: var(--muted);
  max-width: 52ch;
  font-size: 0.95rem;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.hero-stat {
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  transition: border-color 0.2s, transform 0.2s;
}
.hero-stat:hover {
  border-color: #3d5166;
  transform: translateY(-1px);
}
.hero-stat b {
  display: block;
  font-size: 1.4rem;
  margin-top: 4px;
  font-family: var(--mono);
  letter-spacing: -0.02em;
}
.hero-stat span { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; }

.search-row, .toolbar {
  display: flex;
  gap: 8px;
  margin: 0 0 16px;
  flex-wrap: wrap;
  align-items: center;
}
.toolbar strong { font-size: 1rem; }
.search-row input, .field input, .field textarea, .auth-row input {
  flex: 1;
  min-width: 180px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 11px 13px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: var(--sans);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-row input:focus, .field input:focus, .field textarea:focus, .auth-row input:focus {
  outline: none;
  border-color: #3d7a5c;
  box-shadow: 0 0 0 3px rgba(62, 207, 142, 0.15);
}
.btn, .search-row button {
  background: var(--accent);
  color: #04120c;
  border: 0;
  border-radius: 8px;
  padding: 11px 16px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  font-family: var(--sans);
  transition: filter 0.15s, transform 0.15s;
}
.btn:hover, .search-row button:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn.ghost, .btn.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.btn.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}

.list, .repo-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.list li, .repo-list li { border-bottom: 1px solid var(--line); }
.list li:last-child, .repo-list li:last-child { border-bottom: 0; }
.list a, .repo-list a {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 16px;
  text-decoration: none;
  color: inherit;
  padding: 15px 18px;
  transition: background 0.15s;
}
.list a:hover, .repo-list a:hover { background: var(--panel2); }
.commit-main { min-width: 0; }
.commit-title {
  font-weight: 650;
  font-size: 0.98rem;
  margin-bottom: 4px;
}
.commit-body {
  color: var(--muted);
  font-size: 0.88rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.commit-side {
  text-align: right;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}
.repo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.repo-grid li a {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  transition: border-color 0.2s, transform 0.2s;
  min-height: 96px;
}
.repo-grid li a:hover {
  border-color: #3d7a5c;
  transform: translateY(-2px);
}
.repo-name {
  color: var(--link);
  font-weight: 700;
  font-size: 1.02rem;
  font-family: var(--mono);
}
.repo-count {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-dim);
  border-radius: 999px;
  padding: 2px 8px;
}

.meta { color: var(--muted); font-size: 0.82rem; margin-top: 6px; }
code, .mono {
  font-family: var(--mono);
  font-size: 0.85em;
}
.labels { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.label {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--label);
  border: 1px solid var(--label-border);
  color: #c9d1d9;
  font-weight: 600;
}

.layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 22px;
}
.detail-head {
  margin-bottom: 14px;
}
.detail h1, .detail-head h1 {
  margin: 0 0 8px;
  font-size: clamp(1.35rem, 2.5vw, 1.75rem);
  letter-spacing: -0.02em;
}
.crumb { color: var(--muted); font-size: 0.88rem; margin-bottom: 14px; }
.crumb a { color: var(--link); text-decoration: none; }
.crumb a:hover { text-decoration: underline; }

.block {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 12px 0;
  white-space: pre-wrap;
}
.dna-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.dna-cell {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.block .label-title, .field .label-title, .dna-cell .label-title {
  color: var(--muted);
  font-size: 0.72rem;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.side .card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.side h3 {
  margin: 0 0 10px;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.side a { color: var(--link); text-decoration: none; word-break: break-all; }
.side a:hover { text-decoration: underline; }
.score { color: var(--accent); font-variant-numeric: tabular-nums; font-weight: 700; font-family: var(--mono); }

.field { margin: 10px 0; }
.field textarea { width: 100%; min-height: 72px; resize: vertical; }
.auth-row { display: flex; gap: 8px; margin-bottom: 12px; }
.edit-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 18px;
  background: linear-gradient(180deg, #0e141b, #0a0e14);
}
.badge-tomb {
  display: inline-block;
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.72rem;
  margin-left: 8px;
  font-weight: 700;
}

.graph-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 16px;
  overflow: auto;
  box-shadow: var(--shadow);
}
.graph-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 18px;
}
.graph-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.8rem;
  background: var(--panel2);
  transition: border-color 0.15s, transform 0.15s;
}
.graph-chip:hover { transform: translateY(-1px); }
.graph-chip.case { border-color: #3d7a5c; }
.graph-chip.model { border-color: #3d5a7a; }
.graph-chip.tag { border-color: #6a5a3d; }
.graph-chip.component { border-color: #5a3d6a; }
.graph-chip a { color: inherit; text-decoration: none; }
.graph-chip.center {
  box-shadow: 0 0 0 2px rgba(62, 207, 142, 0.35);
  font-weight: 700;
}
.graph-list { list-style: none; padding: 0; margin: 0; }
.graph-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
}
.graph-list li:last-child { border-bottom: 0; }
.node-type {
  display: inline-block;
  font-size: 0.68rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 6px;
  margin-right: 6px;
  font-family: var(--mono);
}
.edge-type { color: var(--muted); font-size: 0.75rem; font-family: var(--mono); }

.empty, .err { color: var(--muted); padding: 28px 0; }
.err { color: var(--danger); }
.flash { color: var(--accent); font-size: 0.9rem; margin: 8px 0; }
.empty-box {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  color: var(--muted);
  background: rgba(18, 24, 31, 0.6);
}

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .tag { margin-left: 0; width: 100%; }
  .hero-stats, .dna-grid, .repo-grid { grid-template-columns: 1fr; }
  .list a, .repo-list a { grid-template-columns: 1fr; }
  .commit-side { text-align: left; }
}
