/* =========================================================
   MTCE – layout guard (loads last)
   Keeps the design intact whatever is typed, resized, added or removed
   in the editor. Sizes chosen in the editor act as a maximum; small
   screens always get what fits. Variables come from MTCE Settings.
   ========================================================= */
:root{
  --mtce-head-k:1;   /* MTCE Settings: header text size */
  --mtce-logo-k:1;   /* MTCE Settings: logo size */
  --mtce-fit:1;      /* theme.js: shrinks the menu row until it fits */
  --mtce-fit-top:1;  /* theme.js: same for the top bar */
  --mtce-card-ratio:16/10;
  --mtce-card-fit:cover;
  /* big spacing presets shrink with the screen (unchanged from 1350px up) */
  --wp--preset--spacing--70:clamp(1.25rem,4vw,3.38rem);
  --wp--preset--spacing--80:clamp(1.25rem,6vw,5.06rem);
}

/* ---------- 1. Nothing may widen the page ---------- */
.wp-site-blocks{overflow-x:clip}
:where(main,header,footer) :where(h1,h2,h3,h4,h5,h6,p,li,a,figcaption,td,th,blockquote){overflow-wrap:break-word}
:where(main,footer) :where(.wp-block-column,.is-layout-flex>*,.is-layout-grid>*){min-width:0;max-width:100%}
:where(main,footer) :where(img,video,iframe,embed,object,canvas){max-width:100%}
main :is(iframe,embed,object,video):not(.wp-block-cover__video-background){max-width:min(100%,var(--wp--style--global--content-size,1480px))!important}
main .wp-block-table,main .wp-block-code,main pre{overflow-x:auto;max-width:100%}
main .wp-block-table td,main .wp-block-table th{min-width:6rem}
.wp-block-button__link{white-space:normal;overflow-wrap:anywhere}
.mtce-info span,.mtce-footer a{overflow-wrap:anywhere}

/* a full-width section without any side space of its own still gets the page margin */
main .entry-content>.wp-block-group.alignfull.is-layout-flow:not(.has-background):not(.has-global-padding):not(.has-border-color):not([style*="padding-left"]):not(:has(>.alignfull)){padding-inline:var(--wp--style--root--padding-left,1rem)}

/* ---------- 2. Top bar: one line, no white gap around it ---------- */
header .mtce-topbar{margin-block:0!important;padding-inline:clamp(1rem,2.5vw,2.25rem)!important}
header .mtce-topbar .wp-block-group{flex-wrap:nowrap!important;gap:clamp(.6rem,1.3vw,1.4rem)!important}
header .mtce-topbar :is(p,h1,h2,h3,h4,h5,h6,li,a){font-size:calc(max(.66rem,min(.93vw,1.2rem)) * var(--mtce-head-k) * var(--mtce-fit-top))!important;line-height:1.4;margin:0;white-space:nowrap}
.mtce-top-tight header .mtce-topbar .mtce-hide-sm{display:none!important}
/* last resort: centred rows instead of a cut-off line */
.mtce-top-wrap header .mtce-topbar .wp-block-group{flex-wrap:wrap!important;justify-content:center!important;row-gap:.1rem!important}
@media (max-width:1099px){header .mtce-topbar .mtce-hide-sm{display:none!important}}
.mtce-no-topbar header .mtce-topbar{display:none!important}

/* ---------- 3. Logo + name + menu: one row ---------- */
header .mtce-header{border-width:.6rem 0!important;padding-inline:clamp(1rem,2.5vw,2.25rem)!important}
header .mtce-header>.wp-block-group{flex-wrap:nowrap!important;gap:clamp(.75rem,1.5vw,2rem)!important}
header .mtce-brand{padding-inline:0!important;min-width:0;max-width:100%;flex:0 1 auto;flex-wrap:nowrap!important}
header .mtce-brand .wp-block-site-logo{flex:0 0 auto}
header .mtce-brand .wp-block-site-logo img{width:calc(clamp(52px,5vw,100px) * var(--mtce-logo-k))!important;max-width:none;height:auto;max-height:calc(110px * var(--mtce-logo-k));object-fit:contain}
header .mtce-brand .wp-block-site-title{font-size:calc(min(var(--mtce-fs,1.7rem),max(.8rem,1.28vw)) * var(--mtce-head-k) * var(--mtce-fit))!important;line-height:1.3!important;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden}
header .mtce-header .wp-block-columns{padding-inline:0!important;margin:0;flex:0 0 auto;width:auto}
header .mtce-header .wp-block-columns .wp-block-column{flex:0 0 auto!important}
header .mtce-header .wp-block-navigation__submenu-icon{font-size:.8rem!important;width:.8em;height:.8em}
header .wp-block-navigation{--mtce-nav-fs:calc(min(var(--mtce-fs,1.2rem),max(.74rem,.95vw)) * var(--mtce-head-k) * var(--mtce-fit))}
@media (min-width:1000px){
  header .mtce-header .wp-block-navigation__container{flex-wrap:nowrap!important;gap:clamp(.1rem,.4vw,.5rem)!important}
  header .mtce-header .wp-block-navigation__container>li>.wp-block-navigation-item__content{font-size:var(--mtce-nav-fs);padding:.5rem calc(clamp(.4rem,.65vw,.8rem) * var(--mtce-fit));white-space:nowrap}
  header .mtce-header .wp-block-navigation__submenu-container .wp-block-navigation-item__content{font-size:clamp(.8rem,.9vw,1.05rem);white-space:normal}
  header .mtce-header .wp-block-navigation__submenu-container{max-height:calc(100vh - 160px)}
  header .mtce-header .wp-block-navigation__submenu-container:not(:has(.wp-block-navigation__submenu-container)){overflow-y:auto}
  header .mtce-header .wp-block-navigation__container>li:nth-last-child(-n+2) .wp-block-navigation__submenu-container{left:auto!important;right:0!important}
  .mtce-nav-wrap header .mtce-header .wp-block-navigation__container{flex-wrap:wrap!important;justify-content:flex-end!important}
}
/* extra blocks in the header, or a menu that cannot collapse: tidy second row */
.mtce-head-wrap header .mtce-header>.wp-block-group{flex-wrap:wrap!important;row-gap:.5rem!important}
.mtce-head-wrap header .mtce-header>.wp-block-group>.wp-block-columns{flex:1 1 auto;max-width:100%;min-width:0}
.mtce-head-wrap header .mtce-header .wp-block-columns .wp-block-column{flex:1 1 100%!important;min-width:0}
.mtce-head-wrap header .mtce-header .wp-block-columns .wp-block-group{flex-wrap:wrap!important;justify-content:flex-end;row-gap:.4rem!important}
.mtce-head-wrap header .mtce-header .wp-block-navigation,.mtce-head-wrap header .mtce-header .wp-block-search{max-width:100%;min-width:0}
.mtce-head-wrap header .mtce-header .wp-block-navigation__container{flex-wrap:wrap!important}
.mtce-head-wrap header .mtce-header .wp-block-button__link{padding:.45rem .8rem;font-size:.8rem}
@media (max-width:599px){.mtce-head-wrap header .mtce-header>.wp-block-group>.wp-block-columns{order:0}}
.mtce-not-sticky header.wp-block-template-part{position:static}

/* Menu button instead of a squeezed menu: below 1000px, or whenever theme.js
   finds that the menu cannot fit (.mtce-nav-collapsed), or by setting */
@media (max-width:999px){
  header .mtce-header .wp-block-navigation__responsive-container-open{display:flex!important;width:42px;height:42px;border-radius:10px;background:var(--mtce-sky);align-items:center;justify-content:center}
  header .mtce-header .wp-block-navigation__responsive-container:not(.is-menu-open){display:none!important}
  header .mtce-header .wp-block-navigation__responsive-container.is-menu-open{display:flex!important;position:fixed!important;inset:0!important;width:auto!important}
  header .mtce-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close{display:flex!important}
  header .mtce-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container{flex-direction:column!important}
  header .mtce-brand .wp-block-site-title{font-size:calc(1.05rem * var(--mtce-head-k))!important;max-width:none}
}
.mtce-nav-collapsed header .mtce-header .wp-block-navigation__responsive-container-open{display:flex!important;width:42px;height:42px;border-radius:10px;background:var(--mtce-sky);align-items:center;justify-content:center}
.mtce-nav-collapsed header .mtce-header .wp-block-navigation__responsive-container:not(.is-menu-open){display:none!important}
.mtce-nav-collapsed header .mtce-header .wp-block-navigation__responsive-container.is-menu-open{display:flex!important;position:fixed!important;inset:0!important;width:auto!important}
.mtce-nav-collapsed header .mtce-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close{display:flex!important}
.mtce-nav-collapsed header .mtce-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container{flex-direction:column!important;flex-wrap:nowrap!important}
.mtce-nav-collapsed header .mtce-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container{max-height:none;left:auto!important;right:auto!important}
@media (max-width:781px){
  header .mtce-header{border-width:.3rem 0!important;padding-inline:1rem!important}
  header .mtce-brand .wp-block-site-logo img{width:calc(44px * var(--mtce-logo-k))!important;max-height:56px}
  header .mtce-brand .wp-block-site-title{font-size:calc(.8rem * var(--mtce-head-k))!important;max-width:230px;line-height:1.25!important}
}
@media (max-width:599px){header .mtce-header>.wp-block-group>.wp-block-columns{order:-1}}

/* ---------- 4. Headings with side lines: bold or coloured words stay in one piece ---------- */
.is-style-lines>.mtce-lines__text{min-width:0}
.is-style-lines::before,.is-style-lines::after{min-width:.6rem}

/* ---------- 5. Banners ---------- */
.mtce-slider__track>.wp-block-cover{min-height:var(--mtce-slider-h,clamp(480px,74vh,720px))!important}
@media (max-width:781px){.mtce-slider__track>.wp-block-cover{min-height:440px!important;padding-bottom:3.5rem}}
.mtce-slider .wp-block-cover__inner-container,.mtce-page-hero .wp-block-cover__inner-container{min-width:0;max-width:100%}
.mtce-page-hero,.mtce-slide{background-color:var(--mtce-navy-d)}
@media (max-width:781px){.mtce-page-hero h1{overflow-wrap:anywhere}}

/* ---------- 6. Picture tiles: same height in a row, long captions welcome ---------- */
.wp-block-column>.mtce-tile:only-child{height:100%}
.wp-block-image.mtce-tile img{flex:0 0 auto}
.wp-block-image.mtce-tile figcaption{flex:1 0 auto;align-content:center}
.wp-block-image.mtce-tile{width:auto!important}

/* ---------- 7. Cards: picture, title, text and button line up across a row ---------- */
.mtce-pcard img{aspect-ratio:var(--mtce-card-ratio)!important;object-fit:var(--mtce-card-fit)!important;width:100%!important;height:auto!important;background:#fff}
.mtce-pcard>figure{flex:0 0 auto;line-height:0;width:100%}
.mtce-pcard>figure figcaption{line-height:1.4}
.mtce-pcard>h3{flex:0 0 auto;align-content:center}
.mtce-pcard>:last-child{margin-bottom:1rem}
@supports (grid-template-rows:subgrid){
  :is(.mtce-products,.wp-block-group.is-layout-grid)>.mtce-pcard{grid-row:span 4}
  :is(.mtce-products,.wp-block-group.is-layout-grid)>.mtce-pcard:has(>:nth-child(4):last-child){display:grid;grid-row:span 4;grid-template-rows:subgrid;row-gap:0!important}
}

/* ---------- 8. Number strips and icon strips: any number of items ---------- */
.mtce-stats{flex-wrap:wrap!important;justify-content:center}
.mtce-stats>.wp-block-column{flex:1 1 13%!important;min-width:0}
@media (max-width:781px){
  .mtce-stats{display:flex!important}
  /* :not() only raises priority over the core "stack on mobile" rule */
  .mtce-stats.wp-block-columns:not(.x):not(.y)>.wp-block-column{flex:1 1 28%!important;text-align:center}
  .mtce-stats.wp-block-columns:not(.x):not(.y):has(>:nth-child(4):last-child)>.wp-block-column{flex-basis:44%!important}
  .mtce-why-cols>.wp-block-column:nth-child(odd):last-child,
  .mtce-equal:has(.mtce-infocard)>.wp-block-column:nth-child(odd):last-child{grid-column:1/-1}
}
.mtce-why .wp-block-columns{flex-wrap:wrap!important;row-gap:1rem}
@media (min-width:782px){.mtce-why .wp-block-column{flex:1 1 15%!important}}

@media (max-width:781px){.mtce-stats .mtce-stat__num{font-size:clamp(.85rem,3.9vw,1.1rem)!important}}
.mtce-certs img{box-sizing:border-box}
@media (max-width:781px){.mtce-certs{grid-template-columns:repeat(auto-fill,minmax(74px,1fr))}}

/* ---------- 9. Client strip ---------- */
.mtce-clients.is-scrolling .mtce-clients__track{animation-duration:var(--mtce-strip,45s)}
.mtce-clients.is-short .mtce-clients__track{animation:none!important;flex:1;justify-content:center;flex-wrap:wrap;padding-right:0}
.mtce-clients.is-short .mtce-clients__track[aria-hidden]{display:none}
.mtce-clients.is-short{-webkit-mask:none;mask:none}

/* ---------- 10. Footer and bottom menu ---------- */
@media (min-width:782px) and (max-width:1099px){
  .mtce-footer__cols{flex-wrap:wrap!important}
  .mtce-footer__cols>.wp-block-column{flex:1 1 28%!important}
}
.mtce-appnav li{min-width:0}
.mtce-appnav a span{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* ---------- 11. Missing pictures: neutral panel instead of a broken icon ---------- */
img.mtce-img-missing{background:#e9f0fa url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke='%239db4d6' stroke-width='2.5' stroke-linejoin='round'%3E%3Crect x='6' y='10' width='36' height='28' rx='3'/%3E%3Ccircle cx='17' cy='20' r='3.5'/%3E%3Cpath d='M8 34l11-10 8 7 6-5 8 8'/%3E%3C/svg%3E") center/64px no-repeat!important}
img.wp-block-cover__image-background.mtce-img-missing{visibility:hidden}

/* ---------- 12. Phones: spacing tricks must not eat the screen ---------- */
@media (max-width:781px){
  /* a white border is the page margin of these sections: one even margin, never doubled */
  main .has-white-border-color{border-inline-width:1rem!important}
  main .has-white-border-color .has-white-border-color,main .wp-block-image .has-white-border-color{border-inline-width:0!important}
  .wp-block-columns:has(> .wp-block-column > .mtce-tile),.mtce-grid-4,.mtce-grid-3{margin-right:0!important}
  main .wp-block-group[style*="margin-left:-"],main .wp-block-group[style*="margin-right:-"],main .wp-block-columns[style*="margin-left:-"]{margin-inline:0!important}
  main .wp-block-columns.is-not-stacked-on-mobile:has(>:nth-child(3)){flex-wrap:wrap!important}
  main .wp-block-columns.is-not-stacked-on-mobile:has(>:nth-child(3))>.wp-block-column{flex:1 1 44%!important}
  /* phone tiles: setting "grid" instead of a swipe row */
  .mtce-tiles-grid .wp-block-columns:has(>.wp-block-column>.mtce-tile){display:grid!important;grid-template-columns:1fr 1fr;overflow:visible;margin-right:0}
  .mtce-tiles-grid .wp-block-columns:has(>.wp-block-column>.mtce-tile)>.wp-block-column{flex-basis:auto!important}
}
