/* ================================================================
   RESPONSIVE UTILITIES & BREAKPOINTS
   ================================================================ */

html,
body {
  overflow-x: clip;
  max-width: 100%;
}

/* ================================================================
   CONTENT CONTAINER — 200px side margins on large screens
   ================================================================ */
.content-container {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

@media (min-width: 640px) {
  .content-container {
    max-width: min(72rem, 100%);
    margin-left: auto;
    margin-right: auto;
  }
}

@media (min-width: 1024px) {
  .content-container {
    max-width: min(72rem, calc(100% - 3rem));
  }
}

/* ================================================================
   CONTAINER QUERIES (Modern Responsive Design)
   ================================================================ */
.container-wrapper {
  container-type: inline-size;
}

@container (max-width: 400px) {
  .card-hover {
    padding: 1rem;
  }

  .section-title {
    font-size: 1.5rem;
  }
}

@container (min-width: 400px) and (max-width: 800px) {
  .card-hover {
    padding: 1.5rem;
  }

  .section-title {
    font-size: 2rem;
  }
}

/* ================================================================
   MOBILE OPTIMIZATIONS (0px - 640px)
   ================================================================ */
@media (max-width: 640px) {
  /* Navigation */
  nav {
    padding: 0.75rem 0.5rem;
  }

  .nav-link {
    font-size: 0.875rem;
  }

  /* Typography */
  h1 {
    font-size: 1.875rem;
    line-height: 2.25rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  h3 {
    font-size: 1.25rem;
  }

  p {
    font-size: 0.938rem;
  }

  /* Buttons */
  .btn-primary,
  .btn-secondary {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.938rem;
  }

  /* Cards */
  .card-hover {
    padding: 1rem;
  }

  /* Features Grid */
  .grid {
    grid-template-columns: 1fr;
    row-gap: 1rem;
  }

  /* Sections (legacy blocks only — optimized homepage sections use home-sections.responsive.css) */
  section:not(.hero):not(.feature-highlight):not(.video-section):not(
      .features-section
    ):not(.feature-highlight-2):not(.integrations-section):not(
      .how-section
    ):not(.testimonials-section):not(.faq-section):not(.cta-section) {
    padding: 2rem 1rem;
  }

  /* Pricing */
  .pricing-highlight {
    transform: scale(1);
  }

  /* Testimonials */
  .testimonial-card {
    border-left-width: 3px;
    padding: 1rem;
  }

  /* Mobile Menu Adjustments */
  #mobile-menu {
    padding: 0.5rem 0;
  }

  /* Hero Section */
  .hero-content,
  .hero-image {
    animation: none !important;
  }

  /* Hide overflow on mobile */
  body {
    overflow-x: hidden;
  }
}

/* ================================================================
   TABLET OPTIMIZATIONS (641px - 1024px)
   ================================================================ */
@media (min-width: 641px) and (max-width: 1024px) {
  /* Navigation — tablet uses mobile drawer (see navbar.html lg: breakpoint) */
  #mobile-menu a,
  #mobile-menu button {
    font-size: 1rem;
    padding-top: 0.625rem;
    padding-bottom: 0.625rem;
  }

  /* Typography */
  h1 {
    font-size: 2.25rem;
  }

  .hero h1 {
    font-size: clamp(1.75rem, 4.2vw, 2.35rem);
    line-height: 1.2;
    overflow-wrap: break-word;
  }

  .hero-trust {
    flex-direction: column;
    align-items: stretch;
    gap: 0.625rem;
  }

  .hero-trust li {
    border-right: none !important;
    padding: 0 !important;
    justify-content: center;
  }

  h2 {
    font-size: 1.875rem;
  }

  /* Grid Adjustments */
  .grid-cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-cols-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Features */
  .feature-box {
    padding: 1.5rem;
  }

  /* Sections */
  section {
    padding: 3rem 1.5rem;
  }

  /* Pricing Cards */
  .pricing-highlight {
    transform: scale(1.02);
  }
}

/* ================================================================
   DESKTOP OPTIMIZATIONS (1025px and above)
   ================================================================ */
@media (min-width: 1025px) {
  /* Full features enabled */
  .pricing-highlight {
    transform: scale(1.05);
  }

  /* Hover effects */
  .card-hover:hover {
    transform: translateY(-8px);
  }

  /* Animations */
  .float-effect {
    animation: float 3s ease-in-out infinite;
  }

  /* Detailed layouts */
  .grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ================================================================
   LARGE DESKTOP (1280px and above)
   ================================================================ */
@media (min-width: 1280px) {
  .max-w-7xl {
    max-width: 80rem;
  }

  /* Enhanced spacing */
  section {
    padding: 4rem 2rem;
  }

  /* Larger fonts */
  h1 {
    font-size: 3.75rem;
  }

  h2 {
    font-size: 2.25rem;
  }
}

/* ================================================================
   EXTRA LARGE DESKTOP (1536px and above)
   ================================================================ */
@media (min-width: 1536px) {
  .max-w-7xl {
    max-width: 88rem;
  }

  /* Ultra wide spacing */
  section {
    padding: 5rem 3rem;
  }

  h1 {
    font-size: 4.5rem;
  }
}

/* ================================================================
   LANDSCAPE ORIENTATION (MOBILE LANDSCAPE)
   ================================================================ */
@media (max-height: 500px) and (orientation: landscape) {
  /* Reduce vertical padding on short screens */
  section {
    padding: 1.5rem 1rem;
  }

  h1 {
    font-size: 1.5rem;
  }

  .btn-primary,
  .btn-secondary {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
  }

  nav {
    height: 3rem;
  }
}

/* ================================================================
   PORTRAIT ORIENTATION
   ================================================================ */
@media (orientation: portrait) {
  body {
    min-height: 100vh;
  }
}

/* ================================================================
   HIGH RESOLUTION DISPLAYS (RETINA, 2x PIXEL RATIO)
   ================================================================ */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* Thinner borders for retina */
  .card-base,
  .feature-box {
    border-width: 0.5px;
  }

  /* Smoother text rendering */
  * {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

/* ================================================================
   LOW POWER MODE / REDUCED MOTION
   ================================================================ */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* ================================================================
   DARK MODE (if user prefers)
   ================================================================ */
/* Dark mode intentionally disabled - light mode is the default design */

/* ================================================================
   PRINT STYLES
   ================================================================ */
@media print {
  nav,
  footer,
  .btn-primary,
  .btn-secondary,
  .faq-item,
  .mobile-menu {
    display: none !important;
  }

  * {
    box-shadow: none !important;
    page-break-inside: avoid;
  }

  section {
    page-break-inside: avoid;
  }

  a {
    text-decoration: underline;
  }
}

/* ================================================================
   TOUCH DEVICE OPTIMIZATIONS
   ================================================================ */
@media (hover: none) and (pointer: coarse) {
  /* Increase touch target sizes */
  button,
  a,
  input,
  select,
  textarea {
    min-height: 44px;
    min-width: 44px;
  }

  /* Remove hover effects for touch devices */
  .card-hover:hover {
    transform: none;
  }

  .btn-primary:hover {
    transform: none;
  }

  /* Add active state instead */
  .card-hover:active {
    opacity: 0.9;
  }

  .btn-primary:active {
    opacity: 0.9;
  }
}

/* ================================================================
   FINE HOVER DEVICES (Mouse Support)
   ================================================================ */
@media (hover: hover) and (pointer: fine) {
  /* Enable hover effects */
  .card-hover:hover {
    transform: translateY(-8px);
  }

  .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
  }

  .nav-link:hover::after {
    width: 100%;
  }
}

/* ================================================================
   ACCESSIBILITY - FOCUS STYLES
   ================================================================ */
.keyboard-nav button:focus,
.keyboard-nav a:focus {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}

/* ================================================================
   RESPONSIVE TYPOGRAPHY SCALING
   ================================================================ */
html {
  font-size: clamp(14px, 2vw, 16px);
}

h1 {
  font-size: clamp(1.875rem, 5vw, 4.5rem);
  line-height: 1.2;
}

.rp-heading h1 {
  font-size: 22px;
  line-height: 1.3;
}

.lp-heading h1 {
  font-size: 22px;
  line-height: 1.3;
}

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

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

.section-title {
  font-size: clamp(1.875rem, 4vw, 4rem);
}

.section-subtitle {
  font-size: clamp(1rem, 2vw, 1.25rem);
}

/* ================================================================
   RESPONSIVE SPACING
   ================================================================ */
.gap-responsive {
  gap: clamp(0.5rem, 2vw, 2rem);
}

.px-responsive {
  padding-left: clamp(1rem, 2vw, 2rem);
  padding-right: clamp(1rem, 2vw, 2rem);
}

.py-responsive {
  padding-top: clamp(1rem, 3vw, 3rem);
  padding-bottom: clamp(1rem, 3vw, 3rem);
}

/* ================================================================
   RESPONSIVE IMAGES
   ================================================================ */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

picture {
  display: block;
}

.image-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
}

.image-container img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ================================================================
   RESPONSIVE GRID UTILITIES
   ================================================================ */
.auto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.auto-grid-sm {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.auto-grid-lg {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

/* ================================================================
   RESPONSIVE FLEX UTILITIES
   ================================================================ */
.flex-responsive {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 768px) {
  .flex-responsive {
    flex-direction: row;
    gap: 1.5rem;
  }
}

/* ================================================================
   VISUALLY HIDDEN (Accessible)
   ================================================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ================================================================
   SKIP TO CONTENT LINK
   ================================================================ */
.skip-to-content {
  position: absolute;
  top: -40px;
  left: 0;
  background: #667eea;
  color: white;
  padding: 8px;
  text-decoration: none;
  z-index: 100;
}

.skip-to-content:focus {
  top: 0;
}

.feature-card-title {
  font-size: 20px;
}
