/* ===== Blog Styles — Don't Panic ===== */

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #6C63FF;
    --primary-dark: #5A52D5;
    --primary-light: #8B83FF;
    --primary-subtle: #f0eeff;
    --text: #1a1a2e;
    --text-secondary: #64748b;
    --bg: #ffffff;
    --bg-alt: #f8fafc;
    --border: #e2e8f0;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,.12);
    --max-width: 1200px;
    --article-width: 720px;
    --transition: .25s ease;
}

html { scroll-behavior: smooth; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; display: block; }

/* ---------- Reading Progress Bar ---------- */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    z-index: 9999;
    transition: width 50ms linear;
    border-radius: 0 2px 2px 0;
}

/* ---------- Navbar ---------- */
.navbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    transition: box-shadow var(--transition);
}
.navbar.scrolled { box-shadow: var(--shadow-md); }
.nav-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-img { width: 36px; height: 36px; border-radius: 8px; }
.logo-text { font-size: 1.15rem; font-weight: 700; color: var(--text); }

.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a { color: var(--text-secondary); font-size: .935rem; font-weight: 500; transition: color var(--transition); }
.nav-links a:hover { color: var(--primary); }
.nav-links a.active { color: var(--primary); font-weight: 600; }

.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 22px; border-radius: 50px; font-weight: 600; font-size: .935rem; transition: all var(--transition); text-decoration: none; cursor: pointer; border: none; }
.btn-primary { background: var(--primary); color: #fff !important; }
.btn-primary:hover { background: var(--primary-dark); color: #fff !important; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-sm { padding: 8px 18px; font-size: .875rem; }

.apple-icon { width: 16px; height: 16px; }

.mobile-menu-btn {
    display: none;
    flex-direction: column; gap: 5px;
    background: none; border: none; cursor: pointer; padding: 4px;
}
.mobile-menu-btn span { display: block; width: 24px; height: 2px; background: var(--text); border-radius: 2px; transition: all var(--transition); }

/* ---------- Blog Index ---------- */
.blog-hero {
    padding: 140px 24px 60px;
    text-align: center;
    background: linear-gradient(135deg, #f0eeff 0%, #e8f4fd 100%);
}
.blog-hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -.02em;
    margin-bottom: 12px;
    color: var(--text);
}
.blog-hero p {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto;
}

.blog-grid-section { padding: 60px 24px 80px; }
.blog-grid-container { max-width: var(--max-width); margin: 0 auto; }
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 32px;
}

.blog-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all var(--transition);
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
}
.blog-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
    color: inherit;
}
.blog-card-body { padding: 28px; flex: 1; display: flex; flex-direction: column; }
.blog-card-tag {
    display: inline-block;
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--primary);
    margin-bottom: 12px;
}
.blog-card-body h2 {
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 10px;
}
.blog-card-body p {
    font-size: .95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    flex: 1;
}
.blog-card-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 28px;
    border-top: 1px solid var(--border);
    font-size: .82rem;
    color: var(--text-secondary);
}

/* ---------- Article Page ---------- */
.article-header {
    padding: 140px 24px 48px;
    text-align: center;
    background: linear-gradient(135deg, #f0eeff 0%, #e8f4fd 100%);
}
.article-header .breadcrumb {
    font-size: .88rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}
.article-header .breadcrumb a { color: var(--primary); }
.article-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -.025em;
    max-width: 780px;
    margin: 0 auto 20px;
    line-height: 1.18;
}
.article-header .article-meta {
    font-size: .92rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}
.article-header .article-meta span { display: flex; align-items: center; gap: 4px; }
.article-header .article-meta .meta-dot { color: #cbd5e1; }
.article-header .article-meta time { color: var(--text-secondary); }

/* --- Article Content --- */
.article-content {
    max-width: var(--article-width);
    margin: 0 auto;
    padding: 56px 24px 80px;
}

/* Drop cap on first paragraph */
.article-content > p:first-child::first-letter {
    float: left;
    font-size: 3.4em;
    line-height: .85;
    font-weight: 700;
    color: var(--primary);
    margin-right: 8px;
    margin-top: 6px;
}

.article-content h2 {
    font-size: 1.55rem;
    font-weight: 700;
    margin: 56px 0 20px;
    color: var(--text);
    letter-spacing: -.015em;
    line-height: 1.3;
}

.article-content h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 40px 0 12px;
    color: var(--text);
    padding-left: 16px;
    border-left: 3px solid var(--primary);
}

.article-content p {
    margin-bottom: 24px;
    font-size: 1.08rem;
    line-height: 1.85;
    color: #334155;
}
.article-content ul, .article-content ol {
    margin: 0 0 28px 20px;
    font-size: 1.08rem;
    line-height: 1.85;
    color: #334155;
}
.article-content li {
    margin-bottom: 10px;
    padding-left: 4px;
}
.article-content li::marker {
    color: var(--primary);
}
.article-content strong { color: var(--text); font-weight: 600; }
.article-content em { color: #475569; }

.article-content blockquote {
    border-left: 4px solid var(--primary);
    margin: 36px 0;
    padding: 24px 28px;
    background: var(--bg-alt);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-style: italic;
    color: #475569;
    font-size: 1.05rem;
    line-height: 1.75;
}

/* --- Table Styling --- */
.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 32px 0;
    font-size: .98rem;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}
.article-content thead {
    background: var(--primary-subtle);
}
.article-content th {
    padding: 14px 18px;
    text-align: left;
    font-weight: 600;
    color: var(--text);
    font-size: .9rem;
    letter-spacing: .01em;
    border-bottom: 2px solid var(--primary-light);
}
.article-content td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    color: #334155;
    line-height: 1.6;
}
.article-content tbody tr:last-child td { border-bottom: none; }
.article-content tbody tr:hover { background: var(--bg-alt); }

/* --- In-article CTA box --- */
.article-cta {
    background: linear-gradient(135deg, #f0eeff 0%, #e8f4fd 100%);
    border: 1px solid #d4d0ff;
    border-radius: 16px;
    padding: 40px 36px;
    margin: 48px 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.article-cta::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(108,99,255,.12) 0%, transparent 70%);
    border-radius: 50%;
}
.article-cta::after {
    content: '';
    position: absolute;
    bottom: -30px;
    left: -30px;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(108,99,255,.08) 0%, transparent 70%);
    border-radius: 50%;
}
.article-cta h3 {
    margin: 0 0 10px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    border-left: none;
    padding-left: 0;
    position: relative;
}
.article-cta p {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 1rem;
    line-height: 1.65;
    position: relative;
}
.article-cta .btn {
    margin-top: 4px;
    position: relative;
    padding: 12px 28px;
    font-size: 1rem;
}

/* --- Horizontal rule between sections --- */
.article-content hr {
    border: none;
    height: 1px;
    background: var(--border);
    margin: 56px 0;
}

/* --- Related articles --- */
.related-articles {
    max-width: var(--article-width);
    margin: 0 auto;
    padding: 0 24px 80px;
    border-top: 1px solid var(--border);
    padding-top: 48px;
}
.related-articles h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text);
}
.related-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.related-card {
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: inherit;
    transition: all var(--transition);
    position: relative;
}
.related-card::after {
    content: '→';
    position: absolute;
    bottom: 24px;
    right: 24px;
    font-size: 1.1rem;
    color: var(--primary);
    opacity: 0;
    transform: translateX(-4px);
    transition: all var(--transition);
}
.related-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-md);
    color: inherit;
    transform: translateY(-2px);
}
.related-card:hover::after { opacity: 1; transform: translateX(0); }
.related-card h3 { font-size: 1.02rem; font-weight: 600; margin-bottom: 8px; line-height: 1.4; }
.related-card p { font-size: .88rem; color: var(--text-secondary); margin: 0; line-height: 1.55; padding-right: 24px; }

/* ---------- Back to Top Button ---------- */
.back-to-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: all var(--transition);
    z-index: 900;
}
.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.back-to-top:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}
.back-to-top svg { width: 20px; height: 20px; }

/* ---------- Footer ---------- */
.footer {
    background: var(--text);
    color: #cbd5e1;
    padding: 60px 24px 32px;
}
.footer .container { max-width: var(--max-width); margin: 0 auto; }
.footer-content { display: flex; gap: 60px; flex-wrap: wrap; margin-bottom: 40px; }
.footer-brand { max-width: 280px; }
.footer-brand .logo-text { color: #fff; }
.footer-brand p { font-size: .9rem; line-height: 1.6; margin-top: 12px; }
.footer-links { display: flex; gap: 60px; flex-wrap: wrap; }
.footer-column h4 { color: #fff; font-size: .9rem; font-weight: 600; margin-bottom: 16px; }
.footer-column a { display: block; color: #94a3b8; font-size: .88rem; margin-bottom: 10px; transition: color var(--transition); }
.footer-column a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid #334155; padding-top: 24px; text-align: center; }
.footer-bottom p { font-size: .82rem; color: #64748b; margin-bottom: 4px; }
.disclaimer { font-size: .78rem !important; font-style: italic; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .mobile-menu-btn { display: flex; }
    .nav-links {
        display: none;
        position: absolute; top: 64px; left: 0; right: 0;
        background: #fff; border-bottom: 1px solid var(--border);
        flex-direction: column; padding: 20px 24px; gap: 16px;
        box-shadow: var(--shadow-md);
    }
    .nav-links.active { display: flex; }

    .blog-hero h1 { font-size: 1.8rem; }
    .blog-grid { grid-template-columns: 1fr; }

    .article-header h1 { font-size: 1.75rem; line-height: 1.25; }
    .article-content { padding-top: 40px; }
    .article-content h2 { font-size: 1.35rem; margin-top: 44px; }
    .article-content h3 { font-size: 1.08rem; }
    .article-content p, .article-content ul, .article-content ol { font-size: 1.02rem; }
    .article-content > p:first-child::first-letter { font-size: 2.8em; }
    .article-cta { padding: 28px 24px; }

    .related-grid { grid-template-columns: 1fr; }
    .related-card::after { display: none; }

    .footer-content { flex-direction: column; gap: 32px; }
    .footer-links { gap: 32px; }
    .back-to-top { bottom: 20px; right: 20px; width: 40px; height: 40px; }
}

@media (max-width: 480px) {
    .blog-hero { padding-top: 110px; }
    .article-header { padding: 110px 20px 40px; }
    .article-header h1 { font-size: 1.5rem; }
    .blog-card-body { padding: 20px; }
    .blog-card-meta { padding: 12px 20px; }
}