/* ============================================================
   MOBILE.CSS — Uttarakhand Housing Developers
   Production-ready responsive fixes
   Tested: 320px / 375px / 390px / 414px / 768px
   ============================================================ */

/* ── 1. GLOBAL OVERFLOW PREVENTION ─────────────────────────── */
html,
body {
  overflow-x: hidden;
  max-width: 100%;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

img,
video,
iframe,
embed,
object {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ── 2. TOUCH IMPROVEMENTS ──────────────────────────────────── */
a,
button,
[role="button"] {
  touch-action: manipulation;
}

/* Prevent iOS zoom on input focus */
input,
select,
textarea {
  font-size: 16px !important;
}

/* ── 3. CONTAINER — never exceed viewport ───────────────────── */
.container {
  width: min(1180px, 92vw);
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

/* ── 4. NAVBAR ──────────────────────────────────────────────── */
.navbar {
  width: 100%;
  max-width: 100vw;
}

.nav-wrap {
  position: relative;
  flex-wrap: nowrap;
  overflow: visible !important;
}

.brand {
  min-width: 0;
  overflow: hidden;
}

.brand-text {
  min-width: 0;
  overflow: hidden;
}

.brand-text strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-text span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Mobile nav menu — full width, no overflow */
@media (max-width: 900px) {
  .navbar {
    position: sticky;
    top: 0;
    z-index: 1200;
  }

  .brand {
    flex: 1 1 auto;
    min-width: 0;
    max-width: calc(100% - 58px);
  }

  .menu-toggle {
    position: relative;
    z-index: 1202;
    display: grid;
    place-items: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    cursor: pointer;
    pointer-events: auto;
    touch-action: manipulation;
    margin-left: auto;
  }

  .menu-toggle i {
    pointer-events: none;
  }

  .nav-links {
    display: none;
    position: fixed;
    top: 71px;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    background: #fff;
    border-bottom: 1px solid #e5dfd4;
    padding: 20px 24px;
    box-shadow: 0 24px 70px rgba(18,59,52,.12);
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    white-space: normal;
    z-index: 1201;
    overflow-x: hidden;
  }
  .nav-links.active { display: flex; }
}

@media (max-width: 480px) {
  .brand-text strong { font-size: .82rem; }
  .brand-text span { display: none; }
  .nav-wrap { gap: 8px; }
  .brand-mark { width: 36px; height: 36px; font-size: .85rem; }
}

/* ── 5. HERO SECTION ────────────────────────────────────────── */

/* Fix: minmax(320px) forces overflow on small screens */
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.03fr) minmax(0, .74fr);
  gap: 58px;
  align-items: center;
  width: 100%;
}

.hero-copy h1 {
  font-size: clamp(1.9rem, 7vw, 5.7rem);
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

.hero-copy p {
  max-width: 100%;
}

.hero-media {
  min-width: 0;
  max-width: 100%;
}

.hero-image,
.hero-placeholder {
  min-height: 0;
  width: 100%;
}

.trust-strip {
  max-width: 100%;
}

@media (max-width: 1024px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .hero-image,
  .hero-placeholder {
    aspect-ratio: 16/10;
    min-height: 0;
    max-height: 420px;
  }
}

@media (max-width: 760px) {
  .hero {
    padding: 52px 0 64px;
    min-height: auto;
  }
  .hero-grid { gap: 28px; }
  .hero-copy h1 { font-size: clamp(1.75rem, 8vw, 2.8rem); line-height: 1.1; }
  .hero-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
  }
  .hero-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .trust-strip {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .hero-image,
  .hero-placeholder {
    aspect-ratio: 16/10;
    min-height: 0;
    max-height: 320px;
  }
}

@media (max-width: 480px) {
  .hero { padding: 40px 0 52px; }
  .hero-copy h1 { font-size: clamp(1.6rem, 9vw, 2.4rem); }
  .trust-strip { grid-template-columns: 1fr; gap: 8px; }
  .trust-item { padding: 12px; }
  .hero-media { padding: 10px; }
}

@media (max-width: 360px) {
  .hero-copy h1 { font-size: 1.55rem; }
}

/* ── 6. SERVICE HERO (services.html) ────────────────────────── */

/* Fix: minmax(340px) forces overflow */
.service-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, .98fr) minmax(0, .72fr);
  gap: 54px;
  align-items: center;
  width: 100%;
}

.service-hero {
  overflow: hidden;
  width: 100%;
}

@media (max-width: 1024px) {
  .service-hero-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .service-hero { min-height: auto; padding: 60px 0 72px; }
  .service-hero .hero-media { width: 100%; max-width: 100%; justify-self: start; }
  .service-hero-image { aspect-ratio: 16/10; height: auto; min-height: 0; max-height: 400px; }
}

@media (max-width: 760px) {
  .service-hero { padding: 48px 0 60px; }
  .service-hero .hero-copy h1 { font-size: clamp(1.75rem, 8vw, 2.8rem); }
  .service-hero-image { aspect-ratio: 16/11; max-height: none; }
  .mini-proof-section { margin-top: 0; padding: 28px 0; }
  .mini-proof-grid {
    grid-template-columns: 1fr;
    padding: 0;
    gap: 0;
    overflow: hidden;
  }
  .mini-proof-grid div { border-right: 0; border-bottom: 1px solid #e5dfd4; }
  .mini-proof-grid div:last-child { border-bottom: 0; }
}

@media (max-width: 480px) {
  .service-hero .hero-copy h1 { font-size: clamp(1.6rem, 9vw, 2.2rem); }
}

/* ── 7. PROOF BAND ──────────────────────────────────────────── */
.proof-band {
  position: relative;
  z-index: 2;
  width: 100%;
  overflow: hidden;
}

.proof-card {
  overflow: hidden;
  width: 100%;
}

@media (max-width: 760px) {
  .proof-band { margin-top: 0; }
  .proof-card { grid-template-columns: 1fr 1fr; }
  .proof-card div { border-right: 0; border-bottom: 1px solid #e5dfd4; padding: 18px; }
  .proof-card div:nth-child(odd) { border-right: 1px solid #e5dfd4; }
  .proof-card div:last-child,
  .proof-card div:nth-last-child(2):nth-child(odd) { border-bottom: 0; }
}

@media (max-width: 480px) {
  .proof-card { grid-template-columns: 1fr; }
  .proof-card div { border-right: 0 !important; border-bottom: 1px solid #e5dfd4; padding: 16px 18px; }
  .proof-card div:last-child { border-bottom: 0; }
  .proof-card strong { font-size: 1.5rem; }
  .proof-card span { font-size: .82rem; }
}

/* ── 8. SECTIONS ────────────────────────────────────────────── */
.section {
  width: 100%;
  overflow: hidden;
}

@media (max-width: 760px) {
  .section { padding: 60px 0; }
}

@media (max-width: 480px) {
  .section { padding: 48px 0; }
  section { padding: 44px 0; }
}

/* ── 9. SPLIT / STORY PANEL ─────────────────────────────────── */
.split {
  width: 100%;
}

@media (max-width: 1024px) {
  .split { grid-template-columns: 1fr; gap: 32px; }
}

@media (max-width: 760px) {
  .story-panel { padding: 22px; }
}

@media (max-width: 480px) {
  .story-panel { padding: 18px; }
}

/* ── 10. PHOTO STACK ────────────────────────────────────────── */
@media (max-width: 760px) {
  .photo-stack { grid-template-columns: 1fr; }
  .photo-stack .media-frame,
  .photo-stack .placeholder {
    grid-column: auto;
    aspect-ratio: 16/10;
    min-height: 0;
  }
}

/* ── 11. SERVICES GRID ──────────────────────────────────────── */
@media (max-width: 1024px) {
  .services-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .services-grid { grid-template-columns: 1fr; }
  .service-card { padding: 20px; min-height: auto; }
  .service-card-featured { border-left: 4px solid #b88945; }
}

@media (max-width: 480px) {
  .service-card { padding: 18px; }
}

/* ── 12. SHOWCASE GRID ──────────────────────────────────────── */
.showcase-grid {
  width: 100%;
}

@media (max-width: 1024px) {
  .showcase-grid { grid-template-columns: 1fr; gap: 16px; }
  .showcase-grid .media-frame,
  .showcase-grid .placeholder { aspect-ratio: 16/10; }
}

@media (max-width: 760px) {
  .showcase-side { gap: 12px; }
}

/* ── 13. PROCESS GRID ───────────────────────────────────────── */
@media (max-width: 1024px) {
  .process-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 760px) {
  .process-grid { grid-template-columns: 1fr; }
  .process-step { padding: 18px; min-height: auto; }
}

@media (max-width: 480px) {
  .process-step { padding: 16px; }
  .process-step h3 { font-size: 1rem; }
}

/* ── 14. TRUST GRID & DOCUMENTATION SUPPORT ────────────────── */
@media (max-width: 1024px) {
  .trust-grid { grid-template-columns: 1fr; gap: 20px; }
}

/* Base — enforce box model on all trust elements */
.trust-card,
.document-grid,
.doc-item {
  box-sizing: border-box;
}

.trust-card {
  width: 100%;
  overflow: hidden;
}

.document-grid {
  width: 100%;
  margin: 0;
  padding: 0;
}

.doc-item {
  width: 100%;
  margin: 0;
  align-items: flex-start;
}

.doc-item i {
  flex-shrink: 0;
  margin-top: 2px;
}

.doc-item span {
  min-width: 0;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* ≤760px: single column, consistent padding */
@media (max-width: 760px) {
  .trust-card { padding: 20px; }
  .document-grid { grid-template-columns: 1fr; gap: 10px; }
  .doc-item { padding: 12px 14px; }
}

/* ≤480px: tighter but still equal on all sides */
@media (max-width: 480px) {
  .trust-card { padding: 16px; }
  .document-grid { gap: 8px; }
  .doc-item { padding: 11px 12px; gap: 10px; }
}

/* ≤360px (320px): minimum comfortable spacing */
@media (max-width: 360px) {
  .trust-card { padding: 14px; }
  .document-grid { gap: 7px; }
  .doc-item { padding: 10px 11px; gap: 9px; font-size: .88rem; }
}

/* ── 14b. CONTACT PERSON IMAGE — show full image, no crop ───── */
/*
  The figure has inline style="aspect-ratio:16/9;min-height:220px"
  object-fit:cover crops the logo/portrait. Switch to contain so
  the full image is always visible inside the frame.
*/
.trust-card .media-frame img {
  object-fit: contain;
  background: #f3ece0;
}

/* Remove the min-height that forces cropping on mobile */
@media (max-width: 760px) {
  .trust-card .media-frame {
    min-height: 0 !important;
    aspect-ratio: 16/9;
  }
}

@media (max-width: 480px) {
  .trust-card .media-frame {
    aspect-ratio: 4/3;
  }
}

/* ── 15. TESTIMONIALS ───────────────────────────────────────── */
@media (max-width: 1024px) {
  .testimonial-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .testimonial-grid { grid-template-columns: 1fr; }
}

/* ── 16. VIDEO SECTION ──────────────────────────────────────── */
/*
   Video card system — supports:
   - Horizontal (16:9): site walkthroughs, drone, house tours
   - Vertical (9:16):   Instagram reels, construction progress
   - Lazy loading via loading="lazy" on <video> / <img>
   - MP4 upload ready via <video> tag inside .media-frame
*/

.video-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  align-items: stretch;
  width: 100%;
}

.video-card {
  background: #fff;
  border: 1px solid #e5dfd4;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
}

/* Horizontal video card */
.video-card.horizontal .media-frame,
.video-card.horizontal .video-placeholder {
  aspect-ratio: 16/9;
  width: 100%;
  border-radius: 0;
  border: 0;
  overflow: hidden;
}

/* Vertical video card */
.video-card.vertical {
  background: linear-gradient(180deg, #fff, #f7f2e9);
}

.video-card.vertical .media-frame,
.video-card.vertical .video-placeholder {
  aspect-ratio: 9/16;
  width: min(62%, 230px);
  max-height: 410px;
  margin: 20px auto;
  border: 1px solid rgba(185,168,133,.45);
  border-radius: 8px;
  overflow: hidden;
}

/* Native video element inside cards */
.video-card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #1a1a1a;
}

/* Video placeholder (before upload) */
.video-placeholder {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, #1a2e2a, #0d1f1b);
  color: rgba(255,255,255,.7);
  text-align: center;
  padding: 24px;
  min-height: 160px;
}

.video-placeholder i {
  font-size: 2.2rem;
  color: #b88945;
  display: block;
}

.video-placeholder span {
  font-size: .88rem;
  font-weight: 600;
  color: rgba(255,255,255,.85);
  display: block;
}

.video-placeholder small {
  font-size: .76rem;
  color: rgba(255,255,255,.5);
  display: block;
}

.video-placeholder .upload-tag {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(184,137,69,.9);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.video-body {
  padding: 16px 18px 18px;
  flex: 1;
}

.video-body h3 {
  font-size: 1.05rem;
  color: #123b34;
  margin-bottom: 6px;
}

.video-body p {
  color: #68756f;
  font-size: .88rem;
  line-height: 1.5;
}

.video-type-tag {
  display: inline-block;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #b88945;
  margin-bottom: 6px;
}

/* Responsive video grid */
@media (max-width: 1024px) {
  .video-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .video-card.vertical .media-frame,
  .video-card.vertical .video-placeholder { width: min(55%, 220px); }
}

@media (max-width: 760px) {
  .video-grid { grid-template-columns: 1fr; gap: 16px; }
  .video-card.vertical .media-frame,
  .video-card.vertical .video-placeholder {
    width: min(70%, 260px);
    max-height: none;
  }
}

@media (max-width: 480px) {
  .video-card.vertical .media-frame,
  .video-card.vertical .video-placeholder {
    width: 100%;
    max-height: none;
    margin: 0;
    border-radius: 0;
    border: 0;
  }
  .video-body { padding: 14px 16px 16px; }
}

/* ── 17. PROPERTY GRID ──────────────────────────────────────── */
@media (max-width: 1024px) {
  .property-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .property-grid { grid-template-columns: 1fr; }
  .property-body { padding: 18px; }
}

@media (max-width: 480px) {
  .property-meta { grid-template-columns: 1fr; gap: 6px; }
  .property-card .media-frame,
  .property-card .placeholder { min-height: 0; }
}

/* ── 18. CTA SECTION ────────────────────────────────────────── */
.cta-box {
  width: 100%;
}

@media (max-width: 1024px) {
  .cta-box { grid-template-columns: 1fr; gap: 20px; }
  .cta-box .btn { width: 100%; justify-content: center; max-width: 320px; }
}

@media (max-width: 480px) {
  .cta-box .btn { max-width: 100%; }
  .cta h2 { font-size: clamp(1.6rem, 7vw, 2.4rem); }
}

/* ── 19. LEAD FORM / CONTACT SECTION ────────────────────────── */
.lead-wrap {
  width: 100%;
}

@media (max-width: 1024px) {
  .lead-wrap { grid-template-columns: 1fr; gap: 24px; }
}

@media (max-width: 760px) {
  .lead-panel,
  .lead-form { padding: 22px; }
}

@media (max-width: 480px) {
  .lead-panel,
  .lead-form { padding: 18px; }
  .lead-form input,
  .lead-form select { height: 52px; }
  .lead-form .btn { width: 100%; }
}

/* ── 20. SOCIAL LINKS ───────────────────────────────────────── */
.social-links {
  flex-wrap: wrap;
}

@media (max-width: 480px) {
  .social-links { gap: 8px; }
  .social-links a { padding: 10px 12px; font-size: .82rem; }
}

/* ── 21. CAPTION — prevent overflow on mobile ───────────────── */
@media (max-width: 480px) {
  .caption {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    border-radius: 0;
    margin-top: 0;
  }
}

/* ── 22. MEDIA FRAMES ───────────────────────────────────────── */
.media-frame {
  overflow: hidden;
  max-width: 100%;
}

.media-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  max-width: 100%;
}

/* ── 23. STICKY FLOATING BUTTONS ────────────────────────────── */
/*
  Two buttons: 52px each + 10px gap = 114px total height.
  Position them so they never overlap section content.
  right:18px keeps them inside viewport on all screen sizes.
*/
.sticky-actions {
  position: fixed;
  right: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 60;
  display: grid;
  gap: 10px;
  /* Prevent right overflow */
  max-width: calc(100vw - 18px);
}

.sticky-actions a {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 1.2rem;
  box-shadow: 0 14px 30px rgba(18,59,52,.22);
  min-width: 44px;
  min-height: 44px;
  flex-shrink: 0;
}

/* Add bottom padding to last section so buttons never overlap it */
main > section:last-of-type,
main > .section:last-of-type {
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}

@media (max-width: 760px) {
  main > section:last-of-type,
  main > .section:last-of-type {
    padding-bottom: calc(130px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 480px) {
  .sticky-actions {
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    gap: 8px;
  }
  .sticky-actions a {
    width: 48px;
    height: 48px;
    font-size: 1.1rem;
  }
  main > section:last-of-type,
  main > .section:last-of-type {
    padding-bottom: calc(120px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 360px) {
  .sticky-actions {
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
  }
  .sticky-actions a { width: 44px; height: 44px; font-size: 1rem; }
}

/* ── 24. FOOTER ─────────────────────────────────────────────── */
.footer-wrap {
  flex-wrap: wrap;
}

@media (max-width: 600px) {
  .footer-wrap {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .footer-wrap p { font-size: .84rem; }
  .footer-wrap strong { font-size: .92rem; }
}

/* about.html / contact.html inline-style footer */
@media (max-width: 600px) {
  footer .container {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 16px !important;
  }
}

/* ── 25. SECTION HEAD ───────────────────────────────────────── */
@media (max-width: 480px) {
  .section-head { text-align: left; max-width: 100%; }
  .section-head h2 { font-size: clamp(1.5rem, 7vw, 2rem); }
}

/* ── 26. ABOUT PAGE — mission/vision ────────────────────────── */
@media (max-width: 768px) {
  .mission-vision { grid-template-columns: 1fr; gap: 20px; }
}

@media (max-width: 480px) {
  .card-highlight { padding: 18px; border-radius: 16px; }
  .who-we-are { padding: 20px !important; border-radius: 16px !important; }
}

/* ── 27. CONTACT PAGE ───────────────────────────────────────── */
@media (max-width: 768px) {
  .contact-grid { grid-template-columns: 1fr; gap: 20px; }
  .contact-card,
  .form-card { padding: 20px; border-radius: 16px; }
  .info-row { grid-template-columns: 1fr; gap: 16px; }
  .map { height: 260px; border-radius: 16px; }
}

@media (max-width: 480px) {
  .contact-card,
  .form-card { padding: 16px; }
  .map { height: 220px; border-radius: 12px; }
  .contact-item { gap: 10px; }
}

/* ── 28. SECTION PADDING — all pages ───────────────────────────*/
@media (max-width: 768px) {
  section { padding: 56px 0; }
  .section { padding: 56px 0; }
}

@media (max-width: 480px) {
  section { padding: 44px 0; }
  .section { padding: 44px 0; }
  .container { width: 91vw; }
}

@media (max-width: 360px) {
  section { padding: 36px 0; }
  .section { padding: 36px 0; }
  .container { width: 93vw; }
}

/* ── 29. OVERFLOW SAFETY NET ────────────────────────────────── */
/* Catch any element that might still overflow */
@media (max-width: 768px) {
  .hero,
  .service-hero,
  .section,
  section,
  footer,
  nav {
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* Fix any fixed-width elements */
  [style*="min-width"] {
    min-width: 0 !important;
  }
}
