/* ── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:      #6366f1;
  --primary-dark: #4f46e5;
  --bg:           #ffffff;
  --bg-alt:       #f8f9fa;
  --bg-card:      #ffffff;
  --text:         #1a1a2e;
  --text-muted:   #6b7280;
  --border:       #e5e7eb;
  --radius:       12px;
  --radius-sm:    8px;
  --shadow:       0 2px 12px rgba(0,0,0,.08);
  --shadow-hover: 0 8px 24px rgba(0,0,0,.12);
  --header-h:     64px;
  --font:         'Inter', system-ui, -apple-system, sans-serif;
  --transition:   0.2s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }

/* ── Container ──────────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.container-narrow { max-width: 760px; }

/* ── Typography ─────────────────────────────────────────────────────────────── */
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 700; line-height: 1.2; }
h2 { font-size: clamp(1.4rem, 3vw, 2rem);   font-weight: 600; line-height: 1.3; }
h3 { font-size: 1.2rem; font-weight: 600; }

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

/* Prose — форматирование текстового контента */
.prose { line-height: 1.8; color: var(--text); }
.prose p  { margin-bottom: 1rem; }
.prose h2 { margin: 2rem 0 1rem; }
.prose h3 { margin: 1.5rem 0 .75rem; }
.prose ul, .prose ol { margin: 1rem 0 1rem 1.5rem; }
.prose li { margin-bottom: .4rem; }
.prose a  { color: var(--primary); text-decoration: underline; }
.prose img { border-radius: var(--radius); margin: 1.5rem 0; }
.prose blockquote {
  border-left: 4px solid var(--primary);
  padding: .75rem 1.25rem;
  margin: 1.5rem 0;
  background: var(--bg-alt);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-muted);
}
.prose pre {
  background: #1a1a2e;
  color: #e5e5e5;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 1.5rem 0;
}

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .65rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: .95rem;
  cursor: pointer;
  transition: all var(--transition);
  border: 2px solid transparent;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(99,102,241,.35);
}
.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline:hover {
  background: var(--primary);
  color: #fff;
}

/* ── Header ─────────────────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 2rem;
}

/* Логотип */
.site-logo { display: flex; align-items: center; text-decoration: none; flex-shrink: 0; }
.logo-img  { height: 36px; width: auto; }
.logo-text {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
}

/* Навигация */
.site-nav { flex: 1; }
.site-nav ul {
  display: flex;
  align-items: center;
  gap: .25rem;
  list-style: none;
}
.site-nav a {
  padding: .45rem .8rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .9rem;
  font-weight: 500;
  transition: all var(--transition);
}
.site-nav a:hover,
.site-nav a.active {
  color: var(--primary);
  background: rgba(99,102,241,.08);
}

/* Переключатель языков */
.lang-switcher { display: flex; gap: .25rem; }
.lang-btn {
  padding: .3rem .6rem;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition);
  text-decoration: none;
}
.lang-btn:hover, .lang-btn.active {
  background: var(--primary);
  color: #fff;
}

/* Бургер */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: .4rem;
  margin-left: auto;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all var(--transition);
}

/* ── Sections ───────────────────────────────────────────────────────────────── */
.section         { padding: 4rem 0; }
.section-alt     { background: var(--bg-alt); }
.section-compact { padding: 2rem 0; }

.section-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 2rem;
  color: var(--text);
}

/* ── Hero ───────────────────────────────────────────────────────────────────── */
.hero {
  padding: 5rem 0 4rem;
  background: linear-gradient(135deg, rgba(99,102,241,.06) 0%, transparent 60%);
  border-bottom: 1px solid var(--border);
}
.hero-title { margin-bottom: 1.25rem; }
.hero-text  { max-width: 640px; color: var(--text-muted); margin-bottom: 2rem; font-size: 1.1rem; }

/* ── Page Hero ──────────────────────────────────────────────────────────────── */
.page-hero {
  padding: 3rem 0 2.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}
.page-hero h1 { margin-top: .5rem; }

/* ── Breadcrumb ─────────────────────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .4rem;
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: .75rem;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span { color: var(--border); }
.breadcrumb [aria-current] { color: var(--text); font-weight: 500; }

/* ── Cards Grid ─────────────────────────────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
}
.card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}
.card-link { text-decoration: none; color: inherit; }
.card-body { padding: 1.5rem; flex: 1; }
.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .5rem;
}
.card-title a { color: var(--text); }
.card-title a:hover { color: var(--primary); }
.card-text  { color: var(--text-muted); font-size: .9rem; line-height: 1.6; }
.card-arrow { padding: 1rem 1.5rem; color: var(--primary); font-weight: 600; font-size: 1.1rem; }
.card-footer-link {
  display: block;
  padding: .85rem 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--primary);
  font-size: .9rem;
  font-weight: 500;
  transition: background var(--transition);
}
.card-footer-link:hover { background: rgba(99,102,241,.05); }

/* ── Articles Grid ──────────────────────────────────────────────────────────── */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
}
.article-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.article-card__body { padding: 1.5rem; }
.article-card__cat {
  display: inline-block;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--primary);
  margin-bottom: .6rem;
}
.article-card__title { font-size: 1.05rem; margin-bottom: .5rem; }
.article-card__title a { color: var(--text); }
.article-card__title a:hover { color: var(--primary); }
.article-card__desc { color: var(--text-muted); font-size: .9rem; margin-bottom: .75rem; }
.article-card__link { font-size: .9rem; font-weight: 600; color: var(--primary); }
.article-card__date { display: block; font-size: .8rem; color: var(--text-muted); margin-top: .75rem; }

/* ── Subcategory list ───────────────────────────────────────────────────────── */
.subcategory-list {
  list-style: none;
  margin-top: .75rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.subcategory-list a { font-size: .9rem; color: var(--text-muted); }
.subcategory-list a:hover { color: var(--primary); }

/* ── Tags ───────────────────────────────────────────────────────────────────── */
.tags-list { display: flex; flex-wrap: wrap; gap: .5rem; }
.tag {
  padding: .4rem .9rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: .85rem;
  color: var(--text);
  transition: all var(--transition);
}
.tag:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Pagination ─────────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 2.5rem;
}
.pagination__btn {
  padding: .6rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-weight: 500;
  transition: all var(--transition);
}
.pagination__btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination__info { color: var(--text-muted); font-size: .9rem; }

/* ── Article Layout ─────────────────────────────────────────────────────────── */
.article-cover { max-height: 460px; overflow: hidden; }
.article-cover__img { width: 100%; height: 460px; object-fit: cover; }

.article-layout { padding: 3rem 0; }
.article-wrap   { max-width: 780px; }

.article-header { margin-bottom: 2rem; }
.article-category {
  display: inline-block;
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--primary);
  margin-bottom: .6rem;
}
.article-title  { font-size: clamp(1.6rem, 3.5vw, 2.4rem); }
.article-content { margin-top: 1.5rem; }

/* ── Media Gallery ──────────────────────────────────────────────────────────── */
.media-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .75rem;
  margin-top: 2rem;
}
.gallery-item { border-radius: var(--radius-sm); overflow: hidden; aspect-ratio: 1; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.gallery-item:hover img { transform: scale(1.05); }

/* ── Related articles ───────────────────────────────────────────────────────── */
.related-articles { margin-top: 4rem; padding-top: 2rem; border-top: 1px solid var(--border); }

/* ── Category desc ──────────────────────────────────────────────────────────── */
.category-desc { margin-top: .75rem; color: var(--text-muted); font-size: 1.05rem; }

/* ── Error Page ─────────────────────────────────────────────────────────────── */
.error-page    { display: flex; align-items: center; justify-content: center; min-height: 60vh; }
.error-inner   { text-align: center; padding: 2rem; }
.error-code    { font-size: 7rem; font-weight: 800; color: var(--primary); line-height: 1; }
.error-title   { font-size: 2rem; margin: .75rem 0 .5rem; }
.error-desc    { color: var(--text-muted); margin-bottom: 2rem; }

/* ── Page content ───────────────────────────────────────────────────────────── */
.page-content  { max-width: 780px; }

/* ── Footer ─────────────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--text);
  color: rgba(255,255,255,.7);
  padding: 3rem 0 0;
  margin-top: 5rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 2.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.footer-brand { flex: 1; min-width: 200px; }
.footer-brand .logo-text { color: #fff; }
.footer-desc  { color: rgba(255,255,255,.45); font-size: .85rem; margin-top: .5rem; }

.footer-nav ul { list-style: none; display: flex; flex-direction: column; gap: .5rem; }
.footer-nav a  { color: rgba(255,255,255,.6); font-size: .9rem; transition: color var(--transition); }
.footer-nav a:hover { color: #fff; }

.footer-langs { display: flex; gap: .35rem; align-items: flex-start; }
.footer-langs .lang-btn { color: rgba(255,255,255,.5); }
.footer-langs .lang-btn:hover,
.footer-langs .lang-btn.active { background: var(--primary); color: #fff; }

.footer-bottom {
  padding: 1.25rem 0;
  text-align: center;
  font-size: .85rem;
  color: rgba(255,255,255,.4);
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .site-nav {
    display: none;
    position: fixed;
    inset: var(--header-h) 0 0 0;
    background: var(--bg);
    padding: 1.5rem;
    z-index: 99;
    overflow-y: auto;
  }
  .site-nav.open { display: block; }
  .site-nav ul   { flex-direction: column; gap: .25rem; }
  .site-nav a    { font-size: 1rem; padding: .7rem 1rem; }

  .nav-toggle { display: flex; }

  .hero { padding: 3rem 0; }

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

  .article-cover__img { height: 240px; }
  .article-wrap { max-width: 100%; }

  .footer-inner { flex-direction: column; gap: 1.5rem; }
  .footer-nav ul { flex-direction: row; flex-wrap: wrap; gap: .5rem 1.5rem; }
}

@media (max-width: 480px) {
  .section { padding: 2.5rem 0; }
  h1 { font-size: 1.7rem; }
  .error-code { font-size: 5rem; }
}
