/**
 * Typography System
 *
 * Fluid typography with complete text hierarchy
 * Uses CSS clamp() for seamless responsive scaling
 *
 * @package MattressProtectorReviews
 * @version 2.0.0 - Design System Transformation
 */

/* ============================================
   FONT IMPORT
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap');

/* ============================================
   BASE TYPOGRAPHY
   ============================================ */
body,
.product-review-single {
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--text-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   FLUID HEADINGS
   Automatically scale based on viewport
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-heading);
    margin-bottom: var(--space-md);
    letter-spacing: -0.02em;
}

h1 {
    font-size: var(--text-4xl);
    line-height: 1.2;
    margin-bottom: var(--space-lg);
}

h2 {
    font-size: var(--text-3xl);
    line-height: 1.25;
    margin-bottom: var(--space-lg);
}

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

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

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

h6 {
    font-size: var(--text-base);
    margin-bottom: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============================================
   PARAGRAPHS & TEXT BLOCKS
   ============================================ */
p {
    margin-bottom: var(--space-md);
    line-height: 1.7;
}

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

.lead {
    font-size: var(--text-lg);
    line-height: 1.8;
    color: var(--text-body);
    margin-bottom: var(--space-lg);
}

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

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

/* ============================================
   TEXT UTILITIES
   ============================================ */
.text-heading {
    color: var(--text-heading);
}

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

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

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

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

/* Font Weights */
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* 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; }
.lowercase { text-transform: lowercase; }
.capitalize { text-transform: capitalize; }

/* ============================================
   LINKS
   ============================================ */
a {
    color: var(--blue-600);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--blue-700);
    text-decoration: underline;
}

a:focus-visible {
    outline: 2px solid var(--blue-300);
    outline-offset: 2px;
    border-radius: 2px;
}

/* ============================================
   LISTS
   ============================================ */
ul, ol {
    margin-bottom: var(--space-md);
    padding-left: 1.5rem;
}

li {
    margin-bottom: var(--space-xs);
    line-height: 1.7;
}

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

/* Unstyled List */
.list-unstyled {
    list-style: none;
    padding-left: 0;
}

.list-unstyled li {
    margin-bottom: 0.5rem;
}

/* Inline List */
.list-inline {
    list-style: none;
    padding-left: 0;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.list-inline li {
    margin-bottom: 0;
}

/* ============================================
   BLOCKQUOTES
   ============================================ */
blockquote {
    margin: var(--space-lg) 0;
    padding: var(--space-md) var(--space-lg);
    background: var(--layer-3);
    border-radius: var(--radius-lg);
    border-left: 4px solid var(--blue-600);
    box-shadow: var(--shadow-small);
}

blockquote p {
    font-size: var(--text-lg);
    font-style: italic;
    color: var(--text-body);
    line-height: 1.8;
}

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

blockquote cite::before {
    content: '— ';
}

/* ============================================
   CODE & PREFORMATTED TEXT
   ============================================ */
code {
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.875em;
    padding: 0.125rem 0.375rem;
    background: var(--layer-3);
    color: var(--red-600);
    border-radius: var(--radius-sm);
}

pre {
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: var(--text-sm);
    padding: var(--space-md);
    background: var(--gray-900);
    color: var(--gray-100);
    border-radius: var(--radius-lg);
    overflow-x: auto;
    margin-bottom: var(--space-md);
    box-shadow: var(--shadow-medium);
}

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

/* ============================================
   HORIZONTAL RULES
   ============================================ */
hr {
    border: none;
    height: 2px;
    background: var(--layer-3);
    margin: var(--space-xl) 0;
}

/* ============================================
   TEXT EMPHASIS
   ============================================ */
strong, b {
    font-weight: 700;
    color: var(--text-heading);
}

em, i {
    font-style: italic;
}

mark {
    background: var(--yellow-100);
    color: var(--gray-900);
    padding: 0.125rem 0.25rem;
    border-radius: 2px;
}

/* ============================================
   TRUNCATION
   ============================================ */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

/* ============================================
   GRADIENT TEXT
   ============================================ */
.gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gradient-text-cta {
    background: var(--gradient-cta);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   RESPONSIVE TYPOGRAPHY ADJUSTMENTS
   ============================================ */
@media (max-width: 768px) {
    body,
    .product-review-single {
        line-height: 1.7;
    }

    /* Ensure minimum 16px for form inputs (prevents zoom on iOS) */
    input, textarea, select {
        font-size: 16px !important;
    }

    /* Reduce letter spacing on small screens */
    h1, h2, h3 {
        letter-spacing: -0.01em;
    }

    /* Tighter spacing on mobile */
    h1 { margin-bottom: var(--space-md); }
    h2 { margin-bottom: var(--space-md); }
    p { margin-bottom: var(--space-sm); }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
/* Focus visible for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--blue-600);
    outline-offset: 2px;
}

/* Skip links for screen readers */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--gray-900);
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    body {
        color: var(--black);
    }

    h1, h2, h3, h4, h5, h6 {
        color: var(--black);
    }

    a {
        text-decoration: underline;
    }
}
