*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0d0d0d;
  --surface: #161616;
  --surface2: #1e1e1e;
  --border: #262626;
  --text: #e2e2e2;
  --muted: #666;
  --muted2: #888;
  --accent: #7aa2f7;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

/* ── Header ── */
.site-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .875rem 2rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(13,13,13,.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 100;
}

.logo {
  font-weight: 700;
  font-size: .95rem;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}
.logo:hover { opacity: .8; }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .82rem;
  color: var(--muted);
  flex-wrap: wrap;
  overflow: hidden;
}
.breadcrumb a { color: var(--muted); transition: color .15s; }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb .cur { color: var(--muted2); }
.breadcrumb .sep { opacity: .35; user-select: none; }

/* ── Main ── */
main { max-width: 1440px; margin: 0 auto; padding: 2.5rem 2rem 5rem; }

/* ── Hero (index only) ── */
.hero {
  text-align: center;
  padding: 5rem 1rem 4rem;
}

.hero h2 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 800;
  letter-spacing: -.03em;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #e2e2e2 30%, #7aa2f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  color: var(--muted2);
  font-size: 1.05rem;
  max-width: 560px;
  margin: 0 auto 2.5rem;
  line-height: 1.85;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  flex-wrap: wrap;
  font-size: .85rem;
  color: var(--muted);
  padding: 1.5rem 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: fit-content;
  margin: 0 auto 3rem;
}
.hero-stats strong { display: block; font-size: 1.5rem; font-weight: 700; color: var(--text); margin-bottom: .15rem; }

.hero-note {
  font-size: .8rem;
  color: var(--muted);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.7;
}
.hero-note a { color: var(--accent); }

/* ── Section header ── */
.section-head { margin-bottom: 1.75rem; }
.section-head h2 { font-size: 1.5rem; font-weight: 700; }
.section-head p { color: var(--muted2); font-size: .875rem; margin-top: .3rem; }

/* ── Library cards ── */
.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 2rem;
}

.lib-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color .2s, transform .2s;
}
.lib-card:hover { border-color: var(--accent); transform: translateY(-3px); }

.lib-card .thumb { height: 175px; overflow: hidden; background: var(--surface2); }
.lib-card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; display: block; }
.lib-card:hover .thumb img { transform: scale(1.07); }

.lib-card .body { padding: 1.25rem 1.4rem; }
.lib-card .body .icon { font-size: 1.4rem; margin-bottom: .5rem; }
.lib-card .body h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: .35rem; }
.lib-card .body p { color: var(--muted2); font-size: .82rem; line-height: 1.6; }
.lib-card .body .meta { margin-top: .9rem; font-size: .78rem; color: var(--accent); }

/* ── Category cards ── */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.cat-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  overflow: hidden;
  transition: border-color .2s, transform .2s;
}
.cat-card:hover { border-color: var(--accent); transform: translateY(-2px); }

.cat-card .thumb { height: 115px; overflow: hidden; background: var(--surface2); }
.cat-card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; display: block; }
.cat-card:hover .thumb img { transform: scale(1.07); }

.cat-card .label { padding: .8rem 1rem; }
.cat-card .label h4 { font-size: .9rem; font-weight: 600; }
.cat-card .label span { font-size: .75rem; color: var(--muted2); }

/* ── Image grid ── */
.img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: .75rem;
  margin-top: 1.75rem;
}

.img-item {
  background: var(--surface2);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  transition: border-color .2s;
}
.img-item:hover { border-color: #444; }
.img-item a { display: block; }
.img-item img { display: block; width: 100%; height: 175px; object-fit: cover; transition: transform .3s; }
.img-item:hover img { transform: scale(1.04); }
.img-item .name {
  padding: .4rem .65rem;
  font-size: .68rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border);
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  font-size: .82rem;
  margin-top: 5rem;
}
footer a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
footer a:hover { color: var(--text); }

/* ── Responsive ── */
@media (max-width: 600px) {
  main { padding: 1.5rem 1rem 3rem; }
  .site-header { padding: .75rem 1rem; }
  .hero { padding: 3rem .5rem 2.5rem; }
  .img-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .img-item img { height: 110px; }
}
