:root {
  --brand: #0077b6;
  --brand-dark: #005f92;
  --brand-soft: #eef8ff;
  --brand-softer: #f7fbff;
  --text: #0f172a;
  --muted: #5b677a;
  --border: #d7e3ef;
  --surface: #ffffff;
  --surface-alt: #f8fbfe;
  --page: #f5f8fc;
  --shadow-sm: 0 10px 24px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 18px 44px rgba(15, 23, 42, 0.08);
  --radius: 1.25rem;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(0,119,182,0.12), transparent 30%),
    radial-gradient(circle at left 18%, rgba(0,119,182,0.07), transparent 24%),
    linear-gradient(180deg, #ffffff 0%, var(--page) 100%);
}
a { color: var(--brand-dark); text-decoration: none; }
a:hover { color: var(--brand); }
.text-secondary { color: var(--muted) !important; }
.kb-main { min-height: 60vh; }

.site-header {
  background: linear-gradient(180deg, #0a86cb 0%, var(--brand) 100%);
  box-shadow: 0 14px 30px rgba(0, 119, 182, 0.14);
}
.navbar-brand, .nav-link { color: rgba(255,255,255,0.96) !important; }
.navbar-brand span { color: rgba(255,255,255,0.72); }
.navbar-brand { letter-spacing: -0.03em; }
.nav-link {
  font-weight: 700;
  padding: 0.55rem 0.9rem !important;
  border-radius: 999px;
}
.nav-link:hover, .nav-link.active {
  background: rgba(255,255,255,0.14);
  color: #fff !important;
}
.navbar-toggler { border-color: rgba(255,255,255,0.28); }
.navbar-toggler:focus { box-shadow: 0 0 0 0.2rem rgba(255,255,255,0.18); }
.navbar-toggler-icon { filter: brightness(0) invert(1); }

.footer-heading {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand);
}
.site-footer {
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(8px);
}
.footer-links { display: grid; gap: 0.45rem; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--brand-dark); }

.container { max-width: 1180px; }
.section-head, .library-controls, .domain-grid, .cat-grid, .kb-grid, .article, .empty-state {
  width: min(1180px, calc(100% - 2rem));
  margin-left: auto;
  margin-right: auto;
}
.grid-2.section-spacer {
  width: min(1180px, calc(100% - 2rem));
  margin-left: auto;
  margin-right: auto;
}
.section-head { padding: 2rem 0 0.75rem; }
.section-title, .article-title, .domain-title, .cat-title, .kb-card-title, .related-title {
  letter-spacing: -0.04em;
  line-height: 1.08;
}
.section-title { font-size: clamp(2.2rem, 3.5vw, 3.25rem); font-weight: 800; margin: 0; }
.section-subtitle {
  margin: 0.85rem 0 0;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.7;
  max-width: 55rem;
}
.domain-hero { padding-top: 2.3rem; }

.library-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0 1.35rem;
}
.library-controls-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}
.library-search, .select {
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: rgba(255,255,255,0.92);
  min-height: 3.1rem;
  box-shadow: var(--shadow-sm);
}
.library-search {
  flex: 1;
  padding: 0 1rem;
  font-size: 0.98rem;
}
.library-search:focus, .select:focus {
  outline: none;
  border-color: rgba(0,119,182,0.42);
  box-shadow: 0 0 0 0.22rem rgba(0,119,182,0.12), var(--shadow-sm);
}
.library-count { color: var(--muted); font-size: 0.92rem; white-space: nowrap; }
.select { padding: 0 0.95rem; font-weight: 600; color: var(--text); }
.sr-only { position:absolute !important; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }

.domain-grid, .kb-grid, .cat-grid, .related-grid, .grid-2 {
  display: grid;
  gap: 1.25rem;
}
.domain-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
.kb-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
.cat-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
.related-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.section-spacer { margin-top: 1.5rem; }

.domain-card, .kb-card, .cat-card, .card, .callout, .related-card {
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.domain-card, .kb-card, .cat-card, .related-card {
  display: grid;
  gap: 0.75rem;
  padding: 1.35rem;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.domain-card:hover, .kb-card:hover, .cat-card:hover, .related-card:hover {
  transform: translateY(-2px);
  border-color: rgba(0,119,182,0.30);
  box-shadow: var(--shadow-md);
}
.domain-title { font-size: 1.5rem; font-weight: 800; color: var(--text); }
.domain-desc, .cat-desc, .kb-card-desc, .related-desc, .domain-meta, .cat-meta, .kb-card-meta, .muted {
  color: var(--muted);
  line-height: 1.65;
}
.domain-desc, .cat-desc, .kb-card-desc { font-size: 1rem; }
.domain-meta, .cat-meta, .kb-card-meta { font-size: 0.92rem; }
.kb-card-title, .cat-title { font-size: 1.15rem; font-weight: 800; color: var(--text); }
.related-title { font-size: 1rem; font-weight: 800; color: var(--text); }
.kb-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}
.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.82rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--brand);
  background: var(--brand-soft);
  border: 1px solid rgba(0,119,182,0.16);
  white-space: nowrap;
}
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  padding: 0.8rem 1.15rem;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(180deg, #0a86cb 0%, var(--brand) 100%);
  box-shadow: 0 12px 26px rgba(0,119,182,0.22);
}
.button-link.secondary {
  color: var(--brand-dark);
  background: #fff;
  border: 1px solid rgba(0,119,182,0.18);
  box-shadow: none;
}

.card {
  padding: 1.35rem;
  min-width: 0;
}
.card h3, .callout h3, .related h3 {
  margin: 0 0 0.6rem;
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--text);
}
.tight { margin: 0; padding-left: 1.2rem; }
.tight li + li { margin-top: 0.42rem; }
.callout {
  padding: 1.35rem 1.45rem 1.1rem;
  background: linear-gradient(180deg, #fbfdff 0%, var(--brand-soft) 100%);
}
.callout ul, .article-body ul { padding-left: 1.2rem; }
.callout li + li, .article-body li + li { margin-top: 0.35rem; }

.article {
  padding: 2rem 0 0;
}

.article-body hr {
  border: 0;
  border-top: 1px solid rgba(215,227,239,0.95);
  margin: 1.5rem 0;
}

.article-body a {
  color: var(--brand-dark);
  text-decoration: underline;
  text-underline-offset: 0.16rem;
}

.article-body a:hover {
  color: var(--brand);
}

.article-head {
  margin-bottom: 1.4rem;
}
.article-head .kicker {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.article-title {
  margin: 0;
  font-size: clamp(2.2rem, 4.3vw, 3.6rem);
  font-weight: 800;
  color: var(--text);
}
.article-desc {
  margin: 0.9rem 0 0;
  color: var(--muted);
  font-size: 1.12rem;
  line-height: 1.75;
  max-width: 60rem;
}
.article-body {
  margin-top: 2rem;
  background: rgba(255,255,255,0.88);
  border: 1px solid rgba(215,227,239,0.9);
  border-radius: calc(var(--radius) + 0.15rem);
  box-shadow: var(--shadow-sm);
  padding: 1.75rem 1.6rem;
}
.article-body > :first-child { margin-top: 0; }
.article-body h2 {
  margin: 1.75rem 0 0.8rem;
  font-size: clamp(1.55rem, 2vw, 2.15rem);
  font-weight: 800;
  color: var(--text);
}
.article-body h3 {
  margin: 1.2rem 0 0.55rem;
  font-size: 1.18rem;
  font-weight: 800;
}
.article-body p, .article-body li {
  font-size: 1.02rem;
  line-height: 1.8;
  color: #1f2937;
}
.article-body p { margin: 0 0 1rem; }
.article-body ul { margin: 0.4rem 0 1.1rem; }
.article-body strong { color: var(--text); }
.article-body code {
  background: rgba(15,23,42,0.06);
  border: 1px solid rgba(15,23,42,0.10);
  padding: 0.16rem 0.42rem;
  border-radius: 0.55rem;
  font-size: 0.88rem;
}
.article-body blockquote {
  margin: 1rem 0;
  padding: 1rem 1.15rem;
  border-left: 4px solid rgba(0,119,182,0.5);
  background: rgba(0,119,182,0.06);
  border-radius: 1rem;
}
.related { margin-top: 1.7rem; }
.related h3 { margin-bottom: 0.95rem; }

.empty-state {
  max-width: 920px;
  padding: 1.4rem 1.5rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255,255,255,0.86);
  box-shadow: var(--shadow-sm);
  line-height: 1.7;
}

@media (max-width: 1199.98px) {
  .domain-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 991.98px) {
  .kb-grid, .cat-grid, .related-grid, .domain-grid, .grid-2 { grid-template-columns: 1fr 1fr; }
  .section-title { font-size: clamp(2rem, 5vw, 2.7rem); }
}
@media (max-width: 767.98px) {
  .library-controls, .library-controls-left { flex-direction: column; align-items: stretch; }
  .library-count { white-space: normal; }
  .kb-grid, .cat-grid, .related-grid, .domain-grid, .grid-2 { grid-template-columns: 1fr; }
  .article, .section-head { padding-top: 1.4rem; }
  .article-body { padding: 1.3rem 1.1rem; }
  .article-title { font-size: 2.1rem; }
}
