:root {
  --bg: #0c0c10;
  --bg-alt: #14141b;
  --fg: #ececf1;
  --muted: #9a9aa8;
  --accent: #ff2e88;
  --accent2: #8a5cff;
  --border: #1f1f29;
  --border-subtle: #262632;
  --maxw: 1080px;
  --radius: 14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:visited { color: #d45cff; }

img { max-width: 100%; height: auto; display: block; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem; }

/* Cross-site network bar */
.network-bar {
  background: #08080b;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
}
.network-bar-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.4rem 1.25rem;
  flex-wrap: wrap;
}
.network-label {
  color: #5a5a68;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  font-size: 0.7rem;
}
.network-bar a {
  color: var(--muted);
  font-weight: 500;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  transition: color 0.15s, background 0.15s;
}
.network-bar a:hover { color: var(--fg); text-decoration: none; background: rgba(255,46,136,0.08); }
.network-bar a.is-active {
  color: #fff;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  font-weight: 600;
}

/* Header / nav */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(12,12,16,0.85);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  max-width: var(--maxw);
  margin: 0 auto;
}
.site-title {
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--fg);
  font-size: 1.05rem;
}
.site-title span { color: var(--accent); }
.site-title:hover { text-decoration: none; }
.site-nav { display: flex; flex-wrap: wrap; gap: 1.1rem; }
.site-nav a { color: var(--muted); font-size: 0.92rem; font-weight: 500; }
.site-nav a:hover { color: var(--fg); text-decoration: none; }

/* Main */
main { min-height: 60vh; }

/* Typography */
h1, h2, h3 { line-height: 1.2; font-weight: 700; }
h1 { font-size: clamp(2rem, 5vw, 3.25rem); letter-spacing: -0.02em; margin: 0 0 1rem; }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); margin: 0 0 1rem; }

/* Hero */
.hero {
  position: relative;
  padding: 5rem 0 4rem;
  text-align: center;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 400px at 50% -10%, rgba(138,92,255,0.22), transparent 60%),
    radial-gradient(700px 380px at 80% 20%, rgba(255,46,136,0.15), transparent 60%);
  z-index: -1;
}
.hero h1 { margin-bottom: 1rem; }
.hero p {
  color: var(--muted);
  font-size: 1.15rem;
  max-width: 680px;
  margin: 0 auto;
}

/* Search */
.search-section { margin: 2rem auto 3rem; max-width: 680px; }
#search-input {
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  background: #0f0f15;
  border: 1px solid #2a2a36;
  border-radius: var(--radius-sm);
  color: var(--fg);
  font: inherit;
}
#search-input:focus { outline: none; border-color: var(--accent); }
#search-results { margin-top: 1rem; text-align: left; }
.search-result {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
}
.search-result a { font-weight: 600; }
.search-result p { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.9rem; }
mark { background: rgba(255,46,136,0.25); color: var(--fg); padding: 0 0.15rem; border-radius: 0.15rem; }
.empty { color: var(--muted); }

/* Browse / sections */
.browse, .recent { padding: 2rem 0; }
.browse h2, .recent h2 { font-size: 1.5rem; margin-bottom: 1.25rem; }

/* Term clouds / pills */
.term-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.term-pill, .pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.92rem;
  color: var(--fg);
  font-weight: 500;
}
.term-pill:hover, .pill:hover {
  border-color: #34343f;
  text-decoration: none;
}
.term-pill .count { color: var(--muted); font-size: 0.8rem; }

/* Section grid */
.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}
.section-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  transition: transform 0.2s, border-color 0.2s;
}
.section-card:hover {
  transform: translateY(-3px);
  border-color: #34343f;
  text-decoration: none;
}
.section-card h3 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
}
.section-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Category tile grid (homepage + /categories/) */
.category-band {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  padding: 2rem 0 3rem;
  background: rgba(0,0,0,0.2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.category-band-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.category-band-inner h2 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
}
.category-tile-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  width: 100%;
}
.category-tile {
  display: flex;
  flex-direction: column;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.category-tile:hover {
  transform: translateY(-3px);
  border-color: #34343f;
  box-shadow: 0 8px 28px rgba(0,0,0,0.35);
  text-decoration: none;
}
.category-tile-image {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 1;
  background: var(--bg);
  overflow: hidden;
}
.category-tile-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  margin: 0;
  border-radius: 0;
}
.category-tile-fallback {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(138,92,255,0.35), rgba(255,46,136,0.25));
}
.category-tile-body {
  padding: 0.85rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.category-tile-body h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  line-height: 1.25;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.category-tile-summary {
  margin: 0 0 0.6rem;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.category-tile-count {
  display: inline-block;
  align-self: flex-start;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}

@media (max-width: 1000px) {
  .category-tile-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .category-tile-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }
  .category-band-inner { padding: 0 1rem; }
  .category-tile-body { padding: 0.75rem; }
}

/* Breadcrumbs */
.breadcrumbs {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--fg); text-decoration: none; }
.breadcrumbs .sep { margin: 0 0.4rem; opacity: 0.5; }
.breadcrumbs .current { color: var(--fg); }

/* Note list */
.note-list { list-style: none; padding: 0; margin: 0; }
.note-list li {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
}
.note-list a { font-weight: 600; }
.note-list .meta {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}
.note-list .summary { margin: 0.4rem 0 0; color: var(--muted); font-size: 0.92rem; }

/* Note page */
.note {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 2.5rem;
  margin: 2rem auto;
}
.note-header { margin-bottom: 2rem; }
.note-header h1 { margin: 0.75rem 0; }
.note-categories { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.75rem; }
.note-source, .note-description, .note-meta { color: var(--muted); margin: 0.5rem 0; }
.note-source a { word-break: break-all; }
.note-body { font-size: 1.05rem; }
.note-body h2 {
  font-size: 1.6rem;
  margin-top: 2.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.note-body h3 { font-size: 1.25rem; margin-top: 1.75rem; }
.note-body p, .note-body ul, .note-body ol { margin: 1rem 0; }
.note-body img { border-radius: var(--radius-sm); margin: 1.5rem 0; }
.note-body pre {
  background: var(--bg);
  padding: 1rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  border: 1px solid var(--border);
}
.note-body code {
  background: var(--bg);
  padding: 0.15rem 0.35rem;
  border-radius: 0.25rem;
  font-size: 0.9em;
}
.note-footer { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.note-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* List / category pages */
.list-page { padding: 3rem 0; }
.list-page h1 { margin-bottom: 1.5rem; }
.category-description { color: var(--muted); font-size: 1.1rem; margin-bottom: 2rem; }
.category-section { margin-bottom: 3rem; }
.category-section h2 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.category-section h2 a { color: var(--fg); }
.category-section h2 a:hover { color: var(--accent); }
.section-count {
  background: var(--bg);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.pill.category { background: rgba(138,92,255,0.12); border-color: rgba(138,92,255,0.35); color: var(--fg); }
.pill.category:hover { background: rgba(138,92,255,0.22); border-color: rgba(138,92,255,0.55); }

/* Resource grid cards */
.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  width: 100%;
}
.resource-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s;
}
.resource-card:hover {
  transform: translateY(-3px);
  border-color: #34343f;
}
.resource-card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: var(--fg);
}
.resource-card-link:hover { text-decoration: none; }
.resource-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--bg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.resource-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  margin: 0;
  border-radius: 0;
}
.resource-thumb.no-thumb {
  background: linear-gradient(135deg, rgba(138,92,255,0.18), rgba(255,46,136,0.12));
}
.resource-icon {
  font-size: 2rem;
  opacity: 0.6;
}
.resource-card-body {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.resource-card-body h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.resource-card-body .summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.resource-source {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

@media (max-width: 720px) {
  .resource-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.9rem;
  }
  .resource-card-body { padding: 0.75rem; }
  .resource-card-body h3 { font-size: 0.95rem; }
}

/* About / content pages */
.page-content { padding: 3rem 0; }
.page-content h1 { margin-bottom: 1.5rem; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--fg); text-decoration: none; }
.site-footer .container { text-align: center; }
.site-footer p { margin: 0.35rem 0; }

/* Video playlist grid */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  width: 100%;
}
.video-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s;
}
.video-card:hover {
  transform: translateY(-3px);
  border-color: #34343f;
}
.video-card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: var(--fg);
}
.video-card-link:hover { text-decoration: none; }
.video-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--bg);
  overflow: hidden;
}
.video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  margin: 0;
  border-radius: 0;
}
.video-thumb.no-thumb {
  background: linear-gradient(135deg, rgba(138,92,255,0.25), rgba(255,46,136,0.18));
  display: flex;
  align-items: center;
  justify-content: center;
}
.video-icon {
  font-size: 2rem;
  color: var(--fg);
  opacity: 0.8;
}
.video-card-body {
  padding: 0.9rem;
  flex: 1;
}
.video-card-body h3 {
  margin: 0 0 0.4rem;
  font-size: 0.98rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.video-channel {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}
.video-duration {
  display: inline-block;
  margin-top: 0.4rem;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 0.25rem;
  border: 1px solid var(--border);
}

@media (max-width: 720px) {
  .video-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
  }
}

/* Video single page */
.video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 1rem 0 1.5rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--border);
}
.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.video-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* Responsive */
@media (max-width: 720px) {
  .header-inner { flex-wrap: wrap; }
  .site-nav { width: 100%; gap: 0.75rem; padding-top: 0.75rem; }
  .note { padding: 1.25rem; }
  .hero { padding: 3.5rem 0 3rem; }
}
