/* ============================================================
   EconWorks — main stylesheet
   Visual palette and tone inspired by the legacy planningtools
   deployment, applied to the current Bootstrap 4 templates.
   ============================================================ */

:root {
    --ew-green:        #9ac747;
    --ew-green-dark:   #82a83b;
    --ew-orange:       #f07622;
    --ew-blue:         #1daadf;
    --ew-text:         #444;
    --ew-text-muted:   #777;
    --ew-page-bg:      #f2f2f2;
    --ew-surface:      #fff;
    --ew-border:       #d3d3d3;
    --ew-soft-green:   #e7f2e0;
    --ew-row-alt:      #eee;

    /* Aliases used in existing component CSS (search.css, etc.) */
    --primary:         #9ac747;
    --white:           #fff;
}

/* ----- Base typography ----- */
html {
    box-sizing: border-box;
}
*, *::before, *::after { box-sizing: inherit; }

body {
    background: var(--ew-page-bg);
    color: var(--ew-text);
    font-family: "Myriad Pro", Myriad, "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
}

h1, h2, h3, h4, h5, h6 {
    font-family: "Myriad Pro", Myriad, "DejaVu Sans Condensed", "Helvetica Neue", Helvetica, Arial, sans-serif;
    color: #222;
    margin-top: 0;
}
h1 { font-size: 28px; line-height: 1.15; font-weight: 500; margin-bottom: 0.6em; }
h2 { font-size: 22px; line-height: 1.2;  font-weight: 600; margin-bottom: 0.5em; }
h3 { font-size: 18px; line-height: 1.25; font-weight: 600; margin-bottom: 0.4em; }
h4 { font-size: 16px; line-height: 1.3;  font-weight: 700; margin-bottom: 0.4em; }
p  { margin: 0 0 1em; }

a, a:visited { color: var(--ew-green-dark); text-decoration: none; }
a:hover, a:focus { color: var(--ew-green); text-decoration: underline; }

/* ----- Page shell: emulate the original "white sheet on gray" look ----- */
body {
    background: var(--ew-page-bg);
}

main#content {
    background: var(--ew-surface);
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 0 40px;
    box-shadow: 0 2px 6px rgba(0,0,0,.06);
}

/* page-content block (project_search, project_detail, AMP) */
.page-content {
    padding: 0;
}

/* ----- Header ----- */
.site-header {
    background: var(--ew-green);
    color: #fff;
    border-bottom: 4px solid var(--ew-green-dark);
    max-width: 1100px;
    margin: 0 auto;
}

.site-header .header-inner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    padding: 18px 24px;
    max-width: 100%;
    position: relative;
}

.site-brand {
    display: inline-flex;
    align-items: center;
    background: #fff;
    padding: 8px 18px;
    border-radius: 4px;
    margin-right: 24px;
}
.site-brand img {
    height: 36px;
    width: auto;
    display: block;
}

.primary-nav {
    flex: 1 1 auto;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.primary-menu > ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
}

.primary-menu > ul > li {
    position: relative;
    margin: 0;
}

.primary-menu a {
    display: block;
    padding: 12px 16px;
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    line-height: 1.2;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: 3px;
}

.primary-menu li:hover > a,
.primary-menu li.active > a,
.primary-menu li.active-parent > a {
    background: #fff;
    color: var(--ew-green-dark);
    border-color: #fff;
    text-decoration: none;
}

/* Sub-menu (dropdown) */
.primary-menu li > ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    min-width: 220px;
    background: var(--ew-green-dark);
    list-style: none;
    margin: 0;
    padding: 6px 0;
    border-radius: 3px;
    box-shadow: 0 4px 10px rgba(0,0,0,.15);
}
/* Invisible hover bridge above the dropdown so moving the cursor from the
   parent link to the dropdown never crosses dead space. Also extends a few
   pixels horizontally to forgive diagonal cursor paths. */
.primary-menu li.has-sub > ul::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -6px;
    right: -6px;
    height: 14px;
}
/* Show on parent hover OR when our JS keeps it open. */
.primary-menu li:hover > ul,
.primary-menu li.is-open > ul { display: block; }
.primary-menu li li { display: block; }
.primary-menu li li a {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    border-radius: 0;
    white-space: nowrap;
}
.primary-menu li li a:hover {
    background: rgba(255,255,255,.15);
    color: #fff;
    border-color: transparent;
}

/* "Take a survey!" pill */
.site-survey {
    display: inline-block;
    background: #fff;
    color: var(--ew-green-dark) !important;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 8px 14px;
    border-radius: 999px;
    margin-left: 18px;
    text-decoration: none !important;
    box-shadow: 0 2px 4px rgba(0,0,0,.15);
}
.site-survey:hover { background: var(--ew-page-bg); }

/* Mobile nav toggle (hamburger) */
.nav-toggle {
    display: none;
    background: transparent;
    border: 2px solid #fff;
    border-radius: 4px;
    padding: 8px 10px;
    cursor: pointer;
    margin-left: auto;
}
.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: #fff;
    margin: 4px 0;
}

@media (max-width: 880px) {
    .site-header .header-inner {
        padding: 14px 16px;
    }
    .nav-toggle { display: inline-block; }
    .primary-nav {
        order: 3;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }
    .primary-menu {
        display: none;
        width: 100%;
    }
    .primary-menu.is-open { display: block; }
    .primary-menu > ul {
        flex-direction: column;
        align-items: stretch;
    }
    .primary-menu a {
        padding: 12px 8px;
        border-bottom: 1px solid rgba(255,255,255,.15);
        border-radius: 0;
    }
    .primary-menu li > ul {
        position: static;
        box-shadow: none;
        background: rgba(0,0,0,.12);
        margin: 0;
        padding: 0;
        min-width: 0;
    }
    .primary-menu li:hover > a,
    .primary-menu li.active > a,
    .primary-menu li.active-parent > a {
        background: rgba(255,255,255,.15);
        color: #fff;
        border-color: transparent;
    }
    .site-survey { margin-left: 12px; }
}

/* ----- Breadcrumbs ----- */
ul.breadcrumb.container {
    background: transparent;
    padding: 14px 30px 0;
    margin: 0;
    list-style: none;
    font-size: 13px;
    color: var(--ew-text-muted);
}
ul.breadcrumb .breadcrumb-item {
    display: inline-block;
}
ul.breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    padding: 0 .35rem;
    color: #aaa;
}
ul.breadcrumb a {
    color: var(--ew-text-muted);
}

/* ----- Block titles (green band above page content) ----- */
.block-title {
    background: var(--ew-green);
    color: #fff;
    border-bottom: 4px solid var(--ew-green-dark);
}
.block-title h1,
.block-title .h1 {
    color: #fff;
    margin: 0;
    padding: 18px 30px;
    font-weight: 500;
    font-size: 26px;
    line-height: 1.2;
}
.colored-txt {
    color: #fff;
}
.block-title button,
.block-title .btn {
    margin-top: 4px;
}

/* ----- One-column content sections ----- */
.block-one_column {
    padding: 0;
}
.block-one_column > section.container,
section.one-column.container {
    max-width: 100%;
    padding: 24px 30px;
}
section.one-column.container > h2:first-child,
section.one-column.container > h3:first-child {
    margin-top: 0;
}

/* ----- Buttons ----- */
button,
.btn,
a.btn,
input[type="submit"] {
    display: inline-block;
    background: var(--ew-green);
    color: #fff;
    border: 1px solid var(--ew-green);
    border-radius: 4px;
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
button:hover, button:focus,
.btn:hover, .btn:focus,
a.btn:hover, a.btn:focus,
input[type="submit"]:hover, input[type="submit"]:focus {
    background: #fff;
    color: var(--ew-green-dark);
    border-color: var(--ew-green-dark);
    text-decoration: none;
}
button.small,
.btn.small,
a.small {
    padding: 5px 12px;
    font-size: 12px;
}
button[name="archive"] { background: #777; border-color: #777; }
button[name="archive"]:hover { color: #777; }
button[name="activate"] { background: #12a36f; border-color: #12a36f; }
button[name="activate"]:hover { color: #12a36f; }
button[name="delete"]   { background: var(--ew-orange); border-color: var(--ew-orange); }
button[name="delete"]:hover { color: var(--ew-orange); }

/* Bootstrap secondary buttons (e.g. Print Case Study) */
.btn-secondary,
button.btn-secondary {
    background: #fff;
    color: var(--ew-green-dark);
    border: 1px solid var(--ew-green-dark);
}
.btn-secondary:hover,
button.btn-secondary:hover {
    background: var(--ew-green-dark);
    color: #fff;
}

/* "Reset" link styled like a subtle button */
a.small {
    color: var(--ew-text);
    border: 1px solid var(--ew-border);
    background: #fff;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 700;
}
a.small:hover { background: var(--ew-page-bg); color: var(--ew-text); text-decoration: none; }

/* ----- Forms ----- */
input[type="text"],
input[type="number"],
input[type="search"],
input[type="email"],
input[type="password"],
textarea,
select {
    background: #f9f9f9;
    border: 1px solid var(--ew-border);
    border-radius: 3px;
    padding: 8px 10px;
    font-size: 14px;
    font-family: inherit;
    color: var(--ew-text);
}
input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--ew-green);
    outline-offset: -1px;
}
label { font-weight: 600; }

/* ----- Filter header / column (search + AMP pages) ----- */
.filter-header {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 30px;
    background: #fafafa;
    border-bottom: 1px solid #eee;
}
.filter-header h3 { margin: 0; font-size: 16px; }
.filter-toggle {
    margin: 0;
    cursor: pointer;
    font-weight: 600;
}
.filter-toggle input { display: none; }

.filter-column {
    flex: 0 0 280px;
    padding: 20px 25px 20px 30px;
    border-right: 1px solid #eee;
    background: #fcfcfc;
}

.filter-column h3 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ew-green-dark);
    border-bottom: 2px solid var(--ew-green);
    padding-bottom: 4px;
    margin-top: 18px;
}

details.filter > summary {
    cursor: pointer;
    font-weight: 600;
    padding: 4px 0;
}
details.filter > summary:hover { color: var(--ew-green-dark); }

.one-column.flex-grow-1 {
    padding: 0 30px 20px;
}

.result-count {
    padding: 12px 30px 0;
    font-weight: 600;
    color: var(--ew-text-muted);
}
.result-count p { margin: 0; }

.result-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
}

/* ----- Tables (search results, impact tables) ----- */
table.project_list,
table.zebra,
table.measures,
.case_results table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    background: #fff;
}
table.project_list thead th,
table.zebra thead th,
table.measures thead th,
.case_results thead th {
    background: var(--ew-soft-green);
    color: #333;
    text-align: left;
    padding: 8px 10px;
    border-bottom: 2px solid var(--ew-green);
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
table.project_list tbody td,
table.zebra tbody td,
table.measures tbody td {
    padding: 8px 10px;
    vertical-align: top;
    border-bottom: 1px solid #f1f1f1;
}
table.project_list tbody tr:hover { background: #fafff4; }

/* Highlighted (compare) rows */
.highlight { background: #e6fac2; }

/* ----- Card-like banners / asides (e.g. resource sidebar) ----- */
.page_sidebar,
.resource_style {
    background: var(--ew-soft-green);
    padding: 24px;
    border-radius: 4px;
    margin: 20px 0;
}
.page_sidebar h2,
.resource_style h2 { color: var(--ew-orange); }

/* ----- Alerts ----- */
.alert {
    border-radius: 4px;
    border: 1px solid transparent;
    padding: 12px 16px;
    margin-bottom: 16px;
}
.alert-success { color: #2c662d; background: #dff0d8; border-color: #d6e9c6; }
.alert-info    { color: #1b6a8a; background: #d9edf7; border-color: #bce8f1; }
.alert-warning { color: #8a6d3b; background: #fcf8e3; border-color: #fbeed5; }
.alert-danger, .alert-error { color: #a94442; background: #f2dede; border-color: #ebccd1; }

/* ----- Misc helpers ----- */
.float-right { float: right; }
.float-left  { float: left; }
.clearfix::after { content: ""; display: table; clear: both; }
.text-right  { text-align: right; }
.hidden, .page_href { display: none; }
.sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0,0,0,0); border: 0;
}

/* ----- Footer ----- */
.site-footer {
    background: var(--ew-green);
    color: #fff;
    max-width: 1100px;
    margin: 30px auto 0;
}
.site-footer a { color: #fff; }
.site-footer a:hover { color: #fff; text-decoration: underline; }

.site-footer .footer-inner {
    display: grid;
    grid-template-columns: 1fr 1.4fr 1fr 1.2fr;
    gap: 30px;
    padding: 30px;
    max-width: 100%;
}
.footer-col { display: flex; flex-direction: column; }
.footer-col .link-header {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 6px;
}
.footer-col .link-header--italic { font-style: italic; font-weight: 500; }
.footer-col .link-node {
    font-size: 14px;
    padding: 2px 0;
    color: #f4ffe0;
}
.footer-col--logos {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
}
.footer-col--logos img {
    max-height: 64px;
    width: auto;
    display: block;
    /* Logos are colored marks designed to sit on the green band directly */
    background: transparent;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,.15));
}

.footer-copyright {
    background: var(--ew-green-dark);
    color: #f4ffe0;
    font-size: 12px;
    padding: 10px 0;
}
.footer-copyright .container { padding: 0 30px; }

@media (max-width: 880px) {
    .site-footer .footer-inner {
        grid-template-columns: 1fr 1fr;
    }
}
@media (max-width: 560px) {
    .site-footer .footer-inner {
        grid-template-columns: 1fr;
    }
    .footer-col--logos { justify-content: flex-start; }
}

/* ----- Print-friendliness for the existing Print button ----- */
@media print {
    .site-header,
    .site-footer,
    .footer-copyright,
    wagtail-userbar,
    .w-userbar,
    .filter-header,
    .filter-column,
    .result-actions,
    .site-survey { display: none !important; }
    main#content { box-shadow: none; max-width: 100%; }
    .block-title { background: #fff !important; color: #000 !important; border-bottom: 2px solid #444; }
    .block-title h1 { color: #000 !important; }
}

/* ----- Bootstrap navbar overrides (in case any legacy fragment renders) ----- */
.navbar-light .navbar-brand,
.navbar-light .nav-link {
    color: #fff;
}
.hide-display { display: none; }

/* ----- Wagtail userbar safe spacing ----- */
wagtail-userbar { position: fixed; }

/* =========================================================================
   StreamField blocks (StandardPage body)
   ========================================================================= */

.block-divider {
    border: 0;
    border-top: 1px solid #e5e5e5;
    margin: 18px 0;
}
.block-heading {
    margin-top: 18px;
    margin-bottom: 12px;
    color: var(--ew-green-dark);
}

.block-one-column { margin: 0 0 22px; }
.block-one-column p:last-child { margin-bottom: 0; }

.block-two-columns { margin: 0 0 22px; }
.block-two-columns > [class*="col-"] { padding: 0 12px; }

.block-white-space { width: 100%; }

/* Accordion (used by FAQ and other Q&A-style pages) */
.block-accordion {
    margin: 0 0 28px;
    border-top: 1px solid #e5e5e5;
}
.block-accordion__item {
    border-bottom: 1px solid #e5e5e5;
    padding: 0;
}
.block-accordion__title {
    list-style: none;
    cursor: pointer;
    padding: 14px 36px 14px 18px;
    font-weight: 600;
    font-size: 16px;
    color: #222;
    position: relative;
    background: #fafafa;
    transition: background .15s ease, color .15s ease;
}
.block-accordion__title::-webkit-details-marker { display: none; }
.block-accordion__title::after {
    content: "+";
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    font-size: 22px;
    font-weight: 400;
    color: var(--ew-green-dark);
    line-height: 1;
    transition: transform .2s ease;
}
.block-accordion__item[open] > .block-accordion__title {
    background: var(--ew-soft-green);
    color: var(--ew-green-dark);
}
.block-accordion__item[open] > .block-accordion__title::after {
    content: "–";
    transform: translateY(-50%);
}
.block-accordion__title:hover {
    background: #f4f4f4;
    color: var(--ew-green-dark);
}
.block-accordion__content {
    padding: 14px 18px 18px;
    background: #fff;
    line-height: 1.55;
}
.block-accordion__content > :last-child { margin-bottom: 0; }

/* Project Tools slideshow (right column of the two_columns block on /econworks/tools/) */
.tools-slideshow {
    background: #fff;
    border: 1px solid #e3e3e3;
    border-radius: 4px;
    padding: 8px 8px 36px;
    margin-bottom: 24px;
    outline: none;
}
.tools-slideshow__slide {
    width: 100%;
    padding: 8px 8px 0;
    box-sizing: border-box;
}
.tools-slideshow__slide img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid #eee;
    border-radius: 3px;
}
.tools-slideshow__caption {
    margin-top: 10px;
    color: var(--ew-text-muted, #555);
    font-size: 0.9rem;
    text-align: center;
    font-style: italic;
}
.tools-slideshow .flickity-page-dots {
    bottom: 8px;
}
.tools-slideshow .flickity-prev-next-button {
    background: rgba(255,255,255,0.85);
}

/* Gallery (welcome-style image grid) */
.block-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin: 0 0 28px;
}
.block-gallery__item {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.block-gallery__media {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    padding: 24px 20px;
    background: #fff;
}
.block-gallery__media img {
    max-width: 100%;
    max-height: 160px;
    width: auto;
    height: auto;
    display: block;
}
.block-gallery__title {
    margin: 14px 16px 6px;
}
.block-gallery__caption {
    margin: 0 16px 14px;
    color: var(--ew-text-muted);
    font-size: 14px;
    flex-grow: 1;
}
.block-gallery__item .btn {
    margin: 0 16px 16px;
    align-self: flex-start;
}
