/* --- Обнуление и базовые стили --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --color-text-dark: #2e2e2e;
  --color-text-btn-open-dark: #7e7e7e;
  --color-text-grey: #8c8c8c;
  --color-text-prev-grey: #c2c2c2;
  --color-text-footer-grey: #c9c9c9;
  --color-text-slogan-grey: #b4b4b4;
  --color-text-active: #116963;
  --font-sans: 'Inter', sans-serif;
  --font-serif: 'Literata', serif;
}

html,
body {
  height: 100%;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: 'Inter';
  font-weight: 500;
  line-height: 1.5;
  margin: 1.37em 0 1em 0;
}

h1 {
  font-size: 26px;
}

h2 {
  font-size: 23px;
}

h3 {
  font-size: 20px;
}

h4 {
  font-size: 19px;
}

h5 {
  font-size: 17px;
}

h6 {
  font-size: 15px;
}

body {
  background-color: #ffffff;
  color: var(--color-text-dark);
  font-family: var(--font-sans);
  display: flex;
  flex-direction: column; /* Для прижатия футера */
  -webkit-font-smoothing: antialiased;
  padding-top: 107px;
}

/* --- Контейнер --- */
.container {
  margin: 0 auto;
  padding: 0 140px; /* Безопасный отступ для малых экранов */
  max-width: 100%;
  width: 100%;
}

/* Базовое состояние перехода */
#header {
  position: absolute;
  top: 0;
  transition:
    background-color 0.3s ease,
    padding 0.3s ease,
    box-shadow 0.3s ease;
  width: 100%;
  z-index: 1000;
  padding-top: 56px;
}

/* Стили при скролле */
#header.header-sticky {
  position: fixed;
  top: 0;
  left: 0;
  padding-top: 15px;
  padding-bottom: 15px;
  background-color: rgba(255, 255, 255, 0.98);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  animation: fadeInDown 0.4s ease;
}

/* Анимация появления */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

body.menu-open #header {
  position: fixed;
  box-shadow: none;
  background: #ffffff;
}

body.menu-open #header.header-sticky {
  background: #ffffff;
}

.header-sticky + #main {
  padding-top: 146px;
}

.header-row {
  display: flex;
  align-items: flex-start;
  align-items: center;
  justify-content: space-between;
  max-width: 820px;
}

.logo {
  display: flex;
  flex-direction: column;
  width: 200px; /* Фиксируем зону лого, чтобы навигация стояла по макету */
  flex-shrink: 0;
}

.logo-title {
  font-size: 26px;
  font-weight: 500;
  text-decoration: none;
  color: var(--color-text-dark);
  line-height: 1.1;
}

.logo-title:hover,
.logo-title:active,
.logo-title:focus {
  text-decoration: none;
  color: var(--color-text-dark);
}

.logo-subtitle {
  font-size: 14px;
  color: var(--color-text-slogan-grey);
  margin-top: 4px;
}

/*
.main-nav {
    padding-top: 6px;
}
*/

.main-nav .level-0 {
  display: flex;
  list-style: none;
  gap: 30px;
}

.main-nav .level-0 {
  font-size: 16px;
  text-decoration: none;
  color: var(--color-text-grey);
}

.main-nav .level-0 li.active,
.main-nav .level-0 li:hover,
.main-nav .level-0 li:focus,
.main-nav .level-0 li:active {
  color: var(--color-text-active);
  text-decoration: none;
}

/* --- Content --- */
#main,
#page,
#list,
#system,
#message {
  flex: 1 0 auto; /* Растягивается, толкая футер */
}

#system .section-title h1 {
    margin: 0.37em 0 1em 0;
}

#message .section-title h1 {
    font-size: 26px;
    text-align: center;
    margin-top: 0;
}

.section-desc {
    font-style: italic;
    padding-bottom: 30px;
    color: #ccc;
}

.systemContent {
  padding-top: 80px;
  padding-bottom: 60px;
}

#system {
	 max-width: 1400px;
}

#message {
	 max-width: 1150px;
}

#standalone-body {
	padding-top: 0;
}

#standalone {
	padding: 24px;
}

.message-container {
    margin: 0 auto;
    /* padding: 0 140px; */
    max-width: 100%;
    width: 100%;
    height: 100%;
    display: flex;
    flex-grow: 1;
    flex-wrap: nowrap;
    align-content: center;
    justify-content: center;
    align-items: center;
}

.indexContent {
  padding-top: 66px;
  padding-bottom: 66px;
}

.text-block {
  max-width: 800px;
  font-size: 19px;
}

.text-block p {
  font-family: var(--font-serif);
  line-height: 1.95; /* Межстрочный интервал по макету */
  margin-bottom: 15px;
  color: #1a1a1a;
}

.btn-open {
  display: inline-block;
  margin-top: 66px;
  font-size: 17px;
  text-decoration: none;
  color: var(--color-text-btn-open-dark);
  border-bottom: 1px solid transparent;
  transition: border 0.3s;
}

.btn-open:hover {
  border-bottom: 1px solid var(--color-text-dark);
  color: var(--color-text-dark);
  text-decoration: none;
}

.btn-open span {
  font-family: var(--font-sans);
}

/* --- Footer --- */
#footer {
  flex: 0 0 auto;
  padding-bottom: 50px;
}

.footer-nav ul {
  display: flex;
  list-style: none;
  gap: 30px;
}

.footer-nav ul li a {
  font-size: 14px;
  color: var(--color-text-footer-grey);
  text-decoration: none;
}

.footer-nav ul li a:hover {
  color: var(--color-text-active);
}

/* --- Mobile / Burger --- */
.burger-menu {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 24px;
  height: 18px;
  position: relative;
  z-index: 100;
}

.burger-menu span {
  display: block;
  width: 100%;
  height: 1px;
  background: var(--color-text-dark);
  position: absolute;
  transition: 0.3s;
}

.burger-menu span:nth-child(1) {
  top: 0;
}
.burger-menu span:nth-child(2) {
  top: 8px;
}
.burger-menu span:nth-child(3) {
  top: 16px;
}

/* --- Page Content (page.html) --- */

/* Контейнер для статьи */

.pageContent {
  padding-top: 80px;
  padding-bottom: 60px;
}

.page {
  max-width: 640px; /* Ограничиваем ширину текста для удобства чтения */
  margin-left: 180px;
  font-size: 17px;
}

/* Заголовок страницы */
.page .page-title-materials h1 {
  font-family: var(--font-sans);
  font-size: 26px;
  font-weight: 500;
  margin: 0.37em 0 1.37em 0;
  color: var(--color-text-dark);
  letter-spacing: -0.02em;
}

/* Текстовые абзацы в статье */
.page p {
  font-family: var(--font-serif);
  line-height: 1.78;
  margin-bottom: 25px;
  color: #1a1a1a;
}

/* --- Расширенные стили для контента .page --- */

/* Списки */
.page ul,
.page ol {
  margin-bottom: 30px;
  padding-left: 20px;
}

.page li {
  font-family: var(--font-serif);
  line-height: 1.75;
  margin-bottom: 12px;
  color: #1a1a1a;
}

/* Цитаты */
.page blockquote {
  margin: 30px 0;
  padding: 20px 20px 20px 40px;
  /* font-size: 0.9em; */
  /* border-left: 1px solid var(--color-text-active); */
  font-style: italic;
}

.page blockquote p {
  line-height: 1.7;
  margin-bottom: 0;
  color: var(--color-text-dark);
}

/* Изображения */
.page img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 30px 0;
}

/* Видео (HTML5 и iframe/Youtube) */
.page video,
.page iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 30px 0;
  border: none;
  display: block;
}

/* Подписи к медиафайлам (если будут использоваться) */
.page figcaption {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--color-text-grey);
  margin-top: -20px;
  margin-bottom: 30px;
  text-align: left;
}

/* --- Список статей (#list) --- */

.list {
  max-width: 640px; /* Ограничиваем ширину текста для удобства чтения */
  margin-left: 180px;
  font-size: 17px;
}

.listContent {
  padding-top: 126px;
  padding-bottom: 60px;
}

/* Рубрикатор (Категории) */
.categories-list {
  display: flex;
  font-size: 14px;
  flex-wrap: wrap;
  gap: 15px 32px; /* Вертикальный и горизонтальный отступы */
  list-style: none;
  margin-bottom: 52px; /* Воздух до списка статей по макету */
  max-width: 800px;
}

.category-link {
  font-family: var(--font-sans);
  text-decoration: none;
  color: var(--color-text-grey);
  transition: color 0.3s ease;
}

.category-link.active,
.category-link:hover,
.category-link:focus {
  color: var(--color-text-active);
  text-decoration: none;
}

/* Список статей */
.articles-list {
  display: flex;
  flex-direction: column;
  gap: 31px;
  max-width: 800px;
}

.article-item h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 500;
  line-height: 1.5;
}

.article-title-link {
  font-family: var(--font-serif);
  line-height: 1.5;
  text-decoration: none;
  color: var(--color-text-dark);
  transition: color 0.3s ease;
}

.article-title-link:hover,
.article-title-link:focus {
  color: var(--color-text-active);
  text-decoration: none;
}

.prev-page {
  padding-bottom: 30px;
}

.prev-page a {
  color: var(--color-text-prev-grey);
  font-size: 0.8em;
}

.prev-page a:hover,
.prev-page a:focus {
  color: var(--color-text-active);
  text-decoration: none;
}

.prev-page span {
  font-family: var(--font-sans);
}

.prev-page-bottom {
  padding-top: 19px;
}

/* --- Страница Контактов --- */

.contacts p {
  margin-bottom: 20px;
  font-family: var(--font-serif);
  font-size: 19px;
  line-height: 1.6;
}

/* Подписи над ссылками */
.contacts small {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--color-text-grey);
  margin-bottom: 4px;
}

/* Стили ссылок (Email, TG) */
.contacts a {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 500;
  color: var(--color-text-dark);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all 0.3s ease;
  display: inline-block;
}

.contacts a:hover {
  color: var(--color-text-active);
  border-bottom-color: var(--color-text-active);
}

/* Финальная реплика */
.contacts .note {
  font-size: 16px;
  color: var(--color-text-grey);
  margin-top: 10px;
}

.section-admin {
	padding: 0 0 24px 0;
}

.section-admin a {
    display: inline-block;
    padding: 3px 10px;
    border: 1px solid #ececec;
    font-size: 0.8em;
}

.section-admin a:hover {
    color: var(--color-text-active);
    border-bottom-color: var(--color-text-active);
	text-decoration: none;
}

/* --- Mobile Styles --- */
@media (max-width: 1024px) {
  .logo {
    width: 280px;
  }

  .page,
  .list {
    margin-left: 0;
  }
}

@media (max-width: 768px) {
  #header {
    padding-top: 40px;
  }

  .container {
    padding: 0 24px;
  }

  .header-row {
    justify-content: space-between;
  }

  .burger-menu {
    display: block;
  }

  .main-nav {
    display: none;
    position: absolute;
    top: 0;
    left: 24px;
    height: 100%;
    width: calc(100% - 24px);
    flex-wrap: nowrap;
    align-items: center;
  }

  body.menu-open #header {
    height: 100%;
  }

  /* Состояние при открытом меню */
  body.menu-open .main-nav {
    display: flex;
  }

  body.menu-open .level-0 {
    flex-direction: column;
    gap: 30px;
  }

  body.menu-open .level-0 li {
    font-size: 24px;
    color: var(--color-text-dark);
  }

  body.menu-open #main,
  body.menu-open #page,
  body.menu-open #list,
  body.menu-open #footer {
    /*display: none;*/ /* Скрываем контент как на скриншоте "Меню-открыто" */
  }

  /* Анимация крестика */
  body.menu-open .burger-menu span:nth-child(1) {
    transform: rotate(45deg);
    top: 8px;
  }
  body.menu-open .burger-menu span:nth-child(2) {
    opacity: 0;
  }
  body.menu-open .burger-menu span:nth-child(3) {
    transform: rotate(-45deg);
    top: 8px;
  }

  .listContent {
    padding-top: 80px;
    padding-bottom: 60px;
  }

  .footer-nav ul {
    display: flex;
    list-style: none;
    gap: 6px 20px;
    flex-wrap: wrap;
    flex-direction: row;
  }
  
  .page blockquote {
    margin: 30px 0;
    padding-left: 20px;
  }

  .pageContent {
    padding-top: 40px;
  }

  .page .page-title h1 {
    font-size: 28px;
    margin-bottom: 35px;
  }

  .page p {
    font-size: 18px;
    line-height: 1.8;
    margin-bottom: 25px;
  }
  .categories-list {
    /*gap: 12px 20px;*/
    margin-bottom: 40px;
  }
  .article-title-link {
    font-size: 20px;
    line-height: 1.4;
  }
  .contacts p {
    margin-bottom: 25px;
  }
  .contacts a {
    font-size: 18px;
  }
}
