/**
 * Webgentic - Typography System
 * Headings, body text, and typographic utilities
 */

/* === Heading Styles === */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  margin-bottom: var(--space-6);
  color: currentColor;
}

h1 {
  font-size: var(--text-5xl);
  margin-bottom: var(--space-8);
  font-weight: var(--weight-bold);
}

h2 {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-6);
  font-weight: var(--weight-bold);
}

h3 {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-6);
  font-weight: var(--weight-semibold);
}

h4 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-4);
}

h5 {
  font-size: var(--text-lg);
  margin-bottom: var(--space-4);
}

h6 {
  font-size: var(--text-base);
  margin-bottom: var(--space-4);
  font-weight: var(--weight-semibold);
}

/* === Paragraph Styles === */
p {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-6);
  color: currentColor;
}

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

/* === Lead Text (Larger intro paragraphs) === */
.text-lead {
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  font-weight: var(--weight-regular);
  opacity: 0.9;
}

/* === Subheadings === */
.subheading {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  font-weight: var(--weight-medium);
  line-height: var(--leading-normal);
  opacity: 0.9;
  margin-bottom: var(--space-8);
}

.subheading--large {
  font-size: var(--text-xl);
}

/* === Caption & Metadata === */
.caption,
.metadata {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: var(--leading-normal);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  opacity: 0.85;
}

/* === Code & Technical Text === */
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background-color: rgba(0, 224, 255, 0.1);
  padding: 0.2em 0.4em;
  border-radius: var(--radius-sm);
  color: var(--color-accent);
}

pre {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  background-color: rgba(12, 15, 30, 0.95);
  padding: var(--space-6);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin-bottom: var(--space-6);
}

pre code {
  background: none;
  padding: 0;
  color: var(--color-highlight);
}

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

a:hover {
  color: var(--color-highlight);
}

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

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

li {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-3);
}

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

/* === Blockquote === */
blockquote {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  font-style: italic;
  border-left: 4px solid var(--color-accent);
  padding-left: var(--space-6);
  margin: var(--space-8) 0;
  opacity: 0.9;
}

/* === Horizontal Rule === */
hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: var(--space-12) 0;
}

/* === Typography Utilities === */

/* Font Weight */
.font-regular {
  font-weight: var(--weight-regular);
}

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

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

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

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

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

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

/* Font Size */
.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);
}

/* Line Height */
.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);
}

/* Letter Spacing */
.tracking-tight {
  letter-spacing: var(--tracking-tight);
}

.tracking-normal {
  letter-spacing: var(--tracking-normal);
}

.tracking-wide {
  letter-spacing: var(--tracking-wide);
}

.tracking-wider {
  letter-spacing: var(--tracking-wider);
}

/* Text Transform */
.uppercase {
  text-transform: uppercase;
}

.lowercase {
  text-transform: lowercase;
}

.capitalize {
  text-transform: capitalize;
}

/* Text Decoration */
.underline {
  text-decoration: underline;
}

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

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

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

/* Better contrast for captions on light backgrounds */
.section--light .caption.text-accent,
.section--light .metadata.text-accent {
  color: #6B5BA5;
  opacity: 1;
}

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

.text-surface {
  color: #ffffff;
}

/* Opacity */
.opacity-50 {
  opacity: 0.5;
}

.opacity-70 {
  opacity: 0.7;
}

.opacity-85 {
  opacity: 0.85;
}

.opacity-90 {
  opacity: 0.9;
}

/* === Special Text Styles === */

/* Italic brand name */
.brand-name {
  font-family: var(--font-heading);
  font-style: italic;
  font-weight: var(--weight-bold);
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% auto;
}

/* Gradient text effect */
.text-gradient {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% auto;
}

.text-gradient-cognitive {
  background: var(--gradient-cognitive);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% auto;
}

/* Glow text effect */
.text-glow {
  color: var(--color-accent);
  text-shadow: 0 0 20px rgba(0, 224, 255, 0.5);
}

/* Balanced text wrapping */
.text-balance {
  text-wrap: balance;
}

/* Prevent orphans */
.text-pretty {
  text-wrap: pretty;
}

/* === Responsive Typography Adjustments === */
@media (max-width: 767px) {
  h1 {
    letter-spacing: var(--tracking-normal);
  }

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

/* === Selection Styling === */
::selection {
  background-color: rgba(0, 224, 255, 0.3);
  color: var(--color-primary);
}

::-moz-selection {
  background-color: rgba(0, 224, 255, 0.3);
  color: var(--color-primary);
}
