/**
 * AFS Website — Mobile overrides
 * Loaded after custome.css
 */

/* Phase 1 — Critical scroll & overflow */

@media only screen and (max-width: 767px) {
  body {
    overflow-x: hidden;
    overflow-y: auto !important;
  }
}

@media (max-width: 767px) {
  .rts-copyright-area .links {
    margin-left: 0 !important;
    text-align: left !important;
  }

  .rts-copyright-area .text-center {
    text-align: left !important;
  }

  .rts-copyright-area p,
  .rts-copyright-area .links li a {
    font-size: 14px;
    word-break: break-word;
  }
}

.map-responsive {
  position: relative;
  overflow: hidden;
  padding-bottom: 56.25%;
  height: 0;
}

.map-responsive iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
  border: 0;
}

/* Phase 2 — Layout & readability */

/* 2.1 Banner / hero slider */
@media (max-width: 767px) {
  .banner-one-inner {
    width: 100% !important;
    padding: 40px 15px 60px !important;
    margin-left: 0 !important;
  }

  .banner-one-inner img,
  .rts-banner-one .swiper-slide img {
    width: 100%;
    height: auto;
    max-height: 220px;
    object-fit: contain;
  }

  .rts-banner-area {
    min-height: auto;
  }
}

/* 2.2 Fixed section heights */
@media (max-width: 767px) {
  .counter-bg,
  .cta-one-bg {
    height: auto !important;
    min-height: unset !important;
  }

  .cta-one-inner {
    padding: 40px 20px !important;
  }
}

/* 2.4 Button floats */
@media (max-width: 767px) {
  .rts-btn.btn-primary,
  .rts-btn.btn-primary:hover {
    float: none !important;
    display: inline-block;
    width: auto;
  }
}

/* 2.5 Counter / quick-links */
@media (max-width: 767px) {
  .counter-details .title {
    margin-left: 0 !important;
    font-size: 22px;
  }

  .counter-details .links li a {
    font-size: 14px;
    word-break: break-word;
  }
}

/* 2.6 Breadcrumb titles on small screens */
@media (max-width: 767px) {
  .rts-breadcrumb-area .title {
    font-size: 22px !important;
    line-height: 1.3;
    word-break: break-word;
  }
}

@media (max-width: 575px) {
  .rts-breadcrumb-area .title {
    font-size: 18px !important;
  }
}

/* 2.7 Team member photos */
.team-member-img {
  width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: cover;
  object-position: top center;
}

@media (max-width: 575px) {
  .team-member-img {
    max-height: 260px;
  }
}

/* 2.9 Logo sizing */
@media (max-width: 479px) {
  .header-main-one .thumbnail img {
    max-width: 200px;
    width: 100%;
    height: auto;
  }

  .header-main-one .thumbnail a {
    max-width: 100%;
  }
}

/* Phase 3 — Content & polish */

/* 3.1 Rich HTML from database */
.cms-content img,
.cms-content table,
.cms-content iframe,
.cms-content video {
  max-width: 100% !important;
  height: auto !important;
}

.cms-content table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.cms-content {
  overflow-wrap: break-word;
  word-break: break-word;
}

/* 3.2 E-newsletter card padding fallback */
@media (max-width: 767px) {
  .pb--140 {
    padding-bottom: 40px !important;
  }
}

/* 3.3 Team details page */
@media (max-width: 767px) {
  .rts-team-details .details-thumb img {
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
    display: block;
  }

  .rts-team-details .details-right-inner {
    padding-left: 0 !important;
  }
}

/* 3.4 Typography scale */
@media (max-width: 767px) {
  .rts-title-area .title {
    font-size: 28px;
    line-height: 1.3;
  }

  .rts-title-area .pre-title {
    font-size: 13px;
  }

  h3.title {
    font-size: 20px;
  }

  .service-detials-step-1 p.disc,
  .blog-listing-content .title {
    font-size: 16px !important;
  }
}

/* 3.5 Breadcrumb area height */
@media (max-width: 575px) {
  .rts-breadcrumb-area {
    padding: 50px 0 !important;
  }
}

/* 3.6 Mobile navigation UX */
@media (max-width: 1199px) {
  .side-bar {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .rts-sidebar-menu-desktop .body-mobile .mainmenu > li > a {
    padding: 12px 0;
    font-size: 16px;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .rts-sidebar-menu-desktop .body-mobile .mainmenu ul {
    overflow-x: hidden;
  }

  .rts-sidebar-menu-desktop .body-mobile .mainmenu li.has-droupdown .submenu li a {
    padding: 10px 0;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
}

/* Phase 4 — Cleanup & maintainability */

/* iOS Safari — text scaling & momentum scroll */
html {
  -webkit-text-size-adjust: 100%;
}

@media (max-width: 767px) {
  html {
    overflow-x: hidden;
  }

  body {
    -webkit-overflow-scrolling: touch;
  }

  /* Global responsive images inside page content */
  .container img:not(.team-member-img) {
    max-width: 100%;
    height: auto;
  }

  /* Tighter section spacing on mobile */
  .rts-section-gap {
    padding: 30px 0 !important;
  }

  .cta-one-bg {
    border-width: 6px;
  }

  .counter-bg {
    height: auto !important;
  }
}

/* Consolidated from custome.css */
@media (max-width: 479px) {
  .header-main-one .thumbnail {
    width: auto;
    max-width: 100%;
  }
}

/* Homepage service dashboard cards */
@media (max-width: 767px) {
  .background-service .service-one-inner {
    align-items: flex-start;
    padding: 24px 12px 20px 15px;
  }

  .background-service .service-one-inner .thumbnail {
    flex-shrink: 0;
    margin-right: 12px;
  }

  .background-service .service-one-inner .service-details {
    flex: 1;
    min-width: 0;
  }

  .background-service .service-one-inner .service-details .title {
    font-size: 18px;
    line-height: 1.25;
    word-break: normal;
    overflow-wrap: normal;
  }

  .background-service .service-one-inner .service-details .disc {
    word-break: normal;
  }

  .background-service .service-one-inner .service-details .rts-read-more {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    font-size: 14px;
  }

  .background-service .service-one-inner .service-details .rts-read-more i {
    flex-shrink: 0;
    margin-right: 10px;
  }
}

@media (max-width: 575px) {
  .background-service {
    padding: 15px 10px !important;
  }

  .background-service.row > [class*="col-"] {
    width: 100%;
    max-width: 100%;
    flex: 0 0 100%;
  }
}

@media (max-width: 767px) {
  .rts-team-area .single-details .title {
    font-size: 18px;
  }

  .service-detials-step-1 .title,
  .service-detials-step-1 h4.title {
    font-size: 22px;
    line-height: 1.3;
    word-break: break-word;
  }

  /* Floated inline images in static content pages */
  .service-detials-step-1 img[style*="float"],
  .service-detials-step-1 p img {
    float: none !important;
    display: block;
    margin: 0 auto 15px !important;
    max-width: 100%;
    height: auto;
  }

  .service-detials-step-1 p.disc[style*="float"] {
    float: none !important;
    text-align: left !important;
  }

  .table-responsive .table {
    width: 100% !important;
  }
}
