/* ===== POST COMPATIBILITY FIXES ===== */

/* Ensure proper variable fallbacks */
:root {
    --primary: #1a1a1a;
    --secondary: #d4af37;
    --text: #333333;
    --text-light: #6c757d;
    --light: #f8f9fa;
    --white: #ffffff;
    --shadow-md: 0 5px 20px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s ease;
    --gradient-primary: linear-gradient(135deg, #d4af37 0%, #b8941f 100%);
}

/* Override any conflicting styles */
.post-detail-section * {
    box-sizing: border-box;
}

/* Ensure images don't overflow */
.post-content img,
.post-body img,
.post-featured-image img {
    max-width: 100%;
    height: auto;
}

/* Fix for embedded videos */
.post-body iframe,
.post-body video {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    margin: 20px 0;
}

/* Fix for tables */
.post-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    overflow-x: auto;
    display: block;
}

.post-body table th,
.post-body table td {
    padding: 12px;
    border: 1px solid #e9ecef;
    text-align: left;
}

.post-body table th {
    background: #f8f9fa;
    font-weight: 700;
    color: #1a1a1a;
}

.post-body table tr:nth-child(even) {
    background: #f8f9fa;
}

/* Fix for blockquotes */
.post-body blockquote {
    border-left: 4px solid #d4af37;
    padding: 20px 25px;
    margin: 25px 0;
    background: #f8f9fa;
    border-radius: 0 10px 10px 0;
    font-style: italic;
    color: #495057;
}

.post-body blockquote p {
    margin: 0;
}

/* Fix for lists */
.post-body ul li::marker,
.post-body ol li::marker {
    color: #d4af37;
    font-weight: 700;
}

/* Fix for horizontal rules */
.post-body hr {
    border: none;
    border-top: 2px solid #e9ecef;
    margin: 30px 0;
}

/* Ensure proper link styling */
.post-body a:not(.share-btn):not(.related-post-item) {
    color: #d4af37;
    text-decoration: underline;
    transition: all 0.3s ease;
}

.post-body a:not(.share-btn):not(.related-post-item):hover {
    color: #b8941f;
}

/* Fix for buttons in content */
.post-body button,
.post-body .button {
    padding: 12px 25px;
    background: #d4af37;
    color: #ffffff;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.post-body button:hover,
.post-body .button:hover {
    background: #b8941f;
    transform: translateY(-2px);
}

/* Fix for forms in content */
.post-body input[type="text"],
.post-body input[type="email"],
.post-body textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
}

.post-body input[type="text"]:focus,
.post-body input[type="email"]:focus,
.post-body textarea:focus {
    border-color: #d4af37;
    outline: none;
}

/* Fix for definition lists */
.post-body dl {
    margin: 20px 0;
}

.post-body dt {
    font-weight: 700;
    color: #1a1a1a;
    margin-top: 15px;
}

.post-body dd {
    margin-left: 20px;
    margin-bottom: 10px;
    color: #495057;
}

/* Fix for abbreviations */
.post-body abbr {
    text-decoration: underline dotted;
    cursor: help;
}

/* Fix for marks/highlights */
.post-body mark {
    background: #fff3cd;
    padding: 2px 5px;
    border-radius: 3px;
}

/* Fix for keyboard shortcuts */
.post-body kbd {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 3px 8px;
    border-radius: 5px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
}

/* Fix for sample output */
.post-body samp {
    background: #f8f9fa;
    padding: 2px 5px;
    border-radius: 3px;
    font-family: 'Courier New', Courier, monospace;
}

/* Fix for variable text */
.post-body var {
    font-style: italic;
    color: #d4af37;
}

/* Ensure proper spacing for nested elements */
.post-body > *:first-child {
    margin-top: 0;
}

.post-body > *:last-child {
    margin-bottom: 0;
}

/* Fix for figure and figcaption */
.post-body figure {
    margin: 25px 0;
}

.post-body figcaption {
    text-align: center;
    font-size: 14px;
    color: #6c757d;
    margin-top: 10px;
    font-style: italic;
}

/* Fix for details/summary */
.post-body details {
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 15px;
    margin: 20px 0;
}

.post-body summary {
    cursor: pointer;
    font-weight: 700;
    color: #1a1a1a;
    user-select: none;
}

.post-body details[open] summary {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

/* Accessibility improvements */
.post-content:focus-within {
    outline: 2px solid #d4af37;
    outline-offset: 4px;
}

/* Skip to content link */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: #d4af37;
    color: #ffffff;
    padding: 8px 15px;
    text-decoration: none;
    z-index: 100;
}

.skip-to-content:focus {
    top: 0;
}

/* Print optimizations */
@media print {
    .post-detail-section {
        background: #ffffff !important;
    }

    .post-content {
        box-shadow: none !important;
        border: 1px solid #ddd;
    }

    .post-body a {
        text-decoration: underline;
        color: #000000;
    }

    .post-body a::after {
        content: " (" attr(href) ")";
        font-size: 12px;
        color: #666666;
    }
}

/* Dark mode support (if implemented) */
@media (prefers-color-scheme: dark) {
    .post-detail-section {
        background: #1a1a1a;
    }

    .post-content {
        background: #2d2d2d;
        color: #e9ecef;
    }

    .post-title,
    .post-body h2,
    .post-body h3,
    .post-body h4 {
        color: #ffffff;
    }

    .post-body {
        color: #e9ecef;
    }

    .post-body blockquote {
        background: #1a1a1a;
        color: #e9ecef;
    }

    .sidebar-widget {
        background: #2d2d2d;
    }

    .widget-title {
        color: #ffffff;
    }

    .related-post-content h4 {
        color: #ffffff;
    }
}
