/* ==========================================================================
   SEO Blog - Main Stylesheet
   Optimized for performance and responsive design
   ========================================================================== */

/* Root Variables */
:root {
    --primary-color: #2a5298;
    --primary-dark: #1e3c72;
    --accent-color: #4a90e2;
    --text-dark: #333333;
    --text-light: #666666;
    --text-muted: #999999;
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --border-color: #e0e0e0;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.15);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.7;
    color: var(--text-dark);
    background-color: var(--bg-light);
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); margin-top: 2.5rem; }
h3 { font-size: clamp(1.5rem, 3vw, 2rem); margin-top: 2rem; }
h4 { font-size: clamp(1.25rem, 2.5vw, 1.75rem); }
h5 { font-size: clamp(1.1rem, 2vw, 1.5rem); }

p {
    margin-bottom: 1.25rem;
    color: var(--text-light);
}

.lead {
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    color: var(--bg-white);
    padding: 80px 20px;
    text-align: center;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0.3;
    animation: heroPattern 20s linear infinite;
}

@keyframes heroPattern {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin: 0 auto;
}

.hero h1 {
    color: var(--bg-white);
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.hero p {
    color: rgba(255, 255, 255, 0.95);
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    margin-bottom: 0;
}

/* Table of Contents */
.toc-wrapper {
    background: var(--bg-white);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.toc-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--primary-color);
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

.toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc li {
    margin-bottom: 0.5rem;
}

.toc a {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--text-light);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    text-decoration: none;
}

.toc a:hover {
    background: var(--bg-light);
    color: var(--primary-color);
    padding-left: 1rem;
    text-decoration: none;
}

/* Article Content */
.article-content {
    background: var(--bg-white);
    padding: 3rem 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.content-section {
    margin-bottom: 3rem;
}

.content-section:last-child {
    margin-bottom: 0;
}

/* Cards */
.card {
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    font-weight: 600;
}

/* Highlight Box */
.highlight-box {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 2rem;
    border-radius: var(--radius-lg);
    border-left: 4px solid var(--primary-color);
    margin: 2rem 0;
}

.highlight-box h4 {
    color: var(--primary-dark);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.highlight-box ul {
    margin-bottom: 0;
    padding-left: 1.5rem;
}

.highlight-box li {
    margin-bottom: 0.5rem;
    color: var(--text-light);
}

/* Feature Cards */
.feature-card {
    background: var(--bg-white);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    height: 100%;
    transition: var(--transition);
}

.feature-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
}

.feature-card h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.feature-card p {
    margin-bottom: 0;
    font-size: 0.95rem;
}

/* Use Case Cards */
.use-case-card {
    background: var(--bg-white);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    height: 100%;
    text-align: center;
    transition: var(--transition);
}

.use-case-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-6px);
}

.icon-wrapper {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    border-radius: 50%;
    color: var(--bg-white);
}

.use-case-card h4 {
    color: var(--primary-dark);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.use-case-card p {
    font-size: 0.95rem;
    margin-bottom: 0;
    text-align: left;
}

/* Accordion (FAQ) */
.accordion-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    overflow: hidden;
}

.accordion-button {
    font-weight: 600;
    color: var(--text-dark);
    background-color: var(--bg-light);
    padding: 1.25rem 1.5rem;
}

.accordion-button:not(.collapsed) {
    background-color: var(--primary-color);
    color: var(--bg-white);
}

.accordion-button:focus {
    box-shadow: none;
    border-color: var(--primary-color);
}

.accordion-body {
    padding: 1.5rem;
    background: var(--bg-white);
}

/* Table Styling */
.table-responsive {
    margin: 2rem 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table {
    margin-bottom: 0;
}

.table th {
    background-color: var(--bg-light);
    font-weight: 600;
    color: var(--primary-dark);
    padding: 1rem;
}

.table td {
    padding: 1rem;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: rgba(42, 82, 152, 0.05);
}

/* CTA Box */
.cta-box {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    color: var(--bg-white);
    padding: 3rem 2rem;
    border-radius: var(--radius-lg);
    margin: 3rem 0 2rem;
    box-shadow: var(--shadow-lg);
}

.cta-box h3 {
    color: var(--bg-white);
    margin-bottom: 1rem;
    font-size: 1.75rem;
}

.cta-box p {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.cta-box .btn {
    margin: 0.5rem;
}

/* Author Box */
.author-box {
    background: var(--bg-light);
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    margin-top: 3rem;
}

.author-avatar {
    color: var(--primary-color);
    flex-shrink: 0;
}

.author-box h4 {
    margin-bottom: 0.25rem;
    color: var(--text-dark);
    font-size: 1.25rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: var(--transition);
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--bg-white);
    border: 2px solid var(--primary-color);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: var(--bg-white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    text-decoration: none;
}

.btn-outline-primary {
    background: transparent;
    color: var(--bg-white);
    border: 2px solid var(--bg-white);
}

.btn-outline-primary:hover {
    background: var(--bg-white);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    text-decoration: none;
}

/* Footer */
.footer {
    background: var(--text-dark);
    color: var(--bg-white);
    padding: 2rem 0;
    margin-top: 4rem;
}

.footer a {
    color: rgba(255, 255, 255, 0.7);
    transition: var(--transition);
}

.footer a:hover {
    color: var(--bg-white);
}

/* Responsive Design */
@media (max-width: 991.98px) {
    .article-content {
        padding: 2rem 1.5rem;
    }
    
    .hero {
        padding: 60px 20px;
        min-height: 300px;
    }
    
    h2 {
        margin-top: 2rem;
    }
}

@media (max-width: 767.98px) {
    .article-content {
        padding: 1.5rem 1rem;
    }
    
    .hero {
        padding: 40px 15px;
        min-height: 250px;
    }
    
    .highlight-box,
    .cta-box {
        padding: 1.5rem;
    }
    
    .use-case-card,
    .feature-card {
        margin-bottom: 1.5rem;
    }
}

/* Accessibility */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 999;
    padding: 1em;
    background: var(--primary-color);
    color: var(--bg-white);
}

.skip-link:focus {
    left: 0;
}

/* Print Styles */
@media print {
    .hero,
    .toc-wrapper,
    .footer,
    .cta-box {
        display: none;
    }
    
    .article-content {
        box-shadow: none;
        padding: 0;
    }
    
    a[href^="http"]:after {
        content: " (" attr(href) ")";
    }
}

/* Performance Optimizations */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Loading States */
.lazy-image {
    opacity: 0;
    transition: opacity 0.3s;
}

.lazy-image.loaded {
    opacity: 1;
}
