/* ===========================================================================
   mobile-fixes.css  —  loaded LAST (see layout/base.html), so it wins on equal specificity.

   1. Hamburger side menu: fully hidden by default (it used to peek in from the right edge)
   2. Solutions section: the left glass card is one link (no title / arrow), mobile layout
   3. Mobile layouts for the other home-page sections (<= 768px)
   =========================================================================== */


/* ===========================================================================
   1. SIDE MENU (hamburger panel)
   Old rule: right:-350px with width 335px + padding in a content-box = the panel was wider
   than its offset, so a strip of it stayed on screen. Now it is moved off-screen with a
   transform AND hidden (visibility), so nothing of it can ever show until it is opened.
   =========================================================================== */
.side-menu {
    box-sizing: border-box;
    right: 0;
    left: auto;
    max-width: 100vw;
    transform: translateX(110%);
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.4s ease, visibility 0s linear 0.4s;
    z-index: 9999;
    overscroll-behavior: contain;
}

.side-menu.is-open {
    transform: none;
    visibility: visible;
    pointer-events: auto;
    transition: transform 0.4s ease, visibility 0s;
}

/* the panel is for tablets / phones only */
@media (min-width: 1026px) {
    .side-menu,
    .overlay {
        display: none !important;
    }
}

.overlay {
    z-index: 9990;
}

html.menu-open,
html.menu-open body {
    overflow: hidden;
}

/* menu links get a comfortable tap size */
.side-menu .mobile-submenu a {
    display: block;
}


/* ===========================================================================
   2. SOLUTIONS SECTION — the left glass card
   • the title text ("CRM", "Web Portals" …) and its arrow are gone
   • the WHOLE card is a link (stretched <a class="sol-detail">, see laptop3d.js)
   • the "Expand" pill stays as a visual cue only (it is a span now, not a second link)
   =========================================================================== */

/* the tab list only keeps the active state for the JS — its titles/arrows are not shown */
section.custom-tabs .tab-list {
    display: none !important;
}

section.custom-tabs .tab-list-window {
    cursor: pointer;
    border-radius: 26px;
    padding: 0 !important;              /* the <a> inside carries the padding, so the link IS the card */
    overflow: hidden;
    transition: background 0.25s ease;
}

section.custom-tabs .tab-list-window:hover {
    background: rgba(0, 0, 0, 0.1);
}

section.custom-tabs .sol-detail {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    box-sizing: border-box;
    width: 100%;
    margin: 0;
    padding: clamp(1.1rem, 1.8vw, 1.7rem) clamp(1.1rem, 1.8vw, 1.5rem);
    border: 0;
    border-radius: inherit;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    animation: solSwapCard 0.45s ease 0.05s both;
}

@keyframes solSwapCard {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

section.custom-tabs .sol-detail:focus-visible {
    outline: 3px solid #7b2ff7;
    outline-offset: -3px;
}

section.custom-tabs .tab-list-window:hover .sol-cap-btn,
section.custom-tabs .sol-detail:focus-visible .sol-cap-btn {
    transform: translateY(-2px);
}

section.custom-tabs .sol-detail .sol-cap-btn {
    pointer-events: none;               /* a visual cue, not a second link */
}

/* desktop */
@media (min-width: 901px) {
    section.custom-tabs .tab-list-window {
        justify-content: flex-start;
    }

    section.custom-tabs .sol-detail {
        gap: var(--sol-gap);
    }
}

/* ---------- Solutions on tablets / phones ---------- */
@media (max-width: 900px) {

    section.custom-tabs {
        height: 400vh;
    }

    section.custom-tabs .tabs-container {
        height: 100vh;
        height: 100svh;
        padding-top: calc(var(--hdr-compact, 64px) + 1vh);
    }

    section.custom-tabs .costomized-head {
        padding: 0 4vw 1vh;
    }

    section.custom-tabs .costomized-head span {
        font-size: 1.25rem;
    }

    section.custom-tabs .costomized-head h2 {
        font-size: clamp(1.25rem, 5.4vw, 1.7rem);
        margin: 0.1rem 0 0.4rem;
    }

    section.custom-tabs .tabs-body {
        gap: 10px;
        padding-bottom: 10px;
    }

    /* the card: full width, compact, centred content */
    section.custom-tabs .tab-list-window {
        flex: none;
        width: auto;
        margin: 0 4vw;
        border-radius: 20px;
        max-height: none;
        overflow: hidden;
    }

    section.custom-tabs .sol-detail {
        align-items: center;
        text-align: center;
        gap: 8px;
        padding: 14px 16px 16px;
    }

    section.custom-tabs .sol-detail .sol-cap-icon {
        height: 42px;
    }

    section.custom-tabs .sol-detail .sol-cap-text {
        font-size: 0.86rem;
        line-height: 1.45;
        -webkit-line-clamp: 4;
    }

    section.custom-tabs .sol-detail .sol-cap-btn {
        padding: 7px 20px;
        font-size: 0.95rem;
    }

    /* the laptop takes all the height that is left under the card */
    section.custom-tabs .laptop-stage {
        flex: 1 1 0;
        min-height: 220px;
        width: 100%;
    }
}

@media (max-width: 520px) {
    section.custom-tabs .tab-list-window {
        margin: 0 3vw;
        border-radius: 16px;
    }

    section.custom-tabs .sol-detail {
        padding: 12px 14px 14px;
    }

    section.custom-tabs .sol-detail .sol-cap-text {
        font-size: 0.82rem;
        -webkit-line-clamp: 5;
    }
}

/* a fixed background on a very tall pinned section is janky / ignored on phones */
@media (max-width: 900px), (hover: none) {

    .customized,
    section.custom-tabs {
        background-attachment: scroll;
    }
}


/* ===========================================================================
   3. MOBILE LAYOUT FOR THE OTHER HOME SECTIONS  (<= 768px)
   =========================================================================== */
@media (max-width: 768px) {

    html,
    body {
        max-width: 100%;
    }

    img,
    video,
    canvas,
    svg {
        max-width: 100%;
    }

    /* ---------- Trusted across industries ---------- */
    .madds-trusted__stats,
    .madds-trusted__badges {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
    }

    .madds-trusted__stat {
        padding: 14px 10px !important;
    }

    .madds-trusted__stat small {
        display: none;
    }

    .madds-trusted__stat strong {
        font-size: 0.92rem;
    }

    .madds-trusted__badge {
        padding: 12px 10px !important;
        gap: 8px !important;
    }

    .madds-trusted__badge small {
        display: none;
    }

    .madds-trusted__live {
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
    }

    /* ---------- About ---------- */
    .about-section .ag-orbit {
        display: none;                  /* hover badges / tooltips do not work on touch */
    }

    .about-section .ag-cards {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .about-section .ag-card__tilt {
        display: grid;
        grid-template-columns: auto 1fr;
        column-gap: 14px;
        align-items: start;
        text-align: left;
    }

    .about-section .ag-card__icon {
        grid-row: 1 / span 2;
        margin: 0;
    }

    .about-section .ag-card__tilt h3 {
        margin: 0 0 4px;
    }

    .about-section .ag-card__tilt p {
        margin: 0;
    }

    .about-section .ag-about-text {
        font-size: 0.95rem;
        line-height: 1.7;
    }

    .about-section .ag-stats {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .about-section .ag-stat__num {
        font-size: 1.6rem;
    }

    .about-section .ag-stat__label {
        font-size: 0.7rem;
        letter-spacing: 0.04em;
    }

    /* ---------- "Idea behind MADDS" tabbed panel (main-parallax) ----------
       Desktop: columns slide left / right. Phone: a plain, auto-height card with the
       tab chips above it and only the selected panel shown (no big empty box, no
       text running to the edge). */
    .main-parallax {
        display: block;
        height: auto !important;
        min-height: 0 !important;
        padding: 28px 0 32px;
        background-attachment: scroll;
        overflow: hidden;
    }

    .main-parallax .wrapper {
        display: flex;
        flex-direction: column;
        gap: 14px;
        width: 100%;
        max-width: 100%;
        height: auto;
        padding: 0 16px;
        box-sizing: border-box;
    }

    .main-parallax .parallax-rail {
        display: none;
    }

    /* phone: the section itself is a swipe carousel (scroll-snap) that also auto-slides
       (see the "main-parallax mobile carousel" block in script.js). The tab columns are
       replaced by dots under the card. */
    .main-parallax .tabs,
    .main-parallax .parallax-rail {
        display: none !important;
    }

    .main-parallax .content {
        order: 1;
        position: relative;
        display: flex;
        flex-direction: row;
        flex: none;
        width: 100%;
        min-height: 0;
        height: auto;
        padding: 0;
        box-sizing: border-box;
        border-radius: 22px;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
    }

    .main-parallax .content::-webkit-scrollbar {
        display: none;
    }

    /* every panel is one full-width slide */
    .main-parallax .text {
        position: static;
        inset: auto;
        display: flex !important;
        flex-direction: column;
        flex: 0 0 100%;
        width: 100%;
        gap: 16px;
        padding: 22px 18px 24px;
        box-sizing: border-box;
        opacity: 1;
        transform: none;
        transition: none;
        scroll-snap-align: center;
        scroll-snap-stop: always;
    }

    /* the desktop reveal animation starts lines at opacity 0 - keep them visible while swiping */
    .main-parallax .text .line,
    .main-parallax .text.active .line {
        opacity: 1;
        transform: none;
        animation: none;
    }

    .main-parallax .text-cont,
    .main-parallax .content-img {
        width: 100%;
        flex: none;
        margin: 0;
    }

    .main-parallax .text h2 {
        font-size: clamp(1.3rem, 5.6vw, 1.6rem);
        margin-bottom: 10px;
    }

    .main-parallax .text .line {
        font-size: 0.95rem;
        line-height: 1.65;
        margin: 0;
        overflow-wrap: anywhere;
    }

    .main-parallax .content-img img {
        display: block;
        width: 100%;
        height: auto;
        max-height: 240px;
        object-fit: contain;
        margin: 0 auto;
    }

    /* dots (created by script.js) */
    .main-parallax .mp-dots {
        order: 2;
        display: flex;
        justify-content: center;
        gap: 8px;
        padding: 2px 0;
    }

    .main-parallax .mp-dot {
        width: 9px;
        height: 9px;
        padding: 0;
        border: 0;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.55);
        box-shadow: 0 0 0 1px rgba(60, 30, 140, 0.25);
        transition: width 0.3s ease, background 0.3s ease;
    }

    .main-parallax .mp-dot.is-active {
        width: 26px;
        background: linear-gradient(90deg, #b900ff, #0058ff);
    }

    /* ---------- What we specialise in ---------- */
    .madds-specialisation__inner {
        width: calc(100% - 2rem) !important;
        max-width: 620px;
        align-items: stretch !important;
        gap: 1.5rem !important;
    }

    .madds-specialisation__intro {
        text-align: center;
    }

    .madds-specialisation__hint {
        justify-content: center;
    }

    .madds-specialisation__preview {
        order: 2;
    }

    .madds-specialisation__directory {
        order: 3;
        width: 100%;
    }

    .madds-specialisation__item {
        height: auto;
        min-height: 56px;
        text-align: left;
        padding: 0.9rem 0.25rem;
        font-size: 1rem;
    }

    .madds-specialisation__preview-media {
        height: min(64vw, 300px) !important;
    }

    /* The right-hand capability list is replaced by the swipeable image slider */
    .madds-specialisation__directory {
        display: none !important;
    }

    /* ---------- What we specialise in: mobile slider ----------
       The slider is built by JS (home.html) and laid over the preview media.
       Desktop keeps the original hover-driven single image. */
    .madds-spec-m-slider {
        display: none;
    }

    .madds-specialisation.is-mobile-slider .madds-spec-m-slider {
        display: block;
        position: absolute;
        inset: 0;
        z-index: 1;
        overflow: hidden;
        cursor: grab;
        touch-action: pan-y;
        user-select: none;
        -webkit-user-select: none;
    }

    .madds-specialisation.is-mobile-slider .madds-spec-m-slider.is-dragging {
        cursor: grabbing;
    }

    /* the single desktop image stays out of the way while the slider runs */
    .madds-specialisation.is-mobile-slider #madds-specialisation-image {
        display: none !important;
    }

    .madds-spec-m-track {
        display: flex;
        height: 100%;
        transform: translate3d(0, 0, 0);
        transition: transform .5s cubic-bezier(.2, .7, .2, 1);
        will-change: transform;
    }

    .madds-spec-m-slide {
        position: relative;
        flex: 0 0 100%;
        width: 100%;
        height: 100%;
    }

    .madds-spec-m-slide img {
        width: 100%;
        height: 100%;
        display: block;
        object-fit: cover;
        pointer-events: none;
        -webkit-user-drag: none;
    }

    /* slide indicators (top-right, clear of the caption block) */
    .madds-spec-m-dots {
        position: absolute;
        z-index: 5;
        top: .95rem;
        right: 1.05rem;
        display: flex;
        align-items: center;
        gap: .38rem;
    }

    .madds-spec-m-dot {
        width: 7px;
        height: 7px;
        padding: 0;
        border: 0;
        border-radius: 999px;
        background: rgba(255, 255, 255, .45);
        box-shadow: 0 0 0 1px rgba(23, 19, 31, .12);
        cursor: pointer;
        transition: width .35s cubic-bezier(.2, .7, .2, 1), background .35s ease;
    }

    .madds-spec-m-dot.is-active {
        width: 22px;
        background: linear-gradient(90deg, #b51bb5, #2677ff);
    }

    /* ---------- Managed IT services (industry cards) ---------- */
    .costomized-head {
        min-width: 0;                   /* was 320px: wider than a 320px phone once padded */
        max-width: 100%;
        box-sizing: border-box;
    }

    .managed .costomized-head,
    .technologies .costomized-head {
        padding: 0 18px;
    }

    .managed .costomized-head h2,
    .technologies .costomized-head h2 {
        font-size: clamp(1.4rem, 6vw, 1.8rem);
    }

    .managed .hover-card,
    .managed .hover-card-first,
    .managed .hover-card-overlay {
        height: 340px;
    }

    .managed .hover-card {
        margin: 0;
    }

    .managed .hover-card h2 {
        font-size: 2rem;
    }

    .managed .hover-card p {
        font-size: 0.92rem;
        line-height: 1.55;
    }

    /* the side arrows sit on top of the card text on a phone — swipe instead */
    .managed .swiper-button-next,
    .managed .swiper-button-prev {
        display: none;
    }

    /* ---------- Technologies, CTA, testimonials ---------- */
    .technologies .swiper-slide img {
        max-height: 56px;
        width: auto;
        margin: 0 auto;
        display: block;
    }

    .cta .cta-width {
        width: 100%;
        padding: 0 18px;
        box-sizing: border-box;
        text-align: center;
    }

    .cta .cta-width h2 {
        font-size: clamp(1.4rem, 6vw, 1.8rem);
    }

    .testimonial .testimonial-head {
        padding: 0 18px;
    }

    .testimonial .testimonial-bg {
        padding: 20px 18px;
        box-sizing: border-box;
    }

    /* ---------- News ---------- */
    .madds-news__head {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .madds-news__feature {
        min-height: 300px;
    }
}

/* very small phones */
@media (max-width: 340px) {

    .madds-trusted__stats,
    .madds-trusted__badges {
        grid-template-columns: 1fr !important;
    }

    .main-parallax .wrapper {
        padding: 0 12px;
    }

    .about-section .ag-stats {
        grid-template-columns: 1fr 1fr;
    }
}