/* ─── tokens: IAMDES Design System ─────────────────────────────── */
:root {
  --bg:      #31302e;
  --surface: #3a3937;
  --fg:      #fff9f0;
  --muted:   #c9c9c9;
  --border:  #87837d;
  --accent:  #fff9f0;

  /* derived — do not change */
  --accent-soft: color-mix(in oklch, var(--accent) 14%, transparent);
  --fg-soft:     color-mix(in oklch, var(--fg) 6%, transparent);
  --fg-mix:      color-mix(in oklch, var(--fg) 62%, var(--bg));
  --muted-mix:   color-mix(in oklch, var(--muted) 30%, transparent);

  /* type */
  --font-display: 'Tenor Sans', system-ui, -apple-system, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --font-body:    'Manrope', system-ui, -apple-system, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --font-mono:    ui-monospace, 'JetBrains Mono', 'SF Mono', Menlo, monospace;

  /* scale */
  --fs-h1: clamp(36px, 4.6vw, 60px);
  --fs-h2: clamp(26px, 3.2vw, 38px);
  --fs-h3: 21px;
  --fs-lead: 19px;
  --fs-body: 16px;
  --fs-meta: 13px;

  /* spacing — 8px baseline grid */
  --gap-xs: 8px;
  --gap-sm: 12px;
  --gap-md: 20px;
  --gap-lg: 32px;
  --gap-xl: 56px;
  --gap-2xl: 96px;
  --container: 1120px;
  --gutter: 32px;

  /* IAMDES: radius 0, borders 1px */
  --radius: 0px;
  --radius-lg: 0px;
}

/* ─── reset & base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

/* ─── layout primitives ────────────────────────────────────────── */
.container { max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
@media (max-width: 480px) {
  .container { padding-inline: 20px; }
}
.section { padding-block: clamp(48px, 7vw, 80px); }
.section + .section { border-top: 1px solid var(--border); }
.stack { display: flex; flex-direction: column; }
.stack > * + * { margin-top: var(--gap-md); }
.row { display: flex; align-items: center; gap: var(--gap-md); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--gap-md); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap-lg); }
.article-layout { display: grid; grid-template-columns: 260px 1fr; gap: var(--gap-2xl); align-items: start; min-width: 0; }
@media (max-width: 920px) {
  .grid-3 { grid-template-columns: 1fr; }
  .article-layout { grid-template-columns: 1fr; }
}

/* ─── type ─────────────────────────────────────────────────────── */
.h1, h1 { font-family: var(--font-display); font-size: var(--fs-h1); line-height: 1.08; letter-spacing: -0.01em; font-weight: 400; margin: 0; }
.h2, h2 { font-family: var(--font-display); font-size: var(--fs-h2); line-height: 1.14; letter-spacing: -0.005em; font-weight: 400; margin: 0; }
.h3, h3 { font-family: var(--font-display); font-size: var(--fs-h3); font-weight: 400; line-height: 1.3; margin: 0; }
.lead   { font-size: var(--fs-lead); line-height: 1.55; color: var(--fg-mix); max-width: 60ch; margin: 0; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg);
  margin: 0 0 var(--gap-md);
}
.meta { font-family: var(--font-mono); font-size: var(--fs-meta); color: var(--fg-mix); }
.num  { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ─── chrome ───────────────────────────────────────────────────── */
/* Хедер в стиле iamdes.ru: тёмная полоса, белый логотип, светлое меню */
.topnav {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.topnav-inner { display: flex; align-items: center; justify-content: space-between; padding-block: 14px; gap: var(--gap-md); }
.topnav .logo { display: flex; align-items: center; }
.topnav .logo img { height: 26px; width: auto; display: block; }
.topnav nav { display: flex; gap: var(--gap-lg); }
.topnav nav a { font-size: 14px; color: var(--muted); }
.topnav nav a:hover { color: var(--accent); }
.topnav nav a[aria-current="page"] { color: var(--accent); border-bottom: 1px solid var(--accent); }
.topnav .nav-item { position: relative; }
.topnav .dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  min-width: 220px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  z-index: 100;
}
.topnav .nav-item:hover .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.topnav .dropdown-menu a {
  display: block;
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.topnav .dropdown-menu a:last-child { border-bottom: none; }
.topnav .dropdown-menu a:hover { background: var(--accent); color: var(--bg); }
/* CTA в тёмном хедере: акцентный фон, тёмный текст */
.topnav .btn-primary { background: transparent; color: var(--accent); border: 1px solid var(--accent); text-transform: uppercase; letter-spacing: 0.08em; font-size: 12px; font-weight: 500; padding: 14px 24px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; }
.topnav .btn-primary:hover { background: var(--accent); color: var(--bg); }
@media (max-width: 920px) { .topnav nav { display: none; } }
.pagefoot { padding-block: var(--gap-xl); color: var(--fg-mix); font-size: 13px; border-top: 1px solid var(--border); }
.pagefoot .row-between { flex-wrap: wrap; gap: var(--gap-md); align-items: flex-start; }
.pagefoot a:hover { color: var(--fg); }

/* ─── buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px;
  min-height: 44px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn-primary { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.btn-primary:hover { background: color-mix(in oklch, var(--accent) 88%, var(--bg)); }
.btn-secondary { background: transparent; color: var(--fg); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--fg); }
.btn-ghost { background: transparent; color: var(--fg); border-color: transparent; padding-inline: 8px; }
.btn-ghost:hover { color: var(--fg-mix); }
.btn-arrow::after { content: '→'; transition: transform 0.15s ease; }
.btn-arrow:hover::after { transform: translateX(2px); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* ─── card / surface ───────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}
.card-flat { background: transparent; border: 0; padding: 0; }

/* ─── pill / tag ───────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: var(--fg);
  color: var(--accent);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.tag {
  display: inline-flex; align-items: center;
  padding: 4px 10px;
  background: transparent;
  color: var(--fg-mix);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
}
a.tag:hover { border-color: var(--fg); color: var(--fg); }

/* ─── form field ───────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--fg-mix); }
.input, .textarea, .select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 15px;
}
.input:focus, .textarea:focus, .select:focus {
  outline: 2px solid var(--fg);
  outline-offset: 1px;
  border-color: var(--fg);
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
.field .error-text { font-size: 12px; color: var(--fg); display: none; }
.field.has-error .input, .field.has-error .select { border-color: var(--fg); outline: 1px solid var(--fg); }
.field.has-error .error-text { display: block; }

/* ─── table ────────────────────────────────────────────────────── */
.ds-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ds-table th, .ds-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.ds-table th { color: var(--fg-mix); font-weight: 500; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; }
.ds-table tbody tr:hover { background: var(--fg-soft); }
.ds-table .num-col { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

/* ─── image placeholder ────────────────────────────────────────── */
.ph-img {
  background:
    linear-gradient(135deg, var(--muted-mix), var(--fg-soft)),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  aspect-ratio: 16 / 10;
  display: grid; place-items: center;
  color: var(--fg-mix);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
}
.ph-img.wide { aspect-ratio: 16 / 9; }

/* ─── divider ──────────────────────────────────────────────────── */
.rule  { border: 0; border-top: 1px solid var(--border); margin: 0; }

/* ─── breadcrumbs ──────────────────────────────────────────────── */
.breadcrumbs { font-family: var(--font-mono); font-size: 12px; color: var(--fg-mix); letter-spacing: 0.02em; }
.breadcrumbs a:hover { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }
.breadcrumbs .sep { margin-inline: 8px; color: var(--muted); }

/* ─── TOC ──────────────────────────────────────────────────────── */
.toc { position: sticky; top: 96px; }
.toc-title { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-mix); margin: 0 0 12px; }
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li { counter-increment: toc; border-top: 1px solid var(--border); }
.toc a {
  display: flex; gap: 12px; align-items: baseline;
  padding: 10px 0;
  font-size: 14px; line-height: 1.4;
  color: var(--fg-mix);
  border-left: 2px solid transparent;
  padding-left: 12px;
  margin-left: -12px;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.toc a::before { content: counter(toc, decimal-leading-zero); font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.toc a:hover { color: var(--fg); }
.toc a.active { color: var(--fg); border-left-color: var(--fg); font-weight: 500; }
.toc a.active::before { color: var(--fg); }
@media (max-width: 920px) {
  .toc { position: static; }
  .toc details { border: 1px solid var(--border); background: var(--surface); }
  .toc summary {
    list-style: none; cursor: pointer;
    padding: 14px 16px; min-height: 44px;
    display: flex; align-items: center; justify-content: space-between;
    font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
  }
  .toc summary::-webkit-details-marker { display: none; }
  .toc summary::after { content: '+'; font-size: 16px; }
  .toc details[open] summary::after { content: '–'; }
  .toc details ol { padding: 0 16px 16px; }
  .toc .toc-desktop-title { display: none; }
}
@media (min-width: 921px) {
  .toc details { display: contents; }
  .toc summary { display: none; }
}

/* ─── article body ─────────────────────────────────────────────── */
.article-body { min-width: 0; }
.article-body > * + * { margin-top: var(--gap-lg); }
.article-body h2 { padding-top: var(--gap-md); }
.article-body h2 .sec-num { font-family: var(--font-mono); font-size: 13px; color: var(--muted); display: block; margin-bottom: 8px; letter-spacing: 0.08em; }
.article-body p { margin: 0; max-width: 68ch; }
.article-body ul { margin: 0; padding-left: 20px; max-width: 66ch; }
.article-body li + li { margin-top: 8px; }
.article-body a:not(.btn) { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.article-body a:not(.btn):hover { text-decoration-thickness: 2px; }

/* тезисы */
.theses { border: 1px solid var(--fg); padding: 24px; background: var(--surface); }
.theses .toc-title { color: var(--fg); }
.theses ul { margin: 0; padding: 0; list-style: none; }
.theses li { display: flex; gap: 12px; padding: 8px 0; font-size: 15px; }
.theses li::before { content: '—'; color: var(--fg-mix); flex-shrink: 0; }

/* цитата эксперта */
.expert-quote { border-left: 2px solid var(--fg); padding: 8px 0 8px 24px; }
.expert-quote blockquote {
  font-family: var(--font-display);
  font-size: clamp(20px, 2.2vw, 26px);
  line-height: 1.4;
  margin: 0;
  max-width: 34ch;
}
.expert-quote .quote-author { display: flex; align-items: center; gap: 12px; margin-top: 16px; font-size: 13px; color: var(--fg-mix); }
.expert-quote .avatar {
  width: 40px; height: 40px; flex-shrink: 0;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--muted-mix), var(--fg-soft)), var(--surface);
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 11px; color: var(--fg-mix);
}

/* врезка-норма / важное */
.callout { background: var(--surface); border: 1px solid var(--border); padding: 20px 24px; }
.callout .pill { margin-bottom: 12px; }
.callout p { font-size: 15px; }

/* ─── FAQ accordion ────────────────────────────────────────────── */
.faq-item { border-top: 1px solid var(--border); }
.faq-item:last-child { border-bottom: 1px solid var(--border); }
.faq-q {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: var(--gap-md);
  padding: 18px 0; min-height: 44px;
  background: none; border: 0; text-align: left;
  font-family: var(--font-display); font-size: 18px; color: var(--fg);
}
.faq-q .ico { font-family: var(--font-mono); font-size: 16px; flex-shrink: 0; transition: transform 0.15s ease; }
.faq-item[data-open="true"] .faq-q .ico { transform: rotate(45deg); }
.faq-a { padding: 0 0 20px; max-width: 64ch; color: var(--fg-mix); font-size: 15px; }
.faq-item:not([data-open="true"]) .faq-a { display: none; }

/* ─── quiz ─────────────────────────────────────────────────────── */
.quiz-opt {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  padding: 14px 16px; min-height: 44px;
  border: 1px solid var(--border);
  background: transparent; color: var(--fg);
  font-size: 15px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.quiz-opt:hover { border-color: var(--fg); }
.quiz-opt[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.quiz-progress { height: 2px; background: var(--muted-mix); }
.quiz-progress span { display: block; height: 100%; background: var(--fg); transition: width 0.25s ease; }

/* ─── calculator ───────────────────────────────────────────────── */
.calc { background: var(--surface); border: 1px solid var(--border); padding: 32px; }
.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap-lg); }
@media (max-width: 920px) { .calc-grid { grid-template-columns: 1fr; } .calc { padding: 24px 20px; } }
.calc-result { border-top: 1px solid var(--fg); margin-top: var(--gap-lg); padding-top: var(--gap-lg); }
.calc-sum { font-family: var(--font-display); font-size: clamp(36px, 4.5vw, 56px); line-height: 1; letter-spacing: -0.01em; }
.range-row { display: flex; align-items: center; gap: 16px; }
.range-row output { font-family: var(--font-mono); font-size: 14px; min-width: 72px; text-align: right; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 2px; background: var(--border); outline-offset: 4px; }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; background: var(--fg); border: 1px solid var(--fg); cursor: pointer;
}
input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; background: var(--fg); border: 1px solid var(--fg); border-radius: 0; cursor: pointer; }

/* ─── related posts ────────────────────────────────────────────── */
.rel-card { border-top: 1px solid var(--border); padding-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.rel-card h3 { font-size: 19px; }
.rel-card h3 a:hover { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.rel-card p { margin: 0; font-size: 14px; color: var(--fg-mix); }

/* ─── отзывы (Яндекс Карты) ──────────────────────────────────── */
.reviews-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--gap-md); flex-wrap: wrap; margin-bottom: 32px; }
.reviews-rating { display: flex; align-items: baseline; gap: 12px; }
.reviews-rating .score { font-family: var(--font-display); font-size: 44px; line-height: 1; }
.reviews-rating .stars { display: inline-flex; gap: 2px; }
.reviews-rating .stars svg { width: 16px; height: 16px; fill: var(--fg); }
.reviews-rating .stars svg.dim { fill: var(--muted); }
.reviews-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap-lg); }
@media (max-width: 920px) { .reviews-grid { grid-template-columns: 1fr; } }
.review-card { background: var(--surface); border: 1px solid var(--border); padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.review-card .review-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.review-card .review-author { display: flex; align-items: center; gap: 12px; min-width: 0; }
.review-card .avatar {
  width: 40px; height: 40px; flex-shrink: 0;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--muted-mix), var(--fg-soft)), var(--surface);
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 11px; color: var(--fg-mix);
}
.review-card .review-name { font-weight: 700; font-size: 14px; }
.review-card .review-date { font-family: var(--font-mono); font-size: 12px; color: var(--fg-mix); }
.review-card .stars { display: inline-flex; gap: 2px; flex-shrink: 0; }
.review-card .stars svg { width: 13px; height: 13px; fill: var(--fg); }
.review-card .stars svg.dim { fill: var(--muted); }
.review-card p { margin: 0; font-size: 14px; color: var(--fg-mix); }
.review-card .review-src { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-mix); margin-top: auto; padding-top: 8px; border-top: 1px solid var(--muted-mix); }
.reviews-foot { margin-top: 24px; display: flex; align-items: center; justify-content: space-between; gap: var(--gap-md); flex-wrap: wrap; }
.reviews-foot a { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.reviews-foot a:hover { text-decoration-thickness: 2px; }
.reviews-note { font-family: var(--font-mono); font-size: 12px; color: var(--fg-mix); }

/* ─── CTA band ─────────────────────────────────────────────────── */
.cta-band { background: var(--fg); color: var(--bg); }
.cta-band h2 { color: var(--bg); }
.cta-band .lead { color: color-mix(in oklch, var(--bg) 72%, var(--fg)); }
.cta-band .btn-primary { background: var(--bg); color: var(--fg); border-color: var(--bg); }
.cta-band .btn-primary:hover { background: color-mix(in oklch, var(--bg) 88%, var(--fg)); }
.cta-band .btn-secondary { color: var(--bg); border-color: color-mix(in oklch, var(--bg) 40%, var(--fg)); }
.cta-band .btn-secondary:hover { border-color: var(--bg); }

/* ─── form states ──────────────────────────────────────────────── */
.form-note { font-size: 13px; color: var(--fg-mix); }
.form-success { border: 1px solid var(--fg); padding: 20px 24px; display: none; }
.form-success.show { display: block; }
