/* ===================================================================
   RESPONSIVE — 768px (Tablet)
   =================================================================== */

@media (max-width: 768px) {
  .container {
    padding: 0 var(--space-md);
  }

  /* Nav */
  .nav-links {
    gap: var(--space-sm);
  }

  .nav-links button {
    font-size: var(--text-small);
  }

  .sign-in-btn {
    padding: var(--space-sm) var(--space-md);
  }

  /* Hero — stack vertically */
  .hero-section {
    padding: var(--space-2xl) var(--space-md);
  }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
    text-align: center;
  }

  .hero-copy {
    text-align: center;
    order: 1;
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-subtitle {
    font-size: var(--text-body);
    margin-left: auto;
    margin-right: auto;
  }

  .hero-actions {
    justify-content: center;
  }

  .hero-demo {
    order: 2;
  }

  .hero-actions .btn-primary,
  .hero-actions .btn-secondary,
  .hero-actions .btn-coral,
  .hero-actions .btn-outline {
    width: 100%;
    max-width: 320px;
    justify-content: center;
  }

  /* Phone mockup scaling */
  .phone-mockup {
    width: 240px;
    height: 400px;
    border-radius: 30px;
    transform: perspective(1000px) rotateY(0deg);
  }

  .phone-mockup:hover {
    transform: perspective(1000px) rotateY(0deg);
  }

  .phone-notch {
    width: 80px;
    height: 24px;
  }

  .phone-screen {
    border-radius: 22px;
  }

  /* Feature sections — stack */
  .feature-section {
    padding: var(--space-3xl) var(--space-md);
  }

  .feature-grid,
  .feature-grid--reverse {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
    direction: ltr;
  }

  .feature-copy {
    text-align: center;
    order: 1;
  }

  .feature-desc {
    margin-left: auto;
    margin-right: auto;
  }

  .feature-list {
    display: inline-block;
    text-align: left;
  }

  .feature-phone {
    order: 2;
  }

  .feature-title {
    font-size: 1.5rem;
  }

  /* How It Works */
  .hiw-section {
    padding: var(--space-3xl) var(--space-md);
  }

  .hiw-grid {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
    max-width: 400px;
  }

  /* Hide horizontal connecting line on mobile */
  .hiw-grid::after {
    display: none;
  }

  /* Support */
  .support-section {
    padding: var(--space-3xl) var(--space-md);
  }

  .support-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .support-card {
    padding: var(--space-lg);
  }

  .support-icon {
    width: 48px;
    height: 48px;
    font-size: 1.1rem;
  }

  .support-card h3 {
    font-size: var(--text-body);
  }

  .support-card p {
    font-size: var(--text-small);
  }
}

/* ===================================================================
   RESPONSIVE — 480px (Small Phones)
   =================================================================== */

@media (max-width: 480px) {
  .hero-title {
    font-size: 1.75rem;
  }

  .phone-mockup {
    width: 220px;
    height: 380px;
    border-radius: 28px;
    padding: 10px;
  }

  .phone-notch {
    width: 70px;
    height: 22px;
    top: 10px;
  }

  .phone-screen {
    border-radius: 20px;
  }

  .phone-header {
    padding: 30px 12px 8px;
  }

  .phone-header-title {
    font-size: 0.6rem;
  }

  .phone-header-voice {
    font-size: 0.55rem;
  }

  .phone-text-content {
    padding: 10px 12px;
  }

  .phone-text-paragraph {
    font-size: 0.7rem;
    line-height: 1.8;
  }

  .voice-name-item {
    font-size: 1.1rem;
  }

  .voice-current-name {
    height: 28px;
  }

  .voice-name-cycle {
    height: 28px;
  }

  .eq-bar {
    width: 5px;
  }

  .voice-option {
    padding: 6px 10px;
    font-size: 0.65rem;
  }

  .translate-text {
    font-size: 0.75rem;
  }

  .feature-title {
    font-size: 1.35rem;
  }

  .feature-desc {
    font-size: var(--text-body);
  }

  .support-card {
    padding: var(--space-md);
    border-radius: var(--radius-md);
  }

  .support-icon {
    width: 44px;
    height: 44px;
    font-size: var(--text-body);
  }

  .support-card h3 {
    font-size: var(--text-small);
  }

  .support-card p {
    font-size: var(--text-xs);
  }

  .support-btn {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--text-xs);
    min-height: 44px;
  }

  /* Ensure all touch targets meet 44px minimum */
  .btn-primary,
  .btn-secondary,
  .btn-coral,
  .btn-outline,
  .sign-in-btn,
  .theme-toggle-btn {
    min-height: 44px;
  }
}

/* ===================================================================
   MODAL RESPONSIVE — preserved from original
   =================================================================== */

@media (max-width: 768px) {
  .modal-overlay {
    padding: 0.5rem;
    padding-top: max(0.5rem, env(safe-area-inset-top));
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
  }

  .modal, .otp-modal, .success-modal {
    padding: 1.5rem;
    width: 100%;
    max-width: none;
    border-radius: var(--radius-lg);
    max-height: 85vh;
    overflow-y: auto;
  }

  #deviceConfirmationModal .modal {
    padding: 1.5rem;
    max-height: 80vh;
    overflow-y: auto;
  }

  .login-tab {
    font-size: 0.7rem;
    padding: 0.5rem 0.25rem;
  }

  .form-input {
    padding: 0.75rem;
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .submit-btn {
    padding: 0.875rem;
    font-size: 0.9rem;
  }

  #deviceConfirmationModal .device-warning {
    padding: 0.75rem;
    margin: 0.75rem 0;
    border-radius: 8px;
  }

  #deviceConfirmationModal .device-warning p {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    line-height: 1.3;
  }

  #deviceConfirmationModal .device-warning li {
    font-size: 0.8rem;
    padding: 0.25rem 0;
    line-height: 1.2;
  }

  #deviceConfirmationModal .warning-box {
    padding: 0.5rem;
    margin-top: 0.5rem;
    border-radius: 6px;
  }

  #deviceConfirmationModal .warning-box strong {
    font-size: 0.9rem;
    line-height: 1.2;
  }

  #deviceConfirmationModal .confirmation-buttons {
    margin-top: 1rem;
    gap: 0.5rem;
    flex-direction: column;
  }

  #deviceConfirmationModal .confirmation-buttons button {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    width: 100%;
    border-radius: 6px;
  }
}

@media (max-width: 480px) {
  .modal-overlay {
    padding: 0.25rem;
    padding-top: max(0.25rem, env(safe-area-inset-top));
    padding-bottom: max(0.25rem, env(safe-area-inset-bottom));
  }

  .modal, .otp-modal, .success-modal {
    padding: 1.25rem;
    border-radius: var(--radius-md);
    max-height: 80vh;
  }

  #deviceConfirmationModal .modal {
    padding: 1.25rem;
    max-height: 75vh;
  }

  #deviceConfirmationModal .modal h2 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
  }

  #deviceConfirmationModal .device-warning {
    padding: 0.5rem;
    margin: 0.5rem 0;
  }

  #deviceConfirmationModal .device-warning p {
    font-size: 0.8rem;
    margin-bottom: 0.4rem;
  }

  #deviceConfirmationModal .device-warning li {
    font-size: 0.75rem;
    padding: 0.2rem 0;
  }

  #deviceConfirmationModal .warning-box {
    padding: 0.4rem;
    margin-top: 0.4rem;
  }

  #deviceConfirmationModal .warning-box strong {
    font-size: 0.85rem;
  }

  #deviceConfirmationModal .confirmation-buttons button {
    padding: 0.65rem 0.75rem;
    font-size: 0.8rem;
  }

  .modal h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
  }
}

/* ===================================================================
   LANDSCAPE ORIENTATION FIXES
   =================================================================== */

@media (max-height: 600px) and (orientation: landscape) {
  .modal-overlay {
    padding: 0.25rem;
    align-items: flex-start;
    padding-top: 0.5rem;
  }

  .modal, .otp-modal, .success-modal {
    max-height: 70vh;
    padding: 1rem;
  }

  #deviceConfirmationModal .modal {
    max-height: 65vh;
    padding: 1rem;
  }

  .modal h2 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
  }

  #deviceConfirmationModal .device-warning {
    padding: 0.75rem;
    margin: 0.75rem 0;
  }

  #deviceConfirmationModal .confirmation-buttons {
    margin-top: 1rem;
  }
}

@media (max-height: 500px) {
  .modal-overlay {
    align-items: flex-start;
    padding-top: 0.25rem;
  }

  .modal, .otp-modal, .success-modal {
    max-height: 85vh;
    padding: 0.75rem;
  }

  #deviceConfirmationModal .modal {
    max-height: 80vh;
    padding: 0.75rem;
  }
}

/* ===================================================================
   UTILITY & ACCESSIBILITY
   =================================================================== */

html {
  scroll-behavior: smooth;
}

*:focus {
  outline: 2px solid var(--accent-primary, #D4654A);
  outline-offset: 2px;
}

.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;
}

@media (prefers-contrast: high) {
  .modal {
    border: 2px solid #000;
  }

  .btn-primary, .btn-secondary, .btn-coral, .btn-outline {
    border: 2px solid #000;
  }
}

/* Accessibility — must override all animations for motion-sensitive users */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
