/* ================================================================
   ГИПЕРТРЕЙД — СТИЛИ БЛОГА
   Подключается в каждой статье:
     Локально:  <link rel="stylesheet" href="css/blog.css">
     На сервере: <link rel="stylesheet" href="/css/blog.css">
   ================================================================ */

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

:root {
  --theme-bg:           #FFFFFF;
  --theme-surface:      #F3F4F6;
  --theme-text:         #111827;
  --theme-muted-text:   #4B5563;
  --theme-primary:      #E11D48;
  --theme-primary-text: #FFFFFF;
  --theme-accent:       #2563EB;
  --theme-border:       #D1D5DB;
  --radius-sm:   6px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-pill: 100px;
  --font-xs:   0.72rem;
  --font-sm:   0.85rem;
  --font-base: 1rem;
  --font-md:   1.125rem;
  --font-weight-medium:    500;
  --font-weight-semibold:  600;
  --font-weight-bold:      700;
  --font-weight-extrabold: 800;
}

html { font-size: 16px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--theme-bg);
  color: var(--theme-text);
  line-height: 1.6;
}

a { color: var(--theme-accent); }
a:hover { opacity: 0.8; }
img { max-width: 100%; height: auto; display: block; }

/* ── CONTAINER — 1200px, для nav и footer ── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── NAV ── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--theme-bg);
  border-bottom: 1px solid var(--theme-border);
  backdrop-filter: blur(8px);
}
.nav-inner {
  display: flex;
  align-items: center;
  height: 64px;
  gap: 24px;
}
.nav-logo {
  font-size: 1.25rem;
  font-weight: var(--font-weight-extrabold);
  color: var(--theme-text);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.nav-logo span { color: var(--theme-primary); }

.btn-primary {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  padding: 10px 22px;
  font-size: 0.875rem;
  font-weight: var(--font-weight-semibold);
  background: var(--theme-primary);
  color: #FFFFFF;
  border: 2px solid var(--theme-primary);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: opacity 0.2s, transform 0.15s;
  white-space: nowrap;
}
.btn-primary:hover { opacity: 0.88; transform: translateY(-1px); color: #FFFFFF; }
.btn-primary:focus-visible { outline: 3px solid var(--theme-accent); outline-offset: 3px; }

/* ── BLOG HERO ── */
.blog-hero {
  padding: 64px 0 40px;
  border-bottom: 1px solid var(--theme-border);
}
.blog-breadcrumb {
  font-size: var(--font-sm);
  color: var(--theme-muted-text);
  margin-bottom: 24px;
}
.blog-breadcrumb a { color: var(--theme-muted-text); text-decoration: none; }
.blog-breadcrumb a:hover { color: var(--theme-primary); }
.blog-breadcrumb span { margin: 0 6px; }

.article-title {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: var(--font-weight-bold);
  line-height: 1.2;
  color: var(--theme-text);
  max-width: 760px;
  margin: 0 auto;
}

/* ── ARTICLE CONTENT ── */
.blog-content { padding: 48px 0 80px; }

/* Текст центрирован: одинаковые поля слева и справа */
.article-body {
  max-width: 760px;
  margin: 0 auto;
}

.article-body h2 {
  font-size: clamp(1.25rem, 2.5vw, 1.625rem);
  font-weight: var(--font-weight-bold);
  color: var(--theme-text);
  margin: 48px 0 16px;
  line-height: 1.3;
}
.article-body h2:first-child { margin-top: 0; }

.article-body h3 {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  font-weight: var(--font-weight-semibold);
  color: var(--theme-text);
  margin: 32px 0 12px;
}

.article-body p {
  color: var(--theme-muted-text);
  margin-bottom: 20px;
  line-height: 1.75;
  font-size: var(--font-base);
}

.article-body ul,
.article-body ol {
  color: var(--theme-muted-text);
  margin: 0 0 20px 24px;
  line-height: 1.75;
}
.article-body li { margin-bottom: 8px; }

.article-body strong {
  color: var(--theme-text);
  font-weight: var(--font-weight-semibold);
}

.article-body code {
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  font-size: 0.9em;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.article-body hr {
  border: none;
  border-top: 1px solid var(--theme-border);
  margin: 40px 0;
}

/* ── ТАБЛИЦЫ ── */
.table-wrap {
  overflow-x: auto;
  margin: 0 0 28px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--theme-border);
}
.article-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-sm);
}
.article-body th {
  background: var(--theme-surface);
  color: var(--theme-text);
  font-weight: var(--font-weight-semibold);
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--theme-border);
}
.article-body td {
  padding: 12px 16px;
  color: var(--theme-muted-text);
  border-bottom: 1px solid var(--theme-border);
}
.article-body tr:last-child td { border-bottom: none; }
.article-body tr:hover td { background: var(--theme-surface); }

/* ── ИЛЛЮСТРАЦИИ ── */
.article-figure {
  margin: 32px 0 36px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid var(--theme-border);
}
.article-figure img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}
.article-figure figcaption {
  padding: 12px 20px;
  font-size: var(--font-sm);
  color: var(--theme-muted-text);
  background: var(--theme-surface);
  border-top: 1px solid var(--theme-border);
}

/* ── ФИНАЛЬНЫЙ CTA ── */
.cta-final {
  background: var(--theme-text);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  margin: 48px 0 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.cta-final::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}
.cta-final h2 {
  color: #FFFFFF;
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  margin-bottom: 12px;
  position: relative;
}
.cta-final p {
  color: rgba(255,255,255,0.65);
  margin-bottom: 28px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
  position: relative;
}
.btn-white {
  display: inline-flex;
  align-items: center;
  padding: 14px 32px;
  font-size: 1rem;
  font-weight: var(--font-weight-semibold);
  background: #FFFFFF;
  color: var(--theme-text);
  border: 2px solid #FFFFFF;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: opacity 0.2s, transform 0.15s;
  position: relative;
}
.btn-white:hover { opacity: 0.9; transform: translateY(-1px); color: var(--theme-text); }
.btn-white:focus-visible { outline: 3px solid var(--theme-accent); outline-offset: 3px; }

/* ── FOOTER ── */
.footer {
  background: var(--theme-text);
  padding: 32px 0;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-logo {
  font-size: 1.1rem;
  font-weight: var(--font-weight-extrabold);
  color: var(--theme-primary-text);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.footer-logo span { color: var(--theme-primary); }
.footer-copy { font-size: 0.8rem; color: rgba(255,255,255,0.65); }
.footer-copy a { color: rgba(255,255,255,0.65); text-decoration: underline; }

/* ── АДАПТИВНОСТЬ ── */
@media (max-width: 768px) {
  .blog-hero  { padding: 40px 0 24px; }
  .cta-final  { padding: 40px 24px; }
  .container  { padding: 0 16px; }
}
@media (max-width: 480px) {
  .btn-white,
  .btn-primary { width: 100%; justify-content: center; }
}