/* ==========================================================================
   FTS: typography.css
   Applies the type scale from tokens.css. No :root declarations here.
   ========================================================================== */

body {
  font-size: var(--fts-text-base);
  line-height: var(--fts-leading-body);
}

p {
  font-family: var(--font-sans);
  font-size: var(--fts-text-base);
  font-weight: var(--weight-regular);
  line-height: var(--fts-leading-body);
  letter-spacing: 0.025em;
  margin-bottom: 0;
}

/* Uses --color-heading semantic token so a single token change updates all headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  line-height: var(--fts-leading-heading);
  color: var(--color-heading);
}

h1 { font-size: var(--fts-h1); font-weight: var(--weight-light); }
h2 { font-size: var(--fts-h2); font-weight: var(--weight-regular); }
h3 { font-size: var(--fts-h3); font-weight: var(--weight-bold); }
h4 { font-size: var(--fts-h4); font-weight: var(--weight-semibold); }
h5 { font-size: var(--fts-h5); font-weight: var(--weight-medium); }
h6 { font-size: var(--fts-h6); font-weight: var(--weight-semibold); }

.fts-text-sm { font-size: var(--fts-text-sm); }
.fts-text-lg { font-size: var(--fts-text-lg); }

/* Rich text: list and blockquote defaults --------------------------------- */
.fl-rich-text :where(ul, ol) { padding-left: 1.125em; margin-top: 0; }
.fl-rich-text :where(li)     { line-height: var(--fts-leading-body); }

.fl-rich-text blockquote {
  margin-left: 0;
  margin-right: 0;
  border-color: var(--cream);
}

/* Zero out all block margins — the lobotomized-owl rhythm system below
   re-adds them intentionally only between adjacent siblings */
.fl-rich-text :where(p, ul, ol, blockquote, pre, table, hr) { margin: 0; }
.fl-rich-text :where(h1, h2, h3, h4, h5, h6)               { margin: 0; }

/* Rich text rhythm -------------------------------------------------------- */
.fl-rich-text {
  --fts-flow:       1rem;
  --fts-flow-tight: 0.5rem;
  --fts-flow-loose: 1.5rem;
}

.fl-rich-text :where(p, ul, ol, blockquote, pre, table, hr)
  + :where(p, ul, ol, blockquote, pre, table, hr) {
  margin-top: var(--fts-flow);
}

.fl-rich-text :where(h1, h2, h3, h4, h5, h6)
  + :where(p, ul, ol) {
  margin-top: var(--fts-flow-tight);
}

.fl-rich-text :where(p, ul, ol, blockquote, pre, table, hr)
  + :where(h1, h2, h3, h4, h5, h6) {
  margin-top: var(--fts-flow-loose);
}

/* Prevents BB/WP editor from injecting stray background colors on inline elements */
.fl-rich-text :where(p, span, strong, em, b, i, u, small, code, mark) {
  background: transparent !important;
}
.fl-rich-text :where(strong, em, b, i, u, small, code) { line-height: inherit; }
.fl-rich-text * { background-clip: padding-box; }
