/* ═══════════════════════════════════════════════════════════════════════════
   BLOG — Listing & Article Pages
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Blog Listing Hero ────────────────────────────────────────────────────── */
.blog-listing-hero {
    background: linear-gradient(135deg, var(--secondary) 0%, #0d2e29 60%, #1a4a3a 100%);
    padding: 130px 0 80px;
    position: relative;
}

.blog-listing-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 70% 50%, rgba(110, 180, 63, 0.15) 0%, transparent 60%);
}

.blog-hero-inner {
    text-align: center;
    position: relative;
    z-index: 1;
}

.blog-hero-inner h1 {
    color: white;
    font-size: clamp(2rem, 4vw, 3rem);
    margin: 14px 0 16px;
    font-weight: 800;
}

.blog-hero-inner p {
    color: rgba(255, 255, 255, 0.75);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

.blog-hero-wave {
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    line-height: 0;
    z-index: 2;
}

.blog-hero-wave svg {
    display: block;
    width: 100%;
    height: 50px;
}

/* ─── Blog Layout ─────────────────────────────────────────────────────────── */
.blog-listing-main {
    padding: 60px 0 100px;
    background: var(--bg-soft);
    min-height: 60vh;
    overflow-x: hidden;
}

.blog-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 50px;
    align-items: start;
    /* prevent sidebar from overflowing on narrow screens */
    overflow: hidden;
}

@media (max-width: 1100px) {
    .blog-layout {
        grid-template-columns: 1fr 280px;
        gap: 30px;
    }
}

@media (max-width: 900px) {
    .blog-layout {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .blog-sidebar {
        order: -1;
    }
}

/* ─── Blog Grid ───────────────────────────────────────────────────────────── */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 28px;
}

@media (max-width: 768px) {
    .blog-grid {
        grid-template-columns: 1fr;
    }
}

/* ─── Blog Card ───────────────────────────────────────────────────────────── */
.blog-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.35s ease;
    display: flex;
    flex-direction: column;
}

.blog-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 50px rgba(0, 50, 40, 0.12);
}

.blog-card-image-wrap {
    position: relative;
    overflow: hidden;
    height: 200px;
    display: block;
}

.blog-card-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.blog-card:hover .blog-card-image-wrap img {
    transform: scale(1.06);
}

.blog-card-image-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bg-soft), #e8f4ee);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--primary);
    opacity: 0.5;
}

.blog-card-category {
    position: absolute;
    top: 14px;
    left: 14px;
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    backdrop-filter: blur(4px);
}

.blog-card-body {
    padding: 22px 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.blog-card-meta {
    display: flex;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.blog-card-meta i {
    color: var(--primary);
}

.blog-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--secondary);
}

.blog-card-title a:hover {
    color: var(--primary);
}

.blog-card-excerpt {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.7;
    flex: 1;
}

.blog-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.blog-card-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ─── Blog Tags ───────────────────────────────────────────────────────────── */
.blog-tag {
    display: inline-block;
    background: rgba(110, 180, 63, 0.1);
    color: var(--primary);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    transition: var(--transition);
    border: 1px solid rgba(110, 180, 63, 0.2);
}

.blog-tag:hover,
.blog-tag.active {
    background: var(--primary);
    color: white;
}

.blog-tag-light {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
}

.blog-tag-light:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

/* ─── Read More ───────────────────────────────────────────────────────────── */
.blog-read-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--secondary);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.blog-read-more i {
    transition: transform 0.3s ease;
}

.blog-read-more:hover i {
    transform: translateX(4px);
}

/* ─── Filter Active ───────────────────────────────────────────────────────── */
.blog-filter-active {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 18px;
    margin-bottom: 24px;
    font-size: 0.9rem;
    color: var(--text-dark);
}

.blog-filter-clear {
    color: #e74c3c;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}

.blog-filter-clear:hover {
    opacity: 0.75;
}

/* ─── Pagination ──────────────────────────────────────────────────────────── */
.blog-pagination {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 50px;
    flex-wrap: wrap;
}

.blog-page-btn {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: white;
    color: var(--text-dark);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: var(--transition);
}

.blog-page-btn:hover,
.blog-page-btn.active {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

/* ─── Blog Empty ──────────────────────────────────────────────────────────── */
.blog-empty {
    text-align: center;
    padding: 80px 40px;
    background: white;
    border-radius: 20px;
}

.blog-empty i {
    font-size: 4rem;
    color: var(--border-color);
    margin-bottom: 20px;
}

.blog-empty h3 {
    color: var(--secondary);
    margin-bottom: 10px;
}

.blog-empty p {
    color: var(--text-muted);
}

/* ─── Sidebar ─────────────────────────────────────────────────────────────── */
.blog-sidebar,
.article-sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: sticky;
    top: 110px;
    /* prevent overflow on narrow viewports */
    min-width: 0;
    overflow: hidden;
}

@media (max-width: 900px) {

    .blog-sidebar,
    .article-sidebar {
        position: static;
        top: auto;
    }
}

.sidebar-widget {
    background: white;
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.sidebar-widget-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-widget-title i {
    color: var(--primary);
}

/* Search */
.blog-search-form {
    display: flex;
    gap: 0;
}

.blog-search-input {
    flex: 1;
    border: 1px solid var(--border-color);
    border-right: none;
    border-radius: 10px 0 0 10px;
    padding: 10px 14px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.blog-search-input:focus {
    border-color: var(--primary);
}

.blog-search-btn {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0 10px 10px 0;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.blog-search-btn:hover {
    background: var(--secondary);
}

/* Category list */
.sidebar-category-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-category-list li a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-dark);
    transition: var(--transition);
}

.sidebar-category-list li a:hover,
.sidebar-category-list li a.active {
    background: rgba(110, 180, 63, 0.08);
    color: var(--primary);
}

.sidebar-count {
    background: var(--bg-soft);
    color: var(--text-muted);
    border-radius: 20px;
    padding: 1px 8px;
    font-size: 0.75rem;
    font-weight: 600;
}

.sidebar-category-list li a.active .sidebar-count,
.sidebar-category-list li a:hover .sidebar-count {
    background: var(--primary);
    color: white;
}

/* Tags cloud */
.sidebar-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.sidebar-tags .blog-tag span {
    color: var(--text-muted);
    font-weight: 400;
}

/* CTA widget */
.sidebar-cta {
    background: linear-gradient(135deg, var(--secondary) 0%, #1a3a34 100%);
    text-align: center;
}

.sidebar-cta i {
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 12px;
    display: block;
}

.sidebar-cta h4 {
    color: white;
    font-size: 1rem;
    margin-bottom: 8px;
}

.sidebar-cta p {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.85rem;
    line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SINGLE ARTICLE PAGE
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Article Hero ────────────────────────────────────────────────────────── */
.article-hero {
    position: relative;
    min-height: 480px;
    display: flex;
    align-items: flex-end;
    background: var(--secondary);
    background-size: cover;
    background-position: center;
    padding-bottom: 50px;
}

.article-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(15, 40, 35, 0.4) 0%, rgba(10, 30, 25, 0.85) 100%);
}

.article-hero-content {
    position: relative;
    z-index: 1;
    max-width: 820px;
}

.article-hero-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}

.article-back-link {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
}

.article-back-link:hover {
    color: white;
}

.article-category-badge {
    background: var(--primary);
    color: white;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.article-hero-content h1 {
    color: white;
    font-size: clamp(1.6rem, 3.5vw, 2.4rem);
    line-height: 1.25;
    margin-bottom: 20px;
}

.article-hero-info {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.88rem;
}

.article-hero-info i {
    color: var(--primary);
    margin-right: 4px;
}

.article-hero-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 16px;
}

/* ─── Article Main ────────────────────────────────────────────────────────── */
.article-main {
    padding: 60px 0 80px;
    background: var(--bg-soft);
    overflow-x: hidden;
}

.article-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 50px;
    align-items: start;
    overflow: hidden;
}

@media (max-width: 1100px) {
    .article-layout {
        grid-template-columns: 1fr 260px;
        gap: 30px;
    }
}

@media (max-width: 900px) {
    .article-layout {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

/* ─── Article Body ────────────────────────────────────────────────────────── */
.article-body {
    background: white;
    border-radius: 20px;
    padding: 48px 52px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.07);
    min-width: 0;
    /* allow grid child to shrink */
    overflow: hidden;
}

@media (max-width: 768px) {
    .article-body {
        padding: 28px 22px;
    }
}

.article-lead {
    font-size: 1.15rem;
    color: var(--text-muted);
    line-height: 1.8;
    border-left: 4px solid var(--primary);
    padding: 16px 20px;
    background: rgba(110, 180, 63, 0.05);
    border-radius: 0 12px 12px 0;
    margin-bottom: 36px;
    font-style: italic;
}

/* ─── Article Rich Content ────────────────────────────────────────────────── */
.article-content {
    font-size: 1rem;
    line-height: 1.85;
    color: var(--text-dark);
}

.article-content h2 {
    font-size: 1.55rem;
    color: var(--secondary);
    margin: 2.2rem 0 1rem;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.article-content h3 {
    font-size: 1.2rem;
    color: var(--secondary);
    margin: 1.8rem 0 0.8rem;
}

.article-content h4 {
    font-size: 1.05rem;
    color: var(--text-dark);
    margin: 1.4rem 0 0.6rem;
    font-weight: 700;
}

.article-content p {
    margin-bottom: 1.2rem;
}

.article-content ul,
.article-content ol {
    margin: 1rem 0 1.4rem 1.5rem;
}

.article-content li {
    margin-bottom: 0.5rem;
    line-height: 1.75;
}

.article-content ul li::marker {
    color: var(--primary);
}

.article-content ol li::marker {
    color: var(--secondary);
    font-weight: 700;
}

.article-content strong {
    color: var(--text-dark);
}

.article-content em {
    color: var(--text-muted);
}

.article-content a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.article-content a:hover {
    color: var(--secondary);
}

.article-content blockquote {
    border-left: 4px solid var(--primary);
    margin: 1.8rem 0;
    padding: 16px 22px;
    background: rgba(110, 180, 63, 0.06);
    border-radius: 0 12px 12px 0;
    font-style: italic;
    color: var(--text-muted);
}

.article-content blockquote p {
    margin: 0;
}

.article-content code {
    background: #f4f7f5;
    padding: 2px 7px;
    border-radius: 5px;
    font-size: 0.88em;
    font-family: 'Courier New', monospace;
    color: var(--secondary);
}

.article-content pre {
    background: #1a2e2a;
    color: #a8d8a8;
    border-radius: 12px;
    padding: 20px;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.article-content pre code {
    background: none;
    color: inherit;
    padding: 0;
}

.article-content img {
    max-width: 100%;
    border-radius: 12px;
    margin: 1.5rem 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.8rem 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    /* table scroll on mobile */
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.article-content th {
    background: var(--secondary);
    color: white;
    padding: 12px 16px;
    text-align: left;
    font-size: 0.9rem;
}

.article-content td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
}

.article-content tr:nth-child(even) td {
    background: var(--bg-soft);
}

.article-content tr:last-child td {
    border-bottom: none;
}

.article-content hr {
    border: none;
    border-top: 2px solid var(--border-color);
    margin: 2.5rem 0;
}

/* ─── Tags bottom ─────────────────────────────────────────────────────────── */
.article-tags-bottom {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 36px 0 28px;
    padding-top: 28px;
    border-top: 1px solid var(--border-color);
}

.article-tags-bottom strong {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ─── Share ───────────────────────────────────────────────────────────────── */
.article-share {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding: 20px 22px;
    background: var(--bg-soft);
    border-radius: 14px;
}

.article-share strong {
    color: var(--text-dark);
    font-size: 0.9rem;
}

.article-share-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

.share-fb {
    background: #1877F2;
    color: white;
}

.share-li {
    background: #0A66C2;
    color: white;
}

.share-tw {
    background: #000;
    color: white;
}

.share-copy {
    background: var(--bg-soft);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
}

.share-btn:hover {
    opacity: 0.85;
    transform: translateY(-2px);
}

/* ─── Lang Switch ─────────────────────────────────────────────────────────── */
.article-lang-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: rgba(22, 160, 133, 0.06);
    border: 1px solid rgba(22, 160, 133, 0.2);
    border-radius: 12px;
    font-size: 0.9rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.article-lang-switch strong {
    color: var(--text-dark);
}

.article-lang-switch a {
    color: var(--secondary);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-left: auto;
}

/* ─── Article Back Nav ────────────────────────────────────────────────────── */
.article-back-nav {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
}

/* ─── Sidebar Author ──────────────────────────────────────────────────────── */
.sidebar-author {
    text-align: center;
}

.author-avatar {
    width: 70px;
    height: 70px;
    object-fit: contain;
    margin: 0 auto 12px;
    display: block;
}

.sidebar-author h4 {
    font-size: 1rem;
    color: var(--secondary);
    margin-bottom: 6px;
}

.sidebar-author p {
    font-size: 0.83rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Recent list */
.sidebar-recent-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-recent-item {
    display: flex;
    gap: 12px;
    align-items: center;
    color: var(--text-dark);
    transition: var(--transition);
}

.sidebar-recent-item:hover {
    color: var(--primary);
}

.sidebar-recent-item img {
    width: 55px;
    height: 55px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.sidebar-recent-title {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 3px;
}

.sidebar-recent-date {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .blog-listing-hero {
        padding: 110px 0 50px;
    }

    .article-hero {
        min-height: 380px;
        padding-bottom: 35px;
    }

    .article-hero-info {
        gap: 12px;
        font-size: 0.82rem;
    }

    .article-body {
        padding: 24px 18px;
    }

    .article-content h2 {
        font-size: 1.3rem;
    }

    .article-content h3 {
        font-size: 1.1rem;
    }

    .article-lead {
        font-size: 1rem;
        padding: 12px 16px;
    }

    .article-tags-bottom {
        gap: 8px;
    }

    .sidebar-widget {
        padding: 18px;
    }

    /* Prevent any sticky from messing layout on mobile */
    .blog-sidebar,
    .article-sidebar {
        position: static !important;
        top: auto !important;
    }
}

@media (max-width: 600px) {
    .article-hero {
        min-height: 320px;
        padding-bottom: 28px;
    }

    .article-hero-info {
        gap: 10px;
        font-size: 0.78rem;
    }

    .article-hero-content h1 {
        font-size: 1.4rem;
    }

    .article-share {
        flex-direction: column;
        gap: 10px;
    }

    .article-share-buttons {
        gap: 8px;
        flex-wrap: wrap;
    }

    .share-btn {
        padding: 7px 12px;
        font-size: 0.8rem;
    }

    .blog-card-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .blog-hero-inner h1 {
        font-size: 1.7rem;
    }

    .blog-hero-inner p {
        font-size: 0.95rem;
    }

    .blog-listing-hero {
        padding: 100px 0 40px;
    }
}