@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --bg: #fafbfc;
  --text: #0f1419;
  --text-soft: #5b6b78;
  --primary: #2454a8;
  --primary-deep: #1b3f80;
  --primary-tint: #eaf1fb;
  --warm: #c9622a;
  --warm-deep: #a44f21;
  --warm-tint: #fdf1e8;
  --success: #10b981;
  --success-tint: #e7f9f3;
  --error: #ef4444;
  --error-tint: #feeeee;
  --border: #e2e6ea;
  --border-subtle: #edf0f2;
  --white: #ffffff;
  --ink: #0f1419; /* тёмный фон футера/спец-панели — тот же text, отдельное имя для читаемости */

  --radius-sm: 0.5rem;
  --radius: 0.75rem;
  --radius-lg: 1rem;
  --radius-pill: 999px;
  --shadow-card: 0 1px 3px rgba(15, 20, 25, 0.04);
  --shadow-card-hover: 0 4px 16px rgba(15, 20, 25, 0.08);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

  --content-width: 1240px;
  --measure: 68ch;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  font-size: 16px;
}

h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 0.5em;
}
h1 { font-size: clamp(1.9rem, 1.55rem + 1.4vw, 2.75rem); letter-spacing: -0.03em; }
h2 { font-size: clamp(1.35rem, 1.15rem + 0.7vw, 1.75rem); letter-spacing: -0.02em; }
h3 { font-size: 1.15rem; letter-spacing: -0.01em; }

p { margin: 0 0 1.1em; max-width: var(--measure); }
a { color: var(--primary); text-decoration-thickness: 1px; text-underline-offset: 2px; transition: color 0.2s var(--ease); }
a:hover { color: var(--primary-deep); }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px;
}

.wrap { max-width: var(--content-width); margin: 0 auto; padding: 0 24px; }

/* ---------- шапка: стеклянный эффект, подчёркивание слева направо ---------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(250, 251, 252, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 50;
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 64px; padding-top: 8px; padding-bottom: 8px; flex-wrap: wrap; gap: 10px 24px; }
.site-logo { font-weight: 700; font-size: 1.05rem; letter-spacing: -0.02em; color: var(--text); text-decoration: none; }
.site-logo span { color: var(--warm); }
.site-nav { display: flex; gap: 26px; font-size: 0.92rem; flex-wrap: wrap; }
.nav-link {
  position: relative; color: var(--text-soft); text-decoration: none; padding-bottom: 4px; white-space: nowrap;
}
.nav-link::after {
  content: ''; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--primary);
  border-radius: var(--radius-pill); transform: scaleX(0); transform-origin: left; transition: transform 0.25s var(--ease);
}
.nav-link:hover, .nav-link.active { color: var(--text); }
.nav-link:hover::after, .nav-link.active::after { transform: scaleX(1); }

.header-actions { display: flex; align-items: center; gap: 4px; }
.search-trigger {
  background: none; border: 1px solid var(--border); border-radius: var(--radius-sm); width: 34px; height: 34px; font-size: 1rem;
  color: var(--text-soft); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s var(--ease);
}
.search-trigger:hover { border-color: var(--primary); color: var(--primary); }

.nav-toggle { display: none; flex-direction: column; gap: 4px; background: none; border: none; cursor: pointer; padding: 6px; }
.nav-toggle span { width: 22px; height: 2px; background: var(--text); display: block; border-radius: 2px; }

/* ---------- поиск ---------- */
.search-overlay { display: none; position: fixed; inset: 0; background: rgba(15, 20, 25, 0.5); z-index: 100; padding: 80px 20px; overflow-y: auto; }
.search-overlay.open { display: block; }
.search-box {
  max-width: 640px; margin: 0 auto; background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-card-hover);
  display: flex; align-items: center; padding: 4px 4px 4px 18px;
}
.search-box input { flex: 1; border: none; padding: 14px 8px; font-size: 1.05rem; font-family: var(--font-sans); background: none; }
.search-box input:focus { outline: none; }
.search-box button { background: none; border: none; font-size: 1.1rem; color: var(--text-soft); cursor: pointer; padding: 10px 14px; }
.search-results { max-width: 640px; margin: 10px auto 0; background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); overflow: hidden; }
.search-hint { padding: 20px; color: var(--text-soft); margin: 0; font-size: 0.92rem; }
.search-result { display: flex; justify-content: space-between; gap: 12px; padding: 14px 18px; text-decoration: none; border-bottom: 1px solid var(--border-subtle); color: var(--text); }
.search-result:last-child { border-bottom: none; }
.search-result:hover { background: var(--bg); }
.search-result-title { font-size: 0.95rem; }
.search-result-cat { font-size: 0.78rem; color: var(--text-soft); white-space: nowrap; align-self: center; }

/* ---------- hero: воздушный, без тёмных блоков и градиентов ---------- */
.hero { padding: 68px 0 52px; border-bottom: 1px solid var(--border); }
.hero .kicker { font-size: 0.92rem; color: var(--text-soft); margin-bottom: 14px; }
.hero h1 { max-width: 17ch; margin-bottom: 0.35em; }
.hero-lede { color: var(--text-soft); font-size: 1.08rem; max-width: 52ch; margin-bottom: 0; }
.hero-stats { display: flex; gap: 40px; margin-top: 36px; padding-top: 26px; border-top: 1px solid var(--border-subtle); }
.hero-stats .stat-num { font-family: var(--font-mono); font-weight: 500; font-size: 1.9rem; color: var(--primary); display: block; }
.hero-stats .stat-label { font-size: 0.82rem; color: var(--text-soft); }

/* ---------- секция-заголовок с акцентной полоской ---------- */
.section-accent-bar { width: 48px; height: 3px; background: var(--primary); border-radius: var(--radius-pill); margin-bottom: 14px; }

/* ---------- контент + рекламная колонка ---------- */
.with-rail { display: grid; grid-template-columns: 1fr 300px; gap: 40px; align-items: start; }
.with-rail.no-ad { grid-template-columns: 1fr; }

.ad-rail { position: sticky; top: 80px; }
.ad-label { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.05em; color: var(--text-soft); margin-bottom: 10px; }
.ad-slot { border: 1px solid var(--border); border-radius: var(--radius); background: var(--white); min-height: 250px; padding: 10px; overflow: hidden; }

/* ---------- индекс категорий: премиум-карточки ---------- */
.index-section { padding: 52px 0 76px; }
.index-section .section-head { margin-bottom: 24px; }
.section-head h2 { margin: 0; }

.bento { display: grid; grid-template-columns: repeat(6, 1fr); gap: 18px; }
.bento-cell {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
  padding: 24px; grid-column: span 3; transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}
.bento-cell:hover { box-shadow: var(--shadow-card-hover); transform: translateY(-2px); }
.bento-cell.wide { grid-column: span 6; }
@media (min-width: 720px) {
  .bento-cell.large { grid-column: span 4; }
  .bento-cell.small { grid-column: span 2; }
}

.bento-cell h3 { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.bento-count { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-soft); font-weight: 400; }

.article-list { list-style: none; margin: 16px 0 0; padding: 0; }
.article-list li { border-top: 1px solid var(--border-subtle); }
.article-list li:first-child { border-top: none; }
.article-list a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; text-decoration: none; color: var(--text); font-size: 0.94rem; }
.article-list a:hover { color: var(--primary); }
.article-list .tag-commercial { font-family: var(--font-mono); font-size: 0.7rem; color: var(--warm-deep); white-space: nowrap; }

/* ---------- категорийные бейджи (мягкий фон + контрастный текст) ---------- */
.cat-badge { display: inline-block; font-size: 0.72rem; font-weight: 600; padding: 3px 10px; border-radius: var(--radius-pill); white-space: nowrap; }
.badge-cat-blue    { background: #e8f0fc; color: #1d4d8f; }
.badge-cat-teal     { background: #e3f6f4; color: #0f6e66; }
.badge-cat-amber    { background: #fdf1de; color: #92600b; }
.badge-cat-violet   { background: #f1ecfb; color: #5b3aa8; }
.badge-cat-green    { background: var(--success-tint); color: #0c7a5a; }
.badge-cat-orange   { background: var(--warm-tint); color: var(--warm-deep); }
.badge-cat-rust     { background: #fbebe7; color: #a33f2b; }
.badge-cat-slate    { background: #eceff2; color: #47535d; }

/* ---------- страница категории ---------- */
.page-head { padding: 40px 0 24px; }
.breadcrumb { font-size: 0.85rem; color: var(--text-soft); margin-bottom: 12px; }
.breadcrumb a { color: var(--text-soft); }
.plain-list { list-style: none; margin: 28px 0; padding: 0; max-width: var(--content-width); }
.plain-list li {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-card);
  padding: 16px 20px; margin-bottom: 10px; transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}
.plain-list li:hover { box-shadow: var(--shadow-card-hover); transform: translateY(-1px); }
.plain-list a { text-decoration: none; color: var(--text); font-size: 1.02rem; font-weight: 600; }
.plain-list a:hover { color: var(--primary); }

/* ---------- статья ---------- */
.article-shell { display: grid; grid-template-columns: 200px 1fr 300px; gap: 40px; padding: 36px 0 80px; align-items: start; }
.article-shell.no-ad { grid-template-columns: 200px 1fr; }

.spec-rail {
  position: sticky; top: 80px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--white);
  box-shadow: var(--shadow-card); padding: 18px; font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-soft);
}
.spec-rail dt { margin-top: 12px; color: var(--text-soft); }
.spec-rail dt:first-child { margin-top: 0; }
.spec-rail dd { margin: 2px 0 0; color: var(--text); font-weight: 500; }
.spec-rail hr { border: none; border-top: 1px solid var(--border-subtle); margin: 14px 0; }

.byline { color: var(--text-soft); font-size: 0.92rem; margin-bottom: 22px; }

.prose-premium, .article-body { line-height: 1.75; }
.article-body p { margin-bottom: 1.5em; }
.article-body h2 { margin-top: 1.7em; padding-top: 0.2em; }
.article-body h2:first-child { margin-top: 0; }
.article-body table {
  width: 100%; border-collapse: separate; border-spacing: 0; margin: 1.4em 0; font-size: 0.94rem;
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-card);
}
.article-body th, .article-body td { border-bottom: 1px solid var(--border-subtle); padding: 10px 14px; text-align: left; vertical-align: top; }
.article-body tr:last-child td { border-bottom: none; }
.article-body th { background: var(--bg); font-weight: 600; }
.article-body ul, .article-body ol { padding-left: 1.3em; max-width: var(--measure); }
.article-body li { margin-bottom: 0.4em; }
.article-body blockquote { border-left: 3px solid var(--warm); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 1.4em 0; padding: 0.6em 1.2em; background: var(--warm-tint); color: var(--text-soft); }
.article-body code {
  font-family: var(--font-mono); font-size: 0.9em; background: var(--primary-tint);
  border-radius: 4px; padding: 1px 6px; color: var(--primary-deep);
}
.article-body pre {
  font-family: var(--font-mono); font-size: 0.82rem; line-height: 1.6; border-radius: var(--radius);
  background: var(--ink); color: #cbd5dc; border: 1px solid var(--border); padding: 18px 20px; overflow-x: auto; margin: 1.5em 0;
}
.article-body pre code { background: none; padding: 0; color: inherit; }
.flag-check { background: var(--warm-tint); border-radius: 4px; color: var(--warm-deep); padding: 1px 6px; font-family: var(--font-mono); font-size: 0.85em; }

.siblings-box { margin-top: 52px; padding-top: 26px; border-top: 1px solid var(--border); }
.siblings-box h4 { font-size: 0.85rem; color: var(--text-soft); margin-bottom: 12px; font-weight: 600; }
.siblings-box ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.siblings-box a { text-decoration: none; font-size: 0.95rem; }

/* ---------- футер ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 48px 0 0; color: var(--text-soft); font-size: 0.88rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; padding-bottom: 32px; }
.footer-grid h5 { font-size: 0.8rem; color: var(--text); margin: 0 0 12px; font-weight: 600; }
.footer-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 0.86rem; }
.footer-links a { color: var(--text-soft); text-decoration: none; }
.footer-links a:hover { color: var(--primary); }
.footer-bottom { border-top: 1px solid var(--border); padding: 16px 0; font-size: 0.8rem; }
.not-found { padding: 100px 0; text-align: left; }

/* ---------- адаптив ---------- */
@media (max-width: 860px) {
  .bento { grid-template-columns: 1fr; }
  .bento-cell { grid-column: span 1 !important; }
  .article-shell { grid-template-columns: 1fr; }
  .spec-rail { position: static; }
  .hero-stats { gap: 24px; flex-wrap: wrap; }
  .with-rail { grid-template-columns: 1fr; }
  .ad-rail { display: none; }

  .nav-toggle { display: flex; }
  .site-nav {
    display: none; position: absolute; top: 64px; left: 0; right: 0; background: var(--white);
    border-bottom: 1px solid var(--border); flex-direction: column; gap: 0; padding: 8px 0; box-shadow: var(--shadow-card-hover);
  }
  .site-nav.open { display: flex; }
  .nav-link { padding: 12px 24px; }
  .nav-link::after { display: none; }
  .site-header .wrap { position: relative; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
