/*
 * AIJRIV unified typography system
 * One family and one responsive scale for every page of the compiled site.
 */
:root {
  --aijriv-font: "Montserrat", Arial, sans-serif;
  --aijriv-body-size: 18px;
  --aijriv-body-leading: 1.7;
  --aijriv-small-size: 14px;
  --aijriv-button-size: 15px;
  --aijriv-h1-size: clamp(42px, 5vw, 64px);
  --aijriv-h2-size: clamp(32px, 3.5vw, 44px);
  --aijriv-h3-size: clamp(22px, 2vw, 26px);
  --aijriv-h4-size: 21px;
  --aijriv-h5-size: 17px;
}

html,
body,
body * {
  font-family: var(--aijriv-font) !important;
}

body {
  font-size: var(--aijriv-body-size);
  line-height: var(--aijriv-body-leading);
}

/* Main editorial hierarchy — identical on every route. */
main h1,
main .display-lg {
  font-size: var(--aijriv-h1-size) !important;
  font-weight: 800 !important;
  line-height: 1.12 !important;
  letter-spacing: -.025em;
}

main h2,
main .headline-xl,
main .headline-lg {
  font-size: var(--aijriv-h2-size) !important;
  font-weight: 750 !important;
  line-height: 1.18 !important;
  letter-spacing: -.018em;
}

main h3,
main .headline-md {
  font-size: var(--aijriv-h3-size) !important;
  font-weight: 700 !important;
  line-height: 1.3 !important;
  letter-spacing: -.01em;
}

main h4 {
  font-size: var(--aijriv-h4-size) !important;
  font-weight: 700 !important;
  line-height: 1.35 !important;
}

main h5,
main h6 {
  font-size: var(--aijriv-h5-size) !important;
  font-weight: 700 !important;
  line-height: 1.4 !important;
}

main p,
main .body-lg,
main .body-md,
main .body-sm {
  font-size: var(--aijriv-body-size) !important;
  font-weight: 400 !important;
  line-height: var(--aijriv-body-leading) !important;
}

/* Functional text keeps a compact but consistent scale. */
button,
input,
textarea,
select,
nav a,
nav button {
  font-size: var(--aijriv-button-size) !important;
  line-height: 1.4 !important;
}

.label-bold,
.badge-trust,
.home-section-kicker {
  font-size: 13px !important;
  font-weight: 750 !important;
  line-height: 1.35 !important;
  letter-spacing: .08em;
}

.caption {
  font-size: 14px !important;
  line-height: 1.5 !important;
}

/* The added homepage cards use the same site-wide heading/body rhythm. */
.home-benefit-card h3,
.home-step h3 {
  font-size: 21px !important;
  line-height: 1.35 !important;
}

.home-benefit-card p,
.home-step p,
.home-trust-item span:last-child {
  font-size: 16px !important;
  line-height: 1.6 !important;
}

/* Footer is secondary information but remains fully Montserrat and readable. */
footer h4 {
  font-size: 21px !important;
  line-height: 1.35 !important;
}

footer h5,
footer h6 {
  font-size: 16px !important;
  line-height: 1.4 !important;
}

footer p,
footer a,
footer button {
  font-size: 14px !important;
  line-height: 1.6 !important;
}

@media (max-width: 640px) {
  :root {
    --aijriv-body-size: 16px;
    --aijriv-small-size: 13px;
    --aijriv-button-size: 14px;
    --aijriv-h1-size: clamp(36px, 11vw, 46px);
    --aijriv-h2-size: clamp(28px, 8vw, 36px);
    --aijriv-h3-size: 21px;
    --aijriv-h4-size: 19px;
    --aijriv-h5-size: 16px;
  }

  main p,
  main .body-lg,
  main .body-md,
  main .body-sm {
    line-height: 1.65 !important;
  }

  .home-benefit-card p,
  .home-step p,
  .home-trust-item span:last-child {
    font-size: 15px !important;
  }
}

/* Final semantic lock: the same HTML level has the same size everywhere. */
main h1:not([data-typography-exception]) {
  font-size: var(--aijriv-h1-size) !important;
}

main h2:not([data-typography-exception]) {
  font-size: var(--aijriv-h2-size) !important;
  line-height: 1.18 !important;
}

main h3:not([data-typography-exception]) {
  font-size: var(--aijriv-h3-size) !important;
  line-height: 1.3 !important;
}

main h4:not([data-typography-exception]) {
  font-size: var(--aijriv-h4-size) !important;
}

main h5:not([data-typography-exception]),
main h6:not([data-typography-exception]) {
  font-size: var(--aijriv-h5-size) !important;
}

main p:not([data-typography-exception]) {
  font-size: var(--aijriv-body-size) !important;
  line-height: var(--aijriv-body-leading) !important;
}

/* Compact media-card headings are labels, not section-level titles. */
main h3.truncate {
  color: #fff !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  line-height: 1.3 !important;
  letter-spacing: .035em;
  overflow: visible !important;
  white-space: normal !important;
  text-overflow: clip !important;
}

main div:has(> h3.truncate) {
  min-height: 58px;
  align-items: center;
}

@media (max-width: 640px) {
  main h3.truncate { font-size: 11px !important; }
}

/* Proportional heading lock for the compact missions section. */
main .missions-editorial-heading {
  max-width: 820px;
  margin-right: auto;
  margin-left: auto;
  text-align: center !important;
}

main .missions-editorial-heading h2:not([data-typography-exception]) {
  margin-right: auto !important;
  margin-left: auto !important;
  font-size: 32px !important;
  line-height: 1.15 !important;
  text-align: center !important;
  white-space: nowrap;
}

main .missions-editorial-heading p:not([data-typography-exception]) {
  max-width: 680px;
  margin-right: auto !important;
  margin-left: auto !important;
  font-size: 16px !important;
  line-height: 1.55 !important;
  text-align: center !important;
}

@media (max-width: 640px) {
  main .missions-editorial-heading h2:not([data-typography-exception]) {
    font-size: 28px !important;
    white-space: normal;
  }

  main .missions-editorial-heading p:not([data-typography-exception]) {
    font-size: 15px !important;
  }
}
