/* ============================================================================
   Фото и описания товаров (content/shop/product_photos.js): миниатюра у позиции, заглушка с брендом, окно товара.
   Подключают страница цен (content/shop/docpart/part_search_page.php) и подбор (content/shop/podbor/podbor.php).
   Витрина тёмная - значения по умолчанию; светлая тема (кабинет: <html data-theme="light"> или класс abph-theme-light
   на любом предке) - переменные ниже.
   ============================================================================ */

:root {
    --abph-bg: #232323;            /* окно */
    --abph-fg: var(--white, #F8FAF9);
    --abph-muted: var(--gray-medium, #ACACAC);
    --abph-faint: var(--gray-text, #898A8A);
    --abph-line: rgba(248, 250, 249, .1);
    --abph-skel: rgba(248, 250, 249, .05);
    --abph-skel-hi: rgba(248, 250, 249, .11);
    --abph-ph-s: 28%;              /* насыщенность и светлота заглушки */
    --abph-ph-l: 20%;
    --abph-ph-fg-l: 78%;
    --abph-accent: var(--green, #5AE0AE);
    --abph-overlay: rgba(10, 10, 10, .78);
}
:root[data-theme="light"], .abph-theme-light {
    --abph-bg: #fff;
    --abph-fg: #1B1B1B;
    --abph-muted: #55575a;
    --abph-faint: #7a7c7f;
    --abph-line: rgba(27, 27, 27, .1);
    --abph-skel: rgba(27, 27, 27, .05);
    --abph-skel-hi: rgba(27, 27, 27, .1);
    --abph-ph-s: 45%;
    --abph-ph-l: 93%;
    --abph-ph-fg-l: 32%;
    --abph-accent: #1f9e6e;
    --abph-overlay: rgba(20, 20, 20, .5);
}

/* Слот миниатюры: квадрат --abph-size (страница цен - 40px, подбор - своя плитка) */
.abph { --abph-size: 40px; position: relative; display: inline-flex; flex: none; width: var(--abph-size); height: var(--abph-size); vertical-align: middle; border-radius: 6px;
    box-sizing: border-box; }
/* ждём ответ - мягкое мерцание вместо пустого серого квадрата */
.abph--wait { background: linear-gradient(100deg, var(--abph-skel) 30%, var(--abph-skel-hi) 50%, var(--abph-skel) 70%) 0 0 / 300% 100%; animation: abph-skel 1.4s linear infinite; }
@keyframes abph-skel { from { background-position: 100% 0; } to { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .abph--wait { animation: none; } }
.abph > .abph-t, .abph > .abph-ph { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; border-radius: inherit;
    box-sizing: border-box; cursor: pointer; font: inherit; color: inherit; text-decoration: none; overflow: hidden; outline-offset: 2px; }
/* фото - на белом, как у поставщиков; проявляется после загрузки */
.abph > .abph-t { background: #fff; }
.abph > .abph-t:hover, .abph > .abph-t:focus-visible, .abph > .abph-ph:hover, .abph > .abph-ph:focus-visible { box-shadow: 0 0 0 1px var(--abph-accent); }
.abph .abph-t img.abph-img { display: block !important; width: 100% !important; height: 100% !important; max-width: none !important; margin: 0 !important; padding: 2px !important;
    box-sizing: border-box; object-fit: contain; border-radius: 0 !important; box-shadow: none !important; background: #fff; opacity: 0; transition: opacity .2s; }
.abph .abph-t img.abph-img.is-ok { opacity: 1; }
/* нет фото - заглушка с брендом: цвет от бренда (--abph-h), разные бренды различимы */
.abph > .abph-ph { flex-direction: column; gap: 2px; background: hsl(var(--abph-h, 160), var(--abph-ph-s), var(--abph-ph-l));
    color: hsl(var(--abph-h, 160), 55%, var(--abph-ph-fg-l)); border: 1px solid hsla(var(--abph-h, 160), 60%, 60%, .18); }
.abph-ph__s { display: block; max-width: 100%; padding: 0 2px; font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif; font-size: 9.5px; font-weight: 700; line-height: 1;
    letter-spacing: .02em; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: clip; box-sizing: border-box; }

/* Крупный вариант (подбор, плитка 88/80/72px): значок, бренд и артикул */
.abph--lg { --abph-size: 100%; width: 100%; height: 100%; border-radius: inherit; }
.abph--lg > .abph-ph { gap: 3px; padding: 6px; font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif; text-align: center; }
.abph--lg .abph-ph svg { width: 22px; height: 22px; flex: none; opacity: .7; }
.abph-ph__b, .abph-ph__a { display: block; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.15; }
.abph-ph__b { font-size: 11px; font-weight: 700; text-transform: uppercase; }
.abph-ph__a { font-size: 10px; opacity: .8; }
.abph--lg .abph-t img.abph-img { padding: 6px !important; }

/* ---------------------------------------------------------------------------- Окно товара */
body.abph-lb-open { overflow: hidden; }
.abph-lb { position: fixed; inset: 0; z-index: 10050; display: flex; align-items: center; justify-content: center; padding: 16px; box-sizing: border-box;
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif; color: var(--abph-fg); text-align: left; }
.abph-lb[hidden] { display: none; }
.abph-lb__ov { position: absolute; inset: 0; background: var(--abph-overlay); }
.abph-lb__box { position: relative; display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); width: 100%; max-width: 860px; max-height: calc(100vh - 32px);
    overflow: hidden; background: var(--abph-bg); border: 1px solid var(--abph-line); border-radius: 16px; box-shadow: 0 24px 64px rgba(0, 0, 0, .45); }
.abph-lb__x { position: absolute; top: 10px; right: 10px; z-index: 2; width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%;
    background: var(--abph-skel-hi); color: var(--abph-fg); cursor: pointer; }
.abph-lb__x:hover, .abph-lb__x:focus-visible { background: var(--abph-line); outline: 2px solid var(--abph-accent); outline-offset: 0; }
.abph-lb__x svg { width: 18px; height: 18px; }
.abph-lb__media { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--abph-line); }
.abph-lb__img { --abph-h: 160; flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 300px; padding: 12px;
    background: #fff; box-sizing: border-box; overflow: hidden; }
.abph-lb__img img.abph-lb__pic { display: block !important; max-width: 100% !important; max-height: min(520px, 60vh) !important; width: auto !important; height: auto !important; margin: 0 !important;
    object-fit: contain; border-radius: 0 !important; box-shadow: none !important; }
.abph-lb__img.is-broken, .abph-lb__img.is-none { background: hsl(var(--abph-h), var(--abph-ph-s), var(--abph-ph-l)); color: hsl(var(--abph-h), 55%, var(--abph-ph-fg-l)); font-size: 13px; text-align: center; }
.abph-lb__img.is-broken { background: var(--abph-skel); color: var(--abph-faint); }
.abph-lb__img svg { width: 28px; height: 28px; opacity: .7; }
.abph-lb__ph { display: flex; flex-direction: column; align-items: center; gap: 4px; max-width: 100%; }
.abph-lb__ph b { font-size: 26px; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; line-height: 1.1; overflow-wrap: anywhere; }
.abph-lb__ph span { font-size: 15px; opacity: .85; overflow-wrap: anywhere; }
.abph-lb__nof { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; opacity: .8; }
.abph-lb__nof svg { width: 16px; height: 16px; }
.abph-lb__src { margin: 0; padding: 8px 14px; font-size: 11px; line-height: 1.35; color: var(--abph-faint); border-top: 1px solid var(--abph-line); }
.abph-lb__src[hidden], .abph-lb__n[hidden], .abph-lb__d[hidden], .abph-lb__st[hidden] { display: none; }
.abph-lb__body { min-width: 0; padding: 18px 20px 18px; overflow: auto; max-height: calc(100vh - 34px); box-sizing: border-box; }
.abph-lb__t { margin: 0 44px 0 0; font-size: 18px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.abph-lb__t span { font-weight: 400; color: var(--abph-muted); margin-left: 8px; }
.abph-lb__n { margin: 6px 0 0; font-size: 14px; line-height: 1.4; color: var(--abph-fg); overflow-wrap: anywhere; }
.abph-lb__st { display: inline-block; margin: 8px 0 0; padding: 2px 8px; border-radius: 999px; font-size: 11px; line-height: 1.5; color: var(--abph-accent);
    border: 1px solid currentColor; }
.abph-lb__d { margin: 10px 0 0; font-size: 13px; line-height: 1.5; color: var(--abph-muted); overflow-wrap: anywhere; white-space: pre-line; }
.abph-lb__h { margin: 16px 0 6px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--abph-fg); }
.abph-lb__h span { font-weight: 400; letter-spacing: 0; color: var(--abph-faint); margin-left: 4px; }
.abph-lb__load { margin: 12px 0 0; font-size: 12px; color: var(--abph-faint); }
.abph-props { width: 100%; border-collapse: collapse; font-size: 12.5px; line-height: 1.4; }
.abph-props th, .abph-props td { padding: 5px 0; border-top: 1px solid var(--abph-line); vertical-align: top; text-align: left; background: none; }
.abph-props th { width: 46%; padding-right: 12px; font-weight: 400; color: var(--abph-faint); }
.abph-props td { color: var(--abph-fg); overflow-wrap: anywhere; }
.abph-ap { margin: 0; padding: 0; list-style: none; font-size: 12.5px; line-height: 1.4; }
.abph-ap li { display: flex; flex-wrap: wrap; gap: 2px 8px; padding: 5px 0; border-top: 1px solid var(--abph-line); }
.abph-ap li:nth-child(n+7) { display: none; }
.abph-ap.is-all li { display: flex; }
.abph-ap b { font-weight: 600; color: var(--abph-fg); }
.abph-ap span { color: var(--abph-muted); }
.abph-ap em { flex-basis: 100%; font-style: normal; font-size: 11.5px; color: var(--abph-faint); }
.abph-lb__all { margin-top: 6px; padding: 0; border: 0; background: none; color: var(--abph-accent); font: inherit; font-size: 12.5px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.abph-lb__links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--abph-line); font-size: 12px; color: var(--abph-faint); }
.abph-lb__links a { display: inline-flex; align-items: center; gap: 4px; color: var(--abph-fg); text-decoration: underline; text-decoration-color: var(--abph-faint); text-underline-offset: 3px; }
.abph-lb__links a:hover { text-decoration-color: var(--abph-fg); color: var(--abph-fg); }
.abph-lb__links svg { width: 13px; height: 13px; opacity: .7; }
@media (max-width: 700px) {
    .abph-lb { align-items: flex-end; padding: 0; }
    .abph-lb__box { display: flex; flex-direction: column; max-width: none; max-height: 92vh; overflow: auto; border-radius: 16px 16px 0 0; border-bottom: 0; }
    .abph-lb__media { border-right: 0; border-bottom: 1px solid var(--abph-line); flex: none; }
    .abph-lb__img { min-height: 200px; max-height: 42vh; border-radius: 15px 15px 0 0; }
    .abph-lb__img img.abph-lb__pic { max-height: calc(42vh - 24px) !important; }
    .abph-lb__body { max-height: none; overflow: visible; padding: 14px 16px 20px; }
    .abph-lb__ph b { font-size: 22px; }
}

/* Страница рисует свою плитку с брендом под слотом (подбор fix/podbor-brands-clarity: .pz__img > .pz__ph): заглушка
   прозрачная - видна плитка страницы, а клик по ней всё равно открывает окно с описанием */
.pz__ph ~ .abph > .abph-ph { background: transparent; border-color: transparent; color: transparent; }
.pz__ph ~ .abph > .abph-ph > * { visibility: hidden; }
.pz__ph ~ .abph > .abph-ph:hover, .pz__ph ~ .abph > .abph-ph:focus-visible { box-shadow: inset 0 0 0 1px var(--abph-accent); }
