/* Blog container */
.blog-container {
    max-width: 1200px;
    margin: 3rem auto;
    padding: 0 1rem;
    font-family: 'Inter', sans-serif;
}

/* Blog grid */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    grid-auto-rows: 380px; /* all cards same fixed height */
    gap: 2rem;
    align-items: stretch; /* ensures all cards stretch equally */
}

.blog-tile {
    background: #f9fff9;
    border: 1px solid #c8e6c9;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 200, 83, 0.1);
    transition: transform 0.2s ease;
    display: flex;
    flex-direction: column; /* stack image + content */
}


.blog-tile:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 200, 83, 0.1);
}

.blog-tile img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.tile-content {
    flex: 1; /* take available vertical space */
    padding: 1rem;
    gap: 0.5rem;
    display: flex;
    flex-direction: column;
}

.tile-content h3 {
    /*margin: 0.5rem 0;*/
    font-size: clamp(1.1rem, 1vw + 1rem, 1.4rem); /* scales between 1.1rem and 1.4rem */
}

.tile-content .date {
    font-size: clamp(0.8rem, 0.5vw + 0.7rem, 0.9rem);
}

.tile-content h3 a {
    text-decoration: none;
    color: #2e7d32;
    transition: color 0.3s ease;
}

.tile-content .excerpt {
    font-size: clamp(0.9rem, 0.6vw + 0.8rem, 1rem);
}

.read-more {
    color: #00c853;
    font-weight: bold;
    text-decoration: none;
    margin-top: auto; /* push to bottom */
    display: inline-block;
}

.read-more:hover {
    text-decoration: underline;
}

/* === Tags inside blog tiles === */
.tags {
    margin: 0.5rem 0;
}

.tag-link {
    display: inline-block;
    margin: 0.2rem;
    padding: 0.3rem 0.8rem;
    font-size: 0.85rem;
    border-radius: 50px;
    background: #e8f5e9;
    color: #2e7d32;
    text-decoration: none;
    transition: background 0.3s ease, color 0.3s ease;
}

.tag-link:hover {
    background: #00c853;
    color: #fff;
}

.no-tags {
    font-size: 0.85rem;
    color: #777;
    font-style: italic;
}

/* === Tag Tools Section (search + info) === */
.tag-tools {
    background: #f1f8f4;
    padding: 1.5rem 1rem;
    border-bottom: 2px solid #00c853;
    margin-bottom: 2rem;
}

.tag-tools-container {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tag-info {
    font-size: 1rem;
    color: #333;
}

.tag-info strong {
    color: #00c853;
}

/* Search form */
.tag-search-form {
    display: flex;
    gap: 0.5rem;
}

.tag-search-form input {
    flex: 1;
    padding: 0.6rem 1rem;
    font-size: 1rem;
    border: 2px solid #00c853;
    border-radius: 8px;
    background: #fff;
    color: #333;
    outline: none;
    transition: border 0.3s ease;
}

.tag-search-form input:focus {
    border-color: #2e7d32;
}

.tag-search-form button {
    padding: 0.6rem 1.2rem;
    font-size: 1rem;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #00c853, #2e7d32);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
}

.tag-search-form button:hover {
    background: linear-gradient(135deg, #2e7d32, #00c853);
    transform: translateY(-2px);
}

/* === Available Tags Section === */
.available-tags {
    margin-top: 0.5rem;
}

.available-tags-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #2e7d32;
}
/* Blog detail */
.blog-article {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 1rem;
    font-family: 'Inter', sans-serif;
}

.blog-article h1 {
    font-size: clamp(1.6rem, 2vw + 1rem, 2.4rem); /* scales big for desktops */
    margin-bottom: 1rem;
    color: #2e7d32;
}

.blog-article .date {
    font-size: clamp(0.8rem, 0.5vw + 0.7rem, 0.95rem);
    color: #777;
}

.article-img {
    width: 100%;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.post-intro {
    margin: 1.2rem 0;
    text-align: center; /* optional, makes it feel like a lead intro */
}

.post-intro .ck-content {
    line-height: 1.4;
    font-weight: 500;
    color: #333;
}


.article-content {
    font-size: 2rem;
    color: #333;
    line-height: 1.7;
}

/* CKEditor content block */
.article-content .ck-content {
    border-radius: 12px;
}

/* Lists inside ck-content */
.article-content .ck-content ul,
.article-content .ck-content ol {
    margin-left: 0;
    padding-left: 1.2rem;
    list-style-position: inside;
}

.article-content .ck-content li {
    margin-bottom: 0.5rem;
    text-align: justify;
}

/* === Generic images === */
.article-content .ck-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    object-fit: contain;
}

/* === Block images (centered) === */
.article-content .ck-content figure.image {
    display: block;
    margin: 1rem auto;
    text-align: center;
}

.article-content .ck-content figure.image img {
    display: block;
    margin: 0 auto;
}

/* === Image captions (toggleImageCaption) === */
.article-content .ck-content figcaption {
    font-size: 0.9rem; /* slightly smaller than body text */
    line-height: 1.4;
    color: #666; /* softer text */
    text-align: center; /* match block image alignment */
    margin-top: 0.5rem;
    padding: 0 0.5rem; /* breathing space */
    word-break: break-word; /* handle long words */
    font-style: italic;
}

/* === Responsive === */
@media (max-width: 768px) {
    .article-content .ck-content img {
        max-height: 350px;
        width: auto;
    }

    .article-content .ck-content figcaption {
        font-size: 0.8rem; /* shrink text */
        line-height: 1.3;
        padding: 0 0.25rem;
    }
}


.back-btn {
    display: inline-block;
    margin-top: 2rem;
    background: #00c853;
    color: #fff;
    padding: 0.7rem 1.5rem;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.3s ease;
}

.back-btn:hover {
    background: #2e7d32;
}

.clear-tag {
    margin-left: 1rem;
    font-size: 0.9rem;
    color: #d32f2f;
    text-decoration: none;
    background: #ffe5e5;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    transition: background 0.3s ease, color 0.3s ease;
}

.clear-tag:hover {
    background: #d32f2f;
    color: #fff;
}

/* No results for tag */
.tag-info.no-results {
    background: #fff0f0; /* light red background */
    color: #d32f2f; /* red text */
    border: 1px solid #f5c2c2; /* subtle red border */
    padding: 0.7rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    margin: 1rem 0;
    text-align: center;
}

.tag-info.no-results strong {
    color: #b71c1c; /* darker red for the tag itself */
}

.tag-info.no-results .clear-tag {
    margin-left: 0.8rem;
    background: #ffe5e5;
    color: #d32f2f;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.3s ease, color 0.3s ease;
}

.tag-info.no-results .clear-tag:hover {
    background: #d32f2f;
    color: #fff;
}


/* ============================== */
/* Responsive Design              */
/* ============================== */

/* Small laptops (max-width: 1200px) */
@media (max-width: 1200px) {
    .blog-container {
        max-width: 95%;
        padding: 0 1rem;
    }

    .blog-article {
        max-width: 90%;
    }

    .tag-tools-container {
        max-width: 95%;
    }
}

/* Tablets (max-width: 992px) */
@media (max-width: 992px) {
    .page-title {
        font-size: 1.8rem;
    }

    .tile-content h3 {
        font-size: 1.2rem;
    }

    .tile-content .excerpt {
        font-size: 0.95rem;
    }

    .blog-article h1 {
        font-size: 2rem;
    }

    .article-content {
        font-size: 1rem;
    }

    .tag-search-form {
        flex-direction: column;
    }

    .tag-search-form button {
        width: 100%;
    }
}

/* iPads & large phones (max-width: 768px) */
@media (max-width: 768px) {
    .blog-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1.5rem;
    }

    .blog-tile img {
        margin: 0 auto;
        height: 170px;
    }

    .page-title {
        font-size: 1.6rem;
    }

    .blog-article h1 {
        font-size: 1.8rem;
    }
}

/* iPhones & small phones (max-width: 480px) */
@media (max-width: 480px) {
    .blog-container {
        margin: 2rem auto;
        padding: 0 0.8rem;
    }

    .blog-grid {
        grid-template-columns: 1fr; /* one column */
        gap: 1rem;
    }

    .blog-tile img {
        height: 160px;
    }

    .tile-content h3 {
        font-size: 1.1rem;
    }

    .tile-content .excerpt {
        font-size: 0.9rem;
    }

    .read-more {
        font-size: 0.9rem;
    }

    .blog-article h1 {
        font-size: 1.6rem;
    }

    .article-content {
        font-size: 0.95rem;
        line-height: 1.5;
    }

    .back-btn {
        display: block;
        width: 100%; /* full-width button for easy tapping */
        text-align: center;
        padding: 0.9rem;
        font-size: 1rem;
    }
}

.tag-link.active {
    font-weight: bold;
    color: #00c853;
    border-bottom: 2px solid #00c853;
}