/* ===========================================================================
   Новостроежи София — editorial graphite/steel design system (v2)
   Static, self-contained. Pairs with /assets/site.js (progress bar, reveal,
   TOC highlight, mobile nav). Respects prefers-reduced-motion.
   =========================================================================== */

:root {
  --ink: #17202a;
  --ink-soft: #46525f;
  --ink-faint: #7a8794;
  --steel: #2f6d92;
  --steel-deep: #1d465e;
  --steel-bright: #3d8bb8;
  --paper: #f4f6f8;
  --paper-2: #eef1f4;
  --card: #ffffff;
  --line: #dbe2e8;
  --line-soft: #e8edf1;
  --accent: #c07d3e;
  --accent-soft: #f3e7d8;
  --tip: #2f8f6b;
  --tip-soft: #e6f4ee;
  --warn: #c1863b;
  --warn-soft: #f7ecd9;
  --note: #2f6d92;
  --note-soft: #e7f0f6;
  --shadow-sm: 0 2px 8px rgba(23, 32, 42, 0.05);
  --shadow-md: 0 12px 34px rgba(23, 32, 42, 0.09);
  --shadow-lg: 0 26px 64px rgba(23, 32, 42, 0.14);
  --radius: 14px;
  --radius-lg: 20px;
  --serif: Georgia, "Times New Roman", "DejaVu Serif", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --maxw: 1140px;
  --readw: 720px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17.5px;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }

/* Scroll progress bar */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: linear-gradient(90deg, var(--steel), var(--accent));
  z-index: 100; transition: width 90ms linear;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header-inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px 24px; max-width: var(--maxw); margin: 0 auto; padding: 14px 22px;
}
.site-logo {
  display: flex; align-items: center; gap: 10px;
  color: var(--ink); font-family: var(--serif); font-size: 20px; font-weight: 700;
  letter-spacing: 0.01em; text-decoration: none;
}
.site-logo svg { display: block; flex: none; }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.site-nav a {
  padding: 7px 11px; border-radius: 8px;
  color: var(--ink-soft); font-size: 14.5px; font-weight: 600; letter-spacing: 0.01em;
  text-decoration: none; transition: color 140ms ease, background 140ms ease;
}
.site-nav a:hover { color: var(--steel); background: var(--paper-2); }
.site-nav a[aria-current="page"] { color: var(--steel); background: var(--note-soft); }
.nav-toggle {
  display: none; align-items: center; justify-content: center;
  width: 42px; height: 38px; padding: 0; border: 1px solid var(--line);
  border-radius: 9px; background: var(--card); color: var(--ink); cursor: pointer;
}
.nav-toggle svg { display: block; }

/* ---------- Layout ---------- */
main { display: block; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

/* ---------- Breadcrumbs ---------- */
.breadcrumbs {
  max-width: var(--maxw); margin: 0 auto; padding: 16px 22px 0;
  font-size: 13px; color: var(--ink-faint);
}
.breadcrumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.breadcrumbs a { color: var(--ink-faint); text-decoration: none; }
.breadcrumbs a:hover { color: var(--steel); }
.breadcrumbs li:not(:last-child)::after { content: "›"; margin-left: 6px; color: var(--line); }
.breadcrumbs li[aria-current] { color: var(--ink-soft); }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(1100px 380px at 82% -12%, rgba(47, 109, 146, 0.12), transparent 60%),
    radial-gradient(760px 340px at 8% 120%, rgba(192, 125, 62, 0.10), transparent 60%),
    linear-gradient(180deg, #ffffff 0%, var(--paper) 100%);
}
.hero-inner { max-width: var(--maxw); margin: 0 auto; padding: 54px 22px 48px; }
.hero-home .hero-inner { padding: 74px 22px 60px; }
.eyebrow-tag {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 13px; margin: 0 0 18px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; box-shadow: var(--shadow-sm);
  color: var(--steel); font-size: 12.5px; font-weight: 700;
  letter-spacing: 0.07em; text-transform: uppercase;
}
.eyebrow-tag .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.hero h1 { margin: 0 0 16px; max-width: 15ch; }
.hero-home h1 { max-width: 18ch; }
.hero .lede { max-width: 62ch; font-size: 19.5px; color: var(--ink-soft); margin: 0; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }

/* Trust / stat strip under home hero */
.stat-strip {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  max-width: var(--maxw); margin: 0 auto; padding: 0;
  background: var(--line); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
}
.stat { background: var(--card); padding: 20px 18px; text-align: center; }
.stat b { display: block; font-family: var(--serif); font-size: 1.7rem; color: var(--ink); line-height: 1; }
.stat span { display: block; margin-top: 7px; font-size: 12.5px; color: var(--ink-faint); letter-spacing: 0.02em; }

/* ---------- Typography ---------- */
h1 { font-family: var(--serif); font-size: clamp(2rem, 4.6vw, 2.9rem); font-weight: 700; letter-spacing: -0.018em; line-height: 1.14; color: var(--ink); }
h2 { margin: 2em 0 0.55em; font-family: var(--serif); font-size: clamp(1.4rem, 2.7vw, 1.75rem); font-weight: 700; line-height: 1.24; color: var(--ink); scroll-margin-top: 84px; }
h3 { margin: 1.7em 0 0.5em; font-size: 1.13rem; font-weight: 700; color: var(--ink); }
p { margin: 0 0 1.15em; }
.lede { font-size: 19px; color: var(--ink-soft); }
article a, .prose a { color: var(--steel); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px; transition: color 140ms ease; }
article a:hover, .prose a:hover { color: var(--steel-deep); }
article ul, article ol, .prose ul, .prose ol { color: var(--ink-soft); padding-left: 1.35em; }
article li, .prose li { margin-bottom: 0.5em; }
article strong { color: var(--ink); }

/* ---------- Article layout with sticky TOC ---------- */
.article-shell { max-width: var(--maxw); margin: 0 auto; padding: 30px 22px 64px; }
.article-grid { display: grid; grid-template-columns: 1fr; gap: 0; }
.article-grid.has-toc { grid-template-columns: minmax(0, var(--readw)) 1fr; gap: 54px; justify-content: center; }
.article-body { min-width: 0; max-width: var(--readw); }
.article-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0 0 22px; color: var(--ink-faint); font-size: 13.5px; letter-spacing: 0.02em; }
.article-meta .sep { color: var(--line); }
article { padding: 0; }

/* Table of contents */
.toc { position: sticky; top: 96px; align-self: start; font-size: 14px; }
.toc-title { margin: 0 0 12px; font-size: 12px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-faint); }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.toc li { margin: 0; }
.toc a { display: block; padding: 6px 0 6px 15px; margin-left: -2px; border-left: 2px solid transparent; color: var(--ink-soft); text-decoration: none; line-height: 1.4; transition: color 140ms ease, border-color 140ms ease; }
.toc a:hover { color: var(--steel); }
.toc a.is-active { color: var(--steel); border-left-color: var(--steel); font-weight: 600; }

/* ---------- Key takeaways ---------- */
.takeaways {
  margin: 0 0 30px; padding: 22px 24px;
  background: linear-gradient(180deg, var(--note-soft), var(--card));
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.takeaways h2 { margin: 0 0 12px; font-size: 1rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--steel-deep); font-family: var(--sans); }
.takeaways ul { margin: 0; padding-left: 0; list-style: none; }
.takeaways li { position: relative; margin-bottom: 9px; padding-left: 28px; color: var(--ink-soft); font-size: 15.5px; }
.takeaways li::before { content: "✓"; position: absolute; left: 0; top: 0; width: 19px; height: 19px; color: var(--tip); font-weight: 700; }
.takeaways li:last-child { margin-bottom: 0; }

/* ---------- Callouts ---------- */
.callout { margin: 1.7em 0; padding: 18px 20px 18px 52px; position: relative; border-radius: 0 var(--radius) var(--radius) 0; font-size: 15.5px; color: var(--ink-soft); border-left: 4px solid var(--note); background: var(--note-soft); }
.callout::before { position: absolute; left: 18px; top: 17px; font-size: 18px; line-height: 1; }
.callout strong { color: var(--ink); }
.callout.tip { border-left-color: var(--tip); background: var(--tip-soft); }
.callout.tip::before { content: "💡"; }
.callout.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.callout.warn::before { content: "⚠️"; }
.callout.note { border-left-color: var(--note); background: var(--note-soft); }
.callout.note::before { content: "ℹ️"; }

/* ---------- Pull quote ---------- */
.pullquote { margin: 1.8em 0; padding: 6px 0 6px 26px; border-left: 3px solid var(--accent); font-family: var(--serif); font-size: 1.35rem; line-height: 1.4; color: var(--ink); }

/* ---------- Cards / grids ---------- */
.section-head { max-width: var(--maxw); margin: 0 auto; padding: 52px 22px 0; }
.section-head .eyebrow { color: var(--steel); font-size: 12.5px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; margin: 0 0 8px; }
.section-head h2 { margin: 0; scroll-margin-top: 84px; }
.section-head p { max-width: 60ch; margin: 12px 0 0; color: var(--ink-soft); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; max-width: var(--maxw); margin: 0 auto; padding: 30px 22px 8px; }
.card {
  display: flex; flex-direction: column; padding: 26px 24px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; box-shadow: var(--shadow-sm);
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}
.card:hover { border-color: var(--steel-bright); transform: translateY(-3px); box-shadow: var(--shadow-md); }
.card-icon { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-bottom: 16px; border-radius: 11px; background: var(--note-soft); color: var(--steel); }
.card-icon svg { display: block; }
.card-kicker { display: block; margin-bottom: 8px; color: var(--steel); font-size: 11.5px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; }
.card h2, .card h3 { margin: 0 0 8px; font-family: var(--serif); font-size: 1.2rem; color: var(--ink); }
.card p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--ink-soft); }
.card .card-more { margin-top: 14px; color: var(--steel); font-size: 14px; font-weight: 600; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 1.5em 0 1.9em; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; background: var(--card); font-size: 15.5px; }
th, td { padding: 12px 15px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
th { background: var(--paper-2); color: var(--ink); font-size: 13px; letter-spacing: 0.02em; text-transform: uppercase; }
td { color: var(--ink-soft); }
tr:last-child td { border-bottom: 0; }

/* ---------- FAQ accordion ---------- */
.faq { margin: 1.6em 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--card); box-shadow: var(--shadow-sm); }
.faq details { border-bottom: 1px solid var(--line-soft); }
.faq details:last-child { border-bottom: 0; }
.faq summary { list-style: none; cursor: pointer; padding: 17px 46px 17px 20px; position: relative; font-weight: 700; color: var(--ink); font-size: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 20px; top: 50%; transform: translateY(-50%); font-size: 22px; font-weight: 400; color: var(--steel); transition: transform 200ms ease; }
.faq details[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.faq .faq-a { padding: 0 20px 18px; color: var(--ink-soft); font-size: 15.5px; }
.faq .faq-a p { margin: 0; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 22px; border-radius: 10px; font-size: 15px; font-weight: 700; text-decoration: none; cursor: pointer; transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease; }
.btn-primary { background: var(--steel); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--steel-deep); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-ghost { background: var(--card); color: var(--steel); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--steel-bright); color: var(--steel-deep); }

/* ---------- Related articles ---------- */
.related { max-width: var(--readw); margin: 44px auto 0; padding: 26px 0 0; border-top: 1px solid var(--line); }
.related h2 { margin: 0 0 16px; font-size: 1.15rem; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.related-card { display: block; padding: 16px 18px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; transition: border-color 160ms ease, transform 160ms ease; }
.related-card:hover { border-color: var(--steel-bright); transform: translateY(-2px); }
.related-card .rc-kicker { display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--steel); margin-bottom: 5px; }
.related-card b { color: var(--ink); font-family: var(--serif); font-size: 1.02rem; font-weight: 700; }

/* ---------- CTA band ---------- */
.cta-band { position: relative; overflow: hidden; margin: 0; background: linear-gradient(135deg, var(--steel-deep), var(--steel)); color: #fff; }
.cta-inner { max-width: var(--maxw); margin: 0 auto; padding: 48px 22px; display: grid; grid-template-columns: 1.6fr 1fr; gap: 28px; align-items: center; }
.cta-inner h2 { margin: 0 0 10px; color: #fff; }
.cta-inner p { margin: 0; color: rgba(255,255,255,0.86); }
.cta-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; }
.cta-band .btn-primary { background: #fff; color: var(--steel-deep); }
.cta-band .btn-primary:hover { background: var(--accent-soft); }
.cta-band .btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,0.5); }
.cta-band .btn-ghost:hover { border-color: #fff; color: #fff; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 0; padding: 46px 0 34px; background: var(--steel-deep); color: #c6d4de; font-size: 14.5px; }
.site-footer-inner { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 28px; max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }
.site-footer h4 { margin: 0 0 12px; color: #fff; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; }
.site-footer p { margin: 0 0 8px; color: #a9bece; line-height: 1.6; }
.site-footer ul { margin: 0; padding: 0; list-style: none; }
.site-footer li { margin-bottom: 8px; }
.site-footer a { color: #dce7ef; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.footer-brand .site-logo { color: #fff; margin-bottom: 12px; }
.footer-legal { max-width: var(--maxw); margin: 30px auto 0; padding: 20px 22px 0; border-top: 1px solid rgba(255,255,255,0.14); color: #8ba3b5; font-size: 12.5px; }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 620ms cubic-bezier(0.22,1,0.36,1), transform 620ms cubic-bezier(0.22,1,0.36,1); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Mobile ---------- */
@media (max-width: 940px) {
  .article-grid.has-toc { grid-template-columns: 1fr; gap: 0; }
  .toc { display: none; }
  .cta-inner { grid-template-columns: 1fr; }
  .cta-actions { justify-content: flex-start; }
  .site-footer-inner { grid-template-columns: 1fr 1fr; gap: 26px 20px; }
}
@media (max-width: 640px) {
  body { font-size: 17px; }
  .nav-toggle { display: inline-flex; }
  .site-nav { display: none; flex-direction: column; align-items: stretch; width: 100%; gap: 2px; padding-top: 8px; }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 11px 12px; }
  .hero-inner, .hero-home .hero-inner { padding: 44px 22px 40px; }
  .stat-strip { grid-template-columns: 1fr 1fr; }
  .site-footer-inner { grid-template-columns: 1fr; }
  .stat b { font-size: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .card:hover, .related-card:hover, .btn:hover { transform: none; }
}
