/*
 * One typography for the whole site, loaded last on every page (ReferenceSiteController::finish).
 * Before, each hand-made page had its own heading fonts and sizes (H1 in 3 fonts from 52 to 89px, H2 in 3 fonts
 * from 26 to 46px, H3 in 3 fonts from 15 to 28px). Colours are left to each block (white on dark backgrounds).
 *
 *   Page title (h1)             Playfair Display 400   56px → 36px   normal case
 *   Section title (h2)          Playfair Display 400   40px → 28px   normal case
 *   Sub-section title           Playfair Display 400   28px → 22px   (governance groups, accordion levels)
 *   Card / item title (h3)      Inter 600              19px          normal case
 *   Small label (eyebrow)       Inter 700              12.5px        uppercase, letter-spaced
 *   Text                        Inter 400              16–17px
 *
 * !important is used on purpose: page stylesheets set headings with more specific selectors
 * (e.g. ".program-hero h1"); this layer must win everywhere without editing each of them.
 */
:root {
  --type-display: "Playfair Display", Georgia, "Times New Roman", serif;
  --type-text: Inter, "Helvetica Neue", Arial, sans-serif;
  --type-h1: clamp(2.25rem, 1.3rem + 3vw, 3.5rem);
  --type-h2: clamp(1.75rem, 1.2rem + 1.7vw, 2.5rem);
  --type-h2-sub: clamp(1.375rem, 1.1rem + 0.9vw, 1.75rem);
  --type-h3: 1.1875rem;
}

main h1 {
  font-family: var(--type-display) !important;
  font-weight: 400 !important;
  font-size: var(--type-h1) !important;
  line-height: 1.1 !important;
  letter-spacing: -0.01em !important;
  text-transform: none !important;
}

main h2 {
  font-family: var(--type-display) !important;
  font-weight: 400 !important;
  font-size: var(--type-h2) !important;
  line-height: 1.15 !important;
  letter-spacing: -0.005em !important;
  text-transform: none !important;
}

/* Sub-sections: governance groups, programme / laboratory accordion levels. */
main h2.gov-section-title,
main .programs-accordion-titles h3 {
  font-family: var(--type-display) !important;
  font-weight: 400 !important;
  font-size: var(--type-h2-sub) !important;
  line-height: 1.2 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

main h3 {
  font-family: var(--type-text) !important;
  font-weight: 600 !important;
  font-size: var(--type-h3) !important;
  line-height: 1.3 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

/* Small labels above titles. */
main [class$="-eyebrow"],
main [class*="-eyebrow "],
main .step {
  font-family: var(--type-text) !important;
  font-weight: 700 !important;
  font-size: 0.78rem !important;
  letter-spacing: 0.14em !important;
  text-transform: uppercase !important;
}

/* Running text of the hand-made blocks. */
main p {
  font-family: var(--type-text);
}

/* Arabic pages load Cairo (titles) and Tajawal (text): same hierarchy, Arabic fonts, no letter-spacing. */
[dir="rtl"] main h1,
[dir="rtl"] main h2,
[dir="rtl"] main h2.gov-section-title,
[dir="rtl"] main .programs-accordion-titles h3 {
  font-family: "Cairo", "Tajawal", "Geeza Pro", sans-serif !important;
  font-weight: 700 !important;
  letter-spacing: 0 !important;
  line-height: 1.35 !important;
}
[dir="rtl"] main h3,
[dir="rtl"] main [class$="-eyebrow"],
[dir="rtl"] main [class*="-eyebrow "],
[dir="rtl"] main .step,
[dir="rtl"] main p {
  font-family: "Tajawal", "Cairo", "Geeza Pro", sans-serif !important;
  letter-spacing: 0 !important;
}

/*
 * Section introductions (small label, title, text) on wide screens: title on the left, text on the right, so the
 * text uses the whole row instead of stopping in the middle of the page. Stacked again below 1024px.
 */
@media (min-width: 1024px) {
  main :is(.rules-header-top, .adm-header, .coop-header, .research-pillars-header, .research-pubs-header, .research-projects-header, .program-content-header, .contact-info-header, .contact-form-header, .pa-head):has(> h2 + p) {
    display: grid !important;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    column-gap: clamp(40px, 5vw, 88px);
    align-items: start;
    max-width: none !important;
    text-align: start;
  }
  main :is(.rules-header-top, .adm-header, .coop-header, .research-pillars-header, .research-pubs-header, .research-projects-header, .program-content-header, .contact-info-header, .contact-form-header, .pa-head):has(> h2 + p) > * {
    grid-column: 1;
  }
  main :is(.rules-header-top, .adm-header, .coop-header, .research-pillars-header, .research-pubs-header, .research-projects-header, .program-content-header, .contact-info-header, .contact-form-header, .pa-head):has(> h2 + p) > p {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: start;
    padding-top: .35em;
    max-width: none !important;
    margin: 0 !important;
  }
}

/* Micro-certifications: the closing line (“Pour être informé…”) stands apart from the cards above, as a note. */
main section.rules-note .container > p:only-child {
  margin: 48px 0 24px;
  padding: 18px 22px;
  border-inline-start: 3px solid #870B22;
  border-radius: 0 12px 12px 0;
  background: #fbf3f5;
  max-width: 760px;
}
[dir="rtl"] main section.rules-note .container > p:only-child { border-radius: 12px 0 0 12px; }
