/* ============================================================
   Task #1513891: Visual Polish — Homepage Audit (375px + 1440px)

   SCOPE: Homepage only (/). Audit all visual elements.

   Fixes:
   1. Contrast — WCAG AA min 4.5:1 on all text/backgrounds
   2. Typography — Fraunces headers, DM Sans body, min 14px mobile
   3. Centering — Hero, cards, CTAs properly centered
   4. Spacing — No giant gaps, no cramping, no horizontal scroll
   5. Elements — Single search box, no duplicates, no broken images
   6. Mobile — 44px tap targets, hamburger menu, sticky CTA not overlapping
   7. Desktop — Max-width containers, proper columns, full nav visible

   ============================================================ */

/* ── 1. HERO SECTION CENTERING ── */
.hp-hero {
  text-align: center;
}

.hp-hero__headline {
  margin-left: auto;
  margin-right: auto;
}

.hp-hero__sub {
  margin-left: auto;
  margin-right: auto;
  max-width: 640px;
}

.hp-hero__ctas {
  justify-content: center !important;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 2rem auto 0;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* ── 2. BUTTON & CTA SIZING (Min 44px tap target) ── */
.btn {
  min-height: 44px;
  min-width: 44px;
  padding: 0.75rem 1.5rem;
  font-size: 16px; /* 16px base on mobile for no auto-zoom */
}

.btn-sm {
  min-height: 44px;
  padding: 0.75rem 1rem;
}

.btn-lg {
  min-height: 48px;
  padding: 1rem 2rem;
}

/* ── 3. HERO SECTION CONTRAST ── */
.hp-hero {
  background: #FFFFFF;
  color: #0A0A0A;
}

.hp-hero__headline {
  color: #0A0A0A !important;
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 800;
}

.hp-hero__sub {
  color: #1F2A37 !important;
  font-family: 'DM Sans', system-ui, sans-serif;
}

.hp-hero__eyebrow {
  color: #4B5563 !important;
}

.hp-hero__stars {
  color: #FFB81C;
}

.hp-hero__proof-text {
  color: #4B5563 !important;
  font-size: 14px;
}

/* ── 4. SECTION HEADERS CENTERING & CONTRAST ── */
.hp-section-header {
  text-align: center;
  margin: 0 auto;
}

.hp-section-header.center {
  justify-content: center;
}

.section-label {
  color: #4B5563 !important;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 0.5rem 0;
}

.section-heading {
  text-align: center !important;
  margin: 0 auto 1rem;
  color: #0A0A0A !important;
  font-family: 'Fraunces', Georgia, serif !important;
  font-weight: 800;
}

.section-subheading {
  text-align: center;
  margin: 0 auto;
  color: #4B5563 !important;
  font-family: 'DM Sans', system-ui, sans-serif;
  max-width: 600px;
}

/* ── 5. CARD GRID CENTERING ── */
.hp-bounty__grid,
.hp-stats__grid,
.hp-feed__grid,
.category-grid {
  margin: 0 auto;
  justify-items: center;
}

/* ── 6. MOBILE: NO HORIZONTAL SCROLL ── */
@media (max-width: 768px) {
  body, html {
    overflow-x: hidden !important;
    max-width: 100vw;
  }

  .hp-hero {
    padding: 2rem 1rem;
  }

  .hp-hero__headline {
    font-size: clamp(28px, 7vw, 48px) !important;
  }

  .hp-hero__sub {
    font-size: 16px !important;
    line-height: 1.5;
  }

  .hp-hero__ctas {
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
  }

  .hp-hero__ctas .btn {
    width: 100%;
  }

  p {
    font-size: 16px !important;
  }

  body {
    font-size: 16px !important;
  }
}

/* ── 7. DESKTOP: MAX-WIDTH CONTAINERS ── */
@media (min-width: 1024px) {
  .container {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 24px;
    padding-right: 24px;
  }

  .hp-hero__inner {
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
  }

  .hp-section-header {
    max-width: 800px;
    margin: 0 auto 3rem;
  }
}

/* ── 8. SEARCH BOX — SINGLE INSTANCE ── */
/* Ensure there's only one visible search box on homepage */
.sr-search-box {
  margin: 0 auto;
  max-width: 500px;
}

/* Hide any duplicate search implementations */
.hp-search-dup,
.search-duplicate,
.search-variant {
  display: none !important;
}

/* ── 9. TYPOGRAPHY ENFORCEMENT ── */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: 'Fraunces', Georgia, serif !important;
  font-weight: 800 !important;
  color: #0A0A0A !important;
}

body, p, span, a, button,
.body, .text-body {
  font-family: 'DM Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  color: #1F2A37 !important;
}

/* Minimum font sizes for mobile */
@media (max-width: 375px) {
  body, p, .body {
    font-size: 14px !important;
  }

  h3, .h3, .section-label {
    font-size: 16px !important;
  }

  .hp-hero__headline {
    font-size: clamp(24px, 5vw, 40px) !important;
  }
}

/* ── 10. URGENCY/DEADLINE BADGES CONTRAST ── */
.badge-error, .badge-deadline-red {
  background: #FEF2F2 !important;
  color: #B91C1C !important;
  border: none;
}

.badge-warning, .badge-deadline-yellow {
  background: #FEF3C7 !important;
  color: #92400E !important;
  border: none;
}

.badge-success, .badge-deadline-green {
  background: #E6F9F3 !important;
  color: #00643E !important;
  border: none;
}

/* ── 11. PILL/BADGE WCAG AA ENFORCEMENT ── */
.pill {
  background: #E6F9F3 !important;
  color: #00643E !important;
  border: 1px solid transparent;
}

.pill-dark, .badge-dark {
  background: #00875A !important;
  color: #FFFFFF !important;
}

/* ── 12. CARD STYLES ── */
.sr-card, .hp-card, .card {
  background: #FFFFFF !important;
  border: 1px solid #E5E7EB !important;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.sr-card-dark, .card-dark {
  background: #FFFFFF !important; /* NO dark cards */
  border: 1px solid #E5E7EB !important;
}

/* ── 13. STICKY CTA POSITIONING (doesn't overlap Crisp chat) ── */
.sticky-cta, .hp-sticky-cta {
  z-index: 40;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 40px);
}

@media (max-width: 768px) {
  .sticky-cta, .hp-sticky-cta {
    bottom: 80px; /* Above Crisp widget which is ~60px tall */
  }
}

/* ── 14. NO BROKEN IMAGES ── */
img {
  display: block;
  max-width: 100%;
  height: auto;
}

img[alt=""],
img:not([alt]) {
  border: 2px solid #DC2626;
  background: #FEF2F2;
  padding: 1rem;
}

/* ── 15. FORM ELEMENTS & INPUTS ── */
input, textarea, select {
  font-family: 'DM Sans', system-ui, sans-serif !important;
  font-size: 16px; /* No auto-zoom on iOS */
  color: #1F2A37 !important;
  border: 1px solid #E5E7EB !important;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  min-height: 44px;
}

input::placeholder, textarea::placeholder {
  color: #9CA3AF !important;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #00875A !important;
  box-shadow: 0 0 0 3px rgba(0, 135, 90, 0.2) !important;
}

/* ── 16. CTA BUTTON CONTRAST ── */
.btn-primary, .btn-cta {
  background: #00875A !important;
  color: #FFFFFF !important;
  font-weight: 700 !important;
  border: none;
}

.btn-primary:hover, .btn-cta:hover {
  background: #006B4D !important;
}

.btn-secondary {
  background: #FFFFFF !important;
  color: #00875A !important;
  border: 2px solid #00875A !important;
  font-weight: 700 !important;
}

.btn-secondary:hover {
  background: #E6F9F3 !important;
}

/* ── 17. SECTION SPACING ── */
section {
  padding: 4rem 1rem;
}

@media (min-width: 768px) {
  section {
    padding: 6rem 2rem;
  }
}

@media (min-width: 1024px) {
  section {
    padding: 8rem 2rem;
  }
}

/* ── 18. UNSTYLED HTML PREVENTION ── */
/* Ensure all text has proper styling */
body > * {
  font-family: 'DM Sans', system-ui, sans-serif;
  color: #1F2A37;
  line-height: 1.5;
}

/* ── 19. MOBILE HAMBURGER MENU ── */
.mobile-menu-toggle {
  min-height: 44px;
  min-width: 44px;
  padding: 0.5rem;
}

/* ── 20. NO OVERLAPPING CTAs ── */
.hp-cta-row {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  justify-content: center;
  align-items: center;
}

@media (min-width: 768px) {
  .hp-cta-row {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

/* ── 21. FINAL POLISH TOUCH ── */
::selection {
  background: #E6F9F3;
  color: #00643E;
}

::-moz-selection {
  background: #E6F9F3;
  color: #00643E;
}

/* Links should be underlined for accessibility */
a {
  text-decoration: underline;
  color: #00875A !important;
  font-weight: 500;
}

a:hover {
  color: #006B4D !important;
}

a.btn, button a {
  text-decoration: none !important;
}

/* Ensure links are WCAG AA compliant */
a:visited {
  color: #5B4E8B !important;
}

/* ============================================================
   END Task #1513891
   ============================================================ */
