/* ==========================================================================
   TYPOGRAPHY - base, headings, body, content
   ========================================================================== */

html {
  font-size: 100%; /* 1rem = 16px */
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--admin-bar-h, 0px) + var(--header-height) + var(--space-4));
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  font-weight: var(--fw-regular);
  line-height: var(--lh-base);
  color: var(--color-text);
  background-color: var(--color-background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ---------- Headings ---------- */
h1, h2, h3,
.h1, .h2, .h3 {
  font-family: var(--font-heading);
  font-weight: var(--fw-regular);
  line-height: var(--lh-heading);
  letter-spacing: var(--ls-tight);
  color: inherit;
  margin-bottom: var(--space-2);
}

h4, h5, h6,
.h4, .h5, .h6 {
  font-family: var(--font-body);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  color: inherit;
  margin-bottom: var(--space-1);
}

/* Italic serif accent inside headings */
h1 em, h2 em, h3 em {
  font-style: italic;
  color: var(--color-secondary);
}

h1, .h1 { font-size: var(--font-size-h1); line-height: var(--lh-tight); }
h2, .h2 { font-size: var(--font-size-h2); }
h3, .h3 { font-size: var(--font-size-h3); }
h4, .h4 { font-size: var(--font-size-h4); }
h5, .h5 { font-size: var(--font-size-h5); }
h6, .h6 { font-size: var(--font-size-h6); }

/* ---------- Body text ---------- */
p {
  margin-bottom: var(--space-2);
}

small,
.text-small {
  font-size: var(--font-size-sm);
}

.text-xs {
  font-size: var(--font-size-xs);
}

.text-lead {
  font-size: var(--font-size-md);
  line-height: var(--lh-base);
  color: var(--color-text-muted);
}

.text-muted-brand {
  color: var(--color-text-muted);
}

/* Small uppercase label above headings */
.eyebrow {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--font-size-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-wide);
  line-height: var(--lh-snug);
  text-transform: uppercase;
  color: var(--color-secondary);
  margin-bottom: var(--space-1-5);
}

/* ---------- Links ---------- */
a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

/* Animated underline (transform only) */
.link-underline {
  position: relative;
  display: inline-block;

  &::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -0.125rem;
    height: var(--border-width);
    background-color: currentColor;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform var(--transition-base) var(--ease-out);
  }

  &:hover::after,
  &:focus-visible::after {
    transform: scaleX(1);
    transform-origin: left;
  }
}

/* ---------- Rich text (.rte) ---------- */
.rte {
  > *:last-child { margin-bottom: 0; }

  /* Links inside running text are underlined (not told apart by colour
     alone); navigation-type links (page numbers, comment author / date,
     buttons, chips) keep the plain theme link style. */
  :is(p, li, td, th, dd, dt, blockquote, figcaption, address) a:not(.btn, .chip, .post-page-numbers, .comment-meta a) {
    text-decoration: underline;
    text-underline-offset: 0.2em;
  }

  ul, ol {
    padding-left: var(--space-3);
    margin-bottom: var(--space-2);
  }
}

/* ---------- Focus & selection ---------- */
:focus-visible {
  outline: 0.125rem solid var(--color-secondary);
  outline-offset: 0.125rem;
}

::selection {
  background-color: var(--color-accent-soft);
  color: var(--color-text);
}
