/* =========================
   Aqualis Mobile Polish (v1)
   Breakpoints: ≤768px (tablet/phone), ≤480px (small phones)
   ========================= */

/* Global: prevent horizontal scroll and ensure images/tables behave */
@media (max-width: 768px) {
  html, body { overflow-x: hidden; }
  img, video, iframe { max-width: 100% !important; height: auto !important; }
  table { display: block; width: 100% !important; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* Space below sticky header */
  body { scroll-padding-top: 80px; }
}

/* Containers and layout */
@media (max-width: 768px) {
  .container, main, section, article, .content, .wrap, .inner {
    max-width: none !important;
    width: 100% !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
    box-sizing: border-box !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  .grid, .row, .columns, .cards { display: block !important; }
  [class*="col-"], [class*="column"] { width: 100% !important; }
}

/* Header (unified behavior on mobile) */
@media (max-width: 768px) {
  header .container.nav {
    display: flex !important; align-items: center !important; justify-content: space-between !important;
    gap: 12px !important; padding: 10px 14px !important;
  }
  header .brand img { height: 56px !important; width: auto !important; }
  nav.links { display: flex !important; gap: 10px !important; overflow-x: auto !important; white-space: nowrap !important; }
  nav.links a { text-decoration: none !important; font-weight: 700 !important; }
}

/* Footer spacing */
@media (max-width: 768px) {
  footer.site-footer .container { padding-left: 16px !important; padding-right: 16px !important; }
}

/* Typography + hero headings */
@media (max-width: 768px) {
  body { font-size: 16px; line-height: 1.45; }
  h1 { font-size: clamp(22px, 6.2vw, 32px); line-height: 1.2; }
  h2 { font-size: clamp(18px, 5.2vw, 26px); line-height: 1.25; }
  h3 { font-size: clamp(16px, 4.5vw, 22px); line-height: 1.3; }
  /* Protect against overflow headings */
  h1, h2, h3 { white-space: normal !important; overflow-wrap: anywhere !important; word-break: break-word !important; }
}

/* Home hero specific: ensure fits */
@media (max-width: 768px) {
  body.home-page h1,
  body.home-page .hero h1,
  body.home-page h1.dark-navy-text,
  body.home-page .headline {
    font-size: clamp(20px, 6vw, 30px) !important;
    text-align: center !important;
    letter-spacing: normal !important;
  }
  .hero, .hero .container, .hero .content, .hero .wrap {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
    box-sizing: border-box !important;
  }
  /* Nuke transforms that can push content off-screen */
  .hero, .hero * { transform: none !important; }
}

/* Cards (Careers + others) */
@media (max-width: 768px) {
  .job-card, .card {
    background: #ffffff !important;
    color: #001f3f !important;
    border: 1px solid #001f3f0d !important; /* subtle border */
    border-radius: 12px !important;
    padding: 18px !important;
    margin: 16px 0 !important;
    box-shadow: 0 3px 10px rgba(0,0,0,0.06) !important;
  }
  .job-card h1, .job-card h2, .job-card h3,
  .card h1, .card h2, .card h3 { color: #001f3f !important; }
}

/* Buttons / CTAs: bigger tap targets */
@media (max-width: 768px) {
  .btn, a.button, button {
    min-height: 44px; padding: 10px 16px; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
  }
}

/* Small phones (≤480px): slightly tighter type & padding */
@media (max-width: 480px) {
  header .brand img { height: 52px !important; }
  .container, main, section, article, .content, .wrap, .inner { padding-left: 14px !important; padding-right: 14px !important; }
  h1 { font-size: clamp(20px, 6.8vw, 28px); }
}

/* =========================
   Aqualis Mobile Polish (v2)
   - Smaller home hero on small phones
   - Active nav highlight
   - Tighter vertical spacing
   ========================= */

/* Smaller hero heading on small phones */
@media (max-width: 480px) {
  body.home-page h1,
  body.home-page .hero h1,
  body.home-page h1.dark-navy-text,
  body.home-page .headline {
    font-size: clamp(18px, 5.5vw, 26px) !important;
    line-height: 1.2 !important;
    letter-spacing: normal !important;
  }
}

/* Active nav highlight style (class applied via tiny script) */
@media (max-width: 1200px) {
  nav.links a.active {
    text-decoration: underline !important;
    text-underline-offset: 4px;
  }
}

/* Tighter vertical spacing on mobile */
@media (max-width: 768px) {
  section { padding-top: 12px !important; padding-bottom: 12px !important; }
  .container > h1, .container > h2, .container > h3 { margin-top: 10px !important; margin-bottom: 10px !important; }
  .container p { margin-top: 8px !important; margin-bottom: 8px !important; }
  .job-card, .card { margin: 12px 0 !important; padding: 16px !important; }
}

/* =========================
   Aqualis Mobile Polish (v3)
   Targeted for iPhone 16 / 17 Pro (~390–460 CSS px width)
   - Safer hero clamp + line-height
   - 95vw max-width and auto centering for hero text blocks
   - Tighter hero vertical padding
   ========================= */
@media (min-width: 390px) and (max-width: 460px) {
  /* Hero heading never overflows on tall/large iPhones */
  body.home-page h1,
  body.home-page .hero h1,
  body.home-page h1.dark-navy-text,
  body.home-page .headline,
  .hero .headline {
    font-size: clamp(18px, 5.2vw, 28px) !important;
    line-height: 1.15 !important;
    max-width: 95vw !important;
    margin-left: auto !important;
    margin-right: auto !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }
  /* Ensure hero blocks don't push beyond the viewport */
  .hero, .hero .container, .hero .content, .hero .wrap {
    padding-top: 14px !important;
    padding-bottom: 14px !important;
    max-width: 100% !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
  }
  /* Make any columns stack and avoid fixed widths */
  [class*="col-"], [class*="column"] { width: 100% !important; }
  [style*="width:"] { width: 100% !important; max-width: 100% !important; }
}


/* ==== OVERRIDES (placed at end): ensure Contact link is visible on 14" laptops ==== */
@media (max-width: 1366px) {
  /* Let the header row wrap when space is tight */
  header .container.nav, .container.nav {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: wrap !important;
    row-gap: 6px !important;
  }

  /* Place the nav on the next line if needed and allow wrapping */
  nav.links {
    display: flex !important;
    flex-wrap: wrap !important;
    flex-basis: 100% !important;
    white-space: normal !important;
    overflow: visible !important;
    gap: 10px 14px !important;
  }

  /* Slightly smaller/tighter items to fit common laptop widths */
  nav.links a {
    font-size: 16px !important;
    padding: 6px 8px !important;
    line-height: 1.2 !important;
  }

  /* Keep the logo from crowding the links */
  .container.nav .brand img {
    max-height: 56px !important;
    height: auto !important;
    width: auto !important;
  }
}

/* Explicitly cancel any previous nowrap/scroll behavior */
nav.links {
  white-space: normal !important;
  overflow-x: visible !important;
}



/* ===== Aqualis Header Fix v3 =====
   Goal: keep logo aligned with buttons and ensure full nav visibility on 14" laptops
*/

/* General: tighten header spacing a bit */
header { padding-top: 10px !important; padding-bottom: 10px !important; }

@media (max-width: 1366px) {
  /* Header row wraps cleanly into two rows when needed */
  header .container.nav, .container.nav {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    column-gap: 16px !important;
    row-gap: 6px !important;
  }

  /* Brand/logo stays on the first row and is vertically centered */
  .container.nav .brand {
    display: flex !important;
    align-items: center !important;
    order: 1 !important;
    flex: 0 0 auto !important;
  }
  .container.nav .brand img {
    max-height: 48px !important;
    height: 48px !important;
    width: auto !important;
  }

  /* Nav moves to the next line and spans full width; centered alignment with wrapping */
  nav.links {
    order: 2 !important;
    flex: 1 1 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important; /* center the buttons; change to flex-start if you want left-aligned */
    flex-wrap: wrap !important;
    gap: 8px 14px !important;
    white-space: normal !important;
    overflow: visible !important;
  }

  /* Make links compact enough to fit typical 1366×768 and 1920×1200 heights */
  nav.links a {
    font-size: 15px !important;
    line-height: 1.2 !important;
    padding: 6px 10px !important;
  }
}

/* Smaller laptop/tablet widths */
@media (max-width: 1024px) {
  nav.links a { font-size: 14px !important; padding: 6px 8px !important; }
}

/* Kill any lingering nowrap/scroll rules from earlier styles */
nav.links { white-space: normal !important; overflow-x: visible !important; }



/* ==== Aqualis Header Alignment Fix v4 ====
   Move navigation buttons up by 15px to align better with logo on 14" screens
*/
@media (max-width: 1366px) {
  nav.links {
    position: relative !important;
    top: -15px !important;
  }
}



/* ==== Aqualis Header Alignment + Font Size Fix v5 ====
   Move navigation buttons up 20px and enlarge font by 5px
*/
@media (max-width: 1366px) {
  nav.links {
    position: relative !important;
    top: -20px !important;
  }
  nav.links a {
    font-size: calc(1em + 5px) !important;
  }
}



/* ===== Aqualis Header Layout v6 =====
   Goal: logo on left, buttons centered in white bar, vertically aligned with logo.
   Implementation: use CSS Grid on the header container to keep brand on the left and
   center the nav in the middle column. Also reset earlier top offsets.
*/

/* Base header alignment */
header { padding-top: 12px !important; padding-bottom: 12px !important; }

/* Use grid so brand stays left and nav sits centered regardless of brand width */
.container.nav {
  display: grid !important;
  grid-template-columns: auto 1fr !important;
  align-items: center !important;        /* vertical alignment with logo */
  column-gap: 16px !important;
}

/* Brand stays on the left */
.container.nav .brand {
  justify-self: start !important;
  display: flex !important;
  align-items: center !important;
}

/* Keep logo size reasonable so nav has room */
.container.nav .brand img {
  max-height: 56px !important;
  height: auto !important;
  width: auto !important;
}

/* Nav centered in the available space */
nav.links {
  justify-self: center !important;       /* center horizontally within grid */
  display: flex !important;
  align-items: center !important;        /* vertical alignment */
  justify-content: center !important;
  flex-wrap: wrap !important;            /* allow wrap if needed */
  gap: 10px 16px !important;
  white-space: normal !important;
  overflow: visible !important;

  /* Undo earlier positional offsets */
  position: static !important;
  top: 0 !important;
}

/* Keep the larger font from the last change */
nav.links a {
  font-size: calc(1em + 5px) !important;
  line-height: 1.2 !important;
  padding: 6px 10px !important;
}

/* Tuning for common laptop widths */
@media (max-width: 1366px) {
  .container.nav {
    column-gap: 14px !important;
  }
  nav.links a {
    padding: 6px 9px !important;
  }
}

/* Remove any wrapping-to-second-row rules from earlier versions */
@media (max-width: 1366px) {
  nav.links {
    flex-basis: auto !important;
  }
}



/* ==== Aqualis Header Spacing v7 ==== 
   Add 10px of white space below navigation buttons 
*/
nav.links {
  margin-bottom: 10px !important;
}

