/* Базові стилі для всіх екранів */
body {
    margin: 0;
    padding: 40px; /* Буде перевизначено для мобільних */
    background-color: #f4f4f4;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    color: #222;
    line-height: 1.7;
}

.container {
    max-width: 800px;
    margin: auto;
    background-color: #fff;
    padding: 40px; /* Буде перевизначено для мобільних */
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.05);
}

h1 {
    margin-top: 0;
    font-size: 2.4rem; /* Буде перевизначено для мобільних */
}

.article-text {
    margin-top: 30px;
    font-size: 1.05rem; /* Буде перевизначено для мобільних */
}

mark {
    background-color: #fff59d;
    padding: 0 4px;
    border-radius: 4px;
}

/* Стилі для зображень */
.img-container {
    width: 100%;
    /* Add a fixed height for the container to control image height on all screens */
    /* This creates a banner-like effect */
    height: 300px; /* Example height: adjust this value as needed for desktop */
    overflow: hidden; /* Ensures image content outside this height is clipped */
    display: flex; /* Use flexbox to center the image within the container */
    justify-content: center;
    align-items: center;
    margin-bottom: 20px; /* Add some space below the image */
}

.full-height-img {
    width: 100%;       /* Image fills the width of its container */
    height: 100%;      /* Image fills the height of its container */
    display: block;
    /* object-fit: cover will crop the image to fit the container's aspect ratio.
       object-fit: contain will ensure the entire image is visible, but might leave empty space.
       For a banner, 'cover' often looks better. */
    object-fit: cover; /* Use 'cover' to fill the container, potentially cropping */
    object-position: center; /* Center the image within the container */
}

/* Кнопка "Home" */
.home-button {
    position: fixed;
    bottom: 30px; /* Буде перевизначено для мобільних */
    right: 30px; /* Буде перевизначено для мобільних */
    padding: 12px 20px;
    background: #28a745;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-size: 1rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: background 0.3s ease, transform 0.2s ease;
}
.home-button:hover {
    background: #218838;
    transform: translateY(-2px);
}

/* Футер */
footer {
    margin-top: 80px; /* Буде перевизначено для мобільних */
    font-size: 0.85rem;
    color: #aaa;
    text-align: center;
}

/* --- СТИЛІ ДЛЯ СЕКЦІЙ КОМЕНТАРІВ І ФОРМИ (винесено з інлайнових стилів) --- */
.comment-section-wrapper {
    margin-top: 50px;
    background-color: #f8f8f8;
    padding: 30px; /* Буде перевизначено для мобільних */
    border-radius: 10px;
}

.comment-section-wrapper h2 {
    margin-top: 0;
}

.comment-form label {
    display: block;
    margin-top: 15px;
}

.comment-form input[type="text"],
.comment-form textarea {
    width: 50%; /* Буде перевизначено для мобільних */
    padding: 10px;
    margin-top: 5px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box; /* Важливо: padding не додає до загальної ширини */
}

.comment-form button[type="submit"] {
    display: block;
    margin-top: 20px;
    padding: 10px 20px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.recent-comments-section {
    background-color: #f0f0f0;
    padding: 30px; /* Буде перевизначено для мобільних */
    margin-top: 40px;
    border-radius: 8px;
}

.recent-comments-section h2 {
    margin-top: 0;
}

.recent-comments-section ul {
    list-style: none;
    padding-left: 0;
}

.recent-comments-section li {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #ddd;
}

.recent-comments-section li strong,
.recent-comments-section li p {
    margin: 0;
    margin-bottom: 6px;
}

/* Стилі для посилань "More to read" */
.container ul p a {
    color: #0057e7;
    text-decoration: none;
}

/* Стилі для кнопок поширення в соцмережах */
.share-links-container {
    margin-top: 30px;
    display: flex; /* Використовуємо Flexbox для кращого контролю */
    flex-wrap: wrap; /* Дозволяє елементам переноситися на новий рядок */
    gap: 15px; /* Проміжок між елементами */
    justify-content: center; /* Центруємо елементи */
}

.share-links-container img {
    width: 40px; /* Зменшуємо розмір іконок для мобільних */
    height: 40px;
    transition: transform 0.2s ease;
}

.share-links-container img:hover {
    transform: translateY(-2px);
}

/* --- МЕДІА-ЗАПИТИ ДЛЯ АДАПТИВНОСТІ --- */

/* Стилі для екранів шириною 768px і менше (планшети та мобільні) */
@media (max-width: 768px) {
    body {
        padding: 20px; /* Зменшуємо загальний padding для тіла */
    }

    .container {
        padding: 20px; /* Зменшуємо padding контейнера */
    }
    .img-container {
         height: 200px; /* Smaller height for tablets and larger phones */
     }

    h1 {
        font-size: 2rem; /* Трохи зменшуємо розмір заголовка */
    }

    .article-text {
        font-size: 1rem; /* Трохи зменшуємо розмір основного тексту */
    }

    /* Адаптація полів форми */
    .comment-form input[type="text"],
    .comment-form textarea {
        width: 100%; /* Робіть поля на всю ширину на мобільних */
    }

    /* Адаптація секцій коментарів */
    .comment-section-wrapper,
    .recent-comments-section {
        padding: 20px;
    }

    .home-button {
        bottom: 20px;
        right: 20px;
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    footer {
        margin-top: 40px; /* Зменшуємо відступ футера */
    }
}

/* Стилі для екранів шириною 480px і менше (більшість смартфонів) */
@media (max-width: 480px) {
    body {
        padding: 15px; /* Ще більше зменшуємо padding */
    }

    .container {
        padding: 15px; /* Ще більше зменшуємо padding контейнера */
        border-radius: 5px; /* Трохи менший радіус для компактності */
    }
    .img-container {
        height: 150px; /* Even smaller height for most smartphones */
    }
    /* You might want to remove the bottom margin on the image for tiny screens
       if space is extremely limited */
    .img-container {
        margin-bottom: 15px;
    }
    h1 {
        font-size: 1.8rem; /* Зменшуємо розмір заголовка для малих екранів */
    }

    .article-text {
        font-size: 0.95rem; /* Зменшуємо розмір основного тексту */
    }

    .share-links-container img {
        width: 35px; /* Ще менші іконки на дуже малих екранах */
        height: 35px;
    }

    .home-button {
        padding: 8px 14px;
        font-size: 0.85rem;
        bottom: 15px;
        right: 15px;
    }
}