body {
    line-height: 1.8;
}

.container {
    max-width: 800px;
    margin: 20px auto;
    background: white;
    padding: 40px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-radius: 8px;
}

header {
    margin-bottom: 40px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 20px;
}

h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    color: #2c3e50;
}

.post-meta {
    color: #7f8c8d;
    font-size: 0.9em;
}

.post-meta .date {
    margin-left: 15px;
}

.post-meta .categories,
.post-meta .tags {
    display: inline;
}

.post-meta .categories a,
.post-meta .tags a {
    color: #3498db;
    text-decoration: none;
    margin: 0 5px;
}

.post-meta .categories a:hover,
.post-meta .tags a:hover {
    text-decoration: underline;
}

article {
    font-size: 1.1em;
}

article h2 {
    margin-top: 30px;
    margin-bottom: 15px;
    color: #34495e;
    font-size: 1.8em;
}

article h3 {
    margin-top: 25px;
    margin-bottom: 12px;
    color: #34495e;
    font-size: 1.4em;
}

article p {
    margin-bottom: 15px;
    text-align: justify;
}

article ul, article ol {
    margin-right: 30px;
    margin-bottom: 15px;
}

article li {
    margin-bottom: 8px;
}

article code {
    background-color: #f4f4f4;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

article pre {
    background-color: #2d2d2d;
    color: #f8f8f2;
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    margin-bottom: 20px;
    direction: ltr;
    text-align: left;
}

article pre code {
    background-color: transparent;
    padding: 0;
    color: inherit;
}

/* Image styles - responsive and contained */
article img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 20px auto;
}

/* Math rendering styles */
.math {
    direction: ltr;
}

span.math {
    direction: ltr;
}

/* Override RTL for KaTeX */
.katex {
    direction: ltr;
    unicode-bidi: embed;
}

.katex-html {
    display: inline !important;
    white-space: nowrap;
}

.katex .base {
    display: inline !important;
    white-space: nowrap;
}

.katex .mspace {
    display: inline !important;
    white-space: normal !important;
}

div.math {
    display: block;
    text-align: center;
    padding: 15px 0;
    direction: ltr;
}

/* RTL adjustments for code blocks */
.highlight {
    direction: ltr;
    text-align: left;
}

footer {
    margin-top: 60px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
    text-align: center;
    color: #95a5a6;
    font-size: 0.9em;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }
    
    h1 {
        font-size: 2em;
    }
    
    article {
        font-size: 1em;
    }
    
    /* Hide post navigation on mobile */
    .post-navigation {
        display: none;
    }
}

/* Post navigation */
.post-navigation {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
    gap: 20px;
}

.post-navigation .nav-link {
    flex: 1;
    text-decoration: none;
    color: #2c3e50;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
    transition: background 0.2s;
}

.post-navigation .nav-link:hover {
    background: #e9ecef;
}

.post-navigation .nav-prev {
    text-align: right;
}

.post-navigation .nav-next {
    text-align: left;
}

.post-navigation .nav-label {
    font-size: 0.85em;
    color: #7f8c8d;
    display: block;
    margin-bottom: 5px;
}

.post-navigation .nav-title {
    font-weight: bold;
    font-size: 1.1em;
}