/**
 * Afoomart Typography System
 * High legibility, commercial visual hierarchy, responsive scale
 *
 * Roles:
 * - Display: Promotional headers, hero banners
 * - H1: Page titles
 * - H2: Major section headings
 * - H3: Subsection headings
 * - H4: Card titles, modal headers
 * - H5: Small component headings
 * - Body Large: Lead paragraphs, important notices
 * - Body: Default reading text
 * - Body Small: Secondary information, list items
 * - Caption: Metadata, timestamps, helper notes
 * - Label: Form labels, filters, table headers
 * - Overline: Category tags, micro-badges, uppercase tracking
 * - Price: Currency & standard product pricing
 * - Sale Price: Highlighted discounted pricing
 * - Product Title: E-commerce product name with 2-line clamp
 */

/* ==================================================
   1. Headings & Display Scale
   ================================================== */
.af-display {
  font-family: var(--font-family-heading);
  font-size: var(--font-size-display);
  font-weight: var(--font-weight-extrabold);
  line-height: var(--line-height-tight);
  color: var(--color-primary-dark);
  letter-spacing: -0.03em;
}

h1, .af-h1 {
  font-family: var(--font-family-heading);
  font-size: var(--font-size-h1);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--color-text);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-3);
}

h2, .af-h2 {
  font-family: var(--font-family-heading);
  font-size: var(--font-size-h2);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-snug);
  color: var(--color-text);
  letter-spacing: -0.015em;
  margin-bottom: var(--space-2);
}

h3, .af-h3 {
  font-family: var(--font-family-heading);
  font-size: var(--font-size-h3);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-snug);
  color: var(--color-text);
  letter-spacing: -0.01em;
  margin-bottom: var(--space-2);
}

h4, .af-h4 {
  font-family: var(--font-family-heading);
  font-size: var(--font-size-h4);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-normal);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

h5, .af-h5 {
  font-family: var(--font-family-heading);
  font-size: var(--font-size-h5);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-normal);
  color: var(--color-text);
  margin-bottom: var(--space-1);
}

/* ==================================================
   2. Body & Content Scale
   ================================================== */
p {
  margin-bottom: var(--space-3);
  color: var(--color-text);
  line-height: var(--line-height-normal);
}

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

.af-body-large {
  font-size: var(--font-size-body-large);
  line-height: var(--line-height-relaxed);
  color: var(--color-text);
}

.af-body {
  font-size: var(--font-size-body);
  line-height: var(--line-height-normal);
  color: var(--color-text);
}

.af-body-small {
  font-size: var(--font-size-body-small);
  line-height: var(--line-height-normal);
  color: var(--color-text-secondary);
}

.af-caption {
  font-size: var(--font-size-caption);
  line-height: var(--line-height-normal);
  color: var(--color-text-muted);
}

.af-label {
  font-size: var(--font-size-label);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
  display: block;
  margin-bottom: var(--space-1);
}

.af-overline {
  font-size: var(--font-size-overline);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-secondary);
  line-height: 1;
}

/* ==================================================
   3. Marketplace Specific Typography
   ================================================== */

/* Product Title (2-line clamped e-commerce title) */
.af-product-title {
  font-family: var(--font-family-sans);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-snug);
  color: var(--color-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 2.6em;
  text-overflow: ellipsis;
  margin-bottom: var(--space-1);
  transition: color var(--transition-fast);
}

.af-product-title:hover {
  color: var(--color-accent);
}

/* Price System */
.af-price {
  font-family: var(--font-family-sans);
  font-size: var(--font-size-price);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  line-height: var(--line-height-none);
}

.af-price-large {
  font-size: var(--font-size-price-large);
  font-weight: var(--font-weight-extrabold);
  color: var(--color-primary-dark);
}

.af-price-sale {
  color: var(--color-text);
  font-weight: var(--font-weight-bold);
}

.af-price-original,
.af-price-old {
  font-size: var(--font-size-caption);
  color: var(--color-text-muted);
  text-decoration: line-through;
  font-weight: var(--font-weight-regular);
  margin-left: var(--space-1);
}

.af-price-discount {
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-bold);
  color: var(--color-discount-badge-text);
  background-color: var(--color-discount-badge-bg);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  margin-left: var(--space-1);
  display: inline-block;
  line-height: 1;
}

/* Section Header Typography */
.af-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background-color: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  margin-bottom: 0;
}

.af-section-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-h3);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
  margin: 0;
}

.af-section-title-accent {
  width: 4px;
  height: 18px;
  background-color: var(--color-accent);
  border-radius: var(--radius-sm);
  display: inline-block;
}

.af-section-link {
  font-size: var(--font-size-body-small);
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary);
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.af-section-link:hover {
  color: var(--color-accent);
}

/* ==================================================
   4. Font Weight Helper Utilities
   ================================================== */
.af-font-regular   { font-weight: var(--font-weight-regular); }
.af-font-medium    { font-weight: var(--font-weight-medium); }
.af-font-semibold  { font-weight: var(--font-weight-semibold); }
.af-font-bold      { font-weight: var(--font-weight-bold); }
.af-font-extrabold { font-weight: var(--font-weight-extrabold); }

/* Text Color Utilities */
.af-text-primary   { color: var(--color-primary); }
.af-text-accent    { color: var(--color-accent); }
.af-text-muted     { color: var(--color-text-muted); }
.af-text-secondary { color: var(--color-text-secondary); }
.af-text-success   { color: var(--color-success); }
.af-text-warning   { color: var(--color-warning); }
.af-text-error     { color: var(--color-error); }
.af-text-white     { color: var(--color-text-inverse); }

/* Screen Reader Utility */
.screen-reader-text,
.af-sr-only {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute !important;
  width: 1px;
  word-wrap: normal !important;
}

/* ==================================================
   5. Responsive Typography Scaling
   ================================================== */
@media (max-width: 767px) {
  .af-display {
    font-size: 2rem; /* 32px on mobile */
  }

  h1, .af-h1 {
    font-size: 1.625rem; /* 26px on mobile */
  }

  h2, .af-h2 {
    font-size: 1.25rem; /* 20px on mobile */
  }

  h3, .af-h3 {
    font-size: 1.125rem; /* 18px on mobile */
  }
}
