/* Hebrew Fonts Configuration */

/* Primary Hebrew Font Stack */
@import url('https://fonts.googleapis.com/css2?family=Heebo:wght@100;200;300;400;500;600;700;800;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Hebrew:wght@100;200;300;400;500;600;700;800;900&display=swap');

/* Font Face Definitions */
:root {
  --font-hebrew-primary: 'Heebo', sans-serif;
  --font-hebrew-secondary: 'Noto Sans Hebrew', sans-serif;
  --font-hebrew-fallback: Arial, sans-serif;
  
  /* Complete Hebrew font stack */
  --font-stack-hebrew: 'Heebo', 'Noto Sans Hebrew', 'Arial Hebrew', 'Arial', sans-serif;
  --font-stack-english: 'Inter', 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
}

/* Base Hebrew Typography */
html[lang="he"] {
  font-family: var(--font-stack-hebrew);
  direction: rtl;
}

html[lang="he"] body {
  font-family: var(--font-stack-hebrew);
  font-feature-settings: 
    "kern" 1,     /* Kerning */
    "liga" 1,     /* Ligatures */
    "calt" 1;     /* Contextual alternates */
}

/* Hebrew specific font weights */
.hebrew-thin { font-weight: 100; }
.hebrew-extralight { font-weight: 200; }
.hebrew-light { font-weight: 300; }
.hebrew-regular { font-weight: 400; }
.hebrew-medium { font-weight: 500; }
.hebrew-semibold { font-weight: 600; }
.hebrew-bold { font-weight: 700; }
.hebrew-extrabold { font-weight: 800; }
.hebrew-black { font-weight: 900; }

/* Headings with Hebrew fonts */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-stack-hebrew);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h1 { font-size: 2.5rem; font-weight: 700; }
h2 { font-size: 2rem; font-weight: 600; }
h3 { font-size: 1.75rem; font-weight: 600; }
h4 { font-size: 1.5rem; font-weight: 600; }
h5 { font-size: 1.25rem; font-weight: 600; }
h6 { font-size: 1rem; font-weight: 600; }

/* Paragraph and body text */
p, .text-body {
  font-family: var(--font-stack-hebrew);
  font-weight: 400;
  line-height: 1.6;
}

/* Form elements with Hebrew fonts */
.form-control,
.form-select,
.form-check-label,
.form-floating label {
  font-family: var(--font-stack-hebrew);
}

/* Button text */
.btn {
  font-family: var(--font-stack-hebrew);
  font-weight: 500;
}

/* Navigation */
.navbar-brand,
.nav-link {
  font-family: var(--font-stack-hebrew);
}

/* Card content */
.card-title {
  font-family: var(--font-stack-hebrew);
  font-weight: 600;
}

.card-text {
  font-family: var(--font-stack-hebrew);
  font-weight: 400;
}

/* Table content */
table {
  font-family: var(--font-stack-hebrew);
}

/* Numbers and dates in Hebrew context */
.hebrew-numbers {
  font-feature-settings: "lnum" 1; /* Lining numbers */
  font-variant-numeric: lining-nums;
}

/* Hebrew text utilities */
.text-hebrew {
  font-family: var(--font-stack-hebrew);
  direction: rtl;
  text-align: right;
}

.text-english {
  font-family: var(--font-stack-english);
  direction: ltr;
  text-align: left;
}

/* Medical/Scientific terms might need English fonts */
.medical-term {
  font-family: var(--font-stack-english);
  direction: ltr;
  display: inline-block;
}

/* Responsive typography */
@media (max-width: 768px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.75rem; }
  h3 { font-size: 1.5rem; }
  h4 { font-size: 1.25rem; }
  h5 { font-size: 1.1rem; }
  h6 { font-size: 1rem; }
  
  body {
    font-size: 0.95rem;
  }
}

@media (max-width: 576px) {
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }
  h4 { font-size: 1.1rem; }
  
  body {
    font-size: 0.9rem;
  }
}

/* Print styles for Hebrew fonts */
@media print {
  * {
    font-family: var(--font-stack-hebrew) !important;
  }
}

/* Font loading optimization */
.font-loading {
  font-display: swap;
}

/* Fallback for systems without Hebrew fonts */
@supports not (font-feature-settings: "kern") {
  body {
    font-family: Arial, sans-serif;
  }
}

/* RTL specific adjustments */
[dir="rtl"] {
  /* Fix punctuation and quotation marks for Hebrew */
  quotes: '"' '"' "'" "'";
}

[dir="rtl"] .text-start {
  text-align: right !important;
}

[dir="rtl"] .text-end {
  text-align: left !important;
}

/* Hebrew font size adjustments for better readability */
.display-1 { font-size: 5rem; font-weight: 300; }
.display-2 { font-size: 4.5rem; font-weight: 300; }
.display-3 { font-size: 4rem; font-weight: 300; }
.display-4 { font-size: 3.5rem; font-weight: 300; }
.display-5 { font-size: 3rem; font-weight: 300; }
.display-6 { font-size: 2.5rem; font-weight: 300; }

/* Lead text */
.lead {
  font-size: 1.25rem;
  font-weight: 300;
  line-height: 1.6;
}

/* Small text */
small, .small {
  font-size: 0.875rem;
  font-weight: 400;
}

/* Code and pre elements */
code, pre {
  font-family: 'Courier New', monospace;
  direction: ltr;
}