/* Модули «Сборочный чертёж»: чертёж с позициями, спецификация, листинги. Перенос _dev/design/modules/style.css. */

/* пока виден баннер cookie, у страницы есть место снизу */
body.has-cookie { padding-bottom: 110px; }
.code { font-family: var(--mono); font-size: var(--fs-label); letter-spacing: -.02em; color: var(--graphite); }

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

.tbd { font-style: italic; font-size: var(--fs-small); }

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

/* ---------- Лист ---------- */

/* ---------- Лист 1: сборочный чертёж ---------- */
.frame--hero {
  flex: 1;
  display: grid;
  grid-template-columns: 420px minmax(0, 1fr);
  padding: 0;
}

.intro {
  display: flex; flex-direction: column; align-items: flex-start;
  padding: 36px 28px 0;
  border-right: 1px solid var(--hair);
}
.intro h1 { font-size: var(--fs-headline); line-height: 1.04; letter-spacing: -.01em; text-wrap: balance; }
.intro__lead { margin-top: 16px; font-size: var(--fs-body); line-height: 1.45; text-wrap: pretty; }

/* доказательство для владельца: шапка величины над цифрами, как Label в шапке графы */
.proof { margin-top: 28px; align-self: stretch; }
.proof__h { font-size: var(--fs-annotation); font-weight: 600; line-height: 1.3; text-wrap: pretty; }
.proof__t { width: 100%; margin-top: 10px; border-collapse: collapse; }
.proof__t th, .proof__t td { padding: 8px 0; text-align: left; vertical-align: baseline; border-bottom: 1px solid var(--hair); }
.proof__t thead th { padding: 0 0 6px; font-size: var(--fs-label); font-weight: 400; font-style: italic; color: var(--graphite); line-height: 1.3; border-bottom: 1.5px solid var(--ink); }
.proof__t thead th + th, .proof__t td { text-align: right; padding-left: 16px; }
.proof__t thead th + th { width: 180px; }
.proof__t tbody th { font-size: var(--fs-annotation); font-weight: 400; }
.proof__t tbody th a { display: inline-block; padding: 2px 0; min-height: 24px; font-weight: 600; text-decoration-line: underline; }
.proof__t tbody th span { margin-left: 6px; font-size: var(--fs-label); font-style: italic; color: var(--graphite); font-variant-numeric: tabular-nums; }
.proof__t td { font-size: var(--fs-label); white-space: nowrap; }
.proof__t td .num { font-size: var(--fs-figure); }
.proof__ref { font-style: normal; }
.proof__note { margin-top: 8px; font-size: var(--fs-label); font-style: italic; color: var(--graphite); line-height: 1.4; }

/* путь разработчика — одна строка ссылок, без рамок: прямые ссылки на Маркетплейс, документация, листинг */
.dev { align-self: stretch; margin-top: 24px; padding-top: 12px; border-top: 1px solid var(--hair); font-size: var(--fs-small); line-height: 1.5; color: var(--graphite); text-wrap: pretty; }
.dev__h { font-style: italic; }
.dev a { display: inline-block; color: var(--ink); font-weight: 600; text-decoration-line: underline; white-space: nowrap; }
.dev .ic--out { width: 12px; height: 12px; margin-left: 3px; vertical-align: 0; }

/* поле чертежа: масштаб 1:1, кегли подписей — из шкалы DESIGN.md */
.draw-wrap { position: relative; min-height: 0; }
.draw { position: absolute; top: max(12px, calc((100% - 640px) / 2)); left: 10px; width: 912px; height: 600px; overflow: visible; font-family: var(--sans); }

/* штамп первого листа: главное действие и условия, вплотную к правому нижнему углу рамки */
.stamp { --stamp-seal-room: 20px; position: absolute; right: 0; bottom: 0; z-index: 2; width: 352px; }
.stamp__who { display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-bottom: 1px solid var(--ink); }
.stamp__who img { width: 40px; height: 50px; object-fit: cover; object-position: 50% 18%; border: 1px solid var(--ink); }
.stamp__who b { display: block; font-size: var(--fs-annotation); font-weight: 600; line-height: 1.2; }
.stamp__who span { font-size: var(--fs-label); }
.stamp__cta { width: 100%; border-bottom: 1px solid var(--ink); }
.stamp__facts { margin: 0; }
.stamp__facts li { padding: 8px 14px; line-height: 1.35; }
.stamp__facts a { text-decoration-line: underline; white-space: nowrap; }
/* цена в обоих штампах: сумма моно, ₽ — Fira через узкий пробел */
.stamp .num { font-size: var(--fs-figure); color: var(--ink); }
.stamp__sheet { margin: 0; border-top: 1px solid var(--ink); font-size: var(--fs-label); }
.stamp__sheet > * { padding: 7px 14px; }
.stamp__sheet b { flex: 1; font-weight: 400; color: var(--ink); }
.stamp__sheet > span { border-left: 1px solid var(--hair); }

/* страница сайта */
.pg__body { fill: var(--paper); stroke: var(--ink); stroke-width: 2; }
.pg__rule { stroke: var(--ink); stroke-width: 1.4; }
.pg__hair { stroke: var(--hair); stroke-width: 1; }
.pg__thin { fill: none; stroke: var(--thin); stroke-width: 1; }
.pg__line { stroke: var(--graphite); stroke-width: 1.4; }
.pg__head { stroke: var(--ink); stroke-width: 5; }
.pg__head2 { stroke: var(--ink); stroke-width: 3; }
.pg__box { fill: none; stroke: var(--ink); stroke-width: 1.2; }
.pg__hidden { fill: var(--side-l); stroke: var(--ink); stroke-width: 1.2; stroke-dasharray: 6 4; }
.pg__edge { stroke: var(--graphite); stroke-width: 1.2; }
.pg__gn { fill: var(--paper); stroke: var(--ink); stroke-width: 1.4; }
.tab { fill: var(--paper); stroke: var(--ink); stroke-width: 1.2; }
.tab--on { fill: var(--ink); }
.tab__t { font-size: var(--fs-label); font-weight: 600; fill: var(--ink); }
.tab__t--on { fill: var(--paper); }
.file { fill: var(--paper); stroke: var(--ink); stroke-width: 1.4; stroke-linejoin: round; }
.file__fold { fill: none; stroke: var(--ink); stroke-width: 1.2; }
.file__t { font-size: var(--fs-label); font-weight: 600; fill: var(--ink); }
.conn { stroke: var(--ink); stroke-width: 1.2; stroke-dasharray: 10 3 2 3; }
.cap { font-size: var(--fs-label); font-style: italic; fill: var(--graphite); }

.node * { transition: stroke .3s, fill .3s; }

/* позиции: выноска, номер в кружке, название, что закрывает, код */
.pos { text-decoration: none; cursor: pointer; }
.pos__hit { fill: transparent; stroke: none; }
.pos:focus { outline: none; }
.pos:focus-visible .pos__hit { stroke: var(--blue); stroke-width: 2; }
.lead { fill: none; stroke: var(--ink); stroke-width: 1.2; transition: stroke .3s; }
.draw marker circle { fill: var(--ink); }
.ball { fill: var(--paper); stroke: var(--ink); stroke-width: 1.6; transition: fill .3s, stroke .3s; }
.ball__n { font: 400 var(--fs-annotation) var(--mono); fill: var(--ink); transition: fill .3s; }
.pos__name { font-size: var(--fs-title); font-weight: 600; fill: var(--ink); transition: fill .3s; }
.pos__what { font-size: var(--fs-annotation); font-style: italic; fill: var(--ink); }
/* код модуля — у всех пяти одинаково: моно, графит, часть позиции (ссылки на Маркетплейс — на листе 1 слева и в таблице) */
.pos__code { font: 400 var(--fs-label) var(--mono); letter-spacing: -.02em; fill: var(--graphite); }

/* подсветка позиции и её узла: наведение, фокус (без скрипта), строка спецификации */
.pos:is(:hover, :focus-visible, .is-on) .lead { stroke: var(--blue); stroke-width: 1.6; }
.pos:is(:hover, :focus-visible, .is-on) .ball { fill: var(--blue-tint); stroke: var(--blue); }
.pos:is(:hover, :focus-visible, .is-on) .ball__n { fill: var(--blue-ink); }
.pos:is(:hover, :focus-visible, .is-on) .pos__name { fill: var(--blue-ink); text-decoration: underline; }
/* узел подсвечивается классом is-on: от позиции на чертеже и от строки спецификации */
.node.is-on .pg__line, .node.is-on .pg__thin, .node.is-on .pg__edge { stroke: var(--blue); }
.node.is-on .pg__head, .node.is-on .pg__head2, .node.is-on .pg__box, .node.is-on .tab,
.node.is-on .file, .node.is-on .file__fold, .node.is-on .pg__gn, .node.is-on .pg__hidden { stroke: var(--blue); }
.node.is-on .pg__hidden, .node.is-on .file, .node.is-on .tab:not(.tab--on) { fill: var(--blue-tint); }
.node.is-on .tab--on { fill: var(--blue); }
.node.is-on .file__t, .node.is-on .tab__t:not(.tab__t--on) { fill: var(--blue-ink); }

/* одна авторская анимация: выноски дотягиваются до узлов. Номера и подписи видны сразу, анимируется только линия */
@media (prefers-reduced-motion: no-preference) {
  .lead { stroke-dasharray: 1; animation: draw-lead .9s var(--ease) backwards; }
  .pos[data-pos="1"] .lead { animation-delay: .1s; }
  .pos[data-pos="2"] .lead { animation-delay: .2s; }
  .pos[data-pos="3"] .lead { animation-delay: .3s; }
  .pos[data-pos="4"] .lead { animation-delay: .4s; }
  .pos[data-pos="5"] .lead { animation-delay: .5s; }
}
@keyframes draw-lead { from { stroke-dashoffset: 1; }
}
@media print { .lead { animation: none; }
}

/* ---------- Лист 2: спецификация ---------- */

.spec-h { margin-bottom: 28px; }

.mods { width: 100%; table-layout: fixed; border-collapse: collapse; border: var(--frame) solid var(--ink); }
/* графы как в смете: цена и редакции — отдельные узкие */
.mods .c-pos { width: 48px; }
.mods .c-mod { width: 340px; }
.mods .c-mkt { width: 300px; }
.mods .c-dev { width: 172px; }
.mods th, .mods td { border: 1px solid var(--ink); padding: 11px 14px; text-align: left; vertical-align: top; }
.mods thead th { font-weight: 400; font-style: italic; font-size: var(--fs-label); color: var(--graphite); padding: 6px 14px; border-bottom-width: 2px; }
.mods tbody tr { transition: background .25s; }
.mods tbody tr.is-on, .mods tbody tr:target { background: var(--blue-tint); }
.mods__n { text-align: center; font-size: var(--fs-figure); }
/* номер связанной строки — светло-синий с синей цифрой, как кружок позиции (The Tint Is A Result) */
.mods tbody tr.is-on .mods__n, .mods tbody tr:target .mods__n { background: var(--blue-tint); color: var(--blue-ink); }
.mods tbody th { font-weight: 400; }
.mods tbody th b { font-size: var(--fs-title); font-weight: 600; line-height: 1.1; }
.mods__alias { white-space: nowrap; font-size: var(--fs-label); font-style: italic; color: var(--graphite); }
.mods__code { display: block; margin-top: 4px; }
.mods__how { display: block; margin-top: 2px; font-size: var(--fs-label); line-height: 1.35; color: var(--graphite); text-wrap: pretty; }
.mods__gain { font-size: var(--fs-body); line-height: 1.4; text-wrap: pretty; }
.mods__gain a { font-weight: 600; text-decoration-line: underline; }
.res { margin-top: 6px; font-size: var(--fs-small); line-height: 1.4; color: var(--graphite); }
.res a { color: var(--ink); }
.mods__dev { font-size: var(--fs-small); }
.mods__links { white-space: nowrap; color: var(--graphite); }
.mods__hint { display: block; margin-top: 2px; font-size: var(--fs-label); line-height: 1.3; }
.mods__none { color: var(--graphite); }
/* графа «На Маркетплейсе»: строки ссылка · цена · редакции */
.mkt { font-size: var(--fs-small); }
.mkt > * + * { margin-top: 6px; }
.mkt a { display: table; }
.mkt__price, .mkt__ed { display: block; }
.mkt__price { font-weight: 600; }
.mkt a { padding: 2px 0; font-family: var(--mono); font-size: var(--fs-label); letter-spacing: -.02em; font-weight: 400; text-decoration-line: underline; }
.mkt a .ic--out { width: 12px; height: 12px; margin-left: 2px; }
/* уточнения для покупателя — одна строка под таблицей */
.buy { margin-top: 12px; font-size: var(--fs-small); color: var(--graphite); }
.buy > span { white-space: nowrap; color: var(--ink); }
.buy .tbd { margin-left: 4px; }
.mods__links a { display: inline-block; padding: 2px 0; color: var(--ink); font-weight: 600; text-decoration-line: underline; }

/* «Показать / Скрыть код» — малая контурная кнопка с шевроном, по форме не ссылка */
.more {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 8px; min-height: 32px; padding: 5px 10px 5px 12px;
  font: 600 var(--fs-label)/1 var(--sans); color: var(--ink);
  background: var(--paper); border: 1px solid var(--ink);
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
}
.more:hover, .more:focus-visible { background: var(--ink); color: var(--paper); }
.more[hidden] { display: none; }
.ic--chev { width: 14px; height: 14px; transition: transform .25s var(--ease); }
.more[aria-expanded="true"] .ic--chev { transform: rotate(180deg); }

/* раскрывающаяся строка: листинг из статьи и факты для разработчика */
.mods .mods__more > td { padding: 0; border-top-color: var(--hair); }
.mods .mods__more > td + td { padding: 18px 18px 22px; }
.mods tbody tr.mods__more.is-on, .mods tbody tr.mods__more:target { background: var(--paper); }
.more__in { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 36px; align-items: start; }
.more__note { font-size: var(--fs-small); color: var(--graphite); max-width: 70ch; text-wrap: pretty; }
.more__note code, .facts code { font-family: var(--mono); font-size: var(--fs-label); letter-spacing: -.02em; color: var(--ink); }
.more__article { margin-top: 14px; font-size: var(--fs-small); color: var(--graphite); }
.more__article a { color: var(--ink); text-decoration-line: underline; }

.listing { margin: 12px 0 0; }
.listing__cap .copy { margin-left: auto; }
.listing pre code { font: inherit; letter-spacing: inherit; }
.t-c { color: var(--graphite); font-style: italic; }
.t-v { font-weight: 600; }
.t-s { color: var(--ink); }

.facts { margin: 0; border-top: 1.5px solid var(--ink); }
.facts div { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--hair); }
.facts dt { font-size: var(--fs-label); font-style: italic; color: var(--graphite); }
.facts dd { margin: 0; font-size: var(--fs-small); line-height: 1.4; }

/* последний лист закрыт штампом-призывом в правом нижнем углу рамки */
.frame--spec { padding-bottom: 0; }
.close { display: flex; align-items: flex-start; justify-content: space-between; gap: 40px; margin: 40px calc(-1 * var(--frame-x)) 0 0; }
.close__fact { max-width: 34ch; padding-top: 18px; font-size: var(--fs-title); font-weight: 600; line-height: 1.3; letter-spacing: -.01em; text-wrap: balance; }
.stamp--end { position: static; flex: none; width: 420px; }
.stamp__offer { padding: 12px 14px; border-bottom: 1px solid var(--ink); }
.stamp__offer b { display: block; font-size: var(--fs-title); font-weight: 600; line-height: 1.15; text-wrap: balance; }
.stamp__offer > span { display: block; margin-top: 4px; font-size: var(--fs-small); color: var(--graphite); }
.stamp__offer .num { font-size: var(--fs-figure); color: var(--ink); }

/* ---------- Низкое окно (1440×768) ---------- */

@media (max-height: 820px) and (min-width: 1180px) {
.top { margin-bottom: 6px; }
@container hero (width >= 1330px) {
  .intro { padding: 20px 28px 0; }
  .intro__lead { margin-top: 10px; font-size: var(--fs-body); }
  .proof { margin-top: 18px; }
  /* сноска о «раньше» уже читается в «+4 языка»: в низком окне её убираем, низ колонки свободен под баннер cookie */
  .proof__note { display: none; }
  .proof__t th, .proof__t td { padding-top: 6px; padding-bottom: 6px; }
  .dev { margin-top: 14px; padding-top: 8px; line-height: 1.4; }
  /* чертёж в масштабе 1:1, только выше */
  .draw { top: 0; }
  /* штамп ниже: фото убираем, имя остаётся */
  .stamp__who img { display: none; }
  .stamp__who { padding: 6px 14px; }
  .stamp__who p { display: flex; align-items: baseline; gap: 8px; }
  .stamp__facts li { padding: 6px 14px; }
}
}

.proof th span { white-space: nowrap; }


/* ---------- Узкие экраны ---------- */

.sheet--hero { container: hero / inline-size; }
.draw-wrap { container: draw / inline-size; }
.frame--spec { container: spec / inline-size; }

/* вступление 420 и чертёж 912 рядом не помещаются (лист уже, чем при окне 1440): вступление, чертёж, штамп в правом нижнем углу — друг под другом */
@container hero (width < 1330px) {
  .frame--hero { grid-template-columns: minmax(0, 1fr); }
  .intro { padding: var(--pad) var(--pad) 28px; border-right: 0; border-bottom: 1px solid var(--hair); }
  .proof, .dev { max-width: 640px; }
  .draw-wrap { overflow: clip; padding: 20px var(--pad) 28px; }
  .draw { position: static; display: block; margin: 0 auto; }
  .stamp { position: static; justify-self: end; width: min(440px, 100%); }
}

/* 1000–1330 (окно ~1100–1430): вступление — строкой в две колонки над чертежом; чертёж 1:1 слева, штамп — в правом
   нижнем углу рамки поверх пустого угла чертежа (как на развороте), под чертежом — поле под нижнюю часть штампа */
@container hero (1000px <= width < 1330px) {
  .intro {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 56px;
    grid-template-areas: "h proof" "lead proof" "dev proof"; grid-template-rows: auto auto 1fr; align-items: start;
  }
  .intro h1 { grid-area: h; }
  .intro__lead { grid-area: lead; }
  .proof { grid-area: proof; margin-top: 4px; max-width: none; }
  .dev { grid-area: dev; max-width: none; }
  .draw-wrap { position: relative; padding: 20px var(--pad) 120px; }
  .draw { margin: 0; }
  .stamp { position: absolute; right: 0; bottom: 0; width: 352px; }
}

/* колонка уже чертежа: выноски уходят в список, на чертеже — окно изделия 1:1 с номерами у узлов */
@container draw (width < 912px) {
  .draw {
    /* окно изделия (x 228–688) по центру; уже 464px оно ужимается до ширины колонки */
    width: min(912px, 100cqw * 1.966); max-width: none; height: auto;
    margin: -8px 0 -36px 50%; transform: translateX(-50%);
  }
  .draw .pos { display: none; }
  .draw .pins { display: inline; }
  .positions { display: block; margin-top: 12px; }
}

/* таблица модулей складывается в строки-блоки: модуль и цена в строке, что получает сайт — под ними */
@container spec (width < 1100px) {
  .mods, .mods tbody { display: block; }
  .mods thead, .mods colgroup { display: none; }
  .mods tbody tr {
    display: grid; grid-template-columns: 48px minmax(0, 1fr) minmax(0, 17em);
    /* слева модуль и что получает сайт, справа ссылка и код — каждая колонка без разрывов: лишняя высота уходит в последнюю строку */
    grid-template-rows: auto auto auto 1fr;
    grid-template-areas: "n mod mkt" "n gain mkt" "n gain dev" "n gain .";
  }
  .mods tbody tr + tr { border-top: 1px solid var(--ink); }
  .mods tbody tr.mods__more { grid-template-areas: "n more"; grid-template-columns: 48px minmax(0, 1fr); border-top-color: var(--hair); }
  .mods th, .mods td { border: 0; }
  .mods .mods__n, .mods .mods__n-cont { grid-area: n; border-right: 1px solid var(--ink); text-align: center; }
  .mods tbody th { grid-area: mod; padding-bottom: 4px; }
  .mods__gain { grid-area: gain; padding-top: 4px; }
  .mkt { grid-area: mkt; }
  .mods__dev { grid-area: dev; padding-top: 0; }
  .mods .mods__more > td + td { grid-area: more; }
  .mods__gain::before, .mkt::before, .mods__dev::before { content: attr(data-label); display: block; margin-bottom: 4px; font-size: var(--fs-label); font-style: italic; color: var(--graphite); }
  .mods__gain::before { content: none; }
  .more__in { grid-template-columns: minmax(0, 1fr); gap: 20px; }
}
@container spec (width < 620px) {
  .mods tbody tr { grid-template-columns: 40px minmax(0, 1fr); grid-template-rows: none; grid-template-areas: "n mod" "n gain" "n mkt" "n dev"; }
  .mods tbody tr.mods__more { grid-template-columns: 40px minmax(0, 1fr); }
  .mods th, .mods td { padding-left: 12px; padding-right: 12px; }
  .mods .mods__n { padding: 11px 0; }
  .mods .mods__more > td + td { padding: 14px 12px 18px; }
  .mkt, .mods__dev { padding-top: 6px; }
}

@container spec (width < 760px) {
  .close { flex-direction: column; align-items: stretch; gap: 20px; }
  .close__fact { padding-top: 0; }
  .stamp--end { align-self: flex-end; width: min(420px, 100%); }
}

/* касание: отдельные ссылки строки модуля — с полями до 44px */
@media (pointer: coarse) {
  .mods__links a, .mkt a { padding: 10px 0; }
}

/* узкий лист: штампы во всю ширину рамки */
@media (max-width: 719px) {
  .stamp { width: 100%; }
  .stamp--end { width: 100%; }
}
