/*
 * Kallamullah mobile stability layer
 * Loaded after the base and page-specific styles so small-screen fixes stay consistent.
 */

html, body {
  max-width: 100%;
}

body {
  overflow-x: clip;
}

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

input, select, textarea, button {
  max-width: 100%;
}

/* Prevent long WordPress/user content from forcing horizontal scrolling. */
.kal-site p,
.kal-site h1,
.kal-site h2,
.kal-site h3,
.kal-site h4,
.kal-site h5,
.kal-site h6,
.kal-site a,
.kal-site li,
.kal-site td,
.kal-site th {
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  .wrap {
    width: calc(100% - 32px);
  }

  section,
  .kal-generic,
  .kal-generic-hero {
    padding-top: 52px;
    padding-bottom: 52px;
  }

  .sec-head {
    margin-bottom: 32px;
  }

  .sec-head h2,
  .pgh h1,
  .pfh h1,
  .kal-generic-hero h1 {
    word-break: normal;
    overflow-wrap: anywhere;
  }

  /* Top bar: keep contact details readable instead of squeezing them. */
  .topbar {
    padding: 8px 0;
  }

  .topbar .wrap {
    gap: 8px 12px;
  }

  .topbar .contacts {
    width: 100%;
    justify-content: center;
    gap: 8px 14px;
    flex-wrap: wrap;
  }

  .topbar .ayah {
    min-width: 0;
    width: 100%;
    flex-basis: 100%;
    line-height: 1.5;
  }

  /* Header/navigation. */
  header {
    width: 100%;
  }

  .nav {
    position: relative;
    min-height: 70px;
    padding: 8px 0;
    gap: 10px;
  }

  .brand {
    min-width: 0;
    flex: 0 1 auto;
  }

  .brand img {
    height: 46px;
    max-width: 170px;
    object-fit: contain;
  }

  .nav-cta {
    margin-inline-start: auto;
    flex: 0 0 auto;
  }

  .burger {
    display: block;
    width: 46px;
    height: 46px;
    padding: 9px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    border-radius: 10px;
    touch-action: manipulation;
  }

  nav ul {
    top: 100%;
    left: -16px;
    right: -16px;
    width: auto;
    max-height: calc(100dvh - 82px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 12px 16px 18px;
    gap: 4px;
    z-index: 100;
  }

  nav ul li,
  nav ul a {
    width: 100%;
  }

  nav ul a {
    display: block;
    padding: 12px 14px;
    min-height: 44px;
  }

  /* Hero and page-header areas. */
  .hero {
    padding: 52px 0 60px;
  }

  .hero .wrap {
    gap: 36px;
  }

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

  .hero p.lead,
  .kal-generic-hero p {
    font-size: 1rem;
  }

  .hero-ctas,
  .steps-row,
  .acts,
  .news-form,
  .radio-row {
    gap: 10px;
    flex-direction: column;
  }

  .hero-ctas .btn,
  .steps-row .btn,
  .acts .btn {
    min-height: 46px;
  }

  .hero-visual {
    width: 100%;
  }

  .hero-arch {
    width: min(330px, 88vw);
  }

  /* Floating chips are decorative; keep them inside the phone viewport. */
  .hero .chip {
    max-width: 46%;
    padding: 8px 10px;
    font-size: .72rem;
    white-space: normal;
  }

  .chip.c1 { left: 0; }
  .chip.c2 { left: 0; }
  .chip.c3 { right: 0; }
  .chip.c4 { right: 0; }

  /* Consistent one-column content on phones. */
  .courses-grid,
  .region-grid,
  .blog-grid,
  .testi-grid,
  .case-grid,
  .why-grid,
  .t-cards,
  .v-grid,
  .kal-generic-grid,
  .cc-grid,
  .ch-grid,
  .tc-grid,
  .rev-grid,
  .vr-grid,
  .teach-grid,
  .ot-grid,
  .st-grid,
  .mvv-grid,
  .region-grid,
  .strip,
  .steps,
  .tq-grid,
  .rel-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  /* Grid/flex children need min-width:0 to actually shrink. */
  .kal-site [class*="grid"] > *,
  .kal-site .wrap > *,
  .kal-site .nav > *,
  .kal-site .hero-ctas > *,
  .kal-site .steps-row > * {
    min-width: 0;
  }

  .f-grid,
  .f-row,
  .phone-pair,
  .trial-grid,
  .art-bottom,
  .pfh .wrap,
  .bio .wrap,
  .story-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .phone-pair {
    gap: 10px;
  }

  /* Cards/forms: reduce oversized desktop padding. */
  .form-card,
  .review-detail,
  .testimonial-card,
  .kal-generic-content {
    padding: 24px 18px;
  }

  .course,
  .case,
  .testi,
  .region,
  .w-tile,
  .kal-generic-card {
    padding-left: 18px;
    padding-right: 18px;
  }
  .w-tile {
    display:flex;
    flex-direction:column
  }
  input,
  select,
  textarea {
    font-size: 16px;
    min-height: 44px;
  }
.exp-badge {
  right:22px
}
  textarea {
    min-height: 110px;
  }

  /* Filters/pagination can wrap rather than overflow. */
  .filter-bar,
  .chips,
  .pager,
  .pagination-wrap {
    max-width: 100%;
  }

  .chips,
  .pager {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }
  .chips {
    flex-direction:column
  }
  .pg {
    min-width: 44px;
    min-height: 44px;
  }

  /* Labels/badges that were forced onto a single line on desktop. */
  .course .lvl,
  .c-thumb .lvl,
  .tc-photo .exp,
  .tg .lvl,
  .rel .lvl,
  .arch-img .badge,
  .pf-badge,
  .g-row b {
    max-width: calc(100% - 20px);
    white-space: normal;
    text-align: center;
  }

  /* Stats and metric rows. */
  .stats .wrap,
  .facts .wrap {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .stat,
  .fact {
    min-width: 0;
  }

  .case-metrics {
    flex-wrap: wrap;
  }

  .case-metrics > div {
    min-width: calc(50% - 8px);
    flex: 1 1 calc(50% - 8px);
  }

  /* Footer. */
  .f-grid-cols {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 30px;
  }

  .f-bottom {
    flex-direction: column;
    text-align: center;
    align-items: center;
  }

  /* Floating actions should not cover page content. */
  .floaters {
    right: 14px;
    bottom: 14px;
    max-width: calc(100vw - 28px);
  }

  .float-trial {
    max-width: calc(100vw - 28px);
    padding: 11px 16px;
    font-size: .8rem;
  }

  /* Generic protection for embedded media and tables from editor content. */
  .kal-site iframe,
  .kal-site video {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .kal-site table {
    width: 100%;
    max-width: 100%;
  }

  .dashboard__review-table,
  .table-responsive {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 480px) {
  .wrap {
    width: calc(100% - 24px);
  }

  section,
  .kal-generic,
  .kal-generic-hero {
    padding-top: 44px;
    padding-bottom: 44px;
  }

  .brand img {
    height: 42px;
    max-width: 145px;
  }

  nav ul {
    left: -12px;
    right: -12px;
  }

  .hero {
    padding-top: 42px;
  }

  .hero h1 {
    font-size: clamp(1.85rem, 10.5vw, 2.35rem);
  }

  .hero-ctas {
    flex-direction: column;
  }

  .hero-ctas .btn,
  .acts .btn,
  .news-form .btn {
    width: 100%;
    justify-content: center;
  }

  .hero-points {
    gap: 10px 14px;
  }

  .hero .chip {
    position: static;
    transform: none !important;
    animation: none;
    max-width: 100%;
    margin: 8px 4px 0;
  }

  .hero-visual {
    flex-wrap: wrap;
    gap: 4px;
  }

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

  .stat:nth-child(-n+2) {
    border-top: 1px solid rgba(255,255,255,.28);
  }

  .stat:first-child {
    border-top: 0;
  }

  .form-card,
  .review-detail,
  .testimonial-card,
  .kal-generic-content {
    padding: 20px 14px;
  }

  .case-metrics > div {
    min-width: 100%;
    flex-basis: 100%;
  }

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

  .j-arrow {
    justify-content: center;
    transform: rotate(90deg);
  }

  .float-wa {
    width: 50px;
    height: 50px;
  }
}
