/* ===== Общая адаптация ===== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

/* Слайдер шапки: до инициализации bxSlider показываем только первый слайд */
.mainslider > ul.bxslider {
    margin: 0;
    padding: 0;
    list-style: none;
    overflow: hidden;
}

.mainslider > ul.bxslider > li {
    display: none;
    margin: 0;
    padding: 0;
}

.mainslider > ul.bxslider > li:first-child {
    display: block;
}

.mainslider > ul.bxslider > li img {
    display: block;
    width: 100%;
    height: auto;
    vertical-align: top;
}

/* Картинки */
.entry-content img,
.container img {
    max-width: 100%;
    height: auto;
}

/* Текст не должен вылезать за экран */
.entry-content,
.entry-content p,
.entry-content li,
.entry-content span,
.entry-content a,
.container p,
.container li,
.container span,
.container a {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-wrap: break-word;
    word-break: break-word;
}

/* Заголовки */
.component-02-title,
.festivals-item-right-title {
    max-width: 100%;
    overflow-wrap: break-word;
}

/* Списки */
.entry-content ul,
.entry-content ol {
    max-width: 100%;
}

/* Телефоны — без клика (tel: и старые wa.me на номерах) */
a[href^="tel:"],
a.link-phone[href*="wa.me"] {
    pointer-events: none;
    cursor: default;
    text-decoration: none;
    color: inherit;
}

/* Согласия в форме и ссылки в футере */
.bottom-form .input-button {
    margin-bottom: 40px;
}

.form-consents {
    max-width: 760px;
    margin: 18px auto 10px;
    text-align: left;
    color: #fff;
}

.form-consent-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 0 12px;
    font-size: 14px;
    line-height: 1.45;
    cursor: pointer;
}

.form-consent-item input[type="checkbox"] {
    flex: 0 0 auto;
    margin-top: 3px;
    width: 16px;
    height: 16px;
}

.form-consent-item a {
    color: #fff;
    text-decoration: underline;
}

.form-consent-item a:hover {
    opacity: 0.85;
}

.site-legal-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 18px;
    max-width: 960px;
    margin: 0 auto 28px;
    padding: 0 15px 20px;
    text-align: center;
}

.site-legal-links a {
    color: #503e8e;
    font-size: 13px;
    line-height: 1.4;
    text-decoration: underline;
}

.site-legal-links a:hover {
    opacity: 0.8;
}

@media (max-width: 768px) {
    .form-consents {
        padding: 0 15px;
        margin-top: 14px;
    }

    .form-consent-item {
        font-size: 13px;
    }

    .site-legal-links {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
}

/* Видео / iframe (VK, YouTube и т.п.) */
.entry-content iframe,
.entry-content embed,
.entry-content object,
.entry-content video,
.flex-container-video iframe,
.responsive-iframe iframe {
    max-width: 100% !important;
}

.entry-content center {
    max-width: 100%;
    display: block;
}

/* ===== Телефон ===== */

@media (max-width: 768px) {

    .entry-content {
        width: 100%;
        max-width: 100%;
        padding-left: 15px;
        padding-right: 15px;
    }

    .component-02-title {
        font-size: 25px;
        line-height: 1.25;
        margin-top: 20px;
        margin-bottom: 20px;
    }

    .festivals-item-right-title {
        font-size: 20px;
        line-height: 1.3;
        margin-top: 25px;
        margin-bottom: 12px;
    }

    .entry-content p,
    .entry-content li,
    .entry-content span {
        font-size: 15px !important;
        line-height: 1.55;
    }

    .entry-content ul,
    .entry-content ol {
        padding-left: 22px;
        margin-left: 0;
    }

    .entry-content li {
        margin-bottom: 7px;
    }

    .entry-content hr {
        margin: 25px 0;
    }

    /* Кнопки */
    .fest-header-button {
        display: block;
        width: 100%;
        max-width: 100%;
        text-align: center;
        padding: 13px 15px;
        margin: 10px 0;
        line-height: 1.3;
    }

    /* Одиночные и сетка видео */
    .entry-content iframe,
    .entry-content embed,
    .entry-content object,
    .entry-content video,
    .flex-container-video iframe {
        display: block;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        aspect-ratio: 16 / 9;
        margin-left: auto;
        margin-right: auto;
    }

    .flex-container-video {
        display: flex;
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
        gap: 12px;
    }

    .flex-container-video iframe {
        padding: 0 !important;
    }

    .responsive-iframe {
        width: 100% !important;
        max-width: 100%;
        padding-bottom: 56.25%;
    }

}

/* Таблицы программы — отдельный breakpoint пошире (телефоны/планшеты) */
@media (max-width: 1100px) {
    .entry-content,
    .container {
        overflow-x: visible;
        max-width: 100%;
    }

    table.wp-block-table,
    table.wp-block-table.alignleft,
    table.wp-block-table.alignright,
    table.wp-block-table.aligncenter,
    .entry-content table,
    .container table,
    figure.wp-block-table {
        float: none !important;
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        height: auto !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        overflow: visible !important;
        table-layout: fixed !important;
    }

    table.wp-block-table colgroup,
    table.wp-block-table col,
    .entry-content table colgroup,
    .entry-content table col,
    .container table colgroup,
    .container table col {
        display: none !important;
    }

    table.wp-block-table tbody,
    table.wp-block-table thead,
    table.wp-block-table tfoot,
    .entry-content table tbody,
    .entry-content table thead,
    .entry-content table tfoot,
    .container table tbody,
    .container table thead,
    .container table tfoot {
        display: block !important;
        width: 100% !important;
    }

    table.wp-block-table tr,
    .entry-content table tr,
    .container table tr,
    table.wp-block-table tr[style],
    .entry-content table tr[style],
    .container table tr[style] {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        margin-bottom: 18px;
        padding-bottom: 12px;
        border-bottom: 1px solid #e5e5e5;
    }

    table.wp-block-table td,
    table.wp-block-table th,
    .entry-content table td,
    .entry-content table th,
    .container table td,
    .container table th,
    table.wp-block-table td[style],
    table.wp-block-table th[style],
    .entry-content table td[style],
    .entry-content table th[style],
    .container table td[style],
    .container table th[style] {
        display: block !important;
        float: none !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        height: auto !important;
        padding: 6px 0 !important;
        box-sizing: border-box !important;
        white-space: normal !important;
        overflow-wrap: anywhere !important;
        word-break: break-word !important;
    }

    table.wp-block-table td *,
    table.wp-block-table th *,
    .entry-content table td *,
    .container table td * {
        max-width: 100% !important;
        white-space: normal !important;
        overflow-wrap: anywhere !important;
        word-break: break-word !important;
        box-sizing: border-box !important;
    }

    table.wp-block-table td:first-child,
    table.wp-block-table th:first-child,
    .entry-content table td:first-child,
    .container table td:first-child {
        margin-bottom: 4px;
        font-weight: 700;
    }

    /*
     * Страницы вроде /festivals/spb-pol/ содержат мусорную многоуровневую
     * вложенность ul (article_decoration_*). На мобиле отступы суммируются
     * и текст уезжает за край — оставляем отступ только у верхнего списка.
     */
    .entry-content ul,
    .entry-content ol,
    .container .entry-content ul,
    .container .entry-content ol {
        padding-left: 18px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .entry-content ul ul,
    .entry-content ol ol,
    .entry-content ul ol,
    .entry-content ol ul,
    .container .entry-content ul ul,
    .container .entry-content ol ol,
    .container .entry-content ul ol,
    .container .entry-content ol ul {
        padding-left: 0 !important;
        margin-left: 0 !important;
        padding-right: 0 !important;
    }

    .entry-content li,
    .container .entry-content li {
        margin-left: 0 !important;
        padding-left: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow-wrap: anywhere !important;
        word-break: break-word !important;
    }

    .entry-content li > ul,
    .entry-content li > ol {
        width: 100% !important;
    }
}
