/* Doc Theme WP - Main Styles */

/* Змінні */
:root {
    --primary-color: #2b5797;
    --primary-dark: #1a365d;
    --primary-light: #4b77b7;
    --secondary-color: #3fc1c9;
    --accent-color: #ff6b6b;
    --text-color: #333;
    --text-light: #666;
    --light-bg: #f8f8f8;
    --white: #ffffff;
    --gray-light: #eaeaea;
    --gray: #cccccc;
    --transition: all 0.3s ease;
    --container-width: 1400px;
    --content-width: 1020px;
    --sidebar-width: 340px;
    --shadow: 0 2px 5px rgba(0,0,0,0.1);
    --shadow-hover: 0 5px 15px rgba(0,0,0,0.1);
    --border-radius: 4px;
    --border-radius-lg: 8px;
}

/* Глобальні стилі для форм та полів вводу */
input, textarea, select, button {
    max-width: 100%;
    box-sizing: border-box;
}

/* Обмеження ширини для всіх форм на сайті */
form {
    max-width: 100%;
}

/* Видалення горизонтального скролу */
html, body {
    overflow-x: hidden;
}

/* Кнопки та посилання */
.btn,
.view-all-link,
.doctor-read-more,
.read-more {
    display: inline-block;
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: var(--white);
    border-radius: var(--border-radius);
    text-align: center;
    transition: all 0.3s ease;
    font-weight: 500;
    border: none;
    cursor: pointer;
}

.btn:hover,
.view-all-link:hover,
.doctor-read-more:hover,
.read-more:hover {
    background-color: var(--primary-dark);
    color: var(--white);
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background-color: var(--secondary-color);
}

.btn-secondary:hover {
    background-color: #2ea8b0;
}

.btn-accent {
    background-color: var(--accent-color);
}

.btn-accent:hover {
    background-color: #e64242;
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: var(--white);
}

.btn-sm {
    padding: 5px 15px;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 12px 30px;
    font-size: 1.125rem;
}

/* Стилі для головної сторінки */
.home-sections {
    margin-top: 3rem;
    margin-bottom: 3rem;
}

.home-section {
    margin-bottom: 3rem;
}

.featured-posts {
    padding: 2rem;
    background-color: var(--light-bg);
    border-radius: var(--border-radius-lg);
    border-left: 5px solid var(--primary-color);
    margin-bottom: 4rem;
}

.section-title {
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 10px;
}

.section-title:after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 80px;
    height: 3px;
    background-color: var(--primary-color);
}

.section-footer {
    margin-top: 1.5rem;
    text-align: center;
}

.view-all-link {
    margin-top: 1rem;
}

.posts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 576px) {
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 992px) {
    .posts-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .section-title {
        font-size: 2rem;
        margin-bottom: 2rem;
    }

    .section-title:after {
        width: 100px;
        height: 4px;
    }

    .home-section {
        margin-bottom: 5rem;
    }

    .view-all-link {
        margin-top: 2rem;
        padding: 12px 25px;
    }
}

/* Контейнеры */
.container {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 15px;
    box-sizing: border-box;
}

    .content-area {
        display: flex;
        flex-wrap: wrap;
        width: 100%;
    }

.site-content {
    width: 100%;
}

    .content-wrapper {
        width: 68%;
        padding-right: 30px;
        flex: 0 0 68%;
        max-width: 68%;
        order: 1;
    }

@media (min-width: 768px) {
    .site-content {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: flex-start; /* Важно для выравнивания сайдбара по верху */
    }

    .sidebar {
        width: 32%;
        flex: 0 0 32%;
        max-width: 32%;
        order: 2;
        position: sticky;
        top: 20px; /* Сделает сайдбар липким */
    }
}

@media (min-width: 992px) {
    .content-wrapper {
        width: calc(100% - var(--sidebar-width));
        flex: 0 0 calc(100% - var(--sidebar-width));
        max-width: calc(100% - var(--sidebar-width));
    }
    
    .sidebar {
        width: var(--sidebar-width);
        flex: 0 0 var(--sidebar-width);
        max-width: var(--sidebar-width);
    }
}

/* Header */
.site-header {
    background-color: var(--white);
    box-shadow: var(--shadow);
    padding: 1rem 0;
}

.header-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.site-branding {
    margin-bottom: 1rem;
    text-align: center;
}

.site-logo {
    max-width: 200px;
    height: auto;
}

.site-title {
    font-size: 1.8rem;
    margin: 0.5rem 0;
}

.site-description {
    font-size: 1rem;
    color: #666;
}

.main-navigation {
    width: 100%;
}

.menu-toggle {
    display: block;
    width: 100%;
    padding: 10px;
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    text-align: center;
    cursor: pointer;
    font-size: 1rem;
    border-radius: var(--border-radius);
}

.menu {
    display: none;
    width: 100%;
}

.menu.active {
    display: block;
}

.menu li {
    position: relative;
}

.menu a {
    display: block;
    padding: 10px 15px;
    color: var(--text-color);
    border-bottom: 1px solid var(--gray-light);
    transition: var(--transition);
}

.menu a:hover {
    background-color: var(--gray-light);
    text-decoration: none;
}

.menu .sub-menu {
    display: none;
    background-color: var(--white);
}

.menu .sub-menu.active {
    display: block;
}

.menu-item-has-children > a::after {
    content: " ▼";
    font-size: 0.8em;
}

@media (min-width: 768px) {
    .header-container {
        flex-direction: row;
        justify-content: space-between;
    }

    .site-branding {
        margin-bottom: 0;
        text-align: left;
    }

    .main-navigation {
        width: auto;
    }

    .menu-toggle {
        display: none;
    }

    .menu {
        display: flex;
    }

    .menu > li {
        position: relative;
    }

    .menu > li > a {
        border-bottom: none;
    }

    .menu .sub-menu {
        position: absolute;
        top: 100%;
        left: 0;
        width: 200px;
        box-shadow: var(--shadow);
    }

    .menu li:hover > .sub-menu {
        display: block;
    }
}

@media (min-width: 992px) {
    .site-header {
        padding: 1.5rem 0;
    }

    .site-logo {
        max-width: 240px;
    }

    .site-title {
        font-size: 2.2rem;
    }

    .site-description {
        font-size: 1.1rem;
    }

    .menu {
        margin-top: 0.5rem;
    }

    .menu > li > a {
        font-size: 1.1rem;
        padding: 10px 20px;
        transition: color 0.3s ease, background-color 0.3s ease;
    }

    .menu > li > a:hover {
        color: var(--primary-color);
        background-color: rgba(75, 119, 183, 0.1);
        border-radius: var(--border-radius);
    }

    .menu .sub-menu {
        width: 220px;
        border-radius: var(--border-radius);
        box-shadow: var(--shadow-hover);
        overflow: hidden;
    }

    .menu .sub-menu a {
        padding: 12px 20px;
        font-size: 1rem;
    }

    .menu .sub-menu a:hover {
        background-color: var(--primary-light);
        color: var(--white);
    }
}

/* Breadcrumbs */
.breadcrumbs {
    padding: 1rem 0;
    background-color: var(--light-bg);
    border-bottom: 1px solid var(--gray-light);
    font-size: 0.9rem;
}

.breadcrumbs a {
    color: var(--primary-color);
}

.breadcrumbs span {
    color: var(--text-color);
}

.breadcrumbs .delimiter {
    margin: 0 0.5rem;
    color: var(--gray);
}

/* Реклама - CLS-safe блоки */
.ad-container {
    width: 100%;
    margin: 2rem 0;
    text-align: center;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
    display: block;
}

/* Рекламні блоки для десктопа */
@media (min-width: 768px) {
    .ad-container-header {
        min-height: 90px; /* Для 728x90 */
        max-height: 90px;
        height: 90px;
    }

    .ad-container-sidebar {
        min-height: 250px; /* Для 300x250 */
        max-height: 250px;
        height: 250px;
    }

    .ad-container-content {
        min-height: 280px; /* Для 336x280 */
        max-height: 280px;
        height: 280px;
    }

    .ad-container-sidebar-bottom {
        min-height: 600px; /* Для 300x600 */
        max-height: 600px;
        height: 600px;
    }
}

/* Рекламні блоки для мобільних пристроїв */
@media (max-width: 767px) {
    .ad-container-header {
        min-height: 50px; /* Для мобільного банера */
        max-height: 100px;
        height: 50px;
    }

    .ad-container-sidebar {
        min-height: 250px; /* Для 300x250 */
        max-height: 250px;
        height: 250px;
    }

    .ad-container-content {
        min-height: 250px; /* Для 300x250 на мобільному */
        max-height: 250px;
        height: 250px;
    }

    .ad-container-sidebar-bottom {
        min-height: 250px; /* Для 300x250 на мобільному */
        max-height: 250px;
        height: 250px;
    }
}

/* Контейнер всередині рекламного блоку, щоб центрувати рекламу */
.ad-container-inner {
    position: relative;
    display: inline-block;
    width: 100%;
    height: 100%;
}

/* Sidebar */
.sidebar {
    width: 100%;
}

.widget {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: var(--white);
    box-shadow: var(--shadow);
    border-radius: var(--border-radius);
}

.widget-title {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
    font-size: 1.25rem;
}

/* Content */
.entry-header {
    margin-bottom: 1.5rem;
}

.entry-title {
    margin-bottom: 0.5rem;
}

.entry-meta {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1rem;
}

.entry-content {
    margin-bottom: 2rem;
}

.entry-content h1, .entry-content h2, .entry-content h3,
.entry-content h4, .entry-content h5, .entry-content h6 {
    margin-top: 2rem;
}

.entry-content ul, .entry-content ol {
    margin-left: 1.5rem;
    margin-bottom: 1.5rem;
}

.entry-content ul {
    list-style-type: disc;
}

.entry-content ol {
    list-style-type: decimal;
}

.entry-content li {
    margin-bottom: 0.5rem;
}

.entry-footer {
    padding-top: 1rem;
    border-top: 1px solid var(--gray-light);
    font-size: 0.9rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
}

.pagination .page-numbers {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 4px;
    border: 1px solid var(--gray);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.pagination .current {
    background-color: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.pagination a:hover {
    background-color: var(--gray-light);
    text-decoration: none;
}

/* Footer */
.site-footer {
    background-color: var(--primary-dark);
    color: var(--white);
    padding: 2rem 0;
}

.footer-widgets {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.footer-widget {
    width: 100%;
    margin-bottom: 1.5rem;
}

.footer-widget-title {
    margin-bottom: 1rem;
    color: var(--white);
    border-bottom: 1px solid rgba(255,255,255,0.2);
    padding-bottom: 0.5rem;
}

.footer-menu {
    margin-bottom: 1.5rem;
}

.footer-menu a {
    color: var(--white);
    opacity: 0.8;
}

.footer-menu a:hover {
    opacity: 1;
}

.footer-bottom {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.9rem;
}

.social-links {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.social-links a {
    display: inline-block;
    margin: 0 10px;
    color: var(--white);
    font-size: 1.2rem;
}

@media (min-width: 768px) {
    .footer-widget {
        width: 50%;
        padding-right: 30px;
    }
}

@media (min-width: 992px) {
    .footer-widget {
        width: 33.333%;
    }
}

/* Врачи (CPT styles) */
.doctor-card {
    display: flex;
    flex-direction: column;
    margin-bottom: 2rem;
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.doctor-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.doctor-content {
    padding: 1.5rem;
}

.doctor-title {
    margin-bottom: 0.5rem;
}

.doctor-specialty {
    font-size: 1rem;
    color: #666;
    margin-bottom: 1rem;
}

.doctor-excerpt {
    margin-bottom: 1rem;
}

.doctor-meta {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.doctor-meta-item {
    width: 100%;
    margin-bottom: 0.5rem;
}

.doctor-read-more {
    display: inline-block;
    padding: 8px 16px;
    background-color: var(--primary-color);
    color: var(--white);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.doctor-read-more:hover {
    background-color: var(--primary-dark);
    text-decoration: none;
}

@media (min-width: 768px) {
    .doctor-card {
        flex-direction: row;
    }

    .doctor-image {
        width: 200px;
        height: auto;
    }

    .doctor-meta-item {
        width: 50%;
    }
}

/* Врачи архив */
.doctors-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 576px) {
    .doctors-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 992px) {
    .doctors-grid {
        grid-template-columns: repeat(2, 1fr); /* Изменено с 3 на 2 */
    }
}

/* Страница врача */
.doctor-single {
    background-color: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.doctor-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
}

.doctor-avatar {
    width: 200px;
    height: 200px;
    object-fit: cover;
    border-radius: 50%;
    border: 5px solid var(--primary-light);
    margin-bottom: 1.5rem;
}

.doctor-header-content {
    text-align: center;
}

.doctor-single-title {
    margin-bottom: 0.5rem;
}

.doctor-single-specialty {
    font-size: 1.25rem;
    color: #666;
    margin-bottom: 1rem;
}

.doctor-details {
    margin-bottom: 2rem;
}

.doctor-attributes {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.doctor-attribute {
    padding: 1rem;
    background-color: var(--light-bg);
    border-radius: var(--border-radius);
}

.attribute-title {
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

@media (min-width: 768px) {
    .doctor-header {
        flex-direction: row;
        text-align: left;
    }

    .doctor-avatar {
        margin-right: 2rem;
        margin-bottom: 0;
    }

    .doctor-header-content {
        text-align: left;
    }

    .doctor-attributes {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Utility classes */
.text-center {
    text-align: center;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.mb-4 {
    margin-bottom: 2rem;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.mt-4 {
    margin-top: 2rem;
}

/* Стилі форми відгуків */
.comments-area {
    margin-top: 3rem;
    padding: 2rem;
    background-color: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    width: 100%;
    box-sizing: border-box;
    overflow: hidden; /* Запобігає виходу контенту за межі */
}

.comments-title,
.comment-reply-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-light);
    padding-bottom: 0.5rem;
}

.comment-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.comment-list li {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--gray-light);
}

.comment-list li:last-child {
    border-bottom: none;
}

.comment-author {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.comment-author .avatar {
    margin-right: 15px;
    border-radius: 50%;
}

.comment-author .fn {
    font-weight: 700;
    font-style: normal;
    color: var(--primary-dark);
}

.comment-metadata {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.comment-metadata a {
    color: var(--text-light);
}

.comment-content {
    margin-bottom: 1rem;
}

.comment-content p:last-child {
    margin-bottom: 0;
}

.reply {
    text-align: right;
}

.comment-reply-link {
    display: inline-block;
    padding: 5px 15px;
    font-size: 0.875rem;
    background-color: var(--primary-light);
    color: var(--white);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.comment-reply-link:hover {
    background-color: var(--primary-color);
    text-decoration: none;
    color: var(--white);
}

/* Форма коментаря */
.comment-respond {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--gray-light);
}

.comment-notes {
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    color: var(--text-light);
}

.comment-form {
    max-width: 100%;
}

.comment-form-field {
    margin-bottom: 1.5rem;
}

.comment-form-field label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.comment-form-field input,
.comment-form-field textarea {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--gray);
    border-radius: var(--border-radius);
    background-color: var(--white);
    font-size: 1rem;
    transition: var(--transition);
    max-width: 100%;
    box-sizing: border-box;
    overflow: auto;
}

.comment-form-field input:focus,
.comment-form-field textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(43, 87, 151, 0.1);
}

.required {
    color: var(--accent-color);
}

.form-submit {
    text-align: right;
}

.form-submit button {
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.form-submit button:hover {
    background-color: var(--primary-dark);
}

.submit-review {
    background-color: var(--accent-color);
}

.submit-review:hover {
    background-color: #e64242;
}

@media (min-width: 768px) {
    .comment-form {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .comment-form-author,
    .comment-form-email,
    .comment-form-url {
        width: calc(33.333% - 10px);
        margin-bottom: 1rem;
    }

    .comment-form-comment {
        width: 100%;
    }
}

/* Виправлення для форми коментарів на мобільних пристроях */
@media (max-width: 767px) {
    .comments-area {
        padding: 1rem;
    }

    .comment-form {
        margin: 0;
        padding: 0;
    }

    .comment-form-field {
        padding-right: 0;
        margin-bottom: 1rem;
    }

    .comment-form-field input,
    .comment-form-field textarea {
        padding: 8px 10px;
        font-size: 0.9rem;
    }

    .comment-form-comment textarea {
        width: 100%;
        max-width: 100%;
    }

    /* Виправлення для мобільних форм */
    input[type="text"],
    input[type="email"],
    input[type="url"],
    textarea {
        max-width: 100% !important;
        width: 100% !important;
        overflow-x: hidden;
    }

    .form-submit {
        text-align: center;
        margin-top: 1rem;
    }

    .form-submit button {
        width: 100%;
        padding: 12px 0;
    }
}

/* Десктопні стилі для карток лікарів */
@media (min-width: 992px) {
    .doctor-card {
        transition: transform 0.3s ease, box-shadow 0.3s ease;
    }

    .doctor-card:hover {
        transform: translateY(-5px);
        box-shadow: var(--shadow-hover);
    }

    .doctor-image {
        max-width: 250px;
    }

    .doctors-grid {
        gap: 2.5rem;
    }

    .doctor-single {
        padding: 2.5rem;
        border-radius: var(--border-radius-lg);
    }
}

/* Стилі для блогу на головній сторінці */
.featured-posts {
    padding: 2rem;
    background-color: var(--light-bg);
    border-radius: var(--border-radius-lg);
    border-left: 5px solid var(--primary-color);
    margin-bottom: 4rem;
}

@media (min-width: 992px) {
    .posts-grid {
        grid-template-columns: repeat(2, 1fr); /* Изменено с 3 и 4 на 2 */
        gap: 1.5rem;
    }

    .featured-posts {
        padding: 3rem;
        box-shadow: var(--shadow);
        margin-bottom: 5rem;
    }

    .featured-posts .post-item {
        background-color: var(--white);
        border-radius: var(--border-radius);
        box-shadow: var(--shadow);
        transition: transform 0.3s ease, box-shadow 0.3s ease;
        height: 100%;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .featured-posts .post-item:hover {
        transform: translateY(-5px);
        box-shadow: var(--shadow-hover);
    }

    .featured-posts .post-thumbnail {
        height: 180px;
        overflow: hidden;
    }

    .featured-posts .post-thumbnail img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform 0.3s ease;
    }

    .featured-posts .post-item:hover .post-thumbnail img {
        transform: scale(1.05);
    }

    .featured-posts .post-content {
        flex: 1;
        display: flex;
        flex-direction: column;
        padding: 1.5rem;
    }

    .featured-posts .entry-summary {
        flex: 1;
    }

    .featured-posts .entry-title {
        font-size: 1.2rem;
        line-height: 1.4;
        margin-bottom: 0.75rem;
    }

    .featured-posts .entry-meta {
        font-size: 0.85rem;
        margin-bottom: 0.75rem;
    }

    .featured-posts .section-title {
        font-size: 2.2rem;
    }
}

/* Запобігання CLS для зображень */
.post-thumbnail {
    display: block;
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* Співвідношення сторін 16:9 */
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.post-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Запобігання CLS для всіх вставлених зображень */
.entry-content img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Запобігання CLS для iframe (вбудовані відео) */
.entry-content iframe,
.entry-content embed,
.entry-content object {
    max-width: 100%;
    display: block;
    margin: 1.5rem auto;
}

/* Блок з аспектним співвідношенням для відео */
.video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
    max-width: 100%;
    margin: 1.5rem 0;
}

.video-container iframe,
.video-container object,
.video-container embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Улучшения для снижения CLS (Cumulative Layout Shift) */

/* Основной контейнер */
.site-content {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 50vh;
    width: 100%;
    box-sizing: border-box;
    transition: none !important; /* Отключаем анимации для предотвращения CLS */
}

@media (min-width: 768px) {
    .site-content {
        flex-direction: row;
        flex-wrap: nowrap; /* Предотвращаем перенос элементов */
    }
    
    /* Устанавливаем фиксированные размеры для сайдбара и контента */
    .content-wrapper {
        flex: 0 0 68%; /* Не растягивать, не сжимать, фиксированная ширина */
    }
    
    .sidebar {
        flex: 0 0 32%; /* Не растягивать, не сжимать, фиксированная ширина */
    }
}

@media (min-width: 992px) {
    .content-wrapper {
        flex: 0 0 calc(100% - var(--sidebar-width)); /* Фиксированная ширина */
    }
    
    .sidebar {
        flex: 0 0 var(--sidebar-width); /* Фиксированная ширина */
    }
}

/* Исправление для span с property="name" (CLS 0.043) */
span[property="name"] {
    display: inline-block;
    min-height: 1.2em;
    min-width: 100px;
    vertical-align: baseline;
    position: relative;
}

.schema-property {
    display: inline-block;
    min-height: 1.2em;
    min-width: 100px;
}

/* Если span находится в заголовке - другое поведение */
h1 span[property="name"],
h2 span[property="name"],
h3 span[property="name"] {
    display: inline;
    min-height: auto;
    min-width: auto;
}

/* Минимальная высота для заголовков с микроразметкой */
.entry-title,
.post-title,
.article-title {
    display: block;
    min-height: 1.5em;
    position: relative;
}

/* Предзагрузка для изображений с transition */
.post-thumbnail {
    position: relative;
    background-color: var(--light-bg);
}

.post-thumbnail.loading img {
    opacity: 0;
}

.post-thumbnail.loaded img {
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* Исправление для body при загрузке контента */
body.content-loaded .site-content {
    min-height: auto;
}

/* Улучшения для рекламных блоков */
.ad-container {
    contain: layout; /* Изолирует потоки для предотвращения CLS */
}

/* Стили для изображений с классом cls-image для предотвращения CLS */
img.cls-image {
    opacity: 0;
    transition: opacity 0.3s ease;
}

img.cls-image.loaded {
    opacity: 1;
}

span.author {
    display: inline-block;
    min-height: 1.2em;
    min-width: 80px;
    vertical-align: baseline;
    position: relative;
}

/* Если span.author находится в метаданных поста */
.entry-meta span.author {
    display: inline-block;
    min-width: 80px;
    margin-right: 5px;
}

/* Для предотвращения изменения высоты строки */
.entry-meta, 
.post-meta,
.meta-data {
    min-height: 1.5em;
    line-height: 1.5;
}

/* Добавьте в файл main.css */

/* Оптимизация миниатюр для улучшения LCP */
.post-thumbnail {
    overflow: hidden;
    position: relative;
    background-color: var(--light-bg); /* Фоновый цвет до загрузки изображения */
}

.post-thumbnail img {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 0.3s ease;
    will-change: transform; /* Подсказка браузеру */
    contain: content; /* Улучшение производительности рендеринга */
}

/* Предотвращение проблем с изображениями при загрузке */
.wp-post-image {
    backface-visibility: hidden; /* Предотвращает мерцание при трансформациях */
}

/* Эффект LQIP (Low Quality Image Placeholder) */
.post-thumbnail::before {
    content: "";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--light-bg);
    z-index: 0;
}

.post-thumbnail img {
    position: relative;
    z-index: 1;
}

/* Оптимизация для LCP заголовков */
.entry-title {
    contain: content; /* Улучшает производительность отрисовки */
    will-change: opacity; /* Подсказка браузеру о будущих изменениях */
}

/* Начальное состояние для предотвращения мерцания */
html:not(.page-loaded) .entry-title {
    opacity: 0.9; 
}

/* Состояние после загрузки */
html.page-loaded .entry-title {
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* Отключение анимаций во время загрузки */
html.no-animations * {
    animation-duration: 0.001ms !important;
    animation-delay: 0 !important;
    transition-duration: 0.001ms !important;
}

/* Исправление для контента на мобильных устройствах */
@media (max-width: 767px) {
    .site-content {
        flex-direction: column;
    }
    
    .content-wrapper {
        width: 100% !important;
        max-width: 100% !important;
        flex: 1 0 100% !important;
        padding-right: 0 !important;
    }
    
    .content-inner {
        width: 100%;
        max-width: 100%;
    }
    
    .sidebar {
        width: 100% !important;
        max-width: 100% !important;
        flex: 1 0 100% !important;
        margin-top: 2rem;
    }
    

    
    /* Исправление для всего содержимого */
    .entry-content img,
    .entry-content iframe,
    .entry-content video,
    .entry-content table {
        max-width: 100%;
        height: auto;
    }
}

/* Исправление для контейнера */
.container {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 15px;
    box-sizing: border-box;
}

/* Исправление для содержимого статьи */
.entry-content {
    width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Исправленная структура для содержимого и сайдбара */
.site-content .container {
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .site-content .container {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: flex-start;
    }
    
    .content-wrapper {
        width: 68%;
        flex: 0 0 68%;
        padding-right: 30px;
    }
    
    .sidebar {
        width: 32%;
        flex: 0 0 32%;
    }
}

@media (min-width: 992px) {
    .content-wrapper {
        width: calc(100% - var(--sidebar-width));
        flex: 0 0 calc(100% - var(--sidebar-width));
    }
    
    .sidebar {
        width: var(--sidebar-width);
        flex: 0 0 var(--sidebar-width);
    }
}

/* Обеспечение полной ширины на мобильных устройствах */
@media (max-width: 767px) {
    .content-wrapper,
    .sidebar {
        width: 100%;
        flex: 0 0 100%;
    }
    
    .sidebar {
        margin-top: 2rem;
    }
}

