/* ===== LIBS PAGE ===== */
.libs-hero {
  padding: 10rem 0 4rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.libs-hero__label {
  font-family: var(--font-mono); font-size: 0.75rem; color: var(--accent);
  letter-spacing: 0.2em; text-transform: uppercase; display: block; margin-bottom: 1rem;
}
.libs-hero__title {
  font-size: clamp(2.5rem, 6vw, 4.5rem); font-weight: 700;
  line-height: 1.1; margin-bottom: 1rem;
}
.libs-hero__title .accent { color: var(--accent); }
.libs-hero__sub {
  font-size: 1.05rem; color: var(--text-2); max-width: 600px;
  margin: 0 auto; line-height: 1.6; position: relative; z-index: 1;
}

.libs-section { padding: 2rem 0 6rem; }

/* ===== LIB CARD ===== */
.lib-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 2rem; margin-bottom: 2rem;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.lib-card:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 40px rgba(108,99,255,0.08);
}

.lib-card__header {
  display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap;
}
.lib-card__icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #00f5d4);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 700; font-size: 0.8rem;
  color: #fff; flex-shrink: 0;
}
.lib-card__name {
  font-size: 1.4rem; font-weight: 700; color: var(--text); margin: 0;
}
.lib-card__version {
  font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-3);
  background: rgba(108,99,255,0.1); padding: 0.2rem 0.5rem;
  border-radius: 6px; border: 1px solid var(--border);
}
.lib-card__type {
  font-family: var(--font-mono); font-size: 0.7rem; color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.1em;
}
.lib-card__link {
  margin-left: auto; font-family: var(--font-mono); font-size: 0.8rem;
  color: var(--accent); text-decoration: none;
  border: 1px solid var(--accent); padding: 0.3rem 0.8rem;
  border-radius: 6px; transition: all 0.2s;
}
.lib-card__link:hover {
  background: var(--accent); color: #fff;
}

.lib-card__desc {
  font-size: 0.95rem; color: var(--text-2); line-height: 1.6; margin-bottom: 1rem;
}
.lib-card__desc code {
  font-family: var(--font-mono); font-size: 0.85rem;
  background: rgba(108,99,255,0.1); padding: 0.1rem 0.35rem;
  border-radius: 4px; color: var(--accent);
}

.lib-card__tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.5rem; }
.lib-tag {
  font-family: var(--font-mono); font-size: 0.65rem;
  padding: 0.2rem 0.6rem; background: rgba(0,245,212,0.08);
  color: #00f5d4; border-radius: 20px; border: 1px solid rgba(0,245,212,0.15);
}

/* ===== CODE EXAMPLES ===== */
.lib-example {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden;
}
.lib-example__tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--border);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.lib-tab {
  padding: 0.65rem 1.2rem; background: none; border: none;
  font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-3);
  cursor: pointer; transition: all 0.2s; white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.lib-tab:hover { color: var(--text-2); background: rgba(108,99,255,0.03); }
.lib-tab.active {
  color: var(--accent); border-bottom-color: var(--accent);
  background: rgba(108,99,255,0.05);
}

.lib-example__split {
  display: grid; grid-template-columns: 1fr 1fr; min-height: 0;
}
.lib-example__desc {
  padding: 1.5rem; border-right: 1px solid var(--border);
}
.lib-example__desc h4 {
  font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 0.5rem;
}
.lib-example__desc p {
  font-size: 0.85rem; color: var(--text-2); line-height: 1.6;
}
.lib-example__desc code {
  font-family: var(--font-mono); font-size: 0.8rem;
  background: rgba(108,99,255,0.1); padding: 0.1rem 0.3rem;
  border-radius: 3px; color: var(--accent);
}

.lib-example__code {
  padding: 0; overflow: hidden;
}
.code-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.5rem 1rem; background: rgba(0,0,0,0.3);
  border-bottom: 1px solid var(--border);
}
.code-lang {
  font-family: var(--font-mono); font-size: 0.65rem; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.1em;
}
.copy-btn {
  font-family: var(--font-mono); font-size: 0.65rem; color: var(--accent);
  background: rgba(108,99,255,0.1); border: 1px solid rgba(108,99,255,0.2);
  padding: 0.2rem 0.6rem; border-radius: 4px; cursor: pointer;
  transition: all 0.2s;
}
.copy-btn:hover { background: var(--accent); color: #fff; }
.copy-btn.copied { background: #00f5d4; color: #000; border-color: #00f5d4; }

.lib-example__code pre {
  margin: 0; padding: 1.25rem; overflow-x: auto;
  font-family: var(--font-mono); font-size: 0.78rem; line-height: 1.7;
  color: var(--text-2); background: transparent;
  -webkit-overflow-scrolling: touch;
}

/* Syntax highlighting */
.lib-example__code .kw { color: #c792ea; }
.lib-example__code .fn { color: #82aaff; }
.lib-example__code .str { color: #c3e88d; }
.lib-example__code .num { color: #f78c6c; }
.lib-example__code .cmt { color: #546e7a; font-style: italic; }
.lib-example__code .prop { color: #ffcb6b; }

/* ===== LIVE PREVIEW PANELS ===== */
.lib-preview {
  margin-top: 1rem; border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; background: var(--bg2);
}
.lib-preview__header {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 1rem;
  background: rgba(0,0,0,0.4); border-bottom: 1px solid var(--border);
}
.lib-preview__dot {
  width: 8px; height: 8px; border-radius: 50%;
}
.lib-preview__dot:nth-child(1) { background: #ff5f57; }
.lib-preview__dot:nth-child(2) { background: #ffbd2e; }
.lib-preview__dot:nth-child(3) { background: #28c840; }
.lib-preview__title {
  font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-3);
  margin-left: 0.5rem; text-transform: uppercase; letter-spacing: 0.1em;
}
.lib-preview__restart {
  margin-left: auto; font-family: var(--font-mono); font-size: 0.6rem;
  color: var(--accent); background: rgba(108,99,255,0.15); border: 1px solid rgba(108,99,255,0.3);
  padding: 0.15rem 0.5rem; border-radius: 4px; cursor: pointer; transition: all 0.2s;
}
.lib-preview__restart:hover { background: var(--accent); color: #fff; }
.lib-preview__body {
  padding: 1rem; min-height: 200px; display: flex; align-items: center; justify-content: center;
}

/* Three.js Canvas */
#threejs-canvas { width: 100%; height: 300px; border-radius: 8px; background: #0a0a0f; }

/* GSAP Demo */
.gsap-demo { display: flex; gap: 0.8rem; align-items: center; flex-wrap: wrap; justify-content: center; width: 100%; }
.gsap-box {
  padding: 0.8rem 1.2rem; border-radius: 8px; font-family: var(--font-mono); font-size: 0.75rem;
  background: var(--surface); border: 1px solid var(--accent); color: var(--accent);
  cursor: pointer; transition: box-shadow 0.2s;
}
.gsap-box:hover { box-shadow: 0 0 15px rgba(108,99,255,0.3); }
.gsap-magnetic-btn {
  padding: 0.6rem 1.5rem; border-radius: 8px; font-family: var(--font-mono); font-size: 0.75rem;
  background: var(--accent); color: #fff; border: none; cursor: pointer; font-weight: 600;
}

/* Lenis Demo */
.lenis-demo {
  width: 100%; max-height: 200px; overflow-y: auto; scrollbar-width: thin;
  scrollbar-color: var(--accent) var(--bg2); border-radius: 8px;
}
.lenis-demo__item {
  padding: 1.5rem; font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-2);
  border-bottom: 1px solid var(--border); text-align: center;
}

/* Terminal */
.terminal {
  width: 100%; background: #0d1117; border-radius: 8px; padding: 1rem; font-family: var(--font-mono);
  font-size: 0.75rem; overflow-y: auto; max-height: 220px;
}
.terminal__line { margin-bottom: 0.3rem; line-height: 1.5; }
.terminal__prompt { color: #00f5d4; margin-right: 0.5rem; }
.terminal__output { color: #c9d1d9; padding-left: 1rem; }
.terminal__cursor {
  display: inline-block; width: 7px; height: 14px; background: #c9d1d9;
  animation: blink 1s step-end infinite; vertical-align: text-bottom;
}
@keyframes blink { 50% { opacity: 0; } }

/* Vanilla JS Demo */
.vanilla-demo { width: 100%; }
.vanilla-search {
  width: 100%; padding: 0.7rem 1rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-family: var(--font-mono); font-size: 0.8rem;
  outline: none; transition: border-color 0.2s; margin-bottom: 0.8rem; box-sizing: border-box;
}
.vanilla-search:focus { border-color: var(--accent); }
.vanilla-output {
  padding: 0.5rem 1rem; font-family: var(--font-mono); font-size: 0.7rem;
  color: var(--text-3); margin-bottom: 0.8rem; min-height: 1.2rem;
}
.vanilla-cards { display: flex; gap: 0.5rem; }
.vanilla-card {
  flex: 1; padding: 1rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-2);
  text-align: center; opacity: 0; transform: translateY(20px); transition: all 0.5s ease;
}
.vanilla-card.visible { opacity: 1; transform: translateY(0); }

/* CSS Demo */
.css-demo { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; width: 100%; }
.css-textarea {
  width: 100%; height: 180px; background: #0d1117; border: 1px solid var(--border);
  border-radius: 8px; padding: 0.8rem; font-family: var(--font-mono); font-size: 0.75rem;
  color: #c9d1d9; resize: vertical; outline: none; transition: border-color 0.2s; box-sizing: border-box;
}
.css-textarea:focus { border-color: var(--accent); }
.css-demo__preview { display: flex; flex-direction: column; gap: 0.8rem; align-items: center; justify-content: center; }
.css-preview-box {
  padding: 1.5rem 2rem; border-radius: 12px; font-family: var(--font-mono); font-weight: 600;
  background: #12121a; color: #e8e8f0; border: 2px solid var(--accent);
  text-align: center; transition: all 0.3s;
}
.css-preview-text { font-family: var(--font-body); font-size: 1rem; color: var(--text); }

/* Fonts Demo */
.fonts-demo { width: 100%; }
.fonts-input {
  width: 100%; padding: 0.7rem 1rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-family: var(--font-body); font-size: 1rem;
  outline: none; transition: border-color 0.2s; margin-bottom: 1rem; box-sizing: border-box;
}
.fonts-input:focus { border-color: var(--accent); }
.fonts-preview { display: flex; flex-direction: column; gap: 0.5rem; }
.fonts-sample { padding: 0.5rem 0; border-bottom: 1px solid var(--border); color: var(--text); }

/* SQLite Demo */
.sqlite-demo { width: 100%; }
.sqlite-toolbar { display: flex; gap: 0.5rem; margin-bottom: 0.8rem; }
.sqlite-table-select {
  flex: 1; padding: 0.5rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-family: var(--font-mono); font-size: 0.75rem; outline: none;
}
.sqlite-run-btn {
  padding: 0.5rem 1rem; background: var(--accent); color: #fff; border: none;
  border-radius: 6px; font-family: var(--font-mono); font-size: 0.75rem; cursor: pointer; font-weight: 600;
}
.sqlite-run-btn:hover { opacity: 0.9; }
.sqlite-result { overflow-x: auto; }
.sqlite-table {
  width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: 0.7rem;
}
.sqlite-table th {
  background: rgba(0,0,0,0.3); padding: 0.5rem 0.8rem; text-align: left;
  border-bottom: 1px solid var(--border); color: var(--accent); font-weight: 600;
}
.sqlite-table td {
  padding: 0.4rem 0.8rem; border-bottom: 1px solid var(--border); color: var(--text-2);
}

/* GitHub API Demo */
.github-demo { width: 100%; }
.github-fetch-btn {
  width: 100%; padding: 0.7rem; background: var(--accent); color: #fff; border: none;
  border-radius: 8px; font-family: var(--font-mono); font-size: 0.8rem; cursor: pointer;
  font-weight: 600; margin-bottom: 0.8rem; transition: opacity 0.2s;
}
.github-fetch-btn:hover { opacity: 0.9; }
.github-fetch-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.github-output {
  padding: 0.5rem 1rem; font-family: var(--font-mono); font-size: 0.7rem;
  color: var(--text-3); background: rgba(0,0,0,0.3); border-radius: 8px;
  max-height: 120px; overflow-y: auto; min-height: 3rem;
}
.github-stats { display: flex; gap: 1rem; margin-top: 0.5rem; }
.github-stat {
  font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-3);
}
.github-stat strong { color: var(--accent); }

/* ===== CODE PLAYGROUND ===== */
.libs-playground {
  padding: 6rem 0 8rem; text-align: center; position: relative;
}
.libs-playground .libs-hero__label { margin-bottom: 0.5rem; }
.playground-container {
  max-width: 1100px; margin: 0 auto; border-radius: 16px; overflow: hidden;
  background: #0a0a0f; border: 1px solid rgba(108,99,255,0.15);
  box-shadow: 0 12px 48px rgba(0,0,0,0.4);
}
.playground-tabs {
  display: flex; gap: 0; background: rgba(108,99,255,0.05);
  border-bottom: 1px solid rgba(108,99,255,0.12); padding: 0 12px;
}
.pg-tab {
  font-family: 'JetBrains Mono', monospace; font-size: 12px; padding: 12px 18px;
  background: none; border: none; color: #666; cursor: pointer;
  border-bottom: 2px solid transparent; transition: all 0.2s;
}
.pg-tab:hover { color: #aaa; }
.pg-tab.active { color: #6c63ff; border-bottom-color: #6c63ff; }
.playground-split {
  display: grid; grid-template-columns: 1fr 1fr; min-height: 420px;
}
.playground-editor, .playground-preview {
  display: flex; flex-direction: column;
}
.playground-editor { border-right: 1px solid rgba(108,99,255,0.12); }
.pe-header {
  display: flex; align-items: center; gap: 6px; padding: 10px 14px;
  background: rgba(108,99,255,0.06); border-bottom: 1px solid rgba(108,99,255,0.08);
}
.pe-dot { width: 8px; height: 8px; border-radius: 50%; }
.pe-dot:nth-child(1) { background: #ff5f57; }
.pe-dot:nth-child(2) { background: #ffbd2e; }
.pe-dot:nth-child(3) { background: #28c840; }
.pe-title { flex: 1; font-family: 'JetBrains Mono', monospace; font-size: 11px; color: #555; margin-left: 6px; }
.pe-run {
  font-family: 'JetBrains Mono', monospace; font-size: 11px; padding: 5px 14px;
  background: linear-gradient(135deg, #00c853, #00e676); color: #000;
  border: none; border-radius: 6px; cursor: pointer; font-weight: 600; transition: all 0.2s;
}
.pe-run:hover { box-shadow: 0 4px 12px rgba(0,200,83,0.4); transform: translateY(-1px); }
#pgEditor {
  flex: 1; width: 100%; min-height: 360px; padding: 16px; background: #0a0a0f;
  border: none; outline: none; resize: none; font-family: 'JetBrains Mono', monospace;
  font-size: 13px; line-height: 1.6; color: #c8c8d0; tab-size: 2;
  overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(108,99,255,0.3) transparent;
}
#pgEditor::-webkit-scrollbar { width: 5px; }
#pgEditor::-webkit-scrollbar-thumb { background: rgba(108,99,255,0.3); border-radius: 10px; }
#pgFrame {
  flex: 1; width: 100%; min-height: 360px; border: none; background: #fff;
}

@media (max-width: 768px) {
  .libs-hero { padding: 8rem 0 2rem; }
  .lib-card { padding: 1.5rem; }
  .lib-card__header { flex-direction: column; align-items: flex-start; }
  .lib-card__link { margin-left: 0; }
  .lib-example__split { grid-template-columns: 1fr; }
  .lib-example__desc { border-right: none; border-bottom: 1px solid var(--border); }
  .css-demo { grid-template-columns: 1fr; }
  .vanilla-cards { flex-direction: column; }
  .playground-split { grid-template-columns: 1fr; }
  .playground-editor { border-right: none; border-bottom: 1px solid rgba(108,99,255,0.12); }
}
