/*
  JADE Senior Care Services - Typography
  Font styles, headings, and text utilities
*/

/* Base Typography */
body {
  font-family: var(--font-primary);
  font-size: var(--text-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--leading-relaxed);
  color: var(--text-primary);
  font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1, 'pnum' 1, 'tnum' 0, 'onum' 1, 'lnum' 0, 'dlig' 0;
}

/* Headings */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-semibold);
  line-height: var(--leading-tight);
  color: var(--text-primary);
  margin-bottom: var(--space-4);
  text-wrap: balance; /* Better text wrapping for headings */
}

/* Heading Sizes - Mobile First */
h1 {
  font-size: var(--text-3xl);
  font-weight: var(--font-weight-bold);
  line-height: var(--leading-tight);
}

h2 {
  font-size: var(--text-2xl);
  font-weight: var(--font-weight-semibold);
}

h3 {
  font-size: var(--text-xl);
  font-weight: var(--font-weight-semibold);
}

h4 {
  font-size: var(--text-lg);
  font-weight: var(--font-weight-medium);
}

h5 {
  font-size: var(--text-base);
  font-weight: var(--font-weight-medium);
}

h6 {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Tablet and up heading sizes */
@media (min-width: 768px) {
  h1 {
    font-size: var(--text-5xl);
  }

  h2 {
    font-size: var(--text-3xl);
  }

  h3 {
    font-size: var(--text-2xl);
  }

  h4 {
    font-size: var(--text-xl);
  }
}

/* Desktop heading sizes */
@media (min-width: 1024px) {
  h1 {
    font-size: var(--text-6xl);
  }

  h2 {
    font-size: var(--text-4xl);
  }
}

/* Paragraph Styles */
p {
  margin-bottom: var(--space-4);
  line-height: var(--leading-relaxed);
  text-wrap: pretty; /* Better text wrapping */
}

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

/* Lead Text */
.lead {
  font-size: var(--text-lg);
  font-weight: var(--font-weight-normal);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
  margin-bottom: var(--space-6);
}

@media (min-width: 768px) {
  .lead {
    font-size: var(--text-xl);
  }
}

/* Text Sizes */
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }
.text-4xl { font-size: var(--text-4xl); }
.text-5xl { font-size: var(--text-5xl); }
.text-6xl { font-size: var(--text-6xl); }

/* Font Weights */
.font-light { font-weight: var(--font-weight-light); }
.font-normal { font-weight: var(--font-weight-normal); }
.font-medium { font-weight: var(--font-weight-medium); }
.font-semibold { font-weight: var(--font-weight-semibold); }
.font-bold { font-weight: var(--font-weight-bold); }

/* Font Families */
.font-sans { font-family: var(--font-primary); }
.font-serif { font-family: var(--font-heading); }
.font-script { font-family: var(--font-accent); }

/* Text Colors */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-light { color: var(--text-light); }
.text-white { color: var(--text-white); }
.text-accent { color: var(--text-accent); }
.text-jade { color: var(--jade-primary); }
.text-gold { color: var(--gold-primary); }

/* Text Alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-justify { text-align: justify; }

/* Text Transform */
.uppercase { text-transform: uppercase; }
.lowercase { text-transform: lowercase; }
.capitalize { text-transform: capitalize; }
.normal-case { text-transform: none; }

/* Text Decoration */
.underline { text-decoration: underline; }
.line-through { text-decoration: line-through; }
.no-underline { text-decoration: none; }

/* Letter Spacing */
.tracking-tight { letter-spacing: -0.025em; }
.tracking-normal { letter-spacing: 0; }
.tracking-wide { letter-spacing: 0.025em; }
.tracking-wider { letter-spacing: 0.05em; }
.tracking-widest { letter-spacing: 0.1em; }

/* Line Heights */
.leading-none { line-height: var(--leading-none); }
.leading-tight { line-height: var(--leading-tight); }
.leading-snug { line-height: var(--leading-snug); }
.leading-normal { line-height: var(--leading-normal); }
.leading-relaxed { line-height: var(--leading-relaxed); }
.leading-loose { line-height: var(--leading-loose); }

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

a:hover {
  color: var(--jade-dark);
}

a:focus {
  outline: 2px solid var(--jade-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Special link styles */
.link-primary {
  color: var(--jade-primary);
  font-weight: var(--font-weight-medium);
}

.link-primary:hover {
  color: var(--jade-dark);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.link-secondary {
  color: var(--text-secondary);
  font-weight: var(--font-weight-normal);
}

.link-secondary:hover {
  color: var(--text-primary);
}

/* Lists */
ul,
ol {
  margin-bottom: var(--space-4);
  padding-left: var(--space-6);
}

ul {
  list-style-type: disc;
}

ol {
  list-style-type: decimal;
}

li {
  margin-bottom: var(--space-2);
}

li:last-child {
  margin-bottom: 0;
}

/* Nested lists */
ul ul,
ol ol,
ul ol,
ol ul {
  margin-top: var(--space-2);
  margin-bottom: var(--space-2);
}

/* Custom list styles */
.list-none {
  list-style: none;
  padding-left: 0;
}

.list-disc {
  list-style-type: disc;
}

.list-decimal {
  list-style-type: decimal;
}

/* Blockquotes */
blockquote {
  border-left: 4px solid var(--gold-primary);
  padding-left: var(--space-6);
  padding-top: var(--space-4);
  padding-bottom: var(--space-4);
  margin: var(--space-8) 0;
  font-size: var(--text-lg);
  font-style: italic;
  color: var(--text-secondary);
  background-color: var(--gray-50);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

blockquote p {
  margin-bottom: var(--space-2);
}

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

/* Quote styling for JADE */
.faith-quote {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: var(--font-weight-medium);
  color: var(--jade-primary);
  text-align: center;
  margin: var(--space-8) 0;
  padding: var(--space-8);
  background: linear-gradient(135deg, var(--gold-light) 0%, var(--jade-light) 100%);
  border-radius: var(--radius-2xl);
  border: none;
}

@media (min-width: 768px) {
  .faith-quote {
    font-size: var(--text-2xl);
  }
}

/* Code (if needed) */
code,
pre {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: var(--text-sm);
}

code {
  background-color: var(--gray-100);
  color: var(--text-primary);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
}

pre {
  background-color: var(--gray-900);
  color: var(--white);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  margin: var(--space-4) 0;
}

pre code {
  background-color: transparent;
  padding: 0;
  color: inherit;
}

/* Small text and captions */
small,
.text-caption {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: var(--leading-normal);
}

/* Emphasis styles */
.emphasis {
  font-weight: var(--font-weight-semibold);
  color: var(--jade-primary);
}

strong,
b {
  font-weight: var(--font-weight-bold);
}

em,
i {
  font-style: italic;
}

/* Mark/highlight */
mark,
.highlight {
  background-color: var(--gold-light);
  color: var(--text-primary);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
  }
}

/* Print styles */
@media print {
  * {
    color: #000 !important;
    background: transparent !important;
  }

  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
  }

  p, blockquote {
    orphans: 3;
    widows: 3;
  }

  blockquote {
    page-break-inside: avoid;
  }
}

/* Selection styles */
::selection {
  background-color: var(--jade-light);
  color: var(--jade-dark);
}