/* ========================================================
   Помощник Самозанятого - Shared Design System (2026)
   Единые токены, типографика и компоненты для всех
   публичных страниц вне React-приложения.
   ========================================================
   Подключается на: landing, calculator, pension-calculator,
   sick-leave-calculator, tax-compare, about, faq, privacy,
   terms, blog-* (8 шт)
   ========================================================
   Lighthouse-friendly: minimal CSS, no @import, system fallback fonts.
   A11y: skip-link, focus-visible, prefers-reduced-motion.
   ======================================================== */

:root {
  /* Палитра (OKLCH editorial bg + терракотовый акцент) */
  --bg: #FBFAF7;
  --bg-warm: #F5F2EC;
  --surface: #FFFFFF;
  --ink: #1A1D23;
  --ink-mid: #5A5D65;
  --ink-soft: #9A9DA5;
  --accent: #C0673A;
  --accent-bg: oklch(0.72 0.10 38 / 0.08);
  --accent-deep: oklch(0.50 0.14 38);
  --trust: #3B4F6B;
  --trust-bg: oklch(0.42 0.04 255 / 0.06);
  --green: #2D7D46;
  --green-bg: oklch(0.55 0.08 160 / 0.08);
  --gold: #B8860B;
  --gold-bg: oklch(0.65 0.10 60 / 0.08);
  --rose: #8B3A3A;
  --rose-bg: oklch(0.50 0.08 10 / 0.08);
  --purple: #6B4C8A;
  --purple-bg: oklch(0.60 0.10 290 / 0.08);
  --border: oklch(0.45 0.02 80 / 0.10);
  --border-strong: oklch(0.45 0.02 80 / 0.18);

  /* Скругления */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Тени (по слоям) */
  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.04), 0 1px 3px oklch(0 0 0 / 0.06);
  --shadow-md: 0 4px 12px oklch(0 0 0 / 0.06), 0 1px 3px oklch(0 0 0 / 0.04);
  --shadow-lg: 0 16px 48px oklch(0 0 0 / 0.10), 0 4px 12px oklch(0 0 0 / 0.06);
  --shadow-xl: 0 24px 72px oklch(0 0 0 / 0.14), 0 8px 16px oklch(0 0 0 / 0.06);

  /* Layout */
  --max-w: 1180px;
  --header-h: 70px;

  /* Шрифты */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, 'SF Mono', Consolas, monospace;
}

/* ========== Dark theme ========== */
html[data-theme="dark"] {
  --bg: #1A1916;
  --bg-warm: #221F1A;
  --surface: #2A2722;
  --ink: #F0EDE6;
  --ink-mid: #B8B4AB;
  --ink-soft: #7B786F;
  --accent: #D88860;
  --accent-bg: oklch(0.78 0.13 38 / 0.14);
  --accent-deep: oklch(0.85 0.12 38);
  --green: #6BBE7E;
  --green-bg: oklch(0.78 0.13 160 / 0.14);
  --gold: #E0B660;
  --gold-bg: oklch(0.80 0.12 80 / 0.14);
  --rose: #D27575;
  --rose-bg: oklch(0.72 0.12 10 / 0.14);
  --trust: #8FA5C2;
  --trust-bg: oklch(0.68 0.06 255 / 0.14);
  --border: oklch(0.95 0.02 75 / 0.08);
  --border-strong: oklch(0.95 0.02 75 / 0.16);
  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.30), 0 1px 3px oklch(0 0 0 / 0.40);
  --shadow-md: 0 4px 12px oklch(0 0 0 / 0.30), 0 1px 3px oklch(0 0 0 / 0.40);
  --shadow-lg: 0 16px 48px oklch(0 0 0 / 0.45), 0 4px 12px oklch(0 0 0 / 0.30);
  --shadow-xl: 0 24px 72px oklch(0 0 0 / 0.55), 0 8px 16px oklch(0 0 0 / 0.30);
  color-scheme: dark;
}

/* Smooth theme switch */
html { transition: background-color 0.4s ease, color 0.4s ease; }
body, .site-header, .site-footer, .calc-card, .feature, .pricing-card,
.platform, .case-card, .team-card, .story-block, .faq-item, .compare-wrap,
.testimonial-card, .audience-card, .trust-bar, .trust-stat, .cta-block,
.related, .blog-card, .blog-card-featured, .tldr, .highlight, .breakeven {
  transition: background-color 0.4s ease, border-color 0.4s ease, color 0.3s ease;
}

/* Header glass background - dark variant */
html[data-theme="dark"] .site-header {
  background: oklch(0.20 0.005 75 / 0.88);
}

/* === Хардкодим стили которые остаются неадаптивными === */

/* Light CTA-блок - в dark стают warmer */
html[data-theme="dark"] .cta-block {
  background: linear-gradient(160deg, var(--surface) 0%, var(--bg-warm) 100%);
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  text-wrap: pretty;
}

img, svg, video { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ===== Типографика ===== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 16px;
  text-wrap: balance;
}
h1 { font-size: clamp(32px, 4vw, 48px); font-weight: 500; letter-spacing: -0.02em; }
h2 { font-size: clamp(26px, 3vw, 36px); }
h3 { font-size: clamp(20px, 2vw, 24px); }
h4 { font-size: 18px; }
em { font-family: var(--font-serif); font-style: italic; color: var(--accent); font-weight: 400; }
strong { font-weight: 600; }
p { margin: 0 0 16px; color: var(--ink-mid); }
a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-deep); }
small { font-size: 13px; color: var(--ink-soft); }
hr { border: none; border-top: 1px solid var(--border); margin: 32px 0; }

/* ===== A11y ===== */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}
.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius);
  z-index: 9999;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}
.skip-link:focus { left: 8px; color: #fff; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ===== Layout ===== */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}
.container-narrow { max-width: 880px; }
.container-medium { max-width: 980px; margin: 0 auto; padding: 0 24px; }

/* ===== Site Header (sticky, glass on scroll) ===== */
.site-header {
  position: sticky; top: 0; left: 0; right: 0;
  z-index: 100;
  background: oklch(0.99 0.005 80 / 0.85);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.site-header[data-scrolled="true"] {
  border-bottom-color: var(--border);
  box-shadow: 0 1px 0 oklch(0 0 0 / 0.02);
}
.site-header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--header-h);
  gap: 24px;
}
.site-logo {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}
.site-logo:hover { color: var(--ink); }
.site-logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.site-logo:hover .site-logo-mark { transform: rotate(-6deg) scale(1.05); }
.site-nav {
  display: flex; gap: 28px; align-items: center;
  flex: 1; justify-content: flex-end;
}
.site-nav a:not(.btn) {
  font-size: 14px;
  color: var(--ink-mid);
  font-weight: 500;
  position: relative;
  padding: 6px 0;
  transition: color 0.15s;
}
.site-nav a:not(.btn):hover, .site-nav a:not(.btn).is-active { color: var(--ink); }
.site-nav a:not(.btn).is-active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}
.site-nav-cta {
  margin-left: 8px;
}

/* Theme toggle button (sun/moon) */
.theme-toggle {
  width: 40px; height: 40px;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center; justify-content: center;
  transition: background 0.2s, border-color 0.2s, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
  margin-right: 4px;
}
.theme-toggle:hover { background: var(--bg-warm); border-color: var(--ink-mid); }
.theme-toggle:active { transform: rotate(180deg); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* Burger button - hidden on desktop */
.site-burger {
  display: none;
  width: 40px; height: 40px;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  align-items: center; justify-content: center;
  transition: background 0.2s, border-color 0.2s;
}
.site-burger:hover { background: var(--bg-warm); border-color: var(--ink-mid); }
.site-burger svg { width: 22px; height: 22px; }
.site-burger .icon-close { display: none; }
.site-burger[aria-expanded="true"] .icon-open { display: none; }
.site-burger[aria-expanded="true"] .icon-close { display: block; }

@media (max-width: 880px) {
  .site-nav { gap: 8px; }
  /* Скрываем все nav-ссылки кроме CTA-кнопки */
  .site-nav > a:not(.btn) { display: none; }
  .site-burger { display: inline-flex; }

  /* Открытое меню - выпадает вниз под header */
  .site-nav.is-open {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    padding: 12px 24px 24px;
    z-index: 99;
  }
  .site-nav.is-open > a:not(.btn) {
    display: flex;
    align-items: center;
    padding: 14px 4px;
    border-bottom: 1px solid var(--border);
    font-size: 16px;
    font-weight: 500;
    color: var(--ink);
  }
  .site-nav.is-open > a:not(.btn):last-of-type { border-bottom: none; }
  .site-nav.is-open > a:not(.btn).is-active { color: var(--accent); }
  .site-nav.is-open > a:not(.btn).is-active::after { display: none; }
  .site-nav.is-open .site-nav-cta {
    margin: 14px 0 0;
    width: 100%;
    justify-content: center;
  }
}
@media (max-width: 540px) {
  .site-logo span:last-child { display: none; }  /* Hide brand text on small mobile, keep mark */
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s,
              transform 0.2s, box-shadow 0.2s;
  white-space: nowrap;
  line-height: 1;
}
.btn-lg { font-size: 15px; padding: 13px 28px; }
.btn-sm { font-size: 13px; padding: 8px 16px; }

.btn-primary {
  background: var(--ink); color: var(--bg); border-color: var(--ink);
}
.btn-primary:hover {
  background: var(--bg); color: var(--ink); border-color: var(--ink);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px oklch(0 0 0 / 0.18);
}
.btn-accent {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.btn-accent:hover {
  background: var(--accent-deep); border-color: var(--accent-deep); color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px oklch(0.55 0.10 38 / 0.30);
}
.btn-outline {
  background: transparent; color: var(--ink); border-color: var(--border-strong);
}
.btn-outline:hover {
  border-color: var(--ink-mid); background: var(--bg-warm);
}
.btn-ghost {
  background: transparent; color: var(--ink-mid);
}
.btn-ghost:hover { background: var(--bg-warm); color: var(--ink); }
.btn:active { transform: translateY(0); }

/* ===== Section labels (eyebrow) ===== */
.section-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

/* ===== Breadcrumbs ===== */
.breadcrumb {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-soft);
  margin: 24px 0 28px;
}
.breadcrumb a {
  color: var(--ink-mid);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
  transition: color 0.2s, border-color 0.2s;
}
.breadcrumb a:hover { color: var(--ink); border-color: var(--border-strong); }
.breadcrumb-sep {
  color: var(--ink-soft);
  opacity: 0.5;
  user-select: none;
}
.breadcrumb-current { color: var(--ink); }

/* ===== Cards (универсальная карточка) ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}
.card-hoverable {
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
}
.card-hoverable:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

/* ===== Badge / chip ===== */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: var(--accent-bg);
  color: var(--accent);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ===== Article (для blog/about/faq) ===== */
.article-meta {
  font-size: 13px; color: var(--ink-soft);
  margin: 8px 0 32px;
  display: flex; gap: 16px; flex-wrap: wrap;
  align-items: center;
}
.article-meta-item {
  display: inline-flex; align-items: center; gap: 6px;
}
.article-meta svg { width: 14px; height: 14px; opacity: 0.7; }
.article-content {
  font-size: 17px;
  line-height: 1.75;
  color: var(--ink);
}
.article-content > p { color: var(--ink); margin: 0 0 22px; }
.article-content h2 { margin-top: 56px; margin-bottom: 18px; font-size: 30px; }
.article-content h3 { margin-top: 36px; margin-bottom: 12px; font-size: 22px; }
.article-content ul, .article-content ol {
  padding-left: 24px;
  margin: 0 0 22px;
}
.article-content li { margin-bottom: 8px; }
.article-content blockquote {
  margin: 28px 0;
  padding: 20px 24px;
  border-left: 3px solid var(--accent);
  background: var(--accent-bg);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  color: var(--ink);
}
.article-content code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--bg-warm);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent-deep);
}
.article-content table {
  border-collapse: collapse; width: 100%; margin: 24px 0;
  font-size: 15px;
}
.article-content th, .article-content td {
  padding: 12px 16px; text-align: left;
  border-bottom: 1px solid var(--border);
}
.article-content th { background: var(--bg-warm); font-weight: 600; color: var(--ink); }
.article-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }

/* ===== Reading progress bar (для blog) ===== */
.reading-progress {
  position: fixed; top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 200;
  pointer-events: none;
}
.reading-progress-bar {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.1s linear;
}

/* ===== Back to top button ===== */
.back-to-top {
  position: fixed;
  bottom: 24px; right: 24px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.3s, transform 0.3s, background 0.2s;
  z-index: 90;
}
.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.back-to-top:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.back-to-top svg { width: 18px; height: 18px; }

/* ===== Site Footer (всегда тёмный, не зависит от темы) ===== */
.site-footer {
  background: #1A1D23;
  color: #B8BCC4;
  padding: 56px 0 28px;
  margin-top: 80px;
  font-size: 14px;
}
html[data-theme="dark"] .site-footer {
  background: #14161B;
  border-top: 1px solid oklch(1 0 0 / 0.06);
}
.site-footer .container {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 36px;
}
.site-footer h4 {
  color: #FFFFFF;
  font-family: var(--font-sans);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  margin: 0 0 16px;
}
.site-footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.site-footer a {
  color: #B8BCC4;
  text-decoration: none;
  transition: color 0.15s;
}
.site-footer a:hover { color: #FFFFFF; }
.site-footer-brand p {
  color: #B8BCC4;
  font-size: 13px;
  line-height: 1.6;
  margin: 0;
}
.site-footer-brand h3,
.site-footer-brand .logo,
.site-footer-brand strong { color: #FFFFFF; }
.site-footer-bottom {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #8A8E96;
}
.site-footer-bottom-links {
  display: flex; gap: 18px; flex-wrap: wrap;
}
@media (max-width: 880px) {
  .site-footer .container { grid-template-columns: 1fr 1fr; gap: 24px; }
  .site-footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 540px) {
  .site-footer .container { grid-template-columns: 1fr; }
  .site-footer-bottom { flex-direction: column; align-items: flex-start; }
}

/* ===== Back-link (стрелка обратно вверху статьи) ===== */
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px;
  color: var(--ink-mid);
  text-decoration: none;
  font-weight: 500;
  margin-bottom: 14px;
  transition: color 0.2s, transform 0.2s;
}
.back-link:hover { color: var(--accent); }
.back-link:hover svg { transform: translateX(-3px); }
.back-link svg { width: 14px; height: 14px; transition: transform 0.2s; }

/* ===== Sub-nav (между группой калькуляторов или блогов) ===== */
.sub-nav {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: var(--header-h);
  z-index: 50;
  backdrop-filter: blur(8px);
}
.sub-nav-inner {
  display: flex; flex-wrap: wrap; gap: 6px;
  width: 100%;
}
.sub-nav-item {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--ink-mid);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
  white-space: nowrap;
}
.sub-nav-item:hover {
  background: var(--bg-warm);
  color: var(--ink);
  border-color: var(--ink-mid);
}
.sub-nav-item.is-active {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.sub-nav-item.is-active:hover { background: var(--ink); color: var(--bg); }

/* ===== Hero small (для калькуляторов и инфо-страниц) ===== */
.page-hero {
  padding: 56px 0 40px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-warm) 0%, var(--bg) 100%);
}
.page-hero h1 {
  font-size: clamp(30px, 4vw, 44px);
  margin: 0 0 14px;
  max-width: 760px;
}
.page-hero .lead {
  font-size: 17px;
  color: var(--ink-mid);
  max-width: 620px;
  margin: 0;
}

/* ===== Print (для blog статей) ===== */
@media print {
  .site-header, .site-footer, .back-to-top, .reading-progress, .breadcrumb { display: none !important; }
  body { background: #fff; color: #000; }
  a { color: #000; text-decoration: underline; }
  .container { max-width: 100%; padding: 0; }
}
