/* ===== Базовые настройки ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0d1117;         /* основной фон */
  --bg-card: #161b22;    /* фон карточек */
  --border: #30363d;     /* границы */
  --text: #e6edf3;       /* основной текст */
  --text-muted: #8b949e; /* вторичный текст */
  --accent: #58a6ff;     /* акцентный цвет */
  --accent-hover: #79b8ff;
}

body {
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== Ссылки ===== */
a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}
a:hover {
  color: var(--accent-hover);
}

/* ===== Шапка ===== */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
  background: rgba(13, 17, 23, 0.9);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.5px;
}
.logo:hover {
  color: var(--accent);
}

.nav {
  display: flex;
  gap: 24px;
  align-items: center;
}
.nav a {
  color: var(--text-muted);
  font-size: 15px;
}
.nav a:hover {
  color: var(--accent);
}

/* ===== Hero-блок ===== */
.hero {
  padding: 80px 0 60px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.hero h1 {
  font-size: 42px;
  font-weight: 700;
  margin-bottom: 16px;
  line-height: 1.2;
  background: linear-gradient(135deg, #58a6ff, #bc8cff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-muted);
  font-size: 18px;
  margin-bottom: 32px;
}

.search {
  width: 100%;
  max-width: 480px;
  padding: 14px 18px;
  font-size: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}
.search:focus {
  border-color: var(--accent);
}
.search::placeholder {
  color: var(--text-muted);
}

/* ===== Блок протоколов ===== */
.protocols {
  padding: 60px 0;
}

.category {
  margin-bottom: 48px;
}

.category-title {
  font-size: 24px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.category-emoji {
  font-size: 24px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  color: var(--text);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(88, 166, 255, 0.15);
  color: var(--text);
}

.card h3 {
  font-size: 20px;
  margin-bottom: 10px;
  color: var(--accent);
}

.card p {
  color: var(--text-muted);
  font-size: 15px;
}

/* ===== Подвал ===== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* ===== Контент на странице протокола ===== */
.content {
  max-width: 780px;
  margin: 0 auto;
}
.content h2 {
  font-size: 24px;
  margin-top: 32px;
  margin-bottom: 12px;
  color: var(--accent);
}
.content h2:first-child {
  margin-top: 0;
}
.content p {
  color: var(--text);
  margin-bottom: 16px;
  font-size: 16px;
}
.content ul,
.content ol {
  margin-bottom: 16px;
  padding-left: 24px;
  color: var(--text);
}
.content li {
  margin-bottom: 8px;
}

.content code {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 14px;
  color: var(--accent);
}

.content a {
  text-decoration: underline;
  text-decoration-color: rgba(88, 166, 255, 0.4);
  text-underline-offset: 3px;
}
.content a:hover {
  text-decoration-color: var(--accent);
}

.content strong {
  color: var(--accent-hover);
  font-weight: 600;
}

/* ===== Выпадающее меню ===== */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-toggle {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 15px;
  transition: color 0.2s;
}
.dropdown:hover .dropdown-toggle {
  color: var(--accent);
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  min-width: 480px;
  max-width: 90vw;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  list-style: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  z-index: 200;
  margin: 0;

  /* Двухколоночная сетка */
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 24px;
  align-items: start;
}

/* Красивый скроллбар (для WebKit-браузеров: Chrome, Edge, Opera) */
.dropdown-menu::-webkit-scrollbar {
  width: 8px;
}
.dropdown-menu::-webkit-scrollbar-track {
  background: transparent;
}
.dropdown-menu::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
.dropdown-menu::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* Firefox */
.dropdown-menu {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.dropdown:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.dropdown-category {
  margin-bottom: 8px;
}
.dropdown-category:last-child {
  margin-bottom: 0;
}

.dropdown-category-title {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 8px 10px 4px;
  font-weight: 600;
}

.dropdown-sublist {
  list-style: none;
  padding: 0;
  margin: 0;
}

.dropdown-sublist a {
  display: block;
  padding: 8px 12px;
  color: var(--text);
  font-size: 14px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.dropdown-sublist a:hover {
  background: rgba(88, 166, 255, 0.1);
  color: var(--accent);
}

/* ===== Адаптив для телефонов ===== */
@media (max-width: 640px) {
  .hero {
    padding: 48px 0 40px;
  }
  .hero h1 {
    font-size: 28px;
  }
  .subtitle {
    font-size: 16px;
  }
  .category-title {
    font-size: 20px;
  }

  .dropdown-menu {
    left: 0;
    transform: translateX(0) translateY(-8px);
    min-width: 220px;
  }
  .dropdown:hover .dropdown-menu {
    transform: translateX(0) translateY(0);
  }
  /* ===== Схемы-диаграммы в протоколах ===== */
.diagram {
  margin: 24px 0 32px;
  padding: 20px;
  background: rgba(22, 27, 34, 0.5);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-align: center;
  overflow-x: auto;
}
.diagram svg {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}
.diagram-title {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 12px;
  font-style: italic;
}
}