/* =====================================================================
   Homepage repairs - loaded after css/style.css, which is left untouched.

   css/style.css has a stray closing brace at line 2136, so rules written
   after that point land inside whichever media query happens to be open.
   Anything added there silently applies at the wrong screen width, which
   is why these corrections live in their own file instead.

   Only two things are corrected, both of them bugs rather than design
   choices. The desktop layout is not touched.
   ===================================================================== */

/* 1. Tablets (601-991px): the four social icons in the header kept their
      desktop width and left margin, so they sat past the right edge and
      made the whole page scroll sideways. They now drop onto their own
      centred line, which is what the header already does below 600px. */
@media (max-width: 991px) {
    .top_nav_right {
        float: none;
        clear: both;
        width: auto;
        max-width: 100%;
        text-align: center;
    }

    .top_nav_right ul {
        margin-top: 6px;
        margin-left: 0;
        padding-left: 0;
    }
}

/* 2. The client logo carousel lays its slides out in a very wide row and
      relies on the wrapper to clip them. Without that clip the row adds
      its full width to the page, which also caused sideways scrolling. */
.nbs-flexisel-container,
.nbs-flexisel-inner {
    overflow: hidden;
}

/* 3. Tablets (768-991px): Bootstrap 3 switches the menu back to the wide
      desktop bar at 768px, where the seven items plus the social icons no
      longer fit, so the page scrolled sideways. The page already ships a
      working hamburger button for narrow screens; these rules simply keep
      using it up to 991px instead of stopping at 767px. */
@media (max-width: 991px) {
    .navbar-header {
        float: none;
    }

    .navbar-toggle {
        display: block;
    }

    .navbar-collapse {
        border-top: 1px solid rgb(255 255 255 / 10%);
    }

    .navbar-collapse.collapse {
        display: none !important;
    }

    .navbar-collapse.collapse.in {
        display: block !important;
        overflow-y: auto;
    }

    .navbar-nav {
        float: none !important;
        margin: 7px 0;
    }

    .navbar-nav > li {
        float: none;
    }

    .navbar-nav > li > a {
        padding-top: 10px;
        padding-bottom: 10px;
    }

    /* the Services dropdown has to open inline once the bar is collapsed */
    .navbar-nav .open .dropdown-menu {
        position: static;
        float: none;
        width: auto;
        margin-top: 0;
        background: transparent;
        border: 0;
        box-shadow: none;
    }
}

/* 4. Client logo strip: one row that scrolls without stopping.
      The old carousel moved one logo every three seconds and paused on hover.
      The page script now puts the list in a track beside an identical copy and
      this slides the track left by half its width. Half of two equal copies is
      exactly one copy, so the loop repeats with no seam, whatever the widths. */
.metro-marquee {
    display: flex;
    width: max-content;
    animation: metro-marquee-scroll 45s linear infinite;
    will-change: transform;
}

@keyframes metro-marquee-scroll {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(-50%);
    }
}

.metro-marquee > .metro-marquee-copy {
    display: flex;
    /* each copy keeps its full width; as a flex item it would otherwise be
       squeezed and its logos would spill over the copy behind it */
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
    list-style: none;
}

.metro-marquee > .metro-marquee-copy > li {
    flex: 0 0 auto;
    float: none;
    width: 150px;
}

@media (max-width: 991px) {
    .metro-marquee {
        animation-duration: 34s;
    }

    .metro-marquee > .metro-marquee-copy > li {
        width: 130px;
    }
}

@media (max-width: 600px) {
    .metro-marquee {
        animation-duration: 28s;
    }

    .metro-marquee > .metro-marquee-copy > li {
        width: 110px;
    }
}

/* visitors who ask their device to reduce motion get a row they can swipe instead */
@media (prefers-reduced-motion: reduce) {
    .metro-marquee {
        animation: none;
    }

    .nbs-flexisel-inner {
        overflow-x: auto;
    }
}

/* 5. Client logo strip runs edge to edge, the same width as the banner above it.
      It was sitting inside Bootstrap's fixed .container, so on a wide screen it
      stopped well short of both edges while the banner filled the window.

      The row becomes a flex line: the rotated red "clients" tab keeps its place
      at the left and takes only the width it actually shows, and the logo strip
      takes everything that is left. The inline width/margin the old carousel
      left on .slide are overridden, otherwise a full-width container would push
      the strip past the right edge. */
@media (min-width: 768px) {
    #clients .banner-bottom > .container {
        display: flex;
        align-items: center;
        width: 100%;
        max-width: none;
        padding-left: 14px;
        padding-right: 0;
    }

    #clients .banner-bottom > .container > .col-md-1 {
        flex: 0 0 auto;
        width: auto;
        padding: 0;
    }

    /* the tab is a 110px box turned on its side, so on screen it is only about a
       line wide; the negative side margins let the column shrink to that, and the
       inline top/right offsets are cleared so it sits against the left edge */
    #clients .banner-bottom > .container > .col-md-1 > h3 {
        top: 0 !important;
        right: 0 !important;
        width: 110px;
        margin: 0 -37px;
        padding-bottom: 5px;
    }

    #clients .banner-bottom > .container > .col-md-1 > h3:before {
        display: none;
    }

    #clients .banner-bottom > .container > .slide {
        flex: 1 1 auto;
        min-width: 0;
        width: auto !important;
        margin-left: 14px !important;
        margin-right: 0 !important;
        padding: 0;
    }
}

/* ---- the menu bar stays at the top of the window while the page scrolls (same behaviour as the inner pages) ----
   .header (logo strip) and .ban-top (menu bar) are siblings inside one wrapper that holds the whole page, so the
   bar can stick directly. "div.ban-top" beats the template's ".ban-top { top: -3px }". */
div.ban-top { position: sticky; top: 0; z-index: 1000; }
@media (max-width: 991px) {
    /* an open menu on a short screen scrolls inside the bar instead of running off the bottom of the window */
    div.ban-top .navbar-collapse.in { max-height: calc(100vh - 56px); max-height: calc(100dvh - 56px); overflow-y: auto; }
}

/* The enquiry modal is shared with the other 60 pages, which set these two faces
   in crafto/css/style.css. The home page does not load that file, so they are
   declared here and the modal reads the same typography as the rest of the site. */
:root {
    --primary-font: "Inter", sans-serif;
    --alt-font: "Plus Jakarta Sans", sans-serif;
}
