/* Enhanced AbyssinicaSIL Font Face Declarations for Geez/Tigrinya Support */
/* Version 2 - Enhanced targeting and specificity */

/* Load Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Ethiopic&display=swap');

/* Abyssinica SIL */
@font-face {
    font-family: 'AbyssinicaSIL';
    src: url('./files/AbyssinicaSIL-Regular.woff2') format('woff2'),
         url('./files/AbyssinicaSIL-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
    unicode-range: U+1200-137F, U+1380-139F, U+2D80-2DDF;
}

/* Nyala */
@font-face {
    font-family: 'Nyala';
    src: url('./files/Nyala.woff2') format('woff2'),
         url('./files/Nyala.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
    unicode-range: U+1200-137F, U+1380-139F, U+2D80-2DDF;
}

/* Jiret */
@font-face {
    font-family: 'Jiret';
    src: url('./files/Jiret.woff2') format('woff2'),
         url('./files/Jiret.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
    unicode-range: U+1200-137F, U+1380-139F, U+2D80-2DDF;
}

/* COMPREHENSIVE GEEZ TEXT TARGETING - High Specificity */

/* 1. PAGE TITLES AND HEADINGS */
html, body,
p, span, div, li, a,
h1, h2, h3, h4, h5, h6,
strong, em, td, th, input, textarea {
  font-family: 'AbyssinicaSIL', 'Noto Sans Ethiopic',
               'Nyala', 'Ebrima', sans-serif !important;
}

html body .geez-text,
.ld-quiz-actions .geez-text,
.wpProQuiz_content .geez-text {
  font-family: 'AbyssinicaSIL', 'Noto Sans Ethiopic',
               'Nyala', 'Ebrima', sans-serif !important;
}

/* 2. LESSON TITLES - Critical Missing Element */
.ld-lesson-title,
div.ld-lesson-title,
.ld-lesson-title *,
.ld-lesson-title a,
.ld-lesson-title span {
    font-family: 'AbyssinicaSIL', 'Noto Sans Ethiopic', 'Nyala', 'Ebrima', sans-serif !important;
}

/* 3. BREADCRUMB NAVIGATION */
.ld-breadcrumbs-segments,
.ld-breadcrumbs-segments a,
.ld-breadcrumbs-segments span,
.ld-breadcrumbs-segments * {
    font-family: 'AbyssinicaSIL', 'Noto Sans Ethiopic', 'Nyala', 'Ebrima', sans-serif !important;
}

/* 4. TRANSLATION DATA ATTRIBUTES - Enhanced Targeting */
[data-translation],
*[data-translation],
p[data-translation],
span[data-translation],
div[data-translation] {
    font-family: 'AbyssinicaSIL', 'Noto Sans Ethiopic', 'Nyala', 'Ebrima', sans-serif !important;
}

/* 5. TRANSLATION BUTTONS AND LINKS */
.see-translation,
p.see-translation,
span.see-translation,
.see-answer-translation,
span.see-answer-translation,
.see-translation *,
.see-answer-translation * {
    font-family: 'AbyssinicaSIL', 'Noto Sans Ethiopic', 'Nyala', 'Ebrima', sans-serif !important;
    font-size: 12px !important;
    line-height: 1.4 !important;
}

/* 6. TRANSLATION TEXT CONTAINERS - Hidden Explanations */
.translation-text,
div.translation-text,
.translation-text.cans,
.translation-text.incans,
div.translation-text.cans,
div.translation-text.incans,
.translation-text *,
.translation-text.cans *,
.translation-text.incans * {
    font-family: 'AbyssinicaSIL', 'Noto Sans Ethiopic', 'Nyala', 'Ebrima', sans-serif !important;
    font-size: 16px !important;
    line-height: 1.6 !important;
    display: block !important;
}

/* 7. QUIZ RESPONSE TRANSLATIONS */
.wpProQuiz_response .translation-text,
.wpProQuiz_response div.translation-text,
.wpProQuiz_response .translation-text *,
.wpProQuiz_AnswerMessage .translation-text,
.wpProQuiz_AnswerMessage div.translation-text {
    font-family: 'AbyssinicaSIL', 'Noto Sans Ethiopic', 'Nyala', 'Ebrima', sans-serif !important;
    font-size: 1.2rem !important;
    line-height: 1.7 !important;
}

/* 8. COURSE NAVIGATION LINKS */
#ld-focus-mode-course-heading,
#ld-focus-mode-course-heading span,
#ld-focus-mode-course-heading a,
a[href*="nl%e1%89%b5%e1%8c%8d"],
a[href*="ትግ"] {
    font-family: 'AbyssinicaSIL', 'Noto Sans Ethiopic', 'Nyala', 'Ebrima', sans-serif !important;
}

/* 9. UNIVERSAL GEEZ CHARACTER DETECTION */
/* Target any element containing Geez characters */
*:lang(ti),
*:lang(am),
*:lang(gez),
*[lang="ti"],
*[lang="am"],
*[lang="gez"] {
    font-family: 'AbyssinicaSIL', 'Noto Sans Ethiopic', 'Nyala', 'Ebrima', sans-serif !important;
}

/* 10. CONTENT-BASED TARGETING - Elements containing Geez text */
/* This uses CSS content selectors to target elements with Geez characters */
body *:not(script):not(style):not(head):not(meta):not(link) {
    font-family: inherit;
}

/* Force font for any text containing specific Geez characters */
body *[class*="translation"],
body *[id*="translation"],
body *[data-translation],
body *[class*="geez"],
body *[class*="tigrinya"],
body *[class*="ethiopic"] {
    font-family: 'AbyssinicaSIL', 'Noto Sans Ethiopic', 'Nyala', 'Ebrima', sans-serif !important;
}

/* 11. LEARNDASH SPECIFIC ELEMENTS */
.learndash-wrapper,
.learndash-wrapper *,
.ld-course-navigation,
.ld-course-navigation *,
.ld-lesson-list,
.ld-lesson-list *,
.ld-lesson-item,
.ld-lesson-item * {
    font-family: inherit;
}

/* But override for elements with Geez text */
.learndash-wrapper .ld-lesson-title,
.learndash-wrapper .ld-lesson-title *,
.ld-course-navigation .ld-lesson-title,
.ld-lesson-list .ld-lesson-title,
.ld-lesson-item .ld-lesson-title {
    font-family: 'AbyssinicaSIL', 'Noto Sans Ethiopic', 'Nyala', 'Ebrima', sans-serif !important;
}

/* 12. MAXIMUM SPECIFICITY OVERRIDE */
/* Nuclear option - highest possible specificity */
html body div.ld-lesson-title,
html body span.see-translation,
html body span.see-answer-translation,
html body div.translation-text,
html body div.translation-text.cans,
html body div.translation-text.incans,
html body p.see-translation,
html body [data-translation] {
    font-family: 'AbyssinicaSIL', 'Noto Sans Ethiopic', 'Nyala', 'Ebrima', sans-serif !important;
    font-feature-settings: "liga" 1, "calt" 1 !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
}

/* 13. IMPROVED STYLING FOR BETTER READABILITY */
.see-translation,
.see-answer-translation {
    border: 1px solid #ccc !important;
    padding: 2px 10px !important;
    margin: 0 5px !important;
    border-radius: 1em !important;
    background-color: #f9f9f9 !important;
    color: #333 !important;
    text-decoration: none !important;
    font-weight: 400 !important;
    font-size: 11px !important;
    display: inline-block !important;
    font-family: 'AbyssinicaSIL', 'Noto Sans Ethiopic', 'Nyala', 'Ebrima', sans-serif !important;
}

/* 14. RESPONSIVE DESIGN */
@media (max-width: 768px) {
    .translation-text,
    .translation-text.cans,
    .translation-text.incans,
    .ld-lesson-title {
        font-size: 14px !important;
    }
    
    .wpProQuiz_response .translation-text {
        font-size: 1.1rem !important;
    }
    
    .see-translation,
    .see-answer-translation {
        font-size: 10px !important;
        padding: 1px 8px !important;
    }
}

/* 15. DEBUGGING - Temporary highlighting (remove after testing) */
/*
.ld-lesson-title {
    border: 2px solid red !important;
}
[data-translation] {
    border: 2px solid blue !important;
}
.translation-text {
    border: 2px solid green !important;
}
*/

/* 16. FONT LOADING OPTIMIZATION */
.geez-text,
.tigrinya-text,
.ethiopic-text,
.ld-lesson-title,
.translation-text,
.see-translation,
.see-answer-translation,
[data-translation] {
    font-display: swap !important;
    text-rendering: optimizeLegibility !important;
}

/* 17. FALLBACK FONT CHAIN ENHANCEMENT */
/* Ensure proper fallback for all targeted elements */
body {
    font-family: 'Poppins', Arial, sans-serif;
}

/* But for Geez-containing elements, prioritize Geez fonts */
.ld-lesson-title,
[data-translation],
.translation-text,
.see-translation,
.see-answer-translation,
.translation-text.cans,
.translation-text.incans {
    font-family: 'AbyssinicaSIL', 'Noto Sans Ethiopic', 'Nyala', 'Ebrima', 'Kefa', 'Lucida Grande', Arial, sans-serif !important;
}