/* ============================================================
   BAC Calculator - Global Stylesheet
   ============================================================ */

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

:root {
    --primary:       #667eea;
    --primary-dark:  #764ba2;
    --primary-light: #f0f4ff;
    --success:       #00d084;
    --warning:       #ffd700;
    --danger:        #ff6b6b;
    --danger-dark:   #c1121f;
    --text-dark:     #1a1a2e;
    --text-mid:      #444;
    --text-light:    #666;
    --border:        #e0e0e0;
    --bg-card:       #ffffff;
    --bg-body:       #f5f6fa;
    --radius:        12px;
    --shadow:        0 4px 20px rgba(102,126,234,0.12);
    --shadow-deep:   0 10px 40px rgba(0,0,0,0.15);
    --transition:    0.3s ease;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-body);
    color: var(--text-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; }
ul, ol { list-style: none; }

/* ---------- Topbar / Navigation ---------- */
.site-nav {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 16px rgba(102,126,234,0.35);
}

.nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.nav-brand span { font-size: 26px; }

.nav-links {
    display: flex;
    gap: 6px;
}

.nav-links a {
    color: rgba(255,255,255,0.85);
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    transition: background var(--transition), color var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.nav-hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background var(--transition);
}

.nav-hamburger:hover { background: rgba(255,255,255,0.15); }

.nav-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: all var(--transition);
}

/* Mobile nav */
@media (max-width: 680px) {
    .nav-hamburger { display: flex; }
    .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: linear-gradient(160deg, var(--primary) 0%, var(--primary-dark) 100%);
        padding: 12px 20px 20px;
        gap: 4px;
        box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    }
    .nav-links.open { display: flex; }
    .nav-links a { padding: 12px 14px; font-size: 15px; }
}

/* ---------- Page Hero ---------- */
.page-hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    text-align: center;
    padding: 60px 24px 50px;
}

.page-hero h1 {
    font-size: clamp(26px, 5vw, 42px);
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.page-hero p {
    font-size: clamp(15px, 2.5vw, 18px);
    opacity: 0.88;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ---------- Main Content Wrapper ---------- */
main { flex: 1; }

.content-section {
    max-width: 900px;
    margin: 0 auto;
    padding: 48px 24px;
}

.section-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-subtitle {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 28px;
}

/* ---------- Card Grid ---------- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin-top: 12px;
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(102,126,234,0.08);
    transition: transform var(--transition), box-shadow var(--transition);
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-deep);
}

.card-icon {
    font-size: 36px;
    margin-bottom: 14px;
    display: block;
}

.card h3 {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-dark);
}

.card p {
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.65;
}

/* ---------- Info Box / Alert ---------- */
.info-box {
    border-radius: var(--radius);
    padding: 20px 24px;
    margin: 20px 0;
    font-size: 14px;
    line-height: 1.65;
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.info-box .box-icon { font-size: 22px; flex-shrink: 0; margin-top: 2px; }
.info-box h4 { font-size: 15px; font-weight: 700; margin-bottom: 6px; }

.info-box.warning {
    background: #fff8e1;
    border: 2px solid #ffc107;
    color: #856404;
}

.info-box.danger {
    background: #ffe0e0;
    border: 2px solid var(--danger);
    color: #c62828;
}

.info-box.success {
    background: #f0fdf4;
    border: 2px solid var(--success);
    color: #1b5e20;
}

.info-box.info {
    background: var(--primary-light);
    border: 2px solid var(--primary);
    color: #2c3e9e;
}

/* ---------- Footer ---------- */
.site-footer {
    background: var(--text-dark);
    color: rgba(255,255,255,0.7);
    padding: 36px 24px;
    text-align: center;
    font-size: 13px;
    line-height: 1.8;
}

.site-footer a {
    color: rgba(255,255,255,0.85);
    border-bottom: 1px solid rgba(255,255,255,0.3);
    transition: color var(--transition);
}

.site-footer a:hover { color: #fff; }

.footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 18px;
    margin-bottom: 16px;
}

.footer-links a { border-bottom: none; opacity: 0.75; font-size: 14px; }
.footer-links a:hover { opacity: 1; }

/* ---------- Animations ---------- */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.animate-fade-up { animation: fadeUp 0.55s ease-out both; }
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }

/* ---------- Divider ---------- */
.divider {
    border: none;
    border-top: 2px solid var(--border);
    margin: 36px 0;
}

/* ---------- Badge ---------- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 600;
}

.badge-purple { background: var(--primary-light); color: var(--primary); }
.badge-green  { background: #f0fdf4; color: #1b5e20; }
.badge-red    { background: #ffe0e0; color: #c62828; }
.badge-yellow { background: #fff8e1; color: #856404; }

/* ---------- Blog Grid ---------- */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

/* Blog Card */
.blog-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.blog-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-deep);
}

.blog-thumb img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.blog-content {
    padding: 20px;
}

.blog-title {
    font-size: 18px;
    margin-bottom: 10px;
}

.blog-title a {
    color: var(--text-dark);
}

.blog-title a:hover {
    color: var(--primary);
}

.blog-meta {
    font-size: 12px;
    color: var(--text-light);
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
}

.blog-excerpt {
    font-size: 14px;
    color: var(--text-mid);
    margin-bottom: 14px;
}

.blog-read-more {
    font-weight: 600;
    color: var(--primary);
    font-size: 14px;
}








/* ---------- Blog Layout ---------- */
.blog-layout {
    display: grid;
    grid-template-columns: 2.2fr 1fr;
    gap: 28px;
    align-items: start;
}

/* Responsive */
@media (max-width: 900px) {
    .blog-layout {
        grid-template-columns: 1fr;
    }
}

/* ---------- Blog Cards ---------- */
.blog-card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.blog-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-deep);
}

.blog-thumb img {
    width: 100%;
    height: 240px;
    object-fit: cover;
}

.blog-content {
    padding: 20px 22px;
}

.blog-meta {
    font-size: 12px;
    color: var(--text-light);
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
}

.blog-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 10px;
}

.blog-title a:hover {
    color: var(--primary);
}

.blog-excerpt {
    font-size: 14px;
    color: var(--text-mid);
    margin-bottom: 14px;
    line-height: 1.6;
}

.blog-read-more {
    font-weight: 600;
    color: var(--primary);
}

/* ---------- Sidebar ---------- */
.blog-sidebar {
    position: sticky;
    top: 90px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.sidebar-card {
    background: #fff;
    padding: 20px;
    border-radius: 14px;
    box-shadow: var(--shadow);
}

.sidebar-card h3 {
    font-size: 15px;
    margin-bottom: 12px;
}

/* Sidebar Lists */
.sidebar-card ul {
    padding-left: 0;
}

.sidebar-card li {
    margin-bottom: 8px;
}

.sidebar-card a:hover {
    color: var(--primary);
}

/* Search Box */
.sidebar-card input {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1.5px solid var(--border);
}

/* Pagination */
.blog-pagination {
    margin-top: 20px;
}

.blog-pagination a,
.blog-pagination span {
    margin-right: 6px;
    padding: 8px 12px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid var(--border);
}

.blog-pagination .current {
    background: var(--primary);
    color: #fff;
}

/* ---------- FIX: Full Width Blog ---------- */
.blog-layout {
    max-width: 1200px;   /* Increase width */
    margin: 0 auto;
    padding: 40px 24px;

    display: grid;
    grid-template-columns: 2.3fr 1fr;
    gap: 32px;
}

.blog-layout {
    max-width: 1280px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Optional: wider screens */
@media (min-width: 1400px) {
    .blog-layout {
        max-width: 1400px;
    }
}

.sidebar-card {
    background: #fff;
    padding: 22px;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

/* CTA should stand out */
.cta-box {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    text-align: center;
}

/* ===== FORCE BLOG LAYOUT FIX ===== */
.blog-layout {
    display: grid !important;
    grid-template-columns: 2fr 1fr !important;
    gap: 32px !important;

    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

/* Fix children */
.blog-main {
    width: 100%;
}

.blog-sidebar {
    width: 100%;
}

/* Mobile fallback */
@media (max-width: 900px) {
    .blog-layout {
        grid-template-columns: 1fr !important;
    }
}

.blog-layout {
    display: flex;
    gap: 30px;
}

.blog-main {
    flex: 2;
}

.blog-sidebar {
    flex: 1;
}

@media (max-width: 900px) {
    .blog-layout {
        flex-direction: column;
    }
}

/* ===== ARTICLE LAYOUT ===== */

.article-layout {
    display: flex;
    gap: 40px;
    max-width: 1100px;
    margin: 40px auto;
    padding: 0 20px;
}

/* LEFT */
.article-main {
    flex: 2;
}

/* RIGHT */
.article-sidebar {
    flex: 1;
    position: sticky;
    top: 100px;
}

/* MOBILE */
@media (max-width: 900px) {
    .article-layout {
        flex-direction: column;
    }
}

/* ===== META ===== */
.article-meta {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 16px;
    display: flex;
    gap: 14px;
}

/* ===== IMAGE ===== */
.article-image img {
    width: 100%;
    border-radius: 12px;
    margin-bottom: 20px;
}

/* ===== CONTENT ===== */
.article-content {
    font-size: 16px;
    line-height: 1.8;
}

/* Typography */
.article-content h2 {
    margin-top: 30px;
    margin-bottom: 10px;
    font-size: 22px;
}

.article-content h3 {
    margin-top: 24px;
    margin-bottom: 8px;
    font-size: 18px;
}

.article-content p {
    margin-bottom: 16px;
}

.article-content ul {
    padding-left: 20px;
    margin-bottom: 16px;
}

.article-content li {
    margin-bottom: 6px;
}

/* ===== TAGS ===== */
.article-tags {
    margin-top: 30px;
}

.article-tags a {
    display: inline-block;
    background: var(--primary-light);
    padding: 6px 12px;
    border-radius: 20px;
    margin-right: 6px;
    font-size: 12px;
}

/* ===== SIDEBAR ===== */
.sidebar-card {
    background: #fff;
    padding: 20px;
    border-radius: 14px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

/* ===== TOC ===== */
.toc li {
    margin-bottom: 8px;
}

.toc a {
    font-size: 14px;
    color: var(--text-mid);
}

.toc a:hover {
    color: var(--primary);
}

/* ===== PROGRESS BAR ===== */
#progressBar {
    position: fixed;
    top: 0;
    left: 0;
    height: 4px;
    width: 0%;
    background: var(--primary);
    z-index: 9999;
}

/* ===== AUTHOR ===== */
.author-box {
    display: flex;
    gap: 16px;
    margin-top: 40px;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.author-avatar img {
    border-radius: 50%;
}

/* ===== RELATED POSTS ===== */
.related-posts {
    margin-top: 40px;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.related-card {
    display: block;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    text-decoration: none;
}

.related-card img {
    width: 100%;
    height: 140px;
    object-fit: cover;
}

.related-card h4 {
    padding: 10px;
    font-size: 14px;
}

/* ===== INTERNAL LINKS ===== */
.internal-links {
    background: var(--primary-light);
    padding: 20px;
    border-radius: 12px;
    margin-top: 30px;
}

.internal-links h3 {
    margin-bottom: 10px;
}

/* ===== MOBILE ===== */
@media (max-width: 900px) {
    .related-grid {
        grid-template-columns: 1fr;
    }
}