/* ============================================================
   UDM v2 Layout Shell  ·  udm-layout.css
   Utility bar, sticky header + mega menu, mobile drawer,
   holiday ribbon, footer and mobile action bar.
   Depends on tokens in udm-design.css.
   ============================================================ */

/* ============================================================
   Scroll progress bar (top of viewport)
   ============================================================ */
.udm-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 70;
    background: linear-gradient(90deg, var(--udm-primary), var(--udm-accent));
    transform: scaleX(0);
    transform-origin: 0 50%;
    transition: transform .08s linear;
    pointer-events: none;
}

/* ============================================================
   Urgent announcement banner (site-wide)
   ============================================================ */
.udm-alert {
    position: relative;
    z-index: 61;
    background: linear-gradient(90deg, var(--udm-primary), var(--udm-primary-dark));
    color: var(--udm-white);
}

.udm-alert__row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 0;
    flex-wrap: wrap;
    font-size: 14.5px;
}

.udm-alert__badge {
    flex: none;
    background: rgba(255, 255, 255, .22);
    padding: 3px 11px;
    border-radius: var(--udm-radius-pill);
    font-weight: 800;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.udm-alert__text {
    flex: 1;
    min-width: 200px;
}

.udm-alert__body {
    opacity: .9;
}

.udm-alert a.udm-alert__cta {
    color: var(--udm-white);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
    white-space: nowrap;
}

.udm-alert__close {
    flex: none;
    background: none;
    border: 0;
    color: var(--udm-white);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    opacity: .85;
    padding: 0 4px;
}

.udm-alert__close:hover {
    opacity: 1;
}

/* ============================================================
   Holiday ribbon  (populated by the seasonal theme engine)
   ============================================================ */
.udm-ribbon {
    background: var(--udm-ribbon-bg);
    color: var(--udm-ribbon-ink);
    position: relative;
    z-index: 60;
}

.udm-ribbon__row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 10px 0;
    flex-wrap: wrap;
    text-align: center;
    font-size: 15px;
}

.udm-ribbon .udm-ribbon__cta {
    color: var(--udm-ribbon-ink);
    font-weight: 600;
    text-underline-offset: 3px;
}

/* ============================================================
   Utility bar
   ============================================================ */
.udm-utility {
    background: var(--udm-night);
    color: rgba(255, 255, 255, .78);
    font-size: 13px;
    position: relative;
    z-index: 55;
}

.udm-utility a {
    color: inherit;
    text-decoration: none;
}

.udm-utility a:hover {
    color: var(--udm-accent);
}

.udm-utility__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    height: 40px;
}

.udm-utility__left {
    display: flex;
    gap: 22px;
    align-items: center;
    overflow: hidden;
    white-space: nowrap;
}

.udm-utility__right {
    display: flex;
    gap: 18px;
    align-items: center;
}

/* EN / SW language switch */
.udm-lang {
    display: flex;
    gap: 2px;
}

.udm-lang button {
    border: 0;
    padding: 4px 9px;
    border-radius: var(--udm-radius-pill);
    font-size: 12px;
    font-weight: 700;
    background: transparent;
    color: rgba(255, 255, 255, .7);
}

.udm-lang button[aria-pressed="true"] {
    background: var(--udm-white);
    color: var(--udm-ink);
}

/* ============================================================
   Header + mega menu
   Base header is solid (works on every interior page).
   .udm-hdr--overlay makes it transparent over a dark hero and
   flips to solid on scroll (.is-solid), hover or focus-within.
   ============================================================ */
.udm-hdr {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--udm-white);
    color: var(--udm-ink);
    box-shadow: var(--udm-shadow-sm);
    transition: background .35s ease, color .35s ease, box-shadow .35s ease;
}

.udm-hdr--overlay {
    background: transparent;
    color: var(--udm-white);
    box-shadow: none;
}

.udm-hdr--overlay.is-solid,
.udm-hdr--overlay:hover,
.udm-hdr--overlay:focus-within {
    background: var(--udm-white);
    color: var(--udm-ink);
    box-shadow: var(--udm-shadow-sm);
}

.udm-hrow {
    display: flex;
    align-items: center;
    gap: 28px;
    height: var(--udm-header-h);
}

.udm-hdr .udm-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-right: 22px;
    text-decoration: none;
    color: inherit;
}

.udm-brand img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    background: #fff;
    border-radius: 50%;
    padding: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
    border: 1px solid rgba(0, 0, 0, .06);
}

.udm-brand__name {
    font-family: 'Archivo', sans-serif;
    font-stretch: 112%;
    font-weight: 800;
    font-size: 15.5px;
    line-height: 1.12;
    letter-spacing: -.01em;
    white-space: nowrap;
}
/* three-word wordmark, theme colours (red · black · gold) */
.udm-brand__name .udm-brand__w1 { color: var(--udm-primary); }
.udm-brand__name .udm-brand__w2 { color: #1b1b1b; }
/* "Movement" drops to its own line → a two-line lockup: "United Democratic" / "Movement".
   This also narrows the wordmark so it no longer crowds the first menu item. */
.udm-brand__name .udm-brand__w3 { color: #c0900a; display: block; }
/* over the dark hero (transparent, not yet solid) keep it white */
.udm-hdr--overlay:not(.is-solid):not(:hover):not(:focus-within) .udm-brand__name span { color: #fff; }

/* keep header CTAs on one line */
.udm-hcta .udm-btn { white-space: nowrap; flex-shrink: 0; }

.udm-menu {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

/* .udm-hdr prefix keeps these above the base `.udm-v2 a` link colour. */
.udm-hdr .udm-mlink {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 11px;
    border: 0;
    background: none;
    font-size: 15px;
    font-weight: 600;
    color: inherit;
    text-decoration: none;
    border-radius: var(--udm-radius-pill);
    cursor: pointer;
}

.udm-mlink:hover {
    color: inherit;
    background: rgba(127, 127, 127, .12);
}

.udm-mlink svg {
    transition: transform .25s ease;
}

/* Mega-menu container: positioned relative to the sticky header */
.udm-mi {
    position: static;
}

.udm-mega {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: var(--udm-white);
    color: var(--udm-ink);
    border-top: 1px solid #EFEAE8;
    box-shadow: 0 30px 60px rgba(30, 20, 20, .14);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity .25s ease, transform .25s ease, visibility .25s;
}

.udm-mi:hover .udm-mega,
.udm-mi:focus-within .udm-mega {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.udm-mi:hover .udm-mlink svg,
.udm-mi:focus-within .udm-mlink svg {
    transform: rotate(180deg);
}

.udm-megain {
    display: grid;
    grid-template-columns: minmax(0, 4fr) minmax(0, 5fr) minmax(0, 3fr);
    gap: 48px;
    padding: 40px 0 44px;
}

.udm-mega__intro .udm-x {
    font-size: 40px;
}

.udm-mega__blurb {
    font-size: 16px;
    line-height: 1.55;
    color: var(--udm-muted);
    margin: 14px 0 0;
    max-width: 340px;
}

.udm-mega__links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 28px;
    align-content: start;
}

.udm-mega .udm-ml {
    display: block;
    padding: 12px 14px;
    margin: 0 -14px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--udm-ink);
}

.udm-mega .udm-ml:hover {
    background: var(--udm-surface);
    color: var(--udm-ink);
}

.udm-ml strong {
    display: block;
    font-size: 17px;
}

.udm-ml span {
    display: block;
    font-size: 14px;
    color: var(--udm-muted);
    margin-top: 2px;
}

.udm-mega__promo {
    position: relative;
    display: block;
    border-radius: 16px;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    text-decoration: none;
    background: var(--udm-night);
}

.udm-mega__promo img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.udm-mega__promo .udm-mega__scrim {
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(30, 8, 10, .9), rgba(30, 8, 10, 0) 65%);
}

.udm-mega__promo .udm-mega__cap {
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: 18px;
    color: var(--udm-white);
}

.udm-mega__promo .udm-mega__cap small {
    display: block;
    font-size: 14px;
    color: var(--udm-accent-soft);
    margin-top: 4px;
    font-weight: 600;
}

.udm-hcta {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ============================================================
   Party flag (animated, transparent WebP)  ·  header, footer & home
   ============================================================ */
.udm-flag {
    display: inline-block;
    height: auto;
    vertical-align: middle;
    filter: drop-shadow(0 8px 18px rgba(0, 0, 0, .3));
}

.udm-flag--sm { width: 64px; }
.udm-flag--md { width: 164px; }
.udm-flag--lg { width: 290px; }

/* header: keep the little flag tidy next to the CTAs */
.udm-hcta .udm-flag { align-self: center; }

/* footer: a standout flag in the brand column */
.udm-foot__flag { display: block; margin: 20px 0 2px; }
.udm-foot__flag.udm-flag { filter: drop-shadow(0 14px 30px rgba(0, 0, 0, .55)); }

/* Kenyan national flag (animated gif, transparent bg) — shown alongside the UDM flag */
.udm-kflag {
    display: inline-block;
    height: auto;
    vertical-align: middle;
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .3));
}
.udm-kflag--xs { width: 34px; }   /* utility bar */
.udm-kflag--sm { width: 54px; }   /* header, beside the UDM flag */
.udm-kflag--md { width: 120px; }  /* footer, beside the UDM flag */
.udm-utility__left .udm-kflag { filter: drop-shadow(0 2px 5px rgba(0, 0, 0, .22)); margin-right: 2px; }

/* header: Kenyan flag sits far-left, just before the logo */
.udm-hkflag { margin-right: -12px; flex: 0 0 auto; }

/* footer: Kenyan flag on the right side (Resources column) */
.udm-foot__kflag { display: block; margin-top: 24px; }

/* Hamburger (mobile) */
.udm-burger {
    display: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid currentColor;
    background: none;
    align-items: center;
    justify-content: center;
    margin-left: auto;
}

/* ============================================================
   Desktop header spacing (≥1281px): the full nav — Kenya flag +
   logo + 3-word wordmark + 9 items + Donate + Join + UDM flag —
   is wider than the 1320px wrap, so tighten gaps/padding a touch
   (without shrinking the logo or flags) so it always fits and
   never clips Join / the flag on the right.
   ============================================================ */
@media (min-width: 1281px) {
    .udm-hrow { gap: 16px; }
    .udm-hdr .udm-brand { margin-right: 14px; }
    .udm-menu { gap: 2px; }
    .udm-hdr .udm-mlink { padding: 10px 8px; font-size: 14.3px; }
    .udm-hcta { gap: 8px; }
}

/* ============================================================
   Responsive: collapse menu into a drawer
   (raised to 1280px — the full nav needs more room than 1080px,
   so it was overflowing on laptops between ~1080 and ~1300px)
   ============================================================ */
@media (max-width: 1280px) {
    .udm-menu,
    .udm-hcta {
        display: none;
    }

    .udm-burger {
        display: inline-flex;
        flex: 0 0 auto;   /* never let it shrink → stays a perfect circle, not an oval */
    }

    .udm-utility__left {
        gap: 14px;
    }
}

/* ── Mobile / small-tablet header: keep everything on one row without overflowing
   (the overflow was pushing the hamburger off-screen and causing horizontal scroll
   that cut off the hero). Drop the Kenya flag, shrink the logo, let the wordmark wrap. ── */
@media (max-width: 768px) {
    .udm-hkflag { display: none; }
    .udm-hdr .udm-brand { margin-right: 0; min-width: 0; }
    .udm-brand img { width: 46px; height: 46px; }
    .udm-brand__name {
        font-size: 13.5px;
        line-height: 1.12;
    }
    .udm-burger { width: 44px; height: 44px; }
}

@media (max-width: 420px) {
    .udm-brand__name { font-size: 12.5px; }
    .udm-brand img { width: 42px; height: 42px; }
}

@media (max-width: 640px) {
    .udm-utility__row {
        font-size: 12px;
    }

    /* Compact the announcement banner — it was eating the whole top of the phone screen. */
    .udm-alert__row { font-size: 12.5px; gap: 6px 10px; padding: 7px 0; }
    .udm-alert__badge { font-size: 10px; padding: 2px 8px; }
    .udm-alert__text {
        min-width: 0;
        display: -webkit-box;
        -webkit-line-clamp: 2;          /* trim long body text; full details via the link */
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .udm-alert__close { font-size: 20px; }
}

/* ============================================================
   Mobile drawer
   ============================================================ */
.udm-drawer {
    position: fixed;
    inset: 0;
    z-index: 90;
    visibility: hidden;
    pointer-events: none;
}

.udm-drawer.is-open {
    visibility: visible;
    pointer-events: auto;
}

.udm-drawer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 6, 8, .5);
    opacity: 0;
    transition: opacity .3s ease;
}

.udm-drawer.is-open .udm-drawer__backdrop {
    opacity: 1;
}

/* Container-scoped link colour keeps drawer links off the base red. */
.udm-drawer a {
    color: var(--udm-ink);
}

.udm-drawer__panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(380px, 88vw);
    background: var(--udm-white);
    color: var(--udm-ink);
    overflow-y: auto;
    padding: 20px 22px 40px;
    transform: translateX(100%);
    transition: transform .35s var(--udm-ease);
    box-shadow: -20px 0 60px rgba(30, 8, 10, .25);
}

.udm-drawer.is-open .udm-drawer__panel {
    transform: none;
}

.udm-drawer__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.udm-drawer__head .udm-brand {
    color: var(--udm-ink);
    text-decoration: none;
}

.udm-drawer__group {
    padding: 16px 0;
    border-bottom: 1px solid var(--udm-border);
}

.udm-drawer__title {
    font-size: 22px;
    margin-bottom: 6px;
}

.udm-drawer__link {
    display: block;
    padding: 9px 0;
    font-size: 17px;
    color: var(--udm-ink);
    text-decoration: none;
}

.udm-drawer__link--top {
    font-weight: 700;
    padding-top: 0;
}

.udm-drawer__cta {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 20px;
}

/* Dark circle button (e.g. drawer close on white) */
.udm-circ--dark {
    border-color: var(--udm-border-strong);
    color: var(--udm-ink);
    background: none;
}

.udm-circ--dark:hover {
    background: var(--udm-surface);
}

/* Lock scroll behind the open drawer */
body.udm-no-scroll {
    overflow: hidden;
}

/* ============================================================
   Sticky mobile action bar
   ============================================================ */
.udm-mbar {
    display: none;
    position: sticky;
    bottom: 0;
    z-index: 60;
    gap: 8px;
    padding: 10px;
    background: var(--udm-white);
    box-shadow: 0 -8px 24px rgba(30, 8, 10, .12);
}

.udm-mbar .udm-btn {
    flex: 1;
    padding: 14px 6px;
    font-size: 15px;
}

@media (max-width: 640px) {
    .udm-mbar {
        display: flex;
    }
}

/* ============================================================
   Footer  (.udm-foot — new names avoid the legacy .udm-footer
   rules still living in the layout's inline <style> block)
   ============================================================ */
.udm-foot {
    background: var(--udm-night);
    color: rgba(255, 255, 255, .72);
    padding: 96px 0 36px;
    font-size: 15px;
}

.udm-foot a {
    color: inherit;
    text-decoration: none;
}

.udm-foot a:hover {
    color: var(--udm-white);
}

.udm-foot__top {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 32px;
    flex-wrap: wrap;
    padding-bottom: 56px;
    margin-bottom: 56px;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.udm-foot__word {
    font-size: clamp(44px, 7vw, 88px);
    color: var(--udm-white);
}

.udm-foot__nl {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.udm-foot__nlinput {
    min-width: 280px;
    color: var(--udm-ink);
}

.udm-foot__nlmsg {
    min-height: 1.1em;
    margin-top: 10px;
    font-size: 14px;
}

.udm-foot__grid {
    display: grid;
    grid-template-columns: minmax(0, 4fr) repeat(4, minmax(0, 2fr));
    gap: 40px;
}

.udm-foot__logo {
    width: 104px;
    height: auto;
    object-fit: contain;
    /* No white disc/ring — show the emblem cleanly on the dark footer (as in the hero),
       just a soft shadow for depth. */
    filter: drop-shadow(0 6px 16px rgba(0, 0, 0, .45));
}

.udm-foot__brand p {
    line-height: 1.6;
    margin: 18px 0 0;
    max-width: 320px;
}

.udm-foot__contact {
    line-height: 1.8;
}

.udm-foot__coltitle {
    color: var(--udm-white);
    font-weight: 700;
    margin-bottom: 16px;
}

.udm-foot__links {
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.udm-foot__bottom {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 64px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, .12);
    font-size: 14px;
}

.udm-foot__social {
    display: flex;
    gap: 20px;
}

@media (max-width: 1080px) {
    .udm-foot {
        padding-top: 72px;
    }

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

    .udm-foot__brand {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    .udm-foot__nlinput {
        min-width: 0;
        flex: 1;
    }
}
