/**
 * PC Scientist — sitewide responsive (phones → 4K TV).
 * Load after style.css on index, services, locations, company, blog, legal.
 */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: clip;
}

body {
  overflow-x: clip;
  max-width: 100%;
}

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

.container,
.container-fluid,
.container-lg,
.container-md,
.container-sm,
.container-xl,
.container-xxl {
  width: 100%;
  max-width: 100%;
  padding-left: max(0.75rem, env(safe-area-inset-left, 0px));
  padding-right: max(0.75rem, env(safe-area-inset-right, 0px));
}

/* Contact modal & CTAs — touch-friendly on phones, not oversized on TV */
.pc-modal-btn {
  min-height: 3rem;
}

.pc-modal-close {
  min-width: 44px;
  min-height: 44px;
}

.pc-modal {
  padding-left: max(12px, env(safe-area-inset-left, 0px));
  padding-right: max(12px, env(safe-area-inset-right, 0px));
}

.pc-modal-card,
.pc-modal__dialog,
.pc-modal-content {
  width: min(100%, 28rem);
  max-height: min(92vh, 92dvh, 100dvh);
  margin-left: auto;
  margin-right: auto;
}

#callbackModal .pc-modal-card,
#quoteModal .pc-modal-card,
#bookModal .pc-modal-card {
  width: min(100%, 60rem);
}

/* Sticky call tab is vertically centred — do not add safe-area bottom padding (misaligns icon on iOS). */

/* iPhone SE / narrow phones (≤390px) */
@media (max-width: 390px) {
  .pc-modal-btn {
    padding: 0.85rem 0.9rem;
    font-size: 0.9rem;
  }

  .header-area .container,
  .header__main {
    padding-left: max(0.5rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.5rem, env(safe-area-inset-right, 0px));
  }
}

/* Tablets & small laptops — avoid vw (scrollbar + mobile chrome resize layout) */
@media (min-width: 768px) {
  .container {
    max-width: min(720px, calc(100% - 2rem));
  }
}

@media (min-width: 992px) {
  .container {
    max-width: min(960px, calc(100% - 2.5rem));
  }
}

/* Laptop / desktop */
@media (min-width: 1200px) {
  .container {
    max-width: min(1140px, calc(100% - 3rem));
  }

  .pc-modal-card,
  .pc-modal__dialog,
  .pc-modal-content {
    width: min(100%, 32rem);
  }
}

/* 27″ monitors (~1920px) */
@media (min-width: 1920px) {
  .container {
    max-width: min(1280px, calc(100% - 4rem));
  }

  body {
    font-size: 1.0625rem;
  }

  h1,
  .section-title h2 {
    font-size: clamp(1.75rem, 1.2vw + 1rem, 2.75rem);
  }
}

/* 32″ / QHD (~2560px) */
@media (min-width: 2560px) {
  .container {
    max-width: min(1400px, calc(100% - 5rem));
  }

  .pc-modal-card,
  .pc-modal__dialog,
  .pc-modal-content {
    width: min(100%, 36rem);
  }
}

/* 4K TV (~3840px) */
@media (min-width: 3840px) {
  .container {
    max-width: min(1520px, calc(100% - 6rem));
  }

  .pc-modal-btn {
    max-width: 36rem;
    margin-left: auto;
    margin-right: auto;
  }
}

/* Foldables / very wide but short (Nest Hub, Duo) */
@media (max-height: 500px) and (min-width: 600px) {
  .pc-modal {
    align-items: flex-start;
  }

  .pc-modal-card,
  .pc-modal__dialog,
  .pc-modal-content {
    max-height: min(94vh, 94dvh);
    overflow-y: auto;
  }

  .pc-modal-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (prefers-reduced-motion: reduce) {
  html.pcs-reduce-motion *,
  html.pcs-reduce-motion *::before,
  html.pcs-reduce-motion *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .wow {
    visibility: visible !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
