/*
 * Lazurit UI Kit A+++ v2.0.1125 | Unified article PHOTO galleries.
 * Scope: all singular WordPress post rubrics, including automotive A+++,
 * Gutenberg Gallery and the legacy [gallery] shortcode.
 * The 16:9 crop is DISPLAY-ONLY: it does not alter uploaded photographs,
 * their dimensions, alt text, captions, media attachments or Gutenberg HTML.
 * Clicking a gallery photo opens the full photograph in an accessible popup.
 */

/* Cards in A+++ 'Фотоматериалы' and galleries within ordinary articles. */
body.single-post .lz-auto-kb__photos :is(
 .lz-auto-a3-gallery__grid,
 .lz-bmw-x1-sale-v909__gallery,
 .lz-vw-troc-sale-v911__gallery,
 .lz-toyota-levin-sale-v912__gallery),
body.single-post :is(.lz-prose--modern,.lz-article-wrap .lz-prose) :is(
 .wp-block-gallery,.blocks-gallery-grid,.gallery){
 box-sizing:border-box!important;
 display:grid!important;
 grid-template-columns:repeat(3,minmax(0,1fr))!important;
 gap:16px!important;
 width:100%;max-width:100%;min-width:0;
 margin:18px 0 30px!important;
 padding:0!important;
 list-style:none!important;
 align-items:stretch!important;
}

/* Every gallery tile has the same frame without legacy 9px white padding. */
body.single-post .lz-auto-kb__photos :is(
 .lz-auto-a3-gallery__grid,
 .lz-bmw-x1-sale-v909__gallery,
 .lz-vw-troc-sale-v911__gallery,
 .lz-toyota-levin-sale-v912__gallery) figure,
body.single-post :is(.lz-prose--modern,.lz-article-wrap .lz-prose) :is(
 .wp-block-gallery,.blocks-gallery-grid,.gallery) :is(figure,.gallery-item,li.blocks-gallery-item){
 box-sizing:border-box!important;display:flex!important;flex-direction:column!important;
 width:100%!important;max-width:100%!important;min-width:0!important;
 height:100%;margin:0!important;padding:0!important;
 overflow:hidden!important;
 border:1px solid #d8e6f5!important;
 border-radius:20px!important;
 background:#fff!important;
 box-shadow:0 8px 26px rgba(6,45,103,.045);
}

/* Legacy gallery lists contain LI > FIGURE. Avoid a second inner border. */
body.single-post :is(.lz-prose--modern,.lz-article-wrap .lz-prose)
 .blocks-gallery-grid > li.blocks-gallery-item > figure{
 border:0!important;border-radius:0!important;box-shadow:none!important;
 background:transparent!important;height:100%;
}

/* The actual photograph fills a predictable 16:9 frame: no grey/white bands. */
body.single-post .lz-auto-kb__photos :is(
 .lz-auto-a3-gallery__grid,
 .lz-bmw-x1-sale-v909__gallery,
 .lz-vw-troc-sale-v911__gallery,
 .lz-toyota-levin-sale-v912__gallery) img,
body.single-post :is(.lz-prose--modern,.lz-article-wrap .lz-prose) :is(
 .wp-block-gallery,.blocks-gallery-grid,.gallery) img{
 box-sizing:border-box!important;display:block!important;
 width:100%!important;max-width:100%!important;
 height:auto!important;min-height:0!important;
 aspect-ratio:16/9!important;
 object-fit:cover!important;object-position:center center!important;
 flex:none!important;
 margin:0!important;padding:0!important;border:0!important;
 border-radius:0!important;background:#eef5fb;
}

/* Linked originals: link and image share the same 16:9 area. */
body.single-post .lz-auto-kb__photos :is(
 .lz-auto-a3-gallery__grid,
 .lz-bmw-x1-sale-v909__gallery,
 .lz-vw-troc-sale-v911__gallery,
 .lz-toyota-levin-sale-v912__gallery) figure>a:has(>img),
body.single-post :is(.lz-prose--modern,.lz-article-wrap .lz-prose) :is(
 .wp-block-gallery,.blocks-gallery-grid,.gallery) a:has(>img){
 box-sizing:border-box;display:block!important;width:100%;max-width:100%;
 min-width:0;aspect-ratio:16/9;overflow:hidden;
 margin:0!important;padding:0!important;
}
body.single-post .lz-auto-kb__photos figure>a:has(>img)>img,
body.single-post :is(.lz-prose--modern,.lz-article-wrap .lz-prose) :is(
 .wp-block-gallery,.blocks-gallery-grid,.gallery) a:has(>img)>img{
 height:100%!important;aspect-ratio:auto!important;
}

/* Captions belong BELOW the image, never overlaid onto the photograph. */
body.single-post .lz-auto-kb__photos :is(
 .lz-auto-a3-gallery__grid,
 .lz-bmw-x1-sale-v909__gallery,
 .lz-vw-troc-sale-v911__gallery,
 .lz-toyota-levin-sale-v912__gallery) figcaption,
body.single-post :is(.lz-prose--modern,.lz-article-wrap .lz-prose) :is(
 .wp-block-gallery,.blocks-gallery-grid,.gallery) :is(figcaption,.gallery-caption){
 box-sizing:border-box!important;display:block!important;position:static!important;
 inset:auto!important;order:2;flex:1 0 auto;
 margin:0!important;padding:13px 15px 15px!important;
 min-height:58px;
 font-family:inherit!important;
 font-size:13px!important;line-height:1.55!important;font-weight:400!important;
 text-align:left!important;color:#57718d!important;
 background:#fff!important;background-image:none!important;
 text-shadow:none!important;border:0!important;
}
/* Gutenberg may place figure media inside another inner DIV. */
body.single-post :is(.lz-prose--modern,.lz-article-wrap .lz-prose) :is(
 .wp-block-gallery,.blocks-gallery-grid,.gallery) :is(.blocks-gallery-item__figure,.wp-block-image)>img{
 margin:0!important;
}
/* Do not crop detailed documents or diagrams explicitly marked by editors. */
body.single-post :is(.lz-auto-kb__photos,.lz-prose--modern,.lz-article-wrap .lz-prose)
 :is(figure.is-style-contain,figure.lz-gallery-fit-contain) img{
 object-fit:contain!important;background:#edf5fd;
}

@media(max-width:900px){
 body.single-post .lz-auto-kb__photos :is(
  .lz-auto-a3-gallery__grid,
  .lz-bmw-x1-sale-v909__gallery,
  .lz-vw-troc-sale-v911__gallery,
  .lz-toyota-levin-sale-v912__gallery),
 body.single-post :is(.lz-prose--modern,.lz-article-wrap .lz-prose) :is(
  .wp-block-gallery,.blocks-gallery-grid,.gallery){
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
 }
}
@media(max-width:620px){
 body.single-post .lz-auto-kb__photos :is(
  .lz-auto-a3-gallery__grid,
  .lz-bmw-x1-sale-v909__gallery,
  .lz-vw-troc-sale-v911__gallery,
  .lz-toyota-levin-sale-v912__gallery),
 body.single-post :is(.lz-prose--modern,.lz-article-wrap .lz-prose) :is(
  .wp-block-gallery,.blocks-gallery-grid,.gallery){
  grid-template-columns:minmax(0,1fr)!important;gap:14px!important;
 }
 body.single-post .lz-auto-kb__photos figure,
 body.single-post :is(.lz-prose--modern,.lz-article-wrap .lz-prose) :is(
  .wp-block-gallery,.blocks-gallery-grid,.gallery) figure{
  border-radius:16px!important;
 }
}
