/* =========================================================
   BUNGE LA MWANANCHI
   GLOBAL RESPONSIVE HARDENING
   Loaded after the main stylesheet.
   ========================================================= */


/* ---------------------------------------------------------
   GLOBAL BOX MODEL / OVERFLOW PROTECTION
   --------------------------------------------------------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
}

body {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
}

main,
header,
footer,
section,
article,
aside,
nav {
    max-width: 100%;
}

.container {
    max-width: 100%;
}

[class*="grid"] > *,
[class*="Grid"] > * {
    min-width: 0;
}


/* ---------------------------------------------------------
   MEDIA
   --------------------------------------------------------- */

img,
picture,
video,
canvas,
iframe {
    max-width: 100%;
}

img,
picture,
video,
canvas {
    height: auto;
}

iframe {
    width: 100%;
}

svg {
    max-width: 100%;
}


/* ---------------------------------------------------------
   TEXT OVERFLOW
   --------------------------------------------------------- */

h1,
h2,
h3,
h4,
h5,
h6,
p,
li,
a,
strong {
    max-width: 100%;
    overflow-wrap: break-word;
}

pre {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

code {
    overflow-wrap: anywhere;
}


/* ---------------------------------------------------------
   FORMS
   --------------------------------------------------------- */

input,
select,
textarea,
button {
    max-width: 100%;
    font: inherit;
}

input,
textarea,
select {
    min-width: 0;
}


/* ---------------------------------------------------------
   TABLES
   --------------------------------------------------------- */

main table {
    max-width: 100%;
}


/* ---------------------------------------------------------
   CHAPTER SEARCH BUTTON
   Keeps the original green results box design.
   --------------------------------------------------------- */

.chapters-search-submit {
    width: 100%;
    margin: 0;
    border: 0;
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.chapters-search-submit:hover {
    filter: brightness(1.08);
}

.chapters-search-submit:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 4px;
}

.chapters-search-submit-main {
    display: block;
    font-size: 22px;
    font-weight: 950;
    line-height: 1;
    text-transform: uppercase;
}

.chapters-filter-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 24px 0 0;
    font-size: 14px;
    font-weight: 800;
}

.chapters-filter-status strong {
    color: var(--green);
}

.chapters-filter-status a {
    margin-left: auto;
    color: var(--green);
    font-size: 12px;
    font-weight: 950;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}


/* ---------------------------------------------------------
   FLEX CONTENT SHOULD WRAP INSTEAD OF OVERFLOW
   --------------------------------------------------------- */

.hero-actions,
.cta-actions,
.footer-callout-actions,
.chapter-card-footer,
.newsroom-contact,
.dispatch-meta,
.post-meta,
.social-links {
    flex-wrap: wrap;
}


/* ---------------------------------------------------------
   LARGE TABLET / SMALL LAPTOP
   --------------------------------------------------------- */

@media (max-width: 1050px) {

    .chapters-directory-header,
    .hero-grid,
    .intro-grid,
    .why-grid,
    .cta-grid,
    .subscribe-grid,
    .page-hero-grid,
    .about-intro-grid,
    .about-story-grid,
    .tradition-grid,
    .sessions-grid,
    .news-intro-grid,
    .featured-update-grid,
    .newsroom-grid,
    .dispatch-hero-grid,
    .dispatch-intro-grid,
    .featured-dispatch-grid,
    .events-blogs-grid,
    .activity-strip-grid,
    .post-hero-grid,
    .post-body-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .chapters-directory-header {
        gap: 28px;
    }
}


/* ---------------------------------------------------------
   TABLET
   --------------------------------------------------------- */

@media (max-width: 900px) {

    .chapters-search-panel {
        grid-template-columns: minmax(0, 1fr);
        gap: 18px;
    }

    .chapters-search-field,
    .chapters-region-field,
    .chapters-results-summary {
        width: 100%;
        min-width: 0;
    }

    .chapters-results-summary {
        min-height: 72px;
    }

    .chapters-grid {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );
    }

    .org-tree-row__members {
        grid-template-columns:
            repeat(
                auto-fit,
                minmax(
                    min(100%, 220px),
                    1fr
                )
            );
    }
}


/* ---------------------------------------------------------
   MOBILE
   --------------------------------------------------------- */

@media (max-width: 760px) {

    .container {
        width: calc(100% - 32px);
        margin-left: auto;
        margin-right: auto;
    }

    .chapters-grid,
    .office-grid,
    .functions-grid,
    .news-category-grid,
    .dispatch-category-grid,
    .dispatch-list-grid,
    .update-meta-grid,
    .session-info {
        grid-template-columns: minmax(0, 1fr);
    }

    .chapters-directory-header {
        grid-template-columns: minmax(0, 1fr);
    }

    .chapters-directory-header h2 {
        max-width: 100%;
    }

    .chapters-search-panel {
        padding-left: 22px;
        padding-right: 22px;
    }

    .chapters-search-control,
    .chapters-select-control {
        width: 100%;
        min-width: 0;
    }

    .chapters-search-control input,
    .chapters-select-control select {
        width: 100%;
        min-width: 0;
    }

    .chapters-filter-status {
        align-items: flex-start;
        flex-direction: column;
    }

    .chapters-filter-status a {
        margin-left: 0;
    }

    .chapter-card-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .hero-actions,
    .cta-actions,
    .footer-callout-actions {
        width: 100%;
    }

    .hero-actions .btn,
    .cta-actions .btn,
    .footer-callout-actions .btn {
        width: 100%;
        max-width: 100%;
        justify-content: center;
        text-align: center;
    }

    main table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .post-image-section img {
        width: 100%;
        height: auto;
    }

    .about-closing-box {
        padding: 28px;
    }
}


/* ---------------------------------------------------------
   SMALL MOBILE
   --------------------------------------------------------- */

@media (max-width: 520px) {

    .container {
        width: calc(100% - 24px);
    }

    .chapters-search-panel {
        padding: 18px;
    }

    .chapters-search-submit {
        min-height: 68px;
    }

    .chapters-search-submit-main {
        font-size: 19px;
    }

    .chapter-card,
    .function-card,
    .office-card,
    .about-closing-box {
        max-width: 100%;
    }

    .chapters-search-control input {
        padding-right: 66px;
    }

    .social-links {
        grid-template-columns: minmax(0, 1fr);
    }
}


/* ---------------------------------------------------------
   VERY SMALL SCREENS
   --------------------------------------------------------- */

@media (max-width: 360px) {

    .container {
        width: calc(100% - 20px);
    }

    .chapters-search-panel {
        padding: 14px;
    }

    .btn {
        white-space: normal;
    }
}

/* =========================================================
   HOME HERO — KEEP "MWANANCHI" AS ONE COMPLETE WORD
   ========================================================= */

/*
 * The home template already places Mwananchi inside its
 * own span. Keep it on its own line and never split the word.
 */
.hero h1 span {
    display: block;
    width: max-content;
    max-width: 100%;

    white-space: nowrap;
    word-break: keep-all;
    overflow-wrap: normal;
    hyphens: none;

    /*
     * Slightly smaller than "BUNGE LA" so the complete
     * word fits comfortably inside the left hero column.
     */
    font-size: 0.88em;
    letter-spacing: -0.07em;
}


/* Tablet */
@media (max-width: 1050px) {
    .hero h1 span {
        width: fit-content;
        max-width: 100%;
        font-size: 0.9em;
    }
}


/* Mobile */
@media (max-width: 620px) {
    .hero h1 {
        font-size: clamp(52px, 16vw, 82px);
    }

    .hero h1 span {
        font-size: 0.82em;
        letter-spacing: -0.06em;
    }
}


/* Very small phones */
@media (max-width: 380px) {
    .hero h1 {
        font-size: clamp(46px, 15vw, 64px);
    }

    .hero h1 span {
        font-size: 0.8em;
    }
}
