/**
 * HalfEats Mobile Landing Trust-First Styles
 * Part of Mobile Optimization (Patch 1)
 *
 * Purpose: Optimize spacing and visual hierarchy for reordered mobile sections
 * Applies only on mobile (<768px)
 */

/* Mobile-only styles for reordered sections */
@media (max-width: 768px) {

  /* Body class applied after reorder */
body.hf-mobile-reordered {
    /* Mobile reorder active - sections have been repositioned */
  }

  /* College carousel: larger logos and less side masking */
  [data-college-carousel] .animate-scroll {
    animation-duration: 20s;
  }

  [data-college-carousel] div[class*="w-20"][class*="h-20"] {
    width: 96px;
    height: 96px;
  }

  [data-college-carousel] div[class*="bg-gradient-to-r"][class*="from-white"][class*="to-transparent"][class*="top-0"][class*="bottom-0"],
  [data-college-carousel] div[class*="bg-gradient-to-l"][class*="from-white"][class*="to-transparent"][class*="top-0"][class*="bottom-0"] {
    width: 24px;
    opacity: 0.6;
  }

  @media (min-width: 768px) {
    [data-college-carousel] div[class*="w-20"][class*="h-20"] {
      width: 140px;
      height: 140px;
    }

    [data-college-carousel] div[class*="bg-gradient-to-r"][class*="from-white"][class*="to-transparent"][class*="top-0"][class*="bottom-0"],
    [data-college-carousel] div[class*="bg-gradient-to-l"][class*="from-white"][class*="to-transparent"][class*="top-0"][class*="bottom-0"] {
      width: 36px;
    }
  }

  /* Hero section - keep compact on mobile */
  [data-hf-section="hero"] {
    padding: 1.5rem 1rem 1rem;
    min-height: auto;
  }

  [data-hf-section="hero"] h1 {
    font-size: 1.75rem;
    line-height: 1.2;
    margin-bottom: 0.75rem;
  }

  [data-hf-section="hero"] p {
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 1rem;
  }

  /* Colleges section - tight spacing, emphasize trust */
  [data-hf-section="colleges"] {
    padding: 1rem 1rem 1.5rem;
    background: linear-gradient(to bottom, #fafafa 0%, #ffffff 100%);
    border-bottom: 1px solid #e5e5e5;
  }

  [data-hf-section="colleges"] h2,
  [data-hf-section="colleges"] h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    text-align: center;
    color: #0f172a;
    font-weight: 600;
  }

  [data-hf-section="colleges"] .college-grid,
  [data-hf-section="colleges"] .college-list,
  [data-hf-section="colleges"] .logos {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.75rem 1rem;
    margin-top: 0.75rem;
  }

  [data-hf-section="colleges"] .college-logo,
  [data-hf-section="colleges"] img {
    max-height: 40px;
    max-width: 80px;
    opacity: 0.85;
    filter: grayscale(0.3);
  }

  [data-hf-section="colleges"] p {
    text-align: center;
    font-size: 0.9rem;
    color: #64748b;
    margin-top: 0.5rem;
  }

  /* Testimonials section - visual emphasis with gradient */
  [data-hf-section="testimonials"] {
    padding: 1.5rem 1rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    position: relative;
  }

  /* Orange accent bar at top of testimonials */
  [data-hf-section="testimonials"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(to right, #ff6b35, #f7931e);
  }

  [data-hf-section="testimonials"] h2,
  [data-hf-section="testimonials"] h3 {
    font-size: 1.35rem;
    margin-bottom: 1rem;
    text-align: center;
    color: #0f172a;
    font-weight: 700;
  }

  [data-hf-section="testimonials"] .testimonial-card,
  [data-hf-section="testimonials"] .testimonial,
  [data-hf-section="testimonials"] blockquote {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
  }

  [data-hf-section="testimonials"] .testimonial-text,
  [data-hf-section="testimonials"] p {
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 0.75rem;
    color: #334155;
  }

  [data-hf-section="testimonials"] .testimonial-author,
  [data-hf-section="testimonials"] cite,
  [data-hf-section="testimonials"] .author {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 500;
    font-style: normal;
  }

  [data-hf-section="testimonials"] .testimonial-school,
  [data-hf-section="testimonials"] .school {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-top: 0.25rem;
  }

  /* How It Works section - clean, minimal */
  [data-hf-section="how-it-works"] {
    padding: 1.5rem 1rem 2rem;
    background: white;
  }

  [data-hf-section="how-it-works"] h2,
  [data-hf-section="how-it-works"] h3 {
    font-size: 1.35rem;
    margin-bottom: 1.25rem;
    text-align: center;
    color: #0f172a;
    font-weight: 700;
  }

  [data-hf-section="how-it-works"] .step,
  [data-hf-section="how-it-works"] .steps > div,
  [data-hf-section="how-it-works"] ol > li {
    margin-bottom: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
  }

  [data-hf-section="how-it-works"] .step-number,
  [data-hf-section="how-it-works"] .number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
    flex-shrink: 0;
  }

  [data-hf-section="how-it-works"] .step-content {
    flex: 1;
  }

  [data-hf-section="how-it-works"] .step-title,
  [data-hf-section="how-it-works"] h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: #0f172a;
  }

  [data-hf-section="how-it-works"] .step-description,
  [data-hf-section="how-it-works"] p {
    font-size: 0.9rem;
    color: #64748b;
    line-height: 1.5;
    margin: 0;
  }

  /* Smooth transitions for reorder animation */
  [data-hf-section] {
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
  }

  /* Ensure proper spacing and centering for reordered sections */
  body.hf-mobile-reordered [data-hf-section] {
    margin-bottom: 0;
    margin-left: auto;
    margin-right: auto;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Individual section spacing - don't rely on adjacent sibling selectors */
  body.hf-mobile-reordered [data-hf-section="hero"] {
    margin-top: 0;
  }

  body.hf-mobile-reordered [data-hf-section="colleges"] {
    margin-top: 0;
  }

  body.hf-mobile-reordered [data-hf-section="testimonials"] {
    margin-top: 0;
  }

  body.hf-mobile-reordered [data-hf-section="how-it-works"] {
    margin-top: 0;
  }

  /* Fix spacing for reordered sections - let Tailwind handle font sizes */
  body.hf-mobile-reordered [data-hf-section] h2,
  body.hf-mobile-reordered [data-hf-section] h3 {
    margin-bottom: 1rem !important;
  }

  body.hf-mobile-reordered [data-hf-section] h4 {
    margin-bottom: 0.5rem !important;
  }

  body.hf-mobile-reordered [data-hf-section] p {
    margin-bottom: 0.75rem !important;
  }

  /* Placeholder styling for Patch 2 value prop (commented out for now) */
  /*
  [data-hf-section="value-prop"] {
    padding: 1.5rem 1rem;
    background: linear-gradient(135deg, #fff8f0 0%, #ffedd5 100%);
    border-left: 4px solid #ff6b35;
    border-bottom: 1px solid #fed7aa;
  }

  [data-hf-section="value-prop"] h3 {
    font-size: 1.35rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 1rem;
  }

  [data-hf-section="value-prop"] .price-comparison {
    display: flex;
    justify-content: space-around;
    margin: 1rem 0;
    padding: 1rem;
    background: white;
    border-radius: 8px;
  }

  [data-hf-section="value-prop"] .checkmarks {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
  }

  [data-hf-section="value-prop"] .checkmark {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #334155;
  }

  [data-hf-section="value-prop"] .checkmark::before {
    content: '✓';
    color: #16a34a;
    font-weight: bold;
    font-size: 1.1rem;
  }
  */
}

/* Desktop - trust-first reorder now applies to desktop too */
@media (min-width: 769px) {
  /* Keep sections clean and professional on desktop */
  [data-hf-section="colleges"] {
    padding: 2rem 1rem 2.5rem;
    background: linear-gradient(to bottom, #fafafa 0%, #ffffff 100%);
    border-bottom: 1px solid #e5e5e5;
  }

  [data-hf-section="colleges"] h2,
  [data-hf-section="colleges"] h3 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    text-align: center;
    color: #0f172a;
    font-weight: 600;
  }

  [data-hf-section="colleges"] .college-grid,
  [data-hf-section="colleges"] .college-list,
  [data-hf-section="colleges"] .logos {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 1.5rem 2rem;
    margin-top: 1rem;
  }

  [data-hf-section="colleges"] .college-logo,
  [data-hf-section="colleges"] img {
    max-height: 60px;
    max-width: 120px;
    opacity: 0.85;
    filter: grayscale(0.3);
  }

  [data-hf-section="testimonials"] {
    padding: 3rem 2rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    position: relative;
  }

  [data-hf-section="testimonials"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(to right, #ff6b35, #f7931e);
  }

  [data-hf-section="testimonials"] h2,
  [data-hf-section="testimonials"] h3 {
    font-size: 2rem;
    margin-bottom: 2rem;
    text-align: center;
    color: #0f172a;
    font-weight: 700;
  }

  [data-hf-section="testimonials"] .testimonial-card,
  [data-hf-section="testimonials"] .testimonial,
  [data-hf-section="testimonials"] blockquote {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
  }

  [data-hf-section="how-it-works"] {
    padding: 3rem 2rem;
  }

  body.hf-mobile-reordered {
    /* Reorder class now applies to all devices */
  }

  /* Ensure proper spacing and centering for reordered sections on desktop */
  body.hf-mobile-reordered [data-hf-section] {
    margin-bottom: 0;
    margin-left: auto;
    margin-right: auto;
    max-width: 100%;
    box-sizing: border-box;
  }

  body.hf-mobile-reordered [data-hf-section="hero"],
  body.hf-mobile-reordered [data-hf-section="colleges"],
  body.hf-mobile-reordered [data-hf-section="testimonials"],
  body.hf-mobile-reordered [data-hf-section="how-it-works"] {
    margin-top: 0;
  }

  /* Fix spacing for desktop viewports - let Tailwind handle font sizes */
  body.hf-mobile-reordered [data-hf-section] h2,
  body.hf-mobile-reordered [data-hf-section] h3 {
    margin-bottom: 1.25rem !important;
  }

  body.hf-mobile-reordered [data-hf-section] h4 {
    margin-bottom: 0.75rem !important;
  }

  body.hf-mobile-reordered [data-hf-section] p {
    margin-bottom: 1rem !important;
  }
}

/* Accessibility improvements for all viewports */
[data-hf-section] {
  scroll-margin-top: 80px; /* Account for sticky headers */
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  [data-hf-section="testimonials"] {
    border: 2px solid currentColor;
  }

  [data-hf-section="colleges"] {
    border-bottom: 2px solid currentColor;
  }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  [data-hf-section] {
    transition: none;
  }
}
.crisp-client,
.crisp-client * {
  display: none !important;
}
