:root {
  --header-height: 64px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --text: #e8eef2;
  --text-secondary: #cfe3f0;
  --text-muted: var(--muted);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.12);
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

.page > .site-header,
.page > .main-content,
.page > .site-footer {
  position: relative;
  z-index: 1;
}

.site-header {
  height: var(--header-height);
  background: var(--glass);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  padding: 0 24px;
  box-shadow: var(--shadow);
}

.header-inner {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

.logo {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: color 0.2s var(--ease);
}

.logo:hover {
  color: var(--gold);
}

.main-content {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 48px 24px 72px;
  overflow: visible;
}

.article-page {
  max-width: 100%;
  overflow: visible;
}

.hero {
  text-align: center;
  padding: 72px 24px 80px;
  margin-bottom: 56px;
  background: var(--glass);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
}

.hero-bg {
  display: none;
}

.hero-title {
  font-size: clamp(2.25rem, 5.5vw, 3.25rem);
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.hero-subtitle {
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin: 0 0 40px;
  font-weight: 400;
}

.search-form {
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  align-items: stretch;
  border-radius: var(--radius-full);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 4px 12px rgba(255, 255, 255, 0.06), 0 8px 24px rgba(0, 0, 0, 0.3);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.search-form:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.search-form:focus-within {
  border-color: var(--gold);
}

.search-input:focus,
.search-input:focus-visible {
  outline: none;
  box-shadow: none;
}

.search-icon {
  display: flex;
  align-items: center;
  padding-left: 20px;
  flex-shrink: 0;
  color: var(--text-muted);
  font-size: 1.1rem;
}

.search-input {
  flex: 1;
  padding: 16px 16px 16px 12px;
  font-size: 1rem;
  font-family: var(--font);
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-btn {
  padding: 14px 26px;
  margin: 6px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: #0b1013;
  border: none;
  cursor: pointer;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: var(--font);
  box-shadow: 0 8px 24px rgba(212, 178, 92, 0.35);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.search-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 28px rgba(212, 178, 92, 0.4);
}

.hero-small {
  padding: 40px 24px 48px;
  margin-bottom: 40px;
}

.hero-small .hero-title,
.hero-small .hero-subtitle {
  display: none;
}

.categories-section {
  margin-top: 0;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 20px;
  color: var(--gold);
  letter-spacing: -0.02em;
}

.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 20px;
  background: var(--glass);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.category-card:hover {
  border-color: rgba(212, 178, 92, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(212, 178, 92, 0.15);
  color: var(--text);
}

.category-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 14px;
  background: rgba(212, 178, 92, 0.15);
  border-radius: var(--radius);
  line-height: 1;
}

.category-icon--svg {
  color: var(--gold);
}

.category-icon--svg svg {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.category-card:hover .category-icon {
  background: rgba(212, 178, 92, 0.25);
}

.category-card:hover .category-icon--svg {
  color: var(--gold-2);
}

.category-title {
  font-size: 0.9375rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.35;
  color: var(--text-secondary);
}

.category-card:hover .category-title {
  color: var(--text);
}

.article-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--glass);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.article-list li {
  margin: 0;
  border-bottom: 1px solid var(--border);
}

.article-list li:last-child {
  border-bottom: none;
}

.article-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  color: inherit;
  text-decoration: none;
  transition: background 0.15s var(--ease);
}

.article-row:hover {
  background: rgba(255, 255, 255, 0.06);
}

.article-row-title {
  font-weight: 500;
  color: var(--gold);
  flex: 1;
  min-width: 0;
}

.article-row:hover .article-row-title {
  color: var(--gold-2);
}

.article-meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.article-list:not(.article-list--with-meta) .article-row {
  justify-content: flex-start;
}

.article-list:not(.article-list--with-meta) .article-row-title {
  flex: none;
}

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

.breadcrumb a {
  color: var(--gold);
  text-decoration: none;
  font-weight: 500;
}

.breadcrumb a:hover {
  color: var(--gold-2);
  text-decoration: underline;
}

.breadcrumb .sep {
  margin: 0 8px;
  color: var(--border-strong);
}

.category-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 40px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.category-icon.big,
.category-icon--big {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  background: rgba(212, 178, 92, 0.15);
  border-radius: var(--radius);
  flex-shrink: 0;
}

.category-icon--big.category-icon--svg svg {
  width: 36px;
  height: 36px;
}

.category-header .category-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.03em;
  color: var(--text);
}

.subcategories-section {
  margin-bottom: 40px;
}

.dropdown {
  margin-bottom: 8px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--glass);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.dropdown-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: transparent;
  border: none;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
  color: var(--text);
  transition: background 0.15s var(--ease);
}

.dropdown-trigger:hover {
  background: rgba(255, 255, 255, 0.06);
}

.dropdown-arrow {
  font-size: 0.65rem;
  color: var(--text-muted);
  transition: transform 0.2s var(--ease);
}

.dropdown-panel {
  display: none;
  padding: 8px 12px 16px 20px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}

.dropdown-panel.is-open {
  display: block;
}

.dropdown:has(.dropdown-panel.is-open) .dropdown-arrow {
  transform: rotate(180deg);
}

.no-results {
  color: var(--text-muted);
  margin: 28px 0;
  font-size: 0.9375rem;
}


.article-with-toc {
  display: flex;
  flex-wrap: nowrap;
  gap: 48px;
  align-items: stretch;
  overflow: visible;
}

.article-with-toc--no-toc .article-body {
  max-width: 680px;
}

.article-content-col {
  flex: 1 1 auto;
  min-width: 0;
}

.article-content-col .article-body {
  max-width: 680px;
}

.article-toc-col {
  flex: 0 0 240px;
  width: 240px;
  align-self: stretch;
  overflow: visible;
}

.article-toc {
  position: sticky;
  top: 24px;
  padding-top: 8px;
  overflow: visible;
}

.article-toc.article-toc--fixed {
  position: fixed !important;
  top: 24px;
  z-index: 10;
}

.article-toc-spacer {
  flex-shrink: 0;
}

.article-toc-mobile {
  display: none;
}

.article-toc-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 20px 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.article-toc-title {
  font-size: 0.6875rem;
  font-weight: 700;
  margin: 0 0 14px;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.article-toc-title::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 14px;
  background: var(--gold);
  border-radius: 2px;
}

.article-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.article-toc-list li {
  margin: 0 0 2px;
}

.article-toc-link {
  position: relative;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  display: block;
  line-height: 1.45;
  padding: 8px 12px;
  margin: 0 -12px;
  border-radius: 6px;
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}

.article-toc-link:hover {
  color: var(--gold);
  background: rgba(212, 178, 92, 0.08);
}

.article-toc-link.is-active {
  color: var(--gold);
  font-weight: 500;
  background: rgba(212, 178, 92, 0.12);
}

.article-toc-link.is-active::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 1em;
  background: var(--gold);
  border-radius: 2px;
  margin-left: -20px;
}

.article-toc-list li {
  position: relative;
}

@media (max-width: 900px) {
  .article-with-toc {
    flex-direction: column;
  }

  .article-toc-col {
    flex: none;
    width: 100%;
    align-self: stretch;
    height: 0;
    min-height: 0;
  }

  .article-with-toc:has(.article-toc-mobile) {
    padding-bottom: 72px;
  }

  .article-toc {
    display: none;
  }

  .article-toc-mobile {
    display: block;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    pointer-events: none;
  }

  .article-toc-mobile-trigger {
    pointer-events: auto;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    font-family: var(--font);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.25);
  }

  .article-toc-mobile-trigger-icon {
    font-size: 0.65rem;
    color: var(--text-muted);
    transition: transform 0.2s var(--ease);
  }

  .article-toc-mobile.is-open .article-toc-mobile-trigger-icon {
    transform: rotate(180deg);
  }

  .article-toc-drawer {
    pointer-events: auto;
    max-height: 0;
    overflow: hidden;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-bottom: none;
    transition: max-height 0.25s var(--ease);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.2);
  }

  .article-toc-drawer.is-open {
    max-height: 60vh;
    overflow-y: auto;
  }

  .article-toc-drawer .article-toc-list {
    padding: 12px 16px 24px;
  }

  .article-toc-drawer .article-toc-link {
    margin: 0 -8px;
    padding: 10px 12px;
  }

  .article-toc-drawer .article-toc-link.is-active::before {
    display: none;
  }

  .article-toc-drawer .article-toc-link.is-active {
    background: rgba(212, 178, 92, 0.15);
  }
}

.article-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.article-title {
  font-size: 2rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.03em;
  line-height: 1.25;
  color: var(--text);
}

.article-summary {
  max-width: 680px;
  background: var(--bg-2);
  border-left: 4px solid var(--gold);
  padding: 24px 28px;
  margin-bottom: 36px;
  border-radius: 0 var(--radius) var(--radius) 0;
  box-shadow: var(--shadow);
}

.summary-title {
  font-size: 0.6875rem;
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.summary-title-ai {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8125rem;
  text-transform: none;
  letter-spacing: 0.02em;
}

.summary-ai-icon {
  display: inline-flex;
  flex-shrink: 0;
  color: var(--gold);
}

.summary-ai-icon svg {
  width: 20px;
  height: 20px;
  opacity: 0.95;
}


.summary-text {
  margin: 0 0 0.85em;
  font-size: 1rem;
  line-height: 1.72;
  letter-spacing: 0.01em;
  color: var(--text-secondary);
}

.summary-text:last-child {
  margin-bottom: 0;
}

.markdown-body {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-secondary);
}

.markdown-body h2 {
  font-size: 1.375rem;
  font-weight: 600;
  margin: 2em 0 0.75em;
  padding-bottom: 0.5em;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.markdown-body h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 1.75em 0 0.5em;
  color: var(--text);
}

.markdown-body p {
  margin: 0 0 1em;
}

.article-figure {
  margin: 1.5em 0;
}

.article-figure .article-figcaption {
  display: block;
  margin-top: 0.5em;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--text-muted);
  text-align: center;
}

.markdown-body img {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
  display: block;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.04);
  background: #0f1c24;
  cursor: pointer;
  transition: box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}

.markdown-body img:hover {
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(212, 178, 92, 0.2);
  border-color: rgba(212, 178, 92, 0.25);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s var(--ease), visibility 0.2s var(--ease);
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  cursor: pointer;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 2;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--gold);
  color: var(--gold);
}

.lightbox-content {
  position: relative;
  z-index: 1;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  background: #0f1c24;
  cursor: default;
}

.markdown-body ul, .markdown-body ol {
  margin: 0 0 1em;
  padding-left: 1.5em;
}

.markdown-body code {
  background: rgba(255, 255, 255, 0.08);
  padding: 0.2em 0.45em;
  border-radius: 6px;
  font-size: 0.9em;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  color: var(--gold-2);
}

.markdown-body pre {
  background: var(--bg-2);
  color: #e8eef2;
  border-radius: var(--radius);
  padding: 1.25em 1.5em;
  overflow-x: auto;
  margin: 0 0 1.5em;
  font-size: 0.875rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.markdown-body pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.markdown-body blockquote {
  margin: 0 0 1em;
  padding: 0.75em 1.25em;
  border-left: 4px solid var(--gold);
  background: rgba(212, 178, 92, 0.08);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-secondary);
}

.markdown-body a {
  color: var(--gold);
  text-decoration: none;
  font-weight: 500;
}

.markdown-body a:hover {
  color: var(--gold-2);
  text-decoration: underline;
}

.markdown-body details {
  margin: 1em 0;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.markdown-body summary {
  padding: 14px 18px;
  font-weight: 600;
  color: var(--gold);
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.markdown-body summary::-webkit-details-marker {
  display: none;
}

.markdown-body summary::before {
  content: "▶";
  display: inline-block;
  margin-right: 10px;
  font-size: 0.7em;
  transition: transform 0.2s var(--ease);
}

.markdown-body details[open] summary::before {
  transform: rotate(90deg);
}

.markdown-body summary:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--gold-2);
}

.markdown-body details > *:not(summary) {
  margin: 0;
  padding: 0 18px 16px;
}

.markdown-body details > *:not(summary):first-of-type {
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.markdown-body details > *:not(summary) p:first-child,
.markdown-body details > *:not(summary) ul:first-child,
.markdown-body details > *:not(summary) ol:first-child {
  margin-top: 0;
}

.markdown-body details p,
.markdown-body details div p {
  margin: 0 0 1em;
  color: var(--text-secondary);
  line-height: 1.75;
  font-size: 1rem;
}

.markdown-body details p:last-child,
.markdown-body details div p:last-child {
  margin-bottom: 0;
}

.markdown-body details a,
.markdown-body details div a {
  color: var(--gold);
  text-decoration: none;
  font-weight: 500;
}

.markdown-body details a:hover,
.markdown-body details div a:hover {
  color: var(--gold-2);
  text-decoration: underline;
}

.markdown-body details ul,
.markdown-body details div ul {
  margin: 0.5em 0 1em;
  padding-left: 1.5em;
  color: var(--text-secondary);
  line-height: 1.6;
}

.markdown-body details li,
.markdown-body details div li {
  margin: 0.35em 0;
}

.markdown-body details li a {
  color: var(--gold);
}

.markdown-body .katex {
  font-size: 1.05em;
  color: var(--text);
}

.markdown-body .katex-display {
  margin: 1em 0;
  padding: 0.75em 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px;
  text-align: center;
  background: var(--glass);
  margin-top: auto;
  backdrop-filter: blur(10px);
}

.lang-switch {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.lang-link {
  color: var(--gold);
  text-decoration: none;
  font-weight: 500;
}

.lang-link:hover {
  color: var(--gold-2);
  text-decoration: underline;
}

.lang-link.active {
  font-weight: 600;
  color: var(--text);
}

.search-results {
  background: var(--glass);
  border-radius: var(--radius-lg);
  padding: 28px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.search-results .section-title {
  margin-bottom: 20px;
}

.search-results .article-list {
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.search-results .article-list li {
  border-bottom: 1px solid var(--border);
}

.search-results .article-list li:last-child {
  border-bottom: none;
}

.search-results .article-row {
  padding: 14px 0;
}

.article-list--with-meta .article-meta {
  margin-left: auto;
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

::selection {
  background: rgba(212, 178, 92, 0.25);
  color: var(--text);
}
