@font-face {
  font-family: 'Rix';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2102-01@1.0/RixYeoljeongdo_Regular.woff') format('woff');
  font-weight: normal;
  font-display: swap;
}
@font-face {
  font-family: 'NanumSquareRound';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_two@1.0/NanumSquareRound.woff') format('woff');
  font-weight: normal;
  font-display: swap;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #ffffff;
  --surface: #f8f8f8;
  --border: #e8e8e8;
  --text: #111111;
  --muted: #888888;
  --accent: #abadb0;
  --accent-soft: #f5f5f6;
  --success: #8cc846;
  --success-soft: #f5fbe8;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06);
}

body {
  font-family: 'NanumSquareRound', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── HEADER ── */
header {
  background: #f5f3ee;
  border-bottom: 1px solid #e6e2d8;
  padding: 72px 24px 64px;
  text-align: center;
}
.dept {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 22px;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'Rix', sans-serif;
  font-size: 72px;
  font-weight: normal;
  letter-spacing: -2px;
  margin-bottom: 20px;
  color: var(--text);
  cursor: default;
  user-select: none;
}
header p#page-subtitle {
  color: var(--muted);
  font-size: 16px;
  max-width: 480px;
  margin: 0 auto 36px;
  line-height: 1.75;
}

/* ── HERO SEARCH ── */
.hero-search-wrap {
  max-width: 560px;
  margin: 0 auto;
}
.search-wrap {
  position: relative;
}
.search-wrap svg {
  position: absolute;
  left: 16px; top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
#search {
  width: 100%;
  padding: 15px 18px 15px 50px;
  border: 1.5px solid #d8d4ca;
  border-radius: 14px;
  font-size: 15px;
  font-family: inherit;
  background: #ffffff;
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
#search:focus {
  border-color: #b0a898;
  box-shadow: 0 2px 12px rgba(0,0,0,.1);
}

/* ── CONTENT LAYOUT ── */
.content-wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.main-col {
  flex: 1;
  min-width: 0;
  padding-bottom: 80px;
}

/* ── GRID ── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-top: 24px;
}

/* ── CARD ── */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
  cursor: pointer;
}
.card:hover {
  border-color: #d0d0d0;
  box-shadow: 0 2px 8px rgba(0,0,0,.09), 0 8px 24px rgba(0,0,0,.08);
}
.card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(171,173,176,.25), 0 2px 8px rgba(0,0,0,.08);
}
.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.card-stars {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
}
.card-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--text);
  flex: 1;
}
.card-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
  flex: 1;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}
.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.btn-copy {
  flex: 1;
  padding: 9px 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, transform .1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}
.btn-copy:hover { background: #8e9094; }
.btn-copy:active { transform: scale(.97); }
.btn-copy.copied {
  background: var(--success);
  pointer-events: none;
}
.btn-gh {
  padding: 9px 12px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s, color .15s;
  display: flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  white-space: nowrap;
}
.btn-gh:hover { border-color: #aaa; color: var(--text); }

/* ── TABS (상위) ── */
.tabs {
  max-width: 1400px;
  margin: 32px auto 0;
  padding: 0 24px;
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
}
.tab {
  padding: 10px 22px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--text); }

/* ── SUB-TABS (하위) ── */
.sub-tabs {
  max-width: 1400px;
  margin: 16px auto 0;
  padding: 0 24px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  min-height: 0;
}
.sub-tab {
  padding: 4px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  background: transparent;
  color: var(--muted);
  transition: border-color .15s, color .15s;
}
.sub-tab:hover, .sub-tab.active { border-color: #aaa; color: var(--text); }

/* ── CARD TAG ── */
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.card-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: var(--muted);
}

/* ── LOADING / EMPTY ── */
.state-wrap {
  margin: 60px 0;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
.spinner {
  width: 28px; height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── FOOTER ── */
footer {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 24px;
  font-size: 12px;
  color: var(--muted);
}
footer a { color: var(--muted); }

/* ── DETAIL PANEL ── */
.detail-panel {
  width: 360px;
  flex-shrink: 0;
  align-self: flex-start;
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow);
  margin-top: 24px;
}
.detail-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}
#detail-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
#detail-body[hidden] { display: none; }
#detail-empty[hidden] { display: none; }

@media (max-width: 900px) {
  .content-wrap { display: block; padding: 0; }
  .main-col { padding: 0 24px 80px; }
  .detail-panel { display: none; }
}
.drawer-header {
  padding: 24px 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: sticky;
  top: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 1;
}
.drawer-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.drawer-name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
  flex: 1;
}
.drawer-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.drawer-close {
  background: transparent;
  border: none;
  font-size: 16px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  line-height: 1;
  transition: color .15s, background .15s;
}
.drawer-close:hover { color: var(--text); background: var(--surface); }
.drawer-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}
.drawer-divider {
  flex-shrink: 0;
}
.drawer-readme-wrap {
  padding: 16px 16px 32px;
}
.drawer-readme-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
}
.readme-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  padding: 20px 0;
}
.readme-loading .spinner {
  width: 20px;
  height: 20px;
  margin: 0;
}
.readme-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 20px 0;
}

/* ── README 마크다운 ── */
.readme-content {
  font-size: 14px;
  line-height: 1.75;
  color: var(--text);
  word-break: break-word;
}
.readme-content h1 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.readme-content h2 {
  font-size: 17px;
  font-weight: 700;
  margin: 24px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.readme-content h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 18px 0 8px;
}
.readme-content h4, .readme-content h5, .readme-content h6 {
  font-size: 14px;
  font-weight: 700;
  margin: 14px 0 6px;
}
.readme-content p { margin: 0 0 10px; }
.readme-content a { color: #0969da; text-decoration: none; }
.readme-content a:hover { text-decoration: underline; }
.readme-content code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}
.readme-content pre {
  background: #1a1a1a;
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  margin: 0 0 14px;
}
.readme-content pre code {
  background: none;
  border: none;
  padding: 0;
  color: #e0e0e0;
  font-size: 12.5px;
}
.readme-content ul, .readme-content ol {
  padding-left: 22px;
  margin: 0 0 10px;
}
.readme-content li { margin: 3px 0; }
.readme-content blockquote {
  border-left: 3px solid var(--border);
  padding: 2px 0 2px 16px;
  color: var(--muted);
  margin: 0 0 10px;
}
.readme-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 18px 0;
}
.readme-content img { max-width: 100%; border-radius: 6px; }
.readme-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 14px;
  font-size: 13px;
}
.readme-content th, .readme-content td {
  border: 1px solid var(--border);
  padding: 7px 12px;
  text-align: left;
}
.readme-content th { background: var(--surface); font-weight: 700; }

@media (max-width: 560px) {
  .drawer { width: 100vw; }
}

@media (max-width: 480px) {
  header { padding: 52px 16px 48px; }
  .logo { font-size: 48px; letter-spacing: -1px; }
  #search { padding: 13px 16px 13px 44px; font-size: 14px; }
  .main-col { padding-left: 12px !important; padding-right: 12px !important; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}
