/* ============================================
   Коробки — гид по видам коробок
   Дизайн-система: крафт-каталог / editorial
   ============================================ */

:root {
  /* Палитра */
  --paper: #ebeadf;        /* овсянка — фон */
  --paper-deep: #e3e1d1;   /* панели глубже */
  --paper-card: #f2f1e8;   /* карточки */
  --ink: #333234;          /* почти-чёрный */
  --ink-soft: rgba(51, 50, 52, 0.64);
  --ink-faint: rgba(51, 50, 52, 0.4);
  --line: rgba(51, 50, 52, 0.16);
  --line-strong: rgba(51, 50, 52, 0.34);
  --accent: #f04923;       /* кораллово-оранжевый */
  --accent-deep: #c93a1a;
  --kraft: #dbbfa5;        /* крафт */
  --kraft-deep: #c8a887;
  --peri: #9eb9e1;         /* барвинок */
  --peri-deep: #7f9ecb;

  /* Типографика */
  --font-display: "Playfair Display", "Georgia", serif;
  --font-sans: "Manrope", -apple-system, "Segoe UI", sans-serif;
  --font-body: "PT Serif", "Georgia", serif;
  --font-mono: "IBM Plex Mono", "Courier New", monospace;

  /* Прочее */
  --radius: 12px;
  --sidebar-w: 280px;
  --content-max: 1160px;
  --ease-out: cubic-bezier(0.32, 0.94, 0.6, 1);
}

/* ---------- База ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }

a { color: inherit; }

button { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection { background: var(--accent); color: var(--paper); }

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 18px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  transition: top 0.2s var(--ease-out);
}
.skip-link:focus { top: 12px; }

/* ---------- Моно-коды и подписи ---------- */

.code {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.label {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.code--accent { color: var(--accent); }

/* ---------- Шапка (мобильная) ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  padding-top: calc(14px + env(safe-area-inset-top));
  background: rgba(235, 234, 223, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar__logo {
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  line-height: 1;
  letter-spacing: -0.01em;
}

.wordmark em {
  font-style: normal;
  color: var(--accent);
}

.topbar__tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.burger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 44px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: background 0.2s var(--ease-out), color 0.2s var(--ease-out);
}
.burger:hover { background: var(--ink); color: var(--paper); }
.burger:active { transform: scale(0.97); }

/* ---------- Мобильное меню ---------- */

.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  background: var(--ink);
  color: var(--paper);
  padding: 20px;
  padding-top: calc(20px + env(safe-area-inset-top));
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s var(--ease-out), visibility 0s linear 0.25s;
}

.menu-overlay.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s var(--ease-out);
}

.menu-overlay__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.menu-overlay__close {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 44px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid rgba(235, 234, 223, 0.4);
  border-radius: 999px;
  background: transparent;
  color: var(--paper);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: background 0.2s var(--ease-out), color 0.2s var(--ease-out);
}
.menu-overlay__close:hover { background: var(--paper); color: var(--ink); }

.menu-overlay__nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

.menu-overlay__link {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 12px 4px;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: clamp(30px, 8vw, 44px);
  font-weight: 700;
  line-height: 1.1;
  border-bottom: 1px solid rgba(235, 234, 223, 0.14);
  transition: padding-left 0.25s var(--ease-out), color 0.25s var(--ease-out);
}
.menu-overlay__link:hover { padding-left: 14px; color: var(--accent); }
.menu-overlay__link .code { color: rgba(235, 234, 223, 0.5); }

.menu-overlay__foot {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(235, 234, 223, 0.5);
}

/* ---------- Каркас: сайдбар + контент ---------- */

.shell { min-height: 100dvh; }

.sidebar { display: none; }

.main {
  min-width: 0;
}

/* ---------- Хиро ---------- */

.hero {
  padding: 48px 20px 40px;
  border-bottom: 1px solid var(--line);
}

.hero__inner {
  max-width: var(--content-max);
  margin: 0 auto;
  display: grid;
  gap: 32px;
}

.hero__eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.hero__eyebrow .rule {
  flex: 0 0 36px;
  height: 2px;
  background: var(--accent);
}

.hero__title {
  margin: 0 0 18px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(40px, 8.5vw, 84px);
  line-height: 1.02;
  letter-spacing: -0.015em;
}

.hero__title em { font-style: normal; color: var(--accent); }

.hero__lead {
  margin: 0;
  max-width: 34rem;
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.65;
  color: var(--ink-soft);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.hero__art {
  align-self: center;
}

.hero__art svg { width: 100%; height: auto; }

/* ---------- Кнопки ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 13px 26px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s var(--ease-out), background 0.2s var(--ease-out),
              color 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}

.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-deep); transform: translateY(-2px); }
.btn--primary:active { transform: translateY(0) scale(0.98); }

.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn--ghost:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn--ghost:active { transform: scale(0.98); }

.btn .arr { font-family: var(--font-mono); font-weight: 600; }

/* ---------- Секции ---------- */

.section {
  padding: 56px 20px;
}

.section--tight { padding: 40px 20px; }
.section--kraft { background: var(--kraft); }
.section--deep { background: var(--paper-deep); }

.section__inner {
  max-width: var(--content-max);
  margin: 0 auto;
}

.section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--ink);
}

.section__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(28px, 4.6vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.01em;
}

.section__note {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ---------- Гофро-разделитель ---------- */

.corrugated {
  height: 10px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='10' viewBox='0 0 16 10'%3E%3Cpath d='M0 9 Q2 1 4 9 Q6 1 8 9 Q10 1 12 9 Q14 1 16 9' fill='none' stroke='%23333234' stroke-opacity='0.35' stroke-width='1.4'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-size: 16px 10px;
}

/* ---------- Сетка карточек видов ---------- */

.type-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

.type-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  overflow: hidden;
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out),
              border-color 0.25s var(--ease-out);
}

.type-card:hover {
  transform: translateY(-4px);
  border-color: var(--ink);
  box-shadow: 0 14px 30px -18px rgba(51, 50, 52, 0.45);
}

.type-card:active { transform: translateY(-1px) scale(0.99); }

.type-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.type-card__code {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--accent);
}

.type-card__tag {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.type-card__art {
  margin: 4px 0;
  padding: 10px 6px;
  background: var(--paper);
  border-radius: 8px;
}

.type-card__art svg { width: 100%; height: auto; transition: transform 0.6s var(--ease-out); }
.type-card:hover .type-card__art svg { transform: scale(1.04); }

.type-card__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.15;
}

.type-card__desc {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.type-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.type-card__foot .go { color: var(--accent); font-weight: 600; }

/* ---------- Фильтры ---------- */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 28px;
}

.filter-btn {
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  transition: background 0.2s var(--ease-out), color 0.2s var(--ease-out),
              border-color 0.2s var(--ease-out), transform 0.2s var(--ease-out);
}

.filter-btn:hover { border-color: var(--ink); color: var(--ink); }
.filter-btn:active { transform: scale(0.97); }

.filter-btn.is-active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.filter-count {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  margin: 0 0 18px;
}

.filter-empty {
  display: none;
  padding: 40px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  text-align: center;
  color: var(--ink-soft);
}
.filter-empty.is-visible { display: block; }

.type-card.is-hidden { display: none; }

/* ---------- Список статей ---------- */

.article-list {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line-strong);
}

.article-row {
  display: grid;
  gap: 6px 24px;
  padding: 26px 4px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  transition: background 0.2s var(--ease-out), padding-left 0.25s var(--ease-out);
}

.article-row:hover { background: var(--paper-card); padding-left: 14px; }

.article-row__code { font-family: var(--font-mono); font-size: 12px; font-weight: 600; letter-spacing: 0.14em; color: var(--accent); }

.article-row__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(22px, 3.4vw, 30px);
  font-weight: 700;
  line-height: 1.18;
}

.article-row__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.article-row__desc {
  margin: 6px 0 0;
  max-width: 44rem;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink-soft);
}

/* ---------- Паспорт коробки (спеки) ---------- */

.spec-grid {
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.spec-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.9fr) 1.4fr;
  gap: 16px;
  padding: 14px 18px;
  background: var(--paper-card);
}

.spec-row dt {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  align-self: center;
}

.spec-row dd {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
}

/* ---------- Тело статьи ---------- */

.article-body {
  max-width: 42rem;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.75;
}

.article-body p { margin: 0 0 1.4em; }

.article-body h2 {
  margin: 2em 0 0.7em;
  font-family: var(--font-display);
  font-size: clamp(24px, 3.6vw, 32px);
  font-weight: 700;
  line-height: 1.2;
}

.article-body h2 .code {
  display: block;
  margin-bottom: 8px;
  color: var(--accent);
}

.article-body ul, .article-body ol {
  margin: 0 0 1.5em;
  padding-left: 1.3em;
}

.article-body li { margin-bottom: 0.55em; }

.article-body strong { font-weight: 700; }

.article-body .mark-signs {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
  margin: 1.6em 0;
}

.mark-sign {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.mark-sign svg { flex: 0 0 44px; }

.mark-sign__name {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.mark-sign__text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-soft);
}

.callout {
  margin: 1.8em 0;
  padding: 18px 20px;
  background: var(--kraft);
  border-radius: var(--radius);
  font-size: 16px;
  line-height: 1.65;
}

.callout .label { display: block; margin-bottom: 8px; color: var(--accent-deep); }

/* ---------- Страница вида ---------- */

.type-hero {
  display: grid;
  gap: 28px;
  padding: 40px 20px 36px;
  border-bottom: 1px solid var(--line);
}

.type-hero__art {
  padding: 24px;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.type-hero__art svg { width: 100%; height: auto; }

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.breadcrumbs a {
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}
.breadcrumbs a:hover { color: var(--accent); border-color: var(--accent); }

.page-title {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(34px, 6.4vw, 60px);
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.page-lead {
  margin: 0;
  max-width: 38rem;
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.65;
  color: var(--ink-soft);
}

.two-col {
  display: grid;
  gap: 32px;
}

/* ---------- Шаги ---------- */

.steps {
  counter-reset: step;
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.step {
  counter-increment: step;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  padding: 16px 18px;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.step::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  padding-top: 2px;
}

.step__title {
  margin: 0 0 4px;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.step__text {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-soft);
}

/* ---------- FAQ ---------- */

.faq {
  border-top: 1px solid var(--line-strong);
}

.faq details {
  border-bottom: 1px solid var(--line);
}

.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
  padding: 20px 4px;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.4;
  list-style: none;
  transition: color 0.2s var(--ease-out);
}

.faq summary::-webkit-details-marker { display: none; }

.faq summary::after {
  content: "+";
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 16px;
  transition: transform 0.25s var(--ease-out), background 0.2s var(--ease-out), color 0.2s var(--ease-out);
}

.faq summary:hover { color: var(--accent); }
.faq details[open] summary::after { transform: rotate(45deg); background: var(--ink); color: var(--paper); }

.faq__answer {
  padding: 0 4px 22px;
  max-width: 42rem;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink-soft);
}

/* ---------- Похожие / навигация по разделу ---------- */

.related-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

.pager {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
  margin-top: 48px;
}

.pager__link {
  display: block;
  padding: 20px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  text-decoration: none;
  transition: background 0.2s var(--ease-out), color 0.2s var(--ease-out);
}
.pager__link:hover { background: var(--ink); color: var(--paper); }
.pager__link .code { display: block; margin-bottom: 6px; color: var(--accent); }
.pager__link:hover .code { color: var(--kraft); }
.pager__link .t { font-family: var(--font-display); font-size: 20px; font-weight: 700; }

/* ---------- Прогресс чтения ---------- */

.read-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 60;
  width: 100%;
  height: 3px;
  background: transparent;
  pointer-events: none;
}

.read-progress__bar {
  width: 100%;
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
}

/* ---------- Подвал ---------- */

.footer {
  border-top: 2px solid var(--ink);
  padding: 40px 20px calc(32px + env(safe-area-inset-bottom));
  background: var(--paper-deep);
}

.footer__inner {
  max-width: var(--content-max);
  margin: 0 auto;
  display: grid;
  gap: 28px;
}

.footer__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
}

.footer__nav a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-soft);
  transition: color 0.2s var(--ease-out);
}
.footer__nav a:hover { color: var(--accent); }

.footer__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ---------- Планшет ---------- */

@media (min-width: 640px) {
  .type-grid { grid-template-columns: repeat(2, 1fr); }
  .mark-signs { grid-template-columns: repeat(2, 1fr); }
  .article-body .mark-signs { grid-template-columns: repeat(2, 1fr); }
  .related-grid { grid-template-columns: repeat(2, 1fr); }
  .pager { grid-template-columns: 1fr 1fr; }
  .hero__inner { grid-template-columns: 1.05fr 0.95fr; align-items: center; }
}

/* ---------- Десктоп: редакционный сайдбар ---------- */

@media (min-width: 1024px) {
  .topbar { display: none; }

  .shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  }

  .sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: 36px 28px 28px;
    border-right: 1px solid var(--line);
    overflow-y: auto;
  }

  .sidebar__logo {
    display: block;
    text-decoration: none;
    margin-bottom: 8px;
  }

  .sidebar__logo .wordmark { font-size: 30px; }

  .sidebar__tag {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-bottom: 40px;
  }

  .sidebar__nav {
    display: flex;
    flex-direction: column;
  }

  .sidebar__link {
    display: flex;
    align-items: baseline;
    gap: 14px;
    min-height: 44px;
    padding: 12px 0;
    text-decoration: none;
    font-family: var(--font-display);
    font-size: 21px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--ink-soft);
    border-top: 1px solid var(--line);
    transition: color 0.2s var(--ease-out), padding-left 0.25s var(--ease-out);
  }

  .sidebar__link .code { color: var(--ink-faint); transition: color 0.2s var(--ease-out); }

  .sidebar__link:hover { color: var(--ink); padding-left: 8px; }
  .sidebar__link:hover .code { color: var(--accent); }

  .sidebar__link[aria-current="page"] {
    color: var(--ink);
    padding-left: 8px;
  }
  .sidebar__link[aria-current="page"] .code { color: var(--accent); }

  .sidebar__foot {
    margin-top: auto;
    padding-top: 24px;
    border-top: 1px solid var(--line);
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.9;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-faint);
  }

  .hero { padding: 88px 56px 72px; }
  .section { padding: 72px 56px; }
  .section--tight { padding: 48px 56px; }
  .type-hero { padding: 56px; grid-template-columns: 1.1fr 0.9fr; align-items: center; }
  .two-col { grid-template-columns: 1fr 1fr; }
  .footer { padding: 56px 56px 40px; }
}

@media (min-width: 1280px) {
  .type-grid { grid-template-columns: repeat(3, 1fr); }
  .related-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Анимации появления ---------- */

.rise {
  animation: rise 0.6s var(--ease-out) both;
}

.rise--d1 { animation-delay: 0.08s; }
.rise--d2 { animation-delay: 0.16s; }
.rise--d3 { animation-delay: 0.24s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
