/* =========================================================================
   EdJo Research Solutions — Responsive & Mobile-Polish Layer
   Loaded AFTER each page's inline <style>. Keeps the existing purple/blue
   brand (--primary/--secondary/--accent) but fixes gaps in responsiveness:
   tablet breakpoint, small-phone breakpoint, fluid type, touch targets,
   overflow safety, and accessibility (focus states, reduced motion).
   Safe to include on every page — selectors are generic ([class$="-card"]
   etc.) so it works across index/about/pricing/faq/testimonials/portfolio
   without needing page-specific rules.
   ========================================================================= */

/* ---- Global safety net ---- */
html {
  -webkit-text-size-adjust: 100%;
}
html, body {
  max-width: 100%;
  overflow-x: hidden;
}
img, video, iframe, svg {
  max-width: 100%;
  height: auto;
}
* {
  min-width: 0; /* prevents flex/grid children from forcing overflow */
}

/* ---- Fluid type scale (smooths the jump between the old single 768px
   breakpoint and desktop, instead of two fixed sizes) ---- */
.hero h1,
h1 {
  font-size: clamp(1.8rem, 5vw, 3rem) !important;
  line-height: 1.15;
}
.section-title,
h2 {
  font-size: clamp(1.5rem, 4vw, 2.25rem) !important;
}
h3 {
  font-size: clamp(1.15rem, 3vw, 1.5rem);
}
p, li, a, span, button, input, textarea, select {
  font-size: clamp(0.95rem, 2vw, 1.05rem);
}

/* ---- Touch targets: every interactive control gets a comfortable
   44px minimum tap area, per WCAG 2.5.5 ---- */
a, button,
[class*="btn"],
.nav-links a,
input[type="submit"],
input[type="button"] {
  min-height: 44px;
}
.nav-links a {
  display: flex;
  align-items: center;
  justify-content: center;
}
input, textarea, select {
  min-height: 44px;
  font-size: 16px; /* stops iOS Safari auto-zoom on focus */
}
textarea {
  min-height: 110px;
}

/* ---- Accessible focus states (was missing entirely) ---- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[class*="btn"]:focus-visible {
  outline: 3px solid var(--accent, #f093fb);
  outline-offset: 2px;
}

/* ---- Generic grid/card safety across all pages ---- */
[class$="-grid"] {
  width: 100%;
}
[class$="-card"] {
  min-width: 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* =========================================================================
   TABLET  (1025px and below) — the old CSS jumped straight from desktop
   to a 768px phone layout, so iPads/landscape tablets got a cramped
   in-between view. This eases that gap.
   ========================================================================= */
@media (max-width: 1024px) {
  .container {
    padding: 0 24px;
  }
  .hero-content {
    grid-template-columns: 1fr minmax(180px, 240px) 1fr !important;
    gap: 2rem !important;
  }
  .about-content {
    grid-template-columns: 240px 1fr !important;
    gap: 2rem !important;
  }
  [class$="-grid"] {
    gap: 1.5rem !important;
  }
  section {
    padding-top: clamp(2.5rem, 6vw, 4rem);
    padding-bottom: clamp(2.5rem, 6vw, 4rem);
  }
}

/* =========================================================================
   PHONE (max 768px) — keep the site's existing hamburger-menu behavior,
   just reinforce spacing/sizing so it feels intentional, not squeezed.
   ========================================================================= */
@media (max-width: 768px) {
  .container {
    padding: 0 18px;
  }
  .hero-content {
    grid-template-columns: 1fr !important;
    text-align: center;
    gap: 1.75rem !important;
  }
  [class$="-card"] {
    padding: 1.25rem !important;
  }
  .nav-links li {
    min-height: 44px;
  }
  /* stack any row of buttons so each stays full-width and tappable */
  .hero-text > div:has([class*="btn"]),
  .cta-buttons,
  .button-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
  }
  [class*="btn"] {
    width: 100%;
  }
}

/* =========================================================================
   SMALL PHONE (max 480px) — the layer that was completely missing.
   Tightens padding/type further for 360–414px devices (most Android +
   iPhone SE/mini widths) so nothing feels oversized or cramped.
   ========================================================================= */
@media (max-width: 480px) {
  .container {
    padding: 0 14px;
  }
  .logo-text {
    font-size: 0.9rem !important;
  }
  .logo-img {
    height: 34px !important;
  }
  .hero h1,
  h1 {
    font-size: clamp(1.5rem, 7vw, 1.9rem) !important;
  }
  .section-title,
  h2 {
    font-size: clamp(1.3rem, 6vw, 1.6rem) !important;
  }
  .profile-image {
    width: 150px !important;
    height: 150px !important;
  }
  [class$="-card"] {
    padding: 1rem !important;
  }
  section {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }
  .chat-widget {
    right: 12px !important;
    bottom: 12px !important;
  }
  .chat-toggle-btn {
    width: 52px !important;
    height: 52px !important;
  }
  .chat-box {
    width: calc(100vw - 16px) !important;
    right: 8px !important;
  }
  [class*="btn"] {
    padding: 0.75rem 1.1rem !important;
    font-size: 0.95rem;
  }
}

/* ---- Landscape phones: keep hero from eating the whole viewport height ---- */
@media (max-height: 480px) and (orientation: landscape) {
  .hero {
    min-height: auto !important;
    padding-top: 6rem;
    padding-bottom: 3rem;
  }
}

/* ---- Respect users who've asked for less motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---- Print: strip gradients/fixed header so quotes/portfolios print clean ---- */
@media print {
  header, .chat-widget, .menu-toggle {
    display: none !important;
  }
  body {
    color: #000;
  }
}
