/* ========================================================================== 
   LexDigital canonical typography roles
   --------------------------------------------------------------------------
   Loaded after page and component styles. This is the shared mapping from
   semantic roles to the tokens in lex-tokens.css. Page styles own composition,
   not independent font scales. Decorative mockup/SVG text remains local.
   ========================================================================== */

/* Homepage optical reduction requested after the first consolidation pass.
   These scoped roles are exactly 90% of the shared scale. Other pages retain
   the canonical site scale, while homepage components continue to consume
   semantic tokens instead of adding local one-off sizes. Form controls stay
   at 16px to prevent mobile focus zoom. */
body[data-page="home"] {
  --type-eyebrow: clamp(.684rem, .6426rem + .207vw, .828rem);
  --type-h1: clamp(2.7rem, 1.98rem + 3.6vw, 5.22rem);
  --type-h2: clamp(2.025rem, 1.512rem + 2.574vw, 3.825rem);
  --type-h3: clamp(1.215rem, 1.044rem + .855vw, 1.8rem);
  --type-ui-title: clamp(.927rem, .882rem + .18vw, 1.062rem);
  --type-dialog-title: clamp(1.125rem, .99rem + .675vw, 1.62rem);

  --type-paragraph-lead: clamp(.99rem, .9387rem + .2574vw, 1.17rem);
  --type-paragraph: clamp(.9rem, .8595rem + .2025vw, 1.062rem);
  --type-paragraph-small: clamp(.828rem, .8037rem + .1215vw, .927rem);
  --type-caption: clamp(.675rem, .657rem + .09vw, .738rem);
  --type-label: var(--type-caption);
  --type-meta: var(--type-caption);

  --type-nav: clamp(.72rem, .6939rem + .1287vw, .81rem);
  --type-menu: clamp(1.35rem, 1.1574rem + .963vw, 2.025rem);
  --type-cta: clamp(.702rem, .6813rem + .1026vw, .774rem);
  --type-brand: clamp(.972rem, .9rem + .162vw, 1.152rem);
  --type-quote: clamp(1.08rem, .9774rem + .513vw, 1.44rem);
  --type-metric-hero: clamp(4.05rem, 2.8926rem + 5.787vw, 8.1rem);
  --type-metric-results-hero: var(--type-metric-hero);
  --type-metric-box: clamp(1.575rem, 1.2537rem + 1.611vw, 2.7rem);
  --type-metric-label: var(--type-caption);
  --type-form-control: 1rem;

  --type-hero: var(--type-h1);
  --type-section: var(--type-h2);
  --type-card-title: var(--type-ui-title);
  --type-panel-title: var(--type-h3);
  --type-tab-num: var(--type-caption);
  --type-tab-label: var(--type-nav);
  --type-chip: var(--type-caption);
  --type-pill: var(--type-caption);
  --type-stat-xl: var(--type-metric-hero);
  --type-stat-lg: clamp(2.475rem, 1.89rem + 2.34vw, 3.6rem);
  --type-stat-md: var(--type-metric-box);
  --type-stat-sm: var(--type-metric-box);
  --type-body: var(--type-paragraph);
  --type-body-sm: var(--type-paragraph-small);
  --section-h: var(--type-h2);
  --body-copy-size: var(--type-paragraph);
  --chrome-body: var(--type-paragraph-small);
  --chrome-meta: var(--type-caption);

  /* Annotated exceptions: these intentionally do not inherit the 90% scale. */
  --type-case-metric: clamp(1.05rem, 6.4cqi, 2rem);
  --type-decision-title: 1.45rem;
  --home-type-stack-gap: clamp(16px, 1.6vw, 22px);
}

@media (max-width: 1366px) {
  body[data-page="home"] { --type-decision-title: 1.36rem; }
}

@media (min-width: 1181px) {
  body[data-page="home"] {
    --type-metric-results-hero: clamp(7.83rem, 8.415vw, 9.585rem);
  }
}

@media (min-width: 901px) and (max-width: 1180px) {
  body[data-page="home"] { --type-decision-title: clamp(1rem, 1.75vw, 1.28rem); }
}

@media (max-width: 900px) {
  body[data-page="home"] { --type-decision-title: 1.28rem; }
}

@media (max-width: 720px) {
  body[data-page="home"] {
    --type-decision-title: 1.04rem;
    --type-case-metric: clamp(1rem, 5.3vw, 1.42rem);
  }
}

@media (max-width: 480px) {
  body[data-page="home"] { --type-decision-title: 1rem; }
}

:where(h1, h2, h3) {
  text-wrap: balance;
}

:where(p, li, dd, .faq-answer-inner, .wy-row-inner) {
  text-wrap: pretty;
}

/* Display hierarchy */
body[data-page="home"] :is(.hero-h1, .hero-fixed .hero-h1),
body[data-page="about"] .hero h1,
body:is([data-page="seo"], [data-page="local-seo"], [data-page="website-cro"], [data-page="paid-media"]) .hero h1 {
  font-size: var(--type-h1);
  line-height: var(--leading-h1);
}

body[data-page="home"] :is(.why-mega, .gs-h1, .about-h, .cs-h, .whyus-live-h, .talk-h, .faqx-h),
body[data-page="home"] .proto-section .proto-h,
body[data-page="home"] .rs.rs-quote-led .rs-h1,
.section-title,
.ranking-copy .section-title,
.process-heading .section-title,
.consultation-cta .section-title {
  font-size: var(--type-h2);
  line-height: var(--leading-h2);
}

.case-study-title {
  font-size: var(--type-h2);
  line-height: var(--leading-h2);
}

.case-study-lede {
  font-size: var(--type-paragraph-lead);
  line-height: var(--leading-paragraph-lead);
}

.case-study-metric-value {
  font-size: var(--type-metric-box);
}

.case-study-metric-label {
  font-size: var(--type-metric-label);
}

:is(h1, h2, h3) :is(.serif, .accent-line, .why-accent, em) {
  font-size: 1em;
}

body[data-page="home"] :is(.hero-h1 .accent-line, .why-mega .why-accent,
  .rs-h1 .serif, .gs-h1 .serif, .about-h em, .proto-h em, .cs-h .serif,
  .whyus-live-h em, .talk-h .serif, .faqx-h .serif),
body:not([data-page="home"]) :is(.hero h1 .serif, .section-title .serif, .legal-title .serif) {
  font-size: 1em;
}

:is(.include-card, .process-step, .principle-card, .system-card) h3,
body .fs-cs-title,
body[data-page="home"] :is(.ps-title, .p-title, .wc-new, .wy-row-t) {
  font-size: var(--type-h3);
  line-height: var(--leading-h3);
}

body[data-page="home"] .wy-row-t {
  font-size: var(--type-decision-title);
}

:is(.faq-question > span:first-child, .faqx-q-text, .market-row h3, .cs-title) {
  font-size: var(--type-ui-title);
  line-height: var(--leading-ui);
}

:is(.form-head h3, .consult-form-head h3, #home-consult-title) {
  font-size: var(--type-dialog-title);
  line-height: 1.15;
}

/* Long-form document hierarchy intentionally uses compact reading roles. */
.legal-title {
  font-size: var(--type-document-title);
}

.legal-prose h2 {
  font-size: var(--type-document-heading);
}

.legal-prose h3 {
  font-size: var(--type-document-subheading);
}

/* Paragraph hierarchy */
:is(.hero-copy, .section-copy, .why-sub, .attrib-txt, .gs-copy, .p-desc,
  .about-sub, .proto-desc, .cs-copy, .cs-detail, .whyus-live-sub, .talk-copy,
  .faqx-copy, .pulse-egg-copy, .faqx-a-inner, .wy-row-inner, .legal-standfirst,
  .legal-prose p, .legal-prose li, .legal-dl dd) {
  font-size: var(--type-paragraph);
  line-height: var(--leading-paragraph);
}

:is(.hero-copy, .legal-standfirst) {
  max-width: var(--measure-paragraph-lead);
}

:is(.process-step-body > p, .include-card > p, .ranking-points li,
  .market-row p, .principle-card p, .system-card p, .ps-text, .cs-body,
  .wc-desc, .about-v3-body, .p-sub, .p-appro-txt, .footer-brand-copy,
  .fs-cs-desc, .form-head p, #home-consult-description) {
  font-size: var(--type-paragraph-small);
  line-height: var(--leading-paragraph-small);
}

.geo-caption {
  font-size: var(--type-caption);
  line-height: var(--leading-caption);
}

/* Eyebrows, labels and supporting metadata */
:is(.eyebrow, .eye, .h-eye, .hero-eye, .p-appro-lbl, .p-subs-lbl,
  .fs-cs-label,
  .case-study-label) {
  font-size: var(--type-eyebrow);
  line-height: 1.2;
  letter-spacing: var(--eyebrow-tracking);
}

:is(.process-step-label, .ps-num, .prog-lbl, .pill, .cs-kicker,
  .rank-kicker, .qattr, .footer-head, .footer-copy, .legal-meta,
  .legal-toc-head, .legal-dl dt, .legal-table th, .form-note,
  .field-error, .form-status, .marq-item, .principle-index,
  .system-card-kicker, .paid-caption) {
  font-size: var(--type-caption);
  line-height: var(--leading-caption);
}

/* Navigation and actions */
.nav-links > a:not(.nav-cta),
.nav-drop-btn {
  font-size: var(--type-nav);
}

.fs-list > li > a,
.fs-list > li > button {
  font-size: var(--type-menu);
}

:is(.btn-p, .btn-primary, .btn-secondary, .nav-cta) {
  font-size: var(--type-cta);
  line-height: 1.2;
}

.gs .v-rail .tb-lbl {
  font-size: var(--type-nav);
}

/* Quotes */
body[data-page="home"] .rs.rs-quote-led .rs-feature-quote .qbody {
  font-size: var(--type-quote);
  line-height: var(--leading-quote);
  letter-spacing: var(--quote-tracking);
}

/* Metrics: value and label roles stay identical in every metric container. */
body[data-page="home"] .big-num {
  font-size: var(--type-metric-results-hero) !important;
  line-height: .88;
}

:is(.hero-stat strong, .rs-n, .mval, .lex-metric-value, .stat-n, .cs-value, .fs-stat-n) {
  font-size: var(--type-metric-box);
  line-height: 1;
}

body[data-page="home"] .cs-ribbon .cs-value {
  font-size: var(--type-case-metric) !important;
}

:is(.hero-stat span, .rs-l, .mlbl, .lex-metric-label, .stat-l, .cs-label, .fs-stat-l) {
  font-size: var(--type-metric-label);
  line-height: var(--leading-caption);
}

/* Forms retain 16px controls to avoid mobile focus zoom. */
:is(input, select, textarea) {
  font-size: var(--type-form-control);
}

:is(.field label, .consult-field > span, .consult-privacy, .form-note) {
  font-size: var(--type-caption);
  line-height: var(--leading-caption);
}

.consent-label {
  font-size: var(--type-paragraph-small) !important;
  line-height: var(--leading-paragraph-small);
}

/* Compact supporting systems */
.about-signal strong {
  font-size: var(--type-ui-title);
}

.about-signal span,
.legal-toc a,
.legal-note p,
.legal-table td,
.nf-links a,
.footer-links a,
.footer-contact a {
  font-size: var(--type-paragraph-small);
}

@media (max-width: 720px) {
  body[data-page="home"] .rs.rs-quote-led .rs-feature-quote .qbody {
    font-size: var(--type-quote) !important;
  }

  body[data-page="home"] :is(.lex-metric-value, .mval, .stat-n, .cs-value) {
    font-size: var(--type-metric-box) !important;
  }

  body[data-page="home"] :is(.lex-metric-label, .mlbl, .stat-l, .cs-label) {
    font-size: var(--type-metric-label) !important;
  }

  body[data-page="home"] .big-num {
    font-size: var(--type-metric-results-hero) !important;
  }

  body[data-page="home"] .gs .v-rail .tb-lbl {
    font-size: var(--type-nav) !important;
  }
}
