/* ==========================================================================
   CARD TYPOGRAPHY - Beautiful Persian/English Fonts
   Professional font system for cards across all devices and browsers
   ========================================================================== */

/* ==========================================================================
   OPTIMAL FONT STACK STRATEGY FOR PERSIAN/ENGLISH
   
   Approach: Progressive Enhancement with Web Fonts + System Fallbacks
   
   1. Self-Hosted Web Fonts (Best approach - RECOMMENDED)
   2. Google Fonts CDN (Current approach - Good fallback)
   3. System Fonts (Ultimate fallback - Always works)
   ========================================================================== */

/* ==========================================================================
   CARD TITLES - All Card Types (Profile & Explore)
   Beautiful, readable headings for Persian and English
   ========================================================================== */

.cards-grid .card-title,
.cards-grid h6.card-title,
.cards-grid h5.card-title,
.cards-grid .cards-grid__post-card__title,
.cards-grid .unified-card .card-title,
.cards-grid .post-card .card-title,
.cards-grid .study-card .card-title,
.cards-grid .publication-card .card-title,
.cards-grid .review-title-text,
.study-title-overlay,
/* EXPLORE PAGE CARDS */
.explore-card .card-title,
.explore-card h6.card-title,
.explore-card h5.card-title,
.explore-card .study-title-overlay,
.explore-card .review-title-text,
.explore-card-wrapper .card-title,
.explore-card-wrapper .study-title-overlay,
.explore-card-wrapper .review-title-text {
    /* Persian-optimized font stack */
    font-family: 
        /* Web fonts (if loaded) */
        'Vazirmatn', 'Vazir', 'Estedad',
        /* Google Fonts fallback */
        'Noto Sans Arabic', 'Noto Sans',
        /* High-quality system fonts */
        'Segoe UI', 'Tahoma', 'Arial',
        /* Ultimate fallback */
        sans-serif !important;
    
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: -0.01em;
    
    /* OpenType features for better rendering */
    font-feature-settings: "liga" 1, "kern" 1, "calt" 1;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   CARD SUBTITLES - Secondary Information (Profile & Explore)
   Lighter weight for hierarchy
   ========================================================================== */

.cards-grid .card-subtitle,
.cards-grid p.card-subtitle,
.cards-grid .cards-grid__post-card__subtitle,
.cards-grid .unified-card .card-subtitle,
.cards-grid .post-card .card-subtitle,
.cards-grid .study-card .card-subtitle,
/* EXPLORE PAGE CARDS */
.explore-card .card-subtitle,
.explore-card p.card-subtitle,
.explore-card-wrapper .card-subtitle {
    font-family: 
        'Vazirmatn', 'Vazir', 'Estedad',
        'Noto Sans Arabic', 'Noto Sans',
        'Segoe UI', 'Tahoma', 'Arial',
        sans-serif !important;
    
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: 0;
    
    font-feature-settings: "liga" 1, "kern" 1;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   CARD BODY TEXT - Content Preview (Profile & Explore)
   Optimized for readability in small spaces
   ========================================================================== */

.cards-grid .card-text,
.cards-grid p.card-text,
.cards-grid .cards-grid__post-card__text,
.cards-grid .unified-card .card-text,
.cards-grid .post-card .card-text,
.cards-grid .study-card .card-text,
.cards-grid .card-body,
.cards-grid .unified-card .card-body,
.cards-grid .study-card .card-body,
.cards-grid .publication-card .card-body,
.cards-grid .cards-grid__post-card__body,
/* EXPLORE PAGE CARDS */
.explore-card .card-text,
.explore-card p.card-text,
.explore-card-wrapper .card-text,
.explore-card .card-body,
.explore-card-wrapper .card-body {
    font-family: 
        'Vazirmatn', 'Vazir', 'Estedad',
        'Noto Sans Arabic', 'Noto Sans',
        'Segoe UI', 'Tahoma', 'Arial',
        sans-serif;
    
    font-weight: 400;
    line-height: 1.6;
    letter-spacing: 0.01em;
    
    font-feature-settings: "liga" 1, "kern" 1;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   REVIEW CARD SPECIFIC TYPOGRAPHY (Profile & Explore)
   ========================================================================== */

/* CRITICAL: Force Vazirmatn on review titles regardless of lang attribute */
.cards-grid .review-card .review-header h5,
.cards-grid .new-review-card .review-header h5,
.cards-grid .review-header .review-title-text,
.cards-grid .review-title-text,
/* EXPLORE PAGE REVIEW CARDS */
.explore-card .review-card .review-header h5,
.explore-card .new-review-card .review-header h5,
.explore-card .review-header .review-title-text,
.explore-card .review-title-text,
.explore-card-wrapper .review-title-text,
.explore-card-wrapper .review-header h5 {
    font-family: 'Vazirmatn', 'Noto Sans Arabic', 'Tahoma', sans-serif !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    
    font-feature-settings: "liga" 1, "kern" 1, "calt" 1;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Auto direction for profile/explore card titles (dir set by review-text-direction.js) */
.cards-grid .card-title[dir="rtl"],
.cards-grid .review-title-text[dir="rtl"],
.cards-grid .cards-grid__post-card__title[dir="rtl"],
.explore-card .card-title[dir="rtl"],
.explore-card .review-title-text[dir="rtl"],
.explore-card-wrapper .card-title[dir="rtl"],
.explore-card-wrapper .review-title-text[dir="rtl"],
#exploreFeed .card-title[dir="rtl"],
#exploreFeed .review-title-text[dir="rtl"] {
    direction: rtl !important;
    text-align: right !important;
}

.cards-grid .card-title[dir="ltr"],
.cards-grid .review-title-text[dir="ltr"],
.cards-grid .cards-grid__post-card__title[dir="ltr"],
.explore-card .card-title[dir="ltr"],
.explore-card .review-title-text[dir="ltr"],
.explore-card-wrapper .card-title[dir="ltr"],
.explore-card-wrapper .review-title-text[dir="ltr"],
#exploreFeed .card-title[dir="ltr"],
#exploreFeed .review-title-text[dir="ltr"] {
    direction: ltr !important;
    text-align: left !important;
}

/* REMOVED: Font styling from review card body - let it use default system fonts */
/* User request: Fonts should NOT be applied to review card body content */

/* ==========================================================================
   LANGUAGE-SPECIFIC OPTIMIZATIONS
   Automatic font selection based on content language
   ========================================================================== */

/* Persian/Farsi Content */
.cards-grid [lang="fa"],
.cards-grid [lang="fa-IR"],
.cards-grid [dir="rtl"] {
    font-family: 
        'Vazirmatn', 'Vazir', 'Estedad',
        'Noto Sans Arabic', 'Scheherazade New',
        'Tahoma', 'Arial',
        sans-serif;
    direction: rtl;
    text-align: right;
}

/* Arabic Content */
.cards-grid [lang="ar"],
.cards-grid [lang="ar-SA"] {
    font-family: 
        'Noto Sans Arabic', 'Amiri', 'Scheherazade New',
        'Arabic Typesetting', 'Tahoma', 'Arial',
        sans-serif;
    direction: rtl;
    text-align: right;
}

/* English/Latin Content */
.cards-grid [lang="en"],
.cards-grid [dir="ltr"] {
    font-family: 
        'Inter', 'Segoe UI', 'Roboto', 'Helvetica Neue',
        'Arial', sans-serif;
    direction: ltr;
    text-align: left;
}

/* ==========================================================================
   DETAIL PAGE TYPOGRAPHY (Study, Publication, Post Details)
   Applied to detail pages with full content views
   ========================================================================== */

/* Detail page card titles */
.container .card .card-body h4.card-title,
.container .card-body h4.card-title,
.card h4.card-title,
h4.card-title {
    font-family: 
        'Vazirmatn', 'Vazir', 'Estedad',
        'Noto Sans Arabic', 'Noto Sans',
        'Segoe UI', 'Tahoma', 'Arial',
        sans-serif !important;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: -0.01em;
}

/* Detail page text-muted paragraphs */
.container .card .card-body p.text-muted,
.container .card-body p.text-muted,
.card-body p.text-muted,
p.text-muted {
    font-family: 
        'Vazirmatn', 'Vazir', 'Estedad',
        'Noto Sans Arabic', 'Noto Sans',
        'Segoe UI', 'Tahoma', 'Arial',
        sans-serif;
    font-weight: 400;
    line-height: 1.6;
}

/* Detail page strong elements (authors, publishers, etc.) */
.container .card .card-body strong,
.container .card-body strong,
.card-body strong,
.row strong,
strong {
    font-family: 
        'Vazirmatn', 'Vazir', 'Estedad',
        'Noto Sans Arabic', 'Noto Sans',
        'Segoe UI', 'Tahoma', 'Arial',
        sans-serif;
    font-weight: 600;
}

/* ==========================================================================
   REVIEW DETAIL PAGE TYPOGRAPHY
   ========================================================================== */

/* Review detail page title (h2.review-title-inline) */
.review-header-card h2.review-title-inline,
h2.review-title-inline,
.review-title-inline {
    font-family: 
        'Vazirmatn', 'Vazir', 'Estedad',
        'Noto Sans Arabic', 'Noto Sans',
        'Segoe UI', 'Tahoma', 'Arial',
        sans-serif !important;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

/* Review author link (inside .review-by) */
.review-by a,
.review-by strong a,
.review-header-inline .review-by a,
a.text-decoration-none.text-dark {
    font-family: 
        'Vazirmatn', 'Vazir', 'Estedad',
        'Noto Sans Arabic', 'Noto Sans',
        'Segoe UI', 'Tahoma', 'Arial',
        sans-serif;
    font-weight: 600;
}

/* Review info section text (external work details) */
.review-info-section p.text-muted,
.external-work-details-section p.text-muted,
.external-work-card p.text-muted,
p.text-muted.small {
    font-family: 
        'Vazirmatn', 'Vazir', 'Estedad',
        'Noto Sans Arabic', 'Noto Sans',
        'Segoe UI', 'Tahoma', 'Arial',
        sans-serif;
    font-weight: 400;
    line-height: 1.6;
}

/* ==========================================================================
   PUBLICATION DETAIL PAGE TYPOGRAPHY
   ========================================================================== */

/* Publication detail page title (h1.publication-title) */
.publication-header h1.publication-title,
h1.publication-title,
.publication-title {
    font-family: 
        'Vazirmatn', 'Vazir', 'Estedad',
        'Noto Sans Arabic', 'Noto Sans',
        'Segoe UI', 'Tahoma', 'Arial',
        sans-serif !important;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

/* Publication author name */
.publication-author a strong,
.publication-author strong,
p.publication-author a strong,
p.publication-author strong {
    font-family: 
        'Vazirmatn', 'Vazir', 'Estedad',
        'Noto Sans Arabic', 'Noto Sans',
        'Segoe UI', 'Tahoma', 'Arial',
        sans-serif;
    font-weight: 600;
}

/* Publication info content (language, genre, etc.) */
.complete-book-info-section .info-card .info-content span,
.book-info-grid .info-card .info-content span,
.info-card .info-content span,
.info-content span {
    font-family: 
        'Vazirmatn', 'Vazir', 'Estedad',
        'Noto Sans Arabic', 'Noto Sans',
        'Segoe UI', 'Tahoma', 'Arial',
        sans-serif;
    font-weight: 400;
    line-height: 1.5;
}

/* Publication description content */
.publication-description .description-content,
.publication-main-content .description-content,
.description-content {
    font-family: 
        'Vazirmatn', 'Vazir', 'Estedad',
        'Noto Sans Arabic', 'Noto Sans',
        'Segoe UI', 'Tahoma', 'Arial',
        sans-serif;
    font-weight: 400;
    line-height: 1.8;
    letter-spacing: 0.01em;
    
    /* Text justification - language-aware */
    text-align: justify;
    text-align-last: right; /* Default for Persian RTL */
    direction: rtl; /* Default for Persian */
}

/* English paragraphs in description content */
.description-content[lang="en"],
.description-content[dir="ltr"],
.description-content p[lang="en"],
.description-content p[dir="ltr"] {
    text-align: justify;
    text-align-last: left; /* For English LTR */
    direction: ltr;
}

/* Persian paragraphs in description content */
.description-content[lang="fa"],
.description-content[dir="rtl"],
.description-content p[lang="fa"],
.description-content p[dir="rtl"] {
    text-align: justify;
    text-align-last: right; /* For Persian RTL */
    direction: rtl;
}

/* ==========================================================================
   PUBLICATION DETAIL PAGE - REVIEW CARDS SECTION
   ========================================================================== */

/* Review cards in publication detail page */
.reviews-of-my-books-section .simple-review-card .simple-review-title,
.reviews-of-my-books-section h6.simple-review-title,
.recent-reviews-list .simple-review-title,
.simple-review-title {
    font-family: 
        'Vazirmatn', 'Vazir', 'Estedad',
        'Noto Sans Arabic', 'Noto Sans',
        'Segoe UI', 'Tahoma', 'Arial',
        sans-serif !important;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: -0.01em;
}

/* Reviewer username in review cards */
.reviews-of-my-books-section .simple-review-username-link,
.reviews-of-my-books-section .simple-review-username-text,
.recent-reviews-list .simple-review-username-link,
.recent-reviews-list .simple-review-username-text,
.simple-review-username-link,
.simple-review-username-text {
    font-family: 
        'Vazirmatn', 'Vazir', 'Estedad',
        'Noto Sans Arabic', 'Noto Sans',
        'Segoe UI', 'Tahoma', 'Arial',
        sans-serif;
    font-weight: 500;
}

/* Review labels */
.reviews-of-my-books-section .simple-review-label,
.recent-reviews-list .simple-review-label,
.simple-review-label {
    font-family: 
        'Vazirmatn', 'Vazir', 'Estedad',
        'Noto Sans Arabic', 'Noto Sans',
        'Segoe UI', 'Tahoma', 'Arial',
        sans-serif;
    font-weight: 400;
    font-size: 0.875rem;
}

/* ==========================================================================
   POST DETAIL PAGE TYPOGRAPHY
   ========================================================================== */

/* Post detail page title (h1.h3 in card-header) */
article.card .card-header h1.h3,
article.card .card-header h1,
.card-header h1.h3,
h1.h3 {
    font-family: 
        'Vazirmatn', 'Vazir', 'Estedad',
        'Noto Sans Arabic', 'Noto Sans',
        'Segoe UI', 'Tahoma', 'Arial',
        sans-serif !important;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

/* Post detail page content (article card-body) */
article.card .card-body,
article .card-body {
    font-family: 
        'Vazirmatn', 'Vazir', 'Estedad',
        'Noto Sans Arabic', 'Noto Sans',
        'Segoe UI', 'Tahoma', 'Arial',
        sans-serif;
    font-weight: 400;
    line-height: 1.8;
    letter-spacing: 0.01em;
}

/* ==========================================================================
   RESPONSIVE FONT ADJUSTMENTS
   ========================================================================== */

/* Desktop - Optimal reading size */
@media (min-width: 1200px) {
    .cards-grid .card-title {
        font-size: 1rem;
        line-height: 1.4;
    }
    
    .cards-grid .card-subtitle,
    .cards-grid .card-text {
        font-size: 0.875rem;
        line-height: 1.6;
    }
}

/* Tablet - Balanced sizing */
@media (min-width: 769px) and (max-width: 1199px) {
    .cards-grid .card-title {
        font-size: 0.9375rem;
        line-height: 1.4;
    }
    
    .cards-grid .card-subtitle,
    .cards-grid .card-text {
        font-size: 0.8125rem;
        line-height: 1.55;
    }
}

/* Mobile - Already defined in _mobile.css */
/* Inherits from mobile.css rules */

/* ==========================================================================
   FONT WEIGHT VARIATIONS FOR BETTER HIERARCHY
   ========================================================================== */

.cards-grid .card-title strong,
.cards-grid .card-title b {
    font-weight: 700;
}

.cards-grid .card-subtitle em,
.cards-grid .card-subtitle i {
    font-style: italic;
    font-weight: 400;
}

/* ==========================================================================
   ENHANCED TEXT RENDERING
   ========================================================================== */

/* Better text rendering for small sizes */
.cards-grid * {
    /* Subpixel antialiasing */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    
    /* Kerning and ligatures */
    text-rendering: optimizeLegibility;
    font-kerning: normal;
    
    /* Direction and alignment handled automatically */
    unicode-bidi: isolate;
}

/* ==========================================================================
   ACCESSIBILITY ENHANCEMENTS
   ========================================================================== */

/* High contrast mode */
@media (prefers-contrast: high) {
    .cards-grid .card-title,
    .cards-grid .card-subtitle,
    .cards-grid .card-text {
        font-weight: 600;
        letter-spacing: 0.02em;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .cards-grid * {
        transition: none !important;
        animation: none !important;
    }
}

/* ==========================================================================
   FALLBACK FONT LOADING
   Ensures fonts work even if web fonts fail
   ========================================================================== */

/* Detect if web fonts failed to load */
.fonts-failed .cards-grid .card-title,
.fonts-failed .cards-grid .card-subtitle,
.fonts-failed .cards-grid .card-text {
    font-family: 'Segoe UI', 'Tahoma', 'Arial', sans-serif !important;
}

/* Detect if Persian fonts failed */
.persian-fonts-failed .cards-grid [lang="fa"],
.persian-fonts-failed .cards-grid [dir="rtl"] {
    font-family: 'Tahoma', 'Arial Unicode MS', 'Arial', sans-serif !important;
}

/* ==========================================================================
   DARK MODE SUPPORT
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .cards-grid .card-title {
        color: #f7fafc;
    }
    
    .cards-grid .card-subtitle,
    .cards-grid .card-text {
        color: #e2e8f0;
    }
}

