/**
 * Typography System
 * Font styles, headings, and text utilities
 */

/* ============================
   BASE TYPOGRAPHY
   ============================ */

body {
  font-family: var(--font-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--color-text-primary);
  letter-spacing: var(--letter-spacing-normal);
}

/* ============================
   HEADINGS
   ============================ */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-secondary);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--color-primary-500);
  margin-bottom: var(--spacing-md);
  letter-spacing: var(--letter-spacing-tight);
}

h1 {
  font-size: var(--font-size-4xl);
  margin-bottom: var(--spacing-xl);
}

h2 {
  font-size: var(--font-size-3xl);
  margin-bottom: var(--spacing-lg);
}

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

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

h5 {
  font-size: var(--font-size-lg);
}

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

/* Responsive heading sizes */
@media (min-width: 768px) {
  h1 {
    font-size: var(--font-size-5xl);
  }
  
  h2 {
    font-size: var(--font-size-4xl);
  }
  
  h3 {
    font-size: var(--font-size-3xl);
  }
}

@media (min-width: 1024px) {
  h1 {
    font-size: var(--font-size-6xl);
  }
}

/* ============================
   BODY TEXT
   ============================ */

p {
  margin-bottom: var(--spacing-md);
}

.text-lead {
  font-size: var(--font-size-xl);
  line-height: var(--line-height-relaxed);
  font-weight: var(--font-weight-normal);
  color: var(--color-text-secondary);
}

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

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

/* ============================
   TEXT UTILITIES
   ============================ */

/* Alignment */
.text-left {
  text-align: left;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-justify {
  text-align: justify;
}

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

.text-accent {
  color: var(--color-accent-500);
}

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

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

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

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

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

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

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

/* Transforms */
.text-uppercase {
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wider);
}

.text-lowercase {
  text-transform: lowercase;
}

.text-capitalize {
  text-transform: capitalize;
}

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

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

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

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

/* ============================
   LINKS
   ============================ */

a {
  color: var(--color-primary-500);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-accent-500);
}

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

.link-underline {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.link-underline:hover {
  text-decoration: none;
}

/* ============================
   LISTS
   ============================ */

ul.list-styled,
ol.list-styled {
  list-style: inherit;
  padding-left: var(--spacing-xl);
  margin-bottom: var(--spacing-md);
}

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

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

li {
  margin-bottom: var(--spacing-xs);
}

/* ============================
   BLOCKQUOTES
   ============================ */

blockquote {
  border-left: 4px solid var(--color-accent-500);
  padding-left: var(--spacing-lg);
  margin: var(--spacing-xl) 0;
  font-size: var(--font-size-lg);
  font-style: italic;
  color: var(--color-text-secondary);
}

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

blockquote cite {
  display: block;
  margin-top: var(--spacing-sm);
  font-size: var(--font-size-sm);
  font-style: normal;
  color: var(--color-text-muted);
}

/* ============================
   CODE
   ============================ */

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  padding: 0.2em 0.4em;
  background-color: var(--color-gray-100);
  border-radius: var(--border-radius-sm);
  color: var(--color-error);
}

pre {
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
  padding: var(--spacing-lg);
  background-color: var(--color-gray-900);
  color: var(--color-gray-50);
  border-radius: var(--border-radius-md);
  overflow-x: auto;
  margin-bottom: var(--spacing-md);
}

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

/* ============================
   HORIZONTAL RULE
   ============================ */

hr {
  border: 0;
  height: 1px;
  background-color: var(--color-border-light);
  margin: var(--spacing-2xl) 0;
}
