.gallery-hero .lead{max-width:760px}
.gallery-controls{margin-top:28px}
.filter-caption span{display:none}

/* Header experiment requested for V0.8: keep «Артсемья» intact, separate the descriptor visually. */
.brand-name,.brand-sub{display:block}
.brand-sub{margin-top:7px;line-height:1.05;letter-spacing:.035em;color:#74685f}
.brand-mark{
  background:
    radial-gradient(circle at 30% 35%,#ef9168 0 18%,transparent 19%),
    radial-gradient(circle at 70% 30%,#8ab7a2 0 22%,transparent 23%),
    radial-gradient(circle at 48% 72%,#d89aaa 0 22%,transparent 23%),
    #f9dfc6;
  box-shadow:inset 0 0 0 1px rgba(100,75,55,.08),0 5px 14px rgba(104,75,49,.08);
}

.gallery-wall-section{
  background:linear-gradient(180deg,var(--paper) 0,var(--paper) 34px,#f1e9df 34px,#f1e9df 100%);
}
.gallery-controls .filterbar{gap:10px}
.gallery-controls .filter{
  border-width:1px;
  box-shadow:0 5px 14px rgba(71,52,38,.06);
  transition:.18s transform,.18s box-shadow,.18s background,.18s border-color,.18s color;
}
.gallery-controls .filter:hover{transform:translateY(-1px);box-shadow:0 8px 18px rgba(71,52,38,.10)}
.gallery-controls .filter[data-group="flowers"]{background:#f8ddd5;border-color:#eeb5a6;color:#9d4b3b}
.gallery-controls .filter[data-group="landscape"]{background:#e2ece3;border-color:#b8cab9;color:#49604c}
.gallery-controls .filter[data-group="still-life"]{background:#f5e8ca;border-color:#dcc58f;color:#735a2f}
.gallery-controls .filter[data-group="graphics"]{background:#ece3ef;border-color:#cdb8d4;color:#654f6c}
.gallery-controls .filter[data-group="flowers"].active{background:#e7654f;border-color:#e7654f;color:#fff}
.gallery-controls .filter[data-group="landscape"].active{background:#738f78;border-color:#738f78;color:#fff}
.gallery-controls .filter[data-group="still-life"].active{background:#b8894c;border-color:#b8894c;color:#fff}
.gallery-controls .filter[data-group="graphics"].active{background:#8d7498;border-color:#8d7498;color:#fff}

.gallery-wall-shell{
  width:100%;max-width:1180px;margin-inline:auto;padding:22px;
  border:1px solid rgba(103,78,57,.10);
  background:radial-gradient(circle at 16% 10%,rgba(255,255,255,.38),transparent 31%),radial-gradient(circle at 84% 78%,rgba(202,168,137,.11),transparent 35%),linear-gradient(145deg,rgba(255,255,255,.14),transparent 48%),#d9cbbd;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.55),inset 0 -1px 0 rgba(91,67,48,.05),0 24px 58px rgba(76,55,36,.09);
  min-height:0;
}
.gallery-masonry{display:grid;width:100%;max-width:1120px;margin-inline:auto;grid-template-columns:1.02fr .98fr 1.02fr .98fr;grid-template-rows:repeat(12,54px);gap:8px;columns:auto}

/* Exact proportional mosaic. The JS supplies normalized rectangles.
   The visual treatment below is deliberately independent from the geometry:
   the floorplan stays exact, while each artwork receives a small gutter and radius. */
.gallery-masonry[data-layout="mosaic"]{display:block;max-width:1120px;--mosaic-art-gap:6px;--mosaic-art-radius:8px}
.gallery-mosaic{position:relative;width:100%;aspect-ratio:var(--mosaic-ratio);overflow:hidden;background:transparent}
.gallery-item.mosaic-leaf{position:absolute;margin:0;padding:calc(var(--mosaic-art-gap)/2);box-sizing:border-box;border:0;overflow:hidden;background:transparent;display:block}
.gallery-item.mosaic-leaf img{display:block;width:100%;height:100%;max-width:none;max-height:none;object-fit:contain;background:transparent;border:0;border-radius:var(--mosaic-art-radius);box-shadow:none}
.gallery-item.mosaic-leaf:hover img{transform:none;box-shadow:none}

.gallery-item{margin:0;min-width:0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;overflow:visible;background:transparent;border:0;padding:0;box-shadow:none;transform:none}
.gallery-item img{display:block;width:auto;height:auto;max-width:100%;max-height:100%;object-fit:contain;background:#fffaf3;border:1px solid rgba(103,78,57,.16);box-shadow:0 20px 34px rgba(73,49,31,.17),0 4px 8px rgba(73,49,31,.10),0 0 0 1px rgba(255,255,255,.28);transition:.22s transform,.22s box-shadow}
.gallery-item:hover{transform:none}
.gallery-item:hover img{transform:translateY(-3px) scale(1.008);box-shadow:0 25px 40px rgba(73,49,31,.21),0 5px 10px rgba(73,49,31,.12),0 0 0 1px rgba(255,255,255,.32)}
.gallery-item:focus-visible{outline:3px solid rgba(231,101,79,.48);outline-offset:3px;z-index:2}

.gallery-purchase .btn{background:#df624d;box-shadow:0 12px 26px rgba(193,77,59,.24)}
.gallery-purchase .btn:hover{background:#c9513f;box-shadow:0 16px 32px rgba(193,77,59,.29)}

/* Legacy fallback composition for categories not yet moved to the solver. */
.gallery-item:nth-child(1){grid-column:1;grid-row:1 / span 5}
.gallery-item:nth-child(3){grid-column:1;grid-row:6 / span 3}
.gallery-item:nth-child(12){grid-column:1;grid-row:9 / span 4}
.gallery-item:nth-child(4){grid-column:2;grid-row:1 / span 3}
.gallery-item:nth-child(2){grid-column:2;grid-row:4 / span 5}
.gallery-item:nth-child(7){grid-column:2;grid-row:9 / span 4}
.gallery-item:nth-child(6){grid-column:3;grid-row:1 / span 5}
.gallery-item:nth-child(10){grid-column:3;grid-row:6 / span 3}
.gallery-item:nth-child(5){grid-column:3;grid-row:9 / span 4}
.gallery-item:nth-child(8){grid-column:4;grid-row:1 / span 5}
.gallery-item:nth-child(9){grid-column:4;grid-row:6 / span 4}
.gallery-item:nth-child(11){grid-column:4;grid-row:10 / span 3}

.gallery-masonry[data-group="landscape"] .gallery-item:nth-child(1){grid-column:1;grid-row:1 / span 5}
.gallery-masonry[data-group="landscape"] .gallery-item:nth-child(3){grid-column:1;grid-row:6 / span 3}
.gallery-masonry[data-group="landscape"] .gallery-item:nth-child(10){grid-column:1;grid-row:9 / span 4}
.gallery-masonry[data-group="landscape"] .gallery-item:nth-child(4){grid-column:2;grid-row:1 / span 3}
.gallery-masonry[data-group="landscape"] .gallery-item:nth-child(2){grid-column:2;grid-row:4 / span 5}
.gallery-masonry[data-group="landscape"] .gallery-item:nth-child(11){grid-column:2;grid-row:9 / span 4}
.gallery-masonry[data-group="landscape"] .gallery-item:nth-child(6){grid-column:3;grid-row:1 / span 5}
.gallery-masonry[data-group="landscape"] .gallery-item:nth-child(7){grid-column:3;grid-row:6 / span 4}
.gallery-masonry[data-group="landscape"] .gallery-item:nth-child(12){grid-column:3;grid-row:10 / span 3}
.gallery-masonry[data-group="landscape"] .gallery-item:nth-child(8){grid-column:4;grid-row:1 / span 5}
.gallery-masonry[data-group="landscape"] .gallery-item:nth-child(9){grid-column:4;grid-row:6 / span 4}
.gallery-masonry[data-group="landscape"] .gallery-item:nth-child(5){grid-column:4;grid-row:10 / span 3}

@media(max-width:980px){
  .gallery-wall-shell{padding:22px}
  .gallery-masonry,.gallery-masonry[data-layout="mosaic"]{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:none;grid-auto-rows:270px;gap:14px}
  .gallery-mosaic{display:contents;aspect-ratio:auto;overflow:visible}
  .gallery-item.mosaic-leaf{position:static!important;width:100%!important;height:100%!important;padding:0;overflow:visible}
  .gallery-item.mosaic-leaf img{width:100%;height:100%;object-fit:contain;border:1px solid rgba(103,78,57,.16);border-radius:var(--mosaic-art-radius);box-shadow:0 20px 34px rgba(73,49,31,.17),0 4px 8px rgba(73,49,31,.10)}
  .gallery-item:nth-child(n),.gallery-masonry[data-group="landscape"] .gallery-item:nth-child(n){grid-column:auto!important;grid-row:auto!important;grid-area:auto!important}
}
@media(max-width:720px){.gallery-wall-shell{padding:18px 14px}.gallery-masonry,.gallery-masonry[data-layout="mosaic"]{grid-auto-rows:230px;gap:12px}}
@media(max-width:460px){
  .gallery-masonry,.gallery-masonry[data-layout="mosaic"]{grid-template-columns:1fr;grid-auto-rows:auto;gap:22px}
  .gallery-item{height:auto;min-height:0}
  .gallery-item img,.gallery-item.mosaic-leaf img{width:100%;height:auto;max-height:none}
}
