/* ─── GOOGLE FONTS ─── */
@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@400;500;600;700;800&family=Nunito:wght@400;500;600;700;800&display=swap');

/* ─── VARIABLES ─── */
:root {
    --primary: #2E7D32;
    --primary-dark: #1B5E20;
    --primary-light: #E8F5E9;
    --primary-mid: #4CAF50;
    --accent: #FFC107;
    --accent-light: #FFF8E1;
    --accent-dark: #F57F17;
    --navy: #0D1B2A;
    --cream: #FFFDF5;
    --warm-gray: #F5F1E8;
    --white: #FFFFFF;
    --text-main: #1A1A0F;
    --text-muted: #6B6258;
    --border: #E8E4D8;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, .06);
    --shadow-md: 0 6px 24px rgba(0, 0, 0, .09);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, .12);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-pill: 100px;
    --font-heading: 'Baloo 2', sans-serif;
    --font-body: 'Nunito', sans-serif;
    --transition: 0.25s cubic-bezier(.4, 0, .2, 1);
}

/* ─── RESET ─── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--cream);
    font-family: var(--font-body);
    color: var(--text-main);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    display: block;
    max-width: 100%;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: var(--font-body);
}

/* ─── NAVBAR ─── */
nav {
    background: white;
    border-bottom: 2px solid var(--primary-light);
    padding: 0 5%;
    height: 68px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.4rem;
    color: var(--navy);
}

.logo-icon {
    width: 38px;
    height: 38px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.logo-sub {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.04em;
    display: block;
    line-height: 1;
    margin-top: 1px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-links a {
    padding: 7px 16px;
    border-radius: var(--radius-pill);
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text-muted);
    transition: all var(--transition);
}

.nav-links a:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.nav-links a.active {
    color: white;
    background: var(--primary);
}

/* Mobile hamburger */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 4px;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2.5px;
    background: var(--navy);
    border-radius: 2px;
    transition: all var(--transition);
}

.nav-toggle.open span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.open span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.open span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile nav drawer */
.nav-drawer {
    display: none;
    flex-direction: column;
    gap: 4px;
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    background: white;
    padding: 12px 5% 20px;
    border-bottom: 2px solid var(--primary-light);
    box-shadow: var(--shadow-md);
    z-index: 999;
}

.nav-drawer.open {
    display: flex;
}

.nav-drawer a {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-muted);
    transition: all var(--transition);
}

.nav-drawer a:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-drawer a.active {
    background: var(--primary);
    color: white;
}

/* ─── HERO ─── */
.hero {
    background: var(--primary-light);
    padding: 4.5rem 5%;
    display: flex;
    align-items: center;
    gap: 3rem;
    flex-wrap: wrap;
    position: relative;
    overflow: hidden;
}

/* Decorative circles */
.hero::before,
.hero::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(46, 125, 50, .06);
    pointer-events: none;
}

.hero::before {
    width: 400px;
    height: 400px;
    top: -120px;
    right: -80px;
}

.hero::after {
    width: 200px;
    height: 200px;
    bottom: -60px;
    left: 5%;
}

.hero-text {
    flex: 1;
    min-width: 280px;
    position: relative;
    z-index: 1;
}

.hero-img {
    flex: 1;
    min-width: 260px;
    max-width: 480px;
    position: relative;
    z-index: 1;
}

.hero-badge {
    display: inline-block;
    background: var(--accent-light);
    color: var(--accent-dark);
    font-weight: 800;
    font-size: 0.75rem;
    padding: 5px 14px;
    border-radius: var(--radius-pill);
    letter-spacing: 0.06em;
    margin-bottom: 1.2rem;
    border: 1.5px solid rgba(245, 127, 23, .25);
}

h1 {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 4vw, 3.2rem);
    color: var(--navy);
    line-height: 1.2;
    margin-bottom: 1rem;
}

.hero-desc {
    font-size: 1.05rem;
    color: var(--text-muted);
    max-width: 480px;
    margin-bottom: 1.8rem;
    line-height: 1.75;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--primary);
    color: white;
    padding: 13px 30px;
    border-radius: var(--radius-pill);
    font-weight: 800;
    font-size: 0.95rem;
    transition: all var(--transition);
    box-shadow: 0 4px 16px rgba(46, 125, 50, .35);
    border: 2px solid transparent;
}

.btn:hover {
    transform: translateY(-3px);
    background: var(--primary-dark);
    box-shadow: 0 8px 24px rgba(46, 125, 50, .4);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    box-shadow: none;
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.hero-img img {
    width: 100%;
    border-radius: var(--radius-lg);
    box-shadow: 0 16px 48px rgba(46, 125, 50, .18);
    aspect-ratio: 4/3;
    object-fit: cover;
}

/* ─── STATS BAR ─── */
.stats-bar {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 1.8rem 5%;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 2rem 5%;
    border-radius: var(--radius-lg);
    color: white;
    box-shadow: 0 8px 24px rgba(46, 125, 50, .28);
    position: relative;
    overflow: hidden;
}

.stats-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--accent);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 14px;
}

.stat-icon {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, .15);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.stat-val {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.6rem;
    display: block;
    line-height: 1;
}

.stat-label {
    font-size: 0.85rem;
    opacity: 0.85;
    margin-top: 2px;
}

/* ─── CONTAINER ─── */
.container {
    padding: 3rem 5%;
    max-width: 1200px;
    margin: 0 auto;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 10px;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 1.7rem;
    color: var(--navy);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::before {
    content: '';
    display: block;
    width: 5px;
    height: 26px;
    background: var(--primary);
    border-radius: 3px;
    flex-shrink: 0;
}

.section-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--warm-gray);
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-weight: 700;
}

/* ─── FILTERS ─── */
.filters {
    margin-bottom: 2rem;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: none;
}

.filters::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    padding: 8px 20px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-pill);
    background: white;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.85rem;
    white-space: nowrap;
    color: var(--text-muted);
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ─── BLOG GRID ─── */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.8rem;
    min-height: 200px;
}

/* ─── BLOG CARD ─── */
.blog-card {
    background: white;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    animation: fadeUp .4s ease both;
}

.blog-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(46, 125, 50, .3);
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-img-wrap {
    position: relative;
    overflow: hidden;
}

.card-img {
    height: 195px;
    width: 100%;
    object-fit: cover;
    transition: transform .4s ease;
    display: block;
}

.blog-card:hover .card-img {
    transform: scale(1.04);
}

.card-category-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    font-size: 0.7rem;
    font-weight: 800;
    color: white;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    letter-spacing: 0.04em;
}

.card-class-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--accent);
    color: var(--navy);
    padding: 4px 10px;
    border-radius: var(--radius-pill);
}

.card-content {
    padding: 1.25rem 1.4rem 1.4rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card-title {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    color: var(--navy);
    line-height: 1.35;
    font-weight: 700;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-excerpt {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

.card-meta {
    margin-top: 4px;
    padding-top: 0.9rem;
    border-top: 1px solid var(--primary-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.card-meta-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-meta svg {
    opacity: 0.55;
    flex-shrink: 0;
}

/* ─── SKELETON LOADER ─── */
.skeleton-card {
    background: white;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.skeleton {
    background: linear-gradient(90deg, var(--warm-gray) 25%, #ede8dd 50%, var(--warm-gray) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    border-radius: 6px;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skeleton-img {
    height: 195px;
    border-radius: 0;
}

.skeleton-body {
    padding: 1.25rem 1.4rem 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.skeleton-tag {
    height: 22px;
    width: 70px;
}

.skeleton-h {
    height: 18px;
    width: 90%;
}

.skeleton-h2 {
    height: 18px;
    width: 65%;
}

.skeleton-text {
    height: 13px;
    width: 100%;
}

.skeleton-text2 {
    height: 13px;
    width: 80%;
}

.skeleton-meta {
    height: 12px;
    width: 50%;
    margin-top: 8px;
}

/* ─── EMPTY / ERROR STATES ─── */
.state-box {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.state-box .state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.state-box h3 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    color: var(--navy);
    margin-bottom: 6px;
}

.state-box p {
    font-size: 0.9rem;
}

/* ─── CATEGORY COLORS ─── */
.cat-Science {
    background: #00897B;
}

.cat-Maths {
    background: #1565C0;
}

.cat-Social {
    background: #558B2F;
}

.cat-English {
    background: #6A1B9A;
}

.cat-Hindi {
    background: #E65100;
}

.cat-General {
    background: #455A64;
}

/* ─── AD SLOT PLACEHOLDER ─── */
.ad-slot {
    width: 100%;
    background: var(--warm-gray);
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.ad-slot-label {
    font-size: 0.7rem;
    opacity: 0.7;
}

/* ─── POST PAGE ─── */
.post-header {
    background: var(--primary-light);
    padding: 3.5rem 5% 6rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.post-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--accent);
}

.post-header-inner {
    max-width: 760px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.post-meta-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 1.2rem;
}

.post-img {
    width: calc(100% - 10%);
    max-width: 900px;
    max-height: 460px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    margin: -4rem auto 2.5rem;
    display: block;
    box-shadow: 0 16px 48px rgba(0, 0, 0, .13);
    position: relative;
    z-index: 2;
}

.post-layout {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 5% 5rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.post-content {
    font-size: 1.05rem;
}

.post-content h2 {
    font-family: var(--font-heading);
    color: var(--navy);
    margin: 2rem 0 0.8rem;
    font-size: 1.65rem;
    padding-left: 14px;
    border-left: 4px solid var(--primary);
}

.post-content h3 {
    font-family: var(--font-heading);
    color: var(--navy);
    margin: 1.5rem 0 0.6rem;
    font-size: 1.25rem;
}

.post-content p {
    margin-bottom: 1.2rem;
    color: var(--text-main);
    line-height: 1.8;
}

.post-content ul {
    list-style: disc;
    margin: 0 0 1.5rem 1.8rem;
}

.post-content ol {
    list-style: decimal;
    margin: 0 0 1.5rem 1.8rem;
}

.post-content li {
    margin-bottom: 0.5rem;
    line-height: 1.7;
}

.post-content strong {
    color: var(--primary-dark);
}

.post-content em {
    color: var(--text-muted);
}

.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.post-content th {
    background: var(--primary);
    color: white;
    padding: 10px 14px;
    text-align: left;
    font-weight: 700;
}

.post-content td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}

.post-content tr:last-child td {
    border-bottom: none;
}

.post-content tr:nth-child(even) td {
    background: var(--primary-light);
}

.post-content blockquote {
    border-left: 4px solid var(--accent);
    background: var(--accent-light);
    padding: 1rem 1.2rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-bottom: 1.5rem;
    font-style: italic;
    color: var(--text-muted);
}

/* Tags in post */
.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 1.5rem;
}

.post-tag {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-weight: 700;
}

/* ─── INTERACTION BAR ─── */
.interaction-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 2rem;
    padding: 1rem 1.2rem;
    background: white;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    flex-wrap: wrap;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: var(--radius-pill);
    border: 1.5px solid var(--border);
    background: white;
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.88rem;
    transition: all var(--transition);
    color: var(--text-muted);
    line-height: 1;
}

.action-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}

.action-btn.liked {
    background: #FFEBEE;
    color: #C62828;
    border-color: #FFCDD2;
}

.action-btn.share:hover {
    background: #E3F2FD;
    color: #1565C0;
    border-color: #90CAF9;
}

.action-btn.copied {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

.view-count-display {
    margin-left: auto;
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ─── BACK BUTTON ─── */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 2rem;
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    border: 1.5px solid var(--primary);
    transition: all var(--transition);
}

.back-link:hover {
    background: var(--primary);
    color: white;
}

/* ─── TAG / BADGE ─── */
.tag {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    letter-spacing: 0.04em;
}

.tag-green {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.tag-yellow {
    background: var(--accent-light);
    color: var(--accent-dark);
}

.tag-white {
    background: white;
    color: var(--primary-dark);
}

/* ─── NOT FOUND ─── */
.not-found {
    text-align: center;
    padding: 6rem 5%;
    color: var(--text-muted);
}

.not-found h2 {
    font-family: var(--font-heading);
    font-size: 2rem;
    color: var(--navy);
    margin-bottom: 1rem;
}

/* ─── FOOTER ─── */
footer {
    background: var(--navy);
    color: white;
    padding: 3rem 5%;
    text-align: center;
    position: relative;
    overflow: hidden;
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--accent);
}

footer h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin-bottom: 6px;
}

footer p {
    opacity: 0.6;
    font-size: 0.88rem;
}

footer .footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 1rem 0;
    flex-wrap: wrap;
}

footer .footer-links a {
    opacity: 0.7;
    font-size: 0.88rem;
    font-weight: 600;
    transition: opacity var(--transition);
}

footer .footer-links a:hover {
    opacity: 1;
    color: var(--accent);
}

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .nav-toggle {
        display: flex;
    }

    .hero {
        padding: 3rem 5%;
        flex-direction: column-reverse;
        gap: 2rem;
    }

    .hero-img {
        max-width: 100%;
    }

    .stats-bar {
        margin: 1.5rem 4%;
        padding: 1.5rem 4%;
    }

    .stat-item {
        flex: 1 1 40%;
    }

    .post-img {
        width: 90%;
        margin-top: -3rem;
    }

    .post-header {
        padding: 2.5rem 5% 5rem;
    }

    .interaction-bar {
        flex-wrap: wrap;
    }

    .view-count-display {
        margin-left: 0;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .blog-grid {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 1.9rem;
    }

    .stat-item {
        flex: 1 1 100%;
    }
}