/* ─── tokens: IAMDES Design System ─────────────────────────────── */
:root {
  --bg:      #31302e;   /* dark canvas — iamdes.ru */
  --surface: #3a3937;   /* cards and panels — dark */
  --fg:      #fff9f0;   /* light text on dark */
  --muted:   #c9c9c9;   /* secondary text and metadata */
  --border:  #87837d;   /* rules and dividers */
  --accent:  #fff9f0;   /* primary actions and emphasis — sparingly */

  /* 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 — display = Tenor Sans, body = Manrope, mono for numerics */
  --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(40px, 5.4vw, 68px);
  --fs-h2: clamp(28px, 3.6vw, 44px);
  --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.55;
  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, 8vw, var(--gap-2xl)); }
.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-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap-lg); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap-lg); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap-md); }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: var(--gap-xl); align-items: start; }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: var(--gap-xl); align-items: start; }
@media (max-width: 920px) {
  .grid-2, .grid-3, .grid-4, .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; }
}

/* ─── type ─────────────────────────────────────────────────────── */
.h1, h1 { font-family: var(--font-display); font-size: var(--fs-h1); line-height: 1.06; letter-spacing: -0.01em; font-weight: 400; margin: 0; }
.h2, h2 { font-family: var(--font-display); font-size: var(--fs-h2); line-height: 1.12; 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: nav + footer ─────────────────────────────────────── */
/* Хедер в стиле 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); }
/* ─── mobile nav ──────────────────────────────────────────────── */
.burger {
  display: none;
  width: 44px; height: 44px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--accent);
  align-items: center;
  justify-content: center;
}
.burger svg { width: 20px; height: 20px; }
.mobile-nav {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 20;
  background: var(--bg);
  padding: var(--gap-lg) var(--gutter);
}
.mobile-nav.open { display: flex; flex-direction: column; }
.mobile-nav .row-between { margin-bottom: var(--gap-xl); }
.mobile-nav nav { display: flex; flex-direction: column; gap: 0; }
.mobile-nav nav a {
  font-family: var(--font-display);
  font-size: 28px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  color: var(--accent);
}
.mobile-nav nav a[aria-current="page"] { color: var(--muted); }
.mobile-nav .btn { margin-top: var(--gap-lg); }
.mobile-nav .btn-primary { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.mobile-nav .btn-primary:hover { background: color-mix(in oklch, var(--accent) 88%, var(--fg)); }
@media (max-width: 920px) {
  .topnav nav, .topnav .btn { display: none; }
  .burger { display: inline-flex; }
}
.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); }

/* ─── 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; }
.card-rule { background: transparent; border: 0; border-top: 1px solid var(--fg); padding: 24px 0 0; border-radius: 0; }

/* ─── feature cell ─────────────────────────────────────────────── */
.feature .feature-num {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  margin-bottom: var(--gap-sm);
  letter-spacing: 0.04em;
}
.feature h3 { margin-bottom: 6px; }
.feature p  { margin: 0; color: var(--fg-mix); font-size: 15px; }

/* ─── pill / badge / 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; }

/* ─── 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; }

/* ─── 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.square    { aspect-ratio: 1 / 1; }
.ph-img.portrait  { aspect-ratio: 3 / 4; }
.ph-img.wide      { aspect-ratio: 16 / 9; }

/* ─── divider ──────────────────────────────────────────────────── */
.rule  { border: 0; border-top: 1px solid var(--border); margin: 0; }
.rule-strong { border: 0; border-top: 1px solid var(--fg); margin: 0; }

/* ─── hero ─────────────────────────────────────────────────────── */
.hero          { padding-block: clamp(64px, 9vw, 120px); }
.hero h1       { margin-bottom: var(--gap-md); }
.hero .lead    { margin-bottom: var(--gap-lg); }
.hero-cta      { display: inline-flex; gap: var(--gap-sm); flex-wrap: wrap; }

/* hero visual anchor — editorial statement */
.hero-statement {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--gap-xl);
  align-items: end;
  margin-bottom: var(--gap-xl);
}
.hero-statement .count {
  font-family: var(--font-mono);
  font-size: clamp(48px, 6vw, 72px);
  line-height: 1;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}
.hero-statement .count small {
  display: block;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-mix);
  margin-top: 8px;
}
@media (max-width: 640px) {
  .hero-statement { grid-template-columns: 1fr; }
  .hero-statement .count { text-align: left; }
}

/* ─── article list (archive) ───────────────────────────────────── */
.post-row {
  display: grid;
  grid-template-columns: 132px 1fr auto;
  gap: var(--gap-lg);
  padding: 24px 0;
  border-top: 1px solid var(--border);
  align-items: baseline;
  transition: background 0.2s ease;
  position: relative;
}
.post-row:hover { background: var(--fg-soft); }
.post-row h3 { font-size: 22px; margin-bottom: 6px; }
.post-row h3 a:hover { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.post-row .dek { margin: 0; color: var(--fg-mix); font-size: 15px; max-width: 64ch; }
.post-row .tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.post-row .go { align-self: center; white-space: nowrap; }
.post-row:hover .go::after { transform: translateX(4px); }
@media (max-width: 920px) {
  .post-row { grid-template-columns: 1fr; gap: var(--gap-sm); }
  .post-row .go { justify-self: start; }
}

/* fade-in on scroll */
.post-row { opacity: 0; transform: translateY(12px); }
.post-row.visible { opacity: 1; transform: translateY(0); transition: opacity 0.4s ease, transform 0.4s ease, background 0.2s ease; }

/* ─── filters bar ──────────────────────────────────────────────── */
.filters { display: flex; flex-direction: column; gap: var(--gap-md); }
.filters-row { display: flex; flex-wrap: wrap; gap: var(--gap-sm); align-items: center; }
.filters-row.secondary { padding-top: var(--gap-sm); border-top: 1px solid var(--border); }
.filters .input { max-width: 320px; }
.chip {
  display: inline-flex; align-items: center;
  min-height: 36px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--fg);
  font-size: 13px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.chip:hover { border-color: var(--fg); }
.chip[aria-pressed="true"] { background: var(--bg); color: var(--fg); border-color: var(--accent); }

/* ─── pagination ───────────────────────────────────────────────── */
.pagination { display: flex; gap: 8px; align-items: center; }
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px;
  border: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 13px;
  color: var(--fg);
}
.pagination a:hover { border-color: var(--fg); }
.pagination .current { background: var(--bg); color: var(--fg); border-color: var(--accent); }
.pagination .disabled { color: var(--muted); border-color: var(--muted); pointer-events: none; }

/* ─── CTA band ─────────────────────────────────────────────────── */
.cta-band { background: var(--bg); color: var(--fg); }
.cta-band h2 { color: var(--fg); }
.cta-band .lead { color: var(--muted); }
.cta-band .btn-primary { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.cta-band .btn-primary:hover { background: color-mix(in oklch, var(--accent) 88%, var(--fg)); }
.cta-band .btn-secondary { color: var(--fg); border-color: var(--border); }
.cta-band .btn-secondary:hover { border-color: var(--fg); }
.cta-band .text-link {
  color: var(--muted);
  font-size: 15px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 2px;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.cta-band .text-link:hover { color: var(--accent); border-color: var(--accent); }
