/* ============================================================
   Flou Marketing Site — Mobile responsive layer
   Loaded after styles.css to override desktop defaults at small sizes.
   Mobile-first refinements + drawer/nav.
   ============================================================ */

/* ----- Header burger button (hidden on desktop) ------------- */
.header-burger {
  display: none;
  background: transparent;
  border: 0;
  width: 48px; height: 48px;
  border-radius: 12px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  padding: 0;
  margin-left: 8px;
}
.header-burger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.header-burger span {
  display: block;
  width: 22px; height: 2px;
  background: var(--foreground);
  border-radius: 2px;
  transition: transform 0.3s var(--ease-premium), opacity 0.2s var(--ease-premium);
}
.header.menu-open .header-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.header.menu-open .header-burger span:nth-child(2) { opacity: 0; }
.header.menu-open .header-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ----- Mobile drawer --------------------------------------- */
.mobile-drawer {
  position: fixed; inset: 0;
  z-index: 90;
  pointer-events: none;
  visibility: hidden;
}
.mobile-drawer.open { pointer-events: auto; visibility: visible; }

.mobile-drawer-backdrop {
  position: absolute; inset: 0;
  background: rgba(15,15,15,0.4);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s var(--ease-premium);
}
.mobile-drawer.open .mobile-drawer-backdrop { opacity: 1; }

.mobile-drawer-panel {
  position: absolute;
  top: 0; right: 0;
  width: min(86vw, 360px);
  height: 100%;
  height: 100svh;
  background: var(--background);
  box-shadow: -20px 0 40px -10px rgba(15,15,15,0.18);
  display: flex;
  flex-direction: column;
  padding: max(96px, calc(env(safe-area-inset-top) + 80px)) 28px max(28px, env(safe-area-inset-bottom));
  transform: translateX(100%);
  transition: transform 0.4s var(--ease-premium);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.mobile-drawer.open .mobile-drawer-panel { transform: translateX(0); }

.mobile-drawer .m-link {
  display: block;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--foreground);
  transition: color 0.2s var(--ease-premium), padding-left 0.3s var(--ease-premium);
}
.mobile-drawer .m-link:hover,
.mobile-drawer .m-link.active { color: var(--accent); padding-left: 6px; }

.mobile-drawer-cta { margin-top: 28px; }
.mobile-drawer-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 24px;
  font-size: 14px;
  color: var(--fg-60);
}
.mobile-drawer-foot a { color: var(--foreground); font-weight: 500; }

/* ============================================================
   Phone breakpoint — ≤640px
   ============================================================ */
@media (max-width: 640px) {

  /* Header — show burger, hide CTA pill (replaced by drawer CTA),
     keep logo crisp. Header uses safe-area-inset for notch devices. */
  .header-wrap { padding: max(10px, env(safe-area-inset-top)) 12px 0; }
  .header { padding: 6px 8px; border-radius: 14px; }
  .header nav { gap: 8px; padding: 0 12px; height: 52px; }
  .header-burger { display: inline-flex; }
  .header-links { display: none; }
  .header-cta { display: none; }

  /* Section padding tighter on phones */
  .section { padding: 64px 0; }
  .section.page-body { padding-top: 16px; }
  .container { padding: 0 20px; }

  /* Type scale */
  .section-title { font-size: clamp(30px, 8.4vw, 38px); line-height: 1.15; }
  .section-subtitle { font-size: 15px; }

  /* Buttons — 16px font prevents iOS zoom on focus, 48px min-height for hit target */
  .btn { padding: 14px 28px; font-size: 16px; width: auto; min-height: 48px; }
  .hero-actions .btn { width: 100%; }
  .hero-actions { flex-direction: column; gap: 10px; align-items: stretch; width: 100%; max-width: 320px; }

  /* HERO — tighter, no forced full-viewport. Marquee follows naturally. */
  .hero {
    padding: max(88px, calc(env(safe-area-inset-top) + 72px)) 20px 0;
    min-height: auto;
  }
  .hero-tagline { font-size: 13px; padding: 7px 14px; }
  .hero-title { font-size: clamp(32px, 9vw, 42px); line-height: 1.12; max-width: 100%; margin-top: 18px; }
  .hero-desc { font-size: 16px; max-width: 100%; margin-top: 16px; }
  /* Mobile: bigger thumbs, faster scroll, cap distance from CTAs */
  .hero-marquee-wrap { height: auto; margin-top: 40px; padding-top: 0; --marquee-duration: 22s; }
  .hero-marquee { gap: 14px; }
  .hero-thumb { height: 280px; border-radius: 16px; }
  @keyframes hero-marquee {
    0%   { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(calc(-50% - 7px), 0, 0); }
  }

  /* Stats — single column, tighter, with stats-head respecting space */
  .stats-head { margin-bottom: 32px; gap: 10px; }
  .stats { grid-template-columns: 1fr !important; gap: 0; padding: 16px 4px; }
  .stat-cell { padding: 28px 16px; }
  .stat-cell.alt { border-left: 0; border-top: 1px solid var(--fg-10); border-bottom: 1px solid var(--fg-10); }
  .stat-num { font-size: clamp(48px, 14vw, 64px); font-variant-numeric: tabular-nums; }

  /* Portfolio + logo cloud — single column on small phones */
  .portfolio-grid, .portfolio-grid.wide { grid-template-columns: 1fr 1fr !important; gap: 12px; }
  .logo-cloud { grid-template-columns: 1fr 1fr !important; }

  /* Process steps — vertical, no offset */
  .process-grid { grid-template-columns: 1fr !important; gap: 16px; }
  .process-step.first { grid-column: auto; }
  .process-step { padding: 24px; }

  /* Comparison — keep side-by-side on phones for impact, just compact */
  .compare-row { flex-direction: row !important; gap: 10px; }
  .compare-card { padding: 0; border-radius: 16px; }
  .compare-card.flou { transform: none !important; }
  .compare-header { padding: 14px 12px; font-size: 14px; }
  .compare-item { padding: 10px 12px; font-size: 12.5px; gap: 8px; line-height: 1.3; }
  .compare-item .icon { width: 16px; height: 16px; flex-shrink: 0; }

  /* Service tabs — horizontal scroll */
  .tabs {
    display: flex !important;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 32px -20px 0;
    padding: 0 20px;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { white-space: nowrap; flex-shrink: 0; padding: 10px 18px; font-size: 14px; }
  .service-card { padding: 24px 20px; margin-top: 20px; border-radius: 16px; }
  .service-card h3 { font-size: 21px; }
  .service-card p { font-size: 15px; margin-top: 12px; }
  .service-card ul { grid-template-columns: 1fr !important; gap: 10px; margin-top: 20px; }
  .service-card ul li { font-size: 14.5px; }

  /* FAQ */
  .faq-q { font-size: 16px; padding: 18px 0; gap: 16px; }
  .faq-a { font-size: 15px; }

  /* Benefits */
  .benefits-list { gap: 16px; }
  .benefit { gap: 16px; padding: 18px; }
  .benefit .num { font-size: 22px; min-width: 36px; }
  .benefit p { font-size: 15px; }

  /* Section CTA — already stacks at 640. Fine. */

  /* Filter bar (portfolio page) — horizontal scroll */
  .filter-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 24px -20px 0;
    padding: 0 20px;
    display: flex;
    gap: 8px;
  }
  .filter-bar::-webkit-scrollbar { display: none; }
  .filter-bar button { white-space: nowrap; flex-shrink: 0; }

  /* Contact page */
  .contact-form { padding: 24px 20px; }
  .contact-form .form-row { grid-template-columns: 1fr; }
  .contact-aside { gap: 14px; }
  .contact-aside-card { padding: 22px; }

  /* Footer */
  .footer { padding: 64px 20px max(32px, env(safe-area-inset-bottom)); }
  .footer-cta h2 { font-size: clamp(30px, 8vw, 40px) !important; text-wrap: balance; }
  .footer-cta-actions { flex-direction: column; gap: 10px; }
  .footer-pill { width: 100%; text-align: center; min-height: 48px; display: inline-flex; align-items: center; justify-content: center; }
  .footer-grid { grid-template-columns: 1fr 1fr !important; gap: 24px; }
  .footer-grid .col-brand { grid-column: 1 / -1; }
  .footer-giant { font-size: 32vw !important; line-height: 0.9; }
  .footer-bottom { gap: 24px; }
  .footer-nav-row a, .footer-contact-row .val { min-height: 32px; display: inline-flex; align-items: center; }

  /* Lightbox */
  .lightbox { padding: 16px; }
  .lightbox-frame { max-width: 100%; }
  .lightbox-close { top: 12px; right: 12px; width: 44px; height: 44px; }

  /* Video card brand label slightly smaller */
  .video-card .brand { font-size: 11px; top: 12px; left: 12px; }
  .video-card .play-btn { width: 52px; height: 52px; }

  /* Logo cloud cells smaller */
  .logo-cell { padding: 18px 12px; }
  .logo-cell img { max-height: 36px; }

  /* Make the "section-cta" margin-top a bit smaller on phones */
  .section-cta { margin-top: 36px; }
  .section-cta .btn { min-height: 48px; }

  /* Anchor scroll offset to account for fixed pill header on small screens */
  html { scroll-padding-top: 76px; }
}

/* ============================================================
   Tablet breakpoint — 641-900px refinements
   ============================================================ */
@media (max-width: 900px) and (min-width: 641px) {
  .header-burger { display: inline-flex; }
  .header-links { display: none; }
  .header-cta { display: none; }
  .stats { grid-template-columns: 1fr 1fr; }
  .process-grid { grid-template-columns: 1fr 1fr; }
  .portfolio-grid { grid-template-columns: 1fr 1fr; }
  .logo-cloud { grid-template-columns: repeat(3, 1fr); }
}

/* ============================================================
   Small phones — ≤380px
   ============================================================ */
@media (max-width: 380px) {
  .container { padding: 0 16px; }
  .hero { padding-top: 88px; }
  .hero-title { font-size: 30px; }
  .portfolio-grid, .portfolio-grid.wide, .logo-cloud { grid-template-columns: 1fr !important; }
}

/* ============================================================
   Touch-friendly defaults (any size with coarse pointer)
   ============================================================ */
@media (hover: none) and (pointer: coarse) {
  /* No hover lifts on touch — feel weird */
  .video-card:hover { transform: none; }
  .video-card:hover img { transform: scale(1.06); } /* keep baseline only */
  .btn:hover { transform: none; }
  .btn:active { transform: scale(0.98); }
  .chip:hover { transform: none; }
  .footer-pill:hover { transform: none; }
  /* Make sure focus is visible on touch keyboards (e.g. external) */
  .btn:focus-visible,
  .footer-pill:focus-visible,
  a:focus-visible,
  button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 9999px; }
}
