@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@600;700;800&display=swap");

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-hover: var(--primary-dark);
  --primary-light: #eff6ff;
  --primary-ring: rgba(37, 99, 235, 0.4);
  --cta-warm: #ea580c;
  --cta-warm-hover: #c2410c;
  --ink: #0f172a;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #e2e8f0;
  --surface: #ffffff;
  --bg: #f8fafc;
  --bg-muted: var(--bg);
  --text: var(--ink);
  --text-muted: var(--muted);
  --border: var(--line);
  --radius: 14px;
  --radius-lg: 24px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-hover: 0 12px 40px rgba(15, 23, 42, 0.1);
  --font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
  --prose-max: 40rem;
  --section-y: clamp(3rem, 5vw, 5.5rem);
  --section-y-tight: clamp(2.5rem, 4.5vw, 4.5rem);
}

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

html {
  scroll-behavior: smooth;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  font-family: var(--font);
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--bg);
  background-image: radial-gradient(ellipse 100% 52% at 50% 0%, rgba(37, 99, 235, 0.1), transparent 50%), linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.15s ease, background 0.15s ease;
}

a:hover {
  color: var(--primary-hover);
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ——— Верхняя навигация (только site header; не <header> статьи) ——— */
body > header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 4rem;
}

.logo {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.03em;
}

.logo span { color: var(--primary); }

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

.nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 16px;
  max-width: min(100%, 52rem);
}

.nav-links a:not(.btn) {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9rem;
  padding: 6px 0;
}

.nav-links a:not(.btn):hover {
  color: var(--ink);
}

.nav-links a.is-current:not(.btn) {
  color: var(--primary);
  font-weight: 600;
}

.nav-links a.btn {
  flex: 0 0 auto;
  padding: 11px 22px;
}

.nav-links a.btn-primary,
.nav-links a.btn-primary:hover {
  color: #fff;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 22px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
  transition: background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px var(--primary-ring);
}

.btn-primary:hover {
  background: var(--primary-hover);
  color: #fff;
  transform: translateY(-1px);
}

.btn-outline {
  border: 1.5px solid var(--border);
  color: var(--text);
  background: rgba(255, 255, 255, 0.6);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #fff;
  transform: translateY(-1px);
}

.burger {
  display: none;
  width: 44px;
  height: 44px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--ink);
}

.mobile-menu {
  position: fixed;
  top: 4rem;
  right: 0;
  width: 100%;
  max-width: 320px;
  height: calc(100vh - 4rem);
  background: var(--surface);
  box-shadow: -4px 0 20px rgba(15, 23, 42, 0.08);
  transform: translateX(100%);
  transition: transform 0.28s ease;
  z-index: 99;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.mobile-menu.open {
  transform: translateX(0);
}

.mobile-menu a {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--ink);
  font-weight: 500;
  font-size: 0.95rem;
}

.mobile-menu a.btn-primary,
.mobile-menu a.btn-primary:hover {
  color: #fff;
  border-bottom-color: transparent;
}

.mobile-overlay {
  position: fixed;
  inset: 0;
  top: 4rem;
  background: rgba(15, 23, 42, 0.35);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  z-index: 98;
}

.mobile-overlay.open {
  opacity: 1;
  visibility: visible;
}

@media (max-width: 900px) {
  .nav-links {
    display: none;
  }
  .burger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* ——— Блог: обложка списка ——— */
.blog-hero {
  padding: var(--section-y) 0;
  text-align: center;
  background: transparent;
  border-bottom: 1px solid var(--border);
}

.blog-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.6vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 12px;
}

.blog-hero p {
  max-width: 36rem;
  margin: 0 auto;
  color: var(--text-muted);
  font-size: 1.05rem;
  font-weight: 400;
  line-height: 1.55;
}

/* ——— Фильтр по темам ——— */
.blog-filters {
  margin-bottom: 28px;
}

.blog-filters__label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.blog-filters__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: center;
}

.blog-filter {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.25;
  color: var(--text-muted);
  background: #fff;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.blog-filter:hover {
  border-color: #cbd5e1;
  color: var(--text);
}

.blog-filter[aria-pressed="true"] {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.22);
}

.blog-filter[aria-pressed="true"]:hover {
  color: #fff;
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.blog-list-empty {
  margin: 0 0 8px;
  padding: 28px 20px;
  text-align: center;
  font-size: 0.95rem;
  color: var(--text-muted);
  background: var(--bg-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  line-height: 1.5;
}

.blog-list-empty[hidden] {
  display: none !important;
}

.blog-card.is-hidden {
  display: none !important;
}

/* Темы в шапке статьи: сразу под крошками, в одном стиле с ярлыком на карточке списка */
.blog-article-header .blog-article-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  margin: 0 0 18px;
  padding: 0;
}

.blog-article-tags a {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--primary);
  text-decoration: none;
  padding: 0;
  border: none;
  background: none;
  border-radius: 0;
}

.blog-article-tags a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
  background: none;
  border: none;
}

.blog-article-header .blog-article-tags a:not(:last-child)::after {
  content: "·";
  display: inline-block;
  margin: 0 10px 0 12px;
  color: #cbd5e1;
  font-weight: 600;
  text-decoration: none;
  pointer-events: none;
}

/* ——— Сетка карточек ——— */
.blog-list {
  padding: 48px 0 72px;
}

.blog-grid {
  display: grid;
  gap: 22px;
  grid-template-columns: 1fr;
}

@media (min-width: 560px) {
  .blog-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: 24px 26px;
  }
}

.blog-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 24px 22px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.blog-card:hover {
  border-color: rgba(37, 99, 235, 0.25);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.blog-card:focus-visible {
  outline-offset: 4px;
}

.blog-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-bottom: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.blog-card__cat {
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--primary);
}

.blog-card h2 {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 10px;
  color: var(--text);
  letter-spacing: -0.02em;
}

.blog-card p {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 16px;
  flex: 1;
}

.blog-card__more {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary);
  margin-top: auto;
}

.blog-card:hover .blog-card__more {
  color: var(--primary-hover);
}

/* ——— Хлебные крошки ——— */
.blog-breadcrumbs {
  padding: 20px 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.blog-breadcrumbs a {
  text-decoration: none;
  font-weight: 500;
}

.blog-breadcrumbs a:hover {
  text-decoration: underline;
}

.blog-breadcrumbs span[aria-current="page"] {
  color: var(--text);
  font-weight: 500;
}

/* ——— Страница статьи ——— */
.blog-article-wrap {
  padding: 24px 0 72px;
}

.blog-article-header {
  max-width: var(--prose-max);
  margin: 0 auto 40px;
  padding-top: 8px;
}

/* header + .container: не сужать шапку до 40rem с внутренним padding — тогда .blog-article-meta
   и h1 окажутся уже, чем .blog-prose (две «линии» рамки визуально съезжают) */
.blog-article-header.container {
  max-width: 1120px;
  width: 100%;
}

.blog-article-header.container > * {
  max-width: var(--prose-max);
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.blog-article-header .blog-breadcrumbs {
  padding-top: 0;
  margin-bottom: 12px;
}

.blog-article-kicker {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
  margin-bottom: 10px;
}

.blog-article-header h1 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.6vw, 2.4rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
  color: var(--text);
}

.blog-article-deck {
  font-size: 1.08rem;
  color: var(--text-muted);
  line-height: 1.55;
  font-weight: 400;
}

.blog-article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* ——— Тело статьи (типографика) ——— */
.blog-prose {
  max-width: var(--prose-max);
  margin: 0 auto;
  font-size: 1rem;
  color: var(--muted);
}

.blog-prose > * + * {
  margin-top: 1.1em;
}

.blog-prose h2 {
  font-family: var(--font-display);
  font-size: 1.28rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 2.2em;
  margin-bottom: 0.5em;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.blog-prose h2:first-child {
  margin-top: 0;
}

.blog-prose h3 {
  font-size: 1.08rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 1.75em;
  line-height: 1.35;
}

.blog-prose p {
  line-height: 1.7;
}

.blog-prose ul,
.blog-prose ol {
  padding-left: 1.35rem;
  line-height: 1.65;
}

.blog-prose li {
  margin-bottom: 0.45em;
}

.blog-prose strong {
  color: var(--text);
  font-weight: 600;
}

.blog-prose blockquote {
  margin: 1.5em 0;
  padding: 16px 20px;
  border-left: 3px solid var(--primary);
  background: var(--bg-muted);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-muted);
  font-style: normal;
  font-size: 0.98rem;
}

.blog-prose hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 2.5rem 0;
}

.blog-prose figure {
  margin: 2rem 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.blog-prose figcaption {
  padding: 10px 14px;
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--bg-muted);
}

.blog-prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin: 1.25em 0;
  line-height: 1.45;
}

.blog-prose th,
.blog-prose td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.65rem;
  text-align: left;
  vertical-align: top;
}

.blog-prose thead th {
  background: var(--bg-muted);
  font-weight: 600;
  color: var(--text);
}

.blog-prose tbody tr:nth-child(even) {
  background: rgba(15, 23, 42, 0.02);
}

.blog-prose .blog-signature {
  margin-top: 2.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.blog-prose pre {
  margin: 1rem 0;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 0.88rem;
  line-height: 1.5;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  white-space: pre-wrap;
  word-break: break-word;
}

.blog-prose h2[id],
.blog-prose h3[id] {
  scroll-margin-top: 5.5rem;
}

.blog-toc {
  margin: 0 0 2rem;
  padding: 18px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-muted);
  font-size: 0.92rem;
}

.blog-toc__label {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.blog-toc__list {
  margin: 0;
  padding-left: 1.25rem;
  line-height: 1.55;
}

.blog-toc__list > li {
  margin-bottom: 0.4em;
}

.blog-toc a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.blog-toc a:hover {
  color: #1d4ed8;
}

.blog-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.75rem;
  padding: 0.55rem 1.15rem;
  border-radius: 10px;
  font: 600 0.9rem/1.2 Roboto, system-ui, sans-serif;
  text-decoration: none;
  background: var(--primary, #2563eb);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease;
}

.blog-cta-btn:hover {
  background: #1d4ed8;
  color: #fff;
  text-decoration: none;
}

.blog-cta-btn:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: 2px;
}

.blog-prose blockquote .blog-cta-btn--block {
  margin-top: 10px;
}

.blog-lead-magnet {
  margin: 1.75rem 0;
  padding: 18px 20px;
  border-radius: var(--radius);
  border: 1px dashed rgba(37, 99, 235, 0.45);
  background: #f8fafc;
}

.blog-lead-magnet strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1rem;
  color: var(--text);
}

.blog-lead-magnet a {
  font-weight: 600;
}

.blog-lead-magnet p {
  margin: 0 0 10px;
}

.blog-lead-magnet p:last-child {
  margin-bottom: 0;
}

.blog-case-callout {
  margin: 1.75rem 0;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #fffbeb 0%, #fefce8 100%);
  border: 1px solid #fde68a;
  font-size: 0.96rem;
  color: #713f12;
}

.blog-case-callout strong {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #b45309;
  margin-bottom: 8px;
}

.blog-tip {
  margin: 1.75rem 0;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
  border: 1px solid #bfdbfe;
  font-size: 0.96rem;
  color: #334155;
}

.blog-tip strong {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  margin-bottom: 6px;
}

.blog-article-footer {
  max-width: var(--prose-max);
  margin: 48px auto 0;
  padding: 28px 0 0;
  border-top: 1px solid var(--border);
  background: transparent;
  color: inherit;
}

.blog-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  color: var(--primary);
}

.blog-back:hover {
  color: var(--primary-hover);
}

/* ——— Подвал сайта (только нижний блок страницы, не footer внутри статьи) ——— */
body > footer {
  background: #0f172a;
  color: #94a3b8;
  padding: var(--section-y) 0 2rem;
}

.footer-tagline {
  max-width: none;
  margin: 0 0 32px;
  font-size: 0.95rem;
  line-height: 1.6;
  white-space: nowrap;
}

.footer-tagline strong {
  color: #e2e8f0;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px 28px;
  padding-bottom: 8px;
}

.footer-heading {
  margin: 0 0 12px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #64748b;
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: 9px;
}

.footer-links a {
  color: #e2e8f0;
  text-decoration: none;
  font-size: 0.9rem;
  opacity: 0.9;
}

.footer-links a:hover {
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer-bottom {
  margin-top: 32px;
  padding-top: 22px;
  border-top: 1px solid #1e293b;
  font-size: 0.82rem;
  text-align: center;
  color: #64748b;
}

@media (max-width: 600px) {
  .blog-hero,
  body > footer {
    padding-top: var(--section-y-tight);
    padding-bottom: var(--section-y-tight);
  }
}

@media (max-width: 960px) {
  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .footer-tagline {
    white-space: normal;
  }
}
