/*
 * Shared responsive layer.
 * Loaded after page-specific styles so every route has the same mobile rules.
 */

@media (max-width: 1200px) {
    .container {
        width: 100%;
        padding-inline: clamp(18px, 4vw, 36px);
    }
}

@media (max-width: 820px) {
    html {
        scroll-padding-top: calc(var(--nav-height) + 16px);
    }

    body {
        min-width: 0;
        background-attachment: scroll;
        overflow-x: clip;
    }

    main,
    section,
    article,
    aside,
    form,
    .container,
    .section-header,
    .hero-container,
    .hero-content {
        min-width: 0;
    }

    .container {
        padding-inline: 18px;
    }

    .section,
    .services-overview,
    .solutions-overview,
    .products-overview {
        padding-block: clamp(52px, 10vw, 72px);
    }

    .header-title,
    .title-row {
        max-width: 100%;
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
    }

    .section-header h1,
    .section-header h2,
    .hero-container h1 {
        max-width: 100%;
        overflow-wrap: anywhere;
        text-wrap: balance;
    }

    .section-header > h2 {
        font-size: clamp(1.9rem, 8vw, 2.7rem) !important;
    }

    .subtitle,
    .section-subtitle {
        width: 100%;
        max-width: 42rem;
        margin-inline: auto;
        margin-bottom: clamp(2rem, 8vw, 3rem);
        padding-inline: 0;
    }

    .subtitle h3,
    .section-subtitle {
        font-size: clamp(0.98rem, 4vw, 1.08rem);
        line-height: 1.65;
    }

    .side-image,
    .mline.left,
    .mline.right {
        max-width: min(42vw, 170px);
        height: auto;
        float: none;
    }

    .buttons-row,
    .products-hero-actions,
    .about-actions,
    .btn-container,
    .parent-container {
        width: 100%;
        flex-wrap: wrap;
        justify-content: center;
    }

    .cards-grid,
    .features-grid,
    .services-grid,
    .solutions-grid,
    .solutions-cards-grid,
    .values-grid,
    .about-capability-grid,
    .products-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .card,
    .feature,
    .service-card,
    .solution-card,
    .solution-category,
    .value-card,
    .product-card,
    .about-capability-card,
    .about-cta-card,
    .contact-info,
    .contact-form {
        max-width: 100%;
        overflow-wrap: anywhere;
    }

    .service-card,
    .solution-category,
    .value-card {
        padding: clamp(1.35rem, 6vw, 2rem);
    }

    .products-page .product-category {
        padding: clamp(1.25rem, 5vw, 2rem);
    }

    .products-page .product-card,
    .products-page #software .product-card {
        min-height: 0;
    }

    .contact-wrapper,
    .contact-methods,
    .form-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    input,
    select,
    textarea,
    button {
        max-width: 100%;
        font-size: 1rem;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        width: 100%;
    }

    #main .icon img {
        margin-inline: auto;
    }

    #main .step {
        width: 100%;
    }

    .footer-container {
        width: 100%;
    }

    .footer-left,
    .footer-center,
    .footer-location {
        min-width: 0;
    }
}

/* Full-height mobile navigation, visually tied to the homepage Solutions section. */
@media (max-width: 768px) {
    .navbar {
        z-index: 3000;
    }

    .nav-logo,
    .hamburger {
        position: relative;
        z-index: 1;
    }

    .nav-links,
    .nav-links.active {
        z-index: 0;
        visibility: hidden;
        position: fixed;
        top: var(--nav-height);
        right: 0;
        bottom: 0;
        left: 0;
        display: flex;
        width: 100%;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        gap: 0;
        padding: clamp(2rem, 8vh, 5rem) clamp(1.25rem, 7vw, 4rem);
        background:
            radial-gradient(circle at 96% 3%, rgb(var(--color-accent-rgb) / 0.28) 0, rgb(var(--color-darker-rgb) / 0.14) 18rem, transparent 36rem),
            radial-gradient(circle at 4% 94%, rgb(var(--color-secondary-rgb) / 0.16), transparent 28rem),
            var(--color-night);
        box-shadow: none;
        opacity: 0;
        transform: translateY(-14px);
        transition: opacity 220ms ease, transform 220ms ease, visibility 220ms ease;
        pointer-events: none;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .nav-links.mobile-active {
        visibility: visible;
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
    }

    .nav-links li {
        width: min(100%, 560px);
        padding: 0;
        border-bottom: 1px solid rgb(var(--color-white-rgb) / 0.13);
        opacity: 0;
        text-align: center;
        transform: translateY(10px);
        transition: opacity 180ms ease, transform 180ms ease;
    }

    .nav-links .mobile-home-link {
        display: block;
    }

    .nav-links.mobile-active li {
        opacity: 1;
        transform: translateY(0);
    }

    .nav-links.mobile-active li:nth-child(2) {
        transition-delay: 35ms;
    }

    .nav-links.mobile-active li:nth-child(3) {
        transition-delay: 70ms;
    }

    .nav-links.mobile-active li:nth-child(4) {
        transition-delay: 105ms;
    }

    .nav-links.mobile-active li:nth-child(5) {
        transition-delay: 140ms;
    }

    .nav-links.mobile-active li:nth-child(6) {
        transition-delay: 175ms;
    }

    .nav-links a {
        display: block;
        width: 100%;
        padding: clamp(0.8rem, 2.6vh, 1.4rem) 0.35rem;
        color: var(--color-white);
        font-size: clamp(1.75rem, 8vw, 3.5rem);
        font-weight: 600;
        line-height: 1.08;
        letter-spacing: -0.035em;
        text-align: center;
    }

    .nav-links a::after {
        right: 25%;
        bottom: 0.45rem;
        left: 25%;
        background: var(--color-secondary-bright);
    }

    .nav-links a:is(:hover, :focus-visible) {
        color: var(--color-white);
        outline: none;
        transform: scale(1.05);
    }

    .nav-links a.active {
        color: var(--color-primary-soft);
    }

    body.menu-open .navbar {
        border-bottom-color: rgb(var(--color-accent-rgb) / 0.72);
    }
}

@media (max-width: 768px) and (orientation: landscape) {
    .nav-links,
    .nav-links.active {
        justify-content: flex-start;
        padding-block: 1.25rem;
    }

    .nav-links a {
        padding-block: 0.7rem;
        font-size: clamp(1.45rem, 6vh, 2rem);
    }
}

@media (max-width: 600px) {
    :root {
        --mobile-gutter: 16px;
    }

    .container,
    #main > .container,
    .about-hero-grid,
    .about-story-grid,
    .about-mission-inner,
    .contact-container,
    .products-page .products-overview > .container,
    .solutions-overview > .container {
        padding-inline: var(--mobile-gutter);
    }

    .hero-section,
    .products-page .products-hero,
    .about-hero {
        min-height: min(600px, calc(100svh - var(--nav-height)));
        padding-block: clamp(58px, 13vw, 82px);
    }

    #home-hero {
        min-height: calc(100svh - var(--nav-height)) !important;
    }

    .home-hero .hero-logo-emphasis {
        width: min(100%, 560px);
    }

    .home-hero h1 {
        font-size: clamp(2rem, 10vw, 3rem);
    }

    .loader-logo {
        width: min(78vw, 360px);
    }

    .buttons-row,
    .products-hero-actions,
    .about-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .products-page .products-hero-actions {
        align-items: center;
    }

    .buttons-row > :is(a, button),
    .products-hero-actions > :is(a, button),
    .about-actions > :is(a, button),
    .btn-container > :is(a, button),
    .parent-container > :is(a, button),
    .about-cta-card > :is(a, button) {
        width: min(100%, 340px);
        margin-inline: auto;
        text-align: center;
    }

    .side-card-content,
    .solutions-section .solution-card-content {
        padding: 1.5rem 1.25rem 1.75rem;
    }

    .side-card .side-card-media,
    .side-card:nth-child(odd) .side-card-media {
        min-height: clamp(210px, 62vw, 310px);
    }

    .services-section .service-row-card {
        grid-template-columns: minmax(0, 1fr) 40px;
        padding: 1rem;
    }

    .services-section .service-row-card > img {
        grid-column: 1 / -1;
        width: 100%;
        height: clamp(170px, 52vw, 240px);
    }

    .solutions-section .solution-card {
        min-height: clamp(440px, 132vw, 540px);
    }

    .process-section .step {
        grid-template-columns: 42px minmax(0, 1fr);
    }

    .process-section .step-card {
        width: 100%;
    }

    .about-hero-visual img,
    .about-story-image img {
        max-height: 420px;
        object-fit: cover;
    }

    .about-cta-card,
    .products-page .about-cta-card {
        gap: 1.5rem;
        padding: 1.5rem;
    }

    .footer-container {
        padding: 36px var(--mobile-gutter) 24px;
    }

    .footer-location {
        align-items: stretch;
        flex-direction: column;
        gap: 14px;
        padding: 14px;
    }

    .footer-address {
        flex-basis: auto;
        align-items: flex-start;
    }

    .footer-location iframe {
        width: 100%;
        min-height: 240px;
        flex-basis: 240px;
    }
}

@media (max-width: 390px) {
    :root {
        --mobile-gutter: 14px;
    }

    .section-header > h2 {
        font-size: clamp(1.7rem, 9vw, 2.15rem) !important;
    }

    .card,
    .feature,
    .service-card,
    .solution-category,
    .value-card,
    .product-card,
    .contact-info,
    .contact-form {
        padding-inline: 1.1rem;
    }

    .navbar .container {
        padding-inline: 14px;
    }

    .nav-links,
    .nav-links.active {
        padding-inline: 1rem;
    }

    .footer-office-row {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (orientation: landscape) and (max-height: 520px) and (max-width: 900px) {
    .hero-section,
    .products-page .products-hero,
    .about-hero,
    #home-hero {
        min-height: auto !important;
        padding-block: 48px;
    }
}
