/* ==========================================================================
   Prometheus Research Group — Research Library Stylesheet
   Extends the shared paper stylesheet design language
   ========================================================================== */

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 17px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Georgia', 'Times New Roman', 'Palatino Linotype', serif;
  line-height: 1.75;
  color: #1a1a1a;
  background: #fafaf8;
  -webkit-font-smoothing: antialiased;
}

/* Layout */
.library-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

/* ---- Header ---- */
.library-header {
  text-align: center;
  padding: 2.5rem 0 2rem;
  border-bottom: 2px solid #2c5f7c;
  margin-bottom: 2rem;
}

.library-header .org-name {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #2c5f7c;
  margin-bottom: 0.25rem;
}

.library-header .org-name a {
  color: #2c5f7c;
  text-decoration: none;
}

.library-header .org-name a:hover {
  text-decoration: underline;
}

.library-header h1 {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.3;
  color: #1a1a1a;
  margin-bottom: 0.75rem;
}

.library-header .subtitle {
  font-size: 1rem;
  color: #555;
  max-width: 640px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ---- Nav Bar ---- */
.library-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 0.75rem 0;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid #d0dce4;
  flex-wrap: wrap;
}

.library-nav a {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: #2c5f7c;
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: color 0.2s;
}

.library-nav a:hover {
  color: #1a4a5c;
  text-decoration: underline;
}

.library-nav .sep {
  color: #d0dce4;
  user-select: none;
}

/* ---- Stats Bar ---- */
.stats-bar {
  display: flex;
  justify-content: center;
  gap: 2rem;
  padding: 1rem 0;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.stat {
  text-align: center;
}

.stat-number {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: #2c5f7c;
  display: block;
  line-height: 1.2;
}

.stat-label {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #888;
}

/* ---- Search ---- */
.search-container {
  max-width: 560px;
  margin: 0 auto 2.5rem;
  position: relative;
}

.search-container input {
  width: 100%;
  padding: 0.7rem 1rem 0.7rem 2.5rem;
  font-family: 'Georgia', serif;
  font-size: 0.95rem;
  border: 1px solid #d0dce4;
  border-radius: 6px;
  background: #fff;
  color: #1a1a1a;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-container input:focus {
  border-color: #2c5f7c;
  box-shadow: 0 0 0 3px rgba(44, 95, 124, 0.1);
}

.search-container input::placeholder {
  color: #aaa;
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: #999;
}

.search-count {
  text-align: center;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.78rem;
  color: #888;
  margin-top: 0.5rem;
  min-height: 1.2em;
}

/* ---- Category Section ---- */
.category {
  margin-bottom: 3rem;
}

.category-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid #d0dce4;
}

.category-header h2 {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: #2c5f7c;
  margin: 0;
}

.category-count {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: #fff;
  background: #2c5f7c;
  padding: 0.1rem 0.5rem;
  border-radius: 10px;
  white-space: nowrap;
}

.category-description {
  font-size: 0.9rem;
  color: #555;
  margin-bottom: 1rem;
  line-height: 1.6;
}

/* ---- Document List ---- */
.doc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.doc-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.75rem;
  border-radius: 4px;
  transition: background 0.15s;
}

.doc-item:hover {
  background: #eef3f7;
}

.doc-item:nth-child(even) {
  background: #f5f7f9;
}

.doc-item:nth-child(even):hover {
  background: #eef3f7;
}

.file-badge {
  display: inline-block;
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 2.2rem;
  text-align: center;
}

.file-badge.txt {
  background: #d4edda;
  color: #155724;
}

.file-badge.py {
  background: #cce5ff;
  color: #004085;
}

.file-badge.json {
  background: #fff3cd;
  color: #856404;
}

.file-badge.md {
  background: #e2e3e5;
  color: #383d41;
}

.file-badge.sh {
  background: #f8d7da;
  color: #721c24;
}

.doc-link {
  font-size: 0.88rem;
  color: #2c5f7c;
  text-decoration: none;
  line-height: 1.4;
  word-break: break-word;
}

.doc-link:hover {
  text-decoration: underline;
  color: #1a4a5c;
}

.doc-name-display {
  font-weight: 500;
}

/* ---- Category ID Letter ---- */
.category-letter {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  background: #3a7a96;
  width: 1.5rem;
  height: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  flex-shrink: 0;
}

/* ---- Footer ---- */
.library-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 2px solid #2c5f7c;
  text-align: center;
  font-size: 0.8rem;
  color: #666;
}

.library-footer .footer-logo {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  color: #2c5f7c;
  letter-spacing: 0.1em;
  margin-bottom: 0.25rem;
}

.library-footer p {
  text-align: center;
  margin-bottom: 0.25rem;
}

.library-footer a {
  color: #2c5f7c;
  text-decoration: none;
}

.library-footer a:hover {
  text-decoration: underline;
}

/* ---- Back to Top ---- */
.back-to-top {
  display: inline-block;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: #2c5f7c;
  text-decoration: none;
  margin-top: 1rem;
  padding: 0.4rem 1rem;
  border: 1px solid #d0dce4;
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
}

.back-to-top:hover {
  background: #2c5f7c;
  color: #fff;
  text-decoration: none;
}

/* ---- Hidden by Filter ---- */
.doc-item.hidden {
  display: none;
}

.category.hidden {
  display: none;
}

/* ---- TOC (jump links) ---- */
.toc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
  margin-bottom: 2.5rem;
}

.toc-card {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  background: #f0f4f7;
  border: 1px solid #d0dce4;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.toc-card:hover {
  background: #e4ecf1;
  border-color: #2c5f7c;
  text-decoration: none;
}

.toc-card-title {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: #2c5f7c;
  line-height: 1.3;
}

.toc-card-count {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.72rem;
  color: #888;
  margin-top: 0.15rem;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  html {
    font-size: 15px;
  }

  .library-container {
    padding: 0 1rem 3rem;
  }

  .library-header h1 {
    font-size: 1.5rem;
  }

  .stats-bar {
    gap: 1rem;
  }

  .stat-number {
    font-size: 1.4rem;
  }

  .library-nav {
    gap: 0.75rem;
  }

  .library-nav a {
    font-size: 0.75rem;
  }

  .toc-grid {
    grid-template-columns: 1fr;
  }

  .category-header h2 {
    font-size: 1.15rem;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 14px;
  }

  .library-header h1 {
    font-size: 1.3rem;
  }

  .library-container {
    padding: 0 0.75rem 2rem;
  }

  .doc-item {
    padding: 0.4rem 0.5rem;
  }
}
