/**
 * Mobile & tablet responsive polish (≤900px primary, ≤479px small phones)
 */

@media (max-width: 900px) {
    html {
        overflow-x: clip;
    }

    body {
        overflow-x: clip;
    }

    :root {
        --container: 100%;
        --gutter: 1rem;
        --section-y: clamp(2rem, 6vw, 2.75rem);
    }

    .container {
        width: 100%;
        max-width: 100%;
        padding-left: var(--gutter);
        padding-right: var(--gutter);
    }

    section {
        padding: var(--section-y) 0;
    }

    /* --- Top bar: one row — contact left, language right --- */
    .topbar {
        font-size: 0.8rem;
    }

    .topbar-inner {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        column-gap: 0.75rem;
        row-gap: 0;
        padding: 0.5rem 0.85rem;
        min-height: 0;
        white-space: normal;
    }

    .topbar-tagline {
        display: none;
    }

    .topbar-contact {
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        gap: 0.5rem 0.85rem;
        grid-column: 1;
        justify-self: start;
        min-width: 0;
        margin: 0;
        padding-left: 0.15rem;
    }

    .topbar-contact li {
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
        font-size: 0.78rem;
        line-height: 1.2;
        min-width: 0;
    }

    .topbar-location {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: min(11rem, 38vw);
    }

    .topbar-email a {
        gap: 0.35rem;
        white-space: nowrap;
    }

    .topbar-email-text {
        display: none;
    }

    .topbar-email-short {
        display: inline;
        font-size: 0.78rem;
        font-weight: 500;
    }

    .topbar-right {
        grid-column: 2;
        justify-self: end;
        flex-shrink: 0;
        padding-right: 0.15rem;
    }

    .lang-trigger {
        min-height: auto;
        padding: 0.2rem 0;
        font-size: 0.78rem;
    }

    /* --- Header & navigation --- */
    .main-nav-bar {
        padding: 0.35rem 0;
    }

    .main-nav-bar .nav-shell.container {
        padding-top: 0.15rem;
        padding-bottom: 0.15rem;
        padding-left: max(var(--gutter), 1.1rem);
        padding-right: max(var(--gutter), 1.1rem);
    }

    .nav-shell {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
    }

    .brand {
        flex: 1 1 auto;
        min-width: 0;
        max-width: none;
    }

    .brand-logo {
        height: clamp(58px, 16vw, 68px);
        max-width: min(260px, 78vw);
    }

    .nav-toggle {
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
        margin-left: auto;
        margin-right: 0.15rem;
        grid-column: unset;
    }

    .btn-header-cta--desktop {
        display: none;
    }

    .main-nav-bar {
        position: relative;
    }

    .nav-shell {
        position: relative;
        z-index: 1002;
    }

    /* Full-screen mobile drawer (page does not scroll behind it) */
    .mobile-menu {
        position: fixed;
        inset: 0;
        z-index: 1000;
        visibility: hidden;
        pointer-events: none;
    }

    .mobile-menu.is-open {
        visibility: visible;
        pointer-events: auto;
    }

    .mobile-menu-backdrop {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        top: var(--mobile-nav-top, 7.5rem);
        margin: 0;
        padding: 0;
        border: 0;
        background: rgba(4, 8, 16, 0.65);
        opacity: 0;
        cursor: pointer;
        transition: opacity 0.25s ease;
    }

    .mobile-menu.is-open .mobile-menu-backdrop {
        opacity: 1;
    }

    .mobile-menu-panel {
        position: absolute;
        left: 0;
        right: 0;
        top: var(--mobile-nav-top, 7.5rem);
        bottom: 0;
        background: var(--header-bg);
        border-top: 1px solid var(--header-border);
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        transform: translateY(-12px);
        opacity: 0;
        transition: transform 0.28s ease, opacity 0.28s ease;
    }

    .mobile-menu.is-open .mobile-menu-panel {
        transform: translateY(0);
        opacity: 1;
    }

    .site-nav {
        position: static;
        width: 100%;
        margin: 0;
        padding: 1rem max(var(--gutter), 1.1rem) 1.5rem;
        opacity: 1;
        visibility: visible;
        transform: none;
    }

    .site-nav ul {
        flex-direction: column;
        align-items: stretch;
        gap: 0.15rem;
    }

    .site-nav a {
        display: flex;
        align-items: center;
        min-height: 48px;
        padding: 0.65rem 0.5rem;
        font-size: 1rem;
        white-space: normal;
        text-transform: none;
    }

    .site-nav a::after {
        display: none;
    }

    .nav-cta-mobile {
        display: list-item;
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        border-top: 1px solid var(--header-border);
    }

    .nav-cta-mobile .btn-header-cta {
        display: flex;
        width: 100%;
        justify-content: center;
        padding: 0.85rem 1rem;
        font-size: 0.8rem;
        white-space: normal;
        text-align: center;
    }

    .nav-toggle.is-active span:nth-child(1) {
        transform: translateY(6px) rotate(45deg);
    }

    .nav-toggle.is-active span:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle.is-active span:nth-child(3) {
        transform: translateY(-6px) rotate(-45deg);
    }

    .nav-toggle span {
        transition: transform 0.2s ease, opacity 0.2s ease;
    }

    body.nav-open {
        overflow: hidden;
        touch-action: none;
    }

    /* --- Hero (home) --- */
    .hero-shell .hero-carousel {
        height: clamp(240px, 48vh, 340px);
        max-height: 340px;
        min-height: 220px;
    }

    .hero-content {
        padding: 0 0.75rem;
        justify-content: flex-end;
        padding-bottom: 1.25rem;
    }

    .hero-shell .hero-title,
    .hero-title {
        font-size: clamp(1.45rem, 7vw, 2.15rem);
        line-height: 1.12;
        word-wrap: break-word;
        hyphens: auto;
    }

    .hero-shell .hero-subtitle,
    .hero-shell .hero p.hero-subtitle,
    .hero-subtitle {
        font-size: 0.88rem;
        line-height: 1.4;
        max-width: 100%;
        padding: 0 0.25rem;
    }

    .hero-shell .hero-actions,
    .hero-actions {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        max-width: 20rem;
        margin-top: 0.65rem;
        gap: 0.5rem;
    }

    .hero-shell .hero-actions .btn,
    .hero-actions .btn {
        width: 100%;
        justify-content: center;
        text-align: center;
        padding: 0.7rem 1rem;
    }

    /* --- Page banners --- */
    .page-banner {
        height: auto;
        min-height: clamp(220px, 38vh, 300px);
        max-height: none;
    }

    .page-banner-inner {
        padding: 1.75rem 0;
        align-items: center;
        text-align: center;
    }

    .page-banner-title {
        font-size: clamp(1.35rem, 6.2vw, 1.95rem);
        line-height: 1.15;
        align-items: center;
    }

    .page-banner-title-line {
        text-wrap: balance;
    }

    /* --- Intro strips --- */
    .services-intro-text,
    .industries-intro-text,
    .contact-intro-text {
        font-size: 0.95rem;
        line-height: 1.65;
        text-align: left;
    }

    /* --- Grids → single column --- */
    .services-showcase-grid,
    .cards-3,
    .cards-4,
    .commitment-grid,
    .stats,
    .contact-grid,
    .feature-project,
    .company-intro .feature-project,
    .hero-grid,
    .home-cta-inner {
        grid-template-columns: 1fr;
    }

    /* --- Service cards (home) --- */
    .service-card-title {
        font-size: 0.95rem;
    }

    .photo-card--industry .photo-card-body h3 {
        font-size: 0.92rem;
        line-height: 1.3;
    }

    /* --- Why ATS --- */
    .why-ats-card {
        grid-template-columns: 1fr;
    }

    .why-ats-card-media {
        min-height: 200px;
        aspect-ratio: 16 / 9;
    }

    .why-ats-card-body {
        padding: 1.35rem 1.15rem;
        text-align: left;
        align-items: flex-start;
    }

    .why-ats-card-heading {
        flex-direction: row;
    }

    .why-ats-card-body h3 {
        font-size: 1.15rem;
        letter-spacing: 0.03em;
    }

    .why-ats-card-body p {
        font-size: 0.92rem;
    }

    /* --- Service / industry detail pages --- */
    .service-detail-card,
    .service-detail-card--reverse,
    .industry-detail-card,
    .industry-detail-card--reverse {
        grid-template-columns: 1fr;
    }

    .service-detail-card--reverse .service-detail-slider,
    .service-detail-card--reverse .service-detail-body,
    .industry-detail-card--reverse .industry-detail-slider,
    .industry-detail-card--reverse .industry-detail-body {
        order: unset;
    }

    .industry-detail-slider,
    .service-detail-slider {
        min-height: 200px;
    }

    .industry-detail-slide img,
    .service-detail-slider .industry-detail-slide img {
        min-height: 200px;
    }

    .service-detail-body {
        padding: 1.35rem 1.15rem;
    }

    .service-detail-title {
        font-size: 1.2rem;
    }

    .service-capabilities li {
        font-size: 0.88rem;
    }

    .service-detail-btn {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    /* --- About --- */
    .about-split,
    .about-commitment-layout {
        grid-template-columns: 1fr;
    }

    .about-commitment-photo {
        position: static;
        order: -1;
    }

    .about-commitment-head {
        text-align: left;
    }

    .about-card-accent--center {
        margin-left: 0;
        margin-right: auto;
    }

    .about-split-photo img {
        min-height: 200px;
    }

    /* --- Contact --- */
    .contact-grid {
        gap: 1rem;
    }

    .contact-form-card {
        order: 1;
    }

    .contact-sidebar {
        order: 2;
    }

    .contact-map {
        min-height: 200px;
    }

    .contact-details-card {
        padding: 1.25rem 1.1rem;
    }

    .contact-form-card input,
    .contact-form-card select,
    .contact-form-card textarea {
        font-size: 16px;
    }

    /* --- Company intro / CTA --- */
    .company-intro-tagline {
        max-width: none;
        text-align: left;
        font-size: clamp(1.2rem, 5vw, 1.65rem);
    }

    .company-intro-text {
        text-align: left;
    }

    .home-cta-copy {
        padding: 1.25rem;
    }

    .media-frame {
        min-height: 200px;
    }

    .media-frame img {
        min-height: 200px;
    }

    /* --- Section headings --- */
    h2 {
        font-size: clamp(1.35rem, 5.5vw, 1.85rem);
    }

    .section-intro {
        font-size: 0.95rem;
        line-height: 1.65;
    }

    /* --- Buttons --- */
    .btn,
    .btn-header-cta,
    .lang-trigger {
        min-height: 44px;
    }

    .section-cta-link .btn {
        width: 100%;
        max-width: 20rem;
    }

    .services-cta-inner .btn {
        width: 100%;
        max-width: 18rem;
    }

    /* --- Footer: compact; Quick Links + Core Services side by side --- */
    .site-footer {
        padding-top: 1rem;
        margin-top: 0.85rem;
    }

    .footer-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        row-gap: 0.35rem;
        column-gap: 0.85rem;
        align-items: start;
    }

    .footer-col--about {
        grid-column: 1 / -1;
        margin-bottom: 0.1rem;
    }

    .footer-col:nth-child(2),
    .footer-col:nth-child(3) {
        margin-bottom: 0;
    }

    .footer-col:nth-child(4) {
        grid-column: 1 / -1;
        text-align: center;
        margin-top: -0.35rem;
        padding-top: 0;
    }

    .footer-col:nth-child(4) h2 {
        text-align: center;
        margin-top: 0;
        margin-bottom: 0.2rem;
    }

    .footer-list--contact {
        justify-items: center;
        gap: 0.12rem;
    }

    .footer-list--contact li {
        align-items: center;
        text-align: center;
        gap: 0.08rem;
    }

    .footer-contact-label {
        font-weight: 400;
        text-transform: none;
        letter-spacing: 0;
        font-size: 0.8rem;
        color: rgba(148, 163, 184, 0.9);
    }

    .footer-list--contact span,
    .footer-list--contact a {
        font-size: 0.82rem;
        line-height: 1.35;
        font-weight: 400;
        text-transform: none;
        color: var(--text-secondary);
    }

    .footer-list--contact a:hover {
        color: var(--orange-bright);
    }

    .footer-col h2 {
        margin: 0 0 0.25rem;
        font-size: 0.88rem;
    }

    .footer-brand {
        margin-bottom: 0.3rem;
    }

    .footer-tagline {
        margin-bottom: 0.2rem;
        font-size: 0.8rem;
    }

    .footer-about-text {
        max-width: none;
        margin-bottom: 0;
        font-size: 0.84rem;
        line-height: 1.45;
    }

    .footer-logo {
        height: clamp(64px, 16vw, 82px);
        max-width: min(300px, 82vw);
    }

    .footer-list {
        gap: 0.2rem;
    }

    .footer-list a {
        font-size: 0.82rem;
        line-height: 1.35;
    }

    .footer-bottom {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        gap: 0.25rem;
        margin-top: 0.45rem;
        padding: 0.45rem 0.85rem 0.7rem;
        font-size: 0.78rem;
    }

    .footer-copyright,
    .footer-credit {
        margin-left: 0;
        text-align: center;
        width: 100%;
    }

    .footer-list--contact a {
        word-break: break-word;
    }

    /* --- Legacy inner pages (trs, etc.) --- */
    .hero-grid {
        gap: 1.25rem;
    }

    .hero-grid .hero-visual,
    .media-card {
        min-height: 180px;
    }

    .card {
        padding: 1.15rem;
    }
}

@media (max-width: 479px) {
    .photo-card-grid--compact {
        grid-template-columns: 1fr;
    }

    :root {
        --gutter: 0.85rem;
    }

    .topbar-location {
        max-width: min(9rem, 34vw);
    }

    .page-banner {
        min-height: 200px;
    }

    .page-banner-title {
        font-size: 1.28rem;
    }

    .hero-shell .hero-carousel {
        height: clamp(200px, 44vh, 280px);
        min-height: 180px;
    }

    .photo-card-arrow {
        font-size: 1.15rem;
    }

    .commitment-item {
        padding: 1rem;
    }

    .service-detail-body h2,
    .industry-detail-body h2 {
        font-size: 1.1rem;
    }
}
