/* ==========================================================================
   Typography — Terra Theme
   Central typography file. All @font-face declarations, type scale tokens,
   font family assignments, and typographic treatments are defined here.
   To change fonts or the type scale, edit only this file.
   ========================================================================== */


/* ==========================================================================
   1. @font-face Declarations
   Variable fonts — single file covers all weights per style.
   ========================================================================== */

@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/source-serif-4.woff2') format('woff2');
}

@font-face {
  font-family: 'Source Serif 4';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/source-serif-4-italic.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('../fonts/inter.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/inter-italic.woff2') format('woff2');
}


/* ==========================================================================
   2. Type Scale Tokens
   Major Third ratio (1.250), anchored at 18px (1.125rem).
   Fluid values scale between mobile and desktop viewports.
   ========================================================================== */

:root {
  /* --- Font Families --- */
  --font-heading:  'Source Serif 4', 'Source Serif Pro', Georgia, serif;
  --font-body:     'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* --- Font Sizes (fluid) --- */
  --font-size-xs:    clamp(0.75rem, 0.72rem + 0.1vw, 0.8125rem);     /* ~12-13px */
  --font-size-sm:    clamp(0.833rem, 0.8rem + 0.15vw, 0.9375rem);    /* ~13-15px */
  --font-size-base:  clamp(1rem, 0.95rem + 0.2vw, 1.125rem);         /* ~16-18px */
  --font-size-md:    clamp(1.15rem, 1.05rem + 0.4vw, 1.375rem);      /* ~18-22px */
  --font-size-lg:    clamp(1.4rem, 1.2rem + 0.65vw, 1.75rem);        /* ~22-28px */
  --font-size-xl:    clamp(1.75rem, 1.45rem + 0.95vw, 2.19rem);      /* ~28-35px */
  --font-size-2xl:   clamp(2rem, 1.6rem + 1.25vw, 2.75rem);          /* ~32-44px */

  /* --- Line Heights --- */
  --leading-tight:    1.2;
  --leading-snug:     1.4;
  --leading-normal:   1.7;
  --leading-relaxed:  1.8;

  /* --- Letter Spacing --- */
  --tracking-tight:    -0.02em;
  --tracking-snug:     -0.015em;
  --tracking-normal:    0;
  --tracking-wide:      0.05em;
  --tracking-wider:     0.08em;

  /* --- Font Weights --- */
  --weight-normal:    400;
  --weight-medium:    500;
  --weight-semibold:  600;
  --weight-bold:      700;
}


/* ==========================================================================
   3. Base Typography
   ========================================================================== */

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

p {
  margin-top: 0;
  margin-bottom: 1.5em;
}


/* ==========================================================================
   4. Headings
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  margin-top: 0;
  margin-bottom: 0.5em;
  color: var(--color-text);
}

h1 {
  font-size: var(--font-size-2xl);
  letter-spacing: var(--tracking-tight);
  line-height: 1.15;
}

h2 {
  font-size: var(--font-size-xl);
  letter-spacing: var(--tracking-snug);
}

h3 {
  font-size: var(--font-size-lg);
  letter-spacing: var(--tracking-snug);
}

h4 {
  font-size: var(--font-size-md);
}

h5 {
  font-size: var(--font-size-base);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

h6 {
  font-size: var(--font-size-sm);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}


/* ==========================================================================
   5. Links
   ========================================================================== */

a {
  color: var(--color-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
  transition: color 0.2s ease;
}

a:hover,
a:focus {
  color: var(--color-link-hover);
}


/* ==========================================================================
   6. Blockquotes & Pull Quotes
   ========================================================================== */

blockquote {
  font-family: var(--font-heading);
  font-size: var(--font-size-md);
  font-style: italic;
  line-height: var(--leading-snug);
  margin: 2em 0;
  padding-left: 1.5em;
  border-left: 3px solid var(--color-border-accent);
  color: var(--color-text);
}

blockquote cite {
  display: block;
  margin-top: 0.75em;
  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  font-style: normal;
  color: var(--color-text-secondary);
}

blockquote p:last-child {
  margin-bottom: 0;
}

.pullquote {
  font-family: var(--font-heading);
  font-size: var(--font-size-lg);
  font-style: italic;
  line-height: var(--leading-snug);
  text-align: center;
  padding: 1.5em 0;
  margin: 2em 0;
  border-top: 2px solid var(--color-border-accent);
  border-bottom: 2px solid var(--color-border-accent);
}


/* ==========================================================================
   7. Code & Preformatted Text
   ========================================================================== */

code, kbd, samp {
  font-size: 0.9em;
  background: var(--color-surface-code);
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

pre {
  font-size: var(--font-size-sm);
  line-height: var(--leading-snug);
  background: var(--color-surface-code);
  padding: 1.25em 1.5em;
  border-radius: 4px;
  overflow-x: auto;
  margin: 2em 0;
}

pre code {
  background: none;
  padding: 0;
  border-radius: 0;
}


/* ==========================================================================
   8. Captions & Small Text
   ========================================================================== */

small,
.caption,
figcaption {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  line-height: var(--leading-snug);
}

.fine-print {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
}


/* ==========================================================================
   9. Lists
   ========================================================================== */

ul, ol {
  margin-top: 0;
  margin-bottom: 1.5em;
  padding-left: 1.5em;
}

li {
  margin-bottom: 0.35em;
}

li > ul,
li > ol {
  margin-top: 0.35em;
  margin-bottom: 0;
}


/* ==========================================================================
   10. Horizontal Rule
   ========================================================================== */

hr {
  border: none;
  border-top: 1px solid var(--color-border-accent);
  margin: 2.5em 0;
}
