/**
 * Mobile-First UX Enhancements
 * Quick wins for improved mobile experience
 * Date: 2025-12-31
 */

/* ============================================
   GLOBAL MOBILE IMPROVEMENTS
   ============================================ */

/* Prevent horizontal scroll */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Ensure all images are responsive */
img {
  max-width: 100%;
  height: auto;
}

/* Box-sizing for all elements */
*, *::before, *::after {
  box-sizing: border-box;
}

/* ============================================
   FLUID TYPOGRAPHY
   ============================================ */

/* Base font size scales with viewport */
body {
  font-size: clamp(14px, 2.5vw, 16px);
  line-height: 1.6;
}

/* Headings scale smoothly */
h1 {
  font-size: clamp(1.75rem, 5vw, 3.5rem);
  line-height: 1.2;
}

h2 {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  line-height: 1.3;
}

h3 {
  font-size: clamp(1.25rem, 3vw, 2rem);
  line-height: 1.4;
}

h4 {
  font-size: clamp(1.125rem, 2.5vw, 1.5rem);
  line-height: 1.4;
}

/* ============================================
   TOUCH-FRIENDLY INTERACTIVE ELEMENTS
   ============================================ */

/* Minimum touch target size (44px recommended by Apple/Google) – CTA audit */
button,
a.button,
a.btn,
input[type="submit"],
input[type="button"],
.nav-link,
.sr-mobile-toggle {
  min-height: 44px;
  min-width: 44px;
  padding: 12px 20px;
}

/* Better spacing for touch targets */
button + button,
.button + .button {
  margin-top: 12px;
}

/* ============================================
   MOBILE NAVIGATION IMPROVEMENTS
   ============================================ */

@media (max-width: 768px) {
  /* Mobile menu toggle - larger touch target */
  .sr-mobile-toggle {
    width: 44px;
    height: 44px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
  }
  
  .sr-mobile-toggle span {
    width: 24px;
    height: 3px;
    background-color: currentColor;
    transition: all 0.3s ease;
  }
  
  /* Navigation links - full width on mobile */
  .sr-nav {
    flex-direction: column;
    width: 100%;
  }
  
  .sr-nav .nav-link {
    width: 100%;
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
  
  .sr-nav .nav-link:last-child {
    border-bottom: none;
  }
}

/* ============================================
   FORM IMPROVEMENTS FOR MOBILE
   ============================================ */

@media (max-width: 768px) {
  /* Form inputs - larger touch targets */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="tel"],
  textarea,
  select {
    min-height: 44px;
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 12px 16px;
    width: 100%;
  }
  
  /* Labels - better spacing */
  label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
  }
  
  /* Form groups - better spacing */
  .form-group,
  .form-field {
    margin-bottom: 20px;
  }
  
  /* Checkboxes and radio buttons - larger */
  input[type="checkbox"],
  input[type="radio"] {
    width: 20px;
    height: 20px;
    margin-right: 12px;
  }
}

/* ============================================
   BUTTON IMPROVEMENTS
   ============================================ */

@media (max-width: 768px) {
  /* Primary buttons - full width on mobile, 44px min (CTA audit) */
  button.primary,
  .button.primary,
  .btn-primary,
  .btn.btn-primary,
  .cta-btn,
  .sr-footer-cta-btn,
  .intro-btn-primary,
  .research-btn-primary,
  input[type="submit"].primary {
    width: 100%;
    min-height: 44px;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
  }
  
  /* Secondary buttons - full width on mobile */
  button.secondary,
  .button.secondary,
  .btn-secondary {
    width: 100%;
    min-height: 44px;
    padding: 14px 24px;
    font-size: 16px;
  }
  
  /* Button groups - stack vertically */
  .button-group {
    flex-direction: column;
    gap: 12px;
  }
  
  .button-group button,
  .button-group .button {
    width: 100%;
    margin: 0;
  }
}

/* ============================================
   CARD AND CONTAINER IMPROVEMENTS
   ============================================ */

@media (max-width: 768px) {
  /* Cards - better padding on mobile */
  .card,
  .sr-card {
    padding: 20px 16px;
    margin-bottom: 16px;
  }
  
  /* Containers - reduced padding */
  .container,
  .sr-wrap,
  .sr-container {
    padding-left: 16px;
    padding-right: 16px;
  }
  
  /* Sections - better spacing */
  section {
    padding: 32px 16px;
  }
}

/* ============================================
   GRID IMPROVEMENTS
   ============================================ */

/* Responsive grids - prevent horizontal overflow */
.grid,
.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 16px;
}

@media (max-width: 768px) {
  .grid,
  .grid-container {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  /* Two-column grids become single column */
  .grid-2 {
    grid-template-columns: 1fr;
  }
  
  /* Three-column grids become single column */
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   TABLE IMPROVEMENTS
   ============================================ */

@media (max-width: 768px) {
  /* Tables - horizontal scroll on mobile */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }
  
  /* Table cells - minimum width */
  table td,
  table th {
    min-width: 120px;
    padding: 12px 8px;
    font-size: 14px;
  }
  
  /* Alternative: Stack table on very small screens */
  @media (max-width: 480px) {
    table,
    thead,
    tbody,
    th,
    td,
    tr {
      display: block;
    }
    
    thead tr {
      position: absolute;
      top: -9999px;
      left: -9999px;
    }
    
    tr {
      border: 1px solid #ccc;
      margin-bottom: 12px;
      padding: 12px;
    }
    
    td {
      border: none;
      position: relative;
      padding-left: 50%;
      padding-top: 8px;
      padding-bottom: 8px;
    }
    
    td:before {
      content: attr(data-label) ": ";
      position: absolute;
      left: 8px;
      width: 45%;
      font-weight: bold;
    }
  }
}

/* ============================================
   SPACING IMPROVEMENTS
   ============================================ */

@media (max-width: 768px) {
  /* Reduce large margins on mobile */
  .mt-large,
  .margin-top-large {
    margin-top: 24px;
  }
  
  .mb-large,
  .margin-bottom-large {
    margin-bottom: 24px;
  }
  
  .p-large,
  .padding-large {
    padding: 24px 16px;
  }
  
  /* Better spacing between sections */
  section + section {
    margin-top: 32px;
  }
}

/* ============================================
   TEXT AND READABILITY
   ============================================ */

@media (max-width: 768px) {
  /* Paragraph spacing */
  p {
    margin-bottom: 16px;
    line-height: 1.7;
  }
  
  /* List spacing */
  ul, ol {
    padding-left: 24px;
    margin-bottom: 16px;
  }
  
  li {
    margin-bottom: 8px;
  }
  
  /* Better line length for readability */
  .text-content,
  article {
    max-width: 100%;
  }
}

/* ============================================
   UTILITY CLASSES FOR MOBILE
   ============================================ */

/* Hide on mobile */
@media (max-width: 768px) {
  .hide-mobile,
  .mobile-hide {
    display: none !important;
  }
}

/* Show only on mobile */
.show-mobile,
.mobile-only {
  display: none;
}

@media (max-width: 768px) {
  .show-mobile,
  .mobile-only {
    display: block;
  }
}

/* Full width on mobile */
@media (max-width: 768px) {
  .mobile-full-width {
    width: 100% !important;
  }
}

/* ============================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================ */

/* Focus states - better visibility on mobile */
button:focus,
a:focus,
input:focus,
textarea:focus,
select:focus {
  outline: 3px solid #3B82F6;
  outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================
   SMALL MOBILE (≤480px) SPECIFIC
   ============================================ */

@media (max-width: 480px) {
  /* Even more compact spacing */
  .container,
  .sr-wrap {
    padding-left: 12px;
    padding-right: 12px;
  }
  
  section {
    padding: 24px 12px;
  }
  
  .card,
  .sr-card {
    padding: 16px 12px;
  }
  
  /* Smaller font sizes for very small screens */
  body {
    font-size: 14px;
  }
  
  h1 {
    font-size: 1.75rem;
  }
  
  h2 {
    font-size: 1.5rem;
  }
  
  h3 {
    font-size: 1.25rem;
  }
}

/* ============================================
   LANDSCAPE ORIENTATION
   ============================================ */

@media (max-width: 768px) and (orientation: landscape) {
  /* Adjust for landscape mobile */
  .sr-header {
    padding: 8px 16px;
  }
  
  /* Reduce vertical padding in landscape */
  section {
    padding: 24px 16px;
  }
}

/* ============================================
   LANDING, RESEARCH, SURVEY & RESULTS PAGES
   ============================================ */

@media (max-width: 768px) {
  /* Research page */
  .research-container {
    padding: 24px 16px;
  }
  
  .research-hero {
    padding: 40px 20px;
    margin-bottom: 40px;
  }
  
  .research-card {
    padding: 20px 16px;
  }
  
  /* Results pages - Executive Summary, Org Insights, Discussion */
  .results-executive-container {
    padding: 1rem 16px;
  }
  
  .exec-summary-strip {
    flex-wrap: wrap;
    gap: 1rem;
  }
  
  .exec-summary-strip-item {
    min-width: calc(50% - 0.5rem);
  }
  
  .exec-summary-hero .score-value {
    font-size: 2.5rem;
  }
  
  .exec-summary-focus-list li {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .exec-summary-focus-list .focus-links {
    align-self: flex-start;
  }
  
  /* Discussion at a glance table - horizontal scroll */
  .discussion-at-a-glance .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -16px;
    padding: 0 16px;
  }
  
  .discussion-at-a-glance table {
    min-width: 520px;
  }
  
  /* Topic cards - compact on mobile */
  .strategic-discussion-tab .topic-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  
  .strategic-discussion-tab .topic-header-inner {
    flex-wrap: wrap;
  }
  
  /* Data quality panel - compact grid */
  .data-quality-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* Survey - progress bar compact */
  #progress-top .container {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  #progress-top .progress-meta {
    width: 100%;
    font-size: 12px;
  }
  
  /* Landing - CTA band */
  .cta-band {
    padding: 48px 20px;
  }
  
  .cta-headline {
    font-size: 1.75rem;
  }
}

@media (max-width: 480px) {
  .exec-summary-strip-item {
    min-width: 100%;
  }
  
  .data-quality-grid {
    grid-template-columns: 1fr;
  }
  
  .research-hero h1 {
    font-size: 1.75rem;
  }
  
  .cta-headline {
    font-size: 1.5rem;
  }
}



