/* ============================================================
   PawKiDex — Shared Responsive CSS
   Covers: index, erp, pawsport, pawmart, pipeline,
           pricing, about, waitlist, legal pages
   Breakpoints:
     Mobile:  ≤ 639px
     Tablet:  640px – 1023px
     Desktop: ≥ 1024px (base styles, untouched)
   ============================================================ */

/* ── HAMBURGER / MOBILE NAV ─────────────────────────────── */

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
  z-index: 1100;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: rgba(250,249,246,0.85);
  margin: 5px 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
  border-radius: 2px;
}
/* animated X when open */
.nav-open .hamburger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-open .hamburger span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-open .hamburger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile nav drawer */
.mobile-nav-drawer {
  display: none;
  position: fixed;
  top: 72px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(17,29,66,0.98);
  backdrop-filter: blur(16px);
  z-index: 999;
  overflow-y: auto;
  padding: 24px 24px 48px;
  flex-direction: column;
  gap: 4px;
}
.nav-open .mobile-nav-drawer { display: flex; }

.mobile-nav-section {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(201,168,76,0.6);
  padding: 20px 0 8px;
}
.mobile-nav-link {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 500;
  color: rgba(250,249,246,0.75);
  text-decoration: none;
  padding: 12px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  transition: color 0.15s;
}
.mobile-nav-link:hover { color: #fff; }
.mobile-nav-link.coming::after {
  content: 'Soon';
  font-size: 9px;
  font-weight: 700;
  background: rgba(201,168,76,0.15);
  color: #C9A84C;
  padding: 1px 7px;
  border-radius: 4px;
  margin-left: 10px;
  vertical-align: middle;
}
.mobile-nav-cta {
  display: block;
  background: #C9A84C;
  color: #1B2B5E;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  padding: 15px;
  border-radius: 10px;
  text-decoration: none;
  margin-top: 20px;
}

/* ── TABLET + MOBILE SHARED ─────────────────────────────── */
@media (max-width: 1023px) {

  /* Nav */
  .nav-links { display: none !important; }
  .hamburger { display: block; }
  nav { padding: 0 5%; }

  /* Sections */
  section, .section { padding: 64px 5%; }

  /* Typography */
  .hero-headline { font-size: clamp(38px, 6vw, 64px); letter-spacing: -2px; }
  .section-title, .section-headline { font-size: clamp(28px, 4vw, 44px); }

  /* 3-col grids → 2-col */
  .pets-grid,
  .ki-grid,
  .modules-grid,
  .features-grid,
  .commission-grid,
  .moat-row,
  .market-row,
  .stats-row,
  .three-col,
  [class*="grid-3"],
  .dropdown-grid { grid-template-columns: 1fr 1fr !important; }

  /* 2-col hero splits → stack */
  .hero-inner,
  .solution-inner,
  .problem-inner,
  .two-col,
  .split-section { grid-template-columns: 1fr !important; gap: 40px; }

  /* Filmstrip / horizontal scroll */
  .filmstrip { gap: 12px; padding: 0 5%; }

  /* ERP 12-col layout */
  .erp-grid { grid-template-columns: 1fr 1fr !important; }

  /* PawMart vendor workflow */
  .workflow-grid { grid-template-columns: 1fr 1fr !important; }

  /* About market bars */
  .market-bar-group { flex-direction: column; gap: 16px; }

  /* Waitlist 2-col → stack */
  .waitlist-layout { grid-template-columns: 1fr !important; }
  .waitlist-left { display: none; }

  /* Pipeline chapters */
  .chapter-grid { grid-template-columns: 1fr !important; }
  .chapter-photo { height: 320px !important; }

  /* Pricing */
  .pricing-grid { grid-template-columns: 1fr 1fr !important; }
  .commission-cards { grid-template-columns: 1fr !important; }

  /* Footer */
  .footer-inner { grid-template-columns: 1fr 1fr !important; gap: 32px; }
  .footer-bottom { flex-direction: column; gap: 12px; text-align: center; }

  /* Stat pills */
  .stats-ticker { font-size: 13px; }
}

/* ── MOBILE ONLY ─────────────────────────────────────────── */
@media (max-width: 639px) {

  /* Base */
  body { font-size: 15px; }
  section, .section { padding: 48px 5%; }

  /* Nav height */
  nav { height: 64px; }
  .mobile-nav-drawer { top: 64px; }
  .nav-logo img { height: 28px; }

  /* Typography */
  .hero-headline { font-size: clamp(32px, 9vw, 48px); letter-spacing: -1.5px; margin-bottom: 20px; }
  .section-title, .section-headline { font-size: clamp(24px, 7vw, 36px); }
  .section-label { font-size: 10px; }
  .hero-sub { font-size: 15px; margin-bottom: 32px; }

  /* Buttons */
  .hero-actions { flex-direction: column; align-items: flex-start; gap: 12px; }
  .btn-gold, .btn-ghost { width: 100%; text-align: center; justify-content: center; }

  /* All grids → 1-col on mobile */
  .pets-grid,
  .ki-grid,
  .modules-grid,
  .features-grid,
  .commission-grid,
  .moat-row,
  .market-row,
  .stats-row,
  .three-col,
  [class*="grid-3"],
  .erp-grid,
  .workflow-grid,
  .pricing-grid,
  .footer-inner { grid-template-columns: 1fr !important; }

  /* Pet cards */
  .pet-card { max-width: 100%; }

  /* Ki carousel cards */
  .ki-card { width: calc(100vw - 48px) !important; height: auto !important; min-height: 300px; }
  .ki-carousel { gap: 12px; padding: 0 24px; }

  /* Phone frame in hero */
  .phone-frame { width: 200px !important; }

  /* ERP screenshot */
  .screenshot-wrap { border-radius: 12px; }
  .screenshot-wrap img { border-radius: 12px; }

  /* Proof tickers */
  .proof-ticker { flex-wrap: wrap; gap: 8px; justify-content: center; }
  .proof-ticker-item { font-size: 12px; padding: 6px 12px; }

  /* Filmstrip → horizontal scroll */
  .filmstrip-track { animation: none !important; }
  .filmstrip-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Section content containers */
  .section-container,
  .container,
  .inner { padding: 0 5%; }

  /* Pets section watermark — too large on mobile */
  .ki-watermark { font-size: 180px; }

  /* Trust hierarchy */
  .trust-col { grid-template-columns: 1fr !important; }

  /* Pipeline full-screen chapters */
  .chapter-photo { height: 240px !important; }
  .chapter-content { padding: 32px 5% !important; }
  .chapter-pull-quote { font-size: clamp(20px, 5vw, 28px) !important; }

  /* About market chart */
  .market-stats-grid { grid-template-columns: 1fr 1fr !important; }
  .market-bar { height: 120px !important; }

  /* Pricing plan card */
  .plan-card { padding: 28px 20px !important; }
  .plan-price { font-size: 48px !important; }

  /* Waitlist */
  .waitlist-form-wrap { padding: 28px 20px !important; }
  .radio-options { grid-template-columns: 1fr 1fr !important; }

  /* FAQ accordion */
  .faq-q { font-size: 15px; padding: 16px 16px; }

  /* Footer */
  .footer-inner { grid-template-columns: 1fr !important; gap: 24px; }
  .footer-col h4 { margin-bottom: 12px; }

  /* Cookie banner */
  .cookie-banner { left: 12px; right: 12px; bottom: 12px; padding: 20px; border-radius: 16px; }
  .cookie-actions { flex-direction: column; }
  .cookie-btn { flex: none !important; width: 100%; }
  .cookie-btn.reject { order: 3; }

  /* Tables */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 480px; }

  /* Hide decorative large text */
  .ghost-text, .watermark-text { display: none; }
}

/* ── TABLET ONLY (640–1023px) ────────────────────────────── */
@media (min-width: 640px) and (max-width: 1023px) {

  nav { height: 68px; }
  .mobile-nav-drawer { top: 68px; }

  .hero-headline { font-size: clamp(40px, 5.5vw, 60px); }

  /* Ki cards slightly smaller */
  .ki-card { width: 300px !important; }

  /* Pipeline chapters — keep photo+text side by side if room */
  .chapter-grid { grid-template-columns: 1fr 1fr !important; }

  /* Pricing — keep 2 col */
  .pricing-grid { grid-template-columns: 1fr 1fr !important; }

  /* About market stats */
  .market-stats-grid { grid-template-columns: repeat(2, 1fr) !important; }

  /* Waitlist — stack */
  .waitlist-layout { grid-template-columns: 1fr !important; }
  .waitlist-left { display: none; }
}

/* ── TOUCH TARGETS ──────────────────────────────────────── */
@media (max-width: 1023px) {
  a, button { min-height: 44px; }
  .nav-cta, .btn-gold, .mobile-nav-cta { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; }
  .faq-q { min-height: 52px; }
}

/* ── HORIZONTAL SCROLL UTILITIES ────────────────────────── */
.scroll-x {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.scroll-x::-webkit-scrollbar { display: none; }

/* ── NAV DROPDOWN LINGER FIX ────────────────────────────── */
/* 1. Delay the hide by 220ms so mouse can travel to panel  */
.dropdown-menu {
  transition-delay: 220ms !important;
}
/* 2. Show instantly — no delay when entering               */
.nav-dropdown:hover .dropdown-menu {
  transition-delay: 0ms !important;
}
/* 3. Bridge the 8px gap between button and panel           */
/*    Invisible pseudo-element covers the gap               */
.nav-dropdown::after {
  content: '';
  position: absolute;
  top: 100%;
  left: -20px;
  right: -20px;
  height: 16px; /* covers the 8px gap with room to spare    */
}

/* ── CAROUSEL MOBILE FIX ────────────────────────────────── */
/* Stop touch events bleeding outside the strip wrapper     */
@media (max-width: 1023px) {
  .ki-strip-wrap {
    overflow: hidden !important;
    touch-action: pan-y !important; /* allow vertical scroll, block horizontal */
  }
  .ki-strip {
    touch-action: none !important;  /* strip itself doesn't respond to touch    */
    user-select: none;
    -webkit-user-select: none;
  }
  /* Pause animation on mobile — auto-scroll can feel jarring */
  .ki-strip {
    animation-play-state: running !important;
  }
  /* Filmstrip wrap also needs containment */
  .filmstrip-wrap {
    overflow: hidden !important;
    touch-action: pan-y !important;
  }
  .filmstrip {
    touch-action: none !important;
    user-select: none;
  }
}
