/* Общие стили сайта АА Татарстана: переменные, шапка и меню, фон страницы, панели, подвал.
   Подключается на всех страницах сайта. Пути к картинкам — относительно этого файла. */

:root{
  --accent:#216f86;
  --accent-dark:#174f62;
  --ink:#243238;
  --muted:#66777e;
  --bg:#f3f7f8;
  --line:#dce7ea;
  --soft:#e8f2f4;
  --panel:#ffffff;
  --panel-radius:24px;
  /* лёгкая мягкая тень светлых панелей */
  --panel-shadow:0 8px 24px rgba(20,55,75,.07);
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto}}
body{
  margin:0;
  font-family:Inter,"Segoe UI",Arial,sans-serif;
  color:var(--ink);
  background:var(--bg);
  line-height:1.55;
}
.wrap{max-width:1280px;margin:auto;padding:0 22px}
.hidden{display:none}

/* ===== Шапка и меню ===== */
.site-header{position:relative;z-index:3;padding:24px 0 0}
.top{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
}
.brand{
  display:flex;
  align-items:center;
  gap:16px;
  min-width:0;
  color:#fff;
  text-decoration:none;
}
.brand-logo{width:72px;height:72px;object-fit:contain;flex:0 0 auto}
/* Две строки названия («Анонимные Алкоголики» / «Татарстана») — один заголовок: одинаковые размер, начертание и цвет */
.brand-text strong,
.brand-text span{
  display:block;
  font-size:20px;
  font-weight:700;
  line-height:1.25;
  letter-spacing:.01em;
}
.site-nav{
  display:flex;
  align-items:center;
  gap:clamp(12px,1.7vw,25px);
  flex-wrap:nowrap;
  flex:0 0 auto;
}
.site-nav a{
  position:relative;
  color:#fff;
  text-decoration:none;
  font-size:15px;
  font-weight:500;
  white-space:nowrap;
}
.site-nav a:hover{opacity:.82}
.site-nav a.active::after{
  content:"";
  position:absolute;
  left:0;right:0;bottom:-10px;
  height:2px;
  background:#fff;
  border-radius:2px;
}
.nav-toggle{
  display:none;
  flex:0 0 auto;
  width:46px;height:46px;
  padding:0;
  border:1.5px solid rgba(255,255,255,.75);
  border-radius:12px;
  background:rgba(7,50,100,.22);
  color:#fff;
  font:inherit;
  font-size:24px;
  line-height:1;
  cursor:pointer;
}
.nav-toggle:focus-visible,.site-nav a:focus-visible,.brand:focus-visible{outline:3px solid #fff;outline-offset:3px}

/* Внутренние страницы: компактная шапка без неба, фирменный синий */
.inner-shell{
  position:relative;
  color:#fff;
  padding-bottom:30px;
  background:linear-gradient(120deg,#0a3b78 0%,#12589f 55%,#1b6fc0 100%);
}

/* ===== Общий фон страницы и панели ===== */
.page{
  position:relative;
  isolation:isolate;
  padding:56px 0 72px;
  background:var(--bg);
}
.page::before{
  content:"";
  position:absolute;
  inset:0;
  z-index:-1;
  background:url("aa-pattern-circles-triangles.83258ad12172.png") 0 0 / 380px 380px repeat;
  opacity:.14;
  pointer-events:none;
}
.panel{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:var(--panel-radius);
  padding:44px;
  margin-bottom:28px;
  box-shadow:var(--panel-shadow);
}
.panel:last-child{margin-bottom:0}
.panel h2{font-size:30px;line-height:1.2;margin:0}

/* ===== Подвал (одинаковый на всех страницах) =====
   Сплошная полоса на всю ширину; содержимое ограничено .wrap. Колонки — без карточек, фонов и рамок.
   Уровни: 1) логотип и название; 2) три колонки (.footer-grid); 3) две колонки (.footer-info); 4) нижняя строка. */
.site-footer{
  background:#1d2b31;
  color:#d9e2e5;
  padding:48px 0 28px;
  font-size:16px;
}
.footer-brand{
  display:flex;
  align-items:center;
  gap:14px;
  width:fit-content;
  max-width:100%;
  margin:0 0 36px;
  color:#fff;
  text-decoration:none;
}
.footer-brand img{width:56px;height:56px;object-fit:contain;flex:0 0 auto}
.footer-brand strong{display:block;font-size:18px;line-height:1.25;margin-bottom:3px}
.footer-brand span span{display:block;font-size:14px;line-height:1.35;color:#c4d1d5}
@media(min-width:480px){
  .footer-brand strong,.footer-brand span span{white-space:nowrap}
}
.footer-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:clamp(24px,4vw,56px);
  align-items:start;
}
.footer-col{display:flex;flex-direction:column;align-items:flex-start;gap:4px;min-width:0}
.footer-col h2{margin:0 0 8px;font-size:19px;line-height:1.3;color:#fff}
.footer-col p{margin:0 0 8px;color:#c4d1d5;overflow-wrap:anywhere}
.footer-col a:not(.footer-btn){
  display:inline-flex;
  align-items:center;
  min-height:32px;
  color:#d9e2e5;
  text-decoration:none;
  overflow-wrap:anywhere;
}
.footer-col a:not(.footer-btn):hover{color:#fff;text-decoration:underline}
.footer-contact{scroll-margin-top:24px}
.footer-col a.footer-phone{
  min-height:44px;
  margin-bottom:10px;
  color:#fff;
  font-size:24px;
  font-weight:700;
  line-height:1.2;
  white-space:nowrap;
}
.footer-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:46px;
  padding:0 22px;
  border-radius:12px;
  background:#fff;
  color:var(--accent-dark);
  font-weight:700;
  text-decoration:none;
  transition:transform .15s ease;
}
.footer-btn:hover{transform:translateY(-1px)}
.footer-brand:focus-visible,.footer-col a:focus-visible,.footer-btn:focus-visible,.footer-info a:focus-visible{outline:3px solid #fff;outline-offset:3px;border-radius:8px}
/* Две равные колонки: одинаковые боковые отступы у обеих, текст по левому краю */
.footer-info{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:0;
  margin-top:36px;
  padding-top:28px;
  border-top:1px solid rgba(255,255,255,.14);
}
.footer-info-block{min-width:0;padding:0 24px;text-align:left}
.footer-info-block h3{margin:0 0 8px;font-size:16px;line-height:1.4;font-weight:700;color:#fff}
.footer-info-block p{margin:0 0 8px;color:#c4d1d5;overflow-wrap:anywhere}
.footer-info-block a{
  display:inline-flex;
  align-items:center;
  min-height:32px;
  color:#d9e2e5;
  overflow-wrap:anywhere;
}
.footer-info-block a:hover{color:#fff}
.footer-bottom{
  margin-top:28px;
  padding-top:20px;
  border-top:1px solid rgba(255,255,255,.14);
  font-size:14px;
  text-align:center;
  color:#aebdc2;
}

/* ===== Адаптив шапки =====
   Сначала компактнее (ниже 1100px), мобильное меню — только ниже 900px. */
@media(max-width:1100px){
  .brand{gap:14px}
  .brand-logo{width:60px;height:60px}
  .brand-text strong,.brand-text span{font-size:18px}
  .site-nav a{font-size:14px}
}
@media(max-width:900px){
  .nav-toggle{display:inline-flex;align-items:center;justify-content:center}
  .js .site-nav{
    display:none;
    position:absolute;
    top:calc(100% + 12px);
    right:0;
    width:min(300px,100%);
    flex-direction:column;
    align-items:stretch;
    gap:2px;
    padding:10px;
    background:rgba(9,40,88,.97);
    border:1px solid rgba(255,255,255,.18);
    border-radius:18px;
    box-shadow:0 16px 40px rgba(3,20,48,.4);
  }
  .js .site-nav.open{display:flex}
  .site-nav a{padding:13px 16px;border-radius:12px;font-size:17px}
  .site-nav a:hover{opacity:1;background:rgba(255,255,255,.1)}
  .site-nav a.active{background:rgba(255,255,255,.14)}
  .site-nav a.active::after{display:none}
  /* без JS меню остаётся видимым строкой под брендом */
  html:not(.js) .top{flex-wrap:wrap}
  html:not(.js) .nav-toggle{display:none}
  html:not(.js) .site-nav{flex:1 1 100%;flex-wrap:wrap}
}
@media(max-width:767px){
  .footer-grid{grid-template-columns:1fr;gap:28px}
  .footer-info{grid-template-columns:1fr;gap:28px}
  .footer-info-block{padding:0}
}
@media(max-width:650px){
  .wrap{padding:0 16px}
  .site-header{padding-top:16px}
  .top{gap:12px}
  .brand{gap:12px}
  .brand-logo{width:50px;height:50px}
  .brand-text strong,.brand-text span{font-size:16px}
  .page{padding:32px 0 48px}
  .panel{padding:26px 20px;border-radius:20px;margin-bottom:20px}
  .panel h2{font-size:26px}
  .site-footer{padding:36px 0 24px}
  .footer-col a:not(.footer-btn),.footer-info-block a{min-height:44px}
  .footer-btn{align-self:stretch}
}

/* ===== События: общие стили (главная, events.html, страницы материалов) ===== */
.page-head{padding-bottom:36px}
.page-head h1{
  margin:0 0 24px;
  font-size:clamp(28px,3.4vw,40px);
  line-height:1.2;
  letter-spacing:0;
  font-weight:800;
  overflow-wrap:anywhere;
}
.page-head h1:last-child{margin-bottom:0}

/* Навигация по категориям: обычные якорные ссылки */
.cat-nav{display:flex;flex-wrap:wrap;gap:10px}
.cat-nav a{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  min-height:48px;
  padding:10px 22px;
  border:1px solid #b7c9ce;
  border-radius:999px;
  background:#fff;
  color:var(--accent-dark);
  font-size:17px;
  font-weight:600;
  line-height:1.3;
  text-decoration:none;
  transition:background .15s ease,border-color .15s ease;
}
.cat-nav a:hover{background:var(--soft);border-color:var(--accent)}
.cat-nav a:focus-visible{outline:3px solid rgba(33,111,134,.45);outline-offset:2px}
.event-section{scroll-margin-top:24px}
.event-section h2{margin-bottom:22px}
.empty-note{margin:0;padding:16px 20px;background:#e6f1f3;border-radius:14px;color:var(--muted)}

/* Компактный хронологический список. Новое событие — ещё один <li class="event-item">.
   Вся строка кликабельна через ссылку в заголовке (::after растягивается на карточку). */
.event-list{list-style:none;margin:0;padding:0;display:grid;gap:14px}
.event-item{
  position:relative;
  display:grid;
  grid-template-columns:150px minmax(0,1fr) auto;
  gap:22px;
  align-items:center;
  background:var(--bg);
  border:1px solid var(--line);
  border-radius:18px;
  padding:20px 24px;
  transition:border-color .15s ease,box-shadow .15s ease;
}
.event-item:hover{border-color:var(--accent);box-shadow:var(--panel-shadow)}
.event-item:focus-within{outline:3px solid rgba(33,111,134,.45);outline-offset:2px}
.event-date{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  min-height:92px;
  padding:12px 10px;
  background:#fff;
  border:1px solid var(--line);
  border-radius:14px;
}
.event-day{font-size:28px;font-weight:800;line-height:1.1;color:var(--accent)}
.event-month{margin-top:2px;font-size:14px;line-height:1.3;color:var(--muted)}
.event-time{margin-top:6px;font-size:14px;font-weight:700;color:var(--accent-dark)}
.event-title{margin:0 0 6px;font-size:20px;line-height:1.35;overflow-wrap:anywhere}
.event-title a{color:var(--ink);text-decoration:none}
.event-title a::after{content:"";position:absolute;inset:0;border-radius:18px}
.event-title a:hover{color:var(--accent-dark);text-decoration:underline}
.event-title a:focus-visible{outline:none}
.event-meta{margin:0;color:var(--muted);font-size:16px}
.event-extra{margin:4px 0 0;font-size:15px}
.event-tag{
  display:inline-block;
  margin-top:10px;
  padding:5px 12px;
  border-radius:999px;
  background:var(--soft);
  color:var(--accent-dark);
  font-size:13px;
  font-weight:600;
  line-height:1.4;
}
.event-arrow{font-size:24px;color:var(--accent)}
.event-more{display:inline-block;margin-top:18px;color:var(--accent-dark);font-weight:700;text-decoration:none}
.event-more:hover{text-decoration:underline}
.event-more:focus-visible{outline:3px solid rgba(33,111,134,.45);outline-offset:3px;border-radius:4px}

/* Подробная страница материала */
.back-link{
  display:inline-flex;
  align-items:center;
  min-height:44px;
  margin:0 0 14px;
  color:var(--accent-dark);
  font-weight:700;
  text-decoration:none;
}
.back-link:hover{text-decoration:underline}
.back-link:focus-visible{outline:3px solid rgba(33,111,134,.45);outline-offset:3px;border-radius:4px}
.event-head .event-tag{margin:0 0 14px}
.event-head h1{margin-bottom:12px}
.event-when{margin:0;color:var(--muted);font-size:18px}
/* Необязательное медиа после заголовка: одно фото или видеоблок по ссылке (сейчас на страницах не выводится).
   <div class="event-media"><img src="…" alt="…"></div>
   <div class="event-media is-video"><iframe src="…" allowfullscreen title="…"></iframe></div> */
.event-media{margin-top:26px;border-radius:16px;overflow:hidden;background:var(--bg)}
.event-media img{display:block;width:100%;height:auto}
.event-media.is-video{aspect-ratio:16/9}
.event-media iframe{display:block;width:100%;height:100%;border:0}

.event-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px;margin-bottom:28px}
.event-card{
  min-width:0;
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:20px;
  box-shadow:var(--panel-shadow);
  padding:28px 30px;
}
.event-card.is-wide{grid-column:1/-1}
.event-card.is-accent{background:#e6f1f3}
.event-card h2{margin:0 0 14px;font-size:22px;line-height:1.25}
.event-card p{margin:0 0 10px;overflow-wrap:anywhere}
.event-card p:last-child,.event-card ul:last-child{margin-bottom:0}
.event-card .lead-line{font-size:18px;font-weight:700}
.event-card .muted{color:var(--muted)}
.event-card ul{margin:0 0 10px;padding-left:20px}
.event-card li{margin:4px 0}
.person{margin-top:14px}
.person:first-of-type{margin-top:0}
.person-name{font-weight:700}
.tel-link{
  display:inline-block;
  padding:6px 0;
  color:var(--accent-dark);
  font-weight:700;
  white-space:nowrap;
  text-decoration:none;
}
.tel-link:hover{text-decoration:underline}
.tel-link:focus-visible,.ext-link:focus-visible{outline:3px solid rgba(33,111,134,.45);outline-offset:2px;border-radius:4px}
.tel-list{display:flex;flex-direction:column;align-items:flex-start}
.ext-link{color:var(--accent-dark);font-weight:700;overflow-wrap:anywhere}
.event-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:50px;
  padding:10px 26px;
  border-radius:12px;
  border:1.5px solid var(--accent);
  background:var(--accent);
  color:#fff;
  font-size:17px;
  font-weight:700;
  line-height:1.3;
  text-align:center;
  text-decoration:none;
  transition:transform .15s ease;
}
.event-btn:hover{transform:translateY(-1px)}
.event-btn:focus-visible{outline:3px solid rgba(33,111,134,.45);outline-offset:3px}
.event-closing{padding:36px 44px}
.event-closing p{margin:0 0 8px;font-size:18px;line-height:1.6}
.event-closing p:last-child{margin-bottom:0}
.event-closing .accent{font-weight:700;color:var(--accent-dark)}
.speaker-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
.speaker{background:var(--bg);border:1px solid var(--line);border-radius:16px;padding:20px 22px}
.speaker h3{margin:0 0 4px;font-size:19px;line-height:1.35;color:var(--accent-dark)}
.speaker .since{margin:0 0 12px;color:var(--muted)}
.speaker .label{margin:12px 0 4px;font-weight:700}

@media(max-width:760px){
  .event-grid,.speaker-grid{grid-template-columns:1fr}
  .event-closing{padding:28px 24px}
}
@media(max-width:700px){
  .event-item{grid-template-columns:minmax(0,1fr);gap:12px;padding:18px}
  .event-date{
    flex-direction:row;
    flex-wrap:wrap;
    justify-content:flex-start;
    align-items:baseline;
    gap:4px 8px;
    min-height:0;
    width:fit-content;
    max-width:100%;
    padding:8px 14px;
  }
  .event-day{font-size:22px}
  .event-month,.event-time{margin:0}
  .event-arrow{display:none}
}
@media(max-width:650px){
  .cat-nav a{flex:1 1 100%}
  .event-card{padding:22px 20px;border-radius:18px}
  .event-closing{padding:24px 20px}
  .event-btn{width:100%}
}

/* ===== Этап 2: добавления для страниц, собираемых из базы ===== */
/* подвал: необязательные контакты округа и мессенджеры (показываются только если заполнены) */
.footer-col p.footer-extra-label{margin:10px 0 0;font-size:14px;color:#aebdc2}
.footer-col a.footer-phone-sub{font-size:20px;min-height:36px;margin-bottom:0}
.footer-col a.footer-mail{font-weight:600;color:#fff}

/* события: прошедшие, фото и видео */
.past-title{margin:26px 0 12px;font-size:18px;color:var(--muted)}
.event-list.is-past .event-item{background:#fff;opacity:.92}
.event-media.is-photo{margin:26px 0 0}
.event-media figcaption{padding:10px 14px;background:var(--bg);color:var(--muted);font-size:15px}
.event-video-link{margin:22px 0 0}
.event-grid .event-card .event-btn{align-self:flex-start}

/* текст компетенции */
.competency h1{margin:0 0 20px;font-size:clamp(26px,3vw,36px);line-height:1.2;font-weight:800;overflow-wrap:anywhere}
.rich-text{max-width:820px;font-size:18px;line-height:1.65}
.rich-text h2{font-size:24px;margin:26px 0 10px}
.rich-text h3{font-size:20px;margin:22px 0 8px}
.rich-text p{margin:0 0 14px}
.rich-text ul,.rich-text ol{margin:0 0 14px;padding-left:24px}
.rich-text a{color:var(--accent-dark);font-weight:600;overflow-wrap:anywhere}
.faq-answer p{margin:0 0 12px}
.faq-answer p:last-child{margin-bottom:0}
.faq-answer ul,.faq-answer ol{margin:0 0 12px;padding-left:24px}
.faq-answer a{color:var(--accent-dark);font-weight:600}
