/* CLAUDE-FRONTEND-DESIGN-RESUME-20261021: блок «組み付け» в корзине — parts/cart-assembly.php, inc/cart-assembly-view.php.
   Разметка — документированная backend сборки (section.hg-assembly, form.hg-assembly__pair[data-state]); подключается только
   в корзине и только с backend. Язык — корзина R617 (белая карточка, линия, красный акцент).
   Движение одно: при отметке миниатюры шины и диска сходятся, плашка комплекта краснеет; при «уменьшить движение» — без переходов. */

/* Место в сетке корзины: cart.php — форма → блок (woocommerce_before_cart_collaterals) → итоги; v31-cart.css — «сцена за витриной».
   Блок под формой, итоги справа на всю высоту; на телефоне — форма, блок, (реплика, сцена), итоги. */
body.hg-store.woocommerce-cart .hg-cart-layout:has(>.hg-assembly){grid-template-areas:"form card" "assembly card";grid-template-rows:auto 1fr}
body.hg-store.woocommerce-cart .hg-cart-layout:has(>.hg-assembly):has(>.hgc-figure){grid-template-areas:"say fig" "form card" "assembly card";grid-template-rows:auto auto 1fr}
/* Форма корзины в теме липкая (sticky, top 50px) в пределах всей сетки: под ней блок сборки она бы накрывала при прокрутке */
body.hg-store.woocommerce-cart .hg-cart-layout:has(>.hg-assembly)>.hg-cart-form{grid-area:form;position:static}
body.hg-store.woocommerce-cart .hg-cart-layout:has(>.hg-assembly)>.hg-cart-summary{grid-area:card;align-self:start}
body.hg-store.woocommerce-cart .hg-cart-layout>.hg-assembly{grid-area:assembly;align-self:start;min-width:0;margin:0}
body.hg-store.woocommerce-cart .hg-cart-layout:has(>.hgc-figure)>.hg-assembly{margin-top:16px} /* у сцены row-gap:0 */
@media (max-width:800px){
  body.hg-store.woocommerce-cart .hg-cart-layout:has(>.hg-assembly){grid-template-areas:"form" "assembly" "card";grid-template-rows:none}
  body.hg-store.woocommerce-cart .hg-cart-layout:has(>.hg-assembly):has(>.hgc-figure){grid-template-areas:"form" "assembly" "say" "fig" "card"}
  body.hg-store.woocommerce-cart .hg-cart-layout:has(>.hgc-figure)>.hg-assembly{margin:0 0 22px}
}

.hg-store .hg-assembly{--ca-ease:cubic-bezier(.16,1,.3,1);margin:0 0 16px;padding:20px 20px 18px;border:1px solid var(--hg-line);border-radius:12px;background:var(--hg-white);color:var(--hg-ink)}
/* Сброс правил статьи/Woo внутри блока; :where — чтобы правила блока ниже его перекрывали */
.hg-store .hg-assembly :where(h2,p,ul,li,form){margin:0;padding:0}
.hg-store .hg-assembly :where(ul){list-style:none}
html[lang=ja] .hg-store .hg-assembly :is(h2,p,li,strong,span){word-break:auto-phrase}
.hg-store .hg-assembly .hg-sw-icon{display:block;width:20px;height:20px;flex:none}

/* Заголовок и плашка цены сборки (policy.fee_jpy сервера; без цены — без плашки) */
.hg-store .hg-assembly__head{display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"kicker badge" "title badge";align-items:center;gap:6px 18px}
.hg-store .hg-assembly__kicker{grid-area:kicker;display:inline-flex;align-items:center;gap:6px;color:var(--hg-red);font-size:12px;font-weight:800;letter-spacing:.04em;line-height:1.4}
.hg-store .hg-assembly__kicker .hg-sw-icon{width:18px;height:18px}
.hg-store .hg-assembly__title{grid-area:title;font-size:17px;font-weight:800;line-height:1.5;text-wrap:balance}
.hg-store .hg-assembly__badge{grid-area:badge;display:grid;justify-items:center;align-content:center;gap:2px;min-width:96px;padding:8px 12px;border:2px solid var(--hg-red);border-radius:12px;background:var(--hg-white);line-height:1.15;text-align:center}
.hg-store .hg-assembly__badge span{color:var(--hg-ink);font-size:11px;font-weight:800}
.hg-store .hg-assembly__badge strong{color:var(--hg-red);font:800 24px/1.1 Montserrat,"Noto Sans JP",sans-serif;white-space:nowrap}

/* Уведомления сервера (notices) и сводка групп */
.hg-store .hg-assembly__notice{display:flex;align-items:flex-start;gap:8px;margin-top:14px;padding:10px 12px;border-radius:10px;background:var(--hg-soft);font-size:13px;font-weight:600;line-height:1.7}
.hg-store .hg-assembly__notice.is-error{background:color-mix(in srgb,var(--hg-red) 10%,var(--hg-white));color:var(--hg-ink)}
.hg-store .hg-assembly__notice .hg-sw-icon{margin-top:.15em;color:var(--hg-red)}
.hg-store .hg-assembly__summary{margin-top:12px;font-size:13px;font-weight:800;line-height:1.6}

/* Пара — форма-карточка; тело — подпись флажка (вся площадь); выбранная сервером — красная рамка */
.hg-store .hg-assembly__pairs{display:grid;gap:10px;margin-top:16px}
.hg-store .hg-assembly__pair{display:grid;gap:10px;padding:14px 16px;border:1px solid var(--hg-line);border-radius:12px;background:var(--hg-white);transition:border-color .2s ease,box-shadow .25s ease}
.hg-store .hg-assembly__pair[data-state=confirmed]{border-color:var(--hg-red);box-shadow:0 0 0 1px var(--hg-red)}
.hg-store .hg-assembly__pair[data-state=needs_agreement]{border-color:color-mix(in srgb,var(--hg-red) 55%,var(--hg-line));border-style:dashed}
.hg-store .hg-assembly__pair[data-state=incompatible]{border-color:transparent;background:var(--hg-soft)}
.hg-store .hg-assembly__pair[data-state=off]:has(.hg-assembly__toggle:checked){border-color:color-mix(in srgb,var(--hg-red) 70%,var(--hg-line))}
.hg-store .hg-assembly__body{display:grid;grid-template-columns:24px 226px minmax(0,1fr);grid-template-areas:"box visual label" "box visual lines";align-items:center;gap:4px 18px;margin:0;cursor:pointer}
.hg-store .hg-assembly__pair[data-state=incompatible] .hg-assembly__body{grid-template-columns:226px minmax(0,1fr);grid-template-areas:"visual label" "visual lines";cursor:default}
@media (hover:hover){.hg-store .hg-assembly__pair[data-state=off]:hover{border-color:color-mix(in srgb,var(--hg-red) 50%,var(--hg-line))}}
/* Флажок: свой квадрат (Ecomus рисует ::before поверх нативного — снимаем) */
.hg-store .hg-assembly__toggle{grid-area:box;appearance:none;-webkit-appearance:none;position:relative;display:block;width:24px;height:24px;margin:0;border:2px solid var(--hg-muted);border-radius:6px;background:var(--hg-white);cursor:pointer;transition:background-color .15s ease,border-color .15s ease}
.hg-store .hg-assembly__toggle::before{content:none}
.hg-store .hg-assembly__toggle::after{content:"";position:absolute;left:6px;top:1px;width:6px;height:12px;border:solid #fff;border-width:0 2.5px 2.5px 0;background:none;transform:rotate(45deg) scale(0);transition:transform .15s ease}
.hg-store .hg-assembly__toggle:checked{border-color:var(--hg-red);background:var(--hg-red)}
html[data-theme=dark] .hg-store .hg-assembly__toggle:checked{border-color:#dc0100;background:#dc0100}
.hg-store .hg-assembly__toggle:checked::after{transform:rotate(45deg) scale(1)}
.hg-store .hg-assembly__toggle:focus-visible{outline:3px solid var(--hg-red);outline-offset:3px}
@media (hover:hover){.hg-store .hg-assembly__body:hover .hg-assembly__toggle:not(:checked){border-color:var(--hg-ink)}}
.hg-store .hg-assembly__label{grid-area:label;align-self:end;font-size:15px;font-weight:800;line-height:1.5}

/* Визуальная сборка: шина + диск → комплект ×N; настоящие миниатюры строк корзины */
.hg-store .hg-assembly__visual{grid-area:visual;display:grid;grid-template-columns:64px 22px 64px minmax(0,1fr);align-items:center;justify-items:center}
.hg-store .hg-assembly__thumb{position:relative;z-index:1;display:block;width:64px;height:64px;border-radius:10px;overflow:hidden;background:var(--hg-paper);box-shadow:0 0 0 1px var(--hg-line);transition:transform .5s var(--ca-ease),box-shadow .3s ease}
.hg-store .hg-assembly__thumb.is-wheel{z-index:2}
.hg-store .hg-assembly__thumb img{display:block;width:100%;height:100%;max-width:none;object-fit:contain}
.hg-store .hg-assembly__join{position:relative;width:14px;height:14px;transition:opacity .2s ease}
.hg-store .hg-assembly__join::before,.hg-store .hg-assembly__join::after{content:"";position:absolute;left:0;top:6px;width:14px;height:2px;border-radius:2px;background:var(--hg-muted)}
.hg-store .hg-assembly__join::after{transform:rotate(90deg)}
.hg-store .hg-assembly__set{justify-self:end;display:inline-flex;align-items:center;gap:5px;padding:6px 10px 6px 7px;border-radius:999px;background:var(--hg-soft);color:var(--hg-muted);transition:background-color .3s ease,color .3s ease}
.hg-store .hg-assembly__set .hg-sw-icon{width:24px;height:24px}
.hg-store .hg-assembly__set b{font:800 14px/1 Montserrat,sans-serif;font-variant-numeric:tabular-nums}
.hg-store .hg-assembly__pair:has(.hg-assembly__toggle:checked) .hg-assembly__thumb.is-tyre{transform:translateX(16px)}
.hg-store .hg-assembly__pair:has(.hg-assembly__toggle:checked) .hg-assembly__thumb.is-wheel{transform:translateX(-16px);box-shadow:0 0 0 1px var(--hg-line),-6px 0 14px #171b2224}
.hg-store .hg-assembly__pair:has(.hg-assembly__toggle:checked) .hg-assembly__join{opacity:0}
.hg-store .hg-assembly__pair[data-state=confirmed]:has(.hg-assembly__toggle:checked) .hg-assembly__set{background:var(--hg-red);color:#fff}
html[data-theme=dark] .hg-store .hg-assembly__pair[data-state=confirmed]:has(.hg-assembly__toggle:checked) .hg-assembly__set{background:#dc0100}

/* Строки пары: исходные строки корзины — размер, SKU (offer_id), количество */
.hg-store .hg-assembly__lines{grid-area:lines;align-self:start;display:grid;gap:3px;min-width:0}
.hg-store .hg-assembly__line{display:flex;align-items:baseline;gap:8px;min-width:0;color:var(--hg-muted);font-size:12px;line-height:1.55;font-variant-numeric:tabular-nums}
.hg-store .hg-assembly__line b{flex:none;min-width:4.2em;color:var(--hg-ink);font-weight:800}
.hg-store .hg-assembly__line span{min-width:0;overflow-wrap:anywhere}
.hg-store .hg-assembly__sets{margin-top:2px;color:var(--hg-ink);font-size:12px;font-weight:700}

/* Управление: количество и кнопки backend (без JS — основной путь; со скриптом backend флажок отправляет set/remove сам) */
.hg-store .hg-assembly__controls{display:flex;flex-wrap:wrap;align-items:center;gap:8px 10px;padding-top:10px;border-top:1px solid var(--hg-line)}
.hg-store .hg-assembly__qty{display:inline-flex;align-items:center;gap:8px;margin:0 auto 0 0;font-size:12px;font-weight:700;color:var(--hg-muted)}
.hg-store .hg-assembly__qty select{min-width:84px;min-height:44px;padding:8px 30px 8px 12px;border:1px solid var(--hg-line);border-radius:6px;background-color:var(--hg-white);color:var(--hg-ink);font:inherit;font-size:16px;font-weight:700}
/* Больше 99 штук — поле числа (min 1, max сервера) и подпись предела под названием; неверное число — красная рамка после ввода */
.hg-store .hg-assembly__qty small{display:block;font-size:11px;font-weight:600;line-height:1.4}
.hg-store .hg-assembly__qty input{width:84px;min-height:44px;margin:0;padding:8px 10px;border:1px solid var(--hg-line);border-radius:6px;background-color:var(--hg-white);color:var(--hg-ink);font:inherit;font-size:16px;font-weight:700;font-variant-numeric:tabular-nums}
html body.hg-store .hg-assembly__qty input:user-invalid:not(:disabled){border-color:var(--hg-red);box-shadow:0 0 0 1px var(--hg-red)} /* сильнее рамки полей UI-03c (hub.css) */
.hg-store .hg-assembly__btn{min-height:44px;padding:10px 16px;border:1px solid var(--hg-ink);border-radius:6px;background:var(--hg-white);color:var(--hg-ink);font:inherit;font-size:13px;font-weight:800;cursor:pointer}
.hg-store .hg-assembly__btn.is-quiet{border-color:var(--hg-line);color:var(--hg-muted)}
.hg-store .hg-assembly__btn:focus-visible,.hg-store .hg-assembly__qty select:focus-visible,.hg-store .hg-assembly__qty input:focus-visible{outline:3px solid var(--hg-red);outline-offset:3px}
@media (hover:hover){.hg-store .hg-assembly__btn:hover{border-color:var(--hg-red);color:var(--hg-red)}}
/* Заметка состояния пары и «отмечено, но сервер ещё не подтвердил» */
.hg-store .hg-assembly__note{display:flex;align-items:flex-start;gap:8px;font-size:12px;font-weight:700;line-height:1.6}
.hg-store .hg-assembly__note .hg-sw-icon{width:18px;height:18px;margin-top:.1em;color:var(--hg-red)}
.hg-store .hg-assembly__pair[data-state=incompatible] .hg-assembly__note{color:var(--hg-red)}
.hg-store .hg-assembly__pending{display:none;position:relative;padding-left:14px;font-size:12px;font-weight:700;line-height:1.6}
.hg-store .hg-assembly__pending::before{content:"";position:absolute;left:2px;top:.62em;width:6px;height:6px;border-radius:50%;background:var(--hg-red)}
.hg-store .hg-assembly__pair[data-state=off]:has(.hg-assembly__toggle:checked) .hg-assembly__pending.is-on,
.hg-store .hg-assembly__pair:is([data-state=confirmed],[data-state=needs_agreement]):has(.hg-assembly__toggle:not(:checked)) .hg-assembly__pending.is-off{display:block}

/* Что входит и что не меняется */
.hg-store .hg-assembly__points{display:flex;flex-wrap:wrap;gap:8px;margin-top:14px}
.hg-store .hg-assembly__points li{display:inline-flex;align-items:center;gap:6px;min-height:32px;padding:4px 12px 4px 8px;border-radius:999px;background:var(--hg-soft);font-size:12px;font-weight:700;line-height:1.4}
.hg-store .hg-assembly__points .hg-sw-icon{width:18px;height:18px;color:var(--hg-red)}
.hg-store .hg-assembly__keep{margin-top:14px;padding-top:14px;border-top:1px solid var(--hg-line);color:var(--hg-muted);font-size:12px;line-height:1.7}

@media (max-width:1050px){
  .hg-store .hg-assembly__body{grid-template-columns:24px 200px minmax(0,1fr);column-gap:14px}
  .hg-store .hg-assembly__pair[data-state=incompatible] .hg-assembly__body{grid-template-columns:200px minmax(0,1fr)}
  .hg-store .hg-assembly__visual{grid-template-columns:56px 20px 56px minmax(0,1fr)}
  .hg-store .hg-assembly__thumb{width:56px;height:56px}
}
/* Телефон: флажок и подпись, под ними сборка, строки, управление; плашка цены — своей строкой */
@media (max-width:800px){
  .hg-store .hg-assembly{padding:16px 14px 14px}
  .hg-store .hg-assembly__head{grid-template-columns:minmax(0,1fr);grid-template-areas:"kicker" "title" "badge";gap:6px}
  .hg-store .hg-assembly__title{font-size:16px}
  .hg-store .hg-assembly__badge{justify-self:start;grid-auto-flow:column;align-items:baseline;gap:6px;min-width:0;margin-top:4px;padding:5px 12px;border-radius:999px}
  .hg-store .hg-assembly__badge strong{font-size:18px}
  .hg-store .hg-assembly__pair{padding:12px}
  .hg-store .hg-assembly__body{grid-template-columns:24px minmax(0,1fr);grid-template-areas:"box label" "visual visual" "lines lines";gap:10px 12px}
  .hg-store .hg-assembly__pair[data-state=incompatible] .hg-assembly__body{grid-template-columns:minmax(0,1fr);grid-template-areas:"label" "visual" "lines"}
  .hg-store .hg-assembly__label{align-self:center}
  .hg-store .hg-assembly__visual{justify-self:stretch;grid-template-columns:56px 20px 56px minmax(0,1fr);padding:8px 10px;border-radius:10px;background:var(--hg-soft)}
  .hg-store .hg-assembly__pair[data-state=incompatible] .hg-assembly__visual{background:var(--hg-white)}
  .hg-store .hg-assembly__set{background:var(--hg-white)}
  .hg-store .hg-assembly__qty{flex:1 1 100%;justify-content:space-between;margin:0}
  .hg-store .hg-assembly__btn{flex:1 1 auto}
  .hg-store .hg-assembly__points{gap:6px}
  .hg-store .hg-assembly__points li{min-height:30px;padding:3px 10px 3px 7px}
}
@media (prefers-reduced-motion:reduce){
  .hg-store .hg-assembly *,.hg-store .hg-assembly *::before,.hg-store .hg-assembly *::after{transition:none!important}
}
@media (forced-colors:active){
  .hg-store .hg-assembly__toggle{appearance:auto;-webkit-appearance:auto;border:0;background:none}
  .hg-store .hg-assembly__toggle::after{content:none}
  .hg-store .hg-assembly__pair[data-state=confirmed]{outline:2px solid CanvasText}
}

html:lang(ja) .hg-q1-cart-shipping td{word-break:auto-phrase;line-break:strict;overflow-wrap:anywhere}
html:lang(ja) .hg-q1-cart-shipping th{min-width:7em;white-space:nowrap}
.jp-store .woocommerce .hg-cart-summary table.shop_table tr.hg-q1-cart-shipping th{padding-inline-end:1em;box-sizing:content-box}
