/**
 * Familytree 2.0 - Typography
 * Mobile-first typography system
 */

/* ============================================
   Base Typography
   ============================================ */

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

/* ============================================
   Headings
   ============================================ */

h1, .h1 {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  line-height: 1.1;
  margin-bottom: var(--space-lg);
}

h2, .h2 {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-semibold);
  line-height: 1.2;
  margin-bottom: var(--space-md);
}

h3, .h3 {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  line-height: 1.3;
  margin-bottom: var(--space-md);
}

h4, .h4 {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-medium);
  line-height: 1.4;
  margin-bottom: var(--space-sm);
}

h5, .h5 {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-medium);
  line-height: 1.4;
  margin-bottom: var(--space-sm);
}

h6, .h6 {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  line-height: 1.4;
  margin-bottom: var(--space-sm);
}

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

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

/* ============================================
   Paragraphs
   ============================================ */

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

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

.lead {
  font-size: var(--font-size-lg);
  line-height: 1.6;
  color: var(--color-text-secondary);
}

.small {
  font-size: var(--font-size-sm);
  line-height: 1.5;
}

.tiny {
  font-size: var(--font-size-xs);
  line-height: 1.4;
}

/* ============================================
   Text Utilities
   ============================================ */

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

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

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

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

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

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

.text-uppercase {
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

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

/* ============================================
   Font Weights
   ============================================ */

.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);
}

/* ============================================
   Line Clamp
   ============================================ */

.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================
   Monospace
   ============================================ */

code,
kbd,
pre,
samp {
  font-family: var(--font-family-mono);
  font-size: 0.9em;
}

code {
  padding: 2px 6px;
  background-color: var(--color-bg-secondary);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
}

pre {
  padding: var(--space-md);
  background-color: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  overflow-x: auto;
  line-height: 1.6;
}

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

/* ============================================
   Links
   ============================================ */

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-smooth);
}

a:hover {
  color: var(--color-text-secondary);
}

a:active {
  color: var(--color-text-muted);
}

.link-underline {
  text-decoration: underline;
  text-underline-offset: 2px;
}

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

/* ============================================
   Star Label Typography
   ============================================ */

.star-label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  letter-spacing: 0.02em;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

@media (min-width: 768px) {
  .star-label {
    font-size: var(--font-size-sm);
  }
}

/* ============================================
   Info Panel Typography
   ============================================ */

.panel-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  line-height: 1.2;
  margin-bottom: var(--space-md);
}

.panel-subtitle {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-normal);
  color: var(--color-text-muted);
  line-height: 1.4;
}

.panel-section-title {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-medium);
  margin-bottom: var(--space-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
}

/* ============================================
   Mobile Nav Typography
   ============================================ */

.nav-label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  line-height: 1;
  margin-top: var(--space-xs);
}

/* ============================================
   Responsive Typography
   ============================================ */

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

  .panel-title {
    font-size: var(--font-size-2xl);
  }
}

/* ============================================
   Text Selection
   ============================================ */

::selection {
  background-color: rgba(102, 126, 234, 0.3);
  color: var(--color-text-primary);
}

::-moz-selection {
  background-color: rgba(102, 126, 234, 0.3);
  color: var(--color-text-primary);
}
