/* ============================================================
   PLUS27PRO v3 — Responsive CSS
   Single clean file. Mobile-first breakpoints.
   No duplicate rules. No conflicts.

   Breakpoints:
   1280px  — large desktop
   1024px  — tablet landscape / small desktop
    768px  — tablet portrait
    640px  — large mobile
    480px  — standard mobile
    380px  — small mobile (SE, Galaxy A series)
   ============================================================ */

/* ============================================================
   BASE OVERRIDES — apply at all sizes
   ============================================================ */

/* Prevent ALL horizontal overflow */
html, body {
  overflow-x: hidden;
  max-width: 100%;
}

/* Grid items never overflow their container */
* { min-width: 0; }

/* iOS Safari: prevent zoom on input focus */
input, select, textarea {
  font-size: max(16px, 1em);
}

/* Disable hover-only interactions on touch devices */
@media (hover: none) {
  .pf-overlay { background: rgba(0,0,0,0.65) !important; }
  .pf-meta    { opacity: 1 !important; transform: translateY(0) !important; }
  .pf-item::after {
    content: 'Tap to view';
    position: absolute;
    bottom: 10px; right: 10px;
    background: rgba(1,190,88,0.15);
    border: 1px solid rgba(1,190,88,0.35);
    color: #01BE58;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 2px;
    z-index: 3;
    pointer-events: none;
  }
  .pf-item.tapped::after { display: none; }
  .pf-item.tapped .pf-overlay { background: rgba(0,0,0,0.82) !important; }
}

/* ============================================================
   SERVICES PAGE — grid-2--reverse (replaces direction:rtl)
   ============================================================ */
@media (min-width: 769px) {
  .grid-2--reverse { direction: rtl; }
  .grid-2--reverse > * { direction: ltr; }
}

/* ============================================================
   PRICING GRID — responsive class system
   .pricing-grid-auto   = auto-collapse to 1 col on mobile
   .cols-2/3/4          = column count on desktop
   ============================================================ */
.pricing-grid-auto {
  display: grid;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--r4);
  overflow: hidden;
}
.pricing-grid-auto.cols-2 { grid-template-columns: repeat(2, 1fr); }
.pricing-grid-auto.cols-3 { grid-template-columns: repeat(3, 1fr); }
.pricing-grid-auto.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Dynamic cols from PHP e.g. cols-1 cols-2 cols-3 cols-4 */
.pricing-grid-auto[class*="cols-1"] { grid-template-columns: 1fr; }

@media (max-width: 1024px) {
  .pricing-grid-auto.cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .pricing-grid-auto.cols-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .pricing-grid-auto,
  .pricing-grid-auto.cols-2,
  .pricing-grid-auto.cols-3,
  .pricing-grid-auto.cols-4 {
    grid-template-columns: 1fr !important;
  }
}

/* ============================================================
   1280px — Large desktop tweaks
   ============================================================ */
@media (max-width: 1280px) {
  .footer-grid { grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 36px; }
}

/* ============================================================
   1024px — Tablet landscape / small desktop
   ============================================================ */
@media (max-width: 1024px) {

  /* Navigation */
  .nav-links            { display: none; }
  .nav-burger           { display: flex; }
  .nav-right .btn-outline { display: none; }

  /* Hero split → single column */
  .hero-inner {
    grid-template-columns: 1fr;
    padding: 60px 0 40px;
    gap: 40px;
  }
  .hero-form-card { max-width: 600px; }

  /* Stats 2 cols */
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .stat-block:nth-child(2) { border-right: none; }
  .stat-block:nth-child(3) { border-top: 1px solid var(--border); }

  /* Portfolio 6-col */
  .portfolio-grid { grid-template-columns: repeat(6, 1fr); }
  .pf-item--lg    { grid-column: span 6; grid-row: span 1; }
  .pf-item--md    { grid-column: span 3; }
  .pf-item--sm    { grid-column: span 3; }

  /* Testimonials 2-col */
  .testimonial-grid { grid-template-columns: repeat(2, 1fr); }
  .testimonial-card:last-child { grid-column: span 2; }

  /* Process 2-col */
  .process-grid { grid-template-columns: repeat(2, 1fr); }

  /* Footer 2-col */
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }

  /* CTA section stacks */
  .cta-inner { grid-template-columns: 1fr; gap: 40px; }
  .cta-form-wrap { max-width: 600px; }

  /* Service list items */
  .service-item { grid-template-columns: 60px 1fr auto; gap: 20px; }

  /* Blog 2-col */
  .blog-grid { grid-template-columns: repeat(2, 1fr); }
  .blog-card:last-child { grid-column: span 2; }

  /* grid-2 used in service/about pages */
  .grid-2 { gap: clamp(32px, 5vw, 60px); }
}

/* ============================================================
   768px — Tablet portrait
   ============================================================ */
@media (max-width: 768px) {

  /* Typography */
  .h-xl { font-size: clamp(2.2rem, 8vw, 3rem); letter-spacing: -0.03em; }
  .h-lg { font-size: clamp(1.8rem, 6vw, 2.4rem); }
  .h-md { font-size: clamp(1.4rem, 4vw, 1.9rem); }

  /* Nav */
  .nav-inner { height: 64px; }
  .nav-right .btn { font-size: 0.78rem; padding: 9px 14px; }

  /* Hero */
  .hero { padding-top: 64px; min-height: auto; }
  .hero-ctas { flex-direction: column; align-items: stretch; }
  .hero-ctas .btn { width: 100%; justify-content: center; }
  .hero-proof { flex-direction: column; gap: 10px; }
  .hero-form-card { max-width: 100%; }
  .form-row.cols-2 { grid-template-columns: 1fr; }

  /* Stats — 2x2 grid */
  .stats-row {
    grid-template-columns: 1fr 1fr;
    border-radius: var(--r4);
  }
  .stat-block { border-right: none; border-bottom: 1px solid var(--border); }
  .stat-block:nth-child(odd)  { border-right: 1px solid var(--border); }
  .stat-block:nth-child(3)    { border-top: none; }
  .stat-block:last-child      { border-bottom: none; }

  /* Portfolio → single column */
  .portfolio-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2px;
  }
  .pf-item--lg,
  .pf-item--md,
  .pf-item--sm {
    grid-column: span 2;
    grid-row: span 1;
  }
  .pf-item--md,
  .pf-item--sm { grid-column: span 1; }
  .pf-item-img,
  .pf-placeholder { min-height: 220px !important; }

  /* Testimonials → single column */
  .testimonial-grid { grid-template-columns: 1fr; }
  .testimonial-card:last-child { grid-column: span 1; }
  .testimonial-card { padding: 28px 22px; }

  /* Process → 2 col */
  .process-grid { grid-template-columns: repeat(2, 1fr); }
  .process-step { padding: 28px 22px; }

  /* Blog → single column */
  .blog-grid { grid-template-columns: 1fr; }
  .blog-card:last-child { grid-column: span 1; }

  /* Service list */
  .service-item {
    grid-template-columns: 44px 1fr;
    gap: 14px;
    padding: 18px 0;
  }
  .service-arrow { display: none; }
  .service-num   { font-size: 1.8rem; }
  .service-body h3 { font-size: 1.05rem; }

  /* grid-2 → single column */
  .grid-2,
  .grid-2--reverse { grid-template-columns: 1fr !important; direction: ltr !important; }
  .grid-2 > *,
  .grid-2--reverse > * { direction: ltr !important; }

  /* grid-3 → single column */
  .grid-3 { grid-template-columns: 1fr; }

  /* Footer */
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .footer-bottom { flex-direction: column; align-items: flex-start; gap: 8px; }
  .footer-bottom-links { flex-wrap: wrap; gap: 12px; }

  /* CTA */
  .cta-btns { flex-direction: column; }
  .cta-btns .btn { width: 100%; justify-content: center; }

  /* FAQ */
  .faq-q { padding: 18px 20px; min-height: 52px; }

  /* Pricing sticky tab bar scrollable */
  .pricing-tab-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .pricing-tab-bar::-webkit-scrollbar { display: none; }
  .pricing-tab-bar a,
  .pricing-tab-bar > a { flex-shrink: 0; }

  /* Location grid 2-col */
  .location-grid { grid-template-columns: 1fr 1fr; }

  /* Exit popup */
  .exit-popup-card { padding: 32px 22px; margin: 16px; }
  .exit-popup-card h3 { font-size: 1.3rem; }

  /* WhatsApp float */
  .wa-btn { bottom: 16px; right: 16px; width: 50px; height: 50px; }
  .wa-btn-tip { display: none; }

  /* Marquee - smaller on mobile */
  .marquee-track { gap: 36px; }
  .marquee-logo  { font-size: 0.82rem; }

  /* Case study meta strip */
  .case-meta-strip { grid-template-columns: 1fr 1fr !important; }

  /* About page values grid */
  .values-grid { grid-template-columns: 1fr !important; }

  /* Team grid 2-col */
  .team-grid { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   640px — Large mobile
   ============================================================ */
@media (max-width: 640px) {

  /* Pricing tab strip on pricing.php sticky header */
  section[style*="top:72px"] > .container > div,
  section[style*="top: 72px"] > .container > div {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
    display: flex;
  }
  section[style*="top:72px"] > .container > div::-webkit-scrollbar { display: none; }
  section[style*="top:72px"] a[style*="padding:18px"],
  section[style*="top:72px"] a[style*="padding: 18px"] {
    flex-shrink: 0;
    padding: 13px 14px !important;
    font-size: 0.7rem !important;
    white-space: nowrap !important;
  }

  /* Stats 1-col */
  .stats-row { grid-template-columns: 1fr 1fr; }

  /* Process 1-col */
  .process-grid { grid-template-columns: 1fr; }

  /* Portfolio 1-col */
  .portfolio-grid { grid-template-columns: 1fr; }
  .pf-item--lg,
  .pf-item--md,
  .pf-item--sm { grid-column: span 1; }

  /* All generic repeat grids collapse */
  .pricing-grid-auto,
  .pricing-grid-auto.cols-2,
  .pricing-grid-auto.cols-3,
  .pricing-grid-auto.cols-4 { grid-template-columns: 1fr !important; }

  /* Location grid 1-col */
  .location-grid { grid-template-columns: 1fr; }

  /* Team grid 1-col */
  .team-grid { grid-template-columns: 1fr 1fr; }

  /* Hero form */
  .hero-form-card { padding: 24px 18px; }

  /* Blog image smaller */
  .blog-img { aspect-ratio: 16/9; }
}

/* ============================================================
   480px — Standard mobile
   ============================================================ */
@media (max-width: 480px) {

  /* Typography */
  .h-xl { font-size: clamp(1.9rem, 7vw, 2.4rem); }
  .h-lg { font-size: clamp(1.5rem, 6vw, 1.9rem); }
  .eyebrow { font-size: 0.68rem; }

  /* Nav */
  .nav-right .btn { display: none; }
  .nav-logo-text   { font-size: 1rem; }

  /* Stats → 2 col still ok */
  .stat-block { padding: 24px 18px; }
  .stat-num   { font-size: 2rem; }

  /* Service items simplified */
  .service-item { grid-template-columns: 40px 1fr; gap: 12px; }
  .service-num  { font-size: 1.5rem; }

  /* Hero form */
  .hero-form-card { padding: 20px 16px; }
  .hero-form-title { font-size: 1.1rem; }

  /* Testimonials */
  .testimonial-card { padding: 24px 18px; }
  .testimonial-quote { font-size: 2.5rem; }

  /* Portfolio overlay */
  .pf-title    { font-size: 1rem; }
  .pf-client   { font-size: 0.65rem; }

  /* Process steps */
  .process-step { padding: 24px 18px; }
  .process-step-num { font-size: 2.5rem; }

  /* Footer */
  .footer-grid { grid-template-columns: 1fr; }
  .footer-address { flex-direction: column; }

  /* Blog body on post pages */
  .post-body { font-size: 0.95rem; }
  .post-body h2 { font-size: 1.3rem; }
  .post-body h3 { font-size: 1.1rem; }
  .post-body pre { font-size: 0.8rem; overflow-x: auto; }
  .post-body table { font-size: 0.8rem; display: block; overflow-x: auto; }

  /* Buttons */
  .btn-lg { padding: 15px 24px; font-size: 0.88rem; }
  .btn    { padding: 12px 20px; font-size: 0.82rem; }

  /* Section padding tighter */
  .section       { padding: clamp(48px, 8vw, 80px) 0; }
  .section--tight { padding: clamp(32px, 6vw, 56px) 0; }

  /* Exit popup */
  .exit-popup-card { padding: 28px 18px; }
}

/* ============================================================
   380px — Small mobile (Samsung Galaxy A, iPhone SE)
   ============================================================ */
@media (max-width: 380px) {

  :root { --pad: 16px; }

  .h-xl { font-size: 1.75rem; letter-spacing: -0.025em; }
  .h-lg { font-size: 1.4rem; }

  /* Stats 1-col on very small */
  .stats-row { grid-template-columns: 1fr; }
  .stat-block { border-right: none !important; border-bottom: 1px solid var(--border); }
  .stat-block:last-child { border-bottom: none !important; }
  .stat-block:nth-child(odd) { border-right: none !important; }

  /* Team 1-col */
  .team-grid { grid-template-columns: 1fr; }

  /* Hero form */
  .hero-form-card  { padding: 16px 14px; }
  .hero-form-title { font-size: 1rem; }
  .hero-form-sub   { display: none; }

  /* Process 1-col */
  .process-grid { grid-template-columns: 1fr; }

  /* Nav logo */
  .nav-logo-text { font-size: 0.9rem; }
  .nav-logo-mark { width: 32px; height: 32px; font-size: 0.7rem; }

  /* Buttons full width in hero */
  .hero-ctas .btn { font-size: 0.82rem; padding: 13px 16px; }

  /* Pricing card padding tighter */
  .pricing-grid-auto > div { padding: 24px 18px !important; }
}

/* ============================================================
   iOS Safari specific fixes
   ============================================================ */
@supports (-webkit-touch-callout: none) {
  /* Fix hero min-height on iOS */
  .hero { min-height: -webkit-fill-available; }

  /* WhatsApp button safe area */
  .wa-btn {
    bottom: max(16px, env(safe-area-inset-bottom, 16px));
    right:  max(16px, env(safe-area-inset-right, 16px));
  }

  /* Fix inputs */
  input, select, textarea {
    -webkit-appearance: none;
    border-radius: 0;
  }
  .form-input, .form-select, .form-textarea {
    border-radius: var(--r2);
  }
}

/* ============================================================
   Reduced 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;
  }
  [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }
  .marquee-track { animation: none; }
  .hero-orb      { animation: none; }
}

/* ============================================================
   Print
   ============================================================ */
@media print {
  .nav, .nav-mobile, .wa-btn, .exit-popup,
  .marquee-section, .cta-section,
  .hero-video-wrap, .hero-grid-bg,
  form, .btn { display: none !important; }

  *, *::before, *::after {
    background: #fff !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  body { font-family: Georgia, serif; font-size: 12pt; line-height: 1.5; }

  .h-xl, .h-lg, .h-md, .h-sm {
    font-family: Arial, Helvetica, sans-serif;
    color: #000 !important;
    page-break-after: avoid;
  }

  a[href]::after { content: ' (' attr(href) ')'; font-size: 10pt; color: #555 !important; }
  a[href^="tel"]::after,
  a[href^="mailto"]::after,
  a[href^="#"]::after { content: none; }

  @page { margin: 1.5cm 2cm; size: A4 portrait; }

  .service-item,
  .testimonial-card,
  .process-step,
  .blog-card { page-break-inside: avoid; }

  [data-reveal] { opacity: 1 !important; transform: none !important; }
}
