@media (max-width: 768px) {
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-padding-top: 76px;
  }

  body {
    -webkit-tap-highlight-color: rgba(235, 89, 95, 0.18);
    overflow-x: hidden;
    font-size: 16px;
    line-height: 1.55;
  }

  body:has(.navbar ul.show) {
    overflow: hidden;
    touch-action: none;
  }

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

  h1,
  h2,
  h3,
  p,
  li,
  a,
  button {
    overflow-wrap: anywhere;
  }

  .navbar {
    padding: 8px max(16px, env(safe-area-inset-left)) 8px max(16px, env(safe-area-inset-right)) !important;
    min-height: 64px;
    background: rgba(15, 15, 25, 0.96);
  }

  .navbar:hover {
    background: rgba(15, 15, 25, 0.96);
  }

  .navbar .logo {
    width: 112px;
    max-height: 44px;
    object-fit: contain;
    object-position: left center;
  }

  .mobile-menu-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    min-width: 46px;
    min-height: 46px;
    padding: 0 !important;
    font-size: 22px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.18);
    touch-action: manipulation;
  }

  .navbar ul {
    height: 100vh;
    height: 100dvh;
    padding: 84px 20px calc(36px + env(safe-area-inset-bottom)) !important;
    -webkit-overflow-scrolling: touch;
  }

  .navbar ul li {
    margin: 0 !important;
  }

  .navbar ul li a,
  .dropdown > a,
  .dropdown-content a {
    min-height: 54px;
    padding: 14px 16px !important;
    font-size: 18px !important;
    touch-action: manipulation;
  }

  .dropdown-content a {
    padding-left: 32px !important;
    font-size: 16px !important;
    color: #aeb4c0 !important;
  }

  .navbar ul li a:hover,
  .dropdown > a:hover,
  .dropdown-content a:hover {
    padding-left: 16px !important;
  }

  .dropdown-content a:hover {
    padding-left: 32px !important;
  }

  .mobile-quote-btn {
    margin-top: 24px !important;
  }

  .mobile-quote-btn a {
    min-height: 56px;
    padding: 16px !important;
    font-size: 16px !important;
  }

  .mobile-quote-btn a:hover {
    padding-left: 16px !important;
  }

  .banner {
    background-attachment: scroll !important;
  }

  .banner:has(.contentindex) {
    height: auto !important;
    min-height: 0 !important;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
  }

  .banner:has(.contentindex) .contentindex {
    position: static;
    transform: none;
    margin: 0;
    padding: 56px 22px 64px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  .banner:not(:has(.contentindex)) {
    height: 300px !important;
    min-height: 300px !important;
  }

  .banner:not(:has(.contentindex)) .content {
    padding: 0 20px;
  }

  .contentindex h1,
  .content h1 {
    font-size: clamp(30px, 9vw, 40px) !important;
    line-height: 1.15;
    letter-spacing: 0;
  }

  .contentindex p,
  .content p {
    width: 100% !important;
    max-width: 34em;
    margin: 16px auto 0 !important;
    font-size: 16px !important;
    line-height: 1.55 !important;
    font-weight: 400;
  }

  .contentindex div,
  .content div {
    gap: 12px !important;
    margin-top: 8px;
  }

  .btn_sp,
  .btn_hd,
  .getq_btn,
  .buy-leads-btn {
    width: 100% !important;
    max-width: 320px !important;
    min-height: 52px;
    margin: 0 !important;
    padding: 14px 20px !important;
    font-size: 16px !important;
    border-radius: 14px;
    touch-action: manipulation;
  }

  .btn_hd {
    display: none;
  }

  button,
  input[type="submit"],
  input[type="button"],
  .btn {
    min-height: 48px;
    touch-action: manipulation;
  }

  button:active,
  .btn_sp:active,
  .learn-more-btn:active,
  .contact-btn:active {
    transform: scale(0.98);
  }

  a,
  button,
  label,
  input,
  select,
  textarea {
    touch-action: manipulation;
  }

  section,
  .section {
    scroll-margin-top: 76px;
  }

  .container {
    width: 100%;
    padding-left: 18px;
    padding-right: 18px;
  }

  h2 {
    line-height: 1.2;
  }

  .m1,
  .m2 {
    padding: 48px 0 !important;
  }

  .d1 {
    display: flex !important;
    gap: 14px !important;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    margin: 0 -18px 12px !important;
    padding: 8px 18px 24px !important;
    scroll-padding: 0 18px;
  }

  .d1 > div {
    flex: 0 0 80%;
    min-width: 0 !important;
    max-width: 320px !important;
    margin: 0 !important;
    scroll-snap-align: start;
  }

  .d1 > div:hover {
    transform: none;
  }

  .d1 div img {
    height: 210px !important;
    object-fit: cover;
  }

  .d2 {
    gap: 24px !important;
  }

  .d2 div img {
    height: 240px !important;
    border-radius: 16px;
    object-fit: cover;
  }

  .location-gallery {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 28px !important;
  }

  .gallery-slider {
    position: relative !important;
    top: auto !important;
    width: 100%;
    min-width: 0;
  }

  .slider {
    width: 100%;
    max-width: 100%;
    height: auto !important;
    aspect-ratio: 4 / 3;
    border-radius: 18px;
  }

  .slide {
    height: 100%;
  }

  .slide .imgs {
    flex: 0 0 100%;
    width: 100%;
    min-width: 0;
    height: 100%;
  }

  .imgs img {
    width: 100% !important;
    max-width: 100%;
    height: 100% !important;
    object-fit: cover;
  }

  .nav_man {
    bottom: 14px;
    gap: 18px;
  }

  .man_btn {
    position: relative;
  }

  .man_btn::after {
    content: "";
    position: absolute;
    top: -14px;
    right: -9px;
    bottom: -14px;
    left: -9px;
  }

  .info-card {
    padding: 24px 20px !important;
    border-radius: 18px;
  }

  .location-info {
    min-height: 0 !important;
    gap: 18px !important;
  }

  .portfolio-grid,
  .team-grid,
  .testimonials-grid,
  .features-grid,
  .case-studies-grid,
  .lead-types-grid,
  .industries-grid,
  .trust-grid,
  .protocols-grid,
  .certifications-grid,
  .quick-forms {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 16px !important;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  .lead-card,
  .form-card,
  .info-card {
    min-width: 0;
    max-width: 100%;
  }

  .form-card button,
  .full-width,
  button.full-width {
    width: 100%;
    min-height: 48px;
    padding: 12px 18px;
    font-size: 16px;
  }

  input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]),
  select,
  textarea {
    font-size: 16px !important;
    min-height: 50px;
    max-width: 100%;
  }

  textarea {
    min-height: 120px;
  }

  input[type="checkbox"],
  input[type="radio"] {
    width: 22px;
    height: 22px;
    min-width: 22px;
    flex-shrink: 0;
  }

  label:has(input[type="checkbox"]),
  label:has(input[type="radio"]) {
    min-height: 44px;
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .form-label,
  .form-label-static {
    font-size: 14px;
  }

  .read-more,
  .rd {
    display: inline-block;
    padding: 10px 0;
    font-size: 14px;
  }

  .badge-title {
    font-size: 13px;
  }

  .badge-subtitle {
    font-size: 12px;
  }

  .up {
    bottom: calc(18px + env(safe-area-inset-bottom)) !important;
    right: 16px !important;
    width: 48px !important;
    height: 48px !important;
  }

  .up i {
    font-size: 20px !important;
  }

  .last {
    height: auto !important;
    min-height: 300px;
    padding: 48px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .last div {
    position: static !important;
    transform: none !important;
    width: 100%;
  }

  .last div h1 {
    font-size: clamp(26px, 7.5vw, 34px);
    line-height: 1.2;
  }

  .last div button {
    width: 100%;
    max-width: 300px;
    font-size: 18px;
    margin: 18px auto 0;
  }

  .ftr-m {
    padding: 36px 20px calc(20px + env(safe-area-inset-bottom)) !important;
  }

  .ftr-t ul {
    gap: 8px !important;
  }

  .ftr-t ul li a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    min-height: 48px;
  }

  .ftr-t ul li a i {
    font-size: 26px !important;
  }

  .ftr-d div a {
    padding: 8px 0;
    min-height: 40px;
    display: flex !important;
    align-items: center;
    font-size: 14px !important;
  }

  .ftr-d div:last-child a {
    justify-content: center;
    font-size: 15px !important;
  }

  .ftr-d div ul li {
    margin-bottom: 2px !important;
  }

  .ftr-b p {
    font-size: 12px !important;
    color: #9ca3af !important;
    line-height: 1.5;
  }

  .ftr-b h2 {
    display: none;
  }

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

  pre,
  code {
    white-space: pre-wrap;
    word-break: break-word;
  }

  .partner-item,
  .partner-item a {
    font-size: 14px !important;
  }

  .partner-item a {
    display: inline-block;
    padding: 4px 0;
  }
}

@media (max-width: 400px) {
  .container {
    padding-left: 16px;
    padding-right: 16px;
  }

  .navbar .logo {
    width: 100px;
  }

  .d1 > div {
    flex-basis: 86%;
  }

  .stats-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .ftr-d {
    gap: 24px 12px !important;
  }
}

@media (max-width: 768px) and (orientation: landscape) and (max-height: 500px) {
  .banner:has(.contentindex) .contentindex {
    padding: 32px 22px 40px;
  }

  .banner:not(:has(.contentindex)) {
    height: 220px !important;
    min-height: 220px !important;
  }

  .navbar ul {
    padding-top: 72px !important;
  }
}
