/**
 * Modern Homepage Styles - "Posh" Aesthetic
 */

/* Variables */
:root {
    --posh-gold: #D4AF37;
    --posh-black: #1a1a1a;
    --posh-grey: #f5f5f5;
    --posh-text: #333333;
    --font-serif: "Playfair Display", Georgia, serif;
    --font-sans: "Inter", "Helvetica Neue", sans-serif;
}

/* Unified Grid Centering Wrapper */
.posh-grid-wrapper {
    max-width: 1400px !important;
    /* Posh wide width */
    width: 95% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    display: grid !important;
    justify-content: center !important;
    padding: 0 !important;
    gap: 2rem;
}

body.modern-home-template .wp-block-group.alignfull {
    max-width: 100% !important;
    width: 100% !important;
}

/* Portrait Grid - using Flexbox for proper centering with any count */
.portrait-grid {
    display: flex !important;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
}

/* Base card width for portrait grids */
.portrait-grid .post-card {
    flex: 0 1 320px;
    /* Don't grow, can shrink, base 320px */
    max-width: 320px;
}

/* Adjust card widths based on column preference */
.portrait-grid.cols-4 .post-card {
    flex-basis: calc(25% - 2rem);
    max-width: 320px;
}

.portrait-grid.cols-3 .post-card {
    flex-basis: calc(33.333% - 2rem);
    max-width: 380px;
}

.portrait-grid.cols-2 .post-card {
    flex-basis: calc(50% - 2rem);
    max-width: 450px;
}

.portrait-grid .post-image {
    width: 100%;
}

.portrait-grid .post-image img,
.portrait-grid .post-image a {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

@media (max-width: 1024px) {
    .portrait-grid.cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {

    .portrait-grid,
    .portrait-grid.cols-2,
    .portrait-grid.cols-3,
    .portrait-grid.cols-4,
    .grid-3,
    .grid-4 {
        display: grid !important;
        grid-template-columns: 1fr !important;
    }

    .portrait-grid .post-card {
        max-width: 100% !important;
        width: 100% !important;
    }
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-top: 4rem;
    margin-bottom: 2rem;
    letter-spacing: 1px;
    position: relative;
    padding-bottom: 1rem;
}

.section-title::after {
    content: "";
    display: block;
    width: 60px;
    height: 2px;
    background: var(--posh-gold);
    margin: 1rem auto 0;
}

/* Button Style */
.btn-posh {
    display: inline-block;
    padding: 12px 30px;
    background: var(--posh-black);
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.8rem;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid var(--posh-black);
}

.btn-posh:hover {
    background: transparent;
    color: var(--posh-black);
}

/* Hero Section */
.hero-section {
    position: relative;
    height: 80vh;
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: cover;
    background-position: center;
    margin-bottom: 4rem;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: #fff;
    max-width: 800px;
    padding: 2rem;
}

.hero-content h1 {
    color: #fff;
    font-size: 3.5rem;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.hero-content p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    font-weight: 300;
}

.hero-content .btn-posh {
    background: #fff;
    color: var(--posh-black);
    border-color: #fff;
}

.hero-content .btn-posh:hover {
    background: transparent;
    color: #fff;
}

/* Grid Layouts */
.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    padding: 0 2rem;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 0 2rem;
}

/* Post Card */
.post-card {
    background: #fff;
    transition: transform 0.3s ease;
}

.post-card:hover {
    transform: translateY(-5px);
}

.post-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 3/4;
}

.post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.post-card:hover .post-image img {
    transform: scale(1.05);
}

.post-meta {
    padding: 1.5rem 0;
    text-align: center;
}

.post-category {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #888;
    margin-bottom: 0.5rem;
    display: block;
}

.post-title h3 {
    font-size: 1.5rem;
    margin: 0.5rem 0;
    line-height: 1.3;
}

.post-title a {
    color: var(--posh-black);
    text-decoration: none;
}

.post-excerpt {
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.read-more-link {
    font-family: var(--font-serif);
    font-style: italic;
    color: var(--posh-text);
    text-decoration: none;
    border-bottom: 1px solid var(--posh-gold);
}

/* Categories Strip */
.category-strip {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 3rem 0;
    background: var(--posh-grey);
    margin: 4rem 0;
    flex-wrap: wrap;
}

.cat-pill {
    padding: 10px 25px;
    border: 1px solid #ddd;
    background: #fff;
    text-decoration: none;
    color: var(--posh-black);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.8rem;
    transition: all 0.3s;
}

.cat-pill:hover {
    background: var(--posh-black);
    color: #fff;
    border-color: var(--posh-black);
}

/* Responsive */
@media (max-width: 768px) {
    .hero-content h1 {
        font-size: 2.5rem;
    }

    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* --- Posh Footer --- */
/* Hide redundant branding from the standard theme footer part */
.site-footer-wrapper .wp-block-site-logo,
.site-footer-wrapper .wp-block-social-links,
.site-footer-wrapper .wp-block-separator,
.site-footer-wrapper .wp-block-spacer,
.site-footer-wrapper .wp-block-group .wp-block-group.alignwide {
    display: none !important;
}

.modern-footer-posh {
    background: #fdfaf5;
    /* Matches the screenshot's warm/cream tone */
    padding: 4rem 1rem;
    text-align: center;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    margin-top: 0;
}

.footer-container {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.footer-logo img {
    max-width: 150px;
    height: auto;
    display: block;
    margin: 0 auto;
}

.footer-site-url {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    margin-top: 0.5rem;
    color: #111;
    text-transform: uppercase;
}

.footer-socials {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin: 0.5rem 0;
}

.footer-socials a {
    color: #111;
    transition: opacity 0.3s ease;
}

.footer-socials a:hover {
    opacity: 0.6;
}

.footer-links {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: #333;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    line-height: 1.5;
}

.footer-links a {
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid transparent;
}

.footer-links a:hover {
    border-bottom-color: #333;
}

.footer-links .sep {
    color: #ccc;
    font-size: 0.6rem;
    vertical-align: middle;
    margin: 0 0.2rem;
    align-self: center;
}

.footer-disclaimer {
    font-family: 'Playfair Display', serif;
    /* Or maybe Inter, but generic matches screenshot */
    font-style: italic;
    font-size: 0.8rem;
    color: #666;
    margin-top: 1rem;
}

/* --- Block Pattern Support --- */
.hero-section-block .wp-block-cover__inner-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

.hero-title {
    font-family: var(--font-serif);
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    font-weight: 300;
}

/* Posh Button Block */
.wp-block-button.btn-posh-block .wp-block-button__link {
    display: inline-block;
    padding: 12px 30px;
    background: var(--posh-black);
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.8rem;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid var(--posh-black);
    border-radius: 0;
}

.wp-block-button.btn-posh-block .wp-block-button__link:hover {
    background: transparent;
    color: var(--posh-black);
    background: #fff;
    /* Inverted for block context usually on image */
}

/* Category Pills Block */
.cat-pill-block .wp-block-button__link {
    padding: 10px 25px;
    border: 1px solid #ddd;
    background: #fff;
    color: var(--posh-black) !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.8rem;
    border-radius: 0;
}

.cat-pill-block .wp-block-button__link:hover {
    background: var(--posh-black);
    color: #fff !important;
    border-color: var(--posh-black);
}

/* Grids */
.grid-3-block .wp-block-post-template,
.grid-4-block .wp-block-post-template {
    display: grid !important;
    gap: 2rem;
    list-style: none;
    /* In case it renders as UL */
    padding: 0;
}

.grid-3-block .wp-block-post-template {
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
}

.grid-4-block .wp-block-post-template {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* Section Titles in Blocks */
.section-title-block {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    margin-top: 4rem;
    margin-bottom: 2rem;
    letter-spacing: 1px;
    padding-bottom: 1rem;
    text-align: center;
}

.section-title-block::after {
    content: "";
    display: block;
    width: 60px;
    height: 2px;
    background: var(--posh-gold);
    margin: 1rem auto 0;
}

/* --- Mosaic Featured Layout --- */
.featured-mosaic {
    display: grid !important;
    grid-template-columns: 2fr 1fr;
    grid-template-rows: repeat(2, 300px);
    gap: 2rem;
}

.featured-mosaic .mosaic-main {
    grid-column: 1 / 2;
    grid-row: 1 / 3;
    position: relative;
    overflow: hidden;
    height: 100%;
}

.featured-mosaic .mosaic-main .post-image {
    height: 100%;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.featured-mosaic .mosaic-main .post-image img,
.featured-mosaic .mosaic-main .post-image a {
    height: 100%;
    width: 100%;
    object-fit: cover;
    display: block;
}

.featured-mosaic .mosaic-main .post-meta {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    background: #ffffff;
    padding: 2.5rem;
    margin: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.featured-mosaic .mosaic-sub {
    grid-column: 2 / 3;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.featured-mosaic .mosaic-sub .post-image {
    height: 100%;
    min-height: 200px;
}

.featured-mosaic .mosaic-sub .post-image img,
.featured-mosaic .mosaic-sub .post-image a {
    height: 100%;
    width: 100%;
    object-fit: cover;
    display: block;
}

.featured-mosaic .mosaic-sub .post-meta {
    padding: 1rem 1rem 1rem 0;
}

/* Header and Navigation Fixes */
body.modern-home-template .wp-block-template-part header>.wp-block-group {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 2rem !important;
    padding-right: 2rem !important;
}

body.modern-home-template .wp-block-navigation {
    width: 100%;
}

/* --- Unified Mobile Responsiveness --- */
@media (max-width: 768px) {

    /* 1. Tighter Gaps & Spacing */
    .posh-grid-wrapper,
    .portrait-grid,
    .grid-3,
    .grid-4 {
        gap: 1.5rem !important;
    }

    .hero-section {
        min-height: 400px;
        height: auto;
        padding: 4rem 1rem;
    }

    /* 2. Typography Scaling */
    .hero-content h1 {
        font-size: 2.2rem;
    }

    .section-title,
    .section-title-block {
        font-size: 2rem;
        margin-top: 3rem;
        margin-bottom: 1.5rem;
    }

    /* 3. Mosaic Grid Reset - Stack vertically on mobile */
    .featured-mosaic {
        display: block !important;
        /* Force block flow */
        width: 100% !important;
        height: auto !important;
        grid-template-columns: none !important;
        grid-template-rows: none !important;
    }

    .featured-mosaic .mosaic-main {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        margin-bottom: 2rem !important;
        position: relative !important;
        grid-column: unset !important;
        grid-row: unset !important;
    }

    .featured-mosaic .mosaic-main .post-image {
        position: relative !important;
        width: 100% !important;
        height: 60vw !important;
        /* Responsive height based on viewport width */
        min-height: 250px;
        max-height: 400px;
    }

    .featured-mosaic .mosaic-main .post-meta {
        position: relative !important;
        background: #fff;
        padding: 1.5rem !important;
        margin: -3rem 1rem 0 1rem !important;
        /* Overlap effect */
        box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
        width: auto !important;
        border-bottom: 1px solid #eee;
        z-index: 10;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
    }

    .featured-mosaic .mosaic-sub {
        display: block !important;
        width: 100% !important;
        margin-top: 2rem;
        height: auto !important;
        border: none !important;
    }

    .featured-mosaic .mosaic-sub .post-image {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 3/4;
        margin-right: 0 !important;
        margin-bottom: 0 !important;
    }

    .featured-mosaic .mosaic-sub .post-meta {
        padding: 1.5rem 0 !important;
        text-align: center !important;
    }

    .featured-mosaic .mosaic-sub h3 {
        font-size: 1.5rem !important;
        margin: 0.5rem 0 !important;
    }

    /* 4. Category Strip Tweak */
    .category-strip-block {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }

    .cat-pill-block .wp-block-button__link {
        padding: 8px 16px;
        font-size: 0.75rem;
    }

    /* 5. Header Fixes (ensure these persist) */
    body.modern-home-template header .wp-block-group.alignwide {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        flex-direction: row !important;
        width: 100% !important;
        max-width: 100vw !important;
        padding: 1rem 1.5rem !important;
    }

    body.modern-home-template .wp-block-navigation {
        flex-grow: 1 !important;
        display: flex !important;
        justify-content: flex-end !important;
    }

    body.modern-home-template .wp-block-navigation__responsive-container-open {
        margin-left: auto !important;
        margin-right: 0 !important;
        display: flex !important;
    }
}

.posh-grid-wrapper h3 {
    font-family: var(--font-serif);
    font-weight: 400;
    color: var(--posh-black);
    margin: 0.5rem 0;
    line-height: 1.3;
}

/* ==========================================================================
   CATEGORY ARCHIVE LAYOUTS
   ========================================================================== */

/* --- 1. The "Visual" Layout (Masonry / Portrait) --- */
.posh-category-visual-wrapper {
    max-width: 1400px;
    width: 95%;
    margin: 4rem auto;
}

.posh-category-visual-wrapper .wp-block-post-template {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    list-style: none;
    padding: 0;
}

/* Force Portrait Images */
.posh-category-visual-wrapper .wp-block-post-featured-image img,
.posh-category-visual-wrapper .wp-block-post-featured-image a {
    aspect-ratio: 2/3 !important;
    object-fit: cover;
    width: 100%;
    height: 100%;
    display: block;
    transition: transform 0.4s ease;
}

.posh-category-visual-wrapper .wp-block-post:hover .wp-block-post-featured-image img {
    transform: scale(1.03);
}

/* Hide Excerpts, Dates, Authors to keep it clean */
.posh-category-visual-wrapper .wp-block-post-excerpt,
.posh-category-visual-wrapper .wp-block-post-date,
.posh-category-visual-wrapper .wp-block-post-author {
    display: none !important;
}

/* Style the Title */
.posh-category-visual-wrapper .wp-block-post-title {
    font-family: var(--font-sans);
    font-size: 1.1rem;
    font-weight: 500;
    text-align: center;
    margin-top: 1rem;
}

.posh-category-visual-wrapper .wp-block-post-title a {
    color: var(--posh-black);
    text-decoration: none;
}


/* --- 2. The "Textual" Layout (Content + Sidebar) --- */
.posh-category-textual-wrapper {
    max-width: 1200px;
    width: 95%;
    margin: 4rem auto;
    display: grid;
    grid-template-columns: 7fr 3fr;
    gap: 4rem;
    align-items: start;
}

/* Style the Main Feed (Native Query Loop) */
.posh-category-textual-wrapper .posh-main-content .wp-block-post-template {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 3rem;
    list-style: none;
    padding: 0;
}

/* Force Square Images */
.posh-category-textual-wrapper .posh-main-content .wp-block-post-featured-image img {
    aspect-ratio: 1/1 !important;
    object-fit: cover;
    width: 100%;
}

.posh-category-textual-wrapper .posh-main-content .wp-block-post-title {
    font-family: var(--font-serif);
    font-size: 1.8rem;
    line-height: 1.2;
    margin: 1rem 0;
}

.posh-category-textual-wrapper .posh-main-content .wp-block-post-title a {
    color: var(--posh-black);
    text-decoration: none;
}

.posh-category-textual-wrapper .posh-main-content .wp-block-post-excerpt {
    font-family: var(--font-sans);
    font-size: 1rem;
    color: #555;
    line-height: 1.6;
}

/* Sidebar Styling */
.posh-category-textual-wrapper .posh-sidebar {
    position: sticky;
    top: 2rem;
    background: #fdfdfd;
    padding: 2rem;
    border: 1px solid #eee;
}

/* --- 3. Responsive Adjustments for Category Layouts --- */
@media (max-width: 1024px) {
    .posh-category-textual-wrapper {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    .posh-category-textual-wrapper .posh-sidebar {
        position: static;
        margin-top: 3rem;
    }
}

@media (max-width: 768px) {
    .posh-category-visual-wrapper .wp-block-post-template {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }
    .posh-category-textual-wrapper .posh-main-content .wp-block-post-template {
        grid-template-columns: 1fr !important;
    }
}

/* --- 4. The "Hub" Layout Wrapper --- */
.posh-category-hub-wrapper {
    max-width: 1400px;
    width: 95%;
    margin: 0 auto 4rem;
}