/**
 * Elmin7a Design System - Typography
 * File: public/Website/css/typography.css
 * Typography scale matched to For9a standards using 'IBM Plex Sans Arabic'
 */

/* ─── Base HTML & Body Typography ─────────────────────────────────────────── */
html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

html, body {
    overflow-x: clip;
}

body {
    font-family: var(--font-family-arabic, 'IBM Plex Sans Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    font-size: 1rem;       /* 16px */
    line-height: 1.625;   /* 26px */
    color: #111827;
    background-color: #F8FAFC;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ─── Global Headings Scale (Matched to For9a) ────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-family: inherit;
    color: #111827;
    font-weight: 700;
    line-height: 1.375;
    margin-top: 0;
    margin-bottom: 0.5rem;
}

h1 {
    font-size: 1.5625rem; /* 25px mobile */
    line-height: 1.38;
}
@media (min-width: 768px) {
    h1 {
        font-size: 2rem;  /* 32px desktop */
        line-height: 1.375;
    }
}

h2 {
    font-size: 1.5625rem; /* 25px */
    line-height: 1.625;
}

h3 {
    font-size: 1.25rem;   /* 20px */
    line-height: 1.625;
}

h4 {
    font-size: 1rem;      /* 16px */
    line-height: 1.5;
}

h5 {
    font-size: 0.875rem;  /* 14px */
    line-height: 1.4;
    font-weight: 600;
}

h6 {
    font-size: 0.75rem;   /* 12px */
    line-height: 1.4;
    font-weight: 600;
    color: #4b5563;
}

p {
    margin-top: 0;
    margin-bottom: 1rem;
    line-height: 1.625;
}

/* ─── Typography Utility Classes (For9a Computed Scale) ───────────────────── */
.text-xs   { font-size: 0.75rem !important; line-height: 1rem !important; }       /* 12px */
.text-sm   { font-size: 0.8125rem !important; line-height: 1.25rem !important; }   /* 13px */
.text-base { font-size: 1rem !important; line-height: 1.625rem !important; }      /* 16px */
.text-lg   { font-size: 1.125rem !important; line-height: 1.75rem !important; }   /* 18px */
.text-xl   { font-size: 1.25rem !important; line-height: 1.75rem !important; }    /* 20px */
.text-2xl  { font-size: 1.5625rem !important; line-height: 2.125rem !important; } /* 25px */
.text-3xl  { font-size: 2rem !important; line-height: 2.375rem !important; }     /* 32px */

.font-light     { font-weight: 300 !important; }
.font-normal    { font-weight: 400 !important; }
.font-medium    { font-weight: 500 !important; }
.font-semibold  { font-weight: 600 !important; }
.font-bold      { font-weight: 700 !important; }
.font-extrabold { font-weight: 800 !important; }

/* ─── Brand Colors Helpers ────────────────────────────────────────────────── */
.text-elmin7a-orange { color: #3390A4; }
.bg-elmin7a-orange { background-color: #3390A4; }
.hover-bg-elmin7a-orange:hover { background-color: #d1501a; }
.border-elmin7a-orange { border-color: #3390A4; }

/* ─── Article & Rich Content Styling (Matched to For9a Article Body) ──────── */
.article-content,
.section-editor {
    font-size: 1.125rem; /* 18px */
    line-height: 2.0;    /* 36px */
    color: #222222;
}

.article-content p,
.section-editor p {
    color: #222222;
    line-height: 2.0;
    font-size: 1.125rem;
    margin-top: 15px;
    margin-bottom: 15px;
}

.article-content h1,
.section-editor h1 {
    color: #111827;
    font-weight: 700;
    font-size: 1.5625rem;
    line-height: 1.38;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}
@media (min-width: 768px) {
    .article-content h1,
    .section-editor h1 {
        font-size: 2rem;
        line-height: 1.375;
    }
}

.article-content h2,
.section-editor h2 {
    color: #111827;
    font-weight: 700;
    font-size: 1.5625rem; /* 25px */
    line-height: 1.625;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.article-content h3,
.section-editor h3 {
    color: #111827;
    font-weight: 700;
    font-size: 1.25rem; /* 20px */
    line-height: 1.625;
    margin-top: 1.75rem;
    margin-bottom: 0.75rem;
}

.article-content h4,
.section-editor h4 {
    color: #111827;
    font-weight: 700;
    font-size: 1rem; /* 16px */
    line-height: 1.5;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.article-content ul,
.article-content ol,
.section-editor ul,
.section-editor ol {
    padding-inline-start: 1.5rem;
    margin-top: 1rem;
    margin-bottom: 1.25rem;
}
.article-content ul, .section-editor ul { list-style-type: disc; }
.article-content ol, .section-editor ol { list-style-type: decimal; }

.article-content li,
.section-editor li {
    color: #222222;
    line-height: 1.8;
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}
.article-content li::marker { color: #3390A4; }

.article-content a,
.section-editor a {
    color: #3390A4;
    text-decoration: underline;
    font-weight: 600;
}
.article-content a:hover,
.section-editor a:hover {
    color: #287a8b;
}

.article-content strong, .article-content b,
.section-editor strong, .section-editor b {
    color: #111827;
    font-weight: 700;
}

.article-content blockquote,
.section-editor blockquote {
    border-right: 4px solid #3390A4;
    padding: 1rem 1.25rem;
    background: #f0f9fa;
    border-radius: 0.5rem;
    margin: 1.5rem 0;
}
.article-content blockquote p,
.section-editor blockquote p {
    margin: 0;
    color: #1b505c;
    font-style: italic;
    font-size: 1.05rem;
    line-height: 1.8;
}

.article-content img,
.section-editor img {
    border-radius: 0.75rem;
    max-width: 100%;
    height: auto;
    margin: 1.5rem auto;
}

.article-content table,
.section-editor table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.25rem;
}
.article-content th, .article-content td,
.section-editor th, .section-editor td {
    border: 1px solid #e5e7eb;
    padding: 0.6rem 0.8rem;
    text-align: right;
}
.article-content th,
.section-editor th {
    background: #f9fafb;
    font-weight: 700;
    color: #111827;
}

.article-content hr,
.article-content .wp-block-separator {
    border: none;
    border-top: 2px solid #f3f4f6;
    margin: 2rem 0;
}

/* ─── Prose Arabic Formatting ─────────────────────────────────────────────── */
.prose-arabic h2 {
    color: #111827;
    font-weight: 700;
    margin-top: 2.25rem;
    margin-bottom: 1rem;
    font-size: 1.5625rem; /* 25px */
    line-height: 1.625;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.prose-arabic h2::before {
    content: '';
    display: inline-block;
    width: 5px;
    height: 22px;
    background-color: #3390A4;
    border-radius: 4px;
}
.prose-arabic p {
    color: #222222;
    line-height: 2.0;
    font-size: 1.125rem; /* 18px */
    margin-bottom: 1.25rem;
}
.prose-arabic a {
    color: #3390A4;
    text-decoration: underline;
    font-weight: 600;
    transition: color 0.3s ease;
}
.prose-arabic a:hover {
    color: #287a8b;
}
.prose-arabic ul {
    margin-top: 1rem;
    margin-bottom: 1.5rem;
    padding-inline-start: 1.5rem;
    list-style-type: none;
}
.prose-arabic li {
    color: #222222;
    line-height: 1.8;
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
    position: relative;
    padding-inline-start: 1.5rem;
}
.prose-arabic li::before {
    content: '✓';
    color: #3390A4;
    font-size: 1.1rem;
    position: absolute;
    right: 0;
    top: 0;
    font-weight: bold;
}

/* ─── Scrollbar, Cards & User-Generated Content Fixes ─────────────────────── */
.custom-scrollbar::-webkit-scrollbar { width: 6px; }
.custom-scrollbar::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 8px; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.info-card {
    transition: all 0.3s ease;
}
.info-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
    border-color: #fca5a5;
}

/* TinyMCE & WYSIWYG Fixes */
.prose-arabic table, .article-content table, .prose table {
    width: 100%; margin-bottom: 1.5rem; border-collapse: collapse;
}
.prose-arabic th, .article-content th, .prose th,
.prose-arabic td, .article-content td, .prose td {
    padding: 0.75rem 1rem; border: 1px solid #e2e8f0; text-align: right;
}
.prose-arabic th, .article-content th, .prose th {
    background-color: #f8fafc; font-weight: bold; color: #334155;
}

/* Hide empty tags often generated by WYSIWYG editors */
.prose-arabic h1:empty, .article-content h1:empty, .prose h1:empty, .section-editor h1:empty,
.prose-arabic h2:empty, .article-content h2:empty, .prose h2:empty, .section-editor h2:empty,
.prose-arabic h3:empty, .article-content h3:empty, .prose h3:empty, .section-editor h3:empty,
.prose-arabic h4:empty, .article-content h4:empty, .prose h4:empty, .section-editor h4:empty,
.prose-arabic h5:empty, .article-content h5:empty, .prose h5:empty, .section-editor h5:empty,
.prose-arabic h6:empty, .article-content h6:empty, .prose h6:empty, .section-editor h6:empty,
.prose-arabic p:empty, .article-content p:empty, .prose p:empty, .section-editor p:empty {
    display: none !important;
}
