/* OWNS: .xfpd-* — страница одной готовой сборки (#514, этап 2A),
   /onlayn-konfigurator/sborki/<code>/. Плюс один допустимый local override:
   `.xfpd .xf-crumbs a` — тап-цель крошек на этой странице (тот же приём, что
   .xfp .xf-crumbs a в configurator-presets.css: вид крошек остаётся за
   catalog.css, здесь только площадь нажатия).

   Свой островок: из чужого каскада берём только ГОТОВЫЕ примитивы шаблона по
   их собственным классам (.xf-pill, .xf-btn, .xf-art, .xf-crumbs) и токены
   tokens.css — ничего из них здесь не переопределяется. Точка статуса
   (.xfp-card__dot, из xfp_status_dot()) и сетка карточек (.xfp-grid) —
   готовые примитивы блока пресетов (css/configurator-presets.css, agent B):
   их форма приходит оттуда, здесь только цвет через свой [data-status].
   Движение — только через var(--xf-motion, 1) (The Motion-Multiplier Rule).
   Per-element :focus не пишем — глобальный :focus-visible в ui.css. */

.xfpd { padding: 20px 0 56px; font-family: var(--font-sans); color: var(--text); }
.xfpd *, .xfpd-more-section * { box-sizing: border-box; }

/* Тап-цель крошек ≥44px без сдвига строки (см. исключение в шапке файла). */
.xfpd .xf-crumbs { margin-bottom: 22px; }
.xfpd .xf-crumbs a { display: inline-block; padding: 14px 0; margin: -14px 0; }

/* ============================================================== hero ======= */
/* Мобильный порядок — ровно DOM-порядок (media, затем инфо-блок): один
   столбец, media сверху. На десктопе grid раскладывает те же два ребёнка в
   два столбца борт о борт без переопределения DOM — реордер не нужен. */
.xfpd-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
  margin-bottom: 44px;
  align-items: start;
}
@media (min-width: 992px) {
  .xfpd-hero { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 48px; }
}

.xfpd-hero__media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 18px;
  background: var(--surface-3);
  border: 1px solid var(--line-soft);
}
.xfpd-hero__media .xf-art { padding: 32px; }
.xfpd-hero__media .xf-art__img { max-width: 100%; max-height: 100%; object-fit: contain; }
@media (max-width: 767.98px) {
  /* Карточка на телефоне тоже 16/9 (аудит #314) — цена обязана остаться в
     первом экране, а не уехать за фотографией на всю высоту. */
  .xfpd-hero__media { aspect-ratio: 16 / 9; }
}

/* Инфо-колонка — sticky только на десктопе (образец .xfc-side,
   configurator2.css): max-height + внутренний скролл, чтобы на низком
   вьюпорте кнопка и приписка не прятались под фолдом без возможности
   доскроллить (тот же P1, что решался у .xfc-side). */
.xfpd-hero__info { display: flex; flex-direction: column; min-width: 0; }
@media (min-width: 992px) {
  .xfpd-hero__info {
    position: sticky; top: 96px;
    max-height: calc(100dvh - 112px); overflow-y: auto; scrollbar-width: thin;
    padding-right: 2px; margin-right: -2px;
  }
}

.xfpd-labels { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }

.xfpd-title-row { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.xfpd-title {
  margin: 0; font-weight: 600; color: var(--text);
  font-size: 32px; line-height: 1.15; letter-spacing: -0.8px;
}

.xfpd-price { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
/* «от» — слово, значит Onest; сумма — данные, значит mono (Mono-as-Data). */
.xfpd-price__from { font-size: 15px; color: var(--text-3); }
.xfpd-price__sum { font-family: var(--font-mono); font-size: 36px; font-weight: 600; letter-spacing: -1px; color: var(--text); }

/* Наличие — своя обёртка (.xfpd-stock), цвет — свой [data-status], форма
   точки (размер/тень) приходит бесплатно из .xfp-card__dot (agent B),
   выбранный тут же вызовом xfp_status_dot(). Конструкция и цвета — те же,
   что на карточке (.xfp-card__stock) и по всему шаблону (карточка листинга,
   корзина, панель совместимости конфигуратора). */
.xfpd-stock-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.xfpd-stock {
  display: flex; align-items: flex-start; gap: 7px;
  font-size: 14px; font-weight: 500; letter-spacing: 0.01em; line-height: 1.4;
}
.xfpd-stock .xfp-card__dot { margin-top: calc((1em * 1.4 - 6px) / 2); }
.xfpd-stock[data-status="ok"]           { color: var(--success); }
.xfpd-stock[data-status="on_order"]     { color: var(--warning); }
.xfpd-stock[data-status="missing_soft"] { color: var(--warning); }
.xfpd-stock[data-status="missing"]      { color: var(--danger); }

.xfpd-text { margin: 0 0 20px; font-size: 15px; line-height: 1.55; color: var(--text-2); max-width: 62ch; }

.xfpd-cta { width: 100%; justify-content: center; margin-bottom: 10px; }
.xfpd-note { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-3); }

/* ============================================================= состав ====== */
.xfpd-parts { margin-bottom: 48px; }
.xfpd-parts__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.xfpd-parts__title { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -0.3px; color: var(--text); }
.xfpd-parts__count { font-family: var(--font-mono); font-size: 13px; color: var(--text-3); white-space: nowrap; }

.xfpd-parts__list {
  list-style: none; margin: 0; padding: 0;
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: 14px; overflow: hidden;
}
.xfpd-parts__row {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center; gap: 12px;
  padding: 14px 18px; border-top: 1px solid var(--line-soft);
}
.xfpd-parts__row:first-child { border-top: 0; }
.xfpd-parts__icon {
  width: 28px; height: 28px; border-radius: 8px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--text-3);
}
.xfpd-parts__icon svg { width: 16px; height: 16px; }
.xfpd-parts__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.xfpd-parts__step { font-size: 12px; color: var(--text-3); }
.xfpd-parts__name {
  font-size: 14.5px; color: var(--text); line-height: 1.4;
  /* Полное имя, перенос по словам — это страница, не карточка (короткого
     short-имени тут нет). overflow-wrap: anywhere — только страховка от
     неразрывного длинного артикула шире колонки. */
  overflow-wrap: anywhere;
}
/* Тап-цель ссылки детали заметно меньше 44px (38.8px у двухстрочного имени,
   ~20px у однострочного) — раскладку не трогаем, площадь нажатия добираем
   невидимым слоем (тот же приём, что .xfp-card__parts-sum::before раньше в
   этом же блоке). Строка несёт 14px паддинга сверху/снизу (.xfpd-parts__row),
   поэтому -12px по вертикали заходит в соседнюю строку максимум на 2px —
   пересечение с чужим текстом, а не с чужой тап-целью (там нет своего слоя),
   промах не создаёт. inline-block обязателен: у строчной ссылки абсолютный
   ::before привязывается к одному фрагменту строки (замер на проде: 49px из
   175px ширины двухстрочного имени), и слой накрывал только хвост. */
.xfpd-parts__link { display: inline-block; position: relative; color: inherit; text-decoration: none; }
.xfpd-parts__link::before { content: ""; position: absolute; inset: -12px -6px; }
.xfpd-parts__link:hover { color: var(--accent-2); text-decoration: underline; }
.xfpd-parts__qty { font-family: var(--font-mono); font-size: 13px; color: var(--text-3); white-space: nowrap; }
.xfpd-parts__value { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; white-space: nowrap; }
.xfpd-parts__sum { font-family: var(--font-mono); font-size: 14.5px; color: var(--text); }
.xfpd-parts__why { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; }
.xfpd-parts__why[data-status="missing"]  { color: var(--danger); }
.xfpd-parts__why[data-status="on_order"] { color: var(--warning); }

.xfpd-parts__row--total {
  background: var(--surface-2);
}
.xfpd-parts__total-label { grid-column: 1 / span 2; font-size: 15px; font-weight: 600; color: var(--text); }
.xfpd-parts__total-value { display: flex; align-items: baseline; gap: 6px; justify-self: end; }
.xfpd-parts__total-from { font-size: 13px; color: var(--text-3); }
.xfpd-parts__total-sum { font-family: var(--font-mono); font-size: 20px; font-weight: 600; letter-spacing: -0.4px; color: var(--text); }
.xfpd-parts__footnote { margin: 8px 2px 0; font-size: 12.5px; color: var(--text-3); }

/* ========================================================= другие сборки === */
.xfpd-more-section { margin-bottom: 8px; }
.xfpd-more__title { margin: 0 0 16px; font-size: 22px; font-weight: 600; letter-spacing: -0.3px; color: var(--text); }
/* .xfp-grid (agent B, configurator-presets.css) уже даёт 3/2/1-колоночную
   раскладку — здесь только собственный вертикальный отступ блока. */
.xfpd-more { margin: 0; }

/* ============================================================= sticky ====== */
/* Мобильный CTA-бар — зеркалит .xf-buy-sticky (product.css): скрыт на
   десктопе через display:none (сам компонент), transition гейтится
   .is-initialized (без анимации на первый показ, FOUC-страховка), тройной
   гейт скрытого состояния (transform + opacity + pointer-events).
   translateY(100% + safe-area) — позиционный уход бара за экран, а не
   декоративный сдвиг, поэтому var(--xf-motion, 1) здесь не участвует вовсе
   (The Motion-Multiplier Rule, следствие про позиционные трансформы); под
   reduced-motion гасим не саму величину, а transition — см. блок в конце
   файла, тот же приём и тот же селектор специфичности, что у
   .xf-buy-sticky.is-initialized. */
.xfpd-sticky { display: none; }
@media (max-width: 767.98px) {
  .xfpd-sticky {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: color-mix(in oklch, var(--bg) 92%, transparent);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line-soft);
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
    transform: translateY(calc(100% + env(safe-area-inset-bottom, 0px)));
    opacity: 0; pointer-events: none;
  }
  .xfpd-sticky.is-initialized { transition: transform .22s ease-out, opacity .18s ease-out; }
  .xfpd-sticky.is-visible { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .xfpd-sticky__inner { display: flex; align-items: center; gap: 10px; }
  .xfpd-sticky__price {
    flex: 0 0 auto; font-family: var(--font-mono); font-size: 16px; font-weight: 600;
    color: var(--text); letter-spacing: -0.3px; line-height: 1;
    display: flex; align-items: baseline; gap: 4px;
  }
  .xfpd-sticky__from { font-size: 11px; font-family: var(--font-sans); color: var(--text-3); font-weight: 500; }
  .xfpd-sticky__btn { flex: 1 1 auto; min-width: 0; height: 48px; padding: 0 14px; font-size: 14px; }

  /* Первый экран телефона — как на PDP/странице сборок: чуть меньше воздуха
     сверху, крупные заголовок/цена ужаты под узкий вьюпорт. */
  .xfpd { padding: 12px 0 40px; }
  .xfpd-hero { gap: 16px; margin-bottom: 32px; }
  .xfpd-title { font-size: 24px; letter-spacing: -0.5px; }
  .xfpd-price__sum { font-size: 28px; }
  .xfpd-parts__row { padding: 12px 14px; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 10px; }
  .xfpd-parts__icon { width: 24px; height: 24px; }
  /* Место под sticky-бар внизу экрана, чтобы он не перекрывал «Другие сборки». */
  .xfpd-more-section { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
}

/* Выезд бара — позиционный уход за экран (translateY), не декоративный сдвиг,
   и `--xf-motion` его не гейтит (см. комментарий у .xfpd-sticky выше) — под
   reduced-motion гасим не величину, а сам transition, точечно. Ход одинаков
   с редукцией и без — то же решение, что уже принято для .xf-buy-sticky в
   product.css (тот же тройной transform+opacity+pointer-events гейт и то же
   grep-совпадение `reduce` там). Селектор повторяет
   `.xfpd-sticky.is-initialized` (там объявлен сам transition): при меньшей
   специфичности отмена не сработала бы. */
@media (prefers-reduced-motion: reduce) {
  .xfpd-sticky.is-initialized { transition: none; }
}
