/* Site type and spacing. One scale, one 8px grid, loaded last on public pages.
   Poppins for UI. Playfair Display italic 500 on a single heading accent.
   Palette stays #2c457d in light and #8ab4ff on dark surfaces. */

@import url("/css/site-fonts.css");

:root {
  --font-ui: Poppins, ui-sans-serif, system-ui, sans-serif;
  --font-accent: "Playfair Display", serif;
  --color-accent: #2c457d;
  --color-accent-on-dark: #8ab4ff;

  /* 8px grid. 4px is only for tight UI (pill padding, icon gaps). */
  --space-2xs: 4px;
  --space-xs: 8px;
  --space-sm: 16px;
  --space-md: 24px;
  --space-lg: 32px;
  --space-xl: 48px;
  --space-2xl: 64px;
  --space-3xl: 80px;
  --space-4xl: 96px;

  /* display: home hero. h1: every other page hero and guide title. */
  --type-display-size: clamp(2.25rem, 1.2rem + 2.4vw, 3.75rem);
  --type-display-lh: 1.08;
  --type-display-weight: 600;
  --type-display-track: -0.03em;
  --type-display-after: var(--space-sm);

  --type-h1-size: clamp(2rem, 1.1rem + 1.5vw, 3rem);
  --type-h1-lh: 1.12;
  --type-h1-weight: 600;
  --type-h1-track: -0.025em;
  --type-h1-after: var(--space-sm);

  --type-h2-size: clamp(1.375rem, 1.05rem + 0.6vw, 1.75rem);
  --type-h2-lh: 1.25;
  --type-h2-weight: 600;
  --type-h2-track: -0.02em;
  --type-h2-before: var(--space-lg);
  --type-h2-after: var(--space-sm);

  --type-h3-size: 1.125rem;
  --type-h3-lh: 1.35;
  --type-h3-weight: 600;
  --type-h3-track: -0.015em;
  --type-h3-after: var(--space-xs);

  --type-body-size: 1rem;
  --type-body-lh: 1.65;
  --type-body-weight: 400;
  --type-body-track: 0;
  --type-body-after: var(--space-sm);

  --type-lede-size: 1.0625rem;
  --type-lede-lh: 1.6;
  --type-lede-weight: 400;
  --type-lede-track: 0;

  --type-label-size: 0.8125rem;
  --type-label-lh: 1.35;
  --type-label-weight: 600;
  --type-label-track: 0;

  --type-caption-size: 0.75rem;
  --type-caption-lh: 1.4;
  --type-caption-weight: 500;
  --type-caption-track: 0.01em;

  /* Names already used by calculators and guides. */
  --type-display: var(--type-display-size);
  --type-h1: var(--type-h1-size);
  --type-h2: var(--type-h2-size);
  --type-h3: var(--type-h3-size);
  --type-body: var(--type-body-size);
  --type-lede: var(--type-lede-size);
  --type-label: var(--type-label-size);
  --type-caption: var(--type-caption-size);

  --btn-height: 44px;
  --btn-pad-x: var(--space-sm);
  --btn-radius: 999px;
  --btn-font-size: var(--type-label-size);
  --btn-weight: var(--type-label-weight);
  --btn-track: var(--type-label-track);

  --calc-btn-height: var(--btn-height);
  --calc-btn-pad-x: var(--btn-pad-x);
  --calc-btn-font: var(--btn-font-size);
  --calc-btn-weight: var(--btn-weight);
  --calc-btn-tracking: var(--btn-track);
  --calc-font: var(--font-ui);
}

/* ---- Base ---- */
body {
  font-family: var(--font-ui);
  font-size: var(--type-body-size);
  font-weight: var(--type-body-weight);
  line-height: var(--type-body-lh);
  letter-spacing: var(--type-body-track);
}

body :is(h1, .docs-article-title, .docs-hub-header h1, .calc-hero-panel h1, .cf-explorer-hero h1) {
  font-family: var(--font-ui);
  font-size: var(--type-h1-size);
  font-weight: var(--type-h1-weight);
  line-height: var(--type-h1-lh);
  letter-spacing: var(--type-h1-track);
  margin-top: 0;
  margin-bottom: var(--type-h1-after);
}

body :is(.home-hero .xxl-heading, .home-hero .modern-headline) {
  font-family: var(--font-ui);
  font-size: var(--type-display-size);
  font-weight: var(--type-display-weight);
  line-height: var(--type-display-lh);
  letter-spacing: var(--type-display-track);
  margin-top: 0;
  margin-bottom: var(--type-display-after);
}

body :is(
  h2,
  .heading-3,
  .heading-4,
  .site-home-section-title,
  .docs-hub-section-header h2,
  .tools-hub__section-head h2,
  .docs-article h2
) {
  font-family: var(--font-ui);
  font-size: var(--type-h2-size);
  font-weight: var(--type-h2-weight);
  line-height: var(--type-h2-lh);
  letter-spacing: var(--type-h2-track);
  margin-top: 0;
  margin-bottom: var(--type-h2-after);
}

body :is(
  h3,
  .docs-card h3,
  .tools-tool-card h3,
  .tools-claim-panel h3,
  .calculator-card .card-content h2,
  .cf-card-explorer__name,
  .site-portal-feature__title,
  .process-phase-title,
  .wb-card-title,
  .rep-card-title
) {
  font-family: var(--font-ui);
  font-size: var(--type-h3-size);
  font-weight: var(--type-h3-weight);
  line-height: var(--type-h3-lh);
  letter-spacing: var(--type-h3-track);
  margin-top: 0;
  margin-bottom: var(--type-h3-after);
}

body :is(
  .hero-lead,
  .modern-supporting-text,
  .body-display,
  .site-home-section-lead,
  .docs-hub-lead,
  .docs-hub-lead--on-dark,
  .docs-hub-header p,
  .docs-cotd-hero .docs-hub-lead,
  .cf-explorer-hero__lead,
  .calc-hero-panel .hero-lead,
  .calc-tool-lede
) {
  font-family: var(--font-ui);
  font-size: var(--type-lede-size);
  font-weight: var(--type-lede-weight);
  line-height: var(--type-lede-lh);
  letter-spacing: var(--type-lede-track);
  margin-top: 0;
}

body :is(.docs-article p, .docs-main p, .rich-text p) {
  font-size: var(--type-body-size);
  line-height: var(--type-body-lh);
}

/* Dark-hero guide ledes stay on the 17px token, including inside .docs-article. */
body .docs-cotd-hero .docs-hub-lead,
body .docs-hub-lead {
  font-size: var(--type-lede-size);
  line-height: var(--type-lede-lh);
  font-weight: var(--type-lede-weight);
}

/* Title to lede is one step on every hero. */
body .home-hero .hero-intro {
  gap: var(--space-sm);
  grid-row-gap: var(--space-sm);
}

body :is(.calc-hero-panel, .docs-hub-header, .cf-explorer-hero__inner) {
  gap: var(--space-sm);
}

/* Accent word. One italic Playfair word, brand blue on light surfaces.
   Dark heroes and dark theme use the existing dark accent. */
body :is(h1, h2, h3, .xxl-heading, .modern-headline, .heading-3, .heading-4, .heading-large, .site-home-section-title, .docs-article-title) em,
body .calc-hero-panel .heading-large em,
body .calc-tool-hero-panel h1 em,
body .section-intro h1 em {
  display: inline;
  font-family: var(--font-accent);
  font-style: italic;
  font-weight: 500;
  font-size: 1em;
  line-height: inherit;
  letter-spacing: -0.01em;
  white-space: normal;
  font-synthesis: none;
  color: var(--color-accent);
}

/* 18ch forced the accent phrase onto its own line. Let the sentence wrap. */
body .calc-tool-hero-panel :is(h1, .heading-large) {
  max-width: 22em;
}

body :is(.home-hero, .calc-hero-panel) :is(h1, .xxl-heading, .modern-headline, .heading-large) em {
  color: var(--color-accent-on-dark);
}

html:not([data-theme="dark"]) :is(.tools-hub__hero, .calc-tool-hero-panel, .cf-explorer-hero) :is(h1, .heading-large) em {
  color: var(--color-accent);
}

html[data-theme="dark"] body :is(h1, h2, h3, .xxl-heading, .modern-headline, .heading-3, .heading-4, .heading-large, .site-home-section-title, .docs-article-title) em,
html[data-theme="dark"] body :is(.home-hero, .calc-hero-panel, .calc-tool-hero-panel, .tools-hub__hero, .cf-explorer-hero) :is(h1, .heading-large, .xxl-heading) em {
  color: var(--color-accent-on-dark);
}

/* ---- Buttons, labels, captions. Identical on tool pages and the home hero. ---- */
body :is(
  a.hero-cta-primary,
  a.outline-button,
  .outline-button.light,
  a.calc-hero-btn,
  a.docs-hub-btn,
  button.calc-hero-btn,
  .calc-btn,
  button.calc-submit,
  .saas-btn
) {
  font-family: var(--font-ui);
  font-size: var(--btn-font-size);
  font-weight: var(--btn-weight);
  letter-spacing: var(--btn-track);
  line-height: var(--type-label-lh);
  text-transform: none;
  min-height: var(--btn-height);
  height: auto;
  padding: 0 var(--btn-pad-x);
  border-radius: var(--btn-radius);
}

/* Nav CTA was 10px, 36px tall, uppercase. Same button as the heroes. */
body .navbar.w-nav .nav-button,
body .docs-site-nav .nav-button {
  font-family: var(--font-ui);
  font-size: var(--btn-font-size);
  font-weight: var(--btn-weight);
  letter-spacing: var(--btn-track);
  line-height: 1;
  text-transform: none;
  height: var(--btn-height);
  min-height: var(--btn-height);
  padding: 0 var(--btn-pad-x);
  border-radius: var(--btn-radius);
}

body :is(
  .docs-card-meta,
  .docs-article-meta,
  .calc-label,
  .calc-field label,
  .tools-free-check-field
) {
  font-family: var(--font-ui);
  font-size: var(--type-label-size);
  font-weight: var(--type-label-weight);
  letter-spacing: var(--type-label-track);
  line-height: var(--type-label-lh);
}

body :is(.docs-hub-kicker, .calc-hero-panel .subtitle.light, .home-hero .subtitle) {
  font-size: var(--type-caption-size);
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: var(--type-caption-lh);
  text-transform: uppercase;
}

body :is(.hero-cta-check, .docs-hub-author, .tools-hub__find-count, .cf-card-explorer__detail) {
  font-family: var(--font-ui);
  font-size: var(--type-caption-size);
  font-weight: var(--type-caption-weight);
  letter-spacing: var(--type-caption-track);
  line-height: var(--type-caption-lh);
}

/* Pills stay on one line, including long certification names in narrow cards. */
body :is(
  .cf-explorer-pill,
  .cf-explorer-pill__text,
  .cf-cert-label__name,
  .cf-chip__cert-label,
  .cf-chip__cert-inner,
  .hero-proof-chip
) {
  white-space: nowrap;
  font-family: var(--font-ui);
}

body :is(.cf-explorer-pill, .cf-cert-label__name, .hero-proof-chip, .cf-filters--cert .cf-chip) {
  font-size: var(--type-caption-size);
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.2;
  padding: var(--space-2xs) var(--space-xs);
  max-width: 100%;
}

body .cf-card-explorer__labels {
  order: 1;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

body .cf-card--explorer .cf-card-explorer__spacer {
  order: 2;
  flex: 1 1 auto;
}

body .cf-card--explorer > a.cf-card-site-link {
  order: 3;
  margin-top: 0;
}

body .cf-card--explorer .cf-explorer-pill {
  flex: 0 1 auto;
  min-width: 0;
}

/* Light cards need an edge on pale hero fields (#f7f8fb, #eef0f6). */
html:not([data-theme="dark"]) :is(
  .tools-tool-card,
  .tools-claim-panel,
  .calculator-card,
  .cf-results-grid .cf-card--explorer,
  .wb-card,
  .rep-card
) {
  border: 1px solid rgba(17, 23, 41, 0.16);
  background-color: #fff;
}

/* Hero headline: transform only, never opacity 0. */
html.site-hero-motion :is(.slide-content, .hero-intro, .hero-intro h1, .xxl-heading, .modern-headline) {
  opacity: 1 !important;
}

@media (prefers-reduced-motion: no-preference) {
  html.site-hero-motion:not(.site-hero-revealed) :is(.hero-intro h1, .xxl-heading, .modern-headline) {
    opacity: 1 !important;
    transform: translateY(12px) !important;
    transition: none !important;
  }

  html.site-hero-revealed :is(.hero-intro h1, .xxl-heading, .modern-headline) {
    opacity: 1 !important;
    transform: none !important;
    transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html.site-hero-motion :is(.hero-intro h1, .xxl-heading, .modern-headline, .calc-hero-btn, .hero-cta-primary) {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    animation: none !important;
  }
}
