/* ==========================================================================
   Flavor Blog - Custom Blog Styling
   Matching TropicalZone blog design: green palette, Playfair + DM Sans cards
   ========================================================================== */

/* --- CSS Variables (defaults, overridden by inline vars from settings) --- */
:root {
    --flavor-bg: #f2ede6;
    --flavor-heading: #12291a;
    --flavor-text: #4a6655;
    --flavor-meta: #4a6655;
    --flavor-card-bg: #ffffff;
    --flavor-btn-border: #2d6a4f;
    --flavor-btn-text: #2d6a4f;
    --flavor-btn-hover-bg: #2d6a4f;
    --flavor-btn-hover-text: #ffffff;
    --flavor-link: #2d6a4f;
    --flavor-breadcrumb: #12291a;
    --flavor-accent: #4a9c68;
    --flavor-accent-dark: #1c3a1e;
    --flavor-card-shadow: rgba(28, 58, 30, 0.07);
    --flavor-card-shadow-hover: rgba(28, 58, 30, 0.16);
    /* Top spacing to prevent sticky/fixed header overlap.
       Blocksy exposes different vars depending on sticky state, so include multiple fallbacks.
       max() ensures we still reserve space even if theme vars are unset. */
    --flavor-top-offset: max(
        96px,
        calc(
            var(--admin-bar, 0px)
            + var(--theme-frame-size, 0px)
            + var(--header-sticky-height, var(--header-height, var(--header-sticky-offset, 0px)))
            + 24px
        )
    );
}

/* --- Global Wrappers --- */
.flavor-blog-active .site-content,
.flavor-single-wrap,
.flavor-archive-wrap,
.flavor-blog-section {
    font-family: 'DM Sans', sans-serif;
}

.flavor-blog-active .site-content,
.flavor-single-wrap,
.flavor-archive-wrap {
    background-color: var(--flavor-bg);
}

/* Keep top title/breadcrumb visible below sticky header */
.flavor-single-wrap,
.flavor-archive-wrap {
    padding-top: var(--flavor-top-offset) !important;
    margin-top: 0 !important;
}

.flavor-single-container,
.flavor-archive-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}

/* Also apply on the inner container in case theme overrides wrap padding */
.flavor-single-container,
.flavor-archive-container {
    padding-top: calc(var(--flavor-top-offset) + 8px) !important;
}

.flavor-archive-container {
    max-width: 1100px;
}

/* ==========================================================================
   Archive / Category / Shortcode Grid
   ========================================================================== */

.flavor-archive-title {
    font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 700;
    color: var(--flavor-heading);
    margin: 0 0 30px;
    padding: 0;
    line-height: 1.2;
}

.flavor-archive-description {
    color: var(--flavor-text);
    font-size: 1rem;
    margin-bottom: 30px;
    line-height: 1.7;
}

/* --- Blog Grid --- */
.flavor-blog-grid {
    display: grid;
    gap: 20px;
}

.flavor-cols-2 { grid-template-columns: repeat(2, 1fr); }
.flavor-cols-3 { grid-template-columns: repeat(3, 1fr); }
.flavor-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 991px) {
    .flavor-cols-3,
    .flavor-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .flavor-cols-2,
    .flavor-cols-3,
    .flavor-cols-4 {
        grid-template-columns: 1fr;
    }
}

/* --- Blog Card (shared: grid, slider, related posts) --- */
.flavor-card {
    background: var(--flavor-card-bg);
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.28s cubic-bezier(0.22, 0.68, 0, 1.2), box-shadow 0.28s ease;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 12px var(--flavor-card-shadow);
    height: 100%;
}

.flavor-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 14px 36px var(--flavor-card-shadow-hover);
}

.flavor-card-image {
    position: relative;
    width: 100%;
    height: 195px;
    overflow: hidden;
    flex-shrink: 0;
}

.flavor-card-image-inner {
    width: 100%;
    height: 100%;
    transition: transform 0.5s cubic-bezier(0.22, 0.68, 0, 1.1);
}

.flavor-card:hover .flavor-card-image-inner {
    transform: scale(1.06);
}

.flavor-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.flavor-card-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a3d2b 0%, #2d6a4f 40%, #52b788 75%, #40c89e 100%);
}

.flavor-card-category-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgb(7 120 38 / 45%);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    font-family: 'DM Sans', sans-serif;
    font-size: 9.5px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 20px;
    z-index: 2;
}

.flavor-card-readtime {
    position: absolute;
    bottom: 10px;
    left: 12px;
    background: rgba(0, 0, 0, 0.35);
    color: rgba(255, 255, 255, 0.9);
    font-family: 'DM Sans', sans-serif;
    font-size: 10px;
    font-weight: 400;
    padding: 3px 9px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    z-index: 2;
}

.flavor-card-readtime svg {
    width: 10px;
    height: 10px;
    stroke: rgba(255, 255, 255, 0.8);
    fill: none;
}

.flavor-card-body {
    padding: 18px 18px 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 8px;
}

.flavor-card-tag {
    font-family: 'DM Sans', sans-serif;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--flavor-accent);
}

.flavor-card-title {
    font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.35;
    margin: 0;
    color: var(--flavor-heading);
}

.flavor-card-excerpt {
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 300;
    line-height: 1.6;
    color: var(--flavor-text);
    margin: 0;
    flex: 1;
}

.flavor-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #eaf2ec;
}

.flavor-card-author {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.flavor-author-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--flavor-btn-hover-bg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'DM Sans', sans-serif;
    font-size: 10px;
    font-weight: 500;
    color: #e8f5ec;
    flex-shrink: 0;
}

.flavor-author-name {
    font-family: 'DM Sans', sans-serif;
    font-size: 11.5px;
    color: var(--flavor-text);
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.flavor-card-arrow {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1.5px solid #c4dfc9;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, border-color 0.2s ease;
    flex-shrink: 0;
}

.flavor-card-arrow svg {
    width: 13px;
    height: 13px;
    stroke: var(--flavor-btn-text);
    stroke-width: 2;
    fill: none;
    transition: stroke 0.2s ease;
}

.flavor-card:hover .flavor-card-arrow {
    background: var(--flavor-btn-hover-bg);
    border-color: var(--flavor-btn-hover-bg);
}

.flavor-card:hover .flavor-card-arrow svg {
    stroke: #ffffff;
}

/* No Posts */
.flavor-no-posts {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--flavor-meta);
    font-size: 1.1rem;
}

/* ==========================================================================
   Category Filter Dropdown
   ========================================================================== */

.flavor-category-filter {
    margin-bottom: 28px;
}

.flavor-category-filter-label {
    display: block;
    font-family: 'DM Sans', sans-serif;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--flavor-accent);
    margin-bottom: 10px;
}

.flavor-category-select-wrap {
    position: relative;
    max-width: 360px;
}

.flavor-category-select {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    border: 1.5px solid #c4dfc9;
    border-radius: 999px;
    background: var(--flavor-card-bg);
    color: var(--flavor-heading);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 500;
    padding: 12px 44px 12px 18px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.flavor-category-select:hover {
    border-color: var(--flavor-btn-hover-bg);
}

.flavor-category-select-wrap.is-focused .flavor-category-select,
.flavor-category-select:focus {
    outline: none;
    border-color: var(--flavor-btn-hover-bg);
    box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.15);
}

.flavor-category-select-icon {
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--flavor-btn-text);
    transition: transform 0.2s ease;
}

.flavor-category-select-wrap.is-focused .flavor-category-select-icon {
    transform: translateY(-50%) rotate(180deg);
}

.flavor-share-btn.is-copied {
    background: var(--flavor-btn-hover-bg);
    color: var(--flavor-btn-hover-text);
    border-color: var(--flavor-btn-hover-bg);
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.flavor-pagination {
    margin: 45px 0 20px;
    text-align: center;
}

.flavor-pagination ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: inline-flex;
    gap: 6px;
}

.flavor-pagination li {
    display: inline-block;
}

.flavor-pagination a,
.flavor-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1.5px solid #d5cec5;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--flavor-text);
    text-decoration: none;
    transition: all 0.2s ease;
    background: var(--flavor-card-bg);
}

.flavor-pagination a:hover {
    border-color: var(--flavor-heading);
    color: var(--flavor-heading);
}

.flavor-page-current {
    background: var(--flavor-heading) !important;
    color: #fff !important;
    border-color: var(--flavor-heading) !important;
}

.flavor-page-dots {
    border: none !important;
    background: transparent !important;
    color: var(--flavor-meta);
}

/* ==========================================================================
   Single Post
   ========================================================================== */

/* Breadcrumbs + Top Nav */
.flavor-single-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.flavor-breadcrumbs {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.flavor-breadcrumbs a {
    color: var(--flavor-breadcrumb);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.flavor-breadcrumbs a:hover {
    opacity: 0.7;
}

.flavor-breadcrumb-sep {
    margin: 0 6px;
    color: var(--flavor-meta);
    font-weight: 400;
}

.flavor-header-nav {
    display: flex;
    gap: 12px;
}

.flavor-nav-link {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--flavor-heading);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.flavor-nav-link:hover {
    opacity: 0.7;
}

/* Single Title */
.flavor-single-title {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--flavor-heading);
    line-height: 1.3;
    margin: 0 0 12px;
}

/* Single Meta */
.flavor-single-meta {
    font-size: 0.9rem;
    color: var(--flavor-meta);
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.flavor-meta-sep {
    font-size: 0.6rem;
}

/* Featured Image */
.flavor-single-featured-image {
    margin-bottom: 30px;
    border-radius: 4px;
    overflow: hidden;
}

.flavor-featured-img {
    width: 100%;
    height: auto;
    display: block;
}

/* Content */
.flavor-single-content {
    font-size: 1.05rem;
    line-height: 1.85;
    color: var(--flavor-text);
    margin-bottom: 40px;
}

.flavor-single-content p {
    margin-bottom: 1.4em;
}

.flavor-single-content h2 {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.5rem;
    color: var(--flavor-heading);
    margin: 2em 0 0.8em;
    font-weight: 700;
    line-height: 1.3;
}

.flavor-single-content h3 {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.25rem;
    color: var(--flavor-heading);
    margin: 1.8em 0 0.7em;
    font-weight: 700;
}

.flavor-single-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 1.2em 0;
}

.flavor-single-content blockquote {
    border-left: 4px solid var(--flavor-heading);
    margin: 1.5em 0;
    padding: 15px 25px;
    background: rgba(107, 29, 29, 0.04);
    font-style: italic;
    color: var(--flavor-text);
}

.flavor-single-content ul,
.flavor-single-content ol {
    margin: 1em 0;
    padding-left: 1.8em;
}

.flavor-single-content li {
    margin-bottom: 0.5em;
    line-height: 1.7;
}

.flavor-single-content a {
    color: var(--flavor-link);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.flavor-single-content a:hover {
    opacity: 0.8;
}

/* Social Share */
.flavor-social-share {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 0;
    border-top: 1px solid #e8e0d6;
    border-bottom: 1px solid #e8e0d6;
    margin-bottom: 40px;
}

.flavor-share-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--flavor-text);
}

.flavor-share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f0ebe4;
    color: var(--flavor-text);
    text-decoration: none;
    transition: all 0.2s ease;
}

.flavor-share-btn:hover {
    background: var(--flavor-heading);
    color: #fff;
}

/* Post Navigation (bottom) */
.flavor-post-navigation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 40px 0;
    padding: 25px 0;
    border-top: 1px solid #e8e0d6;
}

.flavor-post-nav-link {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-decoration: none;
    padding: 12px;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.flavor-post-nav-link:hover {
    background: rgba(107, 29, 29, 0.04);
}

.flavor-post-nav-next {
    text-align: right;
}

.flavor-nav-direction {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--flavor-heading);
}

.flavor-nav-title {
    font-size: 0.95rem;
    color: var(--flavor-text);
    line-height: 1.4;
}

@media (max-width: 600px) {
    .flavor-post-navigation {
        grid-template-columns: 1fr;
    }
    .flavor-post-nav-next {
        text-align: left;
    }
}

/* Related Posts Slider */
.flavor-related-section {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.flavor-related-section:empty {
    display: none;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 768px) {
    .flavor-single-title {
        font-size: 1.6rem;
    }

    .flavor-single-content {
        font-size: 1rem;
    }

    .flavor-archive-title {
        font-size: 1.5rem;
    }

    .flavor-single-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .flavor-social-share {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    :root {
        --flavor-top-offset: max(
            82px,
            calc(
                var(--admin-bar, 0px)
                + var(--theme-frame-size, 0px)
                + var(--header-sticky-height, var(--header-height, var(--header-sticky-offset, 0px)))
                + 14px
            )
        );
    }

    .flavor-single-container,
    .flavor-archive-container {
        padding: 20px 15px 40px;
    }

    .flavor-single-title {
        font-size: 1.35rem;
    }

    .flavor-blog-grid {
        gap: 20px;
    }
}

/* --- Smooth loading animation --- */
.flavor-card {
    animation: flavorFadeInUp 0.4s ease both;
}

.flavor-card:nth-child(2) { animation-delay: 0.06s; }
.flavor-card:nth-child(3) { animation-delay: 0.12s; }
.flavor-card:nth-child(4) { animation-delay: 0.18s; }
.flavor-card:nth-child(5) { animation-delay: 0.24s; }
.flavor-card:nth-child(6) { animation-delay: 0.30s; }
.flavor-card:nth-child(7) { animation-delay: 0.36s; }
.flavor-card:nth-child(8) { animation-delay: 0.42s; }
.flavor-card:nth-child(9) { animation-delay: 0.48s; }

@keyframes flavorFadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
