:root {
  --bg: #f4f5fb;
  --surface: #ffffff;
  --ink: #1d2140;
  --muted: #5b6080;
  --line: #e1e4f0;
  --brand: #3b3fd8;
  --brand-dark: #1b1f4b;
  --accent: #f2b33d;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(27, 31, 75, .08);
  --font: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.7 var(--font);
  overflow-x: hidden;
}

a { color: var(--brand); }
a:hover { color: var(--brand-dark); }
a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

img { max-width: 100%; }

.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 16px; }

.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 10;
  background: var(--brand-dark); color: #fff; padding: 8px 14px; border-radius: 8px;
}
.skip-link:focus { left: 8px; }

/* ---------- Шапка ---------- */
.site-header {
  background: var(--brand-dark);
  color: #fff;
  position: sticky; top: 0; z-index: 5;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .18);
}
.header-inner { display: flex; align-items: center; gap: 24px; min-height: 68px; }

.logo { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; flex-shrink: 0; }
.logo:hover { color: #fff; }
.logo-mark {
  display: grid; place-items: center;
  width: 42px; height: 42px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), #7b5cff);
  font-weight: 800; font-size: 13px; letter-spacing: .5px;
}
.logo-text { font-weight: 700; font-size: 20px; line-height: 1.1; }
.logo-text small { display: block; font-weight: 400; font-size: 12px; opacity: .75; }

.main-nav { margin-left: auto; min-width: 0; }
.main-nav ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.main-nav a {
  display: block; padding: 8px 12px; border-radius: 8px;
  color: #dfe1ff; text-decoration: none; font-size: 15px; white-space: nowrap;
}
.main-nav a:hover, .main-nav a[aria-current="page"] { background: rgba(255, 255, 255, .12); color: #fff; }

/* ---------- Сетка ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 32px;
  padding-top: 32px; padding-bottom: 48px;
  align-items: start;
}

.main, .sidebar { min-width: 0; }

.breadcrumbs ol { display: flex; flex-wrap: wrap; list-style: none; margin: 0 0 12px; padding: 0; font-size: 14px; color: var(--muted); }
.breadcrumbs li + li::before { content: "›"; margin: 0 8px; }

.post {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 40px;
}
.post h1 { font-size: 34px; line-height: 1.25; margin: 0 0 12px; }
.post-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 24px; color: var(--muted); font-size: 14px; }
.post-body h2 { font-size: 25px; line-height: 1.3; margin: 36px 0 12px; }
.post-body p, .post-body ul, .post-body ol { margin: 0 0 16px; }
.post-body li { margin-bottom: 8px; }
.post-body li::marker { color: var(--brand); }
.post-body .lead { font-size: 19px; color: #33385c; }
.post-body .note { font-size: 14px; color: var(--muted); }

/* ---------- Изображения в рамках ---------- */
.figure { margin: 28px 0; }
.frame {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #e9ebf7;
  box-shadow: 0 0 0 6px #fff, 0 0 0 7px var(--line), var(--shadow);
}
.frame img {
  position: absolute; inset: 0;
  display: block;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center;
}
.figure figcaption { margin-top: 14px; font-size: 14px; color: var(--muted); text-align: center; }

/* ---------- Таблицы ---------- */
.table-wrap { overflow-x: auto; margin: 0 0 20px; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.5; }
th, td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
thead th { background: #eef0fb; color: var(--brand-dark); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }

/* ---------- Боковая колонка ---------- */
.sidebar { position: sticky; top: 92px; }
.sidebar-title { font-size: 20px; margin: 0 0 14px; }
.cards { display: flex; flex-direction: column; gap: 18px; }
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(27, 31, 75, .14); }
.card-link { display: block; padding: 14px; color: var(--ink); text-decoration: none; }
.card-link:hover { color: var(--ink); }
.frame-sm { border-radius: 10px; box-shadow: none; }
.card-title { font-size: 17px; line-height: 1.35; margin: 12px 0 6px; }
.card-text { font-size: 14px; line-height: 1.5; color: var(--muted); margin: 0 0 8px; }
.card-more { font-size: 14px; font-weight: 600; color: var(--brand); }

/* ---------- Подвал ---------- */
.site-footer { background: var(--brand-dark); color: #c9cbea; font-size: 15px; }
.footer-top { border-bottom: 1px solid rgba(255, 255, 255, .1); }
.footer-top-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-top: 22px; padding-bottom: 22px; }
.footer-nav ul { display: flex; flex-wrap: wrap; gap: 8px 22px; list-style: none; margin: 0; padding: 0; }
.footer-nav a { color: #e4e6ff; text-decoration: none; }
.footer-nav a:hover { color: #fff; text-decoration: underline; }

.lang-switch { display: inline-flex; flex-shrink: 0; border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px; overflow: hidden; }
.lang-switch a { padding: 6px 16px; color: #fff; text-decoration: none; font-weight: 700; font-size: 14px; letter-spacing: .5px; }
.lang-switch a:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.lang-switch a.active { background: var(--accent); color: var(--brand-dark); }
.header-lang { flex-shrink: 0; }
.header-lang a { padding: 5px 13px; font-size: 13px; }

.footer-bottom-inner { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px 40px; padding-top: 28px; padding-bottom: 28px; }
.footer-about p { margin: 0 0 10px; line-height: 1.6; }
.age-notice { display: flex; align-items: center; gap: 14px; align-self: start; padding: 14px; border: 1px solid rgba(255, 255, 255, .15); border-radius: 12px; }
.age-icon { flex-shrink: 0; color: #ff6b6b; }
.age-notice p { margin: 0; line-height: 1.5; color: #fff; }
.copyright { grid-column: 1 / -1; margin: 6px 0 0; font-size: 13px; opacity: .7; }

/* ---------- Адаптив ---------- */
@media (max-width: 1080px) {
  .layout { grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; }
  .main-nav a { padding: 8px 9px; font-size: 14px; }
}

@media (max-width: 960px) {
  .header-inner { flex-wrap: wrap; gap: 6px 16px; padding-top: 10px; padding-bottom: 6px; }
  .header-lang { margin-left: auto; }
  .main-nav { order: 3; margin-left: 0; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .main-nav::-webkit-scrollbar { display: none; }
  .site-header { position: static; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-bottom-inner { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .layout { padding-top: 18px; }
  .post { padding: 22px 16px; border-radius: 12px; }
  .post h1 { font-size: 26px; }
  .post-body h2 { font-size: 21px; }
  .post-body .lead { font-size: 17px; }
  .frame { box-shadow: 0 0 0 4px #fff, 0 0 0 5px var(--line); }
  .cards { grid-template-columns: 1fr; }
  .footer-top-inner { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
}
