:root {
  color-scheme: light;
  --color-background: #f5f7f9;
  --color-surface: #ffffff;
  --color-text: #1a1c1d;
  --color-muted: #5c646a;
  --color-accent: #1f7a4d;
  --color-accent-soft: #e2f4eb;
  --font-body: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--color-background);
  color: var(--color-text);
}

a {
  color: var(--color-accent);
  text-decoration: none;
}

a:hover,
a:focus {
  text-decoration: underline;
}

.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 100vh;
}

.content {
  padding: 2.5rem 3rem 4rem;
  background: var(--color-surface);
  box-shadow: 0 0 24px rgba(26, 28, 29, 0.08);
}

.page-header,
.article__header {
  margin-bottom: 2rem;
}

.page-header__title,
.article__title {
  margin: 0;
  font-size: 2.2rem;
  line-height: 1.15;
}

.page-header__title a,
.article__title a {
  color: inherit;
}

.page-header__title a:hover,
.article__title a:hover {
  text-decoration: underline;
}

.page-header__lede,
.article__lede {
  margin: 0.75rem 0 0;
  color: var(--color-muted);
  max-width: 68ch;
}

.breadcrumb {
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: var(--color-muted);
}

.breadcrumb__list {
  list-style: none;
  display: flex;
  gap: 0.5rem;
  padding: 0;
  margin: 0;
  align-items: center;
}

.breadcrumb__separator {
  color: #b0b6bc;
}

.sidebar {
  padding: 2rem 1.5rem;
  border-right: 1px solid #e0e4e8;
  background: #f7f9fb;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar__search input {
  width: 100%;
  padding: 0.75rem;
  border-radius: 12px;
  border: 1px solid #ccd2d8;
  font-size: 0.95rem;
  transition: border-color 0.2s ease;
}

.sidebar__search input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(31, 122, 77, 0.15);
}

.sidebar__results {
  margin-top: 0.75rem;
  display: none;
  border-radius: 12px;
  background: var(--color-surface);
  box-shadow: 0 12px 24px rgba(26, 28, 29, 0.12);
  padding: 0.75rem 0;
}

.sidebar__search-results {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar__search-results li {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid #eef1f3;
}

.sidebar__search-results li:last-child {
  border-bottom: none;
}

.sidebar__search-link {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  color: inherit;
}

.sidebar__search-title {
  font-weight: 600;
}

.sidebar__search-score {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-accent);
}

.sidebar__search-snippet {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.sidebar__search-meta {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #889197;
}

.sidebar__results-empty {
  margin: 0;
  padding: 0.75rem 1rem;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.sidebar__list {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
}

.sidebar__item {
  margin: 0;
}

.sidebar__item > .sidebar__list {
  border-left: 1px solid rgba(31, 122, 77, 0.1);
  margin-left: 1rem;
  padding-left: 0.75rem;
}

.sidebar__item--active > .sidebar__link,
.sidebar__item--active > .sidebar__link--category {
  color: var(--color-accent);
}

.sidebar__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.35rem 0.35rem 0.75rem;
  border-radius: 10px;
  color: var(--color-text);
  font-size: 0.95rem;
  line-height: 1.4;
}

.sidebar__link:hover {
  background: var(--color-accent-soft);
}

.sidebar__link--category {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-muted);
  background: rgba(31, 122, 77, 0.08);
  margin-top: 0.4rem;
}

.sidebar__item--active > .sidebar__link--category {
  background: rgba(31, 122, 77, 0.2);
}

.sidebar__label {
  display: inline-block;
  padding: 0.25rem 0.25rem 0.25rem 0.5rem;
  color: var(--color-muted);
  font-size: 0.92rem;
}

.sidebar__toggle {
  display: none;
}

@media (max-width: 1024px) {
  .layout {
    grid-template-columns: 280px 1fr;
  }
}

@media (max-width: 768px) {
  .layout {
    display: block;
  }

  .sidebar {
    position: relative;
    height: auto;
    border-right: none;
    border-bottom: 1px solid #e0e4e8;
    padding: 1.5rem 1.25rem;
  }

  .sidebar__toc {
    display: none;
  }

  .sidebar[data-open="true"] .sidebar__toc {
    display: block;
    margin-top: 1.5rem;
  }

  .sidebar__toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: 1px solid rgba(31, 122, 77, 0.3);
    border-radius: 999px;
    padding: 0.45rem 1rem;
    font-weight: 600;
    color: var(--color-accent);
  }

  .content {
    padding: 1.75rem 1.25rem 2.5rem;
  }

  .page-header__title,
  .article__title {
    font-size: 1.95rem;
  }

  .knowledge-hub__grid,
  .related__list,
  .home-index__grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}

@media (max-width: 520px) {
  .sidebar {
    padding: 1.25rem;
  }

  .content {
    padding: 1.5rem 1rem 2rem;
  }

  .breadcrumb__list {
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  .knowledge-hub__grid,
  .related__list,
  .home-index__grid {
    grid-template-columns: 1fr;
  }

  .home-hero {
    padding: 2.25rem 1.75rem;
  }

  .home-hero__meta {
    flex-direction: column;
    gap: 0.75rem;
  }
}
