/* ===================================================
   MAVERICK — Mobile Optimization Layer
   Lead: Mobile Front-End / UX Audit

   GOLDEN RULE: Every rule lives inside a media query.
   Desktop CSS is NEVER touched.
   =================================================== */

/* ─────────────────────────────────────────────────────
   0. VIEWPORT CONTAINMENT
   Some mobile browsers (older Safari, Samsung Internet)
   need overflow-x on html AND body to prevent the
   dreaded horizontal scroll.
   ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
  html {
    overflow-x: hidden;
  }
}

/* ─────────────────────────────────────────────────────
   1. NAVIGATION — Hamburger & Drawer

   Problems fixed:
   • Toggle only appeared at 640px; 768px is standard
   • Toggle touch target was ~28px; bumped to 44×44
   • Drawer links had 8px padding; now 44px min-height
   • Added CTA button inside drawer for clear conversion
   • Hamburger animates to X when open (punk-rock UX)
   ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Show hamburger, hide inline nav links */
  .nav-links .nav-link {
    display: none;
  }
  .nav-links .nav-cta {
    display: none;
  }
  .nav-toggle {
    display: block;
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .nav-toggle span {
    width: 22px;
    height: 2px;
    transition: transform 0.25s ease, opacity 0.2s ease;
  }

  /* Hamburger → X animation when drawer is open */
  .nav-drawer.open ~ .nav .nav-toggle span:nth-child(1),
  .nav-toggle.active span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }
  .nav-drawer.open ~ .nav .nav-toggle span:nth-child(2),
  .nav-toggle.active span:nth-child(2) {
    opacity: 0;
  }
  .nav-drawer.open ~ .nav .nav-toggle span:nth-child(3),
  .nav-toggle.active span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }

  /* Drawer links — 44px touch targets */
  .nav-drawer a {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 0.75rem 0;
    font-size: 0.85rem;
  }

  /* Make nav stick and add subtle shadow for separation */
  .nav {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
}

/* ─────────────────────────────────────────────────────
   2. TYPOGRAPHY SCALING

   Problems fixed:
   • hero-h1 was clamped to min 64px — way too big at 375px
   • hero-sub floored at 15.2px — below the 16px mobile min
   • Mono labels at 0.52rem are unreadable on phones
   • Body copy needs 16px floor for readability
   ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Hero headline — scale down aggressively but keep the punch */
  .hero-h1 {
    font-size: clamp(2.6rem, 11vw, 4rem) !important;
    margin-bottom: 1.25rem;
  }

  /* Subpage hero headlines (Chefs, Collective) */
  .collective-h1 {
    font-size: clamp(2.4rem, 10vw, 3.5rem) !important;
  }

  /* CTA section headlines */
  .cta-headline {
    font-size: clamp(2.2rem, 8vw, 3rem) !important;
  }

  /* Hero subtitle — enforce 16px mobile floor */
  .hero-sub {
    font-size: 1rem !important;
    max-width: 100%;
  }

  /* Body copy floor — nothing below 16px */
  .t-body,
  .ha-body,
  .lane-body,
  .split-body,
  .phase-body,
  .roadmap-body,
  .flow-note,
  .flow-card-note,
  .highlight-body,
  .paradigm-annotation,
  .cosign-quote,
  .collective-sub,
  .cta-subtitle,
  .audit-cta-body,
  .checklist-content p {
    font-size: 1rem;
    line-height: 1.65;
  }

  /* Mono labels — bump from 0.52-0.62rem to readable size */
  .t-label,
  .t-mono,
  .section-label .t-label,
  .lane-tag,
  .lane-footer-label,
  .split-tag,
  .phase-tag,
  .roadmap-tag,
  .stat-label,
  .flow-card-label,
  .ha-tag,
  .badge-title,
  .cosign-attr,
  .cosign-card-detail,
  .hero-disclaimer,
  .highlight-disclaimer,
  .highlight-label,
  .audit-cta-label,
  .audit-cta-subtitle,
  .audit-cta-note,
  .hero-note,
  .cta-contact,
  .collective-filters-label {
    font-size: 0.72rem;
  }

  /* Split titles — tame the display font on mobile */
  .split-title {
    font-size: 2.2rem;
  }

  /* Lane titles */
  .lane-title,
  .lane-card .lane-title {
    font-size: 1.5rem;
  }

  /* Phase/roadmap titles */
  .phase-title,
  .roadmap-title {
    font-size: 1.7rem;
  }

  /* Stat numbers — slightly smaller */
  .stat-num {
    font-size: 1.8rem;
  }
  .stat-box-num {
    font-size: 2rem;
  }

  /* Receipt text — bump up */
  .receipt-row {
    font-size: 0.78rem;
  }
  .receipt-row .r-label {
    font-size: 0.7rem;
  }

  /* Headline in audience cards */
  .ha-headline {
    font-size: 1.3rem;
  }

  /* Form header */
  .form-header h1 {
    font-size: 1.8rem;
  }
}

/* ─────────────────────────────────────────────────────
   3. TOUCH TARGETS — 44×44px MINIMUM

   Every interactive element must be comfortably tappable.
   We boost padding/min-height without changing the
   visual design language.
   ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Primary & outline buttons — already close, ensure min-height */
  .btn-primary,
  .btn-outline,
  .btn-full {
    min-height: 48px;
    padding: 0.9rem 1.6rem;
    font-size: 0.72rem;
  }

  /* Text links used as CTAs */
  .btn-text {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 0;
  }

  /* Filter chips */
  .filter-chip {
    min-height: 44px;
    padding: 0.6rem 1rem;
    font-size: 0.68rem;
  }

  /* Chef social links — currently tiny unstyled text */
  .chef-socials a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.6rem;
    font-size: 0.65rem;
  }

  /* Footer links */
  .footer-links a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0;
    font-size: 0.65rem;
  }
  .footer-links {
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
  }

  /* Form inputs — enforce comfortable touch zone */
  .field input[type="text"],
  .field input[type="email"],
  .field input[type="tel"] {
    min-height: 48px;
    padding: 14px;
    font-size: 1rem; /* prevents iOS zoom on focus */
  }

  /* Radio options — already decent, enforce min-height */
  .radio-option {
    min-height: 48px;
    padding: 14px;
  }

  /* Checkbox wrapper */
  .optin-label {
    min-height: 44px;
    padding: 0.25rem 0;
  }

  /* Nav CTA (in drawer context) */
  .nav-drawer .nav-cta,
  .nav-drawer a.nav-cta {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--rust);
    color: var(--parchment);
    border-radius: 2px;
    padding: 0.75rem;
    text-align: center;
    font-weight: 700;
  }
}

/* ─────────────────────────────────────────────────────
   4. STACKING & SPACING

   Desktop multi-column layouts → single column.
   Increase breathing room between stacked blocks
   for thumb-friendly scrolling.
   ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Sections — reduce vertical padding slightly for tighter mobile feel */
  :root {
    --section-py: clamp(2.5rem, 6vh, 4rem);
  }

  /* Hero main — tighter on mobile */
  .hero-main {
    padding: 2.5rem var(--page-px);
  }

  /* Hero footer — guarantee single column below 768 */
  .hero-footer {
    grid-template-columns: 1fr;
  }
  .hero-footer-divider {
    width: 100%;
    height: 1px;
  }

  /* Audience cards — max-width remove for mobile */
  .ha-body {
    max-width: 100%;
  }

  /* Stats bar — grid layout instead of inline flex for mobile */
  .stats-bar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    padding: 1.5rem var(--page-px);
  }
  .stat-divider {
    display: none;
  }
  .stats-bar .closing-line {
    grid-column: 1 / -1;
    margin-left: 0;
    text-align: center;
    white-space: normal;
    font-size: 0.92rem;
  }

  /* Split columns — padding reduction */
  .split-col {
    padding: 1.75rem;
  }

  /* Lanes — padding reduction + more gap between stacked */
  .lane {
    padding: 1.75rem;
  }

  /* Cosign block */
  .cosign {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .cosign-card {
    max-width: 280px;
  }
  .cosign-wrapper {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  /* Paradigm comparison */
  .paradigm-grid {
    grid-template-columns: 1fr;
  }

  /* Receipt comparison */
  .receipt-grid {
    grid-template-columns: 1fr;
  }
  .receipt-vs {
    display: none;
  }

  /* Collective preview grid */
  .collective-preview {
    grid-template-columns: 1fr;
  }

  /* Chef grid — 2-col mobile directory pattern (matches Resy/OpenTable/Airbnb) */
  .chef-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Dual CTA (Collective page) */
  .dual-cta {
    grid-template-columns: 1fr;
  }
  .cta-column:first-child {
    border-right: none;
    border-bottom: 1px solid var(--faded-floor);
  }

  /* Brands: lanes grid */
  .lanes-grid {
    grid-template-columns: 1fr;
  }
  .lane-card {
    border-right: none;
    border-bottom: 1px solid rgba(10, 10, 10, 0.12);
  }
  .lane-card:last-child {
    border-bottom: none;
  }

  /* Brands: audit grid */
  .audit-grid {
    grid-template-columns: 1fr;
  }

  /* Footer — stack vertically, center */
  .footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
    padding: 2rem var(--page-px);
  }

  /* Checklist item — reduce number column width */
  .checklist-item {
    grid-template-columns: 48px 1fr;
  }

  /* Highlight box — less padding */
  .highlight-box {
    padding: 1.5rem;
  }

  /* Audit CTA card — less padding */
  .audit-cta-card {
    padding: 2rem 1.5rem;
  }

  /* Form container — remove horizontal constraints, let it breathe */
  .form-container {
    max-width: 100%;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  .form-header {
    padding: 2rem 1.5rem 1.25rem;
  }
  .form-pitch {
    padding: 1rem 1.5rem;
  }
  .form-body {
    padding: 1.5rem;
  }

  /* Join page — full-width on mobile */
  .join-page {
    padding-top: var(--nav-h);
  }

  /* Phase/Roadmap — tighten gap */
  .phase {
    gap: 1rem;
    padding-bottom: 2rem;
  }
  .roadmap-phase {
    padding-bottom: 2rem;
  }

  /* Flow cards — less padding */
  .flow-card {
    padding: 1.5rem;
  }
}

/* Even tighter for very small phones (iPhone SE, etc.) */
@media (max-width: 380px) {
  .hero-h1 {
    font-size: 2.4rem !important;
  }
  .collective-h1 {
    font-size: 2.2rem !important;
  }
  .cta-headline {
    font-size: 2rem !important;
  }
  .split-title {
    font-size: 1.8rem;
  }
  .hero-main {
    padding: 2rem var(--page-px);
  }
}

/* ─────────────────────────────────────────────────────
   5. HERO CTA BUTTONS — Full Width Stack
   ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .hero-ctas {
    flex-direction: column;
  }
  .hero-ctas .btn-primary,
  .hero-ctas .btn-outline {
    width: 100%;
    justify-content: center;
  }

  /* CTA section buttons */
  .cta-buttons {
    flex-direction: column;
    align-items: center;
  }
  .cta-buttons .btn-primary,
  .cta-buttons .btn-outline {
    width: 100%;
    max-width: 320px;
    justify-content: center;
  }
}

/* ─────────────────────────────────────────────────────
   6. PERFORMANCE — GPU & Battery Savings

   Kill expensive visual effects on mobile:
   • Grain overlay (SVG filter compositing)
   • Hero ambient blur gradients (80px blur radius)
   • Reduce animation complexity
   ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Kill the grain overlay — saves a compositing layer */
  body::after {
    display: none;
  }

  /* Reduce hero ambient blurs — smaller, less blur */
  .hero::before {
    width: 250px;
    height: 250px;
    filter: blur(40px);
    opacity: 0.8;
  }
  .hero::after {
    width: 200px;
    height: 200px;
    filter: blur(30px);
    opacity: 0.8;
  }

  /* Simplify scroll animations for better FPS */
  .fade-up {
    transform: translateY(16px);
    transition: opacity 0.4s ease, transform 0.4s ease;
  }

  /* Reduce stagger delay on mobile — quicker feel */
  .stagger > .fade-up:nth-child(2) { transition-delay: 0.05s; }
  .stagger > .fade-up:nth-child(3) { transition-delay: 0.1s; }
  .stagger > .fade-up:nth-child(4) { transition-delay: 0.15s; }
  .stagger > .fade-up:nth-child(5) { transition-delay: 0.2s; }
}

/* ─────────────────────────────────────────────────────
   7. iOS-SPECIFIC FIXES
   ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Prevent iOS auto-zoom when focusing inputs under 16px */
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  select,
  textarea {
    font-size: 16px;
  }

  /* Smooth scrolling momentum on iOS */
  .stats-bar,
  .filter-bar {
    -webkit-overflow-scrolling: touch;
  }

  /* Fix iOS fixed-position + overflow bugs */
  .nav {
    transform: translateZ(0);
  }
}

/* ─────────────────────────────────────────────────────
   8. BRANDS PAGE — Hero Topbar
   Hide status pills on mobile to save space
   ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .hero-topbar-right {
    display: none;
  }
}

/* ─────────────────────────────────────────────────────
   9. LANDSCAPE PHONES
   Prevent hero from being 100vh on landscape (too tall)
   ───────────────────────────────────────────────────── */
@media (max-width: 768px) and (orientation: landscape) {
  .hero {
    min-height: auto;
  }
  .hero-main {
    padding: 1.5rem var(--page-px);
  }
}
