:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --bg-alt: #ffffff;
  --surface: #ffffff;
  --surface-strong: #f0f4ff;
  --text: #1c2534;
  --text-muted: rgba(28, 37, 52, 0.65);
  --accent: #2f6bff;
  --accent-strong: #1b4fd9;
  --border: #dbe4f5;
  --header-offset: 6rem;
  font-size: 16px;
}

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

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: var(--accent-strong);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover,
a:focus-visible {
  color: var(--accent);
}

.site-header {
  backdrop-filter: blur(18px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--border);
  width: 100%;
  box-shadow: 0 6px 24px rgba(31, 50, 94, 0.1);
}

.header-inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
}

.logo {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--accent-strong);
}

.main-nav {
  display: flex;
  gap: 0.75rem;
  flex: 1 1 auto;
  flex-wrap: wrap;
}

.moderators-dropdown {
  position: relative;
  margin-right: auto;
}

.moderators-button {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(47, 107, 255, 0.08);
  color: var(--accent-strong);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.moderators-button:hover,
.moderators-button:focus-visible {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.moderators-button[aria-expanded="true"] {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.dropdown-arrow {
  font-size: 0.7rem;
  transition: transform 0.2s ease;
}

.moderators-button[aria-expanded="true"] .dropdown-arrow {
  transform: rotate(180deg);
}

.moderators-overlay {
  display: none;
}

.moderators-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 280px;
  max-width: 320px;
  width: 280px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(31, 50, 94, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  z-index: 1000;
  height: 420px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.moderators-close {
  display: none;
}

.moderators-content {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.moderators-content::-webkit-scrollbar {
  width: 6px;
}

.moderators-content::-webkit-scrollbar-track {
  background: transparent;
}

.moderators-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.moderators-content::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.moderators-dropdown.active .moderators-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.moderator-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  transition: background 0.2s ease;
}

.moderator-item:hover,
.moderator-item:focus-visible {
  background: var(--surface-strong);
}

.moderator-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.moderator-avatar.placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1rem;
  flex-shrink: 0;
}

.moderator-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  min-width: 0;
}

.moderator-name {
  font-weight: 500;
  color: var(--text);
  font-size: 0.9rem;
}

.moderator-username {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.moderators-footer {
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.moderators-quote {
  margin: 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
}

.nav-link {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--accent-strong);
  border-color: var(--accent);
  background: rgba(47, 107, 255, 0.08);
}

.nav-link.active {
  background: var(--accent);
  color: #fff;
}

.search-form {
  position: relative;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.search-form input[type="search"] {
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  min-width: 200px;
  box-shadow: 0 0 0 transparent;
}

.search-form button {
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s ease;
}

.search-form button:hover,
.search-form button:focus-visible {
  background: var(--accent-strong);
}

.search-arrow-indicator {
  position: absolute;
  bottom: -2rem;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  pointer-events: none;
}

.arrow-down {
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 12px solid var(--accent);
  animation: bounce-arrow 2s infinite;
}

@keyframes bounce-arrow {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(8px);
  }
}

.site-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.site-footer {
  text-align: center;
  padding: 2rem 1.5rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
}

.hero {
  text-align: center;
  padding: 3rem 1rem;
  background: linear-gradient(135deg, rgba(47, 107, 255, 0.12), rgba(255, 255, 255, 0.95));
  border-radius: 24px;
  margin-bottom: 2.5rem;
  border: 1px solid var(--border);
  box-shadow: 0 18px 40px rgba(47, 107, 255, 0.12);
}

.hero h1 {
  margin-bottom: 0.5rem;
  font-size: 2.4rem;
}

.hero p {
  margin: 0;
  color: var(--text-muted);
}

.category-block {
  margin-bottom: 3rem;
}

.category-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1rem;
}

.category-header h2 {
  margin: 0;
}

.view-all {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.view-all:hover {
  color: #fff;
}

.articles-grid {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .articles-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

.card {
  background: var(--surface);
  border-radius: 18px;
  padding: 1.25rem;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: transform 0.2s ease, border-color 0.2s ease,
    box-shadow 0.2s ease;
  box-shadow: 0 12px 32px rgba(31, 50, 94, 0.08);
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 18px 44px rgba(31, 50, 94, 0.15);
}

.card.pinned {
  border-color: rgba(255, 196, 0, 0.5);
  background: linear-gradient(
    135deg,
    rgba(255, 219, 88, 0.22),
    rgba(255, 255, 255, 0.95)
  );
}

.card h2,
.card h3 {
  margin: 0;
  font-size: 1.25rem;
}

.card-excerpt {
  color: var(--text-muted);
  margin: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  line-clamp: 6;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.card-meta {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.card-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.card-actions {
  margin-top: auto;
  display: flex;
  justify-content: flex-start;
}

.card-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease,
    background 0.2s ease;
  white-space: nowrap;
}

.card-button:hover,
.card-button:focus-visible {
  background: var(--accent-strong);
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(47, 107, 255, 0.25);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: rgba(255, 196, 0, 0.18);
  color: #d99a00;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

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

.page-header h1 {
  margin: 0 0 0.5rem 0;
  font-size: 2rem;
}

.page-header p {
  margin: 0;
  color: var(--text-muted);
}

.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: 18px;
  background: rgba(47, 107, 255, 0.06);
}

.article-page {
  max-width: 850px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.article-header h1 {
  margin-top: 0.75rem;
  margin-bottom: 0;
  font-size: 2.2rem;
}

.article-author-card {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.25rem;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  box-shadow: 0 10px 24px rgba(31, 50, 94, 0.08);
}

.author-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(47, 107, 255, 0.2);
  background: #fff;
  flex-shrink: 0;
}

.author-avatar.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--accent-strong);
  background: rgba(47, 107, 255, 0.15);
}

.author-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.author-info.solo {
  margin-left: 0;
}

.author-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.author-name {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
}

.author-username {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  align-items: center;
}

.article-content {
  background: var(--surface);
  border-radius: 18px;
  padding: 2rem;
  border: 1px solid var(--border);
  font-size: 1.05rem;
  line-height: 1.7;
  box-shadow: 0 16px 32px rgba(31, 50, 94, 0.12);
  word-break: break-word;
  overflow-wrap: anywhere;
}

.article-content p {
  margin-bottom: 1rem;
}

.article-content img {
  max-width: 100%;
  border-radius: 12px;
}

.article-media {
  background: var(--surface);
  border-radius: 18px;
  padding: 1.5rem;
  border: 1px solid var(--border);
  box-shadow: 0 12px 28px rgba(31, 50, 94, 0.08);
}

.media-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.media-item {
  background: rgba(47, 107, 255, 0.08);
  border-radius: 14px;
  padding: 0.75rem;
  text-align: center;
  color: var(--accent-strong);
  border: 1px solid transparent;
  transition: transform 0.2s ease, border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.media-item:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 12px 26px rgba(47, 107, 255, 0.2);
}

.article-footer {
  display: flex;
  justify-content: flex-start;
}

.back-link {
  color: var(--accent-strong);
}

.back-link:hover {
  color: var(--accent);
}

.moderators-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.moderator-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s ease;
}

.moderator-card:hover,
.moderator-card:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(47, 107, 255, 0.15);
  transform: translateY(-2px);
}

.moderator-card-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.moderator-card-avatar.placeholder {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.moderator-card-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  min-width: 0;
}

.moderator-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.moderator-card-name {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.moderator-status {
  font-size: 0.85rem;
  padding: 0.2rem 0.5rem;
  border-radius: 12px;
  background: var(--surface-strong);
  color: var(--text-muted);
  white-space: nowrap;
}

.moderator-status-онлайн {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
}

.moderator-status-был-недавно {
  background: rgba(234, 179, 8, 0.15);
  color: #ca8a04;
}

.moderator-status-оффлайн {
  background: rgba(107, 114, 128, 0.15);
  color: #6b7280;
}

.moderator-status-не-в-сети {
  background: rgba(107, 114, 128, 0.15);
  color: #6b7280;
}

.moderator-card-username {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.moderators-quote-section {
  margin-top: 3rem;
  padding: 2rem;
  background: var(--surface-strong);
  border-radius: 12px;
  border: 1px solid var(--border);
  text-align: center;
}

.moderators-quote-text {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-muted);
  font-style: italic;
}

@media (max-width: 960px) {
  .header-inner {
    flex-wrap: wrap;
  }

  .search-form {
    width: 100%;
    justify-content: flex-start;
  }

  .moderators-dropdown {
    order: -1;
    margin-right: 0;
    margin-left: auto;
  }

  .moderators-menu {
    right: 0;
    left: auto;
    min-width: 280px;
    max-width: calc(100vw - 2rem);
  }
}

.error-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  padding: 3rem 1rem;
}

.error-content {
  text-align: center;
  max-width: 600px;
}

.error-content h1 {
  font-size: 8rem;
  font-weight: 700;
  margin: 0;
  color: var(--accent);
  line-height: 1;
}

.error-content h2 {
  font-size: 2rem;
  margin: 1rem 0;
  color: var(--text);
}

.error-content p {
  font-size: 1.125rem;
  color: var(--text-muted);
  margin: 1.5rem 0 1rem;
}

.error-hint {
  font-size: 0.95rem;
  color: var(--text-muted);
  opacity: 0.8;
  margin: 0.5rem 0 2.5rem;
  font-style: italic;
}

.error-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.button {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
}

.button.primary {
  background: var(--accent);
  color: white;
}

.button.primary:hover,
.button.primary:focus-visible {
  background: var(--accent-strong);
  color: white;
}

.button.secondary {
  background: var(--surface);
  color: var(--accent-strong);
  border: 1px solid var(--border);
}

.button.secondary:hover,
.button.secondary:focus-visible {
  background: var(--surface-strong);
  color: var(--accent);
}

.search-section {
  margin: 2rem 0;
  padding: 2rem;
  background: var(--surface);
  border-radius: 0.75rem;
  border: 1px solid var(--border);
}

.search-page-form {
  max-width: 600px;
  margin: 0 auto;
}

.search-input-wrapper {
  display: flex;
  gap: 0.75rem;
  align-items: stretch;
}

.search-input-wrapper input[type="search"] {
  flex: 1;
  padding: 0.875rem 1.25rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--bg-alt);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input-wrapper input[type="search"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.1);
}

.search-submit-button {
  padding: 0.875rem 2rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
}

.search-submit-button:hover,
.search-submit-button:focus-visible {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

.search-submit-button:active {
  transform: translateY(0);
}

@media (max-width: 640px) {
  .hero {
    padding: 2.5rem 1.25rem;
  }

  .site-main {
    padding: 1.5rem 1rem 3rem;
  }

  .articles-grid {
    grid-template-columns: 1fr;
  }

  .article-content {
    padding: 1.5rem;
  }

  .error-content h1 {
    font-size: 5rem;
  }

  .error-content h2 {
    font-size: 1.5rem;
  }

  .error-actions {
    flex-direction: column;
  }

  .button {
    width: 100%;
  }

  .search-section {
    padding: 1.5rem;
    margin: 1.5rem 0;
  }

  .search-input-wrapper {
    flex-direction: column;
  }

  .search-submit-button {
    width: 100%;
  }

  .header-inner {
    gap: 1rem;
    padding: 0.75rem 1rem;
  }

  .main-nav {
    gap: 0.5rem;
  }

  .nav-link {
    padding: 0.3rem 0.6rem;
    font-size: 0.9rem;
  }

  .moderators-button {
    padding: 0.3rem 0.65rem;
    font-size: 0.85rem;
    white-space: nowrap;
  }

  .moderators-overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 999;
  }

  .moderators-overlay.active {
    opacity: 1;
    visibility: visible;
  }

  .moderators-menu {
    position: fixed;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    right: auto;
    min-width: calc(100vw - 2rem);
    max-width: 400px;
    width: calc(100vw - 2rem);
    max-width: 400px;
    height: auto;
    max-height: calc(100vh - 4rem);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  }

  .moderators-dropdown.active .moderators-menu {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
  }

  .moderators-close {
    display: flex;
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    background: var(--surface-strong);
    border: 1px solid var(--border);
    border-radius: 50%;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--text);
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
    padding: 0;
    font-family: inherit;
  }

  .moderators-close:hover,
  .moderators-close:focus-visible {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    transform: rotate(90deg);
  }

  .moderators-content {
    padding-top: 2.5rem;
  }

  .moderator-item {
    padding: 0.6rem;
  }

  .moderator-avatar {
    width: 36px;
    height: 36px;
  }

  .moderator-avatar.placeholder {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }

  .moderator-name {
    font-size: 0.85rem;
  }

  .moderator-username {
    font-size: 0.75rem;
  }

  .moderators-quote {
    font-size: 0.8rem;
    padding: 0.4rem 0.6rem;
    line-height: 1.4;
  }

  .moderators-list {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .moderator-card {
    padding: 1rem;
  }

  .moderator-card-avatar {
    width: 56px;
    height: 56px;
  }

  .moderator-card-avatar.placeholder {
    width: 56px;
    height: 56px;
    font-size: 1.3rem;
  }

  .moderator-card-name {
    font-size: 1rem;
  }

  .moderator-card-username {
    font-size: 0.85rem;
  }

  .moderators-quote-section {
    margin-top: 2rem;
    padding: 1.5rem;
  }

  .moderators-quote-text {
    font-size: 0.95rem;
  }
}

