/* ============================================
   Глобальные переменные
   Используются во всех шаблонах через var(--name)
   ============================================ */
:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --surface2: #f3f0eb;
  --border: rgba(60, 40, 20, 0.1);
  --accent: #e8921a;
  --accent2: #c96d10;
  --green2: #3d8a5c;
  --lilac2: #7a5889;
  --text: #2c2416;
  --muted: #8a7a68;
  --radius: 16px;
}

/* ============================================
   Сброс
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Manrope', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================================
   ТОПБАР — общий для всех страниц
   ============================================ */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(60, 40, 10, 0.06);
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  flex-shrink: 0;
}
.topbar-logo img { height: 48px; width: auto; }
.topbar-name { display: flex; flex-direction: column; line-height: 1.2; }
.topbar-name strong { font-size: 15px; font-weight: 700; color: var(--text); font-family: 'Playfair Display', serif; }
.topbar-name span   { font-size: 11px; color: var(--muted); font-weight: 500; }

.topbar-nav { display: flex; align-items: center; gap: 4px; }

.nav-link {
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}
.nav-link:hover { color: var(--accent); background: rgba(232,146,26,0.06); }
.nav-link.active { color: var(--accent); }

.social-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  padding-left: 16px;
  border-left: 1px solid var(--border);
}
.social-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--muted);
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}
.social-icon:hover { color: var(--accent); background: rgba(232,146,26,0.08); }

/* ============================================
   КНОПКИ — общие
   ============================================ */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px 28px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--accent2); }

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 28px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}
.btn-secondary:hover { background: var(--border); }

/* ============================================
   ФУТЕР — общий
   ============================================ */
.footer {
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 28px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}
.footer-left { display: flex; align-items: center; gap: 12px; }
.footer-left img { height: 40px; width: auto; opacity: 0.75; }
.footer-org { font-size: 12px; font-weight: 600; color: var(--muted); line-height: 1.5; }
.footer-org span { font-weight: 400; opacity: 0.7; }
.footer-branches { display: flex; gap: 24px; flex-wrap: wrap; }
.footer-branch { font-size: 12px; color: var(--muted); line-height: 1.6; }
.footer-branch strong { display: block; font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.footer-branch a { color: var(--accent); text-decoration: none; font-weight: 600; }
.footer-branch a:hover { color: var(--accent2); }
.footer-nav { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.footer-link { font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: none; transition: color 0.15s; }
.footer-link:hover { color: var(--accent); }
.footer-copy { font-size: 11px; color: var(--muted); opacity: 0.5; white-space: nowrap; }

/* ============================================
   ХЛЕБНЫЕ КРОШКИ — общие
   ============================================ */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
  padding: 16px 24px 0;
}
.breadcrumb a { color: var(--muted); text-decoration: none; transition: color 0.15s; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb-sep { opacity: 0.4; }

/* ============================================
   УТИЛИТЫ
   ============================================ */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: rgba(60,40,10,0.12); border-radius: 4px; }

/* ============================================
   АДАПТИВ
   ============================================ */
@media (max-width: 900px) {
  .topbar { padding: 0 16px; }
  .nav-link { font-size: 13px; padding: 6px 8px; }
}
@media (max-width: 768px) {
  .topbar-nav   { display: none; }
  .topbar-social { display: none; }
  .footer { padding: 20px 16px; flex-direction: column; align-items: flex-start; gap: 12px; }
  .footer-branches { display: none; }
  .footer-nav { gap: 12px; }
}

/* ============================================
   БЛОК "ЧИТАЙТЕ ТАКЖЕ" — tpl_circle
   ============================================ */
/* ============================================
   БЛОК СТАТЕЙ — tpl_circle
   ============================================ */
.circle-articles {
  border-top: 1px solid var(--border);
  padding: 48px 0;
}

.circle-articles--personal {
  background: var(--surface);
}

.circle-articles__inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

.circle-articles__title {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 24px;
}

.circle-articles__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

@media (max-width: 900px) {
  .circle-articles__grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .circle-articles__grid { grid-template-columns: 1fr; }
  .circle-articles__title { font-size: 20px; }
}
/* ============================================
   POST-CARD — карточка поста (tpl.postCard)
   Используется в блоге, на странице кружка и т.д.
   ============================================ */
.post-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  transition: box-shadow 0.18s, transform 0.18s;
}

.post-card:hover {
  box-shadow: 0 8px 32px rgba(60, 40, 10, 0.1);
  transform: translateY(-2px);
}

/* --- Изображение --- */
.card-image {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface2);
  flex-shrink: 0;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}

.post-card:hover .card-image img {
  transform: scale(1.04);
}

.card-image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  opacity: 0.4;
}

/* --- Бейдж типа --- */
.card-type-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.badge-news {
  background: var(--accent);
  color: #fff;
}

.badge-article {
  background: var(--green2);
  color: #fff;
}

/* --- Тело карточки --- */
.card-body {
  padding: 16px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.card-meta-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--muted);
  opacity: 0.5;
  flex-shrink: 0;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
}

.card-excerpt {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

/* --- Теги --- */
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.card-tag {
  font-size: 11px;
  font-weight: 600;
  background: var(--surface2);
  color: var(--muted);
  border-radius: 20px;
  padding: 2px 10px;
  border: 1px solid var(--border);
}

/* ============================================
   АДАПТИВ post-card / circle-articles
   ============================================ */
@media (max-width: 900px) {
  .circle-articles__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .circle-articles__grid {
    grid-template-columns: 1fr;
  }

  .circle-articles__title {
    font-size: 22px;
  }
}

/* ТЕГИ В КАРТОЧКЕ ПОСТА */
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.card-tag {
  font-size: 11px;
  font-weight: 600;
  background: var(--surface2);
  color: var(--muted);
  border-radius: 20px;
  padding: 2px 10px;
  border: 1px solid var(--border);
}

.circle-articles--personal .circle-articles__inner {
  padding: 32px 24px;
}

.tag-clickable {
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.tag-clickable:hover {
  background: rgba(232,146,26,.15);
  color: var(--accent);
  border-color: rgba(232,146,26,.3);
}

.mk-tabs { max-width:1200px; margin:24px auto 0; padding:0 24px; display:flex; gap:8px; flex-wrap:wrap; }
.mk-tab { padding:10px 22px; border-radius:100px; border:2px solid var(--border); background:var(--surface); font-size:14px; font-weight:600; cursor:pointer; transition:all .2s; font-family:'Manrope',sans-serif; color:var(--muted); }
.mk-tab:hover { border-color:rgba(232,146,26,.3); color:var(--text); }
.mk-tab.active { border-color:var(--accent); background:var(--accent); color:#fff; }

/* Добавить в style.css в секцию mka-card */
.mka-card-sched-teacher {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-top: 2px;
}
/* ============================================
   ХЕДЕР — мобильная адаптация
   ============================================ */
@media (max-width: 768px) {
  .header-nav { display: none !important; }
  .header-social { display: none !important; }
  .burger { display: flex !important; }
}

/* Бургер — скрыт на десктопе, виден на мобильном */
.burger { display: none; }
@media (max-width: 768px) {
  .burger { display: flex !important; }
  .header-nav { display: none !important; }
  .header-social { display: none !important; }
}

/* ============================================
   САЙДБАР ПОСТА — sidebar-related (tpl_post)
   ============================================ */
.sidebar-related-img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
  border-bottom: 1px solid var(--border);
}

@media (max-width: 768px) {
  .sidebar-related {
    border-radius: 16px;
    overflow: hidden;
  }
  .sidebar-related-img {
    height: 160px;
  }
  .post-layout {
    padding-bottom: 48px;
  }
}
