/* ==========================================================
   3-mksd.ru — Глобальные стили сайта
   ========================================================== */

:root{
  /* Бренд */
  --brand-red:#7a0000;
  --brand-red-dark:#4c0000;

  /* Синонимы (для совместимости с шаблонами) */
  --banner: var(--brand-red);
  --banner-dark: var(--brand-red-dark);

  /* Золото / латунь */
  --gold:#d4af37;
  --gold-dark:#b8932e;
  --brass: var(--gold);

  /* Текст и фон */
  --text:#1e1a16;
  --ink: var(--text);
  --muted:#6a6258;
  --bg:#fbf6ec;
  --paper: var(--bg);
  --soft:#f3ebe0;
  --surface:#fffdf8;

  /* Линии / плитки */
  --line:rgba(122,70,20,.14);
  --tile-border:#e5dcc8;
  --tile-grad:linear-gradient(180deg,#fffdf8,#f7f1e3);
  --tile-shadow:0 4px 14px rgba(40,24,8,.08);
  --tile-hover-border:rgba(139,0,0,.28);

  /* Скругления — единые, умеренные */
  --radius:2px;
  --radius-sm:2px;
  --radius-md:4px;

  /* Акцентный бордовый (ссылки в карточках, постах, алфавите) */
  --accent-dark:#7a0000;

  /* Контентная ширина */
  --content-max:1440px;

  /* Типографика — единая шкала для всего сайта */
  --font-sans:"PT Sans",system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
  --font-display:"Oswald",sans-serif;
  --fs-xs:0.75rem;                              /* подписи, хинты, метки */
  --fs-sm:0.85rem;                              /* eyebrow, meta, хлебные крошки */
  --fs-md:0.95rem;                              /* карточки, вторичный текст, кнопки */
  --fs-base:1rem;                               /* основной текст (16px) */
  --fs-lead:1.05rem;                            /* лиды / вступления */
  --fs-h3:1.15rem;                              /* h3 / заголовки карточек */
  --fs-h2:clamp(1.25rem,2vw,1.55rem);           /* секции */
  --fs-feature:clamp(1.35rem,2.2vw,1.85rem);    /* витрины, крупные карточки */
  --fs-h1:clamp(1.75rem,3vw,2.35rem);           /* заголовок страницы в контенте */
  --fs-hero:clamp(2rem,4.5vw,3rem);             /* полноэкранный hero */
  --fs-brand:clamp(1.25rem,2.2vw,1.625rem);     /* название в шапке */
  --lh-tight:1.15;
  --lh-body:1.6;
}

/* Базовые */
*{box-sizing:border-box}
html,body{height:100%}

html{
  scroll-behavior:smooth;
  scroll-padding-top:120px;
}

body{
  margin:0;
  font:var(--fs-base)/var(--lh-body) var(--font-sans);
  color:var(--text);
  background:var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' opacity='0.05'%3E%3Cpath d='M0,0 L100,100 M100,0 L0,100' stroke='%238B0000' stroke-width='1'/%3E%3C/svg%3E") repeat;
}

a{color:var(--accent-dark);text-decoration:none}
a:hover{color:var(--brand-red-dark);text-decoration:underline}

.container{max-width:var(--content-max);margin:0 auto;padding:0 24px}

.sr-only{
  position:absolute !important;width:1px;height:1px;padding:0;margin:-1px;
  overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0
}

.skip-link{
  position:absolute;left:12px;top:12px;z-index:1000;
  padding:10px 14px;border-radius:var(--radius-md);
  background:var(--brand-red-dark);color:#fff;font-weight:700;
  transform:translateY(-160%);transition:transform .15s ease;
}
.skip-link:focus,.skip-link:focus-visible{
  transform:translateY(0);outline:2px solid var(--gold);outline-offset:3px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible{
  outline:2px solid var(--brand-red);
  outline-offset:2px;
}

/* Заголовки */
h1,h2,h3{
  font-family:var(--font-display);
  margin:24px 0 12px;
  color:var(--brand-red-dark);
  letter-spacing:.01em;
}
h1{font-size:var(--fs-h1); line-height:var(--lh-tight); font-weight:700;}
h2{font-size:var(--fs-h2); font-weight:700;}
h3{font-size:var(--fs-h3); font-weight:600;}
.section-title {
  font-size: var(--fs-h1);
  margin-top: 40px;
  margin-bottom: 24px;
  text-align: center;
  color: var(--brand-red-dark);
}

/* ==========================================================
   Header (V2)
   ========================================================== */

.site-header{
  position:sticky; top:0; z-index:1000;
  background: radial-gradient(circle at top center, #a30000, var(--banner-dark));
  color:#fff; box-shadow:0 2px 12px rgba(0,0,0,.25);
}
.site-header .header-inner{
  max-width:var(--content-max); margin:0 auto; padding:10px 24px;
  display:grid; grid-template-columns:auto 1fr auto; gap:12px; align-items:center;
}
.menu-toggle{
  background:transparent; border:0; cursor:pointer; width:36px; height:36px;
  display:inline-grid; place-content:center;
}
.menu-toggle span{display:block;width:20px;height:2px;background:#fff;margin:3px 0}
.brand{display:flex;align-items:center;gap:12px;text-decoration:none;color:inherit}
.brand-star{width:44px;height:44px;filter:drop-shadow(0 0 6px rgba(0,0,0,.5))}
.brand-title{
  font-family:var(--font-display); font-size:var(--fs-brand); line-height:1.05;
  letter-spacing:.5px; text-transform:uppercase; margin:0; text-shadow:1px 1px 3px rgba(0,0,0,.35);
}
.brand-sub{color:var(--brass); font-style:italic; font-size:var(--fs-sm); margin-top:2px}
.icon-btn{background:transparent;border:0;color:#fff;cursor:pointer}

/* Поиск в шапке */
.search-panel{display:none; background:#5d0000; border-top:1px solid rgba(255,255,255,.12)}
.search-panel.open{display:block}
.search-inner{max-width:900px;margin:0 auto;padding:10px 16px;display:flex;gap:8px}
.search-input{
  flex:1; padding:10px 12px; border-radius:var(--radius); border:1px solid #c7a63a;
  background:#fff; color:#111;
}
.search-submit{
  padding:10px 14px; border:0; border-radius:var(--radius);
  background:var(--brass); color:#2E2E2E; font-weight:700; cursor:pointer
}

/* Primary nav (золотая полоса) */
nav.primary{
  background:linear-gradient(90deg,var(--brass),#e6c763);
  box-shadow:inset 0 -2px 0 rgba(0,0,0,.15);
  color:#2E2E2E;
  position:sticky; top: 60px; z-index:999;
}
nav.primary .nav-inner{max-width:var(--content-max);margin:0 auto;padding:0 8px}
nav.primary .navbar-nav{
  display:flex !important; flex-wrap:wrap; gap:10px;
  margin:0; padding:0; list-style:none;
}
nav.primary .navbar-nav > li > a{
  display:block; padding:0 14px;
  font:700 var(--fs-base)/1.2 var(--font-display); border-radius:0;
  text-decoration:none !important; color:inherit !important;
}
nav.primary a:hover{background:rgba(0,0,0,.06); color:#4c0000 !important}

/* Мобильное меню */
@media (max-width:900px){
  .menu-toggle{
    display:flex !important; flex-direction:column; justify-content:center;
    width:40px;height:40px;background:transparent;border:none;cursor:pointer;padding:0;z-index:1001
  }
  .menu-toggle span{width:24px;height:2px;background:#fff;margin:3px 0;transition:all .3s ease}
  .menu-toggle[aria-expanded="true"] span:nth-child(1){transform:rotate(45deg) translate(5px,5px)}
  .menu-toggle[aria-expanded="true"] span:nth-child(2){opacity:0}
  .menu-toggle[aria-expanded="true"] span:nth-child(3){transform:rotate(-45deg) translate(7px,-6px)}

  /* прячем любые ul в меню до открытия */
  nav.primary .nav,
  nav.primary .navbar-nav,
  nav.primary > .nav-inner > ul,
  nav.primary ul{
    display:none !important; flex-direction:column; gap:0; width:100%; padding:10px 0;
  }
  nav.primary.open .nav,
  nav.primary.open .navbar-nav,
  nav.primary.open > .nav-inner > ul,
  nav.primary.open ul{ display:flex !important; }
  nav.primary.open li{ margin:0 }
  nav.primary.open a{
    display:block; padding:12px 16px; border-bottom:1px solid rgba(0,0,0,.08);
    text-decoration:none !important; color:inherit !important;
  }

  /* Учитываем фиксированную шапку */
  html{ scroll-padding-top:70px; }
}

/* Десктоп: списки всегда видны строкой; скрываем кнопку */
@media (min-width:901px){
  .menu-toggle{display:none !important}
  nav.primary .nav,
  nav.primary .navbar-nav,
  nav.primary > .nav-inner > ul{
    display:flex !important; flex-direction:row; gap:12px;
  }
}

/* Отмена подчёркиваний в шапке/меню */
.site-header a, nav.primary a{ text-decoration:none !important; color:inherit !important; }
.site-header a:hover, .site-header a:focus,
nav.primary a:hover, nav.primary a:focus{ text-decoration:none !important; background:transparent !important; }

/* ==========================================================
   Контентные таблицы / утилиты
   ========================================================== */

.content{padding:16px 0 32px; max-width:52rem;}
.content--gazeta{max-width:none;}
.content .breadcrumb{color:var(--muted);font-size:var(--fs-md);margin-top:6px}
.content h1,.content h2,.content h3{color:var(--brand-red-dark)}
.content h2{margin-top:1.25rem}
.content .dash{list-style:none;padding-left:0}
.content .dash li{position:relative;padding-left:18px}
.content .dash li:before{content:"—";position:absolute;left:0;color:var(--muted)}
.content p{line-height:1.65}
.content img{border-radius:var(--radius)}

.table-wrap{overflow:auto;margin:12px 0 20px; border:1px solid var(--tile-border); border-radius:var(--radius)}
.content table{border-collapse:collapse;width:100%;min-width:720px;background:var(--surface)}
.content thead th{position:sticky;top:0;background:var(--brand-red-dark);color:#eee;font-weight:600}
.content th,.content td{border:1px solid var(--tile-border);padding:6px 8px;vertical-align:top}
.content tbody tr:nth-child(even){background:var(--soft)}

/* Футер */
footer{background:#0f0f0f;color:#ddd;margin-top:32px}
.footer-inner{
  display:grid;gap:24px;grid-template-columns:1.2fr 1fr 1fr 1fr;
  max-width:var(--content-max);margin:0 auto;padding:28px 24px
}
.footer-logo{display:flex;gap:12px;align-items:center}
.footer-logo svg{width:30px;height:30px}
.footer-nav h2{font-family:var(--font-display);font-weight:600;margin:0 0 8px;font-size:var(--fs-h3);color:#e8d48a}
.menu.footer{list-style:none;margin:0;padding:0}
.menu.footer li{margin:6px 0}
.menu.footer a{color:#e8d48a}
.menu.footer a:hover{color:#fff}
.footer-bottom{
  grid-column:1/-1;border-top:1px solid #222;margin-top:8px;padding-top:10px;
  display:flex;justify-content:space-between;align-items:center
}
.back-to-top{color:#e8d48a}
.back-to-top:hover{color:#fff}

/* ==========================================================
   BLOG INDEX / QUICK-LINK STYLE — v2
   Категории, алфавит, плитки записей
   ========================================================== */

/* Сетки */
.cat-grid,
.post-grid{
  list-style:none;
  padding:0;
  margin:1rem 0 2rem;
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(260px,1fr));
  gap:16px;
}
.cat-grid > li,
.post-grid > li{ display:flex; }

/* Карточка-ссылка (категории и общий вид плитки) */
.quick-link{
  display:flex;
  align-items:flex-start;
  gap:12px;
  padding:16px;
  background:var(--tile-grad);
  border:1px solid var(--tile-border);
  border-radius:var(--radius-md);
  color:var(--accent-dark);
  text-decoration:none;
  box-shadow:0 1px 0 rgba(255,255,255,.55) inset;
  transition:box-shadow .15s ease, border-color .15s ease, color .15s ease;
  min-height:120px;
  flex:1;
}
.quick-link:hover{
  box-shadow:var(--tile-shadow);
  border-color:var(--tile-hover-border);
}

.quick-link-icon{
  flex:0 0 44px; height:44px;
  display:flex; align-items:center; justify-content:center;
  background:rgba(139,0,0,.08);
  border-radius:var(--radius);
}
.quick-link-icon svg{ width:24px; height:24px; color:var(--accent-dark); }

.quick-link-text{ flex:1 1 auto; min-width:0; }
.cat-title{
  display:block;
  font-family:var(--font-display);
  color:var(--accent-dark);
  margin-bottom:4px;
}
.muted{ display:block; color:#555; font-size:var(--fs-sm); line-height:1.35; }

/* Список постов (обычные категории) — ссылки бордовые */
/* Обычные разделы — резиновый список как у дивизионной газеты */
.section-archive{ width:100%; margin:0 0 1.5rem; }
.section-archive__back{ margin:0 0 0.75rem; }
.section-archive__back a{ color:var(--accent-dark); font-weight:600; }

.section-list{
  list-style:none;
  margin:0 0 1.5rem;
  padding:0;
  display:grid;
  grid-template-columns:1fr;
  gap:0.65rem 1.35rem;
}
.section-list > li{ margin:0; padding:0; display:flex; min-width:0; }
.section-list__item{
  display:flex;
  align-items:center;
  width:100%;
  min-width:0;
  padding:0.2rem 0;
  text-decoration:none !important;
  color:inherit;
}
.section-list__body{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:0.12rem;
  min-width:0;
}
.section-list__title{
  font-family:var(--font-display);
  font-weight:600;
  font-size:var(--fs-base);
  line-height:1.3;
  color:var(--accent-dark);
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}
.section-list__item:hover .section-list__title{ text-decoration:underline; }
.section-list__date{
  color:var(--muted);
  font-size:var(--fs-sm);
  white-space:nowrap;
}
@media (min-width:720px){
  .section-list{ grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (min-width:1100px){
  .section-list{ grid-template-columns:repeat(3,minmax(0,1fr)); }
}

/* legacy post-list — на тот же лад, без рамки */
.post-list{
  list-style:none;
  padding:0;
  margin:0 0 1.5rem;
  display:grid;
  grid-template-columns:1fr;
  gap:0.65rem 1.35rem;
  border:0;
  background:transparent;
}
.post-list li{ padding:0; border:0; display:flex; min-width:0; }
.post-list a{
  display:block;
  padding:0.2rem 0;
  color:var(--accent-dark);
  text-decoration:none;
  font-family:var(--font-display);
  font-weight:600;
  font-size:var(--fs-base);
  line-height:1.3;
}
.post-list a:hover{ background:transparent; text-decoration:underline; }
.post-list small{ color:var(--muted); font-size:var(--fs-sm); }
@media (min-width:720px){
  .post-list{ grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (min-width:1100px){
  .post-list{ grid-template-columns:repeat(3,minmax(0,1fr)); }
}

/* Компактный поиск в разделах архива */
.search-inline{
  display:flex; flex-wrap:wrap; gap:8px; align-items:center;
  margin:0 0 1rem;
}
.search-inline input[type="search"],
.search-inline select{
  min-height:40px; padding:0 12px; border:1px solid #ddd;
  font-size:var(--fs-base); background:#fff;
}
.search-inline input[type="search"]{ flex:1 1 200px; min-width:180px; }
.search-inline select{ min-width:120px; }
.search-inline button{
  min-height:40px; padding:0 14px; border:1px solid var(--accent-dark);
  background:var(--accent-dark); color:#fff; font-weight:600; cursor:pointer;
}
.search-inline a{ color:var(--accent-dark); }

/* Книга памяти: компактный алфавит */
.alpha-grid{
  list-style:none; padding:0; margin:1rem 0 1.25rem;
  display:grid; gap:6px;
  grid-template-columns:repeat(auto-fill,minmax(2.25rem,1fr));
}
.alpha-grid > li{ display:flex; }
.quick-link--alpha{
  align-items:center; justify-content:center;
  flex:1;
  min-height:2.25rem;
  padding:0.25rem 0.15rem;
  gap:0;
  font-weight:700;
}
.quick-link--alpha .quick-link-icon{ display:none; }
.quick-link--alpha .alpha-letter{
  font-family:var(--font-display);
  font-size:var(--fs-base);
  line-height:1;
}
.quick-link--alpha.is-active{
  background:var(--accent-dark);
  color:#fff;
  border-color:var(--accent-dark);
  box-shadow:none;
}

/* Книга памяти: ФИО как ссылки материалов (.section-list / .post-list) */
.post-grid a{
  color:var(--accent-dark);
  text-decoration:none;
  font-family:var(--font-display);
  font-weight:600;
  font-size:var(--fs-base);
  line-height:1.3;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  display:block;
  padding:0.2rem 0;
}
.post-grid a:hover{ text-decoration:underline; background:transparent; }

/* Пагинация */
.pager{
  display:flex; gap:1rem; align-items:center; justify-content:center;
  margin:1rem 0 2rem;
}
.pager a{ text-decoration:none; }

/* Фокус для доступности */
.quick-link:focus,
.quick-link--alpha:focus,
.post-grid a:focus{
  outline:3px solid var(--gold-dark);
  outline-offset:2px;
}

/* ==========================================================
   Вспомогательные блоки разделов (не главная — у неё свой CSS)
   ========================================================== */

.about-content {
  text-align: center;
  max-width: 800px;
  margin: 40px auto;
  padding: 24px;
  border-radius: var(--radius-md);
  background: var(--soft);
  border: 1px solid var(--tile-border);
  box-shadow: var(--tile-shadow);
}
.about-content p {
  font-size: var(--fs-h3);
  line-height: 1.8;
}
.about-content strong {
  color: var(--brand-red-dark);
}

/* Main grid layout */
.masonry-grid {
    columns: 3 260px;
    column-gap: 40px;
    margin-top: 40px;
    margin-bottom: 60px;
}

/* Teaser cards grid */
.teasers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.teaser-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
    padding: 20px;
    background: var(--tile-grad);
    border: 1px solid var(--tile-border);
    border-radius: var(--radius-md);
    box-shadow: var(--tile-shadow);
    transition: border-color .15s ease, box-shadow .15s ease;
    break-inside: avoid;
    margin-bottom: 40px;
}
.teaser-card:hover {
    border-color: var(--tile-hover-border);
    box-shadow: 0 6px 18px rgba(40,24,8,.1);
}
.teaser-head {
    display: flex;
    align-items: center;
    gap: 12px;
}
.teaser-title {
    font-family: var(--font-display);
    color: var(--accent-dark);
    text-decoration: none;
    font-size: var(--fs-h2);
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 12px;
}
.teaser-title:hover {
    text-decoration: underline;
}
.teaser-icon {
    flex: 0 0 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    background: rgba(139,0,0,.08);
}
.teaser-icon svg {
    color: var(--accent-dark);
}
.teaser-desc {
    font-size: var(--fs-md);
    color: var(--muted);
}
.teaser-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.teaser-list li {
    padding: 8px 0;
    border-bottom: 1px dashed var(--tile-border);
}
.teaser-list li:last-child {
    border-bottom: none;
}
.teaser-list a {
    color: var(--accent-dark);
    text-decoration: none;
    display: block;
}
.teaser-list a:hover .teaser-item__title {
    text-decoration: underline;
}
.teaser-item__title {
    font-weight: 600;
}
.teaser-item__excerpt {
    display: block;
    font-size: var(--fs-sm);
    color: var(--muted);
    margin-top: 4px;
}
.teaser-foot {
    margin-top: 16px;
    text-align: right;
}
.teaser-more {
  display: inline-block;
  padding: 8px 16px;
  background-color: var(--brand-red);
  color: #fff !important;
  border-radius: var(--radius);
  text-decoration: none !important;
  font-weight: bold;
  transition: background-color .2s ease;
}
.teaser-more:hover {
  background-color: var(--brand-red-dark);
}
.teaser-more svg {
  display: inline-block;
  margin-left: 6px;
  width: 1rem;
  height: 1rem;
  color: #fff;
  vertical-align: top;
  margin-top: 2px;
}

.call-to-action {
  background: var(--brand-red-dark);
  color: #fff;
  text-align: center;
  padding: 24px 32px;
  margin-top: 40px;
  border-radius: var(--radius-md);
  box-shadow: var(--tile-shadow);
}
.cta-inner {
  max-width: 800px;
}
.call-to-action h2 {
  color: var(--brass);
  margin-bottom: 16px;
}
.call-to-action p {
  font-size: var(--fs-h3);
  line-height: 1.6;
}
.button {
  display: inline-block;
  padding: 12px 24px;
  background: var(--gold);
  color: #2E2E2E;
  font-weight: 700;
  border-radius: var(--radius);
  text-decoration: none;
  margin-top: 24px;
  transition: background .15s ease, color .15s ease;
}
.button:hover {
  background: var(--gold-dark);
  color: #fff;
}
.button--red {
  background: #fff;
  color: var(--brand-red-dark);
}

/* New style for the latest posts list */
.latest-posts-list {
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: var(--surface);
    border: 1px solid var(--tile-border);
    border-radius: var(--radius-md);
    box-shadow: var(--tile-shadow);
}
.latest-posts-list li {
    padding: 12px 20px;
    border-bottom: 1px dashed var(--tile-border);
}
.latest-posts-list li:last-child {
    border-bottom: none;
}
.latest-posts-list a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--accent-dark);
    text-decoration: none;
    transition: color .2s ease;
}
.latest-posts-list a:hover {
    color: var(--brand-red-dark);
}
.post-list-title {
    font-weight: 600;
}
.post-list-date {
    font-size: var(--fs-sm);
    color: var(--muted);
}


/* New styles for card titles and spacing */
.card-title {
  font-family: var(--font-display);
  color: var(--accent-dark);
  font-size: var(--fs-h2);
  margin-top: 0;
}
.card-title a {
  text-decoration: none !important;
  color: var(--accent-dark) !important;
}
.card-title a:hover {
  text-decoration: underline !important;
}


/* ==========================================================
   Адаптивные правки
   ========================================================== */

@media (min-width:1200px){
  .container{ max-width:1440px; }
}

@media (max-width:900px){
  .masonry-grid {
    columns: 1;
    column-gap: 0;
  }
}

@media (min-width: 768px) {
  .full-width-section {
    grid-column: 1 / -1; /* Занимает всю ширину сетки */
  }
}

@media (max-width:768px){
  h1{font-size:var(--fs-h1)}
  .cat-grid, .post-grid{ grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); }
  .quick-link{ min-height:110px; }
}
@media (max-width:480px){
  .cat-grid, .post-grid, .teasers-grid {
    grid-template-columns:1fr;
  }
  .quick-link{ min-height:100px; }
}

/* ==== iOS safe-area + футер ==== */

/* 1) корректный отступ под нижнюю системную панель */
:root { --safe-bottom: env(safe-area-inset-bottom, 0px); }
body { padding-bottom: max(0px, var(--safe-bottom)); }

/* 2) футер не должен «залипать» к самому низу экрана */
footer .footer-inner {
  /* обычный паддинг + приплата под safe-area */
  padding-bottom: calc(12px + var(--safe-bottom));
}

/* 3) нижняя строка футера — не ломать строки и не упираться в край */
footer .footer-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;           /* разрешаем перенос на новую строку */
}
footer .footer-bottom > * { margin: 0; }

footer .back-to-top {
  margin-left: auto;
  padding: 6px 10px;
  border-radius: var(--radius);
  display: inline-block;
  text-decoration: none;
}
@media (max-width: 520px) {
  footer .back-to-top {
    margin-left: 0;          /* на узких — отдельной строкой */
    width: 100%;
    text-align: center;
  }
}

/* 4) чтобы контент не «прятался» за скруглениями/краем контейнера */
.container { padding-left: 14px; padding-right: 14px; }

/* ==== Мобильный футер: только "Разделы", а "Контакты" сразу под ними ==== */
:root { --safe-bottom: env(safe-area-inset-bottom, 0px); }

@media (max-width: 640px) {
  footer .footer-inner{
    display: flex !important;
    flex-direction: column !important;
    gap: 10px;
    padding: 12px 14px calc(12px + var(--safe-bottom));
  }

  /* порядок блоков */
  footer .footer-logo { order: 0; }
  footer .footer-nav:nth-of-type(1) { order: 1; }               /* Разделы */
  footer .footer-nav:nth-of-type(2) { display: none !important; }/* Материалы — скрыть */
  footer .footer-nav:nth-of-type(3) { order: 2; }               /* Контакты — под Разделами */
  footer .footer-bottom { order: 3; }

  /* типографика и интервалы поуже */
  footer .footer-nav h2 { margin: 0 0 6px; font-size: var(--fs-h3); }
  footer .menu.footer li { margin: 6px 0; }
  footer .back-to-top {
    margin-left: 0;
    width: 100%;
    text-align: center;
    padding: 8px 10px;
    border-radius: var(--radius);
  }
}

/* чтобы контент/кнопки не упирались в нижнюю панель iOS */
body { padding-bottom: max(0px, var(--safe-bottom)); }
footer .footer-inner { padding-bottom: calc(12px + var(--safe-bottom)); }

/* --- Ричтекст-изображения в постах: без апскейла --- */
.content img,
.richtext img,
.richtext-image {
  max-width: 100%;           /* только уменьшаем при переполнении */
  height: auto !important;   /* сохраняем пропорции */
}

/* Полноширинные картинки — без форсированного растяжения */
.richtext-image.full-width {
  display: block;
  /* width:100%;  — убрано, чтобы не апскейлить маленькие картинки */
  max-width: 100%;
  margin: 12px 0 16px;
}

/* Обтекание слева/справа + отступы от текста (не растягиваем) */
.richtext-image.left,
img.align-left {
  float: left;
  margin: 4px 16px 12px 0;
  max-width: min(50%, 320px);
}

.richtext-image.right,
img.align-right {
  float: right;
  margin: 4px 0 12px 16px;
  max-width: min(50%, 320px);
}

/* Импорт из Word мог навесить width:100% — отключаем апскейл */
img[style*="width: 100%"],
img[style*="width:100%"] {
  width: auto !important;
  max-width: 100% !important;
}

/* На узких экранах убираем float, но не растягиваем сверх исходного */
@media (max-width: 768px) {
  .richtext-image.left,
  .richtext-image.right,
  img.align-left,
  img.align-right,
  img[style*="float:left"],
  img[style*="float: right"] {
    float: none !important;
    display: block;
    margin: 10px auto 14px !important;
    max-width: 100% !important; /* по-прежнему без апскейла */
  }
}

/* Контейнер "подчищает" обтекание */
.content::after {
  content: "";
  display: block;
  clear: both;
}

/* Нежные подписи сразу после <img> */
.richtext-image + p,
img + p {
  text-align: center;
  font-size: var(--fs-md);
  color: #666;
  margin-top: 6px;
}

*/

.brand-title__short{
  display:none;
}

@media (max-width:768px){

  .brand-title__full{
    display:none;
  }

  .brand-title__short{
    display:inline;
    font-size:var(--fs-feature);
    font-weight:700;
  }

  .brand-sub{
    font-size:var(--fs-xs);
  }

  .brand{
    align-items:flex-start;
  }

  .brand-star{
    width:34px;
    height:34px;
  }

  .masonry-grid{
    display:flex;
    flex-direction:column;
  }

  .teaser-card--about{
    order:999;
  }

}



/* ===== FIX: alignment for StreamField article images ===== */
.article-image{
  display:block;
  max-width:100%;
  margin:12px 0 16px;
}

.article-image__img{
  display:block;
  max-width:100%;
  height:auto;
}

.article-image.align-left{
  float:left;
  margin:4px 16px 12px 0;
  max-width:min(50%, 320px);
}

.article-image.align-right{
  float:right;
  margin:4px 0 12px 16px;
  max-width:min(50%, 320px);
}

.article-image.align-center{
  float:none;
  margin:12px auto 16px;
  text-align:center;
  max-width:100%;
}

.article-image.align-center .article-image__img,
.article-image.align-center .article-image__link{
  display:inline-block;
}

.article-image__caption{
  margin-top:6px;
  font-size:var(--fs-md);
  color:#666;
  text-align:center;
}

@media (max-width: 768px){
  .article-image.align-left,
  .article-image.align-right{
    float:none !important;
    display:block;
    margin:10px auto 14px !important;
    max-width:100% !important;
  }
}



/* ===== Дополнительные размеры изображений (без ломания текущего дизайна) ===== */
.article-image{
  --article-image-max: 640px;
  max-width:min(100%, var(--article-image-max));
}
.article-image.align-left,
.article-image.align-right{
  max-width:min(50%, var(--article-image-max));
}
.article-image.align-center{
  max-width:min(100%, var(--article-image-max));
}

.article-image.size-w180{ --article-image-max:180px; }
.article-image.size-w200{ --article-image-max:200px; }
.article-image.size-w240{ --article-image-max:240px; }
.article-image.size-w280{ --article-image-max:280px; }
.article-image.size-small{ --article-image-max:320px; }
.article-image.size-w400{ --article-image-max:400px; }
.article-image.size-w480{ --article-image-max:480px; }
.article-image.size-w560{ --article-image-max:560px; }
.article-image.size-medium{ --article-image-max:640px; }
.article-image.size-w800{ --article-image-max:800px; }
.article-image.size-large{ --article-image-max:960px; }
.article-image.size-w1200{ --article-image-max:1200px; }
.article-image.size-full{ --article-image-max:1600px; }

/* ===== Блок разделителя: сброс обтекания и управляемый отступ ===== */
.content-separator{
  clear:both;
  width:100%;
  height:0;
}
.content-separator.spacing-none{ margin-top:0; }
.content-separator.spacing-sm{ margin-top:12px; }
.content-separator.spacing-md{ margin-top:24px; }
.content-separator.spacing-lg{ margin-top:40px; }

@media (max-width:768px){
  .article-image.align-left,
  .article-image.align-right{
    max-width:100% !important;
  }
}

/* ===== Книга памяти =====
   Логика раздела не меняем: поиск + алфавит + плотный список фамилий.
   Только лёгкая стыковка с общей палитрой/скруглениями. */
.memory-search{
  display:flex;
  align-items:center;
  gap:12px;
  margin:4px 0 8px;
}
.memory-search__field{
  display:flex;
  align-items:center;
  flex:1 1 auto;
  max-width:420px;
  background:var(--surface);
  border:1px solid var(--tile-border);
  border-radius:var(--radius-md);
  box-shadow:none;
}
.memory-search__field:focus-within{
  outline:3px solid var(--gold-dark);
  outline-offset:2px;
}
.memory-search__input{
  flex:1 1 auto;
  min-width:0;
  min-height:48px;
  padding:0 14px;
  border:0;
  background:transparent;
  color:#111;
  font:inherit;
  font-size:var(--fs-base);
}
.memory-search__input:focus{ outline:none; }
.memory-search__btn{
  flex:0 0 auto;
  min-height:48px;
  padding:0 16px;
  border:0;
  border-left:1px solid var(--tile-border);
  background:transparent;
  color:var(--accent-dark);
  font:inherit;
  font-weight:700;
  cursor:pointer;
}
.memory-search__btn:hover{ color:var(--brand-red-dark); }
.memory-search__clear{
  align-self:center;
  color:var(--accent-dark);
  font-weight:600;
  text-decoration:none;
}
.memory-search__clear:hover{ text-decoration:underline; }
.memory-search-meta,
.memory-search-status{
  margin:0 0 12px;
  color:var(--muted);
  font-size:var(--fs-md);
}
.memory-search-status{
  color:var(--brand-red-dark);
  font-weight:600;
}

/* ===== SEO: связанные материалы ===== */
.seo-related-links{
  margin:1.5rem 0 1.25rem;
  padding:1rem 0 0;
  border-top:1px solid var(--tile-border);
}
.seo-related-links h2{
  margin:0 0 0.65rem;
  font-size:var(--fs-h2);
}
.seo-related-links ul{
  list-style:none;
  margin:0;
  padding:0;
  display:grid;
  gap:0.45rem 1.25rem;
  grid-template-columns:1fr;
}
.seo-related-links a{
  font-family:var(--font-display);
  font-weight:600;
  font-size:var(--fs-base);
  color:var(--accent-dark);
  text-decoration:none;
}
.seo-related-links a:hover{ text-decoration:underline; }
@media (min-width:720px){
  .seo-related-links ul{ grid-template-columns:repeat(2,minmax(0,1fr)); }
}

/* ===== Поделиться ===== */
.share-bar{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:10px 14px;
  margin:28px 0 8px;
  padding:14px 0 0;
  border-top:1px solid var(--tile-border);
}
.share-bar__label{
  font-family:var(--font-display);
  color:var(--brand-red-dark);
  font-size:var(--fs-lead);
  letter-spacing:.02em;
}
.share-bar__actions{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.share-bar__btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:36px;
  padding:6px 12px;
  border:1px solid var(--tile-border);
  border-radius:var(--radius);
  background:var(--surface);
  color:var(--accent-dark);
  font:inherit;
  font-size:var(--fs-md);
  font-weight:600;
  text-decoration:none;
  cursor:pointer;
}
.share-bar__btn:hover{
  border-color:var(--gold-dark);
  background:#fff8e8;
  color:var(--brand-red-dark);
  text-decoration:none;
}

@media (max-width:560px){
  .memory-search__field{ max-width:100%; }
  .share-bar{ gap:8px; }
  .share-bar__actions{ width:100%; }
  .share-bar__btn{ flex:1 1 calc(50% - 8px); min-height:42px; }
}
