/* ------------------------------------------------------------------
   shared-fixes.css — cross-page overrides for the BeDefended site.
   Loaded after each per-page CSS bundle so its rules win on specificity ties.
   Scope of this file:
     1. Kill the iPad-portrait orientation-lock overlay (was duplicated in 6 bundles).
     2. Make the hamburger toggle animate (X) and behave on resize/orientation change.
     3. Stop services-cards from overlapping on tablet (481–1024px).
     4. Grayscale client carousel logos with hover restore.
     5. About page categorised certifications grid (.about-cert-groups).
     6. Footer "Company certifications" placeholder slots (.footer-cert).
   Notes:
     - Override-only file. No structural redefinitions of base styles.
     - Uses :has() with a no-op fallback for browsers that lack support.
   ------------------------------------------------------------------ */

/* ---------- 0. Keyboard skip link ----------------------------------- */
.skip-link {
    position: absolute;
    top: 0;
    left: 0;
    background: #67ddff;
    color: #171219;
    padding: 12px 16px;
    font-family: "Space Mono", monospace;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    border-radius: 0 0 4px 0;
    transform: translateY(-100%);
    transition: transform 0.15s ease-out;
    z-index: 10000;
}
.skip-link:focus {
    transform: translateY(0);
    outline: 2px solid #171219;
    outline-offset: 2px;
    color: #171219;
}

/* ---------- 1. Orientation-lock overlay removal --------------------- */
.wrapper:before,
.wrapper::before {
    content: none !important;
    display: none !important;
    background: none !important;
}

@media only screen and (min-width: 769px) and (max-width: 1024px) {
    body,
    html {
        overflow: visible !important;
    }
    .wrapper {
        position: static !important;
    }
}

/* ---------- 2. Mobile header — pure-CSS hamburger-to-X + sync ------- */
@media only screen and (max-width: 768px) {
    /* Animate hamburger to X via the sibling checkbox */
    .navbar #menuToggle:checked ~ .navbar-toggler span:nth-child(1) {
        top: 10px;
        transform: rotate(45deg);
    }
    .navbar #menuToggle:checked ~ .navbar-toggler span:nth-child(2) {
        opacity: 0;
    }
    .navbar #menuToggle:checked ~ .navbar-toggler span:nth-child(3) {
        top: 10px;
        transform: rotate(-45deg);
    }

    /* Make the toggler always tappable (above the sliding menu) */
    .navbar .navbar-toggler {
        z-index: 3;
    }

    /* Body scroll lock only while the menu is open (modern browsers) */
    body:has(#menuToggle:checked) {
        overflow: hidden;
        touch-action: none;
    }
}

/* Reset menu state defensively at the tablet/desktop boundary so a
   menu left open on mobile does not bleed into the desktop layout. */
@media only screen and (min-width: 769px) {
    .navbar #menuToggle:checked ~ .navbar-collapse {
        left: auto;
    }
    .navbar .navbar-collapse {
        position: static;
        width: auto;
        padding: 0;
        background: transparent;
    }
}

/* ---------- 3. Services cards — relax absolute layout on tablet ----- */
@media only screen and (min-width: 481px) and (max-width: 1024px) {
    .services-cards {
        height: auto !important;
        padding: 40px 0;
    }
    .services-cards .services-cards__item {
        position: relative !important;
        top: auto !important;
        left: 0 !important;
        width: 100% !important;
        height: auto !important;
        min-height: 360px;
        margin: 0 0 32px 0 !important;
        padding: 40px 32px !important;
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45) !important;
        display: block !important;
    }
    .services-cards .services-cards__item .container {
        grid-column: auto;
        max-width: 100%;
    }
    .services-cards .services-cards__item p {
        height: auto !important;
        -webkit-line-clamp: unset !important;
        display: block !important;
    }
    .services-cards .services-cards__item .service__illustration {
        position: relative !important;
        right: auto !important;
        top: auto !important;
        height: auto !important;
        max-width: 55%;
        margin: 24px auto 0;
        display: block;
    }
    /* Avoid GSAP/ScrollTrigger ghost-pin pushing siblings on tablet */
    #sectionPin {
        min-height: 0 !important;
        height: auto !important;
    }
}

/* ---------- 4. Client carousel — grayscale (uniform across logos) --- */
/* Hover-to-restore-colour was removed because only the TeamSystem PNG
   carries colour in its source; the seven SVGs are all near-monochrome
   so the hover swap produced no perceivable change. */
.client-carousel .slider__slide img {
    filter: grayscale(1) opacity(0.7);
}

/* ---------- 5. About — categorised team-certifications grid --------- */
.about-cert-groups {
    padding: 140px 0 160px;
    position: relative;
}
.about-cert-groups > article {
    position: relative;
    z-index: 1;
}
.about-cert-groups header {
    /* The about page CSS bundle has a global `header{position:fixed;…}`
       rule meant for the site navbar — neutralise it on this section
       header so it flows inline at the top of the cert grid. */
    position: static;
    translate: none;
    left: auto;
    inset: auto;
    width: 100%;
    max-width: 720px;
    z-index: auto;
    /* Flex column with cross-axis centering guarantees the eyebrow / h2 /
       lead are horizontally centred regardless of their intrinsic block
       widths or any conflicting auto-margin rule from the bundle. */
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-left: auto !important;
    margin-right: auto !important;
    margin-top: 0;
    margin-bottom: 80px;
    padding: 0;
}
.about-cert-groups header > * {
    text-align: center;
    width: 100%;
    max-width: 100%;
}
.about-cert-groups header::after,
.about-cert-groups header::before {
    /* The same bundle adds decorative pseudo-elements on header. Strip
       them so we don't get stray strips behind the section title. */
    display: none !important;
    content: none !important;
}
.about-cert-groups header .eyebrow {
    font-family: "Space Mono", monospace;
    font-size: 13px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #67ddff;
    margin-bottom: 16px;
}
.about-cert-groups header h2 {
    font-family: "Space Grotesk", sans-serif;
    font-size: clamp(28px, 4vw, 48px);
    line-height: 1.1;
    color: #fff;
    margin: 0 0 20px;
}
.about-cert-groups header .lead {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1.55;
}
.about-cert-groups .cert-group {
    margin-bottom: 64px;
}
.about-cert-groups .cert-group:last-child {
    margin-bottom: 0;
}
.about-cert-groups .cert-group h3 {
    font-family: "Space Mono", monospace;
    font-size: 14px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.85);
    margin: 0 0 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(103, 221, 255, 0.25);
    position: relative;
}
.about-cert-groups .cert-group h3::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 56px;
    height: 1px;
    background: #67ddff;
}
.about-cert-groups .cert-group ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 48px 56px;
}
.about-cert-groups .cert-group li {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 110px;
    height: 110px;
    transition: transform 0.2s ease;
}
.about-cert-groups .cert-group li:hover,
.about-cert-groups .cert-group li:focus-within {
    transform: translateY(-2px);
}
.about-cert-groups .cert-group li a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}
/* Override the per-logo width/height HTML attributes so every credential
   renders at a uniform visual size regardless of the source asset. */
.about-cert-groups .cert-group li img {
    width: auto !important;
    height: auto !important;
    max-width: 100%;
    max-height: 90px;
    object-fit: contain;
}

/* Entrance animation: each <ul class="--animation" data-animation="text-in">
   gets `.-inview` toggled by the existing IntersectionObserver in
   about-c29bf…js (same mechanism as the section title). The transition
   below picks it up and reveals each credential with a brief stagger. */
.about-cert-groups .cert-group ul li {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}
.about-cert-groups .cert-group ul.-inview li {
    opacity: 1;
    transform: translateY(0);
}
.about-cert-groups .cert-group ul.-inview li:nth-child(1)  { transition-delay: 0.05s; }
.about-cert-groups .cert-group ul.-inview li:nth-child(2)  { transition-delay: 0.10s; }
.about-cert-groups .cert-group ul.-inview li:nth-child(3)  { transition-delay: 0.15s; }
.about-cert-groups .cert-group ul.-inview li:nth-child(4)  { transition-delay: 0.20s; }
.about-cert-groups .cert-group ul.-inview li:nth-child(5)  { transition-delay: 0.25s; }
.about-cert-groups .cert-group ul.-inview li:nth-child(6)  { transition-delay: 0.30s; }
.about-cert-groups .cert-group ul.-inview li:nth-child(7)  { transition-delay: 0.35s; }
.about-cert-groups .cert-group ul.-inview li:nth-child(8)  { transition-delay: 0.40s; }
.about-cert-groups .cert-group ul.-inview li:nth-child(9)  { transition-delay: 0.45s; }
@media (prefers-reduced-motion: reduce) {
    .about-cert-groups .cert-group ul li,
    .about-cert-groups .cert-group ul.-inview li {
        opacity: 1;
        transform: none;
        transition: none;
    }
}
@media only screen and (max-width: 768px) {
    .about-cert-groups {
        padding: 80px 0 100px;
    }
    .about-cert-groups header {
        margin-bottom: 56px;
    }
    .about-cert-groups .cert-group ul {
        gap: 32px 36px;
    }
    .about-cert-groups .cert-group li {
        width: 84px;
        height: 84px;
    }
    .about-cert-groups .cert-group li img {
        max-height: 70px;
    }
}

/* ---------- 6. Footer — Company certifications placeholder slots --- */
/* TEMPORARILY HIDDEN: no company certifications to show yet. The markup
   and the styles below stay in place, validated and ready. To re-enable,
   drop the real logos into the .footer-cert__slot items in the page
   footers and delete the single `display: none` line below. */
footer .footer-cert {
    display: none;
}
footer .footer-cert {
    margin: 56px 0 24px;
    padding: 28px 0 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
footer .footer-cert > p {
    font-family: "Space Mono", monospace;
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin: 0 0 18px;
}
footer .footer-cert ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 140px));
    gap: 16px;
}
footer .footer-cert .footer-cert__slot {
    height: 84px;
    border: 1px dashed rgba(255, 255, 255, 0.22);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    transition: border-color 0.2s ease;
}
footer .footer-cert .footer-cert__slot:hover {
    border-color: rgba(103, 221, 255, 0.45);
}
footer .footer-cert .footer-cert__slot > span {
    font-family: "Space Mono", monospace;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
footer .footer-cert .footer-cert__slot img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    filter: grayscale(1) opacity(0.85);
    transition: filter 0.2s ease;
}
footer .footer-cert .footer-cert__slot:hover img {
    filter: grayscale(0) opacity(1);
}
/* When an <img> is dropped into a slot, switch the slot into "filled" mode */
footer .footer-cert .footer-cert__slot:has(img) {
    border-style: solid;
    border-color: rgba(255, 255, 255, 0.18);
}
footer .footer-cert .footer-cert__slot:has(img) > span {
    display: none;
}
@media only screen and (max-width: 480px) {
    footer .footer-cert ul {
        grid-template-columns: 1fr;
    }
    footer .footer-cert .footer-cert__slot {
        height: 72px;
    }
}

/* ---------- 7. Promote the about-us h2 to render as the original h1 -
   When we demote the secondary <h1 class="w-blinker"> to <h2> on the
   home page (single-H1 SEO best practice), the bundle's `h1.w-blinker`
   styling (large size + pulsing dot pseudo-element) no longer matches.
   Clone the rules for h2.w-blinker so the visual is byte-identical. */
h2.w-blinker {
    font-size: 44px;
    line-height: 58px;
    font-weight: 400; /* match the bundle's h1 base weight (400), not bold */
    position: relative;
    text-indent: 75px;
    color: #fff;
    margin: 0;
}
@media only screen and (min-width: 769px) {
    h2.w-blinker {
        font-size: 72px;
        line-height: 92px;
    }
}
@media only screen and (max-width: 768px) {
    h2.w-blinker {
        text-indent: 55px;
    }
}
h2.w-blinker::before {
    content: "";
    position: absolute;
    left: 0;
    top: 65px;
    height: 5px;
    width: 50px;
    background-color: #c43dff;
    animation: 1s steps(2, start) infinite blink-animation;
}
@media only screen and (max-width: 768px) {
    h2.w-blinker::before {
        left: 5px;
        top: 42px;
        height: 5px;
        width: 35px;
    }
}

/* ---------- 8. Reduced-motion preference ---------------------------- */
@media (prefers-reduced-motion: reduce) {
    /* Disable scroll-triggered entrance animations and any background
       canvas / particle effect. Content remains visible because the
       site does not gate visibility on animation completion. */
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        animation-delay: 0ms !important;
        transition-duration: 0.001ms !important;
        transition-delay: 0ms !important;
        scroll-behavior: auto !important;
    }
    /* The client logo carousel uses an infinite translateX scroll. Stop
       moving it AND switch to a wrapped flex layout so every logo in the
       loop's first half is visible at once without horizontal scroll. */
    .client-carousel .slider {
        width: auto !important;
        max-width: 100% !important;
        height: auto !important;
        overflow: visible !important;
    }
    .client-carousel .slider::before,
    .client-carousel .slider::after {
        display: none !important;
    }
    .client-carousel .slider .slider__track {
        animation: none !important;
        transform: none !important;
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 24px 40px !important;
        width: 100% !important;
    }
    /* Hide the duplicated second half of the loop — index/about each
       carry 14 slides (7 unique × 2). The reduced-motion grid only
       needs the unique 7. */
    .client-carousel .slider .slider__track .slider__slide:nth-child(n + 8) {
        display: none !important;
    }
}
