@import url('https://fonts.googleapis.com/css2?family=Merriweather:ital,wght@0,300;0,400;0,700;1,400&display=swap');

/* --- Fungal Palette Variables --- */
:root {
    --stipe-bg: #f4f1ea;       
    --spore-text: #3e362e;     
    --chanterelle: #c67a3d;
    --earth: #8b5a33;
    --mycelium-border: #d9d0c1;
}

* { margin: 10px 0 0 0; padding: 0; box-sizing: border-box; }

body {
    background-color: var(--stipe-bg);
    color: var(--spore-text);
    font-family: 'Merriweather', 'Georgia', serif;
    line-height: 1.6;
}

a { color: var(--chanterelle); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Turns off this particular hover effect for the Mushrooms category */
.mushrooms-grid a.post-box:hover {
    text-decoration: none;
}

/* --- Header & Navigation --- */
.site-logo {
    max-width: 400px; /* Adjust this value to fit your specific image */
    height: auto;
    display: block;
}

.header-inner {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-nav a { margin-left: 1.5rem; }

.site-content {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 2rem 0 2rem;
}

.search-container { margin-bottom: 3rem; }

.nav-button {
    background: none;
    border: none;
    color: var(--chanterelle);
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    padding: 0;
    margin-left: 1.5rem;
}

.nav-button:hover {
    text-decoration: underline;
}

/* --- Global Post Styling & APA 7 --- */
.post-body img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 1.5rem 0;
}

.apa-references {
    margin-top: 4rem;
    border-top: 1px solid var(--mycelium-border);
    padding-top: 2rem;
}

.apa-references p {
    padding-left: 0.5in;
    text-indent: -0.5in;
    margin-bottom: 1rem;
}

/* --- Garden Index Structure --- */
.garden-section { margin-bottom: 4rem; }

.garden-section h2 {
    border-bottom: 1px solid var(--mycelium-border);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
    font-weight: normal;
    text-align: left; /* Forces left alignment */
    width: 100%; /* Ensures the underline spans the full container */
    display: block;
}

/* Base Text Box (Used for Spores, Pins, Fruiting) */
.text-box {
    border: 1px solid var(--spore-text); 
    padding: 1rem;
    text-align: center;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   DEVELOPMENTAL GRID CONTAINERS
   ========================================================================== */

/* Spores: Centered wrapping row */
.spores-grid .grid-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

/* Pins: 2-column grid for wider sprouting thoughts */
.pins-grid .grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
}

/* Fruiting: Staggered wrapping flex cards */
.fruiting-grid .grid-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
}

/* ==========================================================================
   BOX STYLES (Spores, Pins, Fruiting)
   ========================================================================== */

/* Base reset for text inside all non-mushroom boxes */
.garden-section:not(.mushrooms-grid) .post-box {
    text-decoration: none;
    box-sizing: border-box;
}

.garden-section:not(.mushrooms-grid) .post-box h3 {
    color: var(--spore-text);
    margin: 0;
    font-size: 1.05rem;
    font-weight: normal;
    white-space: nowrap; /* Keeps link title cleanly on one line inside pills */
}


/* --- 1. SPORES: Pill badge with contained text --- */
.spores-grid .post-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--mycelium-border);
    background-color: #C6CFC6;
    border-radius: 9999px;               /* True pill shape */
    padding: 0.6rem 1.4rem;
    transition: all 0.2s ease;
}

.spores-grid .post-box:hover {
    border-color: var(--chanterelle);
    background-color: rgba(198, 122, 61, 0.08);
    transform: translateY(-2px);
}


/* --- 2. PINS: Rounded rectangle cards --- */
.pins-grid .post-box {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 1.5px solid rgba(198, 122, 61, 0.45);
    background-color: rgba(198, 122, 61, 0.04);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    transition: all 0.2s ease;
}

.pins-grid .post-box:hover {
    border-color: var(--chanterelle);
    background-color: rgba(198, 122, 61, 0.12);
    transform: translateY(-2px);
}


/* --- 3. FRUITING: Structured cards --- */
.fruiting-grid .post-box {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex: 1 1 220px;
    max-width: 320px;
    border: 1.5px solid var(--chanterelle);
    background-color: rgba(198, 122, 61, 0.08);
    border-radius: 6px;
    padding: 1.5rem;
    transition: all 0.2s ease;
}

.fruiting-grid .post-box:hover {
    background-color: rgba(198, 122, 61, 0.16);
    box-shadow: 0 4px 12px rgba(62, 54, 46, 0.06);
    transform: translateY(-2px);
}

/* 4. Mushrooms: 3-column grid with images */
.mushrooms-grid .grid-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.mushrooms-grid .post-box {
    display: flex;
    flex-direction: column;
    border: none;
    background: transparent;
    padding: 0;
    text-align: left;
}

/* Specifically targets featured images inside the Mushrooms index grid */
.mushrooms-grid .featured-image {
    border: 2px solid var(--chanterelle); /* Uses warm ochre accent color */
    border-radius: 4px; /* Optional: adds a soft curve to the image corners */
    
    /* If you want a hover effect that highlights the image when rolling over the card: */
    transition: border-color 0.2s ease;
}

/* Optional: Changes the border color when hovering over the post box */
.mushrooms-grid .post-box:hover .featured-image {
    border-color: var(--mycelium-border); 
}

/* Base setup applied directly to the headers inside the Mushrooms grid */
.mushrooms-grid .post-box h3 {
    background-image: linear-gradient(to right, var(--mycelium-border) 0%, var(--mycelium-border) 100%);
    background-size: 0% 2px;     /* Starts invisible at 0% width */
    background-repeat: no-repeat;
    background-position: left 95%; 
    transition: background-size 400ms ease;
    display: inline-block;       
    margin: 0;                   
}

/* Trigger the line to draw across when hovering ANYWHERE on the post card */
.mushrooms-grid .post-box:hover h3 {
    background-size: 100% 2px;   /* Expands to the full width of the text */
}

/* ==========================================================================
   EMPTY CATEGORY PLACEHOLDERS
   ========================================================================== */

/* Overrides the multi-column layout to center the single image */
.grid-container.empty-category {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

/* Styles the illustration to match fungal theme */
.category-placeholder {
    max-width: 150px; /* Keeps the illustration at a tasteful size */
    height: auto;
    opacity: 0.7; /* Softens the image so it looks like a background placeholder */
    border-radius: 8px; 
    /* Optional: Add a subtle taupe border to frame the illustration */
    border: 1px solid var(--mycelium-border);
    padding: 1rem;
}

/* ==========================================================================
   BASIC STYLES AND IMAGES
   ========================================================================== */
.featured-image {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    margin-bottom: 1rem;
    border: 1px solid var(--mycelium-border);
}

.mushroom-post h3 {
    font-size: 1.2rem;
    font-weight: normal;
}

/* --- Footer --- */
.site-footer {
    text-align: center;
    padding: 2rem;
    border-top: 1px solid var(--mycelium-border);
    font-size: 0.9rem;
    color: var(--spore-text);
}

/* ==========================================================================
   POST CONTENT TYPOGRAPHY & SPACING
   ========================================================================== */

/* Spacing for paragraphs and reading rhythm */
.site-content p {
    margin-bottom: 1.5rem;
    line-height: 1.8; 
}

/* Header spacing and hierarchy */
.site-content h1, 
.site-content h2, 
.site-content h3 {
    color: var(--earth);
    font-weight: bold;
    margin-top: .5rem;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.site-content h1 {
    font-size: 2.5rem;
    border-bottom: 1px solid var(--mycelium-border);
    padding-bottom: 0.5rem;
    text-align: center;
}

/* --- Featured Image (Usually placed above H1) --- */
.featured-post-image {
    width: 100%;
    max-height: 500px;
    object-fit: cover;
    border: 1px solid var(--mycelium-border);
    border-radius: 4px;
    margin-bottom: 2rem;
}

/* --- Post Meta (Dates & Categories) --- */
.post-meta {
    color: var(--spore-text);
    font-size: 0.95rem;
    font-style: italic;
    margin-top: -1rem; /* Pulls the dates snugly up against the H1 */
    margin-bottom: 2.5rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
}

.post-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Adds a tiny Chanterelle accent dot before the Modified date */
.post-meta span + span::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--chanterelle);
}

/* --- Inline Images & Captions (<figure> and <figcaption>) --- */
.site-content figure {
    margin: 2.5rem 0;
    text-align: center;
}

.site-content figure img {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--mycelium-border);
    border-radius: 4px;
}

.site-content figcaption {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: var(--spore-text);
    font-style: italic;
    opacity: 0.85; /* Softens the caption slightly compared to body text */
}

/* --- Blockquotes --- */
.site-content blockquote {
    border-left: 4px solid var(--chanterelle);
    background-color: rgba(198, 122, 61, 0.05); /* 5% Chanterelle tint */
    padding: 1.5rem 2rem;
    margin: 2rem 0;
    font-style: italic;
    border-radius: 0 4px 4px 0;
}

.site-content blockquote p:last-child {
    margin-bottom: 0; /* Prevents awkward double-spacing at the bottom of the quote */
}

/* --- Lists (Unordered & Ordered) --- */
.site-content ul, 
.site-content ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

.site-content li {
    margin-bottom: 0.5rem;
    line-height: 1.8;
}

/* Colors the bullets/numbers to match the Chanterelle link color */
.site-content ul li::marker,
.site-content ol li::marker {
    color: var(--chanterelle);
    font-weight: bold;
}

/* --- Dividers (<hr>) --- */
.site-content hr {
    border: none;
    border-top: 1.5px dashed var(--mycelium-border);
    width: 15%; /* Creates a tasteful, centered thematic break */
    margin: 3.5rem auto;
}

/* ==========================================================================
   TAG CLOUD
   ========================================================================== */

.post-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 3rem;
    margin-bottom: 2rem; /* Creates breathing room before the APA references */
}

.tag-label {
    font-weight: bold;
    color: var(--spore-text);
    margin-right: 0.25rem;
    font-size: 0.9rem;
    font-style: italic;
}

.post-tags .tag {
    background-color: #FFFFFF;
    border: 1px solid var(--mycelium-border); /* Subtle taupe outline */
    color: var(--spore-text);                 /* Earthy brown text */
    padding: 0.25rem 0.75rem;
    border-radius: 50px;                      /* Creates the pill shape */
    font-size: 0.85rem;
    line-height: 1;
}

/* --- APA 7 Citations --- */
.apa-references {
    margin-top: 4rem;
    border-top: 1px solid var(--mycelium-border);
    padding-top: 2rem;
}

.apa-references h4 {
    text-align: center;
}

.apa-references p {
    padding-left: 0.5in;
    text-indent: -0.5in;
    margin-bottom: 1rem;
}

/* Responsive Video Wrapper */
.video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    margin: 2.5rem 0;
    overflow: hidden;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* --- Video Fallback Caption --- */
.video-caption {
    text-align: center;
    font-size: 0.9rem;
    font-style: italic;
    color: var(--spore-text);
    margin-top: -1.5rem; /* Pulls the text closer to the bottom of the video container */
    margin-bottom: 2.5rem;
}

/* ==========================================================================
   PAGEFIND SEARCH
   ========================================================================== */

/* 1. Map variables directly to the ID to guarantee specificity over Pagefind's defaults */
#search {
    --pagefind-ui-primary: var(--chanterelle);
    --pagefind-ui-text: var(--spore-text);
    --pagefind-ui-background: #FFFFFF; 
    --pagefind-ui-border: var(--mycelium-border);
    --pagefind-ui-tag: var(--stipe-bg);
    --pagefind-ui-border-width: 1px;
    --pagefind-ui-border-radius: 6px;
    --pagefind-ui-font: 'Merriweather', 'Georgia', serif; 
}

/* 2. Style the search container to blend with your page */
.search-container {
    max-width: 1000px;
    margin: 0 auto 3rem auto;
}

/* 3. Override the stubborn yellow <mark> tag with maximum specificity */
#search mark {
    background-color: rgba(198, 122, 61, 0.15) !important; /* 15% Chanterelle tint */
    color: var(--spore-text) !important;
    font-weight: bold;
    padding: 0 3px;
    border-radius: 3px;
}

/* 4. Remove default underlines on search result links */
#search .pagefind-ui__result-link {
    text-decoration: none;
}

#search .pagefind-ui__result-link:hover {
    color: var(--chanterelle);
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    /* Stack the header and center everything */
    .header-inner {
        flex-direction: column;
        align-items: center;
        gap: 1.5rem;
    }

    /* Wrap navigation links neatly */
    .site-nav {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }

    /* Remove the desktop left-margin so gap controls spacing evenly */
    .site-nav a {
        margin-left: 0; 
    }

    /* Collapse all custom grids to a single column on mobile */
    .spores-grid .grid-container,
    .pins-grid .grid-container,
    .mushrooms-grid .grid-container {
        grid-template-columns: 1fr;
    }

    /* Adjust page padding for smaller screens */
    .site-header {
        padding: 1.5rem 1rem;
    }
    
    .site-content {
        padding: 0 1rem 3rem 1rem;
    }
}

.letterbird-wrapper iframe {
    height: 100% !important;
}

/* ==========================================================================
   SITE UPDATES (Notice Board)
   ========================================================================== */

.updates-container {
    max-width: 800px;
    margin: 4rem auto 4rem auto; /* Centers the box and provides breathing room */
    background-color: rgba(198, 122, 61, 0.04); /* Soft 4% Chanterelle tint */
    border: 1px dashed var(--mycelium-border);
    border-radius: 6px;
    padding: 1.25rem 2rem;
    font-size: 0.9rem;
}

.updates-header {
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--mycelium-border);
    padding-bottom: 0.25rem;
}

.updates-title {
    font-weight: bold;
    color: var(--chanterelle);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.8rem;
}

.updates-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.updates-list li {
    margin-bottom: 0.5rem;
    color: var(--spore-text);
    line-height: 1.5;
}

.updates-list li:last-child {
    margin-bottom: 0;
}

.update-date {
    font-style: italic;
    color: var(--earth);
    margin-right: 0.5rem;
}