/* ==========================================================================
   1. Шрифты (самохост)
   ========================================================================== */
@font-face {
  font-family: 'Kurale';
  src: url('fonts/Kurale_400_normal.woff') format('woff'),
       url('fonts/Kurale_400_normal.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ==========================================================================
   2. База
   ========================================================================== */
body {
  padding-bottom: 40px;
}

/* ==========================================================================
   3. Типографика
   ========================================================================== */
h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6 {
  font-family: 'Kurale', serif;
}

h1, .h1 { font-size: 28px; }
h2, .h2 { font-size: 24px; }
h3, .h3 { font-size: 20px; }
h4, .h4 { font-size: 16px; }
h5, .h5 { font-size: 12px; }
h6, .h6 { font-size: 10px; }

/* ==========================================================================
   4. Ссылки
   ========================================================================== */
a:visited:not(.btn) {
  color: #690D9E;
}

/* ==========================================================================
   5. Каркас: сайт по центру
   ========================================================================== */
.container-narrow {
  margin: 0 auto;
  max-width: 700px;
  padding-left: 15px;
  padding-right: 15px;
}

.container-narrow > hr {
  margin: 30px 0;
}

/* ==========================================================================
   6. Шапка: закрепа, лого по центру, меню под лого
   ========================================================================== */
.sticky-header {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  padding: 10px 0 4px;
}

.logo {
  display: inline-block;
}

.logo img {
  max-height: 80%;      /* компактнее, т.к. шапка закреплена */
  max-width: 80%;
  height: auto;
}

/* Гамбургер — по центру под лого, только мобильные */
.menu-toggle {
  display: block;
  margin: 8px auto 4px;
}

@media (min-width: 768px) {
  .menu-toggle { display: none; }
}

/* Меню: строка по центру */
.main-menu-list {
  list-style: none;
  margin: 0;
  padding: 6px 0 6px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px 20px;
}

/* Мобильные: столбик по центру */
@media (max-width: 767.98px) {
  .main-menu-list {
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding-bottom: 10px;
  }
  .main-menu-list li { margin: 4px 0; }
}

/* ==========================================================================
   7. Приветствие
   ========================================================================== */
.hero-section {
  padding: 40px 0 10px;
}

/* ==========================================================================
   8. Блоки проектов и записей
   ========================================================================== */
.project-block {
  padding: 50px 0;
  border-top: 1px solid #e9ecef;
}

/* Плавное появление: работает ТОЛЬКО при живом JS,
   иначе (js-класс не добавлен) блоки видны сразу */
.js .fade-in-block {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.js .fade-in-block.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Рамка «полароид» для скриншотов */
.img-polaroid {
  padding: 4px;
  background-color: #fff;
  border: 1px solid rgba(0,0,0,0.2);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  max-width: 100%;
  height: auto;
}

/* Фото по центру, адаптивное */
.site-image {
  display: block;
  margin: 20px auto;
  max-width: 100%;
  height: auto;
}

/* Для скрипта зума */
.zoom-img-wrap {
  z-index: 1000;
}

/* ==========================================================================
   9. Контакты: иконки маленькие
   ========================================================================== */
.contacts-list {
  margin-top: 10px;
}

.contacts-list img {
  width: 24px;
  height: 24px;
  vertical-align: middle;
  margin-right: 8px;
}

/* ==========================================================================
   10. Подвал
   ========================================================================== */
.footer {
  padding-top: 30px;
}

/* ==========================================================================
   11. Мобильные
   ========================================================================== */
@media (max-width: 480px) {
  h1, .h1 { font-size: 24px; }
  h2, .h2 { font-size: 20px; }
  .hero-section { padding-top: 25px; }
  .project-block { padding: 35px 0; }
}

/* ==========================================================================
   12. Гамбургер-кнопка: рисуется CSS, не зависит от Bootstrap
   ========================================================================== */
.menu-toggle {
  display: block;
  margin: 8px auto 6px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 6px;
}

/* Три полоски */
.menu-toggle .bar {
  display: block;
  width: 24px;
  height: 2px;
  margin: 4px 0;
  background: #333;
}

/* На компьютере кнопка не нужна — скрываем */
@media (min-width: 768px) {
  .menu-toggle { display: none; }
}

/* ==========================================================================
   13. Скриншоты в блоках — по центру страницы
   ========================================================================== */
.project-block img {
  display: block;              /* картинка становится блоком */
  margin-left: auto;           /* равные отступы слева и справа */
  margin-right: auto;          /* = центрирование */
}

/* ==========================================================================
   14. Переходы по якорям: отступ от закреплённой шапки
   ========================================================================== */
[id] {
  scroll-margin-top: 110px;
}

/* ==========================================================================
   15. Cookie Consent Banner
   ========================================================================== */
#cookie-consent-banner {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: #000000;
  color: #ffffff;
  padding: 15px;
  z-index: 1000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  justify-content: center;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
  text-align: center;
}

#cookie-consent-banner p {
  margin: 0;
  font-size: 14px;
  max-width: 800px;
}

#cookie-consent-banner a {
  color: #ffffff;
  text-decoration: underline;
}

.cookie-btn-group {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

#cookie-consent-accept {
  background-color: #148f16;
  color: #fafafa;
  border: none;
  padding: 10px 20px;
  cursor: pointer;
  border-radius: 5px;
  font-size: 14px;
}

#cookie-consent-decline {
  background-color: #e10909;
  color: #ffffff;
  border: none;
  padding: 10px 20px;
  cursor: pointer;
  border-radius: 5px;
  font-size: 14px;
}

/* ========================================
   16. Telegram Widget (компактная всплывающая панель)
   ======================================== */
.telegram-widget {
  position: fixed;
  bottom: 110px; /* Приподнят над куки-баннером (обычно 60-80px) + зазор */
  right: 20px;
  z-index: 10001; /* Поверх всех элементов */
  max-width: 220px; /* Уменьшен в ~2 раза (было 420px) */
  width: calc(100% - 40px);
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  border: 1px solid #e5e7eb;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
}

.telegram-widget.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.telegram-widget.hidden {
  display: none;
}

.telegram-widget-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border: none;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  color: #6b7280;
  transition: background 0.2s ease, color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.telegram-widget-close:hover {
  background: rgba(0, 0, 0, 0.12);
  color: #1f2937;
}

.telegram-widget-content {
  padding: 12px; /* Уменьшен внутренний отступ */
}

.telegram-widget-header {
  text-align: center;
  margin-bottom: 10px;
}

.telegram-widget-header h3 {
  margin: 0;
  font-size: 0.9rem; /* Уменьшен шрифт заголовка */
  font-weight: 600;
  color: #1f2937;
  line-height: 1.2;
}

.telegram-widget-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.telegram-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px;
  background: #f9fafb;
  border-radius: 6px;
  border: 1px dashed #d1d5db;
}

.telegram-qr img {
  width: 90px; /* QR-код уменьшен, но остается читаемым для сканера */
  height: 90px;
  object-fit: contain;
  display: block;
}

.telegram-qr-hint {
  font-size: 0.65rem;
  color: #6b7280;
  text-align: center;
  line-height: 1.1;
}

.telegram-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background-color: #24A1DE;
  color: #ffffff;
  text-decoration: none;
  padding: 6px 12px; /* Компактная кнопка */
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.8rem;
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px rgba(36, 161, 222, 0.25);
  width: 100%;
}

.telegram-btn:hover {
  background-color: #1a91c4;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(36, 161, 222, 0.35);
  color: #ffffff;
}

.telegram-btn:active {
  transform: translateY(0);
}

.telegram-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Адаптивность для мобильных */
@media (max-width: 576px) {
  .telegram-widget {
    bottom: 100px; /* Чуть ниже на мобильных, где куки-баннер может быть выше */
    right: 15px;
    left: auto;
    max-width: 200px;
  }
  
  .telegram-widget-content {
    padding: 10px;
  }
  
  .telegram-qr img {
    width: 80px;
    height: 80px;
  }
}