/* Minimal responsive overrides — preserves original look, prevents overflow on small screens */
* { box-sizing: border-box; }

img, video, canvas, iframe {
  max-width: 100%;
  height: auto;
}

/* Avoid horizontal scrolling on narrow screens */
html, body {
  overflow-x: hidden;
}

/* Make embedded Google Maps/iframes scale */
.embed-responsive, .map, .video {
  position: relative;
  width: 100%;
}

/* Contact form from freecontactform.css: keep max 460px but allow shrinking */
.freecontactform {
  max-width: 460px;
  width: 100%;
}

/* Tables: allow horizontal scroll rather than breaking layout */
table {
  width: 100%;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Inputs should not overflow on mobile */
input[type="text"], input[type="email"], input[type="tel"], input[type="url"],
select, textarea {
  max-width: 100%;
}

/* Gentle typography scaling */
h1 { font-size: clamp(1.6rem, 3.5vw, 2.5rem); }
h2 { font-size: clamp(1.3rem, 2.8vw, 2rem); }
h3 { font-size: clamp(1.1rem, 2.2vw, 1.5rem); }

@media (max-width: 768px) {
  /* Generic layout helpers for common containers */
  .container, .wrapper, .content, .inner, .section, .hero, #center {
    max-width: 100%;
    width: 100%;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* Reduce large paddings/margins that cause squish */
  .pad-lg, .section, .hero {
    padding-top: 1.25rem;
    padding-bottom: 1.25rem;
  }

  /* Images inside sections shouldn't overflow */
  section img { height: auto; }

  /* Buttons/tap targets: ensure minimum touch size */
  a.button, button, .btn {
    min-height: 44px;
  }
}


/* Mobile dropdown nav */
@media (max-width: 768px) {
  nav {
    position: relative;
  }
  .nav-toggle {
    appearance: none;
    background: none;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 8px;
    padding: .5rem .75rem;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
  }
  /* Hide menu by default on small screens */
  #primary-nav {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(2px);
    padding: .5rem 0;
    margin: 0;
    list-style: none;
    min-width: 200px;
    border-radius: 10px;
  }
  nav.open #primary-nav {
    display: block;
  }
  #primary-nav li {
    padding: 0;
    margin: 0;
  }
  #primary-nav a {
    display: block;
    padding: .75rem 1rem;
  }
  /* Prevent logo from being squashed by allowing wrap and spacing */
  nav {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1rem;
  }
}


/* --- Fixes per user feedback --- */

/* Hide hamburger by default on desktop */
.nav-toggle { 
  display: none; 
}

/* Make the navigation sticky across all viewports */
nav {
  position: sticky;
  top: 0;
  z-index: 1000;
}

/* Mobile layout refinements */
@media (max-width: 768px) {
  /* Show hamburger only on small screens */
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto; /* push to the right if needed */
  }

  /* Keep logo and hamburger on the same row */
  nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap; /* avoid wrapping the button under the logo */
    gap: .5rem;
  }

  /* Constrain logo so it doesn't crowd the button */
  .logo img {
    max-height: 40px;
    height: auto;
    width: auto;
  }

  /* Keep dropdown positioning relative to the sticky nav */
  #primary-nav {
    right: 0;
    top: 100%;
  }
}


/* --- Stronger fixes --- */

/* Ensure sticky header across all viewports */
header {
  position: sticky !important;
  top: 0 !important;
  z-index: 2000 !important;
}

/* Default (desktop) — hide hamburger */
.nav-toggle { display: none; }

@media (max-width: 768px) {
  /* Prevent wrapping: keep logo + hamburger on one line */
  nav {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: nowrap !important;
    gap: .5rem !important;
  }

  /* Constrain logo so it doesn't force wrapping */
  .logo { flex: 0 1 auto; min-width: 0; }
  .logo img { 
    max-height: 36px !important; 
    max-width: 55vw !important; 
    height: auto; width: auto; 
  }

  /* Show hamburger on mobile, keep it on the same row */
  .nav-toggle { 
    display: inline-flex !important; 
    flex: 0 0 auto; 
    align-items: center; 
    justify-content: center; 
    margin-left: .5rem; 
  }

  /* Hide the inline list; show dropdown when open */
  #primary-nav { display: none; }
  nav.open #primary-nav { display: block; }

  /* Position dropdown relative to the nav */
  nav { position: relative; }
  #primary-nav {
    position: absolute;
    right: 0;
    top: 100%;
  }
}


/* --- Robust sticky (fixed) header --- */
:root { --header-h: 0px; }

/* Make header fixed so it always follows on scroll */
header {
  position: fixed !important;
  top: 0 !important;
  left: 0;
  right: 0;
  z-index: 3000 !important;
}

/* Prevent content from hiding under the fixed header */
body { padding-top: var(--header-h); }
