/**
 * Layout polish — final cascade layer (after ap-layout-overrides.css).
 * Resolves mobile/desktop UX conflicts without editing legacy responsive.css blocks.
 */

/* ── Mobile & tablet (≤991.98px) ─────────────────────────────────────────── */
@media (max-width: 991.98px) {
    /* Retire legacy dropdown menu positioning from responsive.css */
    .header .navbar-collapse {
        position: fixed !important;
        top: var(--ap-header-height, 88px) !important;
        right: 0 !important;
        left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    /* Homepage hero — symmetric edges, justified body copy */
    body.home .banner-con .banner_content--static .content,
    body.home .banner-con .banner_content .content {
        padding-left: 0 !important;
        padding-right: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        display: flex !important;
        flex-direction: column;
    }

    /* Phone: form + urgent, then photo, then H1/text */
    body.home .banner-con #ap-hero-consultation-form-wrap {
        order: 1;
    }
    body.home .banner-con .ap-hero-actions {
        order: 2;
    }
    body.home .banner-con .ap-hero-photo-mobile {
        order: 3;
    }
    body.home .banner-con .ap-home-hero-content {
        order: 4;
        margin-top: 24px;
    }
    body.home .banner-con .ap-hero-consultation-form {
        margin-top: 0 !important;
    }

    body.home .banner-con .banner-hero-title,
    body.home .banner-con .ap-home-hero-content h1 {
        text-align: left;
        width: 100%;
        padding-left: 0;
        padding-right: 0;
    }

    body.home .banner-con .banner-hero-text,
    body.home .banner-con .ap-home-hero-content p {
        text-align: justify;
        text-justify: inter-word;
        hyphens: auto;
        width: 100%;
        padding-left: 0;
        padding-right: 0;
    }

    body.home .ap-header-shell {
        padding-left: max(16px, env(safe-area-inset-left, 0px));
        padding-right: max(16px, env(safe-area-inset-right, 0px));
    }

    .ap-loc-detail-hero .ap-mv-hero__photo {
        max-width: 50% !important;
        width: 50% !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* Photos — full frame, no cropping on phones/tablets */
    .ap-hero-photo img,
    .banner-image1 img,
    .banner_wrapper--static img,
    .aboutpage-con .about-image img,
    .ap-about-hero .about-image img,
    .ap-mv-hero__photo img,
    .ap-feedback__photo img,
    .ap-awards-con .about-image img,
    .team-con .team-image img,
    .article-con .article-image img,
    .blogpage-section .blog-image img,
    .singleblog-section .blog-image img {
        object-fit: contain !important;
        object-position: center center;
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
    }

    .aboutpage-con .about_wrapper,
    .aboutpage-con .about-image,
    .ap-hero-photo-mobile,
    .banner_wrapper--static,
    .ap-mv-hero__photo,
    .ap-feedback__photo {
        overflow: visible !important;
    }

    .ap-about-hero .ap-about-hero__photo {
        display: inline-block !important;
        position: relative !important;
        max-width: 100% !important;
        overflow: visible !important;
    }
    .ap-about-hero .ap-about-stat {
        position: absolute !important;
        right: -28px !important;
        left: auto !important;
        bottom: 56px !important;
        top: auto !important;
        z-index: 3 !important;
        width: min(220px, 70%) !important;
    }
    .ap-about-hero .ap-about-stat .about-box {
        position: relative !important;
        right: auto !important;
        left: auto !important;
        bottom: auto !important;
        top: auto !important;
    }
    @media (max-width: 991px) {
        .ap-about-hero .ap-about-stat {
            right: -12px !important;
            bottom: 40px !important;
        }
    }
    @media (max-width: 575px) {
        .ap-about-hero .ap-about-stat {
            right: 6px !important;
            bottom: 28px !important;
        }
    }

    /* Stacked feedback photo (≤991): never clip before «Наші нагороди» */
    body.home .ap-feedback {
        overflow: visible !important;
        min-height: 0 !important;
        --ap-feedback-h: auto !important;
    }

    body.home .ap-feedback__media,
    body.home .ap-feedback__photo {
        height: auto !important;
        max-height: none !important;
        min-height: 0 !important;
        overflow: visible !important;
    }

    body.home .ap-feedback__photo img,
    body.home .ap-feedback__photo-img {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: none !important;
        object-fit: contain !important;
        object-position: top center !important;
        margin-left: 0 !important;
    }

    body.home .ap-won-cases-con .case-box,
    body.home .ap-won-cases-con .ap-won-cases-cards__box,
    body.home .ap-won-cases-con .case-box figure {
        overflow: hidden !important;
        border-radius: 20px;
        max-width: 100%;
    }

    .aboutpage-con .about_content ul {
        width: 100% !important;
        max-width: 100% !important;
    }

    .aboutpage-con .about_content {
        padding-left: 0 !important;
        padding-right: 0 !important;
        text-align: left;
    }

    .entry-content,
    .ap-text-output,
    .text-size-16 {
        overflow-wrap: anywhere;
        word-wrap: break-word;
    }

    .ap-breadcrumb-bar .ap-breadcrumb-list {
        flex-wrap: wrap;
    }

    .case-con:not(.ap-won-cases-con) .case-box figure,
    .ap-cases-listing__card {
        overflow: visible;
    }

    .case-con:not(.ap-won-cases-con) .case-box figure img {
        object-fit: contain !important;
        height: auto !important;
    }

    /* Only one phone control inside the burger overlay */
    .navbar-collapse .ap-header-phone-desktop.header-consult-btn {
        display: none !important;
    }

    /* Consultation photo — full usable width above «Замовити дзвінок» */
    .consultation-con .ap-consultation-photo {
        padding: 12px 0 0 !important;
    }

    .consultation-con .ap-consultation-photo .consultation-image,
    .consultation-con .consultation-image {
        width: 100% !important;
        max-width: 100% !important;
        left: auto !important;
        text-align: center;
    }

    .consultation-con .ap-consultation-photo .consultation-image img,
    .consultation-con .consultation-image img {
        display: block;
        width: 100% !important;
        max-width: min(560px, 100%) !important;
        max-height: none !important;
        height: auto !important;
        margin: 0 auto;
        object-fit: contain !important;
    }

    .consultation-con .consultation_content {
        padding-left: 4px !important;
        padding-right: 4px !important;
    }

    /* Contacts + inner pages — keep copy off the screen edge */
    .ap-contact-page .container,
    .ap-contact-top .container {
        padding-left: 24px !important;
        padding-right: 24px !important;
    }

    .ap-contact-page .ap-contact-top-info {
        padding-left: 0 !important;
        padding-right: 0 !important;
        padding-bottom: 24px !important;
    }

    .ap-breadcrumb-bar .ap-page-shell,
    .ap-breadcrumb-bar .container {
        padding-left: 24px !important;
        padding-right: 24px !important;
    }

    .ap-contact-detail-item {
        gap: 14px;
    }

    .ap-contact-detail-icon {
        flex: 0 0 44px;
        width: 44px;
        height: 44px;
    }

    .ap-contact-details h1.ap-contact-detail-label,
    .ap-contact-detail-label {
        font-size: 26px;
    }

    .ap-contact-detail-value,
    .ap-contact-detail-value p,
    .ap-contact-detail-value a {
        font-size: 16px;
        font-weight: 400;
        line-height: 1.6;
    }

    /* Generic readable gutters on leftover Bootstrap containers */
    .aboutpage-con .container,
    .faq-con .container,
    .practice-con .container,
    .violence-con .container,
    .seo.aboutpage-con .container,
    .case-con .container,
    .ap-team-con .container,
    .article-con .container,
    .blogpage-section .container,
    .singleblog-section .container,
    .ap-mv-hero .container,
    .ap-svc-detail-content .container {
        padding-left: 20px;
        padding-right: 20px;
    }
}

/* ── Desktop (≥992px) ─────────────────────────────────────────────────────── */
@media (min-width: 992px) {
    .ap-about-hero .ap-about-hero__photo {
        display: inline-block !important;
        position: relative !important;
        max-width: 100% !important;
        overflow: visible !important;
    }
    .ap-about-hero .ap-about-stat {
        position: absolute !important;
        right: -28px !important;
        left: auto !important;
        bottom: 56px !important;
        top: auto !important;
        z-index: 3 !important;
        width: min(220px, 70%) !important;
    }
    .ap-about-hero .ap-about-stat .about-box {
        position: relative !important;
        right: auto !important;
        left: auto !important;
        bottom: auto !important;
        top: auto !important;
    }

    body.ap-mv-payments-page .ap-mv-hero__photo,
    .ap-svc-detail-hero:not(.ap-loc-detail-hero) .ap-mv-hero__photo {
        max-width: 360px !important;
        width: 100%;
    }
    .ap-loc-detail-hero .ap-mv-hero__photo {
        max-width: 50% !important;
        width: 50%;
        margin-left: auto;
        margin-right: 0;
    }
    .ap-loc-detail-hero .ap-mv-hero__photo img {
        width: 100% !important;
        height: auto !important;
        object-fit: contain !important;
        object-position: center !important;
        max-height: none !important;
    }

    .ap-svc-detail-hero .row,
    .ap-loc-detail-hero .row,
    .ap-mv-hero .row.align-items-center,
    .ap-mv-hero .row.align-items-start {
        align-items: flex-start !important;
    }

    body.ap-service-route .aboutpage-con > .ap-page-shell > .row,
    body.ap-service-route .aboutpage-con > .container > .row {
        align-items: flex-start !important;
    }

    body.ap-service-route .aboutpage-con .about_wrapper {
        padding-top: 38px;
    }

    body.ap-service-route .aboutpage-con .about_content {
        padding-top: 38px !important;
    }

    .aboutpage-con .about_wrapper .about-image img,
    .ap-about-hero .about-image img {
        width: 360px !important;
        max-width: 100% !important;
        height: auto !important;
    }

    body.ap-mv-payments-page .ap-mv-about .about_wrapper {
        max-width: 36% !important;
    }

    .banner-con .banner_content--static .content {
        max-width: 100%;
    }

    body.home .banner-con .banner-hero-text,
    body.home .banner-con .ap-home-hero-content p {
        text-align: left;
        max-width: 52em;
    }

    .aboutpage-con .about_content,
    .faq-con .left_column,
    .ap-text-output.entry-content {
        max-width: 100%;
    }

    .header .navbar-collapse {
        position: static !important;
    }
}

/* Homepage CTA «У Вас є питання…» — black copy on phone and desktop */
.home section.violence-con:not(.practice-con):not(.ap-services-page-cta) {
    background-color: #f4f1ea;
}

.home section.violence-con:not(.practice-con):not(.ap-services-page-cta)::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.62) 52%, rgba(255, 255, 255, 0.2) 100%);
    z-index: 0;
    pointer-events: none;
}

.home section.violence-con:not(.practice-con):not(.ap-services-page-cta) > .container {
    position: relative;
    z-index: 1;
}

.home section.violence-con:not(.practice-con):not(.ap-services-page-cta) .violence_content,
.home section.violence-con:not(.practice-con):not(.ap-services-page-cta) .violence_content h1,
.home section.violence-con:not(.practice-con):not(.ap-services-page-cta) .violence_content h2,
.home section.violence-con:not(.practice-con):not(.ap-services-page-cta) .violence_content h3,
.home section.violence-con:not(.practice-con):not(.ap-services-page-cta) .violence_content p,
.home section.violence-con:not(.practice-con):not(.ap-services-page-cta) .violence_content .text-white {
    color: #1a1a1a !important;
}

.home section.violence-con:not(.practice-con):not(.ap-services-page-cta) .violence_content a.appointment {
    color: #ffffff !important;
}

.home section.violence-con:not(.practice-con):not(.ap-services-page-cta) .violence_content a.appointment:hover {
    color: var(--e-global-color-primary, #282828) !important;
}

@media (max-width: 991.98px) {
    .home section.violence-con:not(.practice-con):not(.ap-services-page-cta)::before {
        background: rgba(255, 255, 255, 0.88);
    }

    .home section.violence-con:not(.practice-con):not(.ap-services-page-cta) .violence_wrapper {
        padding: 0 8px;
        text-align: left;
    }
}

@media (max-width: 575.98px) {
    .ap-contact-page .container,
    .ap-contact-top .container,
    .ap-breadcrumb-bar .ap-page-shell,
    .ap-breadcrumb-bar .container {
        padding-left: 28px !important;
        padding-right: 28px !important;
    }

    .consultation-con .ap-consultation-photo .consultation-image img,
    .consultation-con .consultation-image img {
        max-width: 100% !important;
    }

    .ap-hero-photo-mobile {
        max-width: min(320px, 92%) !important;
    }
}

/* Form errors sit in document flow between fields and submit — never cover the button */
.ap-form-result,
.ap-contact-form-result,
#form_result,
#ap-hero-consultation-result,
#ap-footer-phone-result,
#ap-consultation-result,
#ap-urgent-visit-result,
.ap-blog-article-cta__result,
.ap-mv-cta__result,
.consultation-con .consultation_content .form-error,
.ap-form-result .form-error,
.ap-contact-form-result .form-error,
#form_result .form-error,
#ap-hero-consultation-result .form-error,
#ap-footer-phone-result .form-error,
#ap-consultation-result .form-error,
#ap-urgent-visit-result .form-error,
.ap-inline-phone-form .form-error {
    position: relative !important;
    float: none !important;
    clear: both;
    width: 100%;
    max-width: 100%;
    inset: auto !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    z-index: 1;
}

.ap-form-result:empty,
.ap-contact-form-result:empty,
#form_result:empty,
#ap-hero-consultation-result:empty,
#ap-footer-phone-result:empty,
#ap-consultation-result:empty,
#ap-urgent-visit-result:empty,
.ap-blog-article-cta__result:empty,
.ap-mv-cta__result:empty {
    display: none !important;
    margin: 0 !important;
    min-height: 0;
}

.ap-form-result:not(:empty),
.ap-contact-form-result:not(:empty),
#form_result:not(:empty),
#ap-hero-consultation-result:not(:empty),
#ap-footer-phone-result:not(:empty),
#ap-consultation-result:not(:empty),
#ap-urgent-visit-result:not(:empty),
.ap-blog-article-cta__result:not(:empty),
.ap-mv-cta__result:not(:empty) {
    display: block !important;
    width: 100%;
    max-width: 280px;
    margin: 10px 0 0;
    box-sizing: border-box;
}

.form-error.alert,
.form-error.alert-danger,
.consultation-con .consultation_content .form-error.alert,
#form_result .form-error.alert,
.ap-form-result .form-error.alert {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    max-width: 280px !important;
    box-sizing: border-box;
    color: #721c24 !important;
    background: #f8d7da !important;
    border: 1px solid #f5c6cb !important;
    margin: 0;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
    white-space: normal;
    overflow-wrap: anywhere;
    word-wrap: break-word;
}

.consultation-con .consultation_content form.callback,
.consultation-con .consultation_content form.ap-contact-form {
    display: flow-root;
}

.consultation-con .consultation_content form.callback #form_result,
.consultation-con .consultation_content form.ap-contact-form #form_result,
.ap-contact-form-block #form_result {
    clear: both !important;
    float: none !important;
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 8px 0 16px !important;
    position: relative !important;
    z-index: 1;
}

.consultation-con .consultation_content .appointment,
.ap-hero-consultation-submit,
.ap-footer-phone-form .ap-consultation-submit,
.ap-inline-phone-form .ap-consultation-submit,
.ap-consultation-form .ap-consultation-submit {
    position: relative;
    z-index: 2;
    clear: both;
}

/* Homepage / contacts form: black pills always, not only on hover */
.consultation-con .consultation_content .appointment,
.consultation-con .consultation_content .appointment:hover,
.consultation-con .consultation_content .appointment:focus,
.consultation-con .consultation_content .appointment:focus-visible,
.consultation-con .consultation_content .appointment:active,
.consultation-con .consultation_content .ap-consultation-call-btn,
.consultation-con .consultation_content .ap-consultation-call-btn:hover,
.consultation-con .consultation_content .ap-consultation-call-btn:focus,
.consultation-con .consultation_content .ap-consultation-call-btn:focus-visible,
.consultation-con .consultation_content .ap-consultation-call-btn:active {
    color: #ffffff;
    background: #202226;
}

#ap-footer-phone-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
}

#ap-footer-phone-form .form-group {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 350px;
    max-width: 100%;
    margin: 0;
    gap: 8px;
}

#ap-footer-phone-form .form-group input {
    width: 100%;
    max-width: 100%;
    margin-right: 0;
}

#ap-footer-phone-result:not(:empty) {
    flex: none;
    width: 100%;
    max-width: 280px;
    margin: 0;
}

.ap-hero-consultation-form .ap-form-result:not(:empty),
.ap-consultation-form .ap-form-result:not(:empty),
.ap-inline-phone-form .ap-form-result:not(:empty),
.consultation-con #form_result:not(:empty),
.ap-blog-article-cta__form-wrap .ap-form-result:not(:empty) {
    width: 100%;
    max-width: 280px;
    margin: 10px 0 16px;
}

/* Header: readable nav size, all items visible, no overlap */
@media (min-width: 992px) {
    :root {
        --ap-header-height: 128px;
    }

    .header,
    .site-header,
    .ap-header-shell,
    .header .navbar,
    .header .navbar-collapse,
    .header .ap-mobile-menu-inner,
    .header .navbar-nav {
        overflow: visible !important;
        height: auto !important;
        max-height: none !important;
    }

    .header,
    .site-header {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .header .navbar-brand {
        margin-left: 0 !important;
        margin-right: 0 !important;
        flex: 0 0 auto;
    }

    .header .navbar-brand img,
    .header .navbar-brand .ap-header-logo {
        max-width: 150px !important;
    }

    .header .navbar,
    .header .navbar-collapse {
        min-width: 0;
        max-width: 100%;
    }

    .header .ap-mobile-menu-inner {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        column-gap: 24px;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        justify-content: stretch;
    }

    .header .ap-mobile-menu-inner > .ap-mobile-menu-close,
    .header .ap-mobile-menu-inner > .mega-mobile-stack,
    .header .ap-mobile-menu-inner > .ap-mobile-phone-btn {
        display: none !important;
    }

    .header .ap-mobile-menu-inner > .navbar-nav {
        grid-column: 1;
        min-width: 0;
    }

    .header .navbar-collapse .ap-mobile-menu-inner > .navbar-nav,
    .header .navbar-nav {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center;
        justify-content: flex-start;
        gap: 8px 22px !important;
        min-width: 0;
        max-width: 100%;
        flex: 1 1 auto;
        row-gap: 8px !important;
    }

    .header .navbar-nav > .nav-item {
        flex: 0 0 auto !important;
        flex-shrink: 0 !important;
        min-width: auto !important;
        max-width: none;
        overflow: visible;
    }

    .header .navbar-nav .nav-link,
    .header .navbar-nav .nav-mega-trigger {
        white-space: nowrap;
        overflow: visible;
        text-overflow: clip;
        max-width: none;
        font-size: 15px !important;
        line-height: 1.25 !important;
        padding: 0 8px !important;
        pointer-events: auto !important;
    }

    .ap-header-actions,
    .ap-header-phone-desktop.header-consult-btn {
        position: static !important;
    }

    .ap-header-actions {
        grid-column: 2;
        margin-left: 0 !important;
        flex-shrink: 0 !important;
        justify-self: end;
        align-self: center;
        gap: 14px;
    }

    .ap-header-phone-desktop.header-consult-btn {
        flex-shrink: 0 !important;
        white-space: nowrap;
        position: static !important;
        padding: 10px 16px !important;
        font-size: 14px !important;
    }
}

@media (min-width: 992px) and (max-width: 1199px) {
    .header .ap-mobile-menu-inner {
        column-gap: 16px;
    }

    .header .navbar-nav {
        gap: 8px 16px !important;
    }

    .header .navbar-nav .nav-link,
    .header .navbar-nav .nav-mega-trigger {
        padding: 0 6px !important;
    }

    .ap-header-actions {
        gap: 12px;
    }
}

@media (min-width: 1200px) {
    .header .navbar-collapse .ap-mobile-menu-inner > .navbar-nav,
    .header .navbar-nav {
        flex-wrap: nowrap !important;
    }

    .header .navbar-brand img,
    .header .navbar-brand .ap-header-logo {
        max-width: 176px !important;
    }

    .header .ap-mobile-menu-inner {
        column-gap: 28px;
    }

    .header .navbar-nav {
        gap: 8px 26px !important;
    }

    .header .navbar-nav .nav-link,
    .header .navbar-nav .nav-mega-trigger {
        font-size: 16px !important;
        padding: 0 10px !important;
    }

    .ap-header-actions {
        gap: 16px;
    }

    .ap-header-phone-desktop.header-consult-btn {
        padding: 11px 18px !important;
        font-size: 15px !important;
    }
}

@media (min-width: 1360px) {
    .header .navbar-brand img,
    .header .navbar-brand .ap-header-logo {
        max-width: 196px !important;
    }

    .header .navbar-nav {
        gap: 8px 28px !important;
    }

    .header .navbar-nav .nav-link,
    .header .navbar-nav .nav-mega-trigger {
        font-size: 16.5px !important;
        padding: 0 10px !important;
    }

    .ap-header-actions {
        gap: 18px;
    }
}

@media (min-width: 1600px) {
    .header .ap-mobile-menu-inner {
        column-gap: 32px;
    }

    .header .navbar-nav {
        gap: 10px 32px !important;
    }

    .header .navbar-nav .nav-link,
    .header .navbar-nav .nav-mega-trigger {
        font-size: 18px !important;
        padding: 0 12px !important;
    }

    .ap-header-actions {
        gap: 20px;
    }

    .ap-header-phone-desktop.header-consult-btn {
        padding: 12px 20px !important;
        font-size: 16px !important;
    }
}

/* Text, images, embeds: stay inside the viewport on every page */
.entry-content,
.ap-text-output,
.ap-rich-text,
.seotext,
.banner-hero-text,
.about_content,
.violence_content,
.committed_content,
.consultation_content,
.ap-svc-detail-content,
.singleblog-section .content,
.blogpage-section .content {
    overflow-wrap: anywhere;
    word-wrap: break-word;
    max-width: 100%;
}

.entry-content .wp-caption,
.entry-content figure.wp-caption,
.entry-content dl.wp-caption,
.ap-text-output .wp-caption,
.ap-text-output figure.wp-caption,
.ap-text-output dl.wp-caption,
.seotext .wp-caption,
.seotext figure.wp-caption,
.seotext dl.wp-caption,
.ap-rich-text .wp-caption,
.ap-rich-text figure.wp-caption,
.ap-rich-text dl.wp-caption {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: center;
    float: none !important;
    max-width: 100% !important;
    text-align: center;
    margin: 1.25em auto !important;
}

.entry-content .wp-caption.alignright,
.ap-text-output .wp-caption.alignright,
.seotext .wp-caption.alignright,
.ap-rich-text .wp-caption.alignright {
    margin: 1.25em auto !important;
}

.entry-content .wp-caption.alignleft,
.ap-text-output .wp-caption.alignleft,
.seotext .wp-caption.alignleft,
.ap-rich-text .wp-caption.alignleft {
    margin: 1.25em auto !important;
}

.entry-content .wp-caption.aligncenter,
.ap-text-output .wp-caption.aligncenter,
.seotext .wp-caption.aligncenter,
.ap-rich-text .wp-caption.aligncenter {
    float: none !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

.entry-content .wp-caption img,
.ap-text-output .wp-caption img,
.ap-text-output figure.wp-caption img,
.seotext .wp-caption img,
.ap-rich-text .wp-caption img,
.entry-content img.aligncenter,
.ap-text-output img.aligncenter,
.seotext img.aligncenter {
    display: block !important;
    float: none !important;
    margin-left: auto !important;
    margin-right: auto !important;
    max-width: 100% !important;
    height: auto !important;
}

.entry-content .wp-caption-dt,
.ap-text-output .wp-caption-dt,
.seotext .wp-caption-dt,
.ap-rich-text .wp-caption-dt {
    display: block !important;
    float: none !important;
    margin: 0 !important;
    width: 100% !important;
    order: 1;
}

.entry-content .wp-caption-text,
.entry-content figcaption,
.entry-content .wp-caption-dd,
.ap-text-output figcaption,
.ap-text-output .wp-caption-text,
.ap-text-output .wp-caption-dd,
.seotext figcaption,
.seotext .wp-caption-text,
.seotext .wp-caption-dd,
.ap-rich-text figcaption,
.ap-rich-text .wp-caption-text,
.ap-rich-text .wp-caption-dd {
    display: block !important;
    caption-side: unset !important;
    float: none !important;
    width: 100% !important;
    order: 2;
    text-align: center;
    margin: 0.5em 0 0 !important;
}

.entry-content img,
.ap-text-output img,
.about-image img,
.consultation-image img,
.banner-image1 img,
.ap-useful-articles img,
.ap-team-card img,
.ap-cases-listing__card img,
.ap-feedback__photo img,
iframe,
video,
embed,
object {
    max-width: 100%;
}

.entry-content table,
.ap-text-output table,
.seotext table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
}

@media (max-width: 1199.98px) {
    h1,
    .banner-hero-title,
    .violence_content h1,
    .sub_banner_content h1 {
        font-size: clamp(28px, 5vw, 46px) !important;
        line-height: 1.22 !important;
        max-width: 100%;
    }

    h2,
    .consultation_content h2,
    .committed_content h2 {
        font-size: clamp(22px, 3.8vw, 36px);
        line-height: 1.25;
        max-width: 100%;
    }

    .consultation-con .consultation_content input,
    .consultation-con .consultation_content textarea,
    .consultation-con .consultation_content select {
        max-width: 100%;
        box-sizing: border-box;
    }
}

@media (max-width: 767.98px) {
    .consultation-con .consultation_content .input1,
    .consultation-con .consultation_content .form-group {
        float: none !important;
        width: 100% !important;
        margin-right: 0 !important;
    }

    .consultation-con .consultation_content input,
    .consultation-con .consultation_content textarea {
        width: 100% !important;
    }

    /* Feedback photo before «Наші нагороди»: never crop on phones */
    body.home .ap-feedback {
        overflow: visible !important;
        min-height: 0 !important;
        --ap-feedback-h: auto !important;
    }

    body.home .ap-feedback__media,
    body.home .ap-feedback__photo {
        height: auto !important;
        max-height: none !important;
        min-height: 0 !important;
        overflow: visible !important;
    }

    body.home .ap-feedback__photo img,
    body.home .ap-feedback__photo-img {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: none !important;
        object-fit: contain !important;
        object-position: top center !important;
        margin-left: 0 !important;
    }

    /* Won cases: keep photo inside the rounded card */
    body.home .ap-won-cases-con .case-box,
    body.home .ap-won-cases-con .ap-won-cases-cards__box,
    body.home .ap-won-cases-con .case-box figure {
        overflow: hidden !important;
        border-radius: 20px;
        max-width: 100%;
    }

    body.home .ap-won-cases-con .case-box figure {
        position: relative;
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 330 / 379;
    }

    body.home .ap-won-cases-con .case-box figure img {
        position: absolute;
        inset: 0;
        width: 100% !important;
        height: 100% !important;
        max-width: none !important;
        max-height: none !important;
        object-fit: cover !important;
        object-position: center center !important;
        display: block;
        border-radius: 20px;
    }
}

/* Headings: contrast on light pages; white only on dark surfaces */
h1:not(.banner-hero-title):not(.text-white),
h2:not(.text-white),
h3.ap-display-h2,
.ap-display-h2,
.ap-service-children-list h2,
.ap-service-cta h2,
.ap-mv-related__title,
.ap-services-hub-grid__title,
.aboutpage-con h2,
.about_content h2,
.faq-con h2,
.committed_content h2,
.practice_content h2,
.ap-page-heading__title,
.violence-con:not(.ap-services-page-cta):not(.ap-locations-page-cta) .violence_content h1,
.violence-con:not(.ap-services-page-cta):not(.ap-locations-page-cta) .violence_content h2,
.violence-con:not(.ap-services-page-cta):not(.ap-locations-page-cta) .violence_content h3 {
    color: #282828 !important;
}

h2.ap-loc-archive__title,
.ap-loc-archive__title,
.ap-loc-card__title,
.ap-loc-card__addresses {
    color: #3b485e !important;
}

.consultation-con .consultation_content h1,
.consultation-con .consultation_content h2,
.consultation-con .consultation_content h3,
.consultation-con .consultation_content .ap-display-h2,
.consultation-con .consultation_content h3.ap-display-h2,
.consultation-con .consultation_content .entry-content,
.consultation-con .consultation_content .entry-content h1,
.consultation-con .consultation_content .entry-content h2,
.consultation-con .consultation_content .entry-content h3,
.consultation-con .consultation_content .text-white,
.consultation-con .consultation_content .text-white p,
.consultation-con .consultation_content .text-white a,
.consultation-con .consultation_content .text-white span,
.consultation-con .consultation_content .ap-contact-form-lead,
.consultation-con .consultation_content .ap-contact-form-lead p,
.consultation-con .consultation_content .ap-contact-form-lead a,
.consultation-con .consultation_content .ap-contact-form-lead span,
.footer-con .upper_portion h2,
.footer-con .ap-send-phone-cta,
.ap-services-page-cta .violence_content h2,
.ap-services-page-cta .violence_content h3,
.ap-locations-page-cta .violence_content h2,
.ap-locations-page-cta .violence_content h3,
.banner-con h1,
.banner-con .banner-hero-title,
.banner-con .banner-hero-text,
.banner-con .banner-hero-text p,
.banner-con .ap-home-hero-content,
.banner-con .ap-home-hero-content h1,
.banner-con .ap-home-hero-content p {
    color: #ffffff !important;
}

/* Homepage hero copy + stats icons: never hide on the dark banner */
body.home .banner-con .ap-home-hero-content {
    display: block !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    opacity: 1 !important;
    visibility: visible !important;
}

body.home .banner-con .ap-home-hero-content,
body.home .banner-con .ap-home-hero-content h1,
body.home .banner-con .banner-hero-title,
body.home .banner-con .banner-hero-text,
body.home .banner-con .banner-hero-text *,
body.home .banner-con .ap-home-hero-content p,
body.home .banner-con .ap-home-hero-content li,
body.home .banner-con .ap-home-hero-content span:not(.emoji) {
    color: #ffffff !important;
    opacity: 1 !important;
    visibility: visible !important;
}

body.home .banner-con .ap-home-hero-content img.emoji,
body.home .banner-con .banner-hero-text img.emoji {
    display: inline !important;
    width: 1.15em !important;
    height: 1.15em !important;
    margin: 0 0.07em !important;
    vertical-align: -0.15em !important;
    opacity: 1 !important;
    visibility: visible !important;
}

body.home .banner-con .banner-stats-block {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

body.home .banner-con .banner-stats-block .number,
body.home .banner-con .banner-stats-block .plus {
    color: #ffffff !important;
}

body.home .banner-con .banner-stats-block__icon,
body.home .banner-con .banner-stats-block__icon i {
    display: inline-block !important;
    color: #d4a373 !important;
    opacity: 1 !important;
    visibility: visible !important;
    font-size: 28px !important;
    line-height: 1 !important;
}

/* Service card icons: full shape, never clipped as a shield */
.ap-mv-related__icon,
.ap-services-hub-grid__card .ap-mv-related__icon,
body.ap-mv-payments-page .ap-mv-related__icon {
    clip-path: none !important;
    -webkit-clip-path: none !important;
    mask: none !important;
    -webkit-mask-image: none !important;
    mask-image: none !important;
    overflow: visible !important;
    border-radius: 12px;
}

.ap-mv-related__icon *,
.ap-mv-related__icon::before,
.ap-mv-related__icon::after {
    clip-path: none !important;
    -webkit-clip-path: none !important;
    mask: none !important;
    -webkit-mask-image: none !important;
    mask-image: none !important;
    overflow: visible !important;
    border-radius: 0 !important;
}

.ap-mv-related__icon i {
    display: flex !important;
    align-items: center;
    justify-content: center;
    overflow: visible !important;
    max-width: none !important;
    max-height: none !important;
    font-size: 22px !important;
    line-height: 1 !important;
}

.ap-services-hub-grid .ap-mv-related__name {
    font-size: 16.8px !important;
    line-height: 1.35;
    padding-top: 62px;
}

.ap-services-hub-grid .ap-mv-related__icon {
    width: 57px;
    height: 57px;
}

.ap-services-hub-grid .ap-mv-related__icon i {
    font-size: 24.2px !important;
}

.ap-services-hub-grid .ap-mv-related__icon svg {
    width: 24px !important;
    height: 24px !important;
    max-width: 24px !important;
    max-height: 24px !important;
}

.ap-mv-related__icon i::before {
    clip-path: none !important;
    -webkit-clip-path: none !important;
    overflow: visible !important;
}

.ap-mv-related__icon img,
.ap-mv-related__icon svg {
    overflow: visible !important;
    object-fit: contain !important;
    width: auto !important;
    height: auto !important;
    max-width: 36px !important;
    max-height: 36px !important;
    clip-path: none !important;
    -webkit-clip-path: none !important;
}

/* About page AO cards: beat shared icon !important at 70% scale */
.ap-about-services .ap-mv-related__icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
}
.ap-about-services .ap-mv-related__icon i {
    font-size: 15px !important;
}
.ap-about-services .ap-mv-related__icon svg {
    width: 15px !important;
    height: 15px !important;
    max-width: 15px !important;
    max-height: 15px !important;
}
.ap-about-services .ap-mv-related__icon img {
    max-width: 25px !important;
    max-height: 25px !important;
}
.ap-about-services .ap-mv-related__name {
    font-size: 12px;
    padding-top: 39px;
}

.committed-con .committed-box .icon,
.committed-con .committed-box .icon img,
.committed-con .committed-box .icon i,
.committed-con .committed-box .icon i::before {
    clip-path: none !important;
    -webkit-clip-path: none !important;
    mask: none !important;
    overflow: visible !important;
}

/* 768px / tablet: space between footer CTA elements */
@media (max-width: 991.98px) {
    .footer-con .upper_portion {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 20px;
        text-align: center;
        padding: 32px 24px;
    }

    .footer-con .upper_portion .heading {
        margin: 0 0 4px;
    }

    .footer-con .upper_portion .ap-send-phone-cta {
        display: block;
        margin: 0 0 8px;
        line-height: 1.35;
    }

    .footer-con .upper_portion .ap-footer-phone-form-area,
    .footer-con .upper_portion .form-group,
    #ap-footer-phone-form,
    #ap-footer-phone-form .form-group {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        width: 100%;
        max-width: 100%;
        margin: 0;
    }

    .footer-con .upper_portion input,
    .footer-con .upper_portion button {
        width: 100% !important;
        max-width: 100%;
        margin: 0 !important;
        position: static;
    }

    .ap-service-children-list .service-hub-list,
    body.ap-service-route .ap-service-children-list .service-hub-list {
        display: grid;
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .ap-service-children-list .service-hub-list li,
    body.ap-service-route .ap-service-children-list .service-hub-list li {
        margin: 0;
        padding: 4px 0;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .ap-service-children-list .service-hub-list,
    body.ap-service-route .ap-service-children-list .service-hub-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px 36px;
    }

    .footer-con .upper_portion {
        gap: 28px;
        padding: 40px 32px;
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }

    #ap-footer-phone-form {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 16px !important;
        width: 100% !important;
    }

    #ap-footer-phone-form .form-group,
    #ap-footer-phone-form .form-group input,
    #ap-footer-phone-form .ap-consultation-submit {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
    }

    .footer-con .upper_portion .heading {
        margin: 0 0 12px !important;
    }

    .footer-con .upper_portion .ap-send-phone-cta {
        margin: 0 0 16px !important;
        line-height: 1.4 !important;
    }

    .footer-con .upper_portion .ap-footer-phone-form-area,
    #ap-footer-phone-form,
    #ap-footer-phone-form .form-group {
        gap: 20px !important;
    }

    .footer-con .upper_portion input {
        margin: 0 0 8px 0 !important;
    }

    .footer-con .upper_portion button {
        margin-top: 8px !important;
    }
}

/* H1 without intro → next about block: keep a readable gap above the photo */
html body .ap-page-heading--no-intro .sub_banner_con,
html body .ap-page-heading--no-intro.sub_banner .sub_banner_con {
    padding-top: 12px !important;
    padding-bottom: 20px !important;
}

html body .ap-page-heading--no-intro .sub_banner_con h1,
html body .ap-page-heading--no-intro .ap-page-heading__title {
    margin-bottom: 8px !important;
}

html body .ap-page-heading + .aboutpage-con,
html body .sub_banner + .aboutpage-con {
    padding-top: 48px !important;
}

@media (min-width: 992px) {
    html body.ap-service-route .ap-page-heading + .aboutpage-con .about_wrapper,
    html body.ap-service-route .ap-page-heading + .aboutpage-con .about_content,
    html body.ap-service-route .sub_banner + .aboutpage-con .about_wrapper,
    html body.ap-service-route .sub_banner + .aboutpage-con .about_content {
        padding-top: 12px !important;
    }
}

/* Contrast: filled navy/accent/dark buttons → white label + icon */
.header-consult-btn,
.ap-consultation-submit,
.ap-hero-consultation-submit,
.ap-consultation-form .ap-consultation-submit,
.ap-inline-phone-form .ap-consultation-submit,
.ap-footer-phone-form .ap-consultation-submit,
.ap-blog-article-cta__submit,
.ap-mv-cta__submit,
.banner-urgent-visit-btn,
.consultation-con .consultation_content .appointment,
.consultation-con .consultation_content .appointment i,
.footer-con .upper_portion button,
.footer-con .upper_portion button i,
.legal_matter_footer .contact_portion .contact_content .appointment,
.legal_matter_footer .contact_portion .contact_content .appointment i,
.legal_situation_footer .footer_content a,
.legal_situation_footer .footer_content a i,
.legal_situation_banner .banner_content .appointment,
.legal_matter_banner .banner_content a,
.aboutpage-con .about_content a.read_more,
.aboutpage-con .about_content a.appointment,
.aboutpage-con .about_content a.read_more i,
.aboutpage-con .about_content a.appointment i,
.ap-useful-articles__read-more,
.ap-blog-listing__read-more,
.blogpage-section .blog-box .button-portion .read_more,
.blogpage-section .blog-box .button-portion .read_more:hover,
.load-more a,
#fixed-form-container .body .submit_now,
.ap-header-phone-desktop.header-consult-btn,
.ap-header-phone-mobile.header-consult-btn,
.form-gray-fields .btn,
.violence-con .violence_content a.appointment,
.home section.violence-con .violence_content a.appointment,
.home section.violence-con .violence_content a.appointment:hover {
    color: #ffffff !important;
}

/* Dark surfaces (mega, footer, photo banners): never use navy-on-navy hover */
.mega-menu-close:hover,
.mega-menu-close:focus,
.mega-content-title-link,
.mega-content-title-link:hover,
.mega-content-title-link i,
.mega-menu-content .mega-content-links a:hover,
.mega-mobile-links-row a:hover,
.mega-mobile-l1-link:hover,
.footer-con .middle_portion .social-icons li:hover i,
.footer-con .middle_portion .links li i,
.footer-con .middle_portion li a:hover,
.banner-con .banner_sideicon .social-icons li:hover i,
.consultation-con .consultation_content span:not(.form-error):not(.alert) {
    color: #ffffff !important;
}

/* Active/hover pills that sit on navy */
.navbar-nav .drop-down-pages .active > a,
.navbar-nav .drop-down-pages .active > a:hover,
.navbar-nav .active > a {
    color: #ffffff !important;
}

.sidebar .tags a.active,
.sidebar .tags a:active,
.sidebar .tags a:focus,
.sidebar .tags a:hover,
.singleblog-section .content4 .tag .button:hover {
    color: #ffffff !important;
    background: #3b485e !important;
    border-color: #3b485e !important;
}

/* Icon circles: keep white glyph on navy; hover darkens the circle, not the icon */
.lawyer-con .lawyer-box .content li:hover i,
.team-con .team-box .content li:hover i {
    color: #ffffff !important;
    background: #202226 !important;
}

/* Status/success chips: light panel + dark text (not navy fill) */
.ap-consultation-success,
.ap-blog-article-cta__result .ap-consultation-success,
.ap-mv-cta__result .ap-consultation-success {
    color: #3b485e !important;
    background: #eef1f5 !important;
}

/* About in-text links (e.g. anchor «google») must not look like the consult button */
html body .ap-about-hero .about_content .ap-rich-text a:not(.read_more):not(.ap-about-consult-btn):not(.appointment),
html body .ap-about-hero .about_content .entry-content a:not(.read_more):not(.ap-about-consult-btn):not(.appointment),
html body .ap-about-hero__text a,
html body .ap-about-hero__kicker a,
html body .ap-about-video__text a,
html body .ap-about-services__intro a,
html body.page-about .faq-con .card-body .ap-rich-text a:not(.btn) {
    display: inline !important;
    padding: 0 !important;
    margin: 0 !important;
    min-width: 0 !important;
    width: auto !important;
    height: auto !important;
    background: none !important;
    background-color: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    color: var(--e-global-color-accent, #3b485e) !important;
    text-decoration: underline !important;
    font-weight: 600 !important;
    font-size: inherit !important;
    line-height: inherit !important;
}

/* Phone: homepage «У Вас є питання до адвоката?» — brand blue, white copy (not photo behind text) */
@media (max-width: 767.98px) {
    html body.home section.consultation-con {
        background-image: none !important;
        background-color: #3b485e !important;
    }

    html body.home section.consultation-con .consultation-sideimage {
        display: none !important;
    }

    html body.home section.consultation-con .consultation_content,
    html body.home section.consultation-con .consultation_content h1,
    html body.home section.consultation-con .consultation_content h2,
    html body.home section.consultation-con .consultation_content h3,
    html body.home section.consultation-con .consultation_content .ap-display-h2,
    html body.home section.consultation-con .consultation_content .entry-content,
    html body.home section.consultation-con .consultation_content .entry-content h1,
    html body.home section.consultation-con .consultation_content .entry-content h2,
    html body.home section.consultation-con .consultation_content .entry-content h3,
    html body.home section.consultation-con .consultation_content .entry-content p,
    html body.home section.consultation-con .consultation_content .entry-content span,
    html body.home section.consultation-con .consultation_content p,
    html body.home section.consultation-con .consultation_content .text-white,
    html body.home section.consultation-con .consultation_content .text-white p,
    html body.home section.consultation-con .consultation_content .text-white a,
    html body.home section.consultation-con .consultation_content .text-white span,
    html body.home section.consultation-con .consultation_content span:not(.form-error):not(.alert) {
        color: #ffffff !important;
    }

    html body.home section.consultation-con .consultation_content input,
    html body.home section.consultation-con .consultation_content textarea,
    html body.home section.consultation-con .consultation_content select {
        color: #282828 !important;
        background: #ffffff !important;
        font-size: 16px !important;
    }

    html body.home section.consultation-con .consultation_content .appointment,
    html body.home section.consultation-con .consultation_content .ap-consultation-call-btn {
        color: #ffffff !important;
    }

    .ap-awards-con .ap-awards-images,
    .ap-awards-con .ap-awards-images .about-image,
    .ap-awards-con .ap-awards-images img {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        margin-left: auto;
        margin-right: auto;
    }
}

.ap-mv-videos-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin-top: 28px;
}

@media (min-width: 768px) {
    .ap-mv-videos-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1200px) {
    .ap-mv-videos-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.ap-mv-videos-grid__item {
    min-width: 0;
}

.ap-mv-videos-grid .ap-youtube-lite {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    min-height: 180px;
    border-radius: 12px;
}

.ap-mv-videos-grid__title {
    margin: 10px 0 0;
    font-size: 15px;
    line-height: 1.4;
    color: #282828;
}

/* Military videos — same on-page player as About («Відео про компанію») */
body.ap-mv-payments-page .ap-mv-payments-videos .ap-mv-video-embed,
.ap-mv-payments-videos .ap-about-video__embed.ap-mv-video-embed {
    max-width: 576px;
    width: 60%;
    margin: 28px auto 12px;
}

body.ap-mv-payments-page .ap-mv-payments-videos .ap-mv-video-embed--portrait,
.ap-mv-payments-videos .ap-mv-video-embed--portrait {
    max-width: 360px;
    width: 100%;
}

body.ap-mv-payments-page .ap-mv-payments-videos .ap-mv-video-embed .ap-youtube-lite {
    display: block;
    width: 100%;
    min-height: 0;
    aspect-ratio: 16 / 9;
    border-radius: 15px;
}

body.ap-mv-payments-page .ap-mv-payments-videos .ap-mv-video-embed--portrait .ap-youtube-lite,
.ap-mv-payments-videos .ap-youtube-lite--portrait {
    aspect-ratio: 9 / 16;
}

@media (max-width: 767.98px) {
    body.ap-mv-payments-page .ap-mv-payments-videos .ap-mv-video-embed,
    .ap-mv-payments-videos .ap-about-video__embed.ap-mv-video-embed {
        width: 100%;
        max-width: 100%;
    }

    body.ap-mv-payments-page .ap-mv-payments-videos .ap-mv-video-embed--portrait,
    .ap-mv-payments-videos .ap-mv-video-embed--portrait {
        max-width: 360px;
    }
}

/* ── Phone + tablet visual (≤1199.98px): iPad landscape included ─────────── */

/* 1. Homepage «Послуги адвоката» on phone: no photo, brand blue, white copy */
@media (max-width: 767.98px) {
    html body.home section.practice-con.violence-con,
    html body.home section.practice-con {
        background: #3b485e none !important;
        background-image: none !important;
        background-color: #3b485e !important;
    }

    html body.home section.practice-con.violence-con::before,
    html body.home section.practice-con::before {
        display: none !important;
        content: none !important;
    }

    html body.home section.practice-con .practice_content,
    html body.home section.practice-con .practice_content h1,
    html body.home section.practice-con .practice_content h2,
    html body.home section.practice-con .practice_content h3,
    html body.home section.practice-con .practice_content .ap-display-h2,
    html body.home section.practice-con .practice_content p,
    html body.home section.practice-con .practice_content .entry-content,
    html body.home section.practice-con .practice_content .entry-content p,
    html body.home section.practice-con .practice_content .entry-content h2,
    html body.home section.practice-con .practice_content .entry-content h3,
    html body.home section.practice-con .practice_content .wp-block-heading {
        color: #ffffff !important;
    }

    html body.home section.practice-con .box {
        background: #ffffff !important;
    }

    html body.home section.practice-con .box h3,
    html body.home section.practice-con .box p,
    html body.home section.practice-con .box .ap-rich-text,
    html body.home section.practice-con .box .ap-rich-text p,
    html body.home section.practice-con .box .ap-rich-text li {
        color: #282828 !important;
    }
}

/* 2. Location pages phone + tablet (incl. iPad landscape): solid blue CTA */
@media (max-width: 1199.98px) {
    html body .ap-locations-page-cta.violence-con,
    html body.single-ap_location .ap-locations-page-cta,
    html body.post-type-archive-ap_location .ap-locations-page-cta {
        background: #3b485e none !important;
        background-image: none !important;
        background-color: #3b485e !important;
    }

    html body .ap-locations-page-cta.violence-con::before,
    html body.single-ap_location .ap-locations-page-cta::before,
    html body.post-type-archive-ap_location .ap-locations-page-cta::before {
        display: none !important;
        background: none !important;
        content: none !important;
    }

    html body .ap-locations-page-cta .violence_content,
    html body .ap-locations-page-cta .violence_content h1,
    html body .ap-locations-page-cta .violence_content h2,
    html body .ap-locations-page-cta .violence_content h3,
    html body .ap-locations-page-cta .violence_content .ap-display-h2,
    html body .ap-locations-page-cta .violence_content p,
    html body .ap-locations-page-cta .violence_content span,
    html body .ap-locations-page-cta .violence_content .text-size-16,
    html body .ap-locations-page-cta .violence_content .ap-rich-text,
    html body .ap-locations-page-cta .violence_content .ap-rich-text p,
    html body .ap-locations-page-cta .violence_content .ap-rich-text span,
    html body .ap-locations-page-cta .violence_content .ap-rich-text a {
        color: #ffffff !important;
        text-shadow: none !important;
    }

    html body .ap-locations-page-cta .header-consult-btn,
    html body .ap-locations-page-cta .header-consult-btn i {
        color: #3b485e !important;
        background: #ffffff !important;
        box-shadow: none !important;
    }

    html body .ap-locations-page-cta .header-consult-btn:hover,
    html body .ap-locations-page-cta .header-consult-btn:focus-visible,
    html body .ap-locations-page-cta .header-consult-btn:hover i,
    html body .ap-locations-page-cta .header-consult-btn:focus-visible i {
        color: #ffffff !important;
        background: #2f3b4e !important;
    }
}

/* 3. Contacts + «Консультація адвоката»: iPad/iOS — text must not stick to fixed header */
@media (max-width: 1366px) {
    :root {
        --ap-header-height: 168px;
        --ap-header-gap: 72px;
    }

    html {
        scroll-padding-top: calc(var(--ap-header-height, 168px) + env(safe-area-inset-top, 0px) + var(--ap-header-gap, 72px)) !important;
    }

    html body.home {
        padding-top: calc(var(--ap-header-height, 168px) + env(safe-area-inset-top, 0px)) !important;
    }

    html body:not(.home) {
        padding-top: calc(var(--ap-header-height, 168px) + env(safe-area-inset-top, 0px) + var(--ap-header-gap, 72px)) !important;
    }

    html body.admin-bar .header,
    html body.admin-bar .site-header {
        top: var(--wp-admin--admin-bar--height, 32px) !important;
    }

    .ap-breadcrumb-bar {
        padding-top: 24px !important;
        padding-bottom: 18px !important;
        margin-top: 0 !important;
    }

    html body .ap-contact-page,
    html body .ap-contact-page.ap-text-output--full,
    html body.ap-contact-page .ap-contact-page,
    html body.page-template-page-contact .ap-contact-page {
        padding-top: 12px !important;
        margin-top: 0 !important;
    }

    html body .ap-contact-page .ap-contact-top,
    html body.ap-contact-page .ap-contact-top,
    html body.page-template-page-contact .ap-contact-top {
        padding-top: 72px !important;
        padding-bottom: 40px !important;
    }

    html body .ap-contact-page-heading,
    html body .ap-contact-page-heading__title {
        margin-top: 0 !important;
        padding-top: 8px !important;
    }

    html body .ap-contact-page-heading {
        margin-bottom: 32px !important;
    }

    html body .ap-contact-page-heading__intro,
    html body .ap-contact-page-heading__intro p {
        margin-bottom: 24px !important;
        line-height: 1.75 !important;
    }

    html body .ap-contact-details-list {
        margin-top: 12px !important;
    }

    html body .ap-contact-detail-item + .ap-contact-detail-item {
        margin-top: 22px !important;
    }

    html body.home .committed-con,
    html body.home .committed-con.committed-con--intro-only,
    html body.ap-service-route .committed-con,
    html body.ap-service-route .aboutpage-con,
    html body.ap-unified-layout .committed-con {
        padding-top: 88px !important;
        margin-top: 0 !important;
    }

    html body.home .committed-con .committed_wrapper,
    html body.ap-service-route .committed-con .committed_wrapper {
        padding-top: 36px !important;
    }

    html body.home .committed-con .committed_content h2,
    html body.home .committed-con .committed_content h3.ap-display-h2,
    html body.home .committed-con .committed_content .wp-block-heading,
    html body.ap-service-route .committed-con .committed_content h2,
    html body.ap-service-route .committed-con .committed_content h3.ap-display-h2,
    html body.ap-service-route .aboutpage-con .about_content h1,
    html body.ap-service-route .aboutpage-con .about_content h2 {
        margin-top: 12px !important;
        margin-bottom: 24px !important;
        line-height: 1.35 !important;
        padding-top: 8px !important;
    }

    html body:not(.home) .ap-page-heading,
    html body:not(.home) .ap-mv-hero,
    html body:not(.home) .ap-svc-detail-hero,
    html body.ap-service-route .ap-mv-hero,
    html body.ap-service-route .ap-svc-detail-hero,
    html body:not(.home) .aboutpage-con:first-of-type,
    html body.ap-service-route .aboutpage-con .about_content {
        padding-top: 88px !important;
    }

    html body.ap-service-route .ap-mv-hero__content h1,
    html body.ap-service-route .ap-svc-detail-hero .ap-mv-hero__content h1,
    html body .ap-contact-page-heading__title {
        padding-top: 12px !important;
    }
}

@media screen and (max-width: 782px) {
    html body.admin-bar .header,
    html body.admin-bar .site-header {
        top: var(--wp-admin--admin-bar--height, 46px) !important;
    }
}

/* iPad only: Contacts + «Консультація адвоката» — text must not run off the sides */
@media (max-width: 1366px) {
    html body:has(.ap-contact-page),
    html body.ap-service-route {
        overflow-x: hidden !important;
    }

    html body .ap-contact-page,
    html body .ap-contact-top {
        overflow-x: hidden !important;
        max-width: 100% !important;
    }

    html body .ap-contact-page .container,
    html body .ap-contact-top .container {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        padding-left: max(48px, calc(env(safe-area-inset-left, 0px) + 40px)) !important;
        padding-right: max(48px, calc(env(safe-area-inset-right, 0px) + 40px)) !important;
    }

    html body .ap-contact-top-row {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    html body .ap-contact-top-row > [class*="col-"],
    html body .ap-contact-top-info,
    html body .ap-contact-top-map {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
        min-width: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    html body .ap-contact-page-heading,
    html body .ap-contact-page-heading__title,
    html body .ap-contact-page-heading__intro,
    html body .ap-contact-page-heading__intro p,
    html body .ap-contact-details,
    html body .ap-contact-detail-value {
        max-width: 100% !important;
        overflow-wrap: anywhere !important;
        word-break: break-word !important;
    }

    html body.ap-service-route .ap-svc-detail-hero .ap-page-shell,
    html body.ap-service-route .ap-svc-detail-content .ap-page-shell,
    html body .ap-svc-detail-hero .ap-page-shell {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        padding-left: max(48px, calc(env(safe-area-inset-left, 0px) + 40px)) !important;
        padding-right: max(48px, calc(env(safe-area-inset-right, 0px) + 40px)) !important;
    }

    html body.ap-service-route .ap-svc-detail-hero .row {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    html body.ap-service-route .ap-svc-detail-hero .row > [class*="col-"] {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
        min-width: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    html body.ap-service-route .ap-svc-detail-hero .ap-mv-hero__copy,
    html body.ap-service-route .ap-svc-detail-hero h1,
    html body.ap-service-route .ap-svc-detail-hero .ap-mv-intro__text,
    html body.ap-service-route .ap-svc-detail-content__inner {
        max-width: 100% !important;
        width: 100% !important;
        overflow-wrap: anywhere !important;
        word-break: break-word !important;
    }

    html body.ap-service-route .ap-svc-detail-hero .ap-mv-hero__photo {
        max-width: min(420px, 100%) !important;
        width: 100% !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
}

/* 4. Homepage service cards: buttons stay inside the card on tablet */
@media (max-width: 1199.98px) {
    html body.home section.practice-con .row.violence_content,
    html body.home section.practice-con > .container > .row:last-child {
        display: grid !important;
        grid-template-columns: 1fr;
        gap: 20px;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    html body.home section.practice-con .row.violence_content > [class*="col-"],
    html body.home section.practice-con > .container > .row:last-child > [class*="col-"] {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    html body.home section.practice-con .box {
        display: flex;
        flex-direction: column;
        width: 100% !important;
        max-width: 100% !important;
        min-height: 0 !important;
        height: 100%;
        margin: 0 0 4px !important;
        padding: 28px 22px 24px !important;
    }

    html body.home section.practice-con .box .practice-box {
        display: flex;
        flex-direction: column;
        flex: 1 1 auto;
        min-width: 0;
    }

    html body.home section.practice-con .box .appointment,
    html body.home section.practice-con .box a.appointment {
        margin-top: auto;
        margin-bottom: 0;
        align-self: center;
        max-width: 100%;
        white-space: normal;
        text-align: center;
        word-break: break-word;
        position: relative;
        z-index: 2;
    }
}

@media (min-width: 768px) and (max-width: 1199.98px) {
    html body.home section.practice-con .row.violence_content,
    html body.home section.practice-con > .container > .row:last-child {
        grid-template-columns: 1fr 1fr;
    }
}

/* 5. Military related services: no overlapping cards on tablet */
@media (max-width: 1199.98px) {
    .ap-mv-related__grid,
    body.ap-mv-payments-page .ap-mv-related__grid,
    html body.ap-mv-payments-page .ap-mv-related__grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 16px !important;
        max-width: 100% !important;
    }

    .ap-mv-related__card,
    body.ap-mv-payments-page .ap-mv-related__card {
        min-width: 0 !important;
        aspect-ratio: auto !important;
        height: auto !important;
    }

    .ap-mv-related__link,
    body.ap-mv-payments-page .ap-mv-related__link {
        aspect-ratio: auto !important;
        min-height: 200px;
        height: auto !important;
        padding: 20px 16px 18px !important;
        overflow: visible;
    }

    .ap-mv-related__name,
    body.ap-mv-payments-page .ap-mv-related__name {
        position: relative !important;
        font-size: 14px !important;
        line-height: 1.35 !important;
        min-height: 0 !important;
        height: auto !important;
        overflow: visible !important;
        white-space: normal !important;
        word-break: break-word;
        display: block !important;
        padding-top: 56px !important;
        margin: 0 !important;
    }
}

@media (max-width: 575.98px) {
    .ap-mv-related__grid,
    body.ap-mv-payments-page .ap-mv-related__grid {
        grid-template-columns: 1fr !important;
    }
}

/* 6. Awards on tablet: photo + text always visible, stacked */
@media (max-width: 1199.98px) {
    .ap-awards-con .about-sideimage {
        display: none !important;
    }

    .ap-awards-con .ap-awards-item {
        display: flex !important;
        flex-direction: column !important;
        align-items: center;
        margin-top: 32px;
    }

    .ap-awards-con .ap-awards-item > [class*="col-"] {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        text-align: center !important;
    }

    .ap-awards-con .ap-awards-item > [class*="col-"]:has(.ap-awards-images) {
        order: 1 !important;
    }

    .ap-awards-con .ap-awards-item > [class*="col-"]:has(.ap-awards-text) {
        order: 2 !important;
    }

    .ap-awards-con .ap-awards-images,
    .ap-awards-con .ap-awards-images .about-image,
    .ap-awards-con .about_wrapper.ap-awards-images,
    .ap-awards-con .ap-awards-images img,
    .ap-awards-con .about-image img {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: 100% !important;
        max-width: 420px !important;
        height: auto !important;
        margin-left: auto !important;
        margin-right: auto !important;
        overflow: visible !important;
    }

    .ap-awards-con .about_content.ap-awards-text {
        max-width: 640px;
        margin: 16px auto 0;
        text-align: center;
        padding-top: 0 !important;
    }

    .ap-awards-con .about_content.ap-awards-text h3,
    .ap-awards-con .about_content.ap-awards-text p {
        color: #282828 !important;
    }
}

/* Forms on phone/tablet: 16px to avoid iOS zoom; readable tap targets */
@media (max-width: 1199.98px) {
    input,
    select,
    textarea {
        font-size: 16px !important;
        min-height: 44px;
    }

    .header-consult-btn,
    a.appointment,
    button.appointment {
        min-height: 44px;
        padding-left: 20px;
        padding-right: 20px;
    }
}
