/* ==========================================================================
   Casper RTL Stylesheet (Persian / Arabic)
   Version: 1.0
   Based on: Casper v1.5.0
   ========================================================================== */

/* --- GLOBAL DIRECTION --- */
html, body {
    direction: rtl;
    unicode-bidi: embed;
    text-align: right;
}

/* --- TYPOGRAPHY --- */
body, html, 
h1, h2, h3, h4, h5, h6,  
.main-nav a,
.subscribe-button,
.page-title,
.post-meta,
.read-next-story .post:before,
.pagination,
.site-footer, time, p, blockquote, ul, ol {
    font-family: Vazirmatn, sans-serif !important;
    letter-spacing: normal;
    line-height: 1.8;
}

/* --- HEADINGS --- */
h2, h3, h4, h5, h6 {
    text-align: right;
}

/* --- LINKS & NAVIGATION --- */
.nav, .site-nav, .nav-menu, .nav ul {
    direction: rtl;
}

.site-nav ul {
    display: flex;
    flex-direction: row-reverse; /* reverse nav item order */
}

.site-nav li {
    margin-right: 0;
    margin-left: 2rem; /* switch spacing */
}

/* --- LOGO & HEADER --- */
.site-header {
    text-align: right;
}

.site-header .site-nav-left {
    order: 2;
}

.site-header .site-nav-right {
    order: 1;
}

/* --- POSTS / CONTENT --- */
.post, .post-content, .post-excerpt {
    text-align: right;
}

.post-meta {
    direction: rtl;
}

.post-meta a, .post-meta time {
    margin-left: 0;
    margin-right: .4rem;
}

/* --- IMAGES & FIGURES --- */
figure {
    direction: rtl;
}
figcaption {
    text-align: right;
}

/* --- PAGINATION --- */
.pagination {
    direction: rtl;
    text-align: center;
}

.pagination .newer-posts {
    float: right;
}

.pagination .older-posts {
    float: left;
}

/* --- FOOTER --- */
.site-footer {
    text-align: right;
    direction: rtl;
}

.site-footer-nav {
    flex-direction: row-reverse;
}

.site-footer-nav li {
    margin-left: 0;
    margin-right: 1.5rem;
}

/* --- FORMS --- */
input[type="text"],
input[type="email"],
textarea {
    text-align: right;
    direction: rtl;
}

/* --- NEWSLETTER / SUBSCRIPTION --- */
.subscribe-form {
    direction: rtl;
    text-align: right;
}
.subscribe-form input {
    text-align: right;
}

/* --- ICONS & ARROWS --- */
svg, .icon {
    transform: scaleX(-1); /* flip icons like arrows */
}

/* prevent flipping for logos or social icons */
.site-logo img,
.social-link svg {
    transform: none !important;
}

/* --- BLOCKQUOTES --- */
blockquote {
    border-right: 4px solid var(--color-border, #ccc);
    border-left: none;
    padding-right: 1rem;
    padding-left: 0;
    text-align: right;
}

/* --- CODE BLOCKS --- */
pre, code {
    direction: ltr;
    text-align: left;
}

/* --- TABLES --- */
table {
    direction: rtl;
}
table th, table td {
    text-align: right;
}

/* --- COMMENTS SECTION (IF ENABLED) --- */
.comment, .comment-content {
    text-align: right;
}

/* --- TOC (Table of Contents) --- */
.gh-toc, .toc-list {
    direction: rtl;
    text-align: right;
}

.gh-form {
    direction: rtl;
    text-align: right;
}

/* --- UTILITY ALIGNMENT --- */
.text-left { text-align: right !important; }
.text-right { text-align: left !important; }

/* --- DARK MODE SUPPORT (OPTIONAL) --- */
@media (prefers-color-scheme: dark) {
    blockquote {
        border-right-color: #444;
    }
}

.icon-heart, .icon-star {
    transform: none !important;
}
