/* =========================================================
   BUSINESS IMPACT NW — STORIES & RESOURCES
   Palette:
   Teal  #39736e
   Green #78a22f
   ========================================================= */


/* =========================================================
   LAYOUT
   ========================================================= */

body.category #content > .container,
body.search-results #content > .container {
    display: flex;
    flex-wrap: wrap;

    width: calc(100% - 56px);
    max-width: 1380px;

    margin-left: auto;
    margin-right: auto;
}


/* Convert sidebar into Stories tools/header area */
body.category #secondary,
body.search-results #secondary {
    order: 1;

    float: none !important;

    width: 100% !important;
    max-width: none !important;

    margin: 0 0 42px !important;
    padding: 38px 0 0 !important;
}


/* Full-width results */
body.category #primary,
body.search-results #primary {
    order: 2;

    float: none !important;

    width: 100% !important;
    max-width: none !important;

    margin: 0 !important;
    padding: 0 !important;
}


/* Get the old WordPress sidebar widgets out of this view only */
body.category #secondary .widget_sow-image,
body.search-results #secondary .widget_sow-image,

body.category #secondary .widget_sow-social-media-buttons,
body.search-results #secondary .widget_sow-social-media-buttons,

body.category #secondary .widget_categories,
body.search-results #secondary .widget_categories,

body.category #secondary .widget_search,
body.search-results #secondary .widget_search {
    display: none !important;
}


/* Don't show this custom interface on unrelated sidebar pages */
body:not(.category):not(.search-results) .binw-story-tools {
    display: none !important;
}


/* =========================================================
   INTRO
   ========================================================= */

.binw-story-tools {
    width: 100%;
}


.binw-story-intro {
    max-width: 800px;

    margin: 0 0 28px;
}


.binw-story-intro h1 {
    margin: 0 0 9px;

    color: #39736e;

    font-size: 42px;
    line-height: 1.1;
    font-weight: 700;
}


.binw-story-intro p {
    margin: 0;

    max-width: 760px;

    color: #343538;

    font-size: 17px;
    line-height: 1.55;
}


/* Replace the theme's duplicate archive heading */
body.category .page-header,
body.category .page-title {
    display: none !important;
}


/* Search-result heading */
body.search-results .page-header {
    margin: 0 0 26px;
}


body.search-results .page-title {
    margin: 0;

    color: #39736e;

    font-size: 34px;
    line-height: 1.2;
    font-weight: 700;
}


/* =========================================================
   CATEGORY + SEARCH TOOLBAR
   ========================================================= */

.binw-story-toolbar {
    display: grid;

    grid-template-columns:
        minmax(280px, 360px)
        minmax(0, 1fr);

    gap: 14px;

    width: 100%;

    align-items: start;
}


/* =========================================================
   CUSTOM CATEGORY DROPDOWN
   ========================================================= */

.binw-category-menu {
    position: relative;

    width: 100%;

    margin: 0;

    z-index: 50;
}


.binw-category-menu summary {
    position: relative;

    display: flex;
    align-items: center;

    width: 100%;
    height: 58px;

    padding: 0 48px 0 18px;

    box-sizing: border-box;

    color: #343538;
    background: #fff;

    border: 1px solid #cbd2cf;
    border-radius: 10px;

    font-size: 16px;
    line-height: 1;

    list-style: none;
    cursor: pointer;

    transition:
        border-color .18s ease,
        box-shadow .18s ease,
        background .18s ease;
}


.binw-category-menu summary::-webkit-details-marker {
    display: none;
}


/* Custom arrow */
.binw-category-menu summary::after {
    content: "";

    position: absolute;

    right: 19px;
    top: 50%;

    width: 8px;
    height: 8px;

    border-right: 2px solid #39736e;
    border-bottom: 2px solid #39736e;

    transform:
        translateY(-70%)
        rotate(45deg);

    transition: transform .18s ease;
}


.binw-category-menu[open] summary::after {
    transform:
        translateY(-25%)
        rotate(225deg);
}


.binw-category-menu summary:hover {
    border-color: #39736e;

    background: #fafcfc;
}


.binw-category-menu[open] summary {
    border-color: #39736e;

    box-shadow:
        0 0 0 3px rgba(57, 115, 110, .12);
}


/* Dropdown panel */
.binw-category-panel {
    position: absolute;

    left: 0;
    top: calc(100% + 8px);

    width: min(460px, 90vw);
    max-height: 560px;

    overflow-y: auto;

    padding: 10px;

    box-sizing: border-box;

    background: #fff;

    border: 1px solid #d6ddda;
    border-radius: 12px;

    box-shadow:
        0 18px 44px rgba(52, 53, 56, .14);
}


/* Links */
.binw-category-panel a {
    display: block;

    padding: 9px 12px;

    color: #343538;

    border-radius: 7px;

    font-size: 15px;
    line-height: 1.35;

    text-decoration: none;

    transition:
        background .15s ease,
        color .15s ease,
        padding-left .15s ease;
}


.binw-category-panel a:hover,
.binw-category-panel a:focus {
    color: #39736e;
    background: rgba(57, 115, 110, .08);

    padding-left: 16px;
}


/* All stories option */
.binw-category-all {
    margin: 0 0 7px;

    color: #39736e !important;

    font-weight: 700;

    border-bottom: 1px solid #e6e9e7;
    border-radius: 0 !important;
}


/* Groups */
.binw-category-group {
    padding: 9px 0;

    border-bottom: 1px solid #ecefed;
}


.binw-category-group:last-child {
    border-bottom: 0;
}


.binw-category-heading {
    padding: 7px 12px 5px;

    color: #39736e;

    font-size: 12px;
    line-height: 1.2;
    font-weight: 700;

    text-transform: uppercase;
    letter-spacing: .055em;
}


/* Slight indent where there really is a visual child */
.binw-category-panel .binw-category-child {
    padding-left: 26px;
}


.binw-category-panel .binw-category-child:hover {
    padding-left: 30px;
}


/* =========================================================
   SEARCH
   ========================================================= */

.binw-story-search {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        auto;

    gap: 10px;

    width: 100%;

    margin: 0;
}


.binw-story-search input[type="search"] {
    width: 100% !important;
    min-width: 0;

    height: 58px;

    margin: 0 !important;
    padding: 0 18px !important;

    box-sizing: border-box;

    color: #343538;
    background: #fff;

    border: 1px solid #cbd2cf !important;
    border-radius: 10px !important;

    font-size: 16px;

    transition:
        border-color .18s ease,
        box-shadow .18s ease,
        background .18s ease;
}


.binw-story-search input[type="search"]:hover {
    border-color: #39736e !important;

    background: #fafcfc;
}


.binw-story-search input[type="search"]:focus {
    border-color: #39736e !important;

    outline: none;

    box-shadow:
        0 0 0 3px rgba(57, 115, 110, .12);
}


.binw-story-search button {
    height: 58px;

    margin: 0;
    padding: 0 27px;

    border: 0;
    border-radius: 10px;

    background: #78a22f;
    color: #fff;

    font-size: 14px;
    font-weight: 700;

    cursor: pointer;

    transition:
        background .18s ease,
        transform .18s ease,
        box-shadow .18s ease;
}


.binw-story-search button:hover,
.binw-story-search button:focus {
    background: #39736e;

    transform: translateY(-2px);

    box-shadow:
        0 8px 18px rgba(57, 115, 110, .17);
}


/* =========================================================
   RESULTS — FORCE TRUE FULL WIDTH
   ========================================================= */

body.category #main,
body.search-results #main {
    width: 100% !important;
    max-width: none !important;

    margin: 0 !important;
    padding: 0 !important;

    background: transparent !important;
}


/* =========================================================
   STORY CARDS
   ========================================================= */

body.category #main > article,
body.search-results #main > article {
    display: grid;

    /*
     * Featured image gets about 43%.
     * This is intentionally much larger than before.
     */
    grid-template-columns:
        minmax(400px, 44%)
        minmax(0, 1fr);

    grid-template-areas:
        "image header"
        "image content";

    column-gap: 42px;
    row-gap: 12px;

    width: 100% !important;
    max-width: none !important;

    margin:
        0
        0
        28px
        0 !important;

    padding: 32px !important;

    box-sizing: border-box;

    background: #fff !important;

    border: 1px solid #dde3e0;
    border-radius: 14px;

    box-shadow:
        0 4px 14px rgba(52, 53, 56, .045);

    overflow: hidden;

    transition:
        transform .2s ease,
        border-color .2s ease,
        box-shadow .2s ease;
}


body.category #main > article:hover,
body.search-results #main > article:hover {
    transform: translateY(-4px);

    border-color: rgba(57, 115, 110, .5);

    box-shadow:
        0 14px 34px rgba(57, 115, 110, .11);
}


/* Posts without an image */
body.category #main > article:not(.has-post-thumbnail),
body.search-results #main > article:not(.has-post-thumbnail) {
    grid-template-columns: 1fr;

    grid-template-areas:
        "header"
        "content";
}


/* =========================================================
   IMAGE — LARGE 1200 × 628 RATIO
   ========================================================= */

body.category #main > article .entry-thumbnail,
body.search-results #main > article .entry-thumbnail {
    grid-area: image;

    float: none !important;

    width: 100% !important;
    max-width: none !important;

    margin: 0 !important;
    padding: 0 !important;

    align-self: start;
}


body.category #main > article .entry-thumbnail a,
body.search-results #main > article .entry-thumbnail a {
    display: block;

    width: 100% !important;
    max-width: none !important;
}


body.category #main > article .entry-thumbnail img,
body.search-results #main > article .entry-thumbnail img {
    display: block;

    width: 100% !important;
    max-width: none !important;
    height: auto !important;

    aspect-ratio: 1200 / 628;

    margin: 0 !important;

    border-radius: 10px;

    object-fit: cover !important;
}


/* =========================================================
   TITLE + META
   ========================================================= */

body.category #main > article .entry-header,
body.search-results #main > article .entry-header {
    grid-area: header;

    margin: 0 !important;
    padding: 5px 0 0 !important;
}


body.category #main > article .entry-title,
body.search-results #main > article .entry-title {
    margin: 0 0 9px !important;

    font-size: 28px !important;
    line-height: 1.17 !important;
    font-weight: 700;
}


body.category #main > article .entry-title a,
body.search-results #main > article .entry-title a {
    color: #39736e !important;

    text-decoration: none;

    transition: color .18s ease;
}


body.category #main > article:hover .entry-title a,
body.search-results #main > article:hover .entry-title a {
    color: #78a22f !important;
}


body.category #main > article .entry-meta,
body.search-results #main > article .entry-meta {
    margin: 0 !important;

    color: #707372 !important;

    font-size: 13px !important;
}


/* =========================================================
   EXCERPT
   ========================================================= */

body.category #main > article .entry-content,
body.search-results #main > article .entry-content {
    grid-area: content;

    margin: 0 !important;
    padding: 0 !important;

    color: #343538;

    font-size: 16px;
    line-height: 1.65;
}


body.category #main > article .entry-content p,
body.search-results #main > article .entry-content p {
    margin-top: 0;
}


/* =========================================================
   CONTINUE READING
   ========================================================= */

body.category #main > article .more-link,
body.search-results #main > article .more-link {
    display: inline-block;

    margin-top: 11px;
    padding: 10px 17px;

    background: #78a22f !important;
    color: #fff !important;

    border-radius: 7px;

    font-weight: 600;
    text-decoration: none;

    transition:
        background .18s ease,
        transform .18s ease;
}


body.category #main > article .more-link:hover,
body.search-results #main > article .more-link:hover {
    background: #39736e !important;

    transform: translateY(-1px);
}


/* =========================================================
   PAGINATION
   ========================================================= */

body.category .pagination,
body.search-results .pagination {
    margin: 34px 0 20px;
}


/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 1020px) {

    body.category #main > article,
    body.search-results #main > article {
        grid-template-columns:
            minmax(320px, 42%)
            minmax(0, 1fr);

        column-gap: 28px;

        padding: 26px !important;
    }

}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 760px) {

    body.category #content > .container,
    body.search-results #content > .container {
        width: calc(100% - 30px);
    }


    .binw-story-intro {
        margin-bottom: 22px;
    }


    .binw-story-intro h1 {
        font-size: 32px;
    }


    .binw-story-intro p {
        font-size: 16px;
    }


    .binw-story-toolbar {
        grid-template-columns: 1fr;

        gap: 10px;
    }


    .binw-category-panel {
        width: 100%;
    }


    .binw-story-search {
        grid-template-columns: 1fr;
    }


    .binw-story-search button {
        width: 100%;
    }


    body.category #main > article,
    body.search-results #main > article {
        grid-template-columns: 1fr;

        grid-template-areas:
            "image"
            "header"
            "content";

        padding: 20px !important;

        row-gap: 16px;
    }


    body.category #main > article .entry-title,
    body.search-results #main > article .entry-title {
        font-size: 23px !important;
    }

}

/* =========================================================
   FIX CUSTOM CATEGORY DROPDOWN CLIPPING
   ========================================================= */

body.category #content,
body.search-results #content,

body.category #content > .container,
body.search-results #content > .container,

body.category #secondary,
body.search-results #secondary,

body.category #secondary .widget,
body.search-results #secondary .widget,

body.category #secondary .widget_custom_html,
body.search-results #secondary .widget_custom_html,

.binw-story-tools,
.binw-story-toolbar,
.binw-category-menu {
    overflow: visible !important;
}


/* Keep dropdown above story cards */
body.category #secondary,
body.search-results #secondary {
    position: relative;
    z-index: 100;
}

body.category #primary,
body.search-results #primary {
    position: relative;
    z-index: 1;
}

.binw-category-menu {
    position: relative;
    z-index: 500;
}

.binw-category-panel {
    z-index: 1000;
}
.binw-story-tools {
    display: block !important;
}
/* Stronger category section headings */
.binw-category-panel .binw-category-heading {
    display: block;
    margin: 0 0 8px;
    font-size: 15px;
    line-height: 1.3;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #39736e;
    text-transform: none;
}

/* Clickable parent category headings */
.binw-category-panel .binw-category-heading-link {
    padding: 0 !important;
    text-decoration: none;
    color: #39736e;
}

.binw-category-panel .binw-category-heading-link:hover,
.binw-category-panel .binw-category-heading-link:focus {
    color: #78a22f;
    background: transparent !important;
    text-decoration: underline;
}

/* Give child links a little visual separation from the parent heading */
.binw-category-panel .binw-category-heading + a,
.binw-category-panel .binw-category-heading-link + a {
    margin-top: 2px;
}

/* IMPACT Pitch gets parent-level emphasis */
.binw-category-panel .binw-category-feature {
    font-size: 15px;
    font-weight: 700;
    color: #39736e;
}