/* Global mobile polish — overflow, spacing, touch targets */
html {
  overflow-x: clip;
}

body {
  overflow-x: clip;
}

/* Scrollable mobile menu with all main sections */
#mobile-menu {
  display: none;
  flex-direction: column;
}

#mobile-menu.open {
  display: flex;
}

#mobile-menu .mobile-menu-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 1.5rem;
}

.mobile-menu-link {
  display: flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.65rem 1rem;
  border-radius: 0.75rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.mobile-menu-link:hover,
.mobile-menu-link:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  color: #c9a84c;
}

.mobile-menu-divider {
  margin: 0.5rem 1rem;
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

@media (max-width: 1023px) {
  /* Tighter horizontal padding on small phones */
  #navbar > div,
  main section .max-w-7xl,
  main section .max-w-5xl,
  main section .max-w-3xl,
  main section .max-w-2xl,
  footer .max-w-7xl {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* Section vertical rhythm */
  main section {
    scroll-margin-top: 5rem;
  }

  /* Hero headline — prevent awkward overflow */
  #hero h1 {
    font-size: clamp(1.65rem, 7.5vw, 2.25rem);
    line-height: 1.2;
    overflow-wrap: break-word;
  }

  #hero .hero-item-3 .btn-primary,
  #hero .hero-item-3 .btn-outline {
    width: 100%;
    justify-content: center;
  }

  #hero .hero-item-4 {
    gap: 1.25rem;
  }

  /* About — image card + badge in flow (no horizontal overflow) */
  #about .reveal-right img {
    height: 16rem;
  }

  #about .reveal-right .absolute {
    position: relative;
    bottom: auto;
    left: auto;
    margin-top: 1rem;
    max-width: none;
    width: 100%;
  }

  #about .mt-24 {
    margin-top: 3rem;
  }

  /* Why — quality badge in flow */
  #why .reveal-left img {
    height: 15rem;
  }

  #why .reveal-left .absolute {
    position: relative;
    top: auto;
    right: auto;
    display: inline-flex;
    margin-top: -2.5rem;
    margin-left: 1rem;
    margin-bottom: 0.5rem;
  }

  /* Project filters */
  .filter-btn {
    font-size: 0.8125rem;
    padding: 0.5rem 0.85rem;
  }

  /* License buttons full width */
  .license-btn-download,
  .license-btn-view {
    width: 100%;
  }

  .license-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.65rem;
  }

  /* Contact form — keep watermarks inside bounds */
  .contact-form-watermark-accent {
    right: 0;
    font-size: 1.25rem;
    letter-spacing: 0.15em;
  }

  .contact-form-watermark-sub {
    left: 0;
    font-size: 1.1rem;
  }

  .contact-form-watermark-outline {
    font-size: 2.5rem;
  }

  .contact-form {
    padding: 1.5rem !important;
  }

  .hours-table td {
    display: block;
    width: 100%;
    padding: 0.35rem 0;
  }

  .hours-table td:last-child {
    text-align: left;
    padding-bottom: 0.65rem;
  }

  .hours-table tr {
    display: block;
    padding: 0.25rem 0;
  }

  /* CTA banner */
  .cta-banner {
    padding: 2rem 1.25rem;
  }

  .cta-banner .btn-primary,
  .cta-banner .btn-outline {
    width: 100%;
    justify-content: center;
  }

  /* Lightbox */
  #lightbox {
    padding: 1rem;
    padding-top: 3.5rem;
  }

  #lightbox-close {
    top: 1rem;
    right: 1rem;
  }

  #lightbox img {
    max-height: 70vh;
  }

  /* Fixed buttons — safe area for notched phones */
  .back-to-home {
    bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
    right: max(1.25rem, env(safe-area-inset-right, 0px));
  }

  .whatsapp-float {
    bottom: max(5.5rem, calc(5.5rem + env(safe-area-inset-bottom, 0px)));
    right: max(1rem, env(safe-area-inset-right, 0px));
  }

  /* Profile cards — long text wraps */
  .profile-card-value {
    font-size: 0.975rem;
  }

  /* Footer copyright stacks cleanly */
  footer .md\:flex-row {
    text-align: center;
  }
}

@media (max-width: 380px) {
  #hero h1 {
    font-size: 1.55rem;
  }

  #hero .hero-item-4 {
    grid-template-columns: 1fr;
    display: grid;
  }

  .nav-brand-name-light {
    display: none;
  }

  .nav-brand-name-gold::after {
    content: " Construction";
    color: rgba(255, 255, 255, 0.92);
    font-weight: 700;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-menu-link {
    transition: none;
  }
}
