/* ============================================
   FOOTER RESPONSIVE FIX
   Created: October 7, 2025
   Fixes footer text sizing that causes horizontal scroll
   ============================================ */

/* ============================================
   1. FOOTER BASE RESPONSIVE STRUCTURE
   ============================================ */

.main-footer {
  background-color: var(--color-bg-secondary);
  padding: var(--space-3xl) 0 var(--space-xl);
  margin-top: var(--space-3xl);
  border-top: 1px solid var(--color-border);
  overflow-x: hidden !important;
  width: 100% !important;
  max-width: 100vw !important;
  box-sizing: border-box !important;
}

/* Ensure footer container doesn't overflow */
.main-footer .container {
  max-width: 100% !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
}

/* ============================================
   2. FOOTER GRID - RESPONSIVE COLUMNS
   ============================================ */

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: clamp(12px, 2vw, 24px);
  margin-bottom: var(--space-2xl);
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

.footer-column {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  min-width: 0 !important;
  max-width: 100% !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

/* ============================================
   3. RESPONSIVE FOOTER TYPOGRAPHY
   ============================================ */

/* Footer Title - Main brand name */
.footer-title {
  font-size: clamp(14px, 2vw, 18px) !important;
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-sm);
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  -webkit-hyphens: auto;
  -ms-hyphens: auto;
  hyphens: auto;
  line-height: 1.2 !important;
  max-width: 100% !important;
}

/* Footer Description */
.footer-description {
  color: var(--color-text-secondary);
  line-height: var(--line-height-relaxed);
  margin: 0;
  font-size: clamp(11px, 1.6vw, 14px) !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  max-width: 100% !important;
}

/* Footer Column Headings (Platform, Resources, Legal) */
.footer-heading {
  font-size: clamp(13px, 1.8vw, 16px) !important;
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-sm);
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  line-height: 1.3 !important;
  max-width: 100% !important;
}

/* Footer Links */
.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: 0;
  margin: 0;
}

.footer-links a {
  color: var(--color-text-secondary);
  font-size: clamp(11px, 1.6vw, 14px) !important;
  transition: color var(--transition-fast);
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  display: inline-block;
  max-width: 100% !important;
}

.footer-links a:hover {
  color: var(--color-text);
}

/* ============================================
   4. FOOTER BOTTOM - COPYRIGHT & DISCLAIMER
   ============================================ */

.footer-bottom {
  text-align: center;
  padding-top: var(--space-xl);
  border-top: 1px solid var(--color-border);
  width: 100%;
  box-sizing: border-box;
}

.footer-bottom p {
  color: var(--color-text-secondary);
  font-size: clamp(11px, 1.8vw, 14px);
  margin-bottom: var(--space-sm);
  word-wrap: break-word;
  overflow-wrap: break-word;
  padding: 0 var(--space-md);
}

.footer-disclaimer {
  font-size: clamp(10px, 1.6vw, 12px);
  color: var(--color-text-tertiary);
  word-wrap: break-word;
  overflow-wrap: break-word;
  padding: 0 var(--space-md);
  margin: 0;
}

/* ============================================
   5. SOCIAL LINKS
   ============================================ */

.social-links {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-sm);
  flex-wrap: wrap;
}

.social-link {
  width: clamp(36px, 5vw, 40px);
  height: clamp(36px, 5vw, 40px);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.social-link:hover {
  border-color: var(--color-text);
  background-color: var(--color-text);
  color: var(--color-bg);
}

.social-link svg {
  width: clamp(18px, 2.5vw, 20px);
  height: clamp(18px, 2.5vw, 20px);
}

/* ============================================
   6. RESPONSIVE BREAKPOINTS
   ============================================ */

/* Large Desktop (1440px+) - Full sizing */
@media (min-width: 1440px) {
  .footer-title {
    font-size: 20px;
  }

  .footer-heading {
    font-size: 16px;
  }

  .footer-description,
  .footer-links a,
  .footer-bottom p {
    font-size: 14px;
  }

  .footer-disclaimer {
    font-size: 12px;
  }
}

/* Desktop (1025px - 1439px) */
@media (max-width: 1439px) and (min-width: 1025px) {
  .footer-grid {
    gap: 24px;
  }
}

/* Tablet (769px - 1024px) */
@media (max-width: 1024px) and (min-width: 769px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }

  .footer-title {
    font-size: 18px;
  }

  .footer-heading {
    font-size: 15px;
  }

  .footer-description,
  .footer-links a,
  .footer-bottom p {
    font-size: 13px;
  }

  .footer-disclaimer {
    font-size: 11px;
  }
}

/* Mobile Landscape (641px - 768px) */
@media (max-width: 768px) and (min-width: 641px) {
  .main-footer {
    padding: var(--space-2xl) 0 var(--space-md);
  }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .footer-title {
    font-size: 17px;
  }

  .footer-heading {
    font-size: 14px;
  }

  .footer-description,
  .footer-links a,
  .footer-bottom p {
    font-size: 12px;
  }

  .footer-disclaimer {
    font-size: 10px;
  }
}

/* Mobile Portrait (481px - 640px) */
@media (max-width: 640px) and (min-width: 481px) {
  .main-footer {
    padding: var(--space-xl) 0 var(--space-md);
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .footer-column {
    text-align: center;
  }

  .footer-title {
    font-size: 16px;
  }

  .footer-heading {
    font-size: 14px;
  }

  .footer-description {
    font-size: 12px;
    max-width: 400px;
    margin: 0 auto;
  }

  .footer-links {
    align-items: center;
  }

  .footer-links a {
    font-size: 12px;
  }

  .footer-bottom p {
    font-size: 12px;
  }

  .footer-disclaimer {
    font-size: 10px;
  }

  .social-links {
    justify-content: center;
  }
}

/* Small Mobile (376px - 480px) */
@media (max-width: 480px) and (min-width: 376px) {
  .main-footer {
    padding: var(--space-lg) 0 var(--space-sm);
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .footer-column {
    text-align: center;
  }

  .footer-title {
    font-size: 15px;
  }

  .footer-heading {
    font-size: 13px;
  }

  .footer-description {
    font-size: 11px;
    max-width: 320px;
    margin: 0 auto;
  }

  .footer-links {
    align-items: center;
  }

  .footer-links a {
    font-size: 11px;
  }

  .footer-bottom p {
    font-size: 11px;
    padding: 0 var(--space-sm);
  }

  .footer-disclaimer {
    font-size: 9px;
    padding: 0 var(--space-sm);
  }

  .social-links {
    justify-content: center;
    gap: var(--space-sm);
  }

  .social-link {
    width: 36px;
    height: 36px;
  }
}

/* Extra Small Mobile (320px - 375px) */
@media (max-width: 375px) and (min-width: 320px) {
  .main-footer {
    padding: var(--space-md) 0 var(--space-sm);
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .footer-column {
    text-align: center;
  }

  .footer-title {
    font-size: 14px;
  }

  .footer-heading {
    font-size: 12px;
  }

  .footer-description {
    font-size: 10px;
    max-width: 280px;
    margin: 0 auto;
  }

  .footer-links {
    align-items: center;
    gap: 6px;
  }

  .footer-links a {
    font-size: 10px;
  }

  .footer-bottom {
    padding-top: var(--space-md);
  }

  .footer-bottom p {
    font-size: 10px;
    padding: 0 8px;
    margin-bottom: 6px;
  }

  .footer-disclaimer {
    font-size: 8px;
    padding: 0 8px;
    line-height: 1.4;
  }

  .social-links {
    justify-content: center;
    gap: 8px;
  }

  .social-link {
    width: 32px;
    height: 32px;
  }

  .social-link svg {
    width: 16px;
    height: 16px;
  }
}

/* Ultra Small (< 320px) */
@media (max-width: 319px) {
  .main-footer {
    padding: var(--space-sm) 0;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .footer-column {
    text-align: center;
  }

  .footer-title {
    font-size: 13px;
  }

  .footer-heading {
    font-size: 11px;
  }

  .footer-description {
    font-size: 9px;
    max-width: 240px;
    margin: 0 auto;
  }

  .footer-links {
    align-items: center;
    gap: 4px;
  }

  .footer-links a {
    font-size: 9px;
  }

  .footer-bottom {
    padding-top: var(--space-sm);
  }

  .footer-bottom p {
    font-size: 9px;
    padding: 0 6px;
    margin-bottom: 4px;
  }

  .footer-disclaimer {
    font-size: 8px;
    padding: 0 6px;
    line-height: 1.3;
  }

  .social-links {
    justify-content: center;
    gap: 6px;
  }

  .social-link {
    width: 28px;
    height: 28px;
  }

  .social-link svg {
    width: 14px;
    height: 14px;
  }
}

/* ============================================
   7. PREVENT OVERFLOW
   ============================================ */

/* Ensure no element causes horizontal scroll */
.main-footer * {
  max-width: 100%;
  box-sizing: border-box;
}

.footer-title,
.footer-heading,
.footer-description,
.footer-links a,
.footer-bottom p,
.footer-disclaimer {
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  -webkit-hyphens: auto;
  -ms-hyphens: auto;
  hyphens: auto;
}

/* ============================================
   8. CONTAINER ADJUSTMENT
   ============================================ */

/* Reduce container padding on small screens */
@media (max-width: 640px) {
  .main-footer .container {
    padding-left: clamp(12px, 3vw, 24px);
    padding-right: clamp(12px, 3vw, 24px);
  }
}

@media (max-width: 375px) {
  .main-footer .container {
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* ============================================
   9. ACCESSIBILITY
   ============================================ */

/* Focus states */
.footer-links a:focus-visible,
.social-link:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ============================================
   10. HIGH CONTRAST MODE
   ============================================ */

@media (prefers-contrast: high) {
  .footer-links a,
  .footer-description,
  .footer-bottom p,
  .footer-disclaimer {
    color: var(--color-text);
  }

  .social-link {
    border-width: 2px;
  }
}

/* ============================================
   11. REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  .footer-links a,
  .social-link {
    transition: none;
  }
}

/* ============================================
   12. PRINT STYLES
   ============================================ */

@media print {
  .main-footer {
    page-break-before: always;
    padding: 20px 0;
  }

  .social-links {
    display: none;
  }

  .footer-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
  }

  .footer-title,
  .footer-heading {
    font-size: 12px;
  }

  .footer-description,
  .footer-links a,
  .footer-bottom p {
    font-size: 10px;
  }

  .footer-disclaimer {
    font-size: 9px;
  }
}

/* ============================================
   13. FALLBACK FOR OLDER BROWSERS
   ============================================ */

/* Fallback for browsers that don't support clamp() */
@supports not (font-size: clamp(1px, 2vw, 3px)) {
  .footer-title {
    font-size: 18px;
  }

  .footer-heading {
    font-size: 15px;
  }

  .footer-description,
  .footer-links a,
  .footer-bottom p {
    font-size: 13px;
  }

  .footer-disclaimer {
    font-size: 11px;
  }

  @media (max-width: 768px) {
    .footer-title {
      font-size: 16px;
    }

    .footer-heading {
      font-size: 14px;
    }

    .footer-description,
    .footer-links a,
    .footer-bottom p {
      font-size: 12px;
    }

    .footer-disclaimer {
      font-size: 10px;
    }
  }

  @media (max-width: 480px) {
    .footer-title {
      font-size: 14px;
    }

    .footer-heading {
      font-size: 12px;
    }

    .footer-description,
    .footer-links a,
    .footer-bottom p {
      font-size: 11px;
    }

    .footer-disclaimer {
      font-size: 9px;
    }
  }
}

/* ============================================
   14. EMERGENCY OVERFLOW FIX - FINAL CATCH-ALL
   ============================================ */

/* Nuclear option to prevent any footer element from causing scroll */
.main-footer,
.main-footer *,
.main-footer .container,
.main-footer .footer-grid,
.main-footer .footer-column,
.main-footer .footer-title,
.main-footer .footer-heading,
.main-footer .footer-description,
.main-footer .footer-links,
.main-footer .footer-links a,
.main-footer .footer-bottom,
.main-footer .footer-bottom p,
.main-footer .footer-disclaimer {
  max-width: 100% !important;
  overflow-wrap: break-word !important;
  word-wrap: break-word !important;
  word-break: break-word !important;
  box-sizing: border-box !important;
}

/* Specifically target the title that's causing issues */
.main-footer h3.footer-title,
.main-footer .footer-column .footer-title {
  font-size: clamp(12px, 1.8vw, 16px) !important;
  max-width: 100% !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* Force all footer text to respect boundaries */
body .main-footer .footer-title,
body .main-footer .footer-heading {
  font-size: clamp(12px, 1.8vw, 16px) !important;
  white-space: normal !important;
}
