/* ==================================================
   Echo Theme - Single Post Styles
   ================================================== */

/* Article Content Images - Prevent overflow */
.echo-article-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.5rem 0;
}

/* WordPress alignment classes support */
.echo-article-content .alignnone {
    max-width: 100%;
    height: auto;
}

.echo-article-content .aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
    max-width: 100%;
    height: auto;
}

.echo-article-content .alignleft {
    float: left;
    margin-right: 1.5rem;
    margin-bottom: 1rem;
    max-width: 50%;
    height: auto;
}

.echo-article-content .alignright {
    float: right;
    margin-left: 1.5rem;
    margin-bottom: 1rem;
    max-width: 50%;
    height: auto;
}

/* WordPress figure element support */
.echo-article-content figure {
    max-width: 100%;
    margin: 1.5rem 0;
}

.echo-article-content figure img {
    margin: 0;
}

.echo-article-content figcaption {
    font-size: 0.875rem;
    color: #666;
    margin-top: 0.5rem;
    font-style: italic;
}

/* Gallery images */
.echo-article-content .gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 1.5rem 0;
}

.echo-article-content .gallery-item {
    flex: 1 1 calc(33.333% - 1rem);
    max-width: calc(33.333% - 1rem);
}

.echo-article-content .gallery-item img {
    width: 100%;
    height: auto;
    margin: 0;
}

/* Article Content Responsive Typography and Overflow Prevention */
.echo-article-content {
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
    overflow-x: hidden;
}

.echo-article-content * {
    max-width: 100%;
}

.echo-article-content p,
.echo-article-content li,
.echo-article-content blockquote,
.echo-article-content div {
    max-width: 100%;
}

/* Tables - Responsive */
.echo-article-content table {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    display: block;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.echo-article-content table td,
.echo-article-content table th {
    padding: 0.5rem;
    word-wrap: break-word;
}

/* Pre and Code blocks - Prevent overflow */
.echo-article-content pre {
    max-width: 100%;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    padding: 1rem;
    background: #f5f5f5;
    border-radius: 4px;
    margin: 1.5rem 0;
}

.echo-article-content code {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Iframes and embeds - Responsive */
.echo-article-content iframe,
.echo-article-content embed,
.echo-article-content object,
.echo-article-content video {
    max-width: 100%;
    height: auto;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .echo-article-content .alignleft,
    .echo-article-content .alignright {
        float: none;
        margin-left: 0;
        margin-right: 0;
        max-width: 100%;
    }
    
    .echo-article-content .gallery-item {
        flex: 1 1 calc(50% - 0.5rem);
        max-width: calc(50% - 0.5rem);
    }
    
    .echo-article-content {
        font-size: 16px;
        line-height: 1.7;
        padding: 0 15px;
    }
    
    .echo-article-content h2 {
        font-size: 1.5rem;
        word-wrap: break-word;
    }
    
    .echo-article-content h3 {
        font-size: 1.25rem;
        word-wrap: break-word;
    }
    
    .echo-article-content table {
        font-size: 14px;
    }
    
    .echo-article-content pre {
        font-size: 13px;
        padding: 0.75rem;
    }
}

@media (max-width: 480px) {
    .echo-article-content .gallery-item {
        flex: 1 1 100%;
        max-width: 100%;
    }
    
    .echo-article-content {
        font-size: 15px;
        padding: 0 10px;
    }
    
    .echo-article-content img {
        margin: 1rem 0;
    }
    
    .echo-article-content h2 {
        font-size: 1.35rem;
    }
    
    .echo-article-content h3 {
        font-size: 1.15rem;
    }
    
    .echo-article-content table {
        font-size: 12px;
    }
    
    .echo-article-content pre {
        font-size: 12px;
        padding: 0.5rem;
    }
}
