/**
 * TP Legacy Content — styles for non-Elementor service pages
 *
 * Provides styled wrapper for classic WP editor content,
 * content+sidebar grid layout, and CTA section.
 *
 * @package Technoproekt
 * @author  Kkalganov <https://kkalganov.com>
 */

/* ==========================================================================
   Content + Sidebar Grid (legacy)
   ========================================================================== */

.tp-content-section--legacy {
    padding: 60px 40px;
    background: var(--tp-white, #FFFFFF);
}

.tp-content-layout--legacy {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 48px;
    max-width: 1400px;
    margin: 0 auto;
}

.tp-content-sidebar--legacy {
    position: relative;
}

.tp-content-main--legacy {
    min-width: 0;
}

/* ==========================================================================
   Legacy Content Typography (classic editor output)
   ========================================================================== */

.tp-legacy-content {
    font-family: 'IBM Plex Sans', system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.8;
    color: var(--tp-text, #1C2B1A);
}

.tp-legacy-content > *:first-child {
    margin-top: 0;
}

.tp-legacy-content > *:last-child {
    margin-bottom: 0;
}

/* --- Headings --- */

.tp-legacy-content h2 {
    font-family: 'Unbounded', system-ui, sans-serif;
    font-size: clamp(18px, 2.5vw, 24px);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: -0.3px;
    color: var(--tp-text, #1C2B1A);
    margin: 48px 0 20px;
    line-height: 1.3;
}

.tp-legacy-content h3 {
    font-family: 'Unbounded', system-ui, sans-serif;
    font-size: clamp(15px, 2vw, 18px);
    font-weight: 600;
    text-transform: uppercase;
    color: var(--tp-text, #1C2B1A);
    margin: 36px 0 16px;
    line-height: 1.3;
}

.tp-legacy-content h4 {
    font-family: 'Unbounded', system-ui, sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: var(--tp-text, #1C2B1A);
    margin: 28px 0 12px;
    line-height: 1.4;
}

/* Strip inline formatting from headings (old content uses <strong><u>) */
.tp-legacy-content h2 u,
.tp-legacy-content h2 strong,
.tp-legacy-content h3 u,
.tp-legacy-content h3 strong,
.tp-legacy-content h4 u,
.tp-legacy-content h4 strong {
    text-decoration: none;
    font-weight: inherit;
    color: inherit;
}

/* --- Paragraphs --- */

.tp-legacy-content p {
    margin: 0 0 16px;
    hyphens: auto;
    -webkit-hyphens: auto;
}

.tp-legacy-content p:empty,
.tp-legacy-content p br:only-child {
    display: none;
}

/* --- Links --- */

.tp-legacy-content a {
    color: var(--tp-green-main, #2D5A27);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.2s;
}

.tp-legacy-content a:hover {
    color: var(--tp-green-dark, #1A3D18);
}

/* --- Images --- */

.tp-legacy-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--tp-radius-lg, 12px);
    margin: 8px 0 16px;
}

.tp-legacy-content img[align="left"],
.tp-legacy-content img.alignleft,
.tp-legacy-content .alignleft img {
    float: left;
    margin: 4px 24px 16px 0;
    max-width: 45%;
}

.tp-legacy-content img[align="right"],
.tp-legacy-content img.alignright,
.tp-legacy-content .alignright img {
    float: right;
    margin: 4px 0 16px 24px;
    max-width: 45%;
}

.tp-legacy-content .aligncenter,
.tp-legacy-content img.aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.tp-legacy-content .wp-caption {
    max-width: 100%;
}

.tp-legacy-content .wp-caption-text {
    font-size: 13px;
    color: var(--tp-text-light, #5A6858);
    text-align: center;
    margin-top: 6px;
}

/* Clearfix after floated images */
.tp-legacy-content::after {
    content: '';
    display: table;
    clear: both;
}

/* --- Lists --- */

.tp-legacy-content ul,
.tp-legacy-content ol {
    margin: 0 0 20px;
    padding-left: 0;
    list-style: none;
}

.tp-legacy-content ul li,
.tp-legacy-content ol li {
    position: relative;
    padding-left: 24px;
    margin-bottom: 8px;
    line-height: 1.7;
}

.tp-legacy-content ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    width: 8px;
    height: 8px;
    background: var(--tp-green-main, #2D5A27);
    border-radius: 50%;
}

.tp-legacy-content ol {
    counter-reset: ol-counter;
}

.tp-legacy-content ol li {
    counter-increment: ol-counter;
}

.tp-legacy-content ol li::before {
    content: counter(ol-counter) '.';
    position: absolute;
    left: 0;
    font-weight: 600;
    color: var(--tp-green-main, #2D5A27);
}

/* Nested lists */
.tp-legacy-content ul ul,
.tp-legacy-content ol ol,
.tp-legacy-content ul ol,
.tp-legacy-content ol ul {
    margin: 8px 0 0;
}

.tp-legacy-content ul ul li::before {
    width: 6px;
    height: 6px;
    background: transparent;
    border: 2px solid var(--tp-green-main, #2D5A27);
}

/* --- Tables --- */

.tp-legacy-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 14px;
}

.tp-legacy-content table th {
    background: var(--tp-green-dark, #1A3D18);
    color: var(--tp-white, #FFFFFF);
    font-family: 'Unbounded', system-ui, sans-serif;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 12px 16px;
    text-align: left;
}

.tp-legacy-content table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--tp-cream-warm, #EDE9E0);
    vertical-align: top;
}

.tp-legacy-content table tr:nth-child(even) td {
    background: var(--tp-cream, #F7F5F0);
}

/* --- Blockquotes --- */

.tp-legacy-content blockquote {
    margin: 24px 0;
    padding: 20px 24px;
    border-left: 4px solid var(--tp-green-main, #2D5A27);
    background: var(--tp-cream, #F7F5F0);
    border-radius: 0 var(--tp-radius-md, 8px) var(--tp-radius-md, 8px) 0;
    font-style: italic;
    color: var(--tp-text, #1C2B1A);
}

.tp-legacy-content blockquote p:last-child {
    margin-bottom: 0;
}

/* --- Horizontal rule --- */

.tp-legacy-content hr {
    border: none;
    height: 1px;
    background: var(--tp-cream-warm, #EDE9E0);
    margin: 32px 0;
}

/* --- Strong/Bold --- */

.tp-legacy-content strong,
.tp-legacy-content b {
    font-weight: 600;
    color: var(--tp-text, #1C2B1A);
}

/* --- Old gallery layout --- */

.tp-legacy-content .gallery_horizont,
.tp-legacy-content .gallery-horizont {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin: 20px 0;
    clear: both;
}

.tp-legacy-content .gallery_horizont a,
.tp-legacy-content .gallery-horizont a {
    display: block;
    overflow: hidden;
    border-radius: var(--tp-radius-md, 8px);
}

.tp-legacy-content .gallery_horizont img,
.tp-legacy-content .gallery-horizont img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    margin: 0;
    border-radius: 0;
    transition: transform 0.3s;
}

.tp-legacy-content .gallery_horizont a:hover img,
.tp-legacy-content .gallery-horizont a:hover img {
    transform: scale(1.05);
}

/* Fancybox gallery images (inline) */
.tp-legacy-content a.fancyboxGallery {
    display: inline-block;
    border-radius: var(--tp-radius-md, 8px);
    overflow: hidden;
}

.tp-legacy-content a.fancyboxGallery img {
    border-radius: 0;
    margin: 0;
}

/* --- Iframes / Embeds --- */

.tp-legacy-content iframe {
    max-width: 100%;
    border-radius: var(--tp-radius-md, 8px);
    margin: 16px 0;
}

/* ==========================================================================
   CTA Section (legacy — non-Elementor)
   ========================================================================== */

.tp-cta-section--legacy {
    padding: 40px 16px !important;
    background: var(--tp-cream, #F7F5F0) !important;
    scroll-margin-top: 100px;
}

.tp-cta__container--legacy {
    display: grid;
    grid-template-columns: 1fr 1fr;
    max-width: 1200px;
    margin: 0 auto;
    background: var(--tp-white, #FFFFFF);
    border-radius: var(--tp-radius-lg, 12px);
    overflow: hidden;
    box-shadow: var(--tp-shadow, 0 2px 8px rgba(0,0,0,0.1));
}

.tp-cta__info--legacy {
    padding: 48px 40px;
    background: var(--tp-green-main, #2D5A27);
    color: var(--tp-white, #FFFFFF);
}

.tp-cta__info--legacy h2 {
    font-family: 'Unbounded', system-ui, sans-serif;
    font-size: 24px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: -0.5px;
    margin: 0 0 16px;
    color: var(--tp-white, #FFFFFF) !important;
}

.tp-cta__info--legacy p {
    color: rgba(255,255,255,0.9) !important;
    font-size: 15px;
    line-height: 1.7;
    margin: 0 0 20px;
}

.tp-cta__info--legacy .tp-cta__list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tp-cta__info--legacy .tp-cta__list li {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 14px;
    font-size: 14px;
    color: var(--tp-white, #FFFFFF) !important;
    padding: 0;
}

.tp-cta__form--legacy {
    padding: 48px 40px;
    background: var(--tp-white, #FFFFFF);
}

.tp-cta__form--legacy h3 {
    font-family: 'Unbounded', system-ui, sans-serif;
    font-size: 20px;
    font-weight: 600;
    color: var(--tp-text, #1C2B1A);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 24px;
}

/* Form field spacing */
.tp-cta__form--legacy .tp-form-group {
    margin-bottom: 16px;
}

.tp-cta__form--legacy .tp-cta__form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Form inputs */
.tp-cta__form--legacy .wpcf7-form-control:not([type="submit"]):not(.wpcf7-radio) {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--tp-cream-warm, #EDE9E0);
    font-size: 15px;
    font-family: 'IBM Plex Sans', system-ui, sans-serif;
    transition: all 0.2s;
    background: var(--tp-cream, #F7F5F0);
    color: var(--tp-text, #1C2B1A);
    border-radius: 0;
    outline: none;
    box-sizing: border-box;
}

.tp-cta__form--legacy .wpcf7-form-control:not([type="submit"]):not(.wpcf7-radio):focus {
    border-color: var(--tp-green-main, #2D5A27);
    background: var(--tp-white, #FFFFFF);
}

/* Submit button */
.tp-cta__form--legacy .wpcf7-submit {
    width: 100%;
    background: var(--tp-green-main, #2D5A27);
    color: var(--tp-white, #FFFFFF);
    padding: 18px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Unbounded', system-ui, sans-serif;
    clip-path: polygon(0 0, 100% 0, 100% 70%, 95% 100%, 0 100%);
    border-radius: 0;
}

.tp-cta__form--legacy .wpcf7-submit:hover {
    background: var(--tp-green-dark, #1A3D18);
}

/* Privacy note */
.tp-cta__form--legacy .tp-cta__form-note {
    font-size: 12px;
    color: var(--tp-text-light, #5A6858);
    text-align: center;
    line-height: 1.5;
    margin-top: 16px;
}

.tp-cta__fallback {
    text-align: center;
    padding: 24px;
}

.tp-cta__fallback p {
    margin: 0 0 12px;
    color: var(--tp-text-light, #5A6858);
}

/* ==========================================================================
   Related Services (legacy — non-Elementor)
   ========================================================================== */

.tp-related-section--legacy {
    padding: 60px 40px;
    background: var(--tp-cream, #F7F5F0);
}

.tp-related__container--legacy {
    max-width: 1200px;
    margin: 0 auto;
}

.tp-related__container--legacy h2 {
    font-family: 'Unbounded', system-ui, sans-serif;
    font-size: clamp(20px, 3vw, 28px);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: -0.5px;
    color: var(--tp-text, #1C2B1A);
    text-align: center;
    margin: 0 0 40px;
}

.tp-related-grid--legacy {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0;
}

.tp-related-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px 20px;
    background: var(--tp-white, #FFFFFF);
    border: 1px solid var(--tp-cream-warm, #EDE9E0);
    margin: -0.5px;
    text-decoration: none;
    transition: all 0.3s;
    position: relative;
}

.tp-related-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: var(--tp-yellow, #E8D52F);
    transition: width 0.4s;
}

.tp-related-card:hover::after {
    width: 100%;
}

.tp-related-card:hover {
    box-shadow: var(--tp-shadow, 0 2px 8px rgba(0,0,0,0.1));
}

.tp-related-card__title {
    font-family: 'Unbounded', system-ui, sans-serif;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--tp-text, #1C2B1A);
    letter-spacing: 0.3px;
    line-height: 1.4;
    flex: 1;
}

.tp-related-card__arrow {
    flex-shrink: 0;
    color: var(--tp-green-main, #2D5A27);
    transition: transform 0.3s;
}

.tp-related-card:hover .tp-related-card__arrow {
    transform: translateX(4px);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1024px) {
    .tp-content-section--legacy {
        padding: 40px 20px;
    }

    .tp-content-layout--legacy {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .tp-content-sidebar--legacy {
        order: 1;
    }

    .tp-content-main--legacy {
        order: 0;
    }
}

@media (max-width: 768px) {
    .tp-content-section--legacy {
        padding: 30px 16px;
    }

    .tp-legacy-content {
        font-size: 15px;
        line-height: 1.7;
    }

    .tp-legacy-content h2 {
        margin: 36px 0 16px;
    }

    .tp-legacy-content h3 {
        margin: 28px 0 12px;
    }

    .tp-legacy-content img[align="left"],
    .tp-legacy-content img.alignleft,
    .tp-legacy-content .alignleft img,
    .tp-legacy-content img[align="right"],
    .tp-legacy-content img.alignright,
    .tp-legacy-content .alignright img {
        float: none;
        max-width: 100%;
        margin: 8px 0 16px;
    }

    .tp-legacy-content .gallery_horizont,
    .tp-legacy-content .gallery-horizont {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 8px;
    }

    .tp-legacy-content .gallery_horizont img,
    .tp-legacy-content .gallery-horizont img {
        height: 140px;
    }

    .tp-cta__container--legacy {
        grid-template-columns: 1fr;
    }

    .tp-cta__info--legacy,
    .tp-cta__form--legacy {
        padding: 32px 20px;
    }

    .tp-cta__info--legacy h2 {
        font-size: 20px;
    }

    .tp-cta__form--legacy h3 {
        font-size: 16px;
    }

    .tp-cta__form--legacy .tp-cta__form-row {
        grid-template-columns: 1fr;
    }

    .tp-related-section--legacy {
        padding: 30px 16px;
    }

    .tp-related__container--legacy h2 {
        margin-bottom: 24px;
    }

    .tp-related-grid--legacy {
        grid-template-columns: 1fr;
    }
}
