/*
Theme Name: Dorothy Gilman Fan Site
Theme URI: https://mrspollifax.com/blog
Author: Jolene MacFadden
Description: Custom Classic Editor theme for the Dorothy Gilman / Mrs Pollifax fan site. Rose and forest-green palette to match the geranium header art.
Version: 1.0.0
Requires PHP: 7.4
Text Domain: dgb-fansite
*/

/* ============================================================
   ROOT VARIABLES — Rose/Berry + Forest Green palette
   Pulled from the geranium header photo: berry-pink flowers,
   deep green leaves, warm cream background.
   ============================================================ */
:root {
    --dgb-berry: #8c2f44;        /* deep rose/berry — nav bar, buttons */
    --dgb-berry-dark: #6e2435;   /* darker berry for hover/active */
    --dgb-rose: #c45a72;         /* lighter rose accent */
    --dgb-forest: #2f4a35;       /* deep forest green — headings, links */
    --dgb-forest-light: #4a6b50; /* lighter green accent */
    --dgb-cream: #faf6f0;        /* warm cream background */
    --dgb-cream-dark: #f0e9de;   /* slightly deeper cream for cards */
    --dgb-ink: #2b2520;          /* near-black warm text color */
    --dgb-gold: #c9a14a;         /* gold accent for dividers */
    --dgb-mist: rgba(255,255,255,0.85);
    --dgb-max-width: 1200px;
    --dgb-radius: 8px;
    --dgb-font-serif: Georgia, 'Times New Roman', serif;
    --dgb-font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --dgb-transition: 0.2s ease;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
* { box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--dgb-font-ui);
    background: var(--dgb-cream);
    color: var(--dgb-ink);
    line-height: 1.65;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--dgb-berry); text-decoration: none; transition: color var(--dgb-transition); }
a:hover { color: var(--dgb-berry-dark); }
ul, ol { padding-left: 1.4rem; }

h1, h2, h3, h4, h5, h6 {
    font-family: var(--dgb-font-serif);
    color: var(--dgb-forest);
    line-height: 1.25;
    margin: 1.2em 0 0.6em;
}
h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.35rem, 3vw, 1.85rem); }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.1rem; }

/* ============================================================
   PAGE WRAPPER
   ============================================================ */
#page { display: flex; flex-direction: column; min-height: 100vh; }
#content { flex: 1; }

/* ============================================================
   TOP UTILITY BAR — date + social icons row above header
   ============================================================ */
.dgb-utility-bar {
    background: var(--dgb-forest);
    color: var(--dgb-mist);
    font-size: 0.78rem;
    padding: 0.45rem 1.5rem;
}
.dgb-utility-inner {
    max-width: var(--dgb-max-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.dgb-utility-date { opacity: 0.85; }
.dgb-social-links {
    display: flex;
    gap: 0.9rem;
    list-style: none;
    margin: 0;
    padding: 0;
}
.dgb-social-links a {
    color: var(--dgb-mist);
    font-size: 0.78rem;
}
.dgb-social-links a:hover { color: #fff; text-decoration: underline; }

/* ============================================================
   HEADER — full-width geranium image, no overlay text
   (title is already baked into the header artwork)
   ============================================================ */
.dgb-header-banner {
    width: 100%;
    background-image: var(--dgb-header-image);
    background-size: cover;
    background-position: center;
    aspect-ratio: 16 / 9;
    max-height: 480px;
    min-height: 220px;
}

/* Screen-reader-only site title for SEO, hidden visually since
   it's already in the header art */
.dgb-sr-title {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
}

/* ============================================================
   NAVIGATION — direct ID targeting, learned from the three
   fan-site builds. wp_nav_menu() container divs are unreliable;
   target #primary-menu directly wherever possible.
   ============================================================ */
.main-navigation {
    background: var(--dgb-berry);
    border-bottom: 3px solid var(--dgb-gold);
}
.nav-inner {
    max-width: var(--dgb-max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    position: relative;
}

#primary-menu {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    list-style: none;
    margin: 0;
    padding: 0;
}

#primary-menu > li {
    position: relative;
}

#primary-menu > li > a {
    display: block;
    font-family: var(--dgb-font-ui);
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.92);
    padding: 0.5rem 1.05rem;
    margin: 0.5rem 0.2rem;
    border-radius: 999px;
    white-space: nowrap;
    transition: all var(--dgb-transition);
}
#primary-menu > li > a:hover,
#primary-menu > li.current-menu-item > a,
#primary-menu > li.current-menu-ancestor > a {
    color: #fff;
    background: rgba(255,255,255,0.18);
}

/* Dropdown arrow on any item with children, at any level */
#primary-menu li.menu-item-has-children > a::after {
    content: ' \25BE';
    font-size: 0.65rem;
    opacity: 0.75;
    margin-left: 0.3em;
}

/* All dropdown levels — hidden until hover/focus on parent */
#primary-menu ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 230px;
    z-index: 9999;
    flex-direction: column;
    list-style: none;
    margin: 0;
    padding: 0;
    background: var(--dgb-forest);
    border-top: 2px solid var(--dgb-gold);
    border-radius: 0 0 var(--dgb-radius) var(--dgb-radius);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}
/* Third and fourth level flyout to the side rather than down,
   so deep menus don't run off the bottom of the screen */
#primary-menu ul ul,
#primary-menu ul ul ul {
    top: 0;
    left: 100%;
    border-top: none;
    border-left: 2px solid var(--dgb-gold);
    border-radius: 0 var(--dgb-radius) var(--dgb-radius) var(--dgb-radius);
}
#primary-menu li:hover > ul,
#primary-menu li:focus-within > ul,
#primary-menu li.submenu-open > ul {
    display: flex;
}
#primary-menu ul li a {
    display: block;
    padding: 0.6rem 1.2rem;
    color: rgba(255,255,255,0.85);
    white-space: nowrap;
    border-radius: 0;
    margin: 0;
    font-size: 0.82rem;
    text-transform: none;
    letter-spacing: 0.02em;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}
#primary-menu ul li a:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}
#primary-menu ul li.menu-item-has-children > a::after {
    content: ' \25B8';
    float: right;
}

/* Mobile toggle button */
.menu-toggle {
    display: none;
    background: none;
    border: 1px solid rgba(255,255,255,0.5);
    color: #fff;
    padding: 0.45rem 0.85rem;
    cursor: pointer;
    font-family: var(--dgb-font-ui);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-radius: var(--dgb-radius);
    margin: 0.6rem 0;
}

/* ============================================================
   LAYOUT — main content + sidebar
   ============================================================ */
.site-main {
    max-width: var(--dgb-max-width);
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
    display: grid;
    grid-template-columns: 2.2fr 1fr;
    gap: 2.5rem;
}

/* ============================================================
   POST CARDS — blog listing
   ============================================================ */
.dgb-post-card {
    background: #fff;
    border-radius: var(--dgb-radius);
    overflow: hidden;
    margin-bottom: 2.2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.dgb-post-card img { width: 100%; }
.dgb-post-card-body { padding: 1.4rem 1.6rem 1.6rem; }
.dgb-post-categories {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.6rem;
}
.dgb-post-categories a {
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: var(--dgb-cream-dark);
    color: var(--dgb-forest);
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
}
.dgb-post-card h2 { margin-top: 0.2rem; }
.dgb-post-date {
    font-size: 0.78rem;
    color: #8a8178;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* AdSense slot directly under each post excerpt */
.dgb-ad-slot {
    display: block;
    width: 100%;
    max-width: 728px;
    margin: 1.5rem auto 0;
    text-align: center;
    overflow: hidden;
}
.dgb-ad-slot ins.adsbygoogle {
    display: block !important;
    width: 100% !important;
    max-width: 728px !important;
    height: 90px !important;
}
/* Hard ceiling: never show more than two ad slots on a page */
.dgb-ad-slot ~ .dgb-ad-slot ~ .dgb-ad-slot {
    display: none !important;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.dgb-pagination {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin: 2rem 0;
    flex-wrap: wrap;
}
.dgb-pagination a, .dgb-pagination span {
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    background: var(--dgb-cream-dark);
    color: var(--dgb-forest);
    font-size: 0.85rem;
}
.dgb-pagination .current {
    background: var(--dgb-berry);
    color: #fff;
}

/* ============================================================
   SIDEBAR — essentials only: search, recent posts, newsletter
   ============================================================ */
#secondary { display: flex; flex-direction: column; gap: 2rem; }
.widget {
    background: #fff;
    border-radius: var(--dgb-radius);
    padding: 1.4rem 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    overflow: hidden;
    box-sizing: border-box;
}
/* Universal safety net — any widget added later via Appearance >
   Widgets (RSS, image, gallery, etc.) gets its images capped to
   the widget's own width automatically. */
.widget img {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    display: block;
    margin: 0.5rem 0;
    border-radius: 4px;
}
.widget-title {
    font-family: var(--dgb-font-serif);
    color: var(--dgb-forest);
    font-size: 1.05rem;
    margin: 0 0 0.9rem;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid var(--dgb-gold);
}
.widget ul { list-style: none; padding: 0; margin: 0; }
.widget ul li {
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--dgb-cream-dark);
    font-size: 0.92rem;
}
.widget ul li:last-child { border-bottom: none; }

.dgb-search-form { display: flex; gap: 0.5rem; }
.dgb-search-form input[type="search"] {
    flex: 1;
    padding: 0.55rem 0.8rem;
    border: 1px solid var(--dgb-cream-dark);
    border-radius: var(--dgb-radius);
    font-size: 0.9rem;
}
.dgb-search-form button {
    background: var(--dgb-berry);
    color: #fff;
    border: none;
    padding: 0.55rem 1.1rem;
    border-radius: var(--dgb-radius);
    cursor: pointer;
    font-size: 0.85rem;
}
.dgb-search-form button:hover { background: var(--dgb-berry-dark); }

.dgb-newsletter-widget p { font-size: 0.9rem; margin-top: 0; }
.dgb-newsletter-widget .dgb-btn {
    display: inline-block;
    background: var(--dgb-forest);
    color: #fff;
    padding: 0.6rem 1.3rem;
    border-radius: 999px;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-top: 0.4rem;
}
.dgb-newsletter-widget .dgb-btn:hover { background: var(--dgb-forest-light); color: #fff; }

/* ============================================================
   SINGLE POST / PAGE CONTENT
   ============================================================ */
.entry-content { font-size: 1rem; line-height: 1.85; }
.entry-content p { margin: 0 0 1.3em; }
.entry-content img { border-radius: var(--dgb-radius); margin: 1.2em 0; }
.entry-content blockquote {
    border-left: 4px solid var(--dgb-gold);
    margin: 1.5em 0;
    padding: 0.3em 0 0.3em 1.3em;
    font-style: italic;
    color: var(--dgb-forest);
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
    background: var(--dgb-forest);
    color: var(--dgb-mist);
    padding: 2.5rem 1.5rem 1.5rem;
}
.dgb-disclosure {
    max-width: var(--dgb-max-width);
    margin: 0 auto 2rem;
    font-size: 0.85rem;
    line-height: 1.7;
    opacity: 0.92;
}
.dgb-disclosure a { color: var(--dgb-gold); }

/* Three independent footer columns, each capped at 300px, for
   widgets — RSS feeds, links, anything dropped in via
   Appearance > Widgets > Footer Column 1/2/3.

   Each column has its own overflow:hidden boundary so a wide
   RSS thumbnail or oversized image can never blow out the grid
   and force columns to stack into one wide block. */
.dgb-footer-columns {
    max-width: var(--dgb-max-width);
    margin: 0 auto 2rem;
    display: grid;
    grid-template-columns: 300px 300px 300px;
    justify-content: space-between;
    gap: 2rem;
}
.dgb-footer-col {
    width: 300px;
    max-width: 300px;
    min-width: 0;
    overflow: hidden;
}

/* Widgets inside the dark footer need light text and a subtle
   contrast panel rather than the white sidebar-card look */
.dgb-footer-col .widget {
    background: rgba(255,255,255,0.06);
    box-shadow: none;
    padding: 1.2rem 1.3rem;
    color: var(--dgb-mist);
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}
.dgb-footer-col .widget-title {
    color: #fff;
    border-bottom: 2px solid var(--dgb-gold);
    font-size: 0.98rem;
}
.dgb-footer-col .widget a { color: var(--dgb-mist); word-break: break-word; }
.dgb-footer-col .widget a:hover { color: var(--dgb-gold); }
.dgb-footer-col .widget ul li {
    border-bottom: 1px solid rgba(255,255,255,0.1);
    font-size: 0.85rem;
}

/* Hard cap on every image inside a footer widget — this is the
   actual fix for oversized RSS feed thumbnails. RSS widgets pull
   whatever image size the source feed provides, which can be
   1000px+ wide, so it must be forced down here regardless of
   its native dimensions. */
.dgb-footer-col .widget img {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    display: block;
    margin: 0.5rem 0;
    border-radius: 4px;
}

/* RSS widget items WordPress generates */
.dgb-footer-col .rss-date { display: block; font-size: 0.72rem; opacity: 0.7; }
.dgb-footer-col .rssSummary {
    font-size: 0.82rem;
    opacity: 0.85;
    margin: 0.3em 0 0;
    overflow-wrap: break-word;
}
.dgb-footer-col .rssSummary img {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
}
/* Some RSS feeds wrap the thumbnail in its own paragraph/div —
   catch those too */
.dgb-footer-col .widget p img,
.dgb-footer-col .widget div img {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
}

.dgb-footer-bottom {
    max-width: var(--dgb-max-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.8rem;
    padding-top: 1.2rem;
    border-top: 1px solid rgba(255,255,255,0.15);
    font-size: 0.8rem;
}
.dgb-footer-social {
    display: flex;
    gap: 0.9rem;
    list-style: none;
    margin: 0;
    padding: 0;
}
.dgb-footer-social a { color: var(--dgb-mist); }
.dgb-footer-social a:hover { color: #fff; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 860px) {
    .site-main { grid-template-columns: 1fr; }
    .dgb-footer-columns {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 1.2rem;
    }
    .dgb-footer-col { width: 100%; max-width: 100%; }
}

@media (max-width: 768px) {
    .menu-toggle { display: block; }

    #primary-menu {
        display: none;
        flex-direction: column;
        width: 100%;
        position: absolute;
        top: 100%;
        left: 0;
        background: var(--dgb-berry);
        box-shadow: 0 6px 16px rgba(0,0,0,0.3);
    }
    .main-navigation.toggled #primary-menu { display: flex; }
    #primary-menu > li > a { margin: 0; border-radius: 0; padding: 0.7rem 1.2rem; }

    /* On mobile, flyout submenus become static stacked panels */
    #primary-menu ul,
    #primary-menu ul ul {
        position: static;
        left: auto; top: auto;
        border-radius: 0;
        box-shadow: none;
        border-left: none;
    }

    .dgb-utility-inner { flex-direction: column; align-items: flex-start; gap: 0.3rem; }

    .dgb-footer-columns {
        grid-template-columns: 1fr;
        justify-content: stretch;
    }
    .dgb-footer-col { width: 100%; max-width: 100%; }
}
