/**
 * MOVIXIT Theme v6.9.3 — High Performance Mobile Layer
 * Mobile-first layout stability, touch ergonomics and low-cost rendering.
 */
:root{
  --mx-mobile-gutter:clamp(14px,4vw,24px);
  --mx-mobile-section:clamp(42px,9vw,72px);
  --mx-mobile-radius:14px;
  --mx-touch:44px;
}

/* Prevent horizontal layout leaks without creating a scroll container. */
html{overflow-x:clip;scroll-behavior:smooth;-webkit-text-size-adjust:100%;text-size-adjust:100%;}
body{min-width:0;width:100%;overflow-x:clip;overscroll-behavior-x:none;}
#page,.site,.site-content,main,header,footer,section,article,.entry-content{min-width:0;max-width:100%;}

/* Flex/grid children must be allowed to shrink on narrow screens. */
:is(.container,.movixit-container,.mvm-inner,.mvm-wrap,.header-main-content,.row,.wp-block-group,.wp-block-columns,.wp-block-column,.grid,.flex,[class*="grid-"]) > *{min-width:0;}

img,svg,video,canvas,iframe{max-inline-size:100%;}
img{display:block;}
iframe{border:0;}

@media (max-width:1024px){
  :where(.container,.movixit-container,.wrapper,.header-wrapper,.footer-wrapper,.content-wrapper){
    width:calc(100% - (2 * var(--mx-mobile-gutter)));
    max-width:100%;
    margin-inline:auto;
  }

  /* Keep content visually separated without oversized desktop spacing. */
  :where(.movixit-front-page section,.site-content section){
    padding-block:clamp(38px,7vw,64px);
  }

  /* Safe responsive grids used throughout the theme. */
  :where(.features-grid,.services-grid,.courses-grid,.stats-grid,.footer-grid,.movixit-plan-grid-v5,.mgm-grid){
    min-width:0;
  }
}

@media (max-width:767px){
  /* Typography scales smoothly instead of jumping between breakpoints. */
  body{font-size:clamp(15px,3.9vw,16px);line-height:1.58;}
  h1{font-size:clamp(1.8rem,8.5vw,2.65rem);line-height:1.08;letter-spacing:-.02em;}
  h2{font-size:clamp(1.45rem,7vw,2.05rem);line-height:1.16;}
  h3{font-size:clamp(1.18rem,5.6vw,1.55rem);line-height:1.22;}
  h4{font-size:clamp(1.05rem,4.8vw,1.25rem);}
  p,li,td,th{overflow-wrap:anywhere;}

  /* Eliminate common mobile overflow sources. */
  :where(.wp-block-columns,.mega-menu-row,.mega-menu-container,.banner-content,.header-main-content){
    max-width:100%;
  }
  .wp-block-columns{flex-wrap:wrap!important;}
  .wp-block-column{flex-basis:100%!important;max-width:100%;}
  .wp-block-media-text{grid-template-columns:1fr!important;}
  .wp-block-media-text__media,.wp-block-media-text__content{min-width:0;}

  /* Mobile grids collapse before cards become cramped. */
  :where(.features-grid,.services-grid,.courses-grid,.footer-grid,.movixit-plan-grid-v5,.mgm-grid,[class*="grid-cols-"]){
    grid-template-columns:1fr!important;
    gap:clamp(14px,4vw,20px)!important;
  }
  .stats-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:14px!important;}

  /* Cards: no fixed desktop width, lighter paint cost and stable height. */
  :where(.feature-card,.service-card,.course-card,.movixit-plan-card-v5,.mgm-card,.mgm-gmi-card,.mgm-step-card,.mgm-testimonial-card){
    width:100%;max-width:100%;min-width:0;
    border-radius:var(--mx-mobile-radius);
  }

  /* Full-width CTAs are easier to use with one hand. */
  :where(.movixit-btn--full,.movixit-v5-btn,.mvx-hero-button,.cta-button,.header-cta,.mvm-cta){
    min-height:var(--mx-touch);
  }
  :where(.movixit-btn--full,.movixit-v5-btn--gold,.movixit-v5-btn--outline){
    width:100%;
  }
  :where(.wp-block-buttons,.banner-buttons){
    display:flex;flex-direction:column;align-items:stretch;gap:10px;
  }
  :where(.wp-block-button,.wp-block-button__link){width:100%;max-width:100%;}
  .wp-block-button__link{white-space:normal;overflow-wrap:anywhere;}

  /* Forms: 16px prevents iOS focus zoom; controls remain touch sized. */
  :where(input:not([type="checkbox"]):not([type="radio"]),select,textarea){
    min-height:var(--mx-touch);
    max-width:100%;
    font-size:16px!important;
  }
  :where(button,input[type="submit"],input[type="button"],.button,.btn,.movixit-btn){
    min-height:var(--mx-touch);
    max-width:100%;
  }
  :where(input,select,textarea){box-sizing:border-box;}

  /* Header: keep the official logo readable without pushing actions off-screen. */
  .mvm-inner{width:calc(100% - 24px);min-height:64px;padding-block:8px;gap:8px;}
  .mvm-brand{min-width:0;max-width:calc(100% - 52px);}
  .mvm-brand-picture{display:block;max-width:min(205px,70vw);min-width:0;}
  .mvm-custom-logo.movixit-official-wordmark{width:min(205px,70vw);max-width:100%;height:auto;max-height:48px;object-fit:contain;}
  .mvm-mobile-trigger{width:44px;height:44px;min-width:44px;padding:0;margin-left:auto;}

  /* Drawer uses the dynamic viewport so browser chrome does not clip it. */
  .mvm-mobile-drawer{position:fixed;inset:0;min-height:100dvh;height:100dvh;}
  .mvm-mobile-panel{width:min(92vw,390px);max-width:100%;height:100dvh;max-height:100dvh;padding-bottom:calc(18px + env(safe-area-inset-bottom));}
  .mvm-mobile-menu > li > a{min-height:48px;display:flex;align-items:center;}
  .mvm-mobile-auth-link{min-height:44px;}

  /* Hero remains compact on phones; prevents huge above-the-fold paint. */
  :where(.mvx-hero[data-hero-height],.mvx-hero-section[data-hero-height],.mvx-home-hero[data-hero-height],.mvx-home-slider[data-hero-height],.mvx-slider[data-hero-height],.mvx-slider-section[data-hero-height],.movixit-hero[data-hero-height],.movixit-home-hero[data-hero-height],.movixit-slider[data-hero-height],.homepage-hero[data-hero-height],.homepage-slider[data-hero-height]){
    min-height:0;
  }
  .mvm-header-hero-slider{max-width:100%;overflow:clip;}

  /* Tables scroll horizontally inside themselves rather than breaking the page. */
  :where(.table-responsive,.movixit-table-wrap,.wp-block-table,.wp-block-table table,.entry-content table){max-width:100%;}
  :where(.table-responsive,.movixit-table-wrap,.wp-block-table){overflow-x:auto;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch;}
  :where(.table-responsive table,.movixit-table-wrap table,.wp-block-table table){min-width:620px;}

  /* Long/secondary content can be rendered just before it enters the viewport. */
  :where(.feature-card,.service-card,.course-card,.movixit-plan-card-v5,.mgm-card,.mgm-gmi-card,.mgm-step-card,.mgm-testimonial-card,.mvx-travel-service-card){
    content-visibility:auto;
    contain-intrinsic-size:1px 220px;
  }

  /* Avoid expensive hover transforms on touch devices. */
  :where(.feature-card,.service-card,.course-card,.movixit-plan-card-v5,.mgm-card):hover{transform:none;}

  /* Respect notches and home indicators. */
  .site-footer{padding-bottom:calc(24px + env(safe-area-inset-bottom));}
}

@media (max-width:380px){
  :root{--mx-mobile-gutter:12px;}
  .mvm-inner{width:calc(100% - 20px);}
  .mvm-custom-logo.movixit-official-wordmark{width:min(180px,67vw);}
  .stats-grid{grid-template-columns:1fr!important;}
}

@media (min-width:768px) and (max-width:1024px){
  :where(.features-grid,.services-grid,.courses-grid,.footer-grid,.movixit-plan-grid-v5){grid-template-columns:repeat(2,minmax(0,1fr));}
  .stats-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
}

@media (prefers-reduced-motion:reduce){
  html{scroll-behavior:auto;}
}


/* ============================================================
 * MOVIXIT v6.9.3 — Mobile Performance Hardening
 * Final cascade: resolves competing legacy breakpoints and makes the
 * mobile experience resilient across 320px phones, notched devices,
 * browser chrome changes and landscape orientation.
 * ============================================================ */
:root{
  --mx-vh:100vh;
  --mx-header-height:68px;
}
@supports (height:100svh){
  .mvm-mobile-drawer{min-height:100svh;}
}
html{scroll-padding-top:var(--mx-header-height);}
body{min-width:0;overscroll-behavior-x:none;}

@media (max-width:767px){
  .site-header,.mvm-header,.mvm-inner{min-width:0;max-width:100%;}
  .mvm-inner{padding-inline:max(12px,env(safe-area-inset-left)) max(12px,env(safe-area-inset-right));}
  .mvm-brand{flex:1 1 auto;overflow:hidden;}
  .mvm-custom-logo.movixit-official-wordmark,.mvm-custom-logo{max-width:min(62vw,205px);}
  .mvm-mobile-drawer{height:var(--mx-vh);min-height:var(--mx-vh);max-height:var(--mx-vh);padding-bottom:env(safe-area-inset-bottom);}
  .mvm-mobile-panel{height:var(--mx-vh);max-height:var(--mx-vh);padding-bottom:calc(18px + env(safe-area-inset-bottom));}
  body.mvm-mobile-open{overflow:hidden;touch-action:none;}
  body.mvx-mobile-scroll-locked{position:fixed;width:100%;overflow:hidden;}

  /* Avoid accidental viewport-wide overflow from third-party embeds/widgets. */
  :where(.wp-block-embed,.wp-block-html,.elementor-widget,.elementor-container,.elementor-widget-container){max-width:100%;min-width:0;}
  :where(.wp-block-embed iframe,.elementor-widget-iframe iframe){max-width:100%;}

  /* Keep buttons usable without forcing every inline utility control to 100%. */
  :where(.wp-block-button,.wp-block-button__link){max-inline-size:100%;}

  /* Stable two-column stats only when there is enough room. */
  .stats-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;}
}
@media (max-width:359px){
  .stats-grid{grid-template-columns:1fr!important;}
  .mvm-custom-logo.movixit-official-wordmark,.mvm-custom-logo{max-width:170px;}
  .mvm-mobile-panel{width:100%;}
}
@media (orientation:landscape) and (max-width:900px){
  .mvm-mobile-head{min-height:58px;}
  :where(.movixit-front-page section,.site-content section){padding-block:34px;}
}
@media (prefers-reduced-motion:reduce){
  .mvm-mobile-panel,.mvm-mobile-drawer{transition:none!important;}
}
