/* Mobile & Tablet Responsive Improvements */

/* Tablet (portrait and smaller) */
@media (max-width: 920px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }

  body {
    padding: 0 16px;
  }

  .container {
    padding: 0 16px;
  }
}

/* Mobile phones (landscape and smaller) */
@media (max-width: 768px) {
  /* Adjust header/logo size */
  header img, header svg {
    max-width: 200px;
    height: auto;
  }

  /* Increase touch target sizes for buttons */
  .pill, button {
    min-height: 44px;
    padding: 12px 20px;
  }

  /* Make input fields larger */
  .input, input, textarea {
    font-size: 16px !important; /* Prevents zoom on iOS */
    padding: 12px 16px;
    min-height: 44px;
  }

  textarea {
    min-height: 120px;
  }

  /* Adjust card padding */
  .card {
    padding: 20px 16px;
  }

  /* Make dialogs full width on mobile */
  dialog {
    max-width: 90vw !important;
    margin: 20px;
  }

  /* Adjust font sizes */
  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.75rem;
  }

  h3 {
    font-size: 1.5rem;
  }

  /* Stack grid items */
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }
}

/* Small mobile phones (portrait) */
@media (max-width: 480px) {
  body {
    padding: 0 12px;
  }

  .container {
    padding: 0 12px;
    gap: 16px;
  }

  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  h3 {
    font-size: 1.25rem;
  }

  .pill, button {
    font-size: 14px;
    padding: 10px 16px;
  }

  .card {
    padding: 16px 12px;
  }

  footer {
    font-size: 12px;
    padding: 16px 8px;
  }

  footer a {
    display: block;
    margin: 8px 0 !important;
  }
}

/* Landscape orientation specific */
@media (max-width: 920px) and (orientation: landscape) {
  .container {
    gap: 12px;
  }

  h1, h2, h3 {
    margin-top: 8px;
    margin-bottom: 8px;
  }
}

/* Touch device improvements */
@media (hover: none) and (pointer: coarse) {
  a, button, .pill {
    min-height: 44px;
    min-width: 44px;
  }

  .pill:active {
    opacity: 0.8;
  }

  /* Pop grid: active state for grid boxes */
  .product:active .product__bg {
    background: var(--brand-bg);
  }
}

/* High DPI screens (Retina displays) */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

/* Prevent text size adjustments on orientation change */
html {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Ensure images scale properly */
img {
  max-width: 100%;
  height: auto;
}

/* Make sure the contact form is mobile friendly */
#contact-form {
  width: 100%;
}

#contact-form .input,
#contact-form input,
#contact-form textarea {
  width: 100%;
  box-sizing: border-box;
}

/* Improve scrolling on mobile */
body {
  -webkit-overflow-scrolling: touch;
  overflow-x: hidden;
}

/* Fix viewport height on mobile browsers */
@supports (-webkit-touch-callout: none) {
  body {
    min-height: -webkit-fill-available;
  }
}

/* App Cards — enterprise flat styling */
.app-card {
  text-align: center;
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
  border: 1px solid var(--border);
  padding: 20px;
  background: var(--bg);
}

.app-card:hover {
  background: var(--bg-alt);
}

.app-logo-container {
  width: 100%;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  background: var(--bg-alt);
  padding: 20px;
}

.app-logo-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.app-card h3 {
  color: var(--brand);
  margin-bottom: 15px;
}

.app-card p {
  line-height: 1.6;
  color: var(--muted);
}

/* Mobile adjustments for app cards */
@media (max-width: 768px) {
  .app-logo-container {
    height: 150px;
  }

  .app-card h3 {
    font-size: 1.3rem;
  }
}

@media (max-width: 480px) {
  .app-logo-container {
    height: 120px;
  }
}

/* Bottom nav bar — push content above it on mobile */
@media (max-width: 900px) {
  /* Cookie banner should sit above bottom nav */
  .cookie-banner {
    bottom: 56px !important;
  }

  /* Footer needs clearance from bottom nav */
  footer {
    margin-bottom: 56px;
  }

  /* Dialogs should not be hidden behind bottom nav */
  dialog {
    margin-bottom: 60px;
  }
}

/* Pop grid: modal content responsive tweaks */
@media (max-width: 768px) {
  .modal-app-grid {
    grid-template-columns: 1fr !important;
  }

  .modal-pricing-grid {
    grid-template-columns: 1fr !important;
  }

  .modal-contact-form .form-row {
    grid-template-columns: 1fr !important;
  }

  .details__bg--down {
    width: 95% !important;
    padding: 20px !important;
  }
}

@media (max-width: 480px) {
  .details__bg--down {
    width: 100% !important;
    padding: 15px !important;
  }
}
