/* Typography System */

/* Base Typography */
body {
  font-family: var(--font-family-primary);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  font-weight: var(--font-weight-regular);
  color: var(--color-text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-heading);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--color-text-primary);
  margin: 0;
  letter-spacing: -0.025em;
}

h1 {
  font-size: var(--font-size-5xl);
  font-weight: var(--font-weight-black);
  line-height: var(--line-height-tight);
}

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

h3 {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
}

h4 {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
}

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

h6 {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
}

/* Responsive Headings */
@media (max-width: 768px) {
  h1 {
    font-size: var(--font-size-4xl);
  }
  
  h2 {
    font-size: var(--font-size-3xl);
  }
  
  h3 {
    font-size: var(--font-size-2xl);
  }
}

@media (max-width: 375px) {
  h1 {
    font-size: var(--font-size-3xl);
  }
  
  h2 {
    font-size: var(--font-size-2xl);
  }
}

/* Paragraphs */
p {
  font-size: var(--font-size-base);
  line-height: var(--line-height-relaxed);
  color: var(--color-text-secondary);
  margin: 0;
}

p + p {
  margin-top: var(--space-4);
}

/* Text Sizes */
.text-xs {
  font-size: var(--font-size-xs);
  line-height: var(--line-height-normal);
}

.text-sm {
  font-size: var(--font-size-sm);
  line-height: var(--line-height-normal);
}

.text-base {
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
}

.text-lg {
  font-size: var(--font-size-lg);
  line-height: var(--line-height-relaxed);
}

.text-xl {
  font-size: var(--font-size-xl);
  line-height: var(--line-height-relaxed);
}

.text-2xl {
  font-size: var(--font-size-2xl);
  line-height: var(--line-height-snug);
}

.text-3xl {
  font-size: var(--font-size-3xl);
  line-height: var(--line-height-snug);
}

.text-4xl {
  font-size: var(--font-size-4xl);
  line-height: var(--line-height-tight);
}

.text-5xl {
  font-size: var(--font-size-5xl);
  line-height: var(--line-height-tight);
}

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

.font-regular {
  font-weight: var(--font-weight-regular);
}

.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-extrabold {
  font-weight: var(--font-weight-extrabold);
}

.font-black {
  font-weight: var(--font-weight-black);
}

/* Text Colors */
.text-primary {
  color: var(--color-text-primary);
}

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

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

.text-accent {
  color: var(--color-accent);
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: var(--font-weight-bold);
}

.text-gold {
  color: var(--color-primary);
}

.text-success {
  color: var(--color-success);
}

.text-warning {
  color: var(--color-warning);
}

.text-error {
  color: var(--color-error);
}

/* 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;
  letter-spacing: 0.05em;
}

.lowercase {
  text-transform: lowercase;
}

.capitalize {
  text-transform: capitalize;
}

/* Text Decoration */
.underline {
  text-decoration: underline;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--color-accent);
}

.line-through {
  text-decoration: line-through;
}

.no-underline {
  text-decoration: none;
}

/* Font Families */
.font-heading {
  font-family: var(--font-family-heading);
}

.font-body {
  font-family: var(--font-family-primary);
}

.font-mono {
  font-family: var(--font-family-mono);
}

/* Line Heights */
.leading-tight {
  line-height: var(--line-height-tight);
}

.leading-snug {
  line-height: var(--line-height-snug);
}

.leading-normal {
  line-height: var(--line-height-normal);
}

.leading-relaxed {
  line-height: var(--line-height-relaxed);
}

.leading-loose {
  line-height: var(--line-height-loose);
}

/* 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;
}

/* Special Typography Effects */
.text-gradient {
  background: var(--gradient-primary);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.text-glow {
  text-shadow: 0 0 10px var(--color-accent),
               0 0 20px var(--color-accent),
               0 0 30px var(--color-accent);
}

.text-shadow {
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* Lists */
ul, ol {
  margin: 0;
  padding: 0;
}

.list-disc {
  list-style-type: disc;
  padding-left: var(--space-6);
}

.list-decimal {
  list-style-type: decimal;
  padding-left: var(--space-6);
}

.list-none {
  list-style: none;
  padding-left: 0;
}

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

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

/* Blockquotes */
blockquote {
  border-left: 4px solid var(--color-accent);
  padding-left: var(--space-4);
  margin: var(--space-6) 0;
  font-style: italic;
  color: var(--color-text-secondary);
}

/* Code */
code {
  font-family: var(--font-family-mono);
  font-size: 0.875em;
  background-color: var(--color-background-card);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  color: var(--color-accent);
}

pre {
  font-family: var(--font-family-mono);
  background-color: var(--color-background-card);
  padding: var(--space-4);
  border-radius: var(--radius-base);
  overflow-x: auto;
  margin: var(--space-4) 0;
}

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

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

a:hover {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 2px;
}

a:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Strong and emphasis */
strong, b {
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
}

em, i {
  font-style: italic;
}

/* Small text */
small {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

/* Mark/highlight */
mark {
  background-color: var(--color-primary);
  color: var(--color-background);
  padding: 0.1em 0.2em;
  border-radius: var(--radius-sm);
}

/* Abbreviations */
abbr[title] {
  text-decoration: underline dotted;
  cursor: help;
}

/* Responsive Typography */
@media (max-width: 768px) {
  body {
    font-size: var(--font-size-sm);
  }
  
  .text-lg {
    font-size: var(--font-size-base);
  }
  
  .text-xl {
    font-size: var(--font-size-lg);
  }
}

/* Print styles */
@media print {
  body {
    font-size: 12pt;
    line-height: 1.4;
    color: black;
  }
  
  h1, h2, h3, h4, h5, h6 {
    color: black;
    page-break-after: avoid;
  }
  
  p {
    orphans: 3;
    widows: 3;
  }
  
  .text-accent,
  .text-gradient {
    color: black !important;
    background: none !important;
    -webkit-text-fill-color: unset !important;
  }
}