/* JS Libraries Hub - CSS Styles */

:root {
  --bg: #060610;
  --surface: #0b0b18;
  --surface-2: #10101e;
  --surface-3: #181830;
  --border: rgba(255,255,255,0.055);
  --border-hover: rgba(255,255,255,0.12);
  --text-primary: #ededf4;
  --text-secondary: #9a9ab5;
  --muted: #55556e;
  --accent: #7df8a3;
  --accent-dim: rgba(125,248,163,0.08);
  --accent-mid: rgba(125,248,163,0.15);
  --red: #f87171;
  --yellow: #fbbf24;
  --blue: #60a5fa;
  --green: #34d399;
  --code-bg: #08080f;
  --display: 'Instrument Serif', Georgia, serif;
  --sans: 'DM Sans', system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text-secondary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Noise Texture Overlay */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 9999;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* Top Glow */
.top-glow {
  position: absolute; top: -200px; left: 50%; transform: translateX(-50%);
  width: 700px; height: 500px;
  background: radial-gradient(ellipse, rgba(125,248,163,0.06) 0%, transparent 70%);
  pointer-events: none; z-index: 0;
}

/* Navigation */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  background: rgba(6,6,16,0.8);
  backdrop-filter: blur(20px);
  position: sticky; top: 0; z-index: 100;
}
.nav-left { display: flex; align-items: center; gap: 1.25rem; }
.nav-logo {
  font-size: 0.95rem; font-weight: 700; color: var(--text-primary);
  text-decoration: none;
}
.nav-logo span { color: var(--accent); }
.nav-sep { color: var(--border); font-size: 1.2rem; }
.nav-links { display: flex; gap: 1rem; }
.nav-links a {
  font-size: 0.75rem; color: var(--muted); text-decoration: none;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--text-secondary); }
.nav-home-link {
  font-size: 0.75rem; color: var(--muted); text-decoration: none;
  transition: color 0.2s;
}
.nav-home-link:hover { color: var(--accent); }

/* Layout */
.page-container { max-width: 52rem; margin: 0 auto; padding: 2.5rem 2rem 6rem; position: relative; }

/* Breadcrumb */
.breadcrumb { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; }
.breadcrumb a { color: var(--accent); text-decoration: none; opacity: 0.7; }
.breadcrumb a:hover { opacity: 1; }
.breadcrumb .sep { color: var(--muted); opacity: 0.3; }
.breadcrumb .current { color: var(--text-secondary); }

/* Hero */
.hero { margin-top: 1.5rem; }
.hero-title-row { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.35rem; }
.hero h1 {
  font-family: var(--display); font-size: 3.5rem; font-weight: 400;
  color: var(--text-primary); line-height: 1;
  font-style: italic;
  letter-spacing: -0.02em;
}
.hero-version {
  font-size: 0.65rem; font-family: var(--mono); font-weight: 600;
  color: var(--accent); background: var(--accent-dim);
  padding: 0.2rem 0.5rem; border-radius: 4px;
  align-self: flex-end; margin-bottom: 0.4rem;
}
.hero-tagline { font-size: 1rem; color: var(--text-secondary); }

/* Stats Bar */
.stats-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.75rem; }
.stat-chip {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.35rem 0.75rem; border-radius: 100px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 0.72rem;
  transition: border-color 0.2s;
  text-decoration: none;
  color: inherit;
}
.stat-chip:hover { border-color: var(--border-hover); }
.stat-label {
  color: var(--muted); font-size: 0.6rem; text-transform: uppercase;
  letter-spacing: 0.08em; font-family: var(--mono);
}
.stat-value { color: var(--text-primary); font-weight: 600; }

/* Divider */
.divider {
  border: none; border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* Section Heading */
.section-heading { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.75rem; }
.section-badge {
  font-size: 0.65rem; font-weight: 700; font-family: var(--mono);
  color: var(--accent); background: var(--accent-dim);
  padding: 0.25rem 0.5rem; border-radius: 5px;
  letter-spacing: 0.06em;
}
.section-heading h2 {
  font-family: var(--display); font-size: 1.6rem; font-weight: 400;
  color: var(--text-primary); font-style: italic;
}

/* Definition Block */
.definition-callout {
  padding: 1.5rem;
  border-radius: 1rem;
  background: linear-gradient(135deg, rgba(125,248,163,0.04), rgba(125,248,163,0.01));
  border: 1px solid rgba(125,248,163,0.1);
  margin-bottom: 1.25rem;
}
.definition-callout p {
  font-size: 0.92rem; line-height: 1.7; color: var(--text-primary);
}

/* Feature Grid */
.feature-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem;
  margin-top: 1.75rem;
}
.feature-card {
  padding: 1.25rem; border-radius: 0.875rem;
  background: var(--surface-2); border: 1px solid var(--border);
  transition: border-color 0.25s, transform 0.25s;
}
.feature-card:hover { border-color: var(--border-hover); transform: translateY(-2px); }
.feature-icon { font-size: 1.5rem; margin-bottom: 0.6rem; display: block; }
.feature-title { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); margin-bottom: 0.3rem; }
.feature-desc { font-size: 0.75rem; color: var(--muted); line-height: 1.6; }

/* Playground */
.example-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.example-tab {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.85rem; border-radius: 0.5rem;
  font-size: 0.75rem; font-family: var(--sans);
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--muted); cursor: pointer;
  transition: all 0.2s;
}
.example-tab.active {
  background: var(--accent-dim); border-color: var(--accent);
  color: var(--accent);
}
.example-tab .dot {
  width: 0.5rem; height: 0.5rem; border-radius: 50%;
  display: inline-block;
}
.example-desc { font-size: 0.85rem; color: var(--muted); margin-bottom: 1.25rem; }

.playground {
  border-radius: 1rem; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--border);
}
.playground-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
}
.window-dots { display: flex; gap: 0.4rem; }
.window-dots span {
  width: 0.6rem; height: 0.6rem; border-radius: 50%;
}
.playground-label {
  font-size: 0.7rem; font-family: var(--mono); color: var(--muted);
}
.btn-run {
  display: flex; align-items: center; gap: 0.35rem;
  padding: 0.3rem 0.75rem; border-radius: 0.375rem;
  font-size: 0.72rem; font-weight: 600; font-family: var(--sans);
  background: var(--accent); color: #060610;
  border: none; cursor: pointer;
  transition: opacity 0.2s;
}
.btn-run:hover { opacity: 0.85; }

.preview-frame {
  width: 100%; height: 450px; border: none; display: block;
  background: #0a0a14;
}

.code-tabs {
  display: flex; gap: 0; padding: 0.5rem 0.6rem 0;
  border-bottom: 1px solid var(--border);
  border-top: 1px solid var(--border);
}
.code-tab {
  padding: 0.5rem 0.75rem; font-size: 0.72rem;
  font-family: var(--mono); color: var(--muted);
  background: transparent; border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer; margin-bottom: -1px;
  transition: color 0.2s;
}
.code-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.code-display {
  min-height: 200px; max-height: 280px; overflow: hidden;
  position: relative;
}
.editor-container {
  width: 100%; height: 200px;
}

.playground-actions {
  display: flex; gap: 0.5rem; padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
}
.btn-action {
  padding: 0.4rem 0.75rem; border-radius: 0.375rem;
  font-size: 0.72rem; font-family: var(--sans);
  background: var(--surface-3); color: var(--text-secondary);
  border: 1px solid var(--border); cursor: pointer;
  transition: border-color 0.2s;
}
.btn-action:hover { border-color: var(--border-hover); }

/* When to Use */
.usage-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; }
.usage-heading {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.12em; margin-bottom: 1rem;
}
.usage-heading.use { color: var(--green); }
.usage-heading.avoid { color: var(--red); }

.usage-list { display: flex; flex-direction: column; gap: 0.65rem; }
.usage-item { display: flex; align-items: flex-start; gap: 0.65rem; font-size: 0.85rem; }
.usage-icon {
  flex-shrink: 0; width: 1.25rem; height: 1.25rem;
  border-radius: 0.35rem; display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 700; margin-top: 0.15rem;
}
.usage-icon.use {
  background: rgba(52,211,153,0.1); color: var(--green);
  border: 1px solid rgba(52,211,153,0.2);
}
.usage-icon.avoid {
  background: rgba(248,113,113,0.1); color: var(--red);
  border: 1px solid rgba(248,113,113,0.2);
}

/* Comparison Cards */
.compare-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0.75rem; }
.compare-card {
  padding: 1.25rem; border-radius: 0.875rem;
  background: var(--surface-2); border: 1px solid var(--border);
  transition: border-color 0.25s;
}
.compare-card:hover { border-color: var(--border-hover); }
.compare-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.75rem;
}
.compare-title { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }
.compare-title .vs { color: var(--muted); font-weight: 400; margin: 0 0.25rem; }
.compare-verdict { font-size: 0.78rem; color: var(--muted); line-height: 1.6; margin-bottom: 0.85rem; }
.compare-chips { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.compare-chip {
  padding: 0.5rem 0.6rem; border-radius: 0.5rem;
}
.compare-chip.primary {
  background: rgba(52,211,153,0.06); border: 1px solid rgba(52,211,153,0.12);
}
.compare-chip.other {
  background: rgba(96,165,250,0.06); border: 1px solid rgba(96,165,250,0.12);
}
.compare-chip-label {
  font-size: 0.62rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; margin-bottom: 0.25rem;
}
.compare-chip.primary .compare-chip-label { color: var(--green); }
.compare-chip.other .compare-chip-label { color: var(--blue); }
.compare-chip-text { font-size: 0.72rem; color: var(--text-secondary); line-height: 1.4; }
.compare-full-link {
  display: block; margin-top: 0.85rem; padding-top: 0.75rem;
  border-top: 1px solid var(--border); text-align: center;
  font-size: 0.72rem; font-weight: 600; color: var(--accent);
  text-decoration: none; transition: color 0.2s;
}
.compare-full-link:hover { color: var(--text-primary); }

/* Install Section */
.install-tabs { display: flex; gap: 0.25rem; margin-bottom: 0.85rem; }
.install-tab {
  padding: 0.4rem 0.75rem; border-radius: 0.375rem;
  font-size: 0.72rem; font-family: var(--mono);
  background: var(--surface-3); color: var(--muted);
  border: none; cursor: pointer;
  transition: all 0.2s;
}
.install-tab.active { background: var(--accent-dim); color: var(--accent); }

.code-block {
  border-radius: 0.6rem; overflow: hidden;
  background: var(--code-bg); border: 1px solid var(--border);
  margin-bottom: 1rem;
}
.code-block-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.5rem 0.85rem; border-bottom: 1px solid var(--border);
}
.code-block-lang { font-size: 0.7rem; font-family: var(--mono); color: var(--muted); }
.btn-copy {
  font-size: 0.7rem; font-family: var(--sans);
  color: var(--accent); background: transparent;
  border: 1px solid var(--border); border-radius: 4px;
  padding: 0.15rem 0.5rem; cursor: pointer;
  transition: border-color 0.2s;
}
.btn-copy:hover { border-color: var(--accent); }
.code-block pre {
  padding: 0.85rem; margin: 0; overflow-x: auto;
  font-family: var(--mono); font-size: 0.78rem; line-height: 1.7;
  color: var(--text-secondary);
}

.quick-start-section { margin-top: 1.5rem; }
.quick-start-title {
  font-size: 0.85rem; font-weight: 600; color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.external-links { display: flex; gap: 0.65rem; margin-top: 1.25rem; flex-wrap: wrap; }
.ext-link {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 0.85rem; border-radius: 0.5rem;
  font-size: 0.78rem; text-decoration: none;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: border-color 0.2s;
}
.ext-link:hover { border-color: var(--border-hover); }
.ext-link .arrow { font-size: 0.6rem; color: var(--muted); }

/* Related Libraries */
.related-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem;
}
.related-card {
  padding: 1rem; border-radius: 0.75rem;
  background: var(--surface-2); border: 1px solid var(--border);
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s;
}
.related-card:hover { border-color: var(--border-hover); transform: translateY(-2px); }
.related-name { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); margin-bottom: 0.25rem; }
.related-tagline { font-size: 0.72rem; color: var(--muted); line-height: 1.4; }

/* Hub Page Styles */
.hub-hero {
  text-align: center;
  padding: 3rem 0 2rem;
}
.hub-title {
  font-family: var(--display);
  font-size: 3rem;
  font-weight: 400;
  font-style: italic;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}
.hub-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 32rem;
  margin: 0 auto;
}

/* Category Navigation */
.category-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin: 2rem 0;
  padding-top: 1rem;
}
.category-pill {
  padding: 0.5rem 1rem;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all 0.2s;
}
.category-pill:hover {
  border-color: var(--border-hover);
}
.category-pill.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* Section Title */
.section-title {
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 400;
  font-style: italic;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
}

/* Library Grid */
.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

/* Library Card */
.library-card {
  display: block;
  padding: 1.25rem;
  border-radius: 0.875rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: all 0.25s;
}
.library-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}
.library-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.library-card-logo {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.5rem;
  object-fit: contain;
}
.library-card-logo-placeholder {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.5rem;
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
}
.library-card-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}
.library-card-tagline {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 0.75rem;
}
.library-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.library-card-category {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: var(--accent-dim);
  color: var(--accent);
}
.library-card-stars {
  font-size: 0.72rem;
  color: var(--yellow);
}

/* Category Colors */
.category-pink { --cat-color: #e8879f; }
.category-teal { --cat-color: #4db8a8; }
.category-purple { --cat-color: #9b7cc4; }
.category-yellow { --cat-color: #f5d76e; }
.category-coral { --cat-color: #e8a07a; }

.library-card-category.category-pink { background: rgba(232,135,159,0.1); color: #e8879f; }
.library-card-category.category-teal { background: rgba(77,184,168,0.1); color: #4db8a8; }
.library-card-category.category-purple { background: rgba(155,124,196,0.1); color: #9b7cc4; }
.library-card-category.category-yellow { background: rgba(245,215,110,0.1); color: #f5d76e; }
.library-card-category.category-coral { background: rgba(232,160,122,0.1); color: #e8a07a; }

/* Featured Section */
.featured-section {
  margin-bottom: 3rem;
}

/* All Libraries Section */
.all-libraries-section {
  margin-bottom: 3rem;
}

/* Categories Section */
.categories-section {
  margin-bottom: 3rem;
}
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.category-card {
  display: block;
  padding: 1.25rem;
  border-radius: 0.875rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: all 0.25s;
}
.category-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}
.category-icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  display: block;
}
.category-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}
.category-desc {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 0.5rem;
}
.category-count {
  font-size: 0.65rem;
  color: var(--accent);
  font-family: var(--mono);
}

/* Category Hero */
.category-hero {
  text-align: center;
  padding: 2rem 0;
}
.category-hero-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  display: block;
}
.category-hero-title {
  font-family: var(--display);
  font-size: 2.5rem;
  font-weight: 400;
  font-style: italic;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}
.category-hero-desc {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 32rem;
  margin: 0 auto;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--muted);
}

/* Footer */
.hub-footer {
  text-align: center;
  padding: 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
}
.hub-footer a {
  color: var(--accent);
  text-decoration: none;
}
.hub-footer a:hover {
  text-decoration: underline;
}

/* Animations */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-in {
  animation: fadeUp 0.6s ease-out both;
}
.hero { animation-delay: 0.05s; }
section:nth-of-type(1) { animation-delay: 0.1s; }
section:nth-of-type(2) { animation-delay: 0.15s; }

/* Responsive */
@media (max-width: 768px) {
  .hero h1 { font-size: 2.5rem; }
  .hub-title { font-size: 2.5rem; }
  .feature-grid { grid-template-columns: 1fr; }
  .usage-grid { grid-template-columns: 1fr; gap: 2rem; }
  .compare-grid { grid-template-columns: 1fr; }
  .related-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .page-container { padding: 1.5rem 1.25rem 4rem; }
}

/* No examples message */
.no-examples {
  text-align: center;
  padding: 2rem;
  color: var(--muted);
  font-style: italic;
}

/* Section intro (one-liner above demos) */
.section-intro {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

/* Comparison intro */
.comparison-intro {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

/* ========================================
   SPLIT LAYOUT STYLES
   ======================================== */

/* Sidebar */
.hub-sidebar {
  background: var(--surface);
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}

.hub-sidebar::-webkit-scrollbar {
  width: 6px;
}

.hub-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.hub-sidebar::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: 3px;
}

.hub-sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* Main Content Area */
.main-content {
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

.content-area {
  position: relative;
  min-height: 100vh;
  padding: 0 2rem; /* Horizontal padding for content spacing */
}

@media (max-width: 1023px) {
  .content-area {
    padding-top: 3.5rem; /* Space for mobile header */
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
}

/* Library Content Wrapper */
.library-content-wrapper {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(6, 6, 16, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

@media (min-width: 1024px) {
  .loading-overlay {
    left: 18rem; /* Sidebar width */
  }
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--surface-3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========================================
   WELCOME LANDING PAGE
   ======================================== */

.welcome-landing {
  padding: 2rem 1.5rem 4rem;
  max-width: 56rem;
  margin: 0 auto;
}

/* Hero */
.wl-hero {
  text-align: center;
  padding: 3rem 0 2rem;
  animation: fadeDown 0.5s ease-out both;
}

.wl-hero-title {
  font-family: var(--display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 400;
  font-style: italic;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.wl-hero-accent {
  color: var(--accent);
}

.wl-hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 32rem;
  margin: 0 auto 1.75rem;
  line-height: 1.6;
  animation: fadeDown 0.5s ease-out 0.05s both;
}

/* Stats */
.wl-stats {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  animation: fadeDown 0.5s ease-out 0.1s both;
}

.wl-stat-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem 1.5rem;
  border-radius: 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.wl-stat-value {
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.wl-stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-family: var(--mono);
  margin-top: 0.15rem;
}

/* Sections */
.wl-section {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.wl-section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  animation: fadeDown 0.5s ease-out 0.12s both;
}

.wl-section-badge {
  font-size: 0.6rem;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--accent);
  background: var(--accent-dim);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  letter-spacing: 0.06em;
}

.wl-badge-featured {
  color: var(--yellow);
  background: rgba(251, 191, 36, 0.1);
}

.wl-section-title {
  font-family: var(--display);
  font-size: 1.4rem;
  font-weight: 400;
  font-style: italic;
  color: var(--text-primary);
}

/* Categories Grid */
.wl-categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}

.wl-category-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 1.25rem;
  border-radius: 0.875rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: left;
  animation: fadeUp 0.4s ease-out both;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  width: 100%;
}

.wl-category-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.wl-category-card:nth-child(1) { animation-delay: 0.15s; }
.wl-category-card:nth-child(2) { animation-delay: 0.18s; }
.wl-category-card:nth-child(3) { animation-delay: 0.21s; }
.wl-category-card:nth-child(4) { animation-delay: 0.24s; }
.wl-category-card:nth-child(5) { animation-delay: 0.27s; }
.wl-category-card:nth-child(6) { animation-delay: 0.30s; }

.wl-category-icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.wl-category-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.wl-category-count {
  font-size: 0.65rem;
  color: var(--accent);
  font-family: var(--mono);
}

/* Library Grid */
.wl-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
}

.wl-library-card {
  display: block;
  padding: 1.25rem;
  border-radius: 0.875rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: all 0.25s ease;
  cursor: pointer;
  animation: fadeUp 0.4s ease-out both;
  color: inherit;
}

.wl-library-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.wl-library-card:nth-child(1) { animation-delay: 0s; }
.wl-library-card:nth-child(2) { animation-delay: 0.03s; }
.wl-library-card:nth-child(3) { animation-delay: 0.06s; }
.wl-library-card:nth-child(4) { animation-delay: 0.09s; }
.wl-library-card:nth-child(5) { animation-delay: 0.12s; }
.wl-library-card:nth-child(6) { animation-delay: 0.15s; }

.wl-library-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.wl-library-logo {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.5rem;
  object-fit: contain;
  flex-shrink: 0;
}

.wl-library-logo-sm {
  width: 1.75rem;
  height: 1.75rem;
}

.wl-library-logo-placeholder {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.5rem;
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  flex-shrink: 0;
}

.wl-library-logo-placeholder.wl-library-logo-sm {
  width: 1.75rem;
  height: 1.75rem;
  font-size: 0.7rem;
}

.wl-library-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.wl-library-tagline {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.wl-library-category {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  background: var(--accent-dim);
  color: var(--accent);
  margin-top: 0.15rem;
}

/* Category color variants for library badges */
.wl-library-category.category-pink { color: #e8879f; background: rgba(232,135,159,0.1); }
.wl-library-category.category-teal { color: #4db8a8; background: rgba(77,184,168,0.1); }
.wl-library-category.category-purple { color: #9b7cc4; background: rgba(155,124,196,0.1); }
.wl-library-category.category-yellow { color: #f5d76e; background: rgba(245,215,110,0.1); }
.wl-library-category.category-coral { color: #e8a07a; background: rgba(232,160,122,0.1); }

.wl-library-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.wl-library-stars {
  font-size: 0.7rem;
  color: var(--yellow);
  font-family: var(--mono);
}

/* Compact variant for "All Libraries" */
.wl-library-card-compact {
  padding: 1rem;
}

.wl-library-grid-compact {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .wl-hero,
  .wl-hero-subtitle,
  .wl-stats,
  .wl-section-header,
  .wl-category-card,
  .wl-library-card {
    animation: none !important;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .welcome-landing {
    padding: 1rem 1rem 3rem;
  }

  .wl-hero {
    padding: 2rem 0 1.5rem;
  }

  .wl-hero-title {
    font-size: 2rem;
  }

  .wl-stats {
    gap: 0.5rem;
  }

  .wl-stat-chip {
    padding: 0.5rem 1rem;
  }

  .wl-stat-value {
    font-size: 1.25rem;
  }

  .wl-categories-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .wl-library-grid {
    grid-template-columns: 1fr;
  }

  .wl-library-grid-compact {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Alpine.js x-collapse animation */
[x-collapse] {
  overflow: hidden;
}

[x-collapse].x-collapse-enter-active,
[x-collapse].x-collapse-leave-active {
  transition: height 0.2s ease;
}

/* Sidebar responsive adjustments */
@media (max-width: 1023px) {
  .hub-sidebar {
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
  }
}

/* Adjust page container for split layout */
.main-content .page-container {
  max-width: 56rem;
  margin: 0 auto;
  padding: 2rem 0 4rem; /* Vertical padding only, content-area handles horizontal */
}

@media (max-width: 768px) {
  .main-content .page-container {
    padding: 1.5rem 0 4rem;
  }
}
