/* ==========================================================================
   ОКРЕМА СТАТТЯ (Single Article)
   ========================================================================== */
.article-header-top {
  padding: 12px 0;
  text-align: center;
  background: transparent;
}

.article-header-logo {
  text-decoration: none;
  display: inline-block;
  font-family: 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', serif;
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main, #1e293b);
  letter-spacing: -0.5px;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--white, #fff);
  box-shadow: var(--card-shadow, 0 8px 20px rgba(0,0,0,0.08));
  transition: transform 0.12s ease, color 0.12s ease;
}

.article-header-logo:hover {
  color: var(--primary, #4f46e5);
  transform: translateY(-2px);
}

.article-container {
  max-width: 800px;
  margin: 40px auto;
  padding: 28px;
  background: linear-gradient(120deg, #f8fafc 0%, #e0e7ff 100%);
  border-radius: 24px;
  box-shadow: 0 4px 24px rgba(99,102,241,0.09);
}
.article-header {
  text-align: center;
  margin-bottom: 30px;
}
.article-header h1 {
  font-size: 2.7rem;
  font-weight: 900;
  color: #6366f1;
  margin-bottom: 10px;
  text-shadow: 0 2px 16px rgba(99,102,241,0.13);
}
.article-header .article-date {
  color: #64748b;
  font-size: 1.1rem;
}
.article-img {
  width: 100%;           /* Адаптивність для мобільних */
  max-width: 500px;      /* Обмежте ширину, щоб на ПК фото не було на весь екран */
  height: auto;          /* !!! Найважливіше: висота підлаштується під пропорції фото */
  
  display: block;        /* Щоб margin: auto працював коректно */
  margin: 0 auto 24px;   /* Центрування фото та відступ знизу */
  
  border-radius: 18px;
  box-shadow: 0 2px 12px rgba(99,102,241,0.07);
  
  /* object-fit тут вже не обов'язковий, якщо не задана жорстка висота,
     але можна залишити на всяк випадок */
  object-fit: cover; 
}
.article-content {
  line-height: 1.8;
  font-size: 1.15rem;
  color: #333;
  background: #fff;
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: 0 2px 8px rgba(99,102,241,0.05);
}
.article-meta {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.article-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tag-pill {
  display: inline-block;
  background: #e0e7ff;
  color: #2d3a5a;
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 13px;
  margin-right: 6px;
  margin-bottom: 2px;
  cursor: pointer;
  transition: background 0.2s;
}
.tag-pill.active {
  background: #6366f1;
  color: #fff;
}
.share-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}
.share-actions a, .share-actions button {
  background: #f3f4f6;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 15px;
  color: #374151;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 4px;
}
.share-actions a:hover, .share-actions button:hover {
  background: #6366f1;
  color: #fff;
}
.share-actions .share-icon {
  font-size: 18px;
}
.comments-block {
  margin-top: 18px;
  border-top: 1px solid #eef2ff;
  padding-top: 14px;
  background: #f8fafc;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(99,102,241,0.07);
}
.comment-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(99,102,241,0.07);
  padding: 16px;
}
.comment-form input,
.comment-form textarea {
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 15px;
  background: #fff;
}
.comment-form button {
  background: #6366f1;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s;
}
.comment-form button:hover {
  background: #4338ca;
}
.comment-form .honeypot {
  display: none;
}
.comment-form .antibot {
  font-size: 14px;
  color: #374151;
}
.comments-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.comment-item {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(99,102,241,0.07);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
}
.comment-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.comment-name {
  font-weight: bold;
  color: #374151;
}
.comment-date {
  font-size: 12px;
  color: #6b7280;
}
.comment-text {
  margin-top: 2px;
  color: #222;
  font-size: 15px;
}
.comment-smilebar {
  margin-top: 6px;
  display: flex;
  gap: 6px;
}
.comment-smile {
  cursor: pointer;
  font-size: 18px;
  transition: transform 0.1s;
}
.comment-smile:hover {
  transform: scale(1.2);
}
.btn-back {
  display: inline-block;
  margin-top: 30px;
  text-decoration: none;
  background: #f1f5f9;
  padding: 10px 20px;
  border-radius: 8px;
  color: #333;
  font-weight: 600;
  transition: 0.2s;
}
.btn-back:hover {
  background: #e2e8f0;
}

/* ==========================================================================
 

/* ==========================================================================
   ОНОВЛЕНИЙ КНИЖКОВИЙ СТИЛЬ ТЕКСТУ
   ========================================================================== */

.article-header h1 {
  /* Шрифт як у заголовках на головній */
  font-family: 'Iowan Old Style', 'Palatino Linotype', 'URW Palladio L', P052, serif;
  font-size: 2.2rem;
  font-weight: 700;
  color: #1e293b; /* Більш глибокий колір для серйозного вигляду */
  margin-bottom: 10px;
  text-align: center;
}

.article-content {
  /* Книжковий шрифт із засічками */
  font-family: 'Iowan Old Style', Georgia, Times, serif;
  font-style: italic; /* Робимо курсив, як у вашому виділеному блоці */
  line-height: 1.8;
  font-size: 1.2rem;
  color: #2d3748;
  
  background: #fff;
  border-radius: 14px;
  padding: 40px; /* Більше простору навколо тексту */
  margin-bottom: 18px;
  
  /* Вирівнювання по ширині для ефекту книжкової сторінки */
  text-align: justify; 
  /* Або text-align: center; якщо хочете точно як у червоному прямокутнику */
  
  hyphens: auto; /* Дозволяє автоматичні переноси слів */
}

/* Ефект "червоного рядка" (абзацу) для кожного нового параграфа */
.article-content p {
  text-indent: 1.5em; 
  margin-bottom: 1em;
}

/* Перша літера статті (буквиця) для справжнього книжкового стилю */
.article-content::first-letter {
  float: left;
  font-size: 3.5rem;
  line-height: 1;
  font-weight: bold;
  margin-right: 8px;
  color: #6366f1;
}

/* Адаптація під мобільні */
@media (max-width: 768px) {
  .article-content {
    padding: 20px;
    font-size: 1.1rem;
    text-align: left; /* На мобільних justify іноді робить великі дірки між словами */
  }
}

/* ========================================================================== 
   MOBILE ADAPTIVE (Article) - ВИПРАВЛЕНО
   ========================================================================== */

@media (max-width: 768px) {
  .article-container {
    margin: 15px 10px; /* Менші відступи від країв екрану */
    padding: 16px;     /* Комфортний внутрішній відступ */
    border-radius: 16px;
    max-width: none;   /* Дозволяємо контейнеру бути на весь екран */
  }
  
  .article-header h1 { 
    font-size: 1.8rem !important; 
    padding: 0 5px;
  }

  .article-img { 
    width: 100%;       /* Фото займає всю доступну ширину */
    max-width: 100%;   /* Скасовуємо обмеження 500px для мобілок */
    max-height: none;  /* !!! ВИДАЛЕНО ОБМЕЖЕННЯ ВИСОТИ !!! */
    height: auto;      /* Повертаємо автоматичну пропорцію */
    margin-bottom: 15px; 
  }

  .article-content {
    padding: 20px;     /* Зменшуємо падінги тексту для мобільних */
    font-size: 1.1rem;
    text-align: left;
  }
}

@media (max-width: 480px) {
    .article-container {
        margin: 10px 5px;
        padding: 12px;
        border-radius: 12px;
    }
    
    .article-header h1 { 
        font-size: 1.5rem !important; 
    }

    .article-img { 
        max-height: none; /* Гарантуємо відсутність обмежень */
        border-radius: 12px; /* Трохи менший радіус для маленьких екранів */
    }

    .article-content {
        padding: 15px;
        font-size: 1.05rem;
    }
}

/* --------------------------------------------------------------------------
   Threaded comment styles (Telegram-style bubbles) for Article view
   ----------------------------------------------------------------------- */
:root {
  --c-bg: #f8fafc;
  --c-bubble: #ffffff;
  --c-bubble-alt: #eef2ff;
  --c-accent: #6366f1;
  --c-text: #1f2937;
  --c-muted: #6b7280;
}

.comments-block {
  margin-top: 22px;
  padding: 18px;
  background: transparent;
}

.comments-list { gap: 12px; }

.comment-bubble {
  display: block;
  width: 100%;
  max-width: 100%;
  background: linear-gradient(180deg, var(--c-bubble) 0%, var(--c-bubble) 100%);
  border-radius: 18px;
  padding: 12px 14px;
  box-shadow: 0 6px 18px rgba(16,24,40,0.06);
  border: 1px solid rgba(99,102,241,0.06);
}

.comment-bubble.is-reply {
  margin-left: 46px; /* visual offset for replies */
  /* Замінюємо яскравий синій градієнт на світло-сірий колір з маргіналій */
  background: #f1f5f9; 
  border: 1px solid #e2e8f0; /* Додаємо тонку рамку для чіткості меж */
}

.cb-header { display:flex; align-items:center; gap:10px; justify-content:space-between; margin-bottom:6px; }
.cb-name { color: var(--c-accent); font-weight:700; }
.cb-date { color: var(--c-muted); font-size: 12px; }
.cb-text { color: var(--c-text); line-height:1.45; white-space:pre-wrap; }
.cb-actions { margin-top:8px; display:flex; gap:8px; }
.cb-reply { background: transparent; border: none; color: var(--c-accent); cursor: pointer; font-weight:600; padding:6px 8px; border-radius:8px; }
.cb-reply:hover { background: rgba(99,102,241,0.08); }

.emoji-bar { display:flex; gap:8px; margin-bottom:8px; }
.emoji-btn {
  /* Замість синього ставимо сірий з маргіналій */
  background: #f1f5f9; 
  border: 1px solid #eef2ff; 
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.emoji-btn:hover {
  /* Ефект при наведенні як у маргіналіях */
  background: #e2e8f0; 
  transform: scale(1.08);
}

.no-comments { color: var(--c-muted); font-size:0.95rem; padding:6px 0; }

/* Make comment form stretch full article width */
.comment-form { width: 100%; }

@media (max-width: 768px) {
  .comment-bubble.is-reply { 
    margin-left: 8px; 
    /* Змінюємо градієнт на спокійний сірий колір маргіналій */
    background: #f1f5f9; 
    border: 1px solid #e2e8f0;
  }
}