/* ========================================
   BASE STYLES - Resets & Typography
   ======================================== */

/* Universal Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Body Base Styles */
body {
    font-family: 'Poppins', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: var(--font-base);
    line-height: 1.8;
    color: #334155;
    background: #f8fafc;
    min-height: 100vh;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Paragraph Styles */
p {
    line-height: 1.8;
    color: #334155;
}

/* Accessibility - Focus Visible */
:focus-visible {
    outline: 3px solid var(--secondary);
    outline-offset: 3px;
}

/* Screen Reader Only Content */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
    white-space: nowrap;
}

/* ========================================
   HEADING STYLES
   ======================================== */

h1 {
    font-family: 'Merriweather', 'Georgia', serif;
    color: var(--primary);
    font-size: 1.25rem;
    margin: 0;
    line-height: 1.3;
    font-weight: 700;
    letter-spacing: -0.01em;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h2 {
    font-family: 'Merriweather', 'Georgia', serif;
    color: var(--primary);
    margin-bottom: var(--space-xl);
    border-bottom: 3px solid var(--primary);
    padding-bottom: var(--space-md);
    font-size: var(--font-2xl);
    font-weight: 700;
    letter-spacing: -0.01em;
    position: relative;
}

h2::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, var(--secondary), transparent);
}

h3 {
    font-family: 'Merriweather', 'Georgia', serif;
    color: var(--text-primary);
    margin-top: var(--space-xl);
    margin-bottom: var(--space-md);
    font-size: var(--font-xl);
    font-weight: 600;
    letter-spacing: -0.01em;
    position: relative;
    padding-left: var(--space-md);
}

h3::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.4em;
    width: 4px;
    height: 1.2em;
    background: linear-gradient(180deg, var(--primary), var(--primary-light));
    border-radius: 2px;
}

h4 {
    margin-top: var(--space-lg);
    margin-bottom: var(--space-md);
    color: var(--text-primary);
    font-size: var(--font-lg);
    font-weight: 600;
    position: relative;
    padding-left: 0;
}

h4::before {
    content: none;
}

h5 {
    margin-top: var(--space-md);
    margin-bottom: var(--space-sm);
    color: var(--text-secondary);
    font-size: var(--font-base);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.9rem;
}

/* Subtitle */
.subtitle {
    color: #6b7280;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.01em;
    margin: 0;
    opacity: 0.9;
}

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

ul, ol {
    margin-left: var(--space-xl);
    margin-top: var(--space-md);
}

li {
    margin-bottom: var(--space-md);
    line-height: 1.7;
    color: var(--text-secondary);
}

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

strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* In-section anchor links */
.section-anchor {
    margin-left: 8px;
    font-size: 0.9rem;
    color: var(--text-tertiary);
    text-decoration: none;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

h2:hover .section-anchor,
h2:focus-within .section-anchor {
    opacity: 1;
}

/* ========================================
   THEME TOGGLE BUTTON
   ======================================== */

.theme-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-base);
    z-index: var(--z-sticky);
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-xl);
}

.theme-toggle:active {
    transform: scale(0.95);
}

/* ========================================
   RESPONSIVE TYPOGRAPHY
   ======================================== */

/* Tablet */
@media (max-width: 768px) {
    h2 {
        font-size: var(--font-xl);
    }

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

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

/* Mobile */
@media (max-width: 480px) {
    body {
        font-size: 16px;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: var(--font-xl);
        margin-bottom: var(--space-lg);
        padding-bottom: var(--space-sm);
    }

    h2::after {
        width: 60px;
    }

    h3 {
        font-size: var(--font-lg);
        margin-top: var(--space-lg);
    }

    li {
        font-size: var(--font-sm);
        margin-bottom: var(--space-sm);
    }

    ul, ol {
        margin-left: var(--space-lg);
    }
}

/* Extra small devices */
@media (max-width: 360px) {
    h1 {
        font-size: 1.5rem;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    body {
        background: white;
    }

    .no-print {
        display: none !important;
    }
}

/* ========================================
   REDUCED MOTION (Accessibility)
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }

    /* Allow only instant focus indicators for accessibility */
    button:focus-visible,
    a:focus-visible,
    input:focus-visible,
    select:focus-visible,
    textarea:focus-visible {
        transition: none !important;
    }
}
