/* ==========================================================
   USTAD (ustadpk.com) - Modern Educational Design System
   Tailwind-Powered Utility Typography & Urdu Nastaliq Engine
   Developed by Muhammad Asim
   ========================================================== */

:root {
    --brand-primary: #1e3a8a;
    --brand-accent: #059669;
    --brand-gold: #d97706;
    --brand-dark: #0f172a;
    --font-en: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-urdu: 'Jameel Noori Nastaleeq', serif;
}

body {
    font-family: var(--font-en);
    background-color: #f8fafc;
    color: #1e293b;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================
   URDU TYPOGRAPHY & RTL STYLING
   ========================================================== */
.urdu,
.nastaliq,
[lang="ur"],
.urdu-content {
    font-family: var(--font-urdu) !important;
    direction: rtl;
    text-align: right;
    line-height: 2.3 !important;
    font-size: 1.15rem;
}

[lang="ur"], [dir="rtl"] {
    font-family: var(--font-urdu);
    unicode-bidi: plaintext;
}

.post-content [lang="ur"],
.post-content .urdu-content {
    direction: rtl;
    text-align: right;
    line-height: 2.35;
}

.urdu-title {
    font-family: var(--font-urdu) !important;
    direction: rtl;
    line-height: 2.0 !important;
    font-weight: 700;
}

.urdu-heading {
    font-family: var(--font-urdu) !important;
    direction: rtl;
    line-height: 2.1 !important;
    font-weight: 700;
    border-right: 4px solid #059669;
    padding-right: 12px;
}

/* Give category titles and descriptions room to wrap and breathe. */
.category-page {
    word-spacing: 0.06em;
}

.category-page :is(h1, h2, h3, h4) {
    letter-spacing: normal;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.category-page p {
    line-height: 1.85;
}

.category-page .urdu-title,
.category-page .urdu {
    word-spacing: 0.12em;
    letter-spacing: normal;
}

.category-page h3.truncate {
    white-space: normal;
    overflow: visible;
}

.category-subcategory-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 48px;
    padding: 0.75rem 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.75;
    color: #334155;
    overflow-wrap: anywhere;
}

.category-subcategory-link:hover,
.category-subcategory-link:focus-visible {
    background: #eff6ff;
    color: #2563eb;
}

.category-subcategory-link:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.category-subcategory-link .bi {
    flex-shrink: 0;
}

/* Reading Progress Bar */
#reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3.5px;
    background: linear-gradient(90deg, #2563eb, #059669, #f59e0b);
    width: 0%;
    z-index: 9999;
    transition: width 0.1s ease-out;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* KaTeX Formula Display */
.katex-display {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin: 16px 0;
}

/* Single Post Content Styling */
.post-title {
    font-size: clamp(1.25rem, 1rem + 1vw, 1.5rem);
    line-height: 1.5;
    letter-spacing: normal;
    overflow-wrap: anywhere;
}
.post-content {
    color: #334155;
    font-size: 0.9375rem;
    line-height: 1.85;
}
.post-content :is(.urdu, .nastaliq, [lang="ur"], .urdu-content) {
    font-size: 1rem;
    word-spacing: 0.08em;
}
.post-content h1, 
.post-content h2, 
.post-content h3, 
.post-content h4 {
    color: #0f172a;
    font-weight: 700;
    margin-top: 1.75rem;
    margin-bottom: 0.85rem;
    line-height: 1.4;
}
.post-content h1 { font-size: 1.375rem; }
.post-content h2 { font-size: 1.25rem; border-bottom: 2px solid #e2e8f0; padding-bottom: 0.4rem; }
.post-content h3 { font-size: 1.125rem; }
.post-content h4 { font-size: 1rem; }
.post-content p { margin-bottom: 1.25rem; }
.post-content ul, .post-content ol { margin-bottom: 1.25rem; padding-left: 1.5rem; }
.post-content li { margin-bottom: 0.4rem; }
.post-content img { border-radius: 12px; max-width: 100%; height: auto; margin: 1.5rem auto; box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.post-content table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; font-size: 0.95rem; }
.post-content table th, .post-content table td { border: 1px solid #e2e8f0; padding: 10px 14px; text-align: left; }
.post-content table th { background: #f1f5f9; font-weight: 700; color: #0f172a; }
.post-content blockquote { border-left: 4px solid #3b82f6; background: #eff6ff; padding: 12px 18px; margin: 1.5rem 0; border-radius: 0 8px 8px 0; font-style: italic; }

/* Print Media Optimization */
.category-banner { background: #eff6ff; border-bottom-color: #bfdbfe; }
.category-panel { background: #f0fdfa; border-color: #99f6e4; }
.category-panel ~ .category-panel { background: #fffbeb; border-color: #fde68a; }
.colour-card { border-left: 4px solid #3b82f6; background: #eff6ff; }
.colour-card:nth-child(4n + 2) { border-left-color: #10b981; background: #ecfdf5; }
.colour-card:nth-child(4n + 3) { border-left-color: #f59e0b; background: #fffbeb; }
.colour-card:nth-child(4n + 4) { border-left-color: #8b5cf6; background: #f5f3ff; }
.job-list { display: flex; flex-direction: column; gap: 1rem; }
.job-list .job-list-item { width: 100%; padding: 1.25rem; }
.job-list h4 { font-size: 1rem; }
.job-meta { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; margin: 0.75rem 0; font-size: 0.8125rem; color: #475569; }

/* Print Media Optimization */
@media print {
    .no-print, header, nav, footer, .sidebar, #reading-progress, .btn, form {
        display: none !important;
    }
    body {
        background: #ffffff !important;
        color: #000000 !important;
    }
    .print-card {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
    }
}
