/**
 * Lotus Grand Projects — global responsive overrides for theme + all LGP Elementor widgets.
 * Breakpoints: 480 (phone), 768 (tablet), 992 (desktop nav / tablet landscape).
 * Loaded last so it can override theme + plugin page CSS.
 */

/* -------------------------------------------------------------------------- */
/* Base safety                                                                */
/* -------------------------------------------------------------------------- */
img,
svg,
video,
canvas,
iframe {
  max-width: 100%;
  height: auto;
}

.elementor-section,
.elementor-container,
.elementor-column,
.elementor-widget-wrap,
.elementor-widget,
.elementor-widget-container,
[class^="lgp-"],
[class*=" lgp-"] {
  max-width: 100%;
  box-sizing: border-box;
}

.btn,
.work-card,
.highlight-card,
.cta-card,
.philosophy-card,
.ba-frame,
.before-after-container {
  max-width: 100%;
}

html,
body {
  overflow-x: hidden;
}

/* Shared WhatsApp booking form responses (home + contact) */
.form-field-error {
  border-color: #c0392b !important;
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.12);
}

.lgp-form-message {
  display: none;
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.45;
}

.lgp-form-message.is-visible {
  display: block;
}

.lgp-form-message--error {
  background: rgba(192, 57, 43, 0.08);
  border: 1px solid rgba(192, 57, 43, 0.25);
  color: #8e1b12;
}

.lgp-form-message--success {
  background: rgba(30, 130, 76, 0.1);
  border: 1px solid rgba(30, 130, 76, 0.25);
  color: var(--color-brand);
}

.lgp-form-message--info {
  background: rgba(10, 10, 10, 0.05);
  border: 1px solid var(--color-border);
  color: var(--color-secondary);
}

/* Fluid form rows (desktop default; stacked below) */
.lgp-form-row--2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

.usp-banner-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: var(--space-4);
}

.channel-cards-grid,
.svc-usp-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)) !important;
}

/* -------------------------------------------------------------------------- */
/* Phone / tablet (≤768)                                                      */
/* -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  :root {
    --header-height: 72px;
  }

  .container {
    padding-left: var(--space-4) !important;
    padding-right: var(--space-4) !important;
  }

  .section-padding {
    padding-top: var(--space-12) !important;
    padding-bottom: var(--space-12) !important;
  }

  /* ---- Typography ---- */
  .hero__title {
    font-size: clamp(2.25rem, 11vw, 3.25rem) !important;
    line-height: 1.05;
    letter-spacing: -0.04em;
  }

  .section-title,
  .detail-h2,
  .project-hero__title,
  .dark-showcase__title,
  .std-heading h2,
  .about-block-grid h2 {
    font-size: clamp(1.75rem, 7vw, 2.5rem) !important;
    line-height: 1.1;
    word-break: break-word;
  }

  .lgp-home-contact-form-card h2,
  .cta-card h3,
  .contact-heading h2,
  .contact-hero-grid h1,
  .about-hero-grid h1 {
    font-size: clamp(1.6rem, 6vw, 2.1rem) !important;
  }

  /* ---- Header (all LGP page headers) ---- */
  .header__container,
  [class*="lgp-"] .header__container,
  .site-header .container {
    gap: var(--space-3);
    flex-wrap: nowrap;
    overflow: visible;
  }

  .header .logo {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
  }

  .header .btn--primary,
  [class*="-header"] .btn--primary {
    padding: 0.4rem 0.4rem 0.4rem 0.85rem !important;
    font-size: 0.75rem !important;
    flex-shrink: 1;
    min-width: 0;
    max-width: min(42vw, 168px);
    white-space: nowrap;
    overflow: hidden;
  }

  .header .btn--primary .btn__arrow,
  [class*="-header"] .btn__arrow {
    width: 24px !important;
    height: 24px !important;
    flex-shrink: 0;
  }

  .header .logo {
    gap: 0.4rem;
  }

  .header .logo span,
  .logo span {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    font-size: 0.82rem !important;
    line-height: 1.15 !important;
    letter-spacing: -0.03em !important;
    min-width: 0;
    max-width: none;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    word-break: normal;
  }

  .logo img {
    height: 40px !important;
    width: auto !important;
    flex-shrink: 0;
  }

  .header__container > div:last-child {
    gap: var(--space-2) !important;
  }

  /* ---- Heroes / CTA rows ---- */
  .hero {
    padding-top: var(--space-8);
    padding-bottom: var(--space-8);
  }

  .hero-grid,
  .about-hero-grid,
  .contact-hero-grid,
  .about-block-grid {
    grid-template-columns: 1fr !important;
    gap: var(--space-8) !important;
  }

  .hero__actions,
  .project-hero__actions,
  .about-hero-grid .hero__actions,
  .contact-hero-grid > div:first-child > div:last-of-type,
  .contact-hero-actions,
  .lgp-cta-row,
  .hero-cta-row {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: var(--space-3) !important;
  }

  .hero__actions .btn,
  .project-hero__actions .btn,
  .cta-card .btn,
  .about-hero-grid .btn,
  .contact-hero-grid .btn,
  .contact-hero-actions .btn,
  .dark-showcase__header .btn {
    width: 100% !important;
    max-width: 100%;
    display: inline-flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    white-space: nowrap;
  }

  .hero-features {
    gap: var(--space-3) !important;
    margin-top: var(--space-8) !important;
    flex-direction: column !important;
  }

  .hero-feature-item {
    width: 100%;
    justify-content: flex-start;
  }

  .hero__media {
    margin-top: var(--space-8);
  }

  .hero__medallion,
  body.lgp-page-home .hero__medallion {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    top: auto !important;
    margin: var(--space-4) auto 0 !important;
    max-width: min(220px, 70vw) !important;
  }

  /* ---- Grids → single / two column ---- */
  .tech-grid,
  .highlight-grid,
  .about-images-side,
  .services-grid,
  .towards-grid,
  .svc-usp-grid,
  .svc-row,
  .svc-row.svc-row--reverse,
  .journey-step,
  .channel-cards-grid,
  .usp-banner-grid,
  .inspection-grid,
  .service-select-grid,
  .contact-hero-grid,
  .map-location-grid,
  .detail-shell,
  .philosophy-grid {
    grid-template-columns: 1fr !important;
  }

  .work-grid,
  .lgp-work-filterable-grid .work-grid,
  .lgp-home-dark-showcase-grid .work-grid,
  .dark-showcase .work-grid {
    grid-template-columns: 1fr !important;
    gap: var(--space-6) !important;
  }

  .journey-step:nth-child(even) .journey-step__media {
    order: 0 !important;
  }

  .highlight-card {
    height: auto !important;
    min-height: 0 !important;
    padding-bottom: 0 !important;
  }

  .highlight-card__image {
    height: 180px !important;
    margin-top: var(--space-6);
  }

  .stats-grid,
  .legacy-band .stats-grid,
  body.lgp-page-about .stats-grid,
  body.lgp-page-about .about-hero-grid .stats-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: var(--space-6) !important;
  }

  .stat-number {
    font-size: clamp(2rem, 10vw, 2.75rem) !important;
  }

  /* ---- Dark showcase (home) ---- */
  .dark-showcase {
    padding: var(--space-10) var(--space-4) !important;
    border-radius: var(--radius-lg) !important;
  }

  .dark-showcase__header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: var(--space-6) !important;
  }

  /* ---- Forms / contact ---- */
  .lgp-form-row--2,
  #contactForm > div:first-child,
  .lgp-home-contact-form-card form > div:first-child {
    grid-template-columns: 1fr !important;
  }

  .lgp-home-contact-form-card > section > div,
  .lgp-home-contact-form-card [style*="padding"] {
    padding: var(--space-6) !important;
  }

  .lgp-contact-map iframe,
  .map-frame,
  .contact-map iframe {
    height: min(320px, 55vw) !important;
    min-height: 220px;
  }

  /* ---- Footer ---- */
  .footer-grid {
    grid-template-columns: 1fr !important;
    gap: var(--space-8) !important;
  }

  .footer-bottom {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: var(--space-4);
  }

  /* ---- CTA bands ---- */
  .cta-card {
    padding: var(--space-8) var(--space-6) !important;
    text-align: center;
  }

  .cta-trust-row {
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
  }

  /* ---- Before / after ---- */
  .before-after-container,
  .ba-frame {
    aspect-ratio: 4 / 3;
    border-radius: var(--radius-md);
    max-width: 100%;
  }

  .ba-handle {
    width: 44px;
    height: 44px;
  }

  /* ---- Services ---- */
  .svc-index {
    bottom: -12px !important;
    font-size: clamp(3rem, 18vw, 5rem) !important;
  }

  .svc-features {
    padding-left: 0 !important;
  }

  .svc-media__frame,
  .arch-top {
    border-radius: var(--radius-md);
  }

  /* ---- Work listing ---- */
  .filters,
  .lgp-work-filterable-grid .filters {
    gap: var(--space-2) !important;
    justify-content: flex-start !important;
  }

  .filter-btn {
    font-size: 0.8rem !important;
    padding: 0.5rem 0.85rem !important;
  }

  .work-search-row,
  .work-toolbar,
  .lgp-work-filterable-grid [style*="max-width: 480px"] {
    max-width: 100% !important;
    width: 100% !important;
  }

  .lgp-work-filterable-grid input[type="search"],
  #projectSearchInput {
    width: 100% !important;
  }

  .towards-card {
    height: 200px !important;
  }

  /* ---- About ---- */
  .philosophy-card {
    padding: var(--space-8) var(--space-6) !important;
  }

  .philosophy-mark {
    font-size: clamp(3rem, 16vw, 5rem) !important;
  }

  .about-badge,
  .floating-badge {
    white-space: normal !important;
    max-width: min(220px, 70vw);
    font-size: 0.75rem;
  }

  /* ---- Work detail ---- */
  .rail-inner {
    position: static !important;
  }

  .project-hero {
    height: auto !important;
    min-height: 420px !important;
    padding-top: calc(var(--header-height) + var(--space-12));
  }

  .project-hero__content {
    padding-bottom: var(--space-12) !important;
    max-width: 100% !important;
  }

  .hero-scroll-cue {
    display: none !important;
  }

  .detail-subnav__inner {
    gap: var(--space-3);
    padding-right: var(--space-4);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .detail-subnav__cta {
    flex-shrink: 0;
    font-size: 0.75rem;
    padding: 0.45rem 0.75rem;
  }

  .detail-subnav__link {
    font-size: 0.85rem;
    white-space: nowrap;
  }

  .gallery-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: var(--space-3) !important;
  }

  .lightbox-modal img {
    max-width: 92vw;
    max-height: 70vh;
  }

  .floating-cta,
  #floatingCta {
    right: var(--space-4) !important;
    bottom: var(--space-4) !important;
    left: auto !important;
  }

  .testimonial-quote {
    font-size: clamp(1.15rem, 5vw, 1.5rem) !important;
  }

  .story-tabs,
  .story-tab-list {
    flex-wrap: wrap !important;
    gap: var(--space-2) !important;
  }

  /* ---- Elementor overflow ---- */
  .elementor-section.elementor-section-boxed > .elementor-container {
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .elementor-column-gap-default > .elementor-column > .elementor-element-populated {
    padding-left: var(--space-3) !important;
    padding-right: var(--space-3) !important;
  }
}

/* -------------------------------------------------------------------------- */
/* Narrow phones (≤480)                                                       */
/* -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .container {
    padding-left: var(--space-3) !important;
    padding-right: var(--space-3) !important;
  }

  .stats-grid,
  .legacy-band .stats-grid,
  body.lgp-page-about .stats-grid {
    grid-template-columns: 1fr !important;
    text-align: center;
  }

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

  .work-grid,
  .lgp-work-filterable-grid .work-grid,
  .dark-showcase .work-grid {
    grid-template-columns: 1fr !important;
  }

  .project-hero {
    min-height: 360px !important;
  }

  .about-badge,
  .floating-badge {
    position: static !important;
    transform: none !important;
    margin: var(--space-2) 0 0;
    display: inline-flex;
  }

  .cta-card,
  .dark-showcase,
  .work-card {
    border-radius: var(--radius-md) !important;
  }

  /* Keep company name beside logo; shrink CTA to icon-only for space */
  .header .logo span,
  .logo span {
    display: inline-block !important;
    font-size: 0.72rem !important;
    line-height: 1.1 !important;
    max-width: 9.5rem;
  }

  .header .btn--primary,
  [class*="-header"] .btn--primary {
    max-width: none;
    padding: 0.35rem !important;
    font-size: 0 !important;
    gap: 0 !important;
    line-height: 0;
    flex-shrink: 0;
  }

  .header .btn--primary .btn__arrow,
  [class*="-header"] .btn__arrow {
    font-size: 0.75rem !important;
    width: 32px !important;
    height: 32px !important;
  }
}

/* -------------------------------------------------------------------------- */
/* Mobile header nav stacking (≤992) — close control above overlay            */
/* -------------------------------------------------------------------------- */
@media (max-width: 992px) {
  .header {
    z-index: 200;
  }

  .header .nav {
    z-index: 201;
  }

  .header__container > div:last-child,
  .header .nav-toggle {
    position: relative;
    z-index: 202;
  }

  .header .nav-toggle {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }

  .header .nav-toggle span {
    width: 22px;
  }
}

/* -------------------------------------------------------------------------- */
/* Tablet landscape / small desktop (769–991)                                 */
/* -------------------------------------------------------------------------- */
@media (min-width: 769px) and (max-width: 991px) {
  .tech-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .work-grid,
  .lgp-work-filterable-grid .work-grid,
  .dark-showcase .work-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

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

  .highlight-card {
    height: auto !important;
    min-height: 320px;
  }

  .detail-shell {
    grid-template-columns: 1fr !important;
  }

  .svc-usp-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }

  .channel-cards-grid,
  .usp-banner-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .hero__title {
    font-size: clamp(2.75rem, 6vw, 4rem);
  }

  .footer-grid {
    grid-template-columns: 1.4fr 1fr 1fr !important;
  }

  .dark-showcase__header {
    gap: var(--space-6);
  }
}

/* -------------------------------------------------------------------------- */
/* Touch-friendly controls                                                    */
/* -------------------------------------------------------------------------- */
@media (hover: none) and (pointer: coarse) {
  .share-btn,
  .filter-btn,
  .story-tab-btn,
  .testimonial-slider__btn,
  .menu-toggle {
    min-height: 44px;
    min-width: 44px;
  }

  /* nav-toggle already uses a fixed 44×44 hit target with gap-spaced bars */
  .nav-toggle {
    min-height: 44px;
    min-width: 44px;
    justify-content: center;
    gap: 5px;
  }

  .ba-handle {
    width: 48px;
    height: 48px;
  }

  .work-card__link,
  .work-card__link--static {
    -webkit-tap-highlight-color: transparent;
  }
}
