/* ============================================
   MOBILE ENHANCEMENTS  (all pages)
   Loaded after the main stylesheets. Only touches phones /
   touch devices; desktop layout is unchanged.
   To switch off: remove this <link> and js/mobile.js
   ============================================ */

/* ---------- Touch polish (all screen sizes) ---------- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

a, button, input, select, textarea, summary, label, [role="button"] {
  touch-action: manipulation;                       /* no 300ms tap delay / double-tap zoom */
  -webkit-tap-highlight-color: rgba(178, 111, 45, .18);
}

img, video, iframe, svg { max-width: 100%; }


/* ---------- Narrow phones: never let the page grow wider than the screen ----------
   (6 social icons x 44px used to force a 344px minimum page width, which pushed
   the menu button, popups and fixed buttons off the right edge.) */
.social-links,
.footer-social,
.contact-social .social-links { flex-wrap: wrap; }

.footer-grid > *,
.contact-grid > *,
.contact-info,
.contact-form-wrapper { min-width: 0; }

p, h1, h2, h3, h4, li { overflow-wrap: break-word; }


/* EMI calculator: let label + number box wrap instead of forcing a 385px page */
.emi-wrapper { grid-template-columns: minmax(0, 1fr); }
.emi-card, .emi-result-card, .emi-field { min-width: 0; }
.emi-field-head { flex-wrap: wrap; row-gap: 8px; }
.emi-field-input { min-width: 0; }
@media (min-width: 900px) { .emi-wrapper { grid-template-columns: 1.05fr 0.95fr; } }
.emi-donut-row { flex-wrap: wrap; justify-content: center; row-gap: 20px; }
.emi-legend { flex: 1 1 190px; min-width: 0; }
.emi-legend-item .val { white-space: nowrap; }

/* ---------- Sticky bottom action bar (injected by js/mobile.js) ---------- */
.mh-bar { display: none; }

@media (max-width: 767px) {

  body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }

  .mh-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9980;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: rgba(255, 253, 248, .94);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-top: 1px solid rgba(178, 111, 45, .28);
    box-shadow: 0 -10px 30px rgba(14, 28, 51, .12);
    transition: transform .3s ease;
  }

  .mh-bar a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 48px;
    border-radius: 12px;
    font-family: var(--font-body, 'Inter', sans-serif);
    font-size: .88rem;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    transition: transform .15s ease, filter .15s ease;
  }

  .mh-bar a:active { transform: scale(.96); filter: brightness(.95); }

  .mh-bar .mh-bar-call  { background: #fff; color: #0e1c33; border: 1px solid rgba(14, 28, 51, .18); }
  .mh-bar .mh-bar-wa    { background: #1d9d47; color: #fff; }
  .mh-bar .mh-bar-visit { background: linear-gradient(135deg, #d7a72f, #b77a12); color: #fffdf7; }

  /* hide while typing (on-screen keyboard) and during the intro / popup */
  body.mh-kbd .mh-bar,
  html.intro-playing .mh-bar { transform: translateY(110%); }

  /* the bar already has WhatsApp, so drop the floating one */
  .whatsapp-float { display: none !important; }

  /* keep the Diwali "re-open" button clear of the bar */
  .dw-pill { left: auto !important; right: 12px !important; bottom: calc(84px + env(safe-area-inset-bottom)) !important; }

  /* ---------- Header / menu ---------- */
  .navbar { padding-top: max(7px, env(safe-area-inset-top)); }

  .nav-toggle { padding: 14px 10px; margin-right: -6px; }          /* 44px tap area */
  .nav-brand small { font-size: .6rem; }

  .nav-menu.active {
    max-height: calc(100vh - 76px);
    max-height: calc(100dvh - 76px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .nav-menu.active .nav-link { min-height: 48px; display: flex; align-items: center; }

  body.mh-menu-open { overflow: hidden; }

  /* ---------- Tap targets ---------- */
  .footer-links ul li { margin-bottom: 0; }
  .footer-links a,
  .footer-bottom a { display: flex; align-items: center; min-height: 44px; padding: 0; }

  .carousel-dot { position: relative; }
  .carousel-dot::before { content: ""; position: absolute; inset: -17px -4px; }  /* bigger touch area */

  .detail-back-link,
  .breadcrumb a,
  .detail-breadcrumb a { display: inline-flex; align-items: center; min-height: 44px; }

  .btn, .brochure-btn, [id$="DetailsBtn"] { min-height: 48px; }
  .btn-details { display: flex; align-items: center; justify-content: center; min-height: 48px; }

  /* phone / e-mail links in the footer and on project pages */
  .footer-contact a,
  footer p a,
  .detail-contact-list a { display: inline-flex; align-items: center; min-height: 44px; }

  /* ---------- Readable small text ---------- */
  .hero-eyebrow { font-size: .72rem; }

  /* ---------- EMI calculator: finger-friendly sliders & fields ---------- */
  .emi-slider { box-sizing: content-box; padding: 11px 0; background-clip: content-box; }
  .emi-slider::-webkit-slider-thumb { width: 28px; height: 28px; margin-top: -11px; }
  .emi-slider::-moz-range-thumb { width: 28px; height: 28px; }
  input[type="number"], input[type="text"], input[type="email"], input[type="tel"], select, textarea {
    font-size: 16px;                    /* stops iOS zooming the page on focus */
    min-height: 48px;
  }

  /* ---------- Diwali popup on small screens: leave room for the bar ---------- */
  .dw-overlay { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
}

/* Very small phones */
@media (max-width: 360px) {
  .mh-bar a { font-size: .8rem; gap: 5px; }
}

/* Short landscape phones: bar is slimmer */
@media (max-width: 900px) and (max-height: 480px) and (orientation: landscape) {
  body { padding-bottom: 0; }
  .mh-bar { display: none; }
}
