@media (max-width: 700px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    min-height: 100svh;
    overflow-x: clip;
    -webkit-text-size-adjust: 100%;
  }

  body {
    background-attachment: scroll;
  }

  body::before,
  body::after,
  .section::before,
  .section::after {
    animation: none !important;
  }

  body::after,
  .section::after {
    display: none;
  }

  .container {
    width: min(100% - 22px, var(--container));
  }

  .section {
    overflow-x: clip;
    overflow-y: visible;
    padding: 48px 0;
  }

  .hero,
  .page-hero,
  .request-section,
  .team-section,
  .home-overview,
  .home-insights,
  .home-projects-showcase,
  .home-team-showcase,
  .home-partners-strip {
    overflow-x: clip;
    overflow-y: visible;
  }

  .hero {
    min-height: auto;
  }

  .hero-grid,
  .page-hero-grid,
  .home-overview-grid,
  .home-insights-grid,
  .projects-layout,
  .about-grid,
  .contact-grid,
  .request-layout,
  .team-member-grid,
  .services-business-grid,
  .service-detail-layout,
  .section-head,
  .compact-head {
    grid-template-columns: 1fr !important;
  }

  .hero-panel,
  .page-hero-media,
  .home-insights-panel,
  .request-summary-card,
  .member-profile-card {
    position: relative !important;
    top: auto !important;
  }

  .button-row,
  .request-step-actions,
  .request-actions,
  .home-contact-inner {
    display: grid !important;
    grid-template-columns: 1fr !important;
  }

  .button,
  .request-actions .button,
  .home-contact-inner .button {
    width: 100%;
  }

  .home-service-card,
  .home-bottom-project-card,
  .home-team-card,
  .home-team-director,
  .team-card,
  .project-card,
  .service-card,
  .request-choice,
  .request-system-card,
  .member-info-card {
    max-width: 100%;
  }

  .home-team-card,
  .home-team-director {
    grid-template-columns: 64px minmax(0, 1fr) !important;
  }

  .home-team-photo,
  .home-team-director .home-team-photo {
    width: 64px !important;
    height: 64px !important;
  }

  .home-team-copy em {
    -webkit-line-clamp: 3;
  }

  .request-stepper {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .request-choice-row,
  .request-grid,
  .request-system-grid,
  .request-check-grid,
  .request-specialist-grid,
  .request-brand-grid,
  .team-management-grid,
  .team-report-grid,
  .member-org-grid,
  .member-org-groups,
  .member-org-child-grid,
  .home-team-manager-grid,
  .home-team-grid,
  .home-bottom-project-grid,
  .home-partner-grid,
  .partners-grid,
  .trust-grid,
  .services-grid,
  .projects-grid,
  .project-gallery,
  .service-feature-grid {
    grid-template-columns: 1fr !important;
  }

  .request-system-card {
    grid-template-columns: 1fr !important;
  }

  .request-qty {
    grid-template-columns: minmax(0, 1fr) 92px !important;
  }

  .request-brand-grid {
    display: flex;
  }

  .request-brand-chip span {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  /* Prevent clipped cards/rails on iPhone-sized screens. */
  .team-hierarchy,
  .team-carousel,
  .team-carousel-shell {
    overflow-x: visible;
    overflow-y: visible;
  }

  .team-carousel-shell {
    overflow-x: auto !important;
    overflow-y: visible !important;
    padding-bottom: 10px !important;
    margin-inline: -2px;
    -webkit-mask-image: none !important;
    mask-image: none !important;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .team-carousel-shell::-webkit-scrollbar {
    display: none;
  }

  .team-carousel-shell::before,
  .team-carousel-shell::after {
    display: none !important;
  }

  .team-carousel-track {
    animation: none !important;
    transform: none !important;
  }

  .team-carousel-set {
    gap: 10px !important;
    padding-right: 10px !important;
  }

  .team-carousel-set[aria-hidden="true"] {
    display: none !important;
  }

  .team-rail-node {
    flex: 0 0 min(86vw, 294px) !important;
    scroll-snap-align: center;
  }

  .team-carousel .team-card.team-card-person {
    height: auto !important;
    min-height: 136px !important;
    padding: 12px 13px !important;
  }

  .team-carousel .team-card.team-card-person .team-card-profile {
    grid-template-columns: 66px minmax(0, 1fr) !important;
    gap: 10px !important;
  }

  .team-carousel .team-card.team-card-person .team-photo-wrap,
  .team-carousel .team-card.team-card-person .team-photo {
    width: 66px !important;
    height: 66px !important;
  }

  .team-carousel .team-card.team-card-person h3 {
    font-size: 0.94rem !important;
  }

  .team-carousel .team-card.team-card-person p {
    font-size: 0.8rem !important;
  }

  .auto-chat-shell {
    right: max(8px, env(safe-area-inset-right, 0px));
    bottom: max(8px, env(safe-area-inset-bottom, 0px));
    left: max(8px, env(safe-area-inset-left, 0px));
    width: auto;
  }

  .auto-chat-panel {
    width: 100%;
    max-height: 72vh;
    max-height: min(72svh, 560px);
    -webkit-overflow-scrolling: touch;
  }

  .back-to-top-button {
    right: max(8px, env(safe-area-inset-right, 0px));
    bottom: calc(82px + env(safe-area-inset-bottom, 0px));
  }

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

@media (max-width: 390px) {
  .container {
    width: min(100% - 18px, var(--container));
  }

  .section {
    padding: 42px 0;
  }

  .request-stepper {
    grid-template-columns: 1fr !important;
  }

  .home-team-card,
  .home-team-director {
    grid-template-columns: 58px minmax(0, 1fr) !important;
  }

  .home-team-photo,
  .home-team-director .home-team-photo {
    width: 58px !important;
    height: 58px !important;
  }
}

/* ========================================
   Mobile Bottom Navigation Bar
   ======================================== */
.mobile-bottom-nav {
  position: fixed;
  left: max(12px, env(safe-area-inset-left, 0px));
  right: max(12px, env(safe-area-inset-right, 0px));
  bottom: max(6px, env(safe-area-inset-bottom, 0px));
  z-index: 210;
  display: none;
  padding: 4px;
  border: 1px solid rgba(10, 54, 60, 0.13);
  border-radius: 20px;
  color: rgba(24, 51, 56, 0.72);
  background:
    radial-gradient(circle at 50% -18%, rgba(10, 168, 150, 0.18), transparent 46%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(237, 248, 246, 0.9) 54%, rgba(226, 240, 240, 0.92));
  box-shadow:
    0 12px 30px rgba(20, 33, 38, 0.14),
    0 0 0 1px rgba(255, 255, 255, 0.68) inset;
  backdrop-filter: blur(16px) saturate(1.12);
  -webkit-backdrop-filter: blur(16px) saturate(1.12);
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms ease, box-shadow 180ms ease;
}

@media (max-width: 768px) {
  .mobile-bottom-nav {
    display: block;
  }

  /* On mobile the chat opens from the bottom dock, so no stray floating controls remain on screen. */
  .auto-chat-shell {
    bottom: calc(74px + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 260;
  }

  .auto-chat-shell .auto-chat-controls {
    display: none !important;
  }

  /* Keep page-end actions and footer links above the fixed bottom navigation. */
  #site-main {
    padding-bottom: calc(86px + env(safe-area-inset-bottom, 0px));
    min-height: calc(100svh - var(--smarttech-header-bottom, 70px));
  }

  #site-footer {
    padding-bottom: calc(142px + env(safe-area-inset-bottom, 0px));
  }

  .back-to-top-button {
    bottom: calc(74px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

@media (min-width: 1241px) {
  .auto-chat-shell {
    display: flex !important;
  }
}

body.ui-theme-dark .mobile-bottom-nav {
  color: rgba(236, 246, 244, 0.78);
  border-color: rgba(255, 255, 255, 0.14);
  background:
    radial-gradient(circle at 50% -18%, rgba(82, 205, 191, 0.3), transparent 46%),
    linear-gradient(135deg, rgba(12, 28, 34, 0.98), rgba(11, 43, 48, 0.96) 54%, rgba(18, 28, 34, 0.98));
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.46),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}

body.is-menu-open .mobile-bottom-nav {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(100%);
}

.mobile-bottom-nav .bottom-nav-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
  gap: 2px;
  width: 100%;
  min-height: 50px;
}

.mobile-bottom-nav .bottom-nav-item {
  position: relative;
  isolation: isolate;
  min-width: 0;
  border: 0;
  border-radius: 16px;
  background: transparent;
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  padding: 5px 2px 4px;
  color: inherit;
  text-decoration: none;
  font: inherit;
  line-height: 1;
  cursor: pointer;
  transition: color 170ms ease, transform 170ms ease, background 170ms ease, box-shadow 170ms ease;
  -webkit-tap-highlight-color: transparent;
}

.mobile-bottom-nav .bottom-nav-item::before {
  position: absolute;
  inset: 3px;
  z-index: -1;
  content: "";
  border-radius: 13px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(82, 205, 191, 0.08));
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 170ms ease, transform 170ms ease;
}

.mobile-bottom-nav .bottom-nav-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
}

.mobile-bottom-nav .bottom-nav-label {
  display: block;
  width: 100%;
  max-width: 58px;
  overflow: hidden;
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.05;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.82;
}

.mobile-bottom-nav .bottom-nav-item svg {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  stroke-width: 2.05;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  filter: drop-shadow(0 7px 13px rgba(0, 0, 0, 0.18));
  transition: transform 170ms ease, filter 170ms ease;
}

.mobile-bottom-nav .bottom-nav-menu {
  min-height: 52px;
  margin-top: -11px;
  border-radius: 18px;
  color: #07191d;
  background:
    radial-gradient(circle at 35% 22%, rgba(255, 255, 255, 0.82), transparent 29%),
    linear-gradient(145deg, var(--teal), #38d7c9 58%, var(--amber));
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow:
    0 16px 30px rgba(10, 168, 150, 0.34),
    0 4px 0 rgba(255, 255, 255, 0.18) inset;
}

.mobile-bottom-nav .bottom-nav-menu .bottom-nav-icon {
  width: 26px;
  height: 26px;
}

.mobile-bottom-nav .bottom-nav-menu svg {
  width: 22px;
  height: 22px;
  stroke-width: 2.25;
}

.mobile-bottom-nav .bottom-nav-menu .bottom-nav-label {
  color: rgba(7, 25, 29, 0.86);
  opacity: 1;
}

.mobile-bottom-nav .bottom-nav-item.is-active {
  color: #087b70;
  background: rgba(10, 168, 150, 0.1);
  box-shadow: 0 0 0 1px rgba(10, 168, 150, 0.13) inset;
}

.mobile-bottom-nav .bottom-nav-item.is-active::before {
  opacity: 1;
  transform: scale(1);
}

.mobile-bottom-nav .bottom-nav-item.is-active svg {
  transform: translateY(-1px) scale(1.06);
  filter: drop-shadow(0 0 10px rgba(10, 168, 150, 0.28));
}

body.ui-theme-dark .mobile-bottom-nav .bottom-nav-item.is-active {
  color: #52cdbf;
  background: rgba(82, 205, 191, 0.08);
  box-shadow: 0 0 0 1px rgba(82, 205, 191, 0.12) inset;
}

body.ui-theme-dark .mobile-bottom-nav .bottom-nav-item.is-active svg {
  filter: drop-shadow(0 0 11px rgba(82, 205, 191, 0.34));
}

.mobile-bottom-nav .bottom-nav-menu.is-active,
.mobile-bottom-nav .bottom-nav-menu:focus-visible {
  color: #061b1d;
  background:
    radial-gradient(circle at 34% 22%, rgba(255, 255, 255, 0.9), transparent 30%),
    linear-gradient(145deg, #55e0d4, var(--teal) 54%, #f0bd50);
}

.mobile-bottom-nav .bottom-nav-item:focus-visible {
  outline: 2px solid rgba(82, 205, 191, 0.72);
  outline-offset: 2px;
}

.mobile-bottom-nav .bottom-nav-item:active {
  transform: translateY(1px) scale(0.97);
}

@media (max-width: 360px) {
  .mobile-bottom-nav {
    left: max(6px, env(safe-area-inset-left, 0px));
    right: max(6px, env(safe-area-inset-right, 0px));
    bottom: max(5px, env(safe-area-inset-bottom, 0px));
    padding: 3px;
    border-radius: 18px;
  }

  .mobile-bottom-nav .bottom-nav-list {
    gap: 1px;
    min-height: 46px;
  }

  .mobile-bottom-nav .bottom-nav-item {
    border-radius: 14px;
    min-height: 41px;
    padding: 4px 1px 3px;
  }

  .mobile-bottom-nav .bottom-nav-menu {
    min-height: 48px;
    margin-top: -9px;
    border-radius: 16px;
  }

  .mobile-bottom-nav .bottom-nav-label {
    max-width: 48px;
    font-size: 0.47rem;
    letter-spacing: -0.025em;
  }

  .mobile-bottom-nav .bottom-nav-item svg {
    width: 18px;
    height: 18px;
  }

  .mobile-bottom-nav .bottom-nav-menu svg {
    width: 21px;
    height: 21px;
  }

  .auto-chat-shell {
    bottom: calc(68px + env(safe-area-inset-bottom, 0px)) !important;
  }

  #site-main,
  #site-footer {
    padding-bottom: calc(138px + env(safe-area-inset-bottom, 0px));
  }

  .back-to-top-button {
    bottom: calc(66px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

@media (max-width: 520px) and (max-height: 640px) {
  .auto-chat-panel {
    max-height: calc(100svh - 92px);
    grid-template-rows: auto minmax(86px, 1fr) auto auto auto;
    gap: 6px;
    padding: 10px;
    border-radius: 20px;
    overflow: hidden;
  }

  .auto-chat-head {
    gap: 8px;
    padding-bottom: 4px;
  }

  .auto-chat-title {
    margin-top: 2px;
    font-size: 0.94rem;
  }

  .auto-chat-subtitle {
    margin-top: 2px;
    font-size: 0.74rem;
    line-height: 1.32;
  }

  .auto-chat-status {
    font-size: 0.68rem;
  }

  .auto-chat-close {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
  }

  .auto-chat-messages {
    min-height: 86px;
    gap: 6px;
    padding-right: 2px;
  }

  .auto-chat-message {
    padding: 8px 9px;
    border-radius: 14px;
    font-size: 0.84rem;
    line-height: 1.38;
  }

  .auto-chat-quick-label {
    margin-top: 0;
    font-size: 0.68rem;
  }

  .auto-chat-actions {
    gap: 5px;
    max-height: 96px;
    overflow-y: auto;
    padding-right: 2px;
  }

  .auto-chat-quick {
    min-height: 28px;
    padding: 5px 8px;
    font-size: 0.7rem;
  }

  .auto-chat-form {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
  }

  .auto-chat-input {
    min-width: 0;
    min-height: 38px;
    padding: 7px 9px;
    border-radius: 14px;
    font-size: 0.9rem;
  }

  .auto-chat-send {
    min-height: 38px;
    padding: 7px 10px;
    border-radius: 14px;
    font-size: 0.82rem;
    overflow-wrap: normal;
    white-space: nowrap;
    word-break: normal;
  }
}

@media (max-width: 330px) {
  .mobile-bottom-nav .bottom-nav-label {
    max-width: 44px;
    font-size: 0.44rem;
  }

  .mobile-bottom-nav .bottom-nav-icon {
    width: 20px;
    height: 20px;
  }
}
