:root {
    --primary: #2D5A27;
    --secondary: #C04000;
    --accent: #87A96B;
    --bg-parchment: #F5F5DC;
    --text-main: #3E2723;
    --text-dim: #6D4C41;
    --paper-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--bg-parchment);
    background-image: url('https://www.transparenttextures.com/patterns/recycled-paper.png');
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

h1,
h2,
h3,
h4 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
}

/* Header & Navigation */
header {
    padding: 1.5rem 2rem 1.5rem;
    background: linear-gradient(to bottom, rgba(45, 90, 39, 0.05), transparent);
}

/* Top row: logo left, ad right */
.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    font-size: 2.88rem;
}

.logo h1 {
    font-size: 3.17rem;
    color: var(--primary);
    letter-spacing: -1px;
}

.bmc-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 1rem;
    background: #FFDD00;
    color: #1a1a1a;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    transition: transform 0.2s, box-shadow 0.2s;
    white-space: nowrap;
    margin-left: 0.75rem;
    overflow: visible;
    position: relative;
}

.bmc-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

.bmc-icon {
    width: 36px;
    height: 52px;
    margin: -14px 0;
}

.ad-banner-header {
    flex-shrink: 0;
}

/* Centered content below logo row */
.header-content {
    text-align: center;
}

.tagline {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 1.1rem;
    color: var(--text-dim);
    margin-bottom: 1.5rem;
}

.filter-nav {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

/* Buttons scaled down 20% from original */
.filter-btn {
    padding: 0.48rem 1.2rem;
    border: 1px solid var(--primary);
    background: transparent;
    color: var(--primary);
    border-radius: 50px;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    font-size: 0.72rem;
    transition: all 0.3s ease;
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 10px rgba(45, 90, 39, 0.2);
}

.filter-divider {
    color: var(--primary);
    font-size: 1.2rem;
    opacity: 0.3;
    display: flex;
    align-items: center;
    margin: 0 0.2rem;
}

/* Main Content */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.search-container {
    margin-bottom: 3rem;
    display: flex;
    justify-content: center;
}

#plant-search {
    width: 100%;
    max-width: 500px;
    padding: 1rem 1.5rem;
    border: none;
    border-bottom: 2px solid var(--accent);
    background: transparent;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.3rem;
    outline: none;
    transition: border-color 0.3s ease;
}

#plant-search:focus {
    border-color: var(--primary);
}

/* Plant Grid — cards scaled down 20% */
.plant-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(224px, 1fr));
    gap: 2rem;
}

.plant-card {
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: var(--paper-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.plant-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}

.plant-img-wrapper {
    height: 160px;
    background: var(--bg-parchment);
    overflow: hidden;
    position: relative;
}

.plant-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: scale 0.5s ease;
}

.plant-card:hover img {
    scale: 1.05;
}

.season-tag {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 0.3rem 0.8rem;
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
}

.plant-info {
    padding: 1.5rem;
}

.plant-info h3 {
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.plant-summary {
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-bottom: 1rem;
}

.plant-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 500;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(62, 39, 35, 0.8);
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--bg-parchment);
    background-image: url('https://www.transparenttextures.com/patterns/recycled-paper.png');
    width: 90%;
    max-width: 1050px;
    margin: 2rem auto;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 8px;
    position: relative;
    padding: 2.5rem;
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-dim);
    z-index: 10;
}

/* Modal Detail Header — left-aligned with ad banner */
.plant-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding-bottom: 2rem;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.detail-info-left {
    text-align: left;
}

.detail-name {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 0.3rem;
}

.detail-latin {
    font-size: 1.1rem;
    color: var(--text-dim);
    margin-bottom: 0.8rem;
}

.detail-tags {
    display: flex;
    gap: 0.6rem;
}

.detail-tags .tag {
    background: var(--accent);
    color: #fff;
    padding: 0.3rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.ad-banner-modal {
    flex-shrink: 0;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 3rem;
    margin-bottom: 3rem;
}

.cultivation-section h3,
.detail-growth h3,
.growth-gallery h3 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: var(--primary);
    border-left: 4px solid var(--secondary);
    padding-left: 1rem;
}

.guide-item {
    margin-bottom: 1.5rem;
}

.guide-item strong {
    display: block;
    color: var(--secondary);
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
}

.detail-growth {
    background: rgba(45, 90, 39, 0.03);
    padding: 1.5rem;
    border-radius: 4px;
}

.stats-list {
    list-style: none;
    margin-bottom: 2rem;
}

.stats-list li {
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
}

.cycle-timeline {
    border-left: 2px dashed var(--accent);
    padding-left: 1.5rem;
    margin-left: 0.5rem;
}

.cycle-step {
    position: relative;
    margin-bottom: 1.5rem;
}

.cycle-step::before {
    content: '';
    position: absolute;
    left: -1.95rem;
    top: 0.5rem;
    width: 12px;
    height: 12px;
    background: var(--primary);
    border-radius: 50%;
}

.step-label {
    font-weight: 600;
    color: var(--primary);
    display: block;
    font-size: 0.9rem;
}

.step-info {
    font-size: 0.85rem;
    color: var(--text-dim);
}

/* Single bloom image in modal */
.detail-bloom-image {
    margin-bottom: 2rem;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.detail-bloom-image img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    display: block;
}

/* Footer */
footer {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-dim);
    font-size: 0.85rem;
    font-family: 'Cormorant Garamond', serif;
}

@media (max-width: 768px) {
    header {
        padding: 1rem;
    }

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

    .ad-banner-header,
    .ad-banner-modal {
        display: none;
    }

    .logo h1 {
        font-size: 1.8rem;
    }

    .plant-detail-header {
        flex-direction: column;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .detail-bloom-image img {
        height: 200px;
    }

    .modal-content {
        padding: 1.5rem;
        margin: 1rem auto;
        width: 95%;
    }
}

/* ===================== Ad Popup Overlay ===================== */
#ad-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeInOverlay 0.3s ease;
}

@keyframes fadeInOverlay {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.ad-popup {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem 2rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 380px;
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0.85);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.ad-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
}

.ad-popup-label {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #999;
    font-weight: 500;
}

.ad-popup-close {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.75rem;
    padding: 0.4rem 1rem;
    border: 1px solid #ccc;
    border-radius: 50px;
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
    transition: all 0.3s ease;
    font-weight: 500;
}

.ad-popup-close.ready {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(45, 90, 39, 0.3);
}

.ad-popup-close.ready:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(45, 90, 39, 0.4);
}

.ad-popup-body {
    display: flex;
    justify-content: center;
}

.ad-popup-placeholder {
    padding: 0.5rem;
}