/*
 * Final responsive layer for public pages.
 * Loaded after the core stylesheet so legacy page-specific styles remain
 * usable without compromising small-screen layouts.
 */

:root {
    --responsive-page-gutter: clamp(1rem, 4vw, 1.5rem);
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    min-width: 0;
    overflow-x: hidden;
}

main,
.container,
.container-fluid,
.row > [class*="col-"] {
    min-width: 0;
}

img,
svg,
video,
canvas,
iframe {
    max-width: 100%;
}

img,
video {
    height: auto;
}

iframe {
    display: block;
    width: 100%;
}

pre,
code,
table,
svg {
    overflow-wrap: anywhere;
}

.table-responsive {
    max-width: 100%;
    overflow-x: auto;
}

.row {
    max-width: 100%;
}

.btn,
.nav-link,
.dropdown-item,
.form-control,
.form-select {
    overflow-wrap: anywhere;
}

.table-responsive {
    -webkit-overflow-scrolling: touch;
    border-radius: .5rem;
}

.table-responsive > .table {
    margin-bottom: 0;
}

.blog-content,
.project-info,
.recent-post > div:last-child,
.footer-contact,
.footer-brand,
.insight-card__content {
    min-width: 0;
}

.blog-content pre,
.blog-content table {
    max-width: 100%;
    overflow-x: auto;
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
    justify-content: center;
}

.project-tech .badge {
    margin: 0 !important;
    white-space: normal;
}

@media (min-width: 576px) and (max-width: 991.98px) {
    /* The four statistics used across legacy pages remain comfortably two-up. */
    .bg-secondary .row > .col-lg-3 {
        flex: 0 0 auto;
        width: 50%;
    }
}

@media (max-width: 991.98px) {
    .blog-hero {
        padding: 5.5rem 0 3.5rem !important;
    }

    .blog-hero .display-5 {
        font-size: clamp(2rem, 6.5vw, 3rem);
    }

    .blog-hero .row.text-center {
        row-gap: .55rem;
    }

    .blog-content h1 {
        font-size: clamp(1.85rem, 5.6vw, 2.4rem);
    }

    .blog-content h2 {
        font-size: clamp(1.45rem, 4.8vw, 1.9rem);
    }
}

@media (max-width: 767.98px) {
    /* Restore Bootstrap's expected collapsed state; legacy rules forced the
       navigation and its service submenu open on every mobile page load. */
    .site-header .navbar-collapse.collapse:not(.show) {
        display: none !important;
    }

    .site-header .navbar-collapse.collapse.show {
        display: block !important;
    }

    .site-header .navbar .nav-item .dropdown-menu:not(.show) {
        display: none !important;
    }

    .site-header .navbar .nav-item .dropdown-menu.show {
        display: block !important;
    }

    .container {
        padding-right: var(--responsive-page-gutter);
        padding-left: var(--responsive-page-gutter);
    }

    .container-fluid.py-5,
    .container-fluid.services.py-5 {
        padding-top: 3.5rem !important;
        padding-bottom: 3.5rem !important;
    }

    .container-fluid.py-5.my-5 {
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }

    .container-fluid.py-5 > .container.py-5 {
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }

    .bg-light.p-5,
    .bg-white.p-5 {
        padding: 1.35rem !important;
    }

    .bg-secondary .counter {
        align-items: flex-start;
        margin-bottom: 1.15rem;
    }

    .bg-secondary .counter .counter-value {
        flex: 0 0 auto;
        font-size: clamp(1.8rem, 8vw, 2.35rem);
    }

    .bg-secondary .counter h5 {
        font-size: .92rem;
        line-height: 1.35;
    }

    .services-inner,
    .row.g-5 {
        --bs-gutter-y: 2rem;
    }

    .services-content .fa-7x,
    .services-content .fas.fa-7x {
        font-size: 3.4rem;
    }

    .service-item,
    .tech-item,
    .platform-item,
    .process-item,
    .contact-method,
    .job-card,
    .project-item {
        height: 100%;
    }

    .service-icon,
    .tech-icon,
    .platform-icon,
    .contact-icon,
    .icon-box {
        display: inline-grid !important;
        place-items: center;
        line-height: 1 !important;
    }

    #serviceTabs {
        display: flex;
        flex-wrap: nowrap;
        justify-content: flex-start;
        gap: .55rem;
        padding: .15rem .15rem .8rem;
        margin-right: calc(var(--responsive-page-gutter) * -1);
        margin-left: calc(var(--responsive-page-gutter) * -1);
        overflow-x: auto;
        scrollbar-width: thin;
    }

    #serviceTabs .nav-link {
        flex: 0 0 auto;
        min-height: 42px;
        margin: 0 !important;
        padding: .55rem .9rem !important;
        white-space: nowrap;
    }

    #serviceTable {
        min-width: 720px;
    }

    #serviceTable th,
    #serviceTable td {
        padding: .7rem .65rem;
        font-size: .82rem;
    }

    .project-img img {
        height: clamp(205px, 62vw, 285px) !important;
    }

    /* Hover-only project details stay visible and usable on touch devices. */
    @media (hover: none), (pointer: coarse) {
        .project-content {
            opacity: 1 !important;
            background: linear-gradient(180deg, rgba(1, 25, 87, .08), rgba(1, 25, 87, .86)) !important;
        }
    }

    .project-content > a {
        max-width: calc(100% - 1.5rem);
        padding: .9rem;
    }

    .project-info .d-flex.justify-content-between,
    .job-card .d-flex.justify-content-between,
    .related-blog-card .card-footer .d-flex {
        align-items: flex-start !important;
        flex-wrap: wrap;
        gap: .55rem;
    }

    .map-container iframe {
        min-height: 240px;
    }

    .modal-dialog {
        width: auto;
        max-width: calc(100% - 1.5rem);
        margin: .75rem auto;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }

    .modal-title {
        overflow-wrap: anywhere;
    }

    #contactForm button[type="submit"],
    #serviceEnquiryForm button[type="submit"],
    #jobApplicationForm .mt-4 {
        width: 100%;
    }

    #jobApplicationForm .mt-4 {
        display: grid;
        gap: .6rem;
    }

    #jobApplicationForm .mt-4 .btn {
        width: 100%;
    }

    .contact-method .btn-sm,
    .contact-method button.btn-sm,
    .form-control,
    .form-select {
        min-height: 44px;
    }

    textarea.form-control {
        min-height: 120px;
    }

    .blog-hero {
        padding: 4.5rem 0 2.8rem !important;
    }

    .blog-hero .breadcrumb {
        display: inline-flex;
        max-width: 100%;
        padding: .65rem .9rem;
        overflow-wrap: anywhere;
    }

    .blog-hero .breadcrumb-item,
    .blog-hero .breadcrumb-item a {
        font-size: .78rem;
    }

    .blog-content {
        font-size: 1rem !important;
        line-height: 1.72 !important;
    }

    .blog-content h1,
    .blog-content h2,
    .blog-content h3,
    .blog-content h4 {
        margin-top: 1.65rem;
    }

    .blog-content h2 {
        margin-left: 0 !important;
        padding-left: .75rem !important;
    }

    .blog-content blockquote,
    .author-card,
    .blog-meta,
    .blog-stats,
    .sidebar-widget,
    .table-of-contents {
        padding: 1.2rem !important;
    }

    .blog-content blockquote {
        margin: 1.5rem 0;
    }

    .social-share {
        gap: .6rem;
    }

    .social-share > span {
        flex-basis: 100%;
        margin-right: 0 !important;
    }

    .social-share .btn {
        flex: 1 1 calc(50% - .6rem);
        padding: .65rem .8rem;
    }

    .gallery-container {
        padding: 2.8rem 0 !important;
    }

    .lightbox {
        width: calc(100% - 1.5rem);
        max-width: 100% !important;
    }

    .lightbox .nav-btn {
        padding: .45rem .7rem;
        font-size: 1rem;
    }

    .quick-contact {
        bottom: calc(64px + env(safe-area-inset-bottom));
    }

    .back-to-top {
        bottom: calc(12px + env(safe-area-inset-bottom));
    }
}

@media (max-width: 575.98px) {
    .page-header .container,
    .blog-hero .container {
        padding-right: var(--responsive-page-gutter);
        padding-left: var(--responsive-page-gutter);
    }

    .page-header .display-2,
    .blog-hero .display-5 {
        overflow-wrap: anywhere;
    }

    .bg-secondary .counter {
        margin-bottom: .9rem;
    }

    .bg-secondary .row > .col-lg-3:last-child .counter {
        margin-bottom: 0;
    }

    .project-info .d-flex.justify-content-between,
    .job-card .d-flex.justify-content-between,
    .related-blog-card .card-footer .d-flex {
        flex-direction: column;
    }

    .author-card .row {
        justify-content: center;
        text-align: center;
    }

    .author-card .col-auto {
        width: 100%;
    }

    .author-card .col {
        flex-basis: 100%;
        width: 100%;
        margin-top: .9rem;
    }

    .recent-post {
        align-items: flex-start;
        padding: .75rem !important;
    }

    .recent-post-img {
        width: 56px !important;
        height: 56px !important;
        margin-right: .8rem !important;
    }

    .category-list a {
        gap: .6rem;
        padding: .7rem .8rem !important;
    }

    .modal-footer {
        align-items: stretch;
        flex-direction: column;
        gap: .55rem;
    }

    .modal-footer .btn,
    .modal-footer a.btn {
        width: 100%;
    }
}

@media (max-width: 419.98px) {
    .bg-light.p-5,
    .bg-white.p-5 {
        padding: 1.1rem !important;
    }

    .service-icon,
    .tech-icon,
    .platform-icon,
    .contact-icon,
    .icon-box {
        width: 64px !important;
        height: 64px !important;
        line-height: 1 !important;
    }

    .process-number {
        width: 52px !important;
        height: 52px !important;
        line-height: 52px !important;
    }

    .social-share .btn {
        flex-basis: 100%;
    }

    .blog-content pre {
        padding: 1rem !important;
        font-size: .8rem;
    }
}

/* Final responsive overrides. */

html {
    scroll-behavior: smooth;
}

body {
    overflow-wrap: break-word;
}

a,
button,
input,
select,
textarea {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

:focus-visible {
    outline: 3px solid rgba(8, 120, 254, .5);
    outline-offset: 3px;
}

[id] {
    scroll-margin-top: 6.5rem;
}

.card,
.accordion,
.accordion-item,
.modal-content,
.dropdown-menu,
.form-floating,
.form-check {
    min-width: 0;
}

.site-footer a,
.footer-contact__link,
.footer-project-link,
.breadcrumb-item,
.breadcrumb-item a,
.btn,
.badge {
    overflow-wrap: anywhere;
}

@media (max-width: 991.98px) {
    /* Restore Bootstrap's collapse state at every mobile-nav breakpoint. */
    .site-header .navbar-collapse.collapse:not(.show) {
        display: none !important;
    }

    .site-header .navbar-collapse.collapse.show {
        display: block !important;
    }

    .site-header .navbar .nav-item .dropdown-menu:not(.show) {
        display: none !important;
    }

    .site-header .navbar .nav-item .dropdown-menu.show {
        display: block !important;
    }

    .site-header .navbar-collapse {
        max-height: calc(100dvh - 82px);
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .site-header .navbar .navbar-nav .nav-link.dropdown-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .site-header .navbar .navbar-nav .nav-link,
    .site-header .dropdown-item,
    .nav-cta {
        min-height: 44px;
    }

    .page-header .breadcrumb {
        justify-content: center;
    }

    .footer-bottom {
        align-items: flex-start;
        flex-wrap: wrap;
    }
}

@media (max-width: 767.98px) {
    /* Prevent iOS Safari from zooming when a form field receives focus. */
    input,
    select,
    textarea {
        font-size: 16px !important;
    }

    .form-floating > label {
        max-width: calc(100% - 1rem);
        overflow: hidden;
        font-size: .82rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .form-check {
        display: flex;
        align-items: flex-start;
        gap: .55rem;
    }

    .form-check .form-check-input {
        flex: 0 0 auto;
        margin: .25rem 0 0;
    }

    .form-check .form-check-label {
        min-width: 0;
    }

    .bg-secondary .counter {
        gap: .7rem;
    }

    .bg-secondary .counter .counter-value {
        min-width: 2.1rem;
        margin-right: 0 !important;
    }

    .bg-secondary .counter h5 {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .table-responsive {
        margin-right: calc(var(--responsive-page-gutter) * -1);
        margin-left: calc(var(--responsive-page-gutter) * -1);
        padding-right: var(--responsive-page-gutter);
        padding-left: var(--responsive-page-gutter);
        border-radius: 0;
    }

    .table-responsive .btn,
    #serviceTable .btn {
        min-height: 40px;
        white-space: nowrap;
    }

    .modal {
        padding-right: 0 !important;
    }

    .modal-body {
        overflow-wrap: anywhere;
    }

    .site-footer {
        padding-top: 3.5rem;
        padding-bottom: calc(1.25rem + env(safe-area-inset-bottom));
    }

    .footer-social a {
        width: 42px;
        height: 42px;
        font-size: .9rem;
    }

    .footer-bottom {
        flex-direction: column;
        gap: .45rem;
        padding-top: 1.2rem;
    }

    .quick-contact__item,
    .quick-contact__item i,
    .back-to-top {
        width: 44px;
        min-width: 44px;
        height: 44px;
    }
}

.back-to-top {
    display: grid !important;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
}

.back-to-top.is-visible {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

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

    .back-to-top {
        transition: none;
    }
}

/* Lighter process section: the previous solid navy panel dominated the home
   page. These colours retain the blue brand accent while giving the content
   more breathing room. */
.process-section {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 88% 6%, rgba(72, 152, 255, .16), transparent 27rem),
        linear-gradient(145deg, #f8fbff 0%, #eef6ff 100%);
}

.process-section .eyebrow--light {
    color: #0878fe;
}

.process-section .section-title--light {
    color: #0a2858;
}

.process-section .row > div:last-child p {
    color: #58708f;
}

.process-section .process-grid {
    gap: 1rem;
    border: 0;
}

.process-section .process-card {
    min-height: 220px;
    padding: 1.8rem;
    background: rgba(255, 255, 255, .92);
    border: 1px solid #d7e6fa;
    border-radius: 14px;
    box-shadow: 0 12px 28px rgba(12, 56, 118, .07);
    transition: border-color .25s ease, box-shadow .25s ease, transform .25s ease;
}

.process-section .process-card::before {
    background: rgba(8, 120, 254, .11);
}

.process-section .process-card span {
    color: #0878fe;
}

.process-section .process-card h3 {
    color: #0a2858;
}

.process-section .process-card p {
    color: #5d718e;
}

.process-section .process-card:hover {
    background: #fff;
    border-color: rgba(8, 120, 254, .46);
    box-shadow: 0 18px 36px rgba(12, 56, 118, .13);
    transform: translateY(-5px);
}

@media (max-width: 767.98px) {
    .process-section .process-grid {
        gap: .8rem;
    }

    .process-section .process-card {
        min-height: 0;
        margin-bottom: 0;
        padding: 1.25rem;
        background: #fff;
        border-color: #dbe8f8;
    }
}
