/**
 * WEBFLUENCE — UNIVERSAL RESPONSIVE LAYER
 * Applies to all 7 pages. Fixes gaps left by per-page breakpoints.
 * Breakpoints: 1440+ · 1200 · 1024 · 768 · 480 · 390
 */

/* ═══════════════ FOUNDATIONS ═══════════════ */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  /* Safe area for notched phones */
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

img, video, canvas, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ═══════════════ NAVIGATION — ALL PAGES ═══════════════ */
nav, .nav {
  width: 100%;
}

/* Prevent horizontal scroll from nav on small screens */
@media (max-width: 768px) {
  nav ul, .nav-links { display: none !important; }
  .nav-cta { display: none !important; }
  /* Hamburger always visible on mobile */
  .nav-mobile-toggle,
  .nav-hamburger,
  .hamburger { display: flex !important; }
}

/* ═══════════════ SECTION PADDING — NORMALISE ═══════════════ */

/* Large desktop: breathe */
@media (min-width: 1440px) {
  section, .service-section, .work-section,
  .origin-section, .beliefs-section, .team-section,
  .values-section, .credentials-section,
  .stats-strip, .industries-section, .closing-cta {
    padding-top: 120px !important;
    padding-bottom: 120px !important;
  }
}

/* Tablet: reduce */
@media (max-width: 1024px) {
  section, .service-section, .work-section,
  .origin-section, .beliefs-section, .team-section,
  .values-section, .credentials-section,
  .industries-section, .closing-cta {
    padding-left: 32px !important;
    padding-right: 32px !important;
  }
}

/* Mobile: tighter */
@media (max-width: 768px) {
  section, .service-section, .work-section,
  .origin-section, .beliefs-section, .team-section,
  .values-section, .credentials-section,
  .stats-strip, .industries-section, .closing-cta {
    padding-left: 20px !important;
    padding-right: 20px !important;
    padding-top: 64px !important;
    padding-bottom: 64px !important;
  }
  /* Keep hero padding for nav clearance */
  #hero, .page-hero { padding-top: 110px !important; }
}

/* Very small */
@media (max-width: 480px) {
  section, .service-section, .work-section,
  .origin-section, .beliefs-section, .team-section,
  .values-section, .credentials-section,
  .industries-section, .closing-cta {
    padding-left: 16px !important;
    padding-right: 16px !important;
    padding-top: 52px !important;
    padding-bottom: 52px !important;
  }
}

/* ═══════════════ TYPOGRAPHY — FLUID SCALING ═══════════════ */

/* Section headings — scale down gracefully */
.section-title, h1.section-title {
  font-size: clamp(24px, 5vw, 56px);
  line-height: 1.1;
}

h1 { font-size: clamp(28px, 6vw, 72px); line-height: 1.05; }
h2 { font-size: clamp(22px, 4vw, 48px); line-height: 1.1; }
h3 { font-size: clamp(18px, 2.5vw, 30px); line-height: 1.2; }
p  { line-height: 1.65; }

/* Hero headline override — keep cinematic on mobile */
.hero-headline {
  font-size: clamp(32px, 7.5vw, 96px) !important;
  letter-spacing: -0.03em;
}

/* Page hero eyebrow / sub */
.hero-eyebrow, .page-hero-eyebrow {
  font-size: clamp(10px, 1.5vw, 13px);
  letter-spacing: 0.2em;
}

.hero-sub, .page-hero-sub {
  font-size: clamp(14px, 1.8vw, 18px);
  max-width: 560px;
}

/* ═══════════════ GRIDS — COLLAPSING ═══════════════ */

/* 3-col grids → 2 → 1 */
@media (max-width: 768px) {
  .services-grid,
  .why-grid,
  .values-grid,
  .team-grid,
  .industries-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 1024px) {
  .services-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .team-grid     { grid-template-columns: repeat(2, 1fr) !important; }
}

/* Contact split — stack on tablet */
@media (max-width: 900px) {
  .contact-split,
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* Insights sidebar — hide sidebar on tablet */
@media (max-width: 1100px) {
  .articles-layout {
    grid-template-columns: 1fr !important;
  }
  .sidebar { display: none !important; }
}

/* Work cards — single col on mobile */
@media (max-width: 600px) {
  .work-grid { grid-template-columns: 1fr !important; }
  .case-card { width: 100% !important; min-width: unset !important; }
}

/* ═══════════════ FOOTER — ALL PAGES ═══════════════ */
footer, .footer {
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
}

@media (max-width: 768px) {
  footer, .footer { padding: 56px 20px 32px !important; }
  .footer-grid, .footer-top { grid-template-columns: 1fr !important; gap: 36px !important; }
  .footer-bar { flex-direction: column !important; text-align: center !important; gap: 12px !important; }
}

/* ═══════════════ BUTTONS / CTAs ═══════════════ */
.btn-primary, .btn-ghost, .nav-cta {
  white-space: nowrap;
}

@media (max-width: 480px) {
  .hero-ctas {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
  }
  .btn-primary, .btn-ghost {
    width: 100%;
    text-align: center;
    justify-content: center;
  }
}

/* ═══════════════ STATS STRIPS ═══════════════ */
@media (max-width: 600px) {
  .stats-inner, .trust-strip, .hero-stats {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1px !important;
  }
  .stat-item, .trust-item {
    padding: 20px 16px !important;
  }
  .stat-number, .stat-num { font-size: clamp(28px, 7vw, 48px) !important; }
}

/* ═══════════════ MODALS / DRAWERS ═══════════════ */
.nav-drawer, .mobile-menu {
  /* Ensure full height including notch */
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom, 16px);
}

@media (max-width: 480px) {
  .nav-drawer a, .mobile-menu a { font-size: 18px; padding: 14px 0; }
}

/* ═══════════════ HORIZONTAL SCROLL CONTAINERS ═══════════════ */
.work-scroll-container, .clients-scroll, .filter-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
}
.work-scroll-container::-webkit-scrollbar,
.clients-scroll::-webkit-scrollbar { display: none; }

/* ═══════════════ FILTER / PILL NAVS ═══════════════ */
.filter-wrap, .category-nav, .service-nav-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.filter-wrap::-webkit-scrollbar,
.category-nav::-webkit-scrollbar,
.service-nav-wrap::-webkit-scrollbar { display: none; }

@media (max-width: 768px) {
  .filter-pill, .cat-pill, .service-tab {
    white-space: nowrap;
    flex-shrink: 0;
  }
}

/* ═══════════════ INSIGHTS PAGE — ARTICLE GRID ═══════════════ */
@media (max-width: 768px) {
  .articles-grid { grid-template-columns: 1fr !important; }
  .featured-card { flex-direction: column !important; }
  .featured-visual { min-height: 200px; border-radius: 0 0 12px 12px !important; }
}

/* ═══════════════ CONTACT PAGE ═══════════════ */
@media (max-width: 768px) {
  .contact-left, .contact-right {
    padding: 48px 20px !important;
  }
  .what-happens-next { grid-template-columns: 1fr !important; }
  .faq-grid { grid-template-columns: 1fr !important; }
}

/* WhatsApp FAB — safe area on mobile */
.whatsapp-fab {
  bottom: max(24px, env(safe-area-inset-bottom));
}

/* ═══════════════ INDUSTRIES PAGE ═══════════════ */
@media (max-width: 768px) {
  .industry-card { min-height: unset !important; }
  .industry-hero { min-height: 260px !important; }
  .industry-split { grid-template-columns: 1fr !important; }
}

/* ═══════════════ ABOUT PAGE ═══════════════ */
@media (max-width: 600px) {
  .team-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .origin-content { grid-template-columns: 1fr !important; }
  .belief-item { grid-template-columns: 1fr !important; }
}

/* ═══════════════ WORK PAGE — MODAL ═══════════════ */
@media (max-width: 480px) {
  .modal-content { border-radius: 12px 12px 0 0 !important; }
  .modal-snapshot { grid-template-columns: 1fr 1fr !important; }
}

/* ═══════════════ CURSOR GLOW — DISABLE ON TOUCH ═══════════════ */
@media (hover: none), (pointer: coarse) {
  .cursor-glow { display: none !important; }
}

/* ═══════════════ 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;
  }
  .hero-orb, .hero-bg-grid { display: none; }
}

/* ═══════════════ PHONE — MINIMUM FONT SIZES ═══════════════
   Labels, tags and metadata that are intentionally small on desktop
   need a floor of 11px on mobile to stay readable on 1× Android screens.
   ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  /* Homepage */
  .scroll-label { font-size: 11px !important; }

  /* Services */
  .service-nav a .nav-num { font-size: 11px !important; }
  .proof-label { font-size: 11px !important; }

  /* Work */
  .filter-label,
  .filter-count   { font-size: 11px !important; }
  .card-tag       { font-size: 11px !important; }
  .metric-label   { font-size: 11px !important; }
  .modal-label    { font-size: 11px !important; }
  .modal-section-label { font-size: 11px !important; }
  .snapshot-cell-label { font-size: 11px !important; }

  /* Work modal result labels — 9px on desktop, minimum 11px on mobile */
  .modal-result-before-label,
  .modal-result-after-label { font-size: 11px !important; letter-spacing: 0.08em; }

  /* About */
  .belief-tag         { font-size: 11px !important; }
  .credentials-label  { font-size: 11px !important; }

  /* Industries */
  .ind-tag            { font-size: 11px !important; }
  .ind-deliver-label  { font-size: 11px !important; }
  .pain-title         { font-size: 11px !important; }
  .numbers-title      { font-size: 11px !important; }
}

/* ═══════════════ PHONE — MODAL PADDING ═══════════════ */
@media (max-width: 480px) {
  /* Work page modal — full-width on phone with safe padding */
  .modal-overlay { align-items: flex-end !important; padding: 0 !important; }
  .modal {
    border-radius: 16px 16px 0 0 !important;
    max-height: 90dvh !important;
    overflow-y: auto !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .modal-hero { padding: 24px 16px !important; }
  .modal-body { padding: 20px 16px !important; }
  .modal-footer { padding: 16px !important; flex-direction: column !important; gap: 10px !important; }
  .modal-footer a, .modal-footer button { width: 100%; text-align: center; justify-content: center; }
  .modal-snapshot { grid-template-columns: 1fr 1fr !important; gap: 8px !important; }

  /* Nav drawer full-screen on small phones */
  .nav-drawer, .mobile-menu { width: 100% !important; }
}

/* ═══════════════ PHONE — CONTACT FORM ═══════════════ */
@media (max-width: 480px) {
  .form-row { grid-template-columns: 1fr !important; }
  .contact-left { padding: 48px 16px !important; }
  .contact-right { padding: 40px 16px !important; }
  .step-list { gap: 20px !important; }
}

/* ═══════════════ PHONE — INSIGHTS ═══════════════ */
@media (max-width: 480px) {
  .featured-card { flex-direction: column !important; }
  .featured-text { padding: 24px 16px !important; }
  .articles-grid { grid-template-columns: 1fr !important; }
  .article-card { padding: 20px 16px !important; }
  .category-nav { gap: 8px !important; }
  .cat-pill { padding: 7px 14px !important; font-size: 12px !important; }
}

/* ═══════════════ PRINT ═══════════════ */
@media print {
  nav, .nav, footer, .cursor-glow,
  .wf-film-section, .whatsapp-fab,
  .nav-drawer, .mobile-menu { display: none !important; }
  body { background: #fff !important; color: #000 !important; }
  section { page-break-inside: avoid; }
}
