/* Darwin Now - Responsive Design */

/* Hide mobile controls on desktop by default */
.mobile-controls {
  display: none;
}

/* Tablet Landscape and Below (992px) */
@media (max-width: 992px) {
  /* Typography Adjustments */
  h1 {
    font-size: clamp(2rem, 4vw, 3rem);
  }

  h2 {
    font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  }

  /* Hero Adjustments */
  .hero {
    min-height: 80vh;
  }

  .hero-content {
    padding: var(--spacing-lg) var(--spacing-sm);
  }

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

  /* Solution Cards */
  .solution-split {
    flex-direction: column;
  }

  /* Pricing Grid */
  .pricing-grid {
    grid-template-columns: 1fr;
    max-width: 500px;
    margin: 0 auto;
  }
}

/* Tablet Portrait (768px) */
@media (max-width: 768px) {
  /* Typography */
  h1 {
    font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  }

  p {
    font-size: 1rem;
  }

  /* Hero */
  .hero {
    min-height: 85vh;
    padding-top: 125px;
  }

  /* Hero mobile specific */
  .hero-headline {
    font-size: 2.25rem !important;
  }

  .hero-subheadline {
    font-size: 1.125rem !important;
  }

  .hero-cta-group {
    flex-direction: column;
    width: 100%;
  }

  .hero-cta-group .btn {
    width: 100%;
  }

  /* Mobile Navbar Adjustments */
  .navbar-menu {
    position: fixed;
    top: 70px;
    left: -100%;
    width: 100%;
    height: calc(100vh - 70px);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    flex-direction: column;
    padding: var(--spacing-md);
    transition: left 0.3s ease;
    overflow-y: auto;
  }

  [data-theme="dark"] .navbar-menu {
    background: rgba(15, 15, 35, 0.98);
  }

  .navbar-menu.active {
    left: 0;
  }

  .navbar-toggle {
    display: flex;
  }

  /* Hide language and dark mode from navbar on mobile */
  .navbar-cta .lang-switcher,
  .navbar-cta .theme-toggle {
    display: none;
  }

  /* Hide desktop login button on mobile */
  .navbar-cta #loginButton {
    display: none !important;
  }

  /* Show login button in mobile menu */
  .navbar-menu-login {
    display: block !important;
  }

  .navbar-menu-login a {
    font-weight: 600;
    color: var(--primary-purple);
    padding: 12px 0;
    display: block;
    border-top: 1px solid var(--border-color);
    margin-top: 8px;
    padding-top: 16px;
  }

  [data-theme="dark"] .navbar-menu-login a {
    color: var(--color-text-primary);
  }

  /* Make Try Darwin Now button narrower on mobile */
  .navbar-cta .btn {
    width: 75%;
    padding: 8px 12px;
    font-size: 0.75rem;
    min-width: auto;
    white-space: nowrap;
  }

  /* Mobile controls at bottom left */
  .mobile-controls {
    display: flex !important;
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 999;
    gap: 12px;
    align-items: center;
  }

  .mobile-controls .lang-toggle,
  .mobile-controls .theme-toggle {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
  }

  [data-theme="dark"] .mobile-controls .lang-toggle,
  [data-theme="dark"] .mobile-controls .theme-toggle {
    background: rgba(28, 29, 38, 0.95);
  }

  /* Mobile dropdown opens upward */
  .mobile-controls .lang-dropdown {
    bottom: calc(100% + 12px);
    top: auto;
    left: 0;
    right: auto;
    transform-origin: bottom left;
  }

  .mobile-controls .lang-dropdown.show {
    animation: slideUpMobile 0.3s ease-out;
  }

  @keyframes slideUpMobile {
    from {
      opacity: 0;
      transform: translateY(10px) scale(0.95);
    }
    to {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
  }

  /* All Grids to Single Column */
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  /* Stats Bar */
  .stats-bar {
    position: relative;
    top: 0;
    transform: none !important;
  }

  .stat-item {
    padding: var(--spacing-sm);
    background: rgba(124, 58, 237, 0.04);
    border-radius: 12px;
    flex-direction: column;
    text-align: center;
  }

  .stat-icon {
    width: 56px;
    height: 56px;
  }

  .stat-content {
    text-align: center !important;
  }

  /* Trust Badges */
  .trust-badges {
    flex-direction: column;
    gap: var(--spacing-sm);
  }

  /* Icon Circles */
  .icon-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Case Studies */
  .case-study-grid {
    grid-template-columns: 1fr;
  }

  /* Tabs */
  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .tab-btn {
    white-space: nowrap;
  }

  /* Modals */
  .modal-content {
    margin: var(--spacing-sm);
    padding: var(--spacing-sm);
  }

  /* CTAs */
  .cta-group {
    width: 100%;
  }

  .cta-group .btn {
    width: 100%;
    justify-content: center;
  }

  /* Forms */
  .form-row {
    flex-direction: column;
  }

  /* Calculator */
  .roi-calculator {
    padding: var(--spacing-sm);
  }

  .calculator-inputs {
    grid-template-columns: 1fr;
  }
}

/* Mobile (480px) */
@media (max-width: 480px) {
  /* Spacing Reductions */
  :root {
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
  }

  /* Typography */
  h1 {
    font-size: 1.75rem;
    line-height: 1.1;
  }

  h2 {
    font-size: 1.5rem;
  }

  h3 {
    font-size: 1.25rem;
  }

  p {
    font-size: 0.9375rem;
  }

  /* Buttons */
  .btn {
    padding: 12px 20px;
    font-size: 0.875rem;
  }

  .btn-lg {
    width: 100%;
    padding: 14px 28px;
    font-size: 0.9375rem;
  }

  .btn-sm {
    padding: 10px 18px;
    font-size: 0.8125rem;
  }

  /* Hero */
  .hero {
    min-height: 70vh;
  }

  /* Icon Grid Single Column */
  .icon-grid {
    grid-template-columns: 1fr;
  }

  /* Stat Numbers Smaller */
  .stat-number {
    font-size: 1.5rem;
  }

  .stat-label {
    font-size: 0.75rem;
  }

  /* Navbar Logo */
  .navbar-logo img {
    height: 32px;
  }

  /* Footer */
  .footer {
    padding: var(--spacing-lg) 0 var(--spacing-sm);
  }

  /* Scroll to Top */
  .scroll-top-btn {
    width: 40px;
    height: 40px;
    bottom: 1rem;
    right: 1rem;
    font-size: 1.25rem;
  }

  /* Modal Full Screen on Mobile */
  .modal-content {
    max-width: 100%;
    min-height: 100vh;
    border-radius: 0;
    margin: 0;
  }
}

/* Extra Small Devices (360px and below) */
@media (max-width: 360px) {
  html {
    font-size: 14px;
  }

  .navbar-container {
    padding: 0.75rem var(--spacing-sm);
  }

  .value-item {
    font-size: 0.7rem;
  }

  .value-item svg {
    width: 14px;
    height: 14px;
  }

  .hero-headline {
    font-size: 1.5rem !important;
  }

  .hero-subheadline {
    font-size: 0.9375rem !important;
  }

  .btn {
    padding: 10px 16px;
    font-size: 0.8125rem;
  }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .hero {
    min-height: 100vh;
  }

  .navbar-menu {
    max-height: 70vh;
    overflow-y: auto;
  }
}

/* Large Screens (1400px+) */
@media (min-width: 1400px) {
  .container {
    max-width: 1320px;
  }

  .container-wide {
    max-width: 1600px;
  }
}

/* Extra Large Screens (1920px+) */
@media (min-width: 1920px) {
  :root {
    font-size: 18px;
  }

  .container {
    max-width: 1400px;
  }

  .container-wide {
    max-width: 1800px;
  }
}

/* Print Styles */
@media print {
  .navbar,
  .footer,
  .modal,
  .scroll-top-btn,
  .cta-group,
  .btn,
  .stats-bar {
    display: none !important;
  }

  body {
    font-size: 12pt;
    color: #000;
    background: #fff;
  }

  .glass-card {
    background: #fff;
    border: 1px solid #ccc;
    box-shadow: none;
  }

  a {
    color: #000;
    text-decoration: underline;
  }

  .hero {
    background: #fff;
    color: #000;
    min-height: auto;
    padding: 2rem 0;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  :root {
    --primary-purple: #6b4fcc;
    --text-dark: #000;
    --glass-bg: rgba(134, 102, 255, 0.2);
  }

  .glass-card {
    border-width: 2px;
  }

  .btn {
    border-width: 2px;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .particle {
    animation: none;
  }

  html {
    scroll-behavior: auto;
  }
}

/* Dark Mode Support (if implementing) */
@media (prefers-color-scheme: dark) {
  /* Keep light theme as primary design
     But can add optional dark mode styles here */
}

/* Hover Capability Detection */
@media (hover: none) {
  /* Touch devices - adjust hover effects */
  .glass-card:hover,
  .btn:hover,
  .navbar-menu a:hover {
    transform: none;
  }

  .icon-circle:hover {
    transform: none;
  }
}

/* Focus Styles for Accessibility */
@media (prefers-reduced-motion: no-preference) {
  *:focus {
    outline: 3px solid var(--primary-purple);
    outline-offset: 2px;
  }

  *:focus:not(:focus-visible) {
    outline: none;
  }
}

/* Safe Area for Notched Devices */
@supports (padding: env(safe-area-inset-top)) {
  .navbar {
    padding-top: env(safe-area-inset-top);
  }

  .footer {
    padding-bottom: calc(var(--spacing-md) + env(safe-area-inset-bottom));
  }

  .scroll-top-btn {
    bottom: calc(1rem + env(safe-area-inset-bottom));
    right: calc(1rem + env(safe-area-inset-right));
  }
}
