
:root{
  --gap:10px;
  --thumb-height: 300px;
}
body{
  font-family: Arial, Helvetica, sans-serif;
  margin:0; padding:20px; background:#f7f7f7; color:#222;
}
.container{
  max-width:1100px; margin:0 auto; background:#fff; padding:20px; box-shadow:0 0 8px rgba(0,0,0,0.06);
}
.site-title{ text-decoration:none; color: inherit; }
h1{ margin:0 0 8px 0; text-align:center; font-family: Merriweather, Georgia, 'Times New Roman', serif; font-size: 36px; }
h1 a.site-title { color: #5B3A29; }

/* Меню */
.site-menu{ margin: 8px 0 18px 0; }
.topbar { width:100%; background:#fff; border-bottom:1px solid rgba(0,0,0,0.06); position:relative; z-index:60; }
.topbar .topbar-inner { max-width:1100px; margin:0 auto; padding:8px 16px; display:flex; align-items:center; justify-content:space-between; gap:12px; box-sizing:border-box; }
.brand { display:flex; align-items:center; gap:12px; }
/* логотип рядом с заголовком:
    - высота привязана к размеру шрифта заголовка (em)
    - flex-shrink:0 — не даём логотипу ужиматься в flex-контейнере
*/
.site-logo{
    height: 8em;
    width: auto;
    display:block;
    object-fit:contain;
    margin-right:10px;
    flex-shrink:0;
}


/* кнопка гамбургера (скрыта на десктопе) */
.menu-toggle { display:none; width:40px; height:40px; border:0; background:transparent; align-items:center; justify-content:center; cursor:pointer; }
.menu-toggle .bar { display:block; width:22px; height:2px; background:#222; position:relative; }
.menu-toggle .bar::before, .menu-toggle .bar::after { content:""; position:absolute; left:0; width:22px; height:2px; background:#222; }
.menu-toggle .bar::before { top:-6px; } .menu-toggle .bar::after { top:6px; }

/* базовые стили для списка меню */
.menu{ list-style:none; margin:0; padding:0; display:flex; gap:24px; justify-content:center; align-items:center; max-width:1100px; margin-left:auto; margin-right:auto; }
.menu-item{ position:relative; display:block; } /* li блочно для предсказуемого flow */
.menu-item > a{
  display:inline-block;
  vertical-align:middle;
  text-decoration:none;
  color: #5B3A29;
  font-family: Roboto, Arial, Helvetica, sans-serif;
  font-size: 24px;
  line-height:1.2;
  padding:8px 16px;
  background:transparent;
  border-radius:6px;
  box-sizing:border-box;
  cursor:pointer;
  white-space:nowrap;
}
.menu-item > a:hover{ background:#eee; }

/* ---------- desktop: вложенное меню как выпадающее (>=701px) ---------- */
@media (min-width: 701px) {
  /* desktop: ставим бренд (лого + заголовок) над меню — расширяем шапку */
  .topbar .topbar-inner { flex-direction: column; align-items: center; justify-content: center; gap:8px; }
  .site-menu { width: 100%; }

  .menu{ display:flex; }
  .menu .menu{
    position:absolute; top: calc(100% - 6px); left: 50%; transform: translateX(-50%);
    opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 140ms ease, transform 140ms ease;
    display:flex; flex-direction:column; gap:6px; background:#fff; padding:6px; box-shadow:0 6px 14px rgba(0,0,0,0.10);
    border-radius:6px; min-width: auto; width: auto; box-sizing: border-box; z-index: 70;
  }
  .menu-item:hover > .menu,
  .menu-item:focus-within > .menu {
    opacity:1; visibility:visible; pointer-events:auto; transform: translateX(-50%) translateY(0);
  }
  .menu .menu > .menu-item{ display:block; }
  .menu .menu a{
    display:block; width:100%; text-align:left; padding:8px 12px; white-space:nowrap;
    font-family: Roboto, Arial, Helvetica, sans-serif; font-size: 20px; color: #5B3A29;
    border-radius:4px; box-sizing:border-box;
  }
  .menu .menu a:hover{ background:#f3f3f3; }
}

/* ---------- mobile: боковая панель, аккордеон для подменю ---------- */
@media (max-width: 700px) {
  .menu-toggle { display:flex; }

  /* Скрываем логотип на мобильных, чтобы Шапка помещалась в строку */
  .site-logo { display: none !important; }

  /* slide-out vertical menu: колонка */
  .menu {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 280px;
    max-width: 90%;
    background:#fff;
    flex-direction:column;
    padding:64px 0 16px 0; /* убрал боковые паддинги чтобы пункты были 100% ширины */
    box-shadow:-8px 0 24px rgba(0,0,0,0.12);
    transform: translateX(100%);
    transition: transform .22s ease;
    overflow-y:auto;
    z-index:75;
    display:flex;
  }
  .menu.open { transform: translateX(0); }

  /* сброс боксов/отступов у ul/li */
  .menu, .menu ul, .menu li { margin:0; padding:0; }

  /* пункт меню: flex, центр по вертикали, текст слева, стрелка справа */
  .menu > li {
    display:block;
    width:100%;
    box-sizing:border-box;
  }
  .menu > li > a {
    display:flex;
    align-items:center;
    justify-content:space-between;
    width:100%;
    padding:12px 16px;
    text-decoration:none;
    color: #5B3A29;
    font-family: Roboto, Arial, Helvetica, sans-serif;
    font-size: 16px;
    line-height:1;
    box-sizing:border-box;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    background:transparent;
  }

  /* подменю как аккордеон: скрытое по высоте, не flex */
  .menu .menu {
    position: static;
    transform:none;
    opacity:1;
    visibility:visible;
    box-shadow:none;
    padding-left:12px;
    max-height:0;
    overflow:hidden;
    transition: max-height .22s ease;
    display:block;
  }
  .menu .menu.open { max-height: 2000px; }

  /* индикатор стрелки: не float, заметный размер */
  .menu > li.has-sub > a::after {
    content: "▸";
    margin-left:12px;
    font-size:18px;
    line-height:1;
    transform:rotate(0);
    transition: transform .18s ease;
    opacity:0.9;
  }
  .menu > li.has-sub.open > a::after { transform:rotate(90deg); }

  /* разделители пунктов */
  .menu > li + li > a { border-top: 1px solid rgba(0,0,0,0.04); }

  .topbar .topbar-inner { padding:8px 12px; }
  body.menu-open { overflow:hidden; }
}

/* Главный текст */
.main-text{ font-family: Roboto, Arial, Helvetica, sans-serif; font-size: 18px; color: #111111; margin:12px 0 18px 0; text-align:left; }

/* галерея */
    /* галерея */
    .gallery{
      display:grid;
      gap: var(--gap);
      margin-bottom:16px;
      grid-template-columns: repeat(var(--cols, 3), 1fr);
    }
    .gallery a{ display:block; overflow:hidden; border-radius:4px; }
    .gallery img{ width:100%; height:auto; object-fit:contain; display:block; }

/* главная галерея: используем aspect-ratio из конфигурации */
.main-gallery{ display:grid; grid-template-columns: repeat(2,1fr); gap: var(--gap); margin:12px 0 20px 0; }
.main-gallery a{ display:block; overflow:hidden; border-radius:6px; }
.main-gallery img{ width:100%; height:auto; object-fit:contain; display:block; }

/* пагинация */
.pagination{ display:flex; gap:8px; flex-wrap:wrap; align-items:center; justify-content:center; margin:16px 0; }
.page, .page-link{ padding:6px 10px; background:#eee; color:#111; text-decoration:none; border-radius:4px; }
.page.current{ background:#333; color:#fff; }
.page-link{ background:#ddd; }

footer{ font-size:12px; color:#666; margin-top:12px; text-align:center; }

/* responsive */
@media (max-width:900px){
  .gallery{ grid-template-columns: repeat(2, 1fr); }
}

/* на телефонах и небольших экранах — принудительно одна колонка */
@media (max-width:700px){
  .gallery{ grid-template-columns: 1fr !important; }
  .main-gallery{ grid-template-columns: 1fr !important; }
}

@media (max-width:480px){
  .gallery{ grid-template-columns: 1fr; }
  :root{ --thumb-height:180px; }
  .main-gallery img{ aspect-ratio: 400 / 300; }
}
