:root {
  --bg: #f1eadf;
  --paper: #fbf7f0;
  --paper-2: #f6efe4;
  --ink: #2a241e;
  --muted: #6b6158;
  --line: rgba(42, 36, 30, 0.12);
  --wood: #b7834f;
  --wood-light: #e2c9a6;
  --wood-ink: #8a5d31;
  --moss: #2f5a3c;
  --moss-hover: #3a6d49;
  --on-moss: #fbf7f0;
  --on-moss-muted: #dce6df;
  --dark: #2a241e;
  --on-dark: #f6efe4;
  --on-dark-muted: #cbbfae;
  --radius: 12px;
  --radius-arch: 999px 999px 12px 12px;
  --shell: 1280px;
  --pad: clamp(16px, 3vw, 40px);
  --section: clamp(80px, 10vw, 136px);
  --serif: "Lora", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --sky: radial-gradient(120% 90% at 72% 18%, #fbe6c4 0%, #f3dcbf 38%, #e8d3ba 72%, #e2ccb2 100%);
  --mark-steel: #9aa1ab;
  --mark-wood: #d9a56b;
  --kb-ui-bg: #fbf7f0;
  --kb-ui-ink: #2a241e;
  --kb-ui-muted: #6b6158;
  --kb-ui-line: rgba(42, 36, 30, 0.12);
  --kb-ui-accent: #2f5a3c;
  --kb-ui-accent-ink: #fbf7f0;
  --kb-ui-radius: 12px;
  --kb-ui-font: var(--sans);
  --kb-proto-bg: #2a241e;
  --kb-proto-ink: #f6efe4;
  --kb-g: #d8cbb0;
  --kb-dt: #c9a27a;
  --kb-dl: #a97f58;
  --kb-dr: #8f6947;
  --kb-wt: #e6be8c;
  --kb-wl: #cf9a61;
  --kb-wr: #b27c46;
  --kb-mt: #5b6068;
  --kb-ml: #3f444b;
  --kb-mr: #2c3035;
  --kb-sh: rgba(90, 60, 30, 0.16);
  --kb-pl: rgba(80, 50, 25, 0.25);
  --kb-rb: #7e5236;
  --kb-rf: #9b6443;
  --kb-rg: #b98356;
  --kb-at: #efe7da;
  --kb-al: #e3d7c4;
  --kb-ar: #cfc0a8;
  --kb-door: #7f5e44;
  --kb-win: #b7c7cf;
  --kb-ct: #6f8a7b;
  --kb-cl: #54705f;
  --kb-cr: #41594a;
  --kb-lt: #c9d6d3;
  --kb-ll: #aabdb9;
  --kb-lr: #93a8a3;
  --kb-rt: rgba(220, 230, 228, 0.32);
  --kb-rl: rgba(180, 196, 192, 0.45);
  --kb-rr: rgba(150, 168, 164, 0.45);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

body > * {
  position: relative;
  z-index: 1;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  text-wrap: balance;
}

p,
figure,
blockquote,
ol,
ul {
  margin: 0;
}

p {
  text-wrap: pretty;
}

.shell {
  width: 100%;
  max-width: calc(var(--shell) + 2 * var(--pad));
  margin-inline: auto;
  padding-inline: var(--pad);
}

.section {
  padding-top: var(--section);
}

.skip {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 600;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--paper);
  transform: translateY(-160%);
}

.skip:focus {
  transform: none;
}

:focus-visible {
  outline: 3px solid var(--moss);
  outline-offset: 3px;
}

.final :focus-visible,
.foot :focus-visible {
  outline-color: var(--on-moss);
}

.arch {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-arch);
  background: var(--sky);
}

.scene-canvas {
  position: relative;
}

.scene {
  display: block;
  width: 100%;
  height: auto;
}

.hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
  padding-top: clamp(32px, 5vw, 64px);
}

.arch--hero {
  display: flex;
  align-items: flex-end;
  aspect-ratio: 4 / 5;
  max-height: 680px;
}

.arch--hero .scene-canvas {
  width: 124%;
  margin: 0 -12% -3%;
}

.marker {
  position: absolute;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin: -16px 0 0 -16px;
  border: 2px solid var(--moss);
  border-radius: 50%;
  background: var(--paper);
  color: var(--moss);
  font: 600 14px/1 var(--sans);
}

.tabbar {
  display: none;
}

@media (max-width: 1099px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero__art {
    width: 100%;
    max-width: 520px;
    justify-self: center;
  }
}

@media (max-width: 767px) {
  .tabbar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 150;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    height: calc(64px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--paper);
    border-top: 1px solid var(--line);
  }

  body {
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== v3 «Сценарии»: компоненты. Выше — обязательный блок из брифа, без изменений. ===== */

/* В v3 теней нет: шторка корзины и подсказки поиска из ui.css — тоже без тени. */
:root {
  --kb-ui-shadow: none;
}

a {
  color: inherit;
}

button,
input {
  color: inherit;
  font: inherit;
}

::selection {
  background: var(--wood-light);
  color: var(--ink);
}

/* --- Иконки --- */

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --- Типографика --- */

.eyebrow {
  color: var(--wood-ink);
  font: 600 13px/1.3 var(--sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.lead {
  max-width: 34ch;
  margin-top: 24px;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.55;
}

.section h2 {
  font-size: clamp(34px, 4vw, 54px);
  line-height: 1.06;
  letter-spacing: -0.01em;
}

.price {
  color: var(--ink);
  font: 600 26px/1 var(--sans);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.price--big {
  font-size: 36px;
}

/* --- Бумага --- */

.paper {
  padding: clamp(20px, 2.4vw, 32px);
  border-radius: var(--radius);
  background: var(--paper);
}

/* --- Кнопки и ссылки --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 24px;
  border: 0;
  border-radius: var(--radius);
  font: 600 16px/1.2 var(--sans);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.btn--moss {
  background: var(--moss);
  color: var(--on-moss);
}

.btn--moss:hover {
  background: var(--moss-hover);
}

.btn--light {
  background: var(--paper);
  color: var(--ink);
}

.btn--light:hover {
  background: var(--paper-2);
}

.btn--sm {
  min-height: 44px;
  padding: 0 18px;
  font-size: 15px;
}

.btn.is-added {
  background: var(--ink);
  color: var(--paper);
}

.link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--wood);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}

.link:hover {
  text-decoration-color: currentColor;
}

.icon-btn {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: var(--moss);
  color: var(--on-moss);
  font: 400 22px/1 var(--sans);
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--moss-hover);
}

.icon-btn.is-added {
  background: var(--ink);
  color: var(--paper);
}

/* --- Шапка --- */

.top {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--line);
  background: color-mix(in oklab, var(--bg) 90%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.top__bar {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 75px;
}

.brand {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--ink);
  text-decoration: none;
}

.brand__mark {
  width: 32px;
  height: 32px;
  flex: none;
}

.brand__name {
  font: 600 17px/1.2 var(--sans);
  white-space: nowrap;
}

.top__nav {
  display: flex;
  gap: 22px;
  margin-inline: auto;
}

.top__nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink);
  font: 500 15px/1.2 var(--sans);
  text-decoration: none;
  text-decoration-color: var(--wood);
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
  white-space: nowrap;
}

.top__nav a:hover {
  text-decoration-line: underline;
}

.top__search {
  flex: 0 1 280px;
}

.top__search input {
  width: 100%;
  text-overflow: ellipsis;
  height: 46px;
  padding: 0 14px 0 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b6158' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M16 16l4.5 4.5'/%3E%3C/svg%3E") no-repeat 14px 50% / 18px 18px;
  color: var(--ink);
  font: 400 15px/1.2 var(--sans);
  -webkit-appearance: none;
  appearance: none;
}

.top__search input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.top__search input:focus {
  border-color: var(--moss);
}

.top__search input:focus-visible {
  outline: 2px solid var(--moss);
  outline-offset: -2px;
}

/* Системный «×» у поля поиска в Chrome синий — рисуем свой, в цвете --muted. */
.top__search input::-webkit-search-cancel-button {
  width: 18px;
  height: 18px;
  margin: 0 0 0 8px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b6158' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M7 7l10 10M17 7L7 17'/%3E%3C/svg%3E") center / 18px 18px no-repeat;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.top__cart {
  position: relative;
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: 600 15px/1 var(--sans);
  cursor: pointer;
}

.top__cart:hover {
  background: var(--paper-2);
}

/* Счётчик: display задаётся только непустому, иначе перебьётся скрытие нуля из ui.css. */
.count {
  border-radius: 999px;
  background: var(--moss);
  color: var(--on-moss);
  font: 600 12px/1 var(--sans);
  font-variant-numeric: tabular-nums;
}

[data-cart-count]:not([data-empty]) {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
}

/* --- Hero --- */

.hero h1 {
  margin-top: 18px;
  font-size: clamp(44px, 5.8vw, 80px);
  line-height: 1.02;
  letter-spacing: -0.015em;
}

.hero h1 span {
  color: var(--wood-ink);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  margin-top: 36px;
}

.trust {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin-top: 36px;
  padding: 0;
  list-style: none;
  font-size: 15px;
  line-height: 1.4;
}

.trust li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.trust .icon {
  stroke: var(--moss);
}

/* Арки: верх — ровный полукруг, низ — 12 px. Токен 999px 999px 12px 12px при сложении радиусов
   пропорционально ужимает и нижние углы (до 2–3 px), поэтому радиусы заданы в процентах под пропорцию арки. */
.arch--hero {
  margin-inline: auto;
  border-radius: 50% 50% 12px 12px / 40% 40% 12px 12px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 22px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.3;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.legend b {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--moss);
  color: var(--on-moss);
  font: 600 12px/1 var(--sans);
}

/* --- Шапка секции --- */

.section__head {
  margin-bottom: 40px;
}

.section__head h2,
.story__intro h2 {
  margin-top: 12px;
}

.section__lead {
  max-width: 58ch;
  margin-top: 16px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.section__head--row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px 40px;
}

/* --- Фильтр и переключатель --- */

.filters,
.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filters {
  margin-bottom: 28px;
}

.segmented {
  flex: none;
}

.filters [role="radio"],
.segmented [role="radio"] {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font: 500 15px/1.2 var(--sans);
  white-space: nowrap;
  cursor: pointer;
}

.filters [role="radio"]:hover,
.segmented [role="radio"]:hover {
  background: var(--paper);
}

.filters [role="radio"][aria-checked="true"],
.segmented [role="radio"][aria-checked="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

/* --- Комплекты --- */

.kits-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px 20px;
}

.kit-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 12px 20px;
  border-radius: var(--radius);
  background: var(--paper);
}

/* Части карточек одного ряда встают на общие строки: цены на одной линии,
   а раскрытый «Состав комплекта» не сдвигает строку покупки у соседних карточек. */
@supports (grid-template-rows: subgrid) {
  .kit-card {
    display: grid;
    grid-row: span 6;
    grid-template-rows: subgrid;
    row-gap: 8px;
  }
}

.kit-card[hidden] {
  display: none;
}

.kit-card__art {
  display: flex;
  align-items: flex-end;
  aspect-ratio: 5 / 4;
  padding: 16px 6px 0;
  border-radius: 50% 50% 12px 12px / 62.5% 62.5% 12px 12px;
}

.kit-card__art .scene {
  transition: transform 0.3s var(--ease);
}

.kit-card:hover .kit-card__art .scene {
  transform: translateY(-4px);
}

/* Две строки под лид всегда: фильтр не меняет высоту карточек, когда из ряда уходит длинный лид. */
.kit-card__lead {
  display: flex;
  align-items: flex-end;
  min-height: 2.9em;
  margin-top: 8px;
  padding-inline: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.kit-card__name {
  padding-inline: 8px;
  font-size: 22px;
  line-height: 1.2;
}

.kit-card__facts {
  padding-inline: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.kit-card__buy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 12px;
  margin-top: auto;
  padding: 10px 8px 0;
  container-type: inline-size;
}

/* Узкая карточка (4 колонки около 1200 px, 3 — около 900 px, 2 — около 600 px): цена и кнопка не влезают
   в строку — во всех карточках ряда одинаково встают друг под другом, кнопка на всю ширину. */
@container (max-width: 239px) {
  .kit-card__buy .price,
  .kit-card__buy .btn {
    flex-basis: 100%;
  }
}

.kit-card__parts {
  margin-inline: 8px;
  border-top: 1px solid var(--line);
}

.kit-card__parts summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  font: 600 14px/1.3 var(--sans);
  list-style: none;
  cursor: pointer;
}

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

.kit-card__parts summary::after {
  content: "+";
  color: var(--wood-ink);
  font: 400 22px/1 var(--sans);
}

.kit-card__parts[open] summary::after {
  content: "−";
}

.kit-card__parts ul {
  display: grid;
  gap: 6px;
  margin: 0 0 4px;
  padding: 0;
  list-style: none;
}

.kit-card__parts li {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  line-height: 1.35;
}

.kit-card__icon {
  width: 32px;
  height: 32px;
}

.kit-card__parts li b {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* --- Разбор комплекта --- */

.story {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-areas:
    "intro intro intro"
    "box buy plan";
  gap: 20px;
}

.story__intro {
  grid-area: intro;
  margin-bottom: 20px;
}

.story__box {
  display: flex;
  flex-direction: column;
  grid-area: box;
}

.story__buy {
  grid-area: buy;
}

.story__plan {
  grid-area: plan;
}

/* Заголовки колонок разбора: место под две строки, текст прижат вниз — списки трёх колонок начинаются
   на одной линии. «Докупить в строительном магазине» держим в двух строках: 22 px, на 1100–1279 px — 20 px. */
.story h3 {
  display: flex;
  align-items: flex-end;
  min-height: 2.4em;
  font-size: 22px;
  line-height: 1.2;
}

.box-list,
.shop-list,
.timeline {
  margin-top: 12px;
  padding: 0;
  list-style: none;
}

.box-list li {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.box-list__icon {
  width: 44px;
  height: 44px;
}

.box-list__name {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
}

.box-list small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.box-list b {
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.story__total {
  margin-top: auto;
  padding-top: 24px;
}

.story__facts {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.story__total .price--big {
  margin-top: 12px;
}

.story__total .btn {
  width: 100%;
  margin-top: 20px;
}

.shop-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
  line-height: 1.4;
}

.shop-list b {
  font-weight: 600;
}

.shop-list span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 14px;
}

.timeline {
  margin-top: 20px;
}

.timeline li {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
}

.timeline time {
  color: var(--moss);
  font: 600 14px/1.6 var(--sans);
  font-variant-numeric: tabular-nums;
}

.timeline p {
  position: relative;
  padding: 0 0 22px 20px;
  border-left: 2px solid var(--wood-light);
  font-size: 16px;
  line-height: 1.45;
}

.timeline li:last-child p {
  padding-bottom: 0;
}

.timeline p::before {
  content: "";
  position: absolute;
  top: 7px;
  left: -6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--wood);
}

/* --- Сборка по шагам --- */

.how {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  padding: 0;
  list-style: none;
}

.how__art {
  padding: 12px;
  border-radius: var(--radius);
  background: var(--paper);
}

.how__num {
  margin-top: 20px;
  color: var(--wood-ink);
  font: 600 40px/1 var(--serif);
}

.how__step h3 {
  margin-top: 10px;
  font-size: 20px;
  line-height: 1.25;
}

.how__step h3 + p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

/* --- Истории --- */

.stories {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.story-card {
  display: flex;
  flex-direction: column;
  padding: 12px 12px 24px;
  border-radius: var(--radius);
  background: var(--paper);
}

.story-card__art {
  display: flex;
  align-items: flex-end;
  aspect-ratio: 4 / 3;
  padding: 16px 8px 0;
  border-radius: 50% 50% 12px 12px / 66.667% 66.667% 12px 12px;
}

.story-card blockquote {
  padding: 20px 8px 0;
  font: 500 20px/1.45 var(--serif);
}

.story-card figcaption {
  margin-top: auto;
  padding: 14px 8px 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.story-card figcaption b {
  color: var(--ink);
  font-weight: 600;
}

/* --- Узлы поштучно --- */

.nodes-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  padding: 0;
  list-style: none;
}

.node-card {
  display: flex;
  flex-direction: column;
}

/* Имя, роль, артикул и цена у карточек одного ряда — на общих строках, даже если имя в две строки. */
@supports (grid-template-rows: subgrid) {
  .node-card {
    display: grid;
    grid-row: span 5;
    grid-template-rows: subgrid;
    row-gap: 0;
  }

  /* Короткое имя прижато к роли: запас под второе слово уходит вверх, к иконке. */
  .node-card__name {
    display: flex;
    align-items: flex-end;
  }
}

.node-card__icon {
  justify-self: start;
}

.node-card__icon {
  width: 96px;
  height: 96px;
}

.node-card__name {
  margin-top: 14px;
  font-size: 19px;
  line-height: 1.25;
}

.node-card__role {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.node-card__sku {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.node-card__buy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 18px;
}

/* --- Вопросы: диалог --- */

/* На широком экране шапка вопросов — слева, диалог — справа, как разворот журнала.
   Левая колонка не уже самого длинного слова заголовка: на 1100–1365 px диалог уступает ей место. */
.section:has(> .dialog) {
  display: grid;
  grid-template-columns: minmax(min-content, 1fr) minmax(0, 860px);
  align-items: start;
  column-gap: clamp(40px, 5vw, 80px);
}

.section:has(> .dialog) > .section__head {
  margin-bottom: 0;
}

.dialog {
  max-width: 860px;
}

.dialog__pair {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 28px;
}

.dialog__pair:last-child {
  margin-bottom: 0;
}

.bubble {
  max-width: 78%;
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 16px;
  line-height: 1.55;
}

.bubble--q {
  align-self: flex-end;
  background: var(--ink);
  color: var(--paper);
}

.bubble--a {
  align-self: flex-start;
  background: var(--paper);
  color: var(--ink);
}

/* --- Покупка --- */

.cards3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.card h3 {
  font-size: 22px;
  line-height: 1.2;
}

.card p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

/* --- Финал --- */

.final {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  align-items: center;
  gap: 32px;
  padding: clamp(32px, 5vw, 64px);
  border-radius: var(--radius);
  background: var(--moss);
  color: var(--on-moss);
}

.final h2 {
  color: var(--on-moss);
}

.final__text p {
  max-width: 44ch;
  margin-top: 16px;
  color: var(--on-moss-muted);
  font-size: 18px;
  line-height: 1.55;
}

.final__text .btn {
  margin-top: 32px;
}

.final__art {
  display: flex;
  align-items: flex-end;
  justify-self: end;
  border-radius: 50% 50% 12px 12px;
  width: 100%;
  max-width: 360px;
  aspect-ratio: 1 / 1;
  padding: 16px 8px 0;
}

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

.foot {
  margin-top: var(--section);
  padding: 56px 0 32px;
  background: var(--dark);
  color: var(--on-dark);
}

.foot__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 40px;
}

.foot__name {
  font: 600 24px/1.2 var(--serif);
}

.foot__brand p + p {
  max-width: 30ch;
  margin-top: 10px;
  color: var(--on-dark-muted);
  font-size: 15px;
  line-height: 1.5;
}

.foot__nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px;
}

.foot__title {
  margin-bottom: 6px;
  color: var(--on-dark-muted);
  font: 600 13px/1.3 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.foot__nav a {
  display: flex;
  align-items: center;
  width: fit-content;
  min-height: 44px;
  color: var(--on-dark);
  font-size: 15px;
  text-decoration: none;
  text-underline-offset: 4px;
}

.foot__nav a:hover {
  text-decoration: underline;
}

.foot__nav p:not(.foot__title) {
  display: flex;
  align-items: center;
  min-height: 44px;
  font-size: 15px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.foot__nav .foot__small {
  color: var(--on-dark-muted);
  font-size: 13px;
}

.foot__legal {
  display: flex;
  flex-wrap: wrap;
  grid-column: 1 / -1;
  align-items: center;
  gap: 0 28px;
  padding-top: 16px;
  border-top: 1px solid rgba(246, 239, 228, 0.14);
  color: var(--on-dark-muted);
  font-size: 13px;
}

.foot__legal p {
  margin-right: auto;
}

.foot__legal a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--on-dark-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.foot__legal a:hover {
  color: var(--on-dark);
}

/* --- Нижняя панель (видна до 767 px, см. обязательный блок) --- */

.tabbar__item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: 500 12px/1.2 var(--sans);
  text-decoration: none;
  cursor: pointer;
}

.tabbar__item .icon {
  width: 22px;
  height: 22px;
  color: var(--moss);
}

.tabbar__item .count {
  position: absolute;
  top: 6px;
  left: calc(50% + 4px);
}

/* --- Общие компоненты из ui.css в системе v3 --- */

/* Ссылка «К основному содержанию» спрятана сдвигом вверх (обязательный блок). Прозрачность вне фокуса
   убирает её и со скриншотов высоких блоков, где Playwright дорисовывает область над окном. */
.skip:not(:focus) {
  opacity: 0;
}

/* В ui.css у мелких кнопок радиус 0.6 × --kb-ui-radius (7 px); в v3 радиус один — 12 px. */
.kb-cart__qty button,
.kb-toast__action,
.kb-search__item {
  border-radius: var(--radius);
}

/* Тост в ui.css стоит от left: 50% и без ширины сжимается до половины экрана; на ≤767 его растягивает сам ui.css. */
@media (min-width: 768px) {
  .kb-toast {
    width: max-content;
  }
}

/* --- Адаптив --- */

@media (max-width: 1199px) {
  .kits-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* 1100–1279 px: навигация уже видна, а места мало — зазоры в шапке уже, полю поиска остаётся больше ширины. */
@media (min-width: 1100px) and (max-width: 1279px) {
  .top__bar,
  .top__nav {
    gap: 16px;
  }

  .story h3 {
    font-size: 20px;
  }
}

@media (max-width: 1099px) {
  .top__nav {
    display: none;
  }

  .top__search {
    flex-basis: 360px;
    margin-left: auto;
  }

  .story {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "intro intro"
      "box buy"
      "plan plan";
  }

  .how,
  .nodes-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .story__plan h3 {
    min-height: 0;
  }

  .section:has(> .dialog) {
    display: block;
  }

  .section:has(> .dialog) > .section__head {
    margin-bottom: 40px;
  }

  .foot__inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }

  .foot__legal p {
    flex-basis: 100%;
    padding-top: 8px;
  }
}

@media (max-width: 899px) {
  .kits-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stories,
  .cards3,
  .final {
    grid-template-columns: minmax(0, 1fr);
  }

  .final__art {
    justify-self: center;
  }
}

/* Истории в одну колонку на планшете: арка слева, цитата справа — иначе три арки по 540 px высотой. */
@media (min-width: 600px) and (max-width: 899px) {
  .story-card {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: center;
    column-gap: 28px;
    padding: 12px 24px 12px 12px;
  }

  .story-card__art {
    grid-row: span 2;
    align-self: center;
  }

  .story-card blockquote {
    align-self: end;
    padding: 0;
  }

  .story-card figcaption {
    align-self: start;
    padding: 14px 0 0;
  }
}

@media (max-width: 767px) {
  html {
    scroll-padding-top: 132px;
  }

  /* Плашка «Прототип» строкой текста: без flex-переноса «Все версии» не уходит на третью строку. */
  .kb-proto {
    display: block;
  }

  .story h3 {
    min-height: 0;
  }

  .top__bar {
    flex-wrap: wrap;
    gap: 8px 12px;
    min-height: 0;
    padding-block: 10px 12px;
  }

  .top__search {
    flex: 1 1 100%;
    order: 3;
    margin-left: 0;
  }

  .top__cart {
    justify-content: center;
    width: 46px;
    margin-left: auto;
    padding: 0;
  }

  .top__cart-label {
    display: none;
  }

  .top__cart .count {
    position: absolute;
    top: -7px;
    right: -7px;
  }

  .lead {
    font-size: 18px;
  }

  .section__head--row {
    flex-direction: column;
    align-items: flex-start;
  }

  .story {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "intro"
      "box"
      "buy"
      "plan";
  }

  .bubble {
    max-width: 92%;
  }

  .foot__inner,
  .foot__nav {
    grid-template-columns: minmax(0, 1fr);
  }

  .foot__nav {
    gap: 24px;
  }
}

@media (max-width: 599px) {
  .kits-grid,
  .how {
    grid-template-columns: minmax(0, 1fr);
  }

  .nodes-row {
    grid-template-columns: none;
    grid-auto-columns: 72%;
    grid-auto-flow: column;
    gap: 12px;
    margin-inline: calc(-1 * var(--pad));
    padding: 0 var(--pad) 8px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-padding-inline: var(--pad);
    scroll-snap-type: x mandatory;
  }

  .node-card {
    scroll-snap-align: start;
  }

  .kit-card__lead {
    min-height: 0;
  }

  .legend {
    display: grid;
    grid-template-columns: repeat(2, max-content);
    justify-content: center;
    gap: 10px 28px;
  }

  /* Метки «Т-узел» и «Кронштейн» на узкой арке ближе 32 px — уменьшаем кружки, чтобы не наезжали. */
  .marker {
    width: 26px;
    height: 26px;
    margin: -13px 0 0 -13px;
    font-size: 13px;
  }
}
