/*
 * WCAG 2.2 AA typography normalization — 2026-08-05.
 *
 * WCAG does not prescribe a maximum heading size. This layer keeps headings
 * readable and restrained while preserving 200% browser zoom, reflow and
 * user-defined text spacing. It is intentionally loaded after page CSS.
 */

:root {
  --rp-type-page-title: 2.5rem;       /* 40px at the default 16px root */
  --rp-type-section-title: 1.875rem;  /* 30px */
  --rp-type-subtitle: 1.25rem;        /* 20px */
  --rp-type-minor-title: 1.125rem;    /* 18px */
  --rp-type-product-title: 1rem;      /* 16px */
}

body.rp-theme {
  font-size: 1rem;
  line-height: 1.6;
}

/*
 * Main content headings. Fixed relative units are used instead of viewport-only
 * sizing so browser text enlargement remains predictable.
 */
body.rp-theme main.site-main :where(h1),
body.rp-theme .wp-block-post-content :where(h1),
body.rp-theme .entry-content :where(h1) {
  max-width: 100%;
  max-height: none !important;
  overflow: visible !important;
  font-size: var(--rp-type-page-title) !important;
  line-height: 1.12 !important;
  letter-spacing: -0.025em !important;
  text-wrap: balance;
  overflow-wrap: break-word;
  word-break: normal;
}

body.rp-theme main.site-main :where(h2):not(.product-name),
body.rp-theme .wp-block-post-content :where(h2):not(.product-name),
body.rp-theme .entry-content :where(h2):not(.product-name) {
  max-width: 100%;
  max-height: none !important;
  overflow: visible !important;
  font-size: var(--rp-type-section-title) !important;
  line-height: 1.18 !important;
  letter-spacing: -0.018em !important;
  text-wrap: balance;
  overflow-wrap: break-word;
  word-break: normal;
}

body.rp-theme main.site-main :where(h3):not(.product-name),
body.rp-theme .wp-block-post-content :where(h3):not(.product-name),
body.rp-theme .entry-content :where(h3):not(.product-name) {
  max-height: none !important;
  overflow: visible !important;
  font-size: var(--rp-type-subtitle) !important;
  line-height: 1.3 !important;
  letter-spacing: -0.008em !important;
  overflow-wrap: break-word;
  word-break: normal;
}

body.rp-theme main.site-main :where(h4):not(.product-name),
body.rp-theme .wp-block-post-content :where(h4):not(.product-name),
body.rp-theme .entry-content :where(h4):not(.product-name) {
  max-height: none !important;
  overflow: visible !important;
  font-size: var(--rp-type-minor-title) !important;
  line-height: 1.35 !important;
  letter-spacing: 0 !important;
  overflow-wrap: break-word;
  word-break: normal;
}

/*
 * Product-card names were undersized and visually truncated. Keep them readable,
 * allow natural wrapping and avoid loss of text when users increase spacing.
 */
body.rp-theme .product-card :is(h2.product-name, h3.product-name),
body.rp-theme .product-card .product-name {
  height: auto !important;
  min-height: calc(1.4em * 3) !important;
  max-height: none !important;
  overflow: visible !important;
  font-size: var(--rp-type-product-title) !important;
  line-height: 1.4 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  white-space: normal !important;
  overflow-wrap: break-word;
  word-break: normal;
}

body.rp-theme .product-card :is(h2.product-name, h3.product-name) > a,
body.rp-theme .product-card .product-name > a {
  display: block !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  font: inherit !important;
  line-height: inherit !important;
  letter-spacing: inherit !important;
  white-space: normal !important;
  overflow-wrap: break-word;
  word-break: normal;
  -webkit-box-orient: initial !important;
  -webkit-line-clamp: unset !important;
  line-clamp: unset !important;
}

/** Compact mobile scale without returning to oversized display typography. */
@media (max-width: 767px) {
  :root {
    --rp-type-page-title: 2.25rem;       /* 36px */
    --rp-type-section-title: 1.625rem;   /* 26px */
    --rp-type-subtitle: 1.1875rem;       /* 19px */
     --rp-type-minor-title: 1.0625rem;    /* 17px */
    --rp-type-product-title: 0.9375rem;  /* 15px */
  }

  body.rp-theme main.site-main :where(h1),
  body.rp-theme .wp-block-post-content :where(h1),
  body.rp-theme .entry-content :where(h1) {
    line-height: 1.16 !important;
  }

  body.rp-theme main.site-main :where(h2):not(.product-name),
  body.rp-theme .wp-block-post-content :where(h2):not(.product-name),
  body.rp-theme .entry-content :where(h2):not(.product-name) {
    line-height: 1.22 !important;
  }
}
