/* Gallery — pixel-aligned to D1/D2/D3/D4 mockups */

.page-gallery{
  --gal-ink:#45413C;
  --gal-mute:#8a847a;
  --gal-line:rgba(26,24,20,.10);
  --gal-gold:#C9A961;
  --gal-cream:#F7F5EE;
  --gal-card:#fff;
  --gal-radius:18px;
  --gal-radius-sm:12px;
}
.page-gallery .page-content,
body.page-gallery{
  background:#FAF8F3;
}
.page-gallery .h-display{
  font-family:var(--f-serif,'Playfair Display',Georgia,serif);
  font-weight:500;
  color:var(--gal-ink);
  letter-spacing:-.015em;
  line-height:1.1;
}
.page-gallery .eyebrow{
  color:var(--gal-gold);
  font-size:12px;
  letter-spacing:.14em;
  text-transform:uppercase;
  font-weight:500;
}

/* —— Login —— */
.gallery-login{
  padding:80px var(--gutter) 120px;
  background:#FAF8F3;
  min-height:60vh;
}
.gallery-login__wrap{max-width:480px;margin:0 auto}
.gallery-login__card{
  background:var(--gal-cream,#F7F5EE);
  border-radius:22px;
  padding:40px 32px 36px;
}
.gallery-login__title{margin:10px 0 14px;font-size:clamp(36px,5vw,48px)}
.gallery-login__text{
  font-size:16px;line-height:1.55;color:var(--gal-mute,#8a847a);
  margin:0 0 28px;
}
.gallery-login__text a{
  color:var(--gal-gold,#C9A961);
  text-decoration:underline;
  text-underline-offset:3px;
  white-space:nowrap;
}
.gallery-login__text a:hover{color:var(--gal-ink,#45413C)}
.gallery-login__error{
  color:#a33;font-size:14px;margin:0 0 16px;
}
.gallery-login__label{
  display:block;font-size:13px;font-weight:500;
  color:var(--gal-mute,#8a847a);margin-bottom:8px;
}
.gallery-login__input{
  width:100%;box-sizing:border-box;
  height:52px;padding:0 16px;margin-bottom:18px;
  border:1px solid rgba(26,24,20,.14);border-radius:10px;
  font-size:16px;background:#fff;color:var(--gal-ink,#45413C);
  outline:none;
  box-shadow:none;
  -webkit-appearance:none;
  appearance:none;
}
.gallery-login__input:focus,
.gallery-login__input:focus-visible{
  outline:none;
  border-color:rgba(201,169,97,.55);
  box-shadow:none;
}
.gallery-login__form .btn,
.gallery-login__submit{
  width:100%;justify-content:center;border-radius:10px;
  background:linear-gradient(120deg,#bd8f3c 0%,#e7cd86 50%,#bd8f3c 100%);
  color:#fff;border:none;min-width:0;
}
.gallery-login__submit:hover{filter:brightness(1.04)}

/* —— Hub (D4) —— */
.gallery-hub{
  padding:72px var(--gutter) 110px;
  background:#FAF8F3;
}
.gallery-hub__grid{
  display:grid;
  grid-template-columns:minmax(0,1.25fr) minmax(300px,.75fr);
  gap:72px;
  align-items:start;
  max-width:1180px;
  margin:0 auto;
}
.gallery-hub__title{
  margin:10px 0 48px;
  font-size:clamp(44px,5.2vw,68px);
}
.gallery-hub__dirs{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:0 56px;
}
.gallery-hub__list{list-style:none;margin:0;padding:0}
.gallery-hub__list li{border-bottom:1px solid var(--gal-line)}
.gallery-hub__list a{
  display:block;
  padding:20px 0;
  font-family:var(--f-serif,'Playfair Display',Georgia,serif);
  font-size:23px;
  font-weight:400;
  color:var(--gal-ink);
  text-decoration:none;
  transition:color .2s;
}
.gallery-hub__list a:hover{color:var(--gal-gold)}

.gallery-consult{
  background:var(--gal-cream);
  border-radius:22px;
  padding:36px 32px 32px;
}
.gallery-consult__title{
  font-family:var(--f-serif,'Playfair Display',Georgia,serif);
  font-size:34px;
  font-weight:500;
  color:var(--gal-ink);
  margin:10px 0 14px;
  line-height:1.22;
}
.gallery-consult__text{
  font-size:16px;
  line-height:1.55;
  color:var(--gal-mute);
  margin-bottom:22px;
}
.gallery-consult__photo{
  border-radius:14px;
  overflow:hidden;
  margin-bottom:22px;
  aspect-ratio:4/5;
  background:#e8e4da;
}
.gallery-consult__photo img{
  width:100%;height:100%;object-fit:cover;display:block;
}
.gallery-consult__phone{
  display:block;
  font-size:22px;
  font-weight:500;
  color:var(--gal-ink);
  text-decoration:none;
  margin-bottom:6px;
}
.gallery-consult .btn{
  width:100%;
  justify-content:center;
  border-radius:10px;
}

/* —— List head / tabs (D1) —— */
.gallery-list,
.gallery-case{
  padding:56px var(--gutter) 100px;
  background:#FAF8F3;
}
.gallery-list > .container,
.gallery-case > .container,
.gallery-hub > .container{
  max-width:1180px;
}
.gallery-list__head{margin-bottom:8px}
.gallery-list__title-row{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:24px;
  margin-top:8px;
}
.gallery-list__title-row .h-display{
  font-size:clamp(40px,4.8vw,60px);
  margin:0;
}
.gallery-back{
  flex-shrink:0;
  display:inline-flex;
  align-items:center;
  margin-top:10px;
  padding:11px 20px;
  border:1px solid rgba(26,24,20,.14);
  border-radius:999px;
  font-size:14px;
  font-weight:500;
  color:var(--gal-ink);
  background:#fff;
  text-decoration:none;
}

.gallery-tabs{
  display:flex;
  flex-wrap:wrap;
  gap:4px 32px;
  margin:20px 0 36px;
  border-bottom:1px solid var(--gal-line);
  padding-bottom:0;
}
.gallery-tabs__item{
  position:relative;
  padding:12px 0 16px;
  font-size:15px;
  color:var(--gal-mute);
  text-decoration:none;
  white-space:nowrap;
  transition:color .15s;
}
.gallery-tabs__item:hover{color:var(--gal-ink)}
.gallery-tabs__item.is-active{
  color:var(--gal-ink);
  font-style:italic;
  font-family:var(--f-serif,'Playfair Display',Georgia,serif);
  font-size:16px;
}
.gallery-tabs__item.is-active::after{
  content:"";
  position:absolute;left:0;right:0;bottom:-1px;
  height:1.5px;background:var(--gal-gold);
}

/* —— Filters panel (D3) —— */
.gallery-layout{
  display:grid;
  grid-template-columns:1fr;
  gap:36px;
  align-items:start;
}
.gallery-layout.is-filters-open{
  grid-template-columns:300px minmax(0,1fr);
  gap:40px;
}
.gallery-filters[hidden]{display:none!important}
.gallery-layout.is-filters-open .gallery-filters[hidden]{display:block!important}

.gallery-filters__panel{
  position:relative;
  background:var(--gal-cream);
  border:none;
  border-radius:22px;
  padding:32px 26px 28px;
}
@media (min-width:1101px){
  .gallery-layout.is-filters-open .gallery-filters__panel{
    position:sticky;top:96px;
  }
}
.gallery-filters__close{
  position:absolute;top:14px;right:16px;
  width:36px;height:36px;
  font-size:26px;line-height:1;color:var(--gal-mute);
  cursor:pointer;
}
.gallery-filters__title{
  font-family:var(--f-serif,'Playfair Display',Georgia,serif);
  font-size:40px;font-weight:500;color:var(--gal-ink);
  margin:8px 0 12px;line-height:1.1;
}
.gallery-filters__lead{
  font-size:15px;color:var(--gal-mute);margin-bottom:28px;line-height:1.5;
}
.gallery-filter-group{margin-bottom:26px}
.gallery-filter-group__label{
  font-size:12px;letter-spacing:.1em;text-transform:uppercase;
  color:var(--gal-mute);margin-bottom:12px;font-weight:500;
}
.gallery-chips{display:flex;flex-wrap:wrap;gap:8px}
.gallery-chip{
  display:inline-flex;align-items:center;
  padding:9px 15px;border-radius:999px;
  border:1px solid rgba(26,24,20,.14);
  font-size:14px;color:var(--gal-ink);background:#fff;
  cursor:pointer;text-decoration:none;
  position:relative;
}
.gallery-chip input{position:absolute;opacity:0;pointer-events:none}
.gallery-chip.is-active{
  background:var(--gal-gold);
  border-color:var(--gal-gold);
  color:#fff;
}
.gallery-filters__actions{
  display:flex;flex-direction:column;gap:14px;margin-top:12px;
}
.gallery-filters__reset{
  text-align:center;
  color:var(--gal-ink);
  text-decoration:none;
  font-size:15px;
  font-weight:500;
  padding:8px;
}
.gallery-filters__actions .btn{
  width:100%;justify-content:center;border-radius:10px;
}

.gallery-results__bar{
  display:flex;align-items:baseline;justify-content:space-between;
  margin-bottom:22px;
}
.gallery-results__bar[hidden]{display:none!important}
.gallery-results__count{
  font-family:var(--f-serif,'Playfair Display',Georgia,serif);
  font-size:30px;color:var(--gal-ink);font-weight:500;
}
.gallery-results__sort{font-size:14px;color:var(--gal-mute)}
.gallery-empty{padding:48px 0;color:var(--gal-mute);font-size:17px}
.gallery-empty a{color:var(--gal-gold)}

/* —— Cards grid: static double BA (no slider) —— */
.gallery-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:22px;
}
.gallery-layout.is-filters-open .gallery-grid{
  grid-template-columns:repeat(2,minmax(0,1fr));
}
.gallery-card{
  display:block;text-decoration:none;color:inherit;
  background:var(--gal-card);
  border-radius:var(--gal-radius);
  overflow:hidden;
  box-shadow:0 6px 28px rgba(26,24,20,.07);
  transition:transform .2s,box-shadow .2s;
}
.gallery-card:hover{
  transform:translateY(-2px);
  box-shadow:0 12px 36px rgba(26,24,20,.11);
}
.gallery-card__body{padding:18px 18px 20px}
.gallery-card__body h3{
  font-family:var(--f-serif,'Playfair Display',Georgia,serif);
  font-size:20px;font-weight:500;color:var(--gal-ink);margin:0 0 4px;
}
.gallery-card__body p{font-size:14px;color:var(--gal-mute);margin:0}

.gallery-ba{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:0;
  /* Две половины рядом, значит пропорция вдвое шире пропорции кадра. При 8/5
     каждая половина получалась 4/5 и обрезала 38% ширины панели — тело
     срезалось по бокам, как и на странице кейса. */
  aspect-ratio:calc(var(--ba-ratio, 41/32) * 2);
  background:#e8e4da;
  overflow:hidden;
}
.gallery-ba__half{
  position:relative;
  min-width:0;
  overflow:hidden;
}
.gallery-ba__half img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.gallery-ba__tag{
  position:absolute;
  left:10px;
  bottom:10px;
  transform:none;
  padding:4px 9px;
  border-radius:4px;
  background:rgba(26,24,20,.78);
  color:#fff;
  font-size:10px;
  letter-spacing:.08em;
  font-weight:600;
  pointer-events:none;
}
.gallery-ba__sbs{
  grid-column:1 / -1;
  width:100%;height:100%;object-fit:cover;display:block;
}

/* —— Case detail slider (D2) —— */
.ba-compare{
  position:relative;
  /* Пропорция кадра, а не рамки. Панели конвейера — 820x640; при 4/5 и
     object-fit:cover браузер обрезал 38% ширины, то есть срезал тело по бокам.
     Замер на живой странице: рамка 697x872 при кадре 820x640 — видно 62%. */
  aspect-ratio:var(--ba-ratio, 41/32);
  overflow:hidden;
  background:#ece8df;
  user-select:none;
  touch-action:none;
  --split:50%;
  border-radius:var(--gal-radius);
}
.ba-compare__before,
.ba-compare__after{
  position:absolute;inset:0;
  width:100%;height:100%;
  object-fit:cover;display:block;
  pointer-events:none;
}
.ba-compare__after{
  clip-path:inset(0 0 0 var(--split));
}
.ba-compare__handle{
  position:absolute;top:0;bottom:0;left:var(--split);
  width:2px;background:#fff;
  transform:translateX(-50%);
  z-index:2;cursor:ew-resize;
}
.ba-compare__handle span{
  position:absolute;top:50%;left:50%;
  width:44px;height:44px;
  transform:translate(-50%,-50%);
  border-radius:50%;
  background:#fff;
  border:2px solid var(--gal-gold);
  box-shadow:0 2px 12px rgba(0,0,0,.2);
}
.ba-compare__handle span::before,
.ba-compare__handle span::after{
  content:"";
  position:absolute;top:50%;width:0;height:0;
  border-style:solid;
  transform:translateY(-50%);
}
.ba-compare__handle span::before{
  left:11px;
  border-width:5px 7px 5px 0;
  border-color:transparent var(--gal-gold) transparent transparent;
}
.ba-compare__handle span::after{
  right:11px;
  border-width:5px 0 5px 7px;
  border-color:transparent transparent transparent var(--gal-gold);
}
.ba-compare__tag{
  position:absolute;bottom:14px;z-index:3;
  padding:5px 10px;border-radius:4px;
  background:rgba(26,24,20,.78);color:#fff;
  font-size:11px;letter-spacing:.08em;font-weight:600;
}
.ba-compare__tag--before{left:14px}
.ba-compare__tag--after{right:14px}
/* Крупный вариант на странице кейса. Ширину ограничиваем: при полной ширине
   колонки фото занимало 697x872 и подавляло собой всю страницу.
   --gal-case-w — единственная ручка, которой этот размер настраивается. */
.ba-compare--lg{aspect-ratio:var(--ba-ratio, 41/32)}


.gallery-case__frame{
  display:grid;
  grid-template-columns:minmax(0,1.15fr) minmax(280px,.75fr);
  gap:28px;
  align-items:stretch;
}
.gallery-case__stage{min-width:0}
.gallery-case__panel{
  background:var(--gal-cream);
  border:none;
  border-radius:var(--gal-radius);
  padding:36px 30px 28px;
  display:flex;
  flex-direction:column;
}
.gallery-case__num{
  font-size:12px;letter-spacing:.12em;text-transform:uppercase;
  color:var(--gal-gold);margin-bottom:14px;font-weight:500;
}
.gallery-case__title{
  font-family:var(--f-serif,'Playfair Display',Georgia,serif);
  font-size:34px;font-weight:500;color:var(--gal-ink);margin:0 0 10px;line-height:1.15;
}
.gallery-case__meta{font-size:15px;color:var(--gal-mute);margin:0 0 28px}
.gallery-case__params{
  display:grid;gap:0;margin:0 0 28px;
  padding:0;
  border:none;
}
.gallery-case__params > div{
  display:grid;grid-template-columns:110px 1fr;gap:12px;
  font-size:15px;
  padding:14px 0;
  border-top:1px solid var(--gal-line);
}
.gallery-case__params > div:last-child{border-bottom:1px solid var(--gal-line)}
.gallery-case__params dt{color:var(--gal-mute);font-weight:400}
.gallery-case__params dd{color:var(--gal-ink);font-weight:500;margin:0}
.gallery-case__more{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  align-self:flex-start;
  padding:12px 20px;
  margin-bottom:14px;
  border:1px solid rgba(26,24,20,.14);
  border-radius:999px;
  background:#fff;
  color:var(--gal-ink);
  text-decoration:none;
  font-size:14px;
  font-weight:500;
}
.gallery-case__panel .btn{
  width:100%;justify-content:center;border-radius:10px;margin-top:auto;
}
.gallery-case__views{
  display:flex;flex-wrap:wrap;gap:8px;margin-top:14px;
}
.gallery-case__view{
  padding:8px 14px;border-radius:999px;
  border:1px solid rgba(26,24,20,.14);
  font-size:13px;color:var(--gal-ink);background:#fff;cursor:pointer;
}
.gallery-case__view.is-active{
  background:var(--gal-ink);border-color:var(--gal-ink);color:#fff;
}
.gallery-case__sbs{border-radius:var(--gal-radius);overflow:hidden}
.gallery-case__sbs img{width:100%;display:block}

@media (max-width:1100px){
  .gallery-hub__grid{grid-template-columns:1fr;gap:40px}
  .gallery-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .gallery-layout.is-filters-open{grid-template-columns:1fr}
  .gallery-layout.is-filters-open .gallery-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .gallery-case__frame{grid-template-columns:1fr;gap:24px}
  .gallery-layout.is-filters-open .gallery-filters{
    position:fixed;inset:0;z-index:10040;
    background:rgba(26,24,20,.45);
    padding:16px;display:flex!important;align-items:flex-start;justify-content:center;
    overflow:auto;
  }
  .gallery-filters__panel{position:relative;top:auto;width:min(420px,100%);margin:48px auto}
}

@media (max-width:768px){
  .gallery-hub,.gallery-list,.gallery-case{padding:36px var(--gutter) 72px}
  .gallery-hub__dirs{grid-template-columns:1fr}
  .gallery-list__title-row{flex-direction:column;align-items:stretch;gap:14px}
  .gallery-back{align-self:flex-start;margin-top:0}
  .gallery-tabs{gap:4px 18px;overflow-x:auto;-webkit-overflow-scrolling:touch;flex-wrap:nowrap}
  .gallery-grid,
  .gallery-layout.is-filters-open .gallery-grid{grid-template-columns:1fr}
  .gallery-consult{padding:28px 22px}
  /* на телефоне пропорция та же: обрезать кадр нельзя ни на каком экране */
  .gallery-case__params > div{grid-template-columns:1fr;gap:4px}
  .gallery-filters__title{font-size:32px}
}

/* ——— Страница кейса на десктопе ———
   Снимок был 697x872 и подавлял собой всю страницу. Уменьшен до 280, затем по
   просьбе оператора увеличен в 1.5 раза; --gal-case-w — единственная ручка
   размера, менять только её.
   Блок в конце файла намеренно: базовое объявление .gallery-case__frame идёт
   ниже правил выше по файлу и перебивало их при равной специфичности. */
@media (min-width:1101px){
  .gallery-case__stage .ba-compare--lg{
    max-width:var(--gal-case-w, 420px);
  }
  .gallery-case__stage .gallery-case__sbs img{
    max-width:calc(var(--gal-case-w, 420px) * 2);
  }
  .gallery-case__frame{
    grid-template-columns:var(--gal-case-w, 420px) minmax(300px, 520px);
    justify-content:start;
  }
  /* Пять кнопок ракурсов в узкой колонке вставали в четыре ряда и занимали
     больше места, чем сам снимок. Два столбца мелким кеглем — три ряда. */
  .gallery-case__views{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:6px;
    max-width:var(--gal-case-w, 420px);
  }
  .gallery-case__view{font-size:12px;padding:7px 8px;text-align:center}
}
