/* MOBILE ONLY */

html {
    box-sizing: border-box;
    overflow-x: clip;
}

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

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

img,
svg,
video,
iframe,
table {
    max-width: 100%;
}

img,
video {
    height: auto;
}

iframe {
    display: block;
}

.fms-page-container,
.fms-institutional-content,
.fms-single-post-content,
.fms-room-card,
.fms-news-content {
    overflow-wrap: anywhere;
}

.fms-page-container table,
.fms-institutional-content table,
.fms-single-post-content table {
    display: block;
    overflow-x: auto;
    width: 100%;
}


.fms-mobile-header,
.fms-mobile-menu,
.fms-mobile-overlay {
    display: none !important;
}

@media (max-width: 992px) {

    .fms-topbar,
    .fms-branding,
    .fms-main-nav {
        display: none !important;
    }

    .fms-mobile-header {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        background: #16324f;
        padding: 12px 15px;
        color: white;
    }

    .fms-mobile-logo img {
        max-height: 40px;
        width: auto;
    }

    .fms-mobile-title {
        flex: 1;
        text-align: center;
        font-size: 13px;
        font-weight: 600;
        line-height: 1.2;
        margin: 0 10px;
    }

    .fms-mobile-title span {
        display: block;
    }

    .fms-mobile-toggle {
        background: none;
        border: none;
        color: white;
        font-size: 28px;
        cursor: pointer;
    }

    /* IMPORTANT : styles ciblés uniquement DANS le nav mobile */
    nav.fms-mobile-menu {
        display: block !important;
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        max-width: 320px;
        height: 100%;
        background: #16324f;
        padding: 80px 20px 20px;
        transition: right 0.3s ease;
        z-index: 9999;
        overflow-y: auto;
    }

    nav.fms-mobile-menu.active {
        right: 0;
    }

    nav.fms-mobile-menu ul,
    nav.fms-mobile-menu li {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    nav.fms-mobile-menu a {
        display: block;
        color: white;
        padding: 14px 42px 14px 12px;
        text-decoration: none;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }

    nav.fms-mobile-menu .sub-menu {
        background: rgba(255,255,255,0.06);
        display: none;
        margin: 0 0 8px;
    }

    nav.fms-mobile-menu .menu-item-has-children.submenu-open > .sub-menu {
        display: block;
    }

    nav.fms-mobile-menu .menu-item-has-children > a {
        position: relative;
    }

    nav.fms-mobile-menu .menu-item-has-children > a::after {
        border-bottom: 2px solid currentColor;
        border-right: 2px solid currentColor;
        content: '';
        height: 8px;
        position: absolute;
        right: 16px;
        top: 50%;
        transform: translateY(-65%) rotate(45deg);
        transition: transform .2s ease;
        width: 8px;
    }

    nav.fms-mobile-menu .menu-item-has-children.submenu-open > a::after {
        transform: translateY(-35%) rotate(225deg);
    }

    nav.fms-mobile-menu .sub-menu a {
        font-size: 15px;
        font-weight: 500;
        padding-left: 24px;
    }

    nav.fms-mobile-menu .sub-menu .fms-parent-page-link > a {
        font-weight: 700;
    }

    .fms-mobile-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.45);
        z-index: 9998;
        opacity: 0;
        visibility: hidden;
    }

    .fms-mobile-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    body.fms-menu-open {
        overflow: hidden;
    }
}

/* Mobile institutional polish */
@media (max-width: 992px) {
    html {
        -webkit-text-size-adjust: 100%;
    }

    body {
        background: #f7f9fb;
        overflow-x: hidden;
    }

    .fms-mobile-header {
        box-shadow: 0 8px 22px rgba(8, 18, 32, .16);
        min-height: 64px;
        position: sticky;
        top: 0;
        z-index: 9997;
    }

    .admin-bar .fms-mobile-header {
        top: 46px;
    }

    .fms-mobile-logo {
        align-items: center;
        display: flex;
        flex: 0 0 44px;
        justify-content: center;
    }

    .fms-mobile-logo img {
        max-height: 42px;
        max-width: 42px;
        object-fit: contain;
    }

    .fms-mobile-title {
        color: #ffffff;
        font-size: 14px;
        font-weight: 700;
        letter-spacing: 0;
        line-height: 1.25;
        min-width: 0;
    }

    .fms-mobile-actions {
        align-items: center;
        display: flex;
        gap: 8px;
    }

    .fms-mobile-toggle {
        align-items: center;
        background: rgba(255,255,255,.1);
        border: 1px solid rgba(255,255,255,.18);
        border-radius: 0;
        display: inline-flex;
        height: 42px;
        justify-content: center;
        line-height: 1;
        padding: 0;
        width: 42px;
    }

    .fms-mobile-close {
        align-items: center;
        background: rgba(255,255,255,.1);
        border: 1px solid rgba(255,255,255,.22);
        color: #ffffff;
        cursor: pointer;
        display: inline-flex;
        font-size: 28px;
        height: 42px;
        justify-content: center;
        line-height: 1;
        padding: 0;
        position: absolute;
        right: 18px;
        top: 18px;
        width: 42px;
    }

    .fms-mobile-close:focus-visible,
    .fms-mobile-toggle:focus-visible {
        outline: 2px solid rgba(255,255,255,.85);
        outline-offset: 3px;
    }

    nav.fms-mobile-menu {
        background: #102a43;
        box-shadow: -12px 0 34px rgba(8,18,32,.34);
        max-width: 380px;
        padding: 76px 18px 28px;
        width: min(88vw, 380px);
    }

    nav.fms-mobile-menu::before {
        color: #d9e2ec;
        content: 'Navigation';
        font-size: 12px;
        font-weight: 700;
        left: 30px;
        letter-spacing: .12em;
        position: absolute;
        text-transform: uppercase;
        top: 28px;
    }

    nav.fms-mobile-menu .menu {
        border-top: 1px solid rgba(255,255,255,.12);
    }

    nav.fms-mobile-menu li {
        border-bottom: 1px solid rgba(255,255,255,.1);
    }

    nav.fms-mobile-menu a {
        border-bottom: 0;
        color: #ffffff;
        font-size: 15px;
        font-weight: 700;
        line-height: 1.35;
        padding: 15px 8px;
    }

    nav.fms-mobile-menu .menu-item-has-children > a {
        padding-right: 34px;
        position: relative;
    }

    nav.fms-mobile-menu .menu-item-has-children > a::after {
        align-items: center;
        border: 1px solid rgba(255,255,255,.22);
        content: '⌄';
        display: inline-flex;
        font-size: 18px;
        font-weight: 700;
        height: 28px;
        justify-content: center;
        position: absolute;
        right: 4px;
        top: 50%;
        transform: translateY(-50%);
        transition: transform .2s ease, background .2s ease;
        width: 28px;
    }

    nav.fms-mobile-menu .menu-item-has-children.submenu-open > a::after {
        background: rgba(255,255,255,.12);
        transform: translateY(-50%) rotate(180deg);
    }

    nav.fms-mobile-menu .sub-menu {
        background: rgba(255,255,255,.06);
        border-left: 3px solid #d9e2ec;
        display: none;
        margin: 0 0 10px 8px;
        padding: 4px 0 4px 12px;
    }

    nav.fms-mobile-menu .sub-menu li {
        border-bottom: 0;
    }

    nav.fms-mobile-menu .sub-menu a {
        color: #e6edf4;
        font-size: 14px;
        font-weight: 600;
        padding: 10px 8px;
    }

    .fms-mobile-cta {
        display: grid;
        gap: 10px;
        margin-top: 18px;
    }

    nav.fms-mobile-menu .fms-mobile-cta a {
        border: 1px solid rgba(255,255,255,.24);
        padding: 13px 14px;
        text-align: center;
    }

    nav.fms-mobile-menu .fms-mobile-donate {
        background: #ffffff;
        color: #16324f;
    }

    nav.fms-mobile-menu .fms-mobile-contact {
        background: rgba(255,255,255,.08);
        color: #ffffff;
    }

    .fms-language-switcher-mobile {
        border-top: 1px solid rgba(255,255,255,.12);
        justify-content: flex-start;
        margin-top: 12px;
        padding: 16px 8px 8px;
    }

    .fms-language-switcher-mobile .gt_switcher,
    .fms-language-switcher-mobile .gt_switcher .gt_selected a,
    .fms-language-switcher-mobile .gt_switcher .gt_option {
        width: 100% !important;
    }

    .fms-language-switcher-mobile .gt_switcher .gt_selected a {
        box-sizing: border-box !important;
        padding: 10px 12px !important;
    }

    .fms-mobile-overlay {
        backdrop-filter: blur(2px);
        transition: opacity .25s ease, visibility .25s ease;
    }
}

@media (max-width: 760px) {
    .fms-hero,
    .fms-slide,
    .fms-hero-slider {
        min-height: 460px;
    }

    .fms-hero-overlay {
        padding: 58px 20px 68px;
    }

    .fms-hero h1,
    .fms-slide h1,
    .fms-news-archive-hero h1,
    .fms-institutional-hero h1,
    .fms-world-map-hero h1,
    .fms-single-post-header h1 {
        font-size: 2.25rem;
        line-height: 1.08;
    }

    .fms-hero p,
    .fms-slide p,
    .fms-news-archive-hero p,
    .fms-institutional-hero p,
    .fms-world-map-hero p,
    .fms-single-post-header p {
        font-size: 1rem;
        line-height: 1.7;
    }

    .fms-hero-btn,
    .fms-world-map-caption a,
    .fms-news-section-heading > a {
        align-items: center;
        display: inline-flex;
        justify-content: center;
        min-height: 44px;
        padding: 12px 16px;
    }

    .fms-slider-nav {
        height: 38px;
        width: 38px;
    }

    .fms-slider-prev {
        left: 12px;
    }

    .fms-slider-next {
        right: 12px;
    }

    .fms-institutional-section,
    .fms-message-section,
    .fms-foundress-section,
    .fms-news-section,
    .fms-world-section,
    .fms-vocation-section {
        padding: 52px 18px;
    }

    .fms-message-container,
    .fms-foundress-container {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 26px 22px;
        text-align: left;
    }

    .fms-foundress-photo {
        order: -1;
    }

    .fms-message-photo img {
        height: 132px;
        width: 132px;
    }

    .fms-message-content h2,
    .fms-foundress-content h2,
    .fms-news-section h2 {
        font-size: 1.72rem;
    }

    .fms-news-section-heading,
    .fms-news-archive-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 14px;
    }

    .fms-news-section-heading > a,
    .fms-news-archive-heading a {
        white-space: normal;
    }

    .fms-news-content,
    .fms-news-archive-card-content {
        padding: 22px;
    }

    .fms-news-image,
    .fms-news-image img {
        max-height: none;
        min-height: 190px;
    }

    .fms-institutional-content,
    .fms-single-post-content {
        border-left: 0;
        border-right: 0;
        margin-left: -18px;
        margin-right: -18px;
    }

    .fms-institutional-content blockquote,
    .fms-single-post-content blockquote {
        font-size: 1.25rem;
        padding: 22px;
    }

    .fms-world-map-frame {
        box-shadow: 0 14px 30px rgba(16,42,67,.12);
    }

    .fms-world-map-links a {
        flex: 1 1 100%;
        text-align: center;
    }

    .fms-footer {
        margin-top: 52px;
    }

    .fms-footer-cta {
        padding: 28px 20px;
    }

    .fms-footer-bottom {
        gap: 8px;
        padding: 18px 20px;
    }
}

@media (max-width: 420px) {
    .fms-mobile-title {
        font-size: 12px;
    }

    .fms-mobile-logo.left {
        display: none;
    }

    .fms-mobile-actions .fms-mobile-logo.right {
        display: none;
    }

    .fms-mobile-header {
        padding: 11px 14px;
    }
}


@media (max-width: 992px) {
    .fms-mobile-header,
    .fms-mobile-menu {
        max-width: 100vw;
    }

    nav.fms-mobile-menu {
        left: auto;
        right: 0 !important;
        transform: translateX(100%);
        transition: transform .28s ease;
        will-change: transform;
    }

    nav.fms-mobile-menu.active {
        transform: translateX(0);
    }

    .fms-mobile-menu .menu,
    .fms-mobile-menu .sub-menu,
    .fms-language-switcher-mobile,
    .fms-mobile-cta {
        min-width: 0;
        max-width: 100%;
    }

    .fms-mobile-menu a,
    .fms-mobile-cta a {
        overflow-wrap: anywhere;
    }

    .wp-block-group,
    .wp-block-columns,
    .wp-block-cover,
    .wp-block-media-text,
    .wp-block-image,
    .wp-block-table,
    .fms-page-content,
    .fms-institutional-body,
    .fms-room-page,
    .fms-news-section,
    .fms-world-section {
        max-width: 100%;
    }

    .wp-block-columns,
    .wp-block-media-text {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 760px) {
    .fms-page-hero h1 {
        font-size: clamp(2rem, 12vw, 2.65rem);
        letter-spacing: 0;
    }

    .fms-page-hero-overlay,
    .fms-message-container,
    .fms-foundress-container,
    .fms-institutional-content,
    .fms-president-letter-sheet {
        max-width: 100%;
    }
}
