/* ===== MOBILE & TABLET IMPROVEMENTS ===== */

/* Base Mobile Styles */
@media (max-width: 767px) {
  /* Typography Scaling */
  html {
    font-size: 16px; /* Prevent zoom on iOS input focus */
  }
  
  h1, .h1 {
    font-size: clamp(1.75rem, 8vw, 2.5rem) !important;
    line-height: 1.2;
    margin-bottom: 1rem;
  }
  
  h2, .h2 {
    font-size: clamp(1.5rem, 6vw, 2rem) !important;
    line-height: 1.3;
    margin-bottom: 0.875rem;
  }
  
  h3, .h3 {
    font-size: clamp(1.25rem, 5vw, 1.5rem) !important;
    line-height: 1.4;
  }
  
  /* Safe Area Insets for iOS */
  body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
  
  /* Navigation Improvements */
  .navbar {
    padding: 0.75rem 1rem;
    min-height: 60px;
  }
  
  .navbar-brand {
    font-size: 1.125rem;
  }
  
  .navbar-brand img {
    height: 28px;
  }
  
  .navbar-toggler {
    padding: 0.5rem;
    min-width: 44px;
    min-height: 44px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
  }
  
  .navbar-nav {
    padding: 1rem 0;
  }
  
  .nav-link {
    padding: 0.875rem 1rem !important;
    font-size: 1rem;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  
  /* Editorial Navbar Mobile Improvements */
  .editorial-navbar {
    /* Safe area insets for iOS devices */
    padding-top: env(safe-area-inset-top, 0);
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
    /* Optimize backdrop-filter performance on mobile */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
  
  .editorial-navbar-content {
    padding-left: max(1rem, env(safe-area-inset-left, 0));
    padding-right: max(1rem, env(safe-area-inset-right, 0));
  }
  
  .editorial-navbar-brand {
    min-height: 44px; /* WCAG AAA touch target */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  
  .editorial-navbar-toggle {
    min-width: 44px; /* WCAG AAA touch target */
    min-height: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
  }
  
  .editorial-nav-overlay {
    /* Safe area insets for overlay */
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
    /* Optimize backdrop-filter performance */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  
  .editorial-nav-overlay-content {
    padding-top: max(1.5rem, calc(1.5rem + env(safe-area-inset-top, 0)));
    padding-bottom: max(1.5rem, calc(1.5rem + env(safe-area-inset-bottom, 0)));
    padding-left: max(1.5rem, calc(1.5rem + env(safe-area-inset-left, 0)));
    padding-right: max(1.5rem, calc(1.5rem + env(safe-area-inset-right, 0)));
  }
  
  .editorial-nav-overlay-close {
    min-width: 44px; /* WCAG AAA touch target */
    min-height: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  
  .editorial-nav-link {
    min-height: 60px; /* Larger touch target for links */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
  }
  
  /* Touch-Friendly Buttons */
  .btn {
    min-height: 44px;
    min-width: 44px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    touch-action: manipulation; /* Remove 300ms delay */
  }
  
  .btn-sm {
    min-height: 36px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
  }
  
  .btn-lg {
    min-height: 52px;
    padding: 1rem 2rem;
    font-size: 1.125rem;
  }
  
  /* Gallery Improvements */
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
  }
  
  .gallery-masonry {
    column-count: 2 !important;
    column-gap: 0.75rem !important;
  }
  
  .gallery-list .artwork-card {
    flex-direction: column !important;
  }
  
  .gallery-list .artwork-card img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
  }
  
  .artwork-card {
    margin-bottom: 0.75rem;
    border-radius: 0.5rem;
    overflow: hidden;
  }
  
  .artwork-card img {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
  }
  
  /* Filter Buttons - Horizontal Scroll */
  .filter-container {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
  }
  
  .filter-container::-webkit-scrollbar {
    display: none;
  }
  
  .filter-buttons {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 0;
    min-width: max-content;
  }
  
  .filter-btn {
    white-space: nowrap;
    min-height: 44px;
    padding: 0.625rem 1.25rem;
    font-size: 0.9375rem;
    flex-shrink: 0;
  }
  
  /* Search Bar */
  .search-container {
    margin-bottom: 1rem;
  }
  
  .search-container input {
    min-height: 44px;
    font-size: 16px; /* Prevent iOS zoom */
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
  }
  
  /* Forms */
  .form-control,
  .form-select {
    min-height: 44px;
    font-size: 16px; /* Prevent iOS zoom */
    padding: 0.75rem 1rem;
  }
  
  .form-label {
    font-size: 0.9375rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
  }
  
  /* Cards */
  .card {
    margin-bottom: 1rem;
    border-radius: 0.75rem;
  }
  
  .card-body {
    padding: 1rem;
  }
  
  .card-title {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
  }
  
  /* Spacing Adjustments */
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  .section {
    padding: 2rem 0;
  }
  
  .py-5 {
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
  }
  
  .my-5 {
    margin-top: 2rem !important;
    margin-bottom: 2rem !important;
  }
  
  /* Hero Section */
  .hero-section {
    min-height: 50vh;
    padding: 2rem 1rem;
  }
  
  .hero-content h1 {
    font-size: clamp(1.75rem, 10vw, 2.5rem);
    margin-bottom: 1rem;
  }
  
  .hero-content .lead {
    font-size: clamp(1rem, 4vw, 1.25rem);
    margin-bottom: 1.5rem;
  }
  
  /* Breadcrumbs */
  .breadcrumb {
    font-size: 0.875rem;
    padding: 0.75rem 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  
  .breadcrumb-item {
    display: inline-block;
  }
  
  /* Tables - Horizontal Scroll */
  .table-responsive {
    -webkit-overflow-scrolling: touch;
    border-radius: 0.5rem;
  }
  
  /* Modals */
  .modal-dialog {
    margin: 0.5rem;
    max-width: calc(100% - 1rem);
  }
  
  .modal-content {
    border-radius: 1rem;
  }
  
  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 1rem;
  }
  
  /* Toast Notifications */
  .toast-container {
    left: 0.5rem;
    right: 0.5rem;
    max-width: none;
  }
  
  .toast {
    width: 100%;
    font-size: 0.9375rem;
  }
  
  /* FAB Menu */
  .fab-button {
    width: 56px;
    height: 56px;
    bottom: 1.5rem;
    right: 1rem;
  }
  
  .fab-menu-item {
    width: 48px;
    height: 48px;
  }
  
  /* LightGallery Mobile Optimizations */
  .lg-toolbar {
    padding: 0.5rem;
  }
  
  .lg-icon {
    width: 44px;
    height: 44px;
    font-size: 1.25rem;
  }
  
  .lg-actions .lg-icon {
    width: 48px;
    height: 48px;
  }
  
  /* View Toggle Buttons */
  .view-toggle-container {
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
  }
  
  .view-toggle-btn {
    min-height: 44px;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
  }
  
  /* Footer */
  footer {
    padding: 2rem 1rem;
    font-size: 0.875rem;
  }
  
  footer .row {
    margin-bottom: 1.5rem;
  }
  
  /* Disable hover effects on touch devices */
  @media (hover: none) {
    .card:hover {
      transform: none;
    }
    
    .btn:hover {
      transform: none;
    }
    
    .artwork-card:hover {
      transform: none;
    }
  }
  
  /* Improve scrolling performance */
  * {
    -webkit-overflow-scrolling: touch;
  }
  
  /* Prevent text size adjustment on orientation change */
  body {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
}

/* Tablet Styles */
@media (min-width: 768px) and (max-width: 1024px) {
  /* Typography */
  h1, .h1 {
    font-size: clamp(2rem, 5vw, 3rem) !important;
  }
  
  h2, .h2 {
    font-size: clamp(1.75rem, 4vw, 2.5rem) !important;
  }
  
  /* Gallery */
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 1rem !important;
  }
  
  .gallery-masonry {
    column-count: 3 !important;
    column-gap: 1rem !important;
  }
  
  /* Navigation */
  .navbar-nav .nav-link {
    padding: 0.75rem 1rem;
  }
  
  /* Cards */
  .card-body {
    padding: 1.25rem;
  }
  
  /* Hero */
  .hero-section {
    min-height: 60vh;
    padding: 3rem 2rem;
  }
  
  /* Container */
  .container {
    max-width: 720px;
  }
  
  /* Filter Buttons */
  .filter-buttons {
    flex-wrap: wrap;
    gap: 0.75rem;
  }
}

/* Large Tablet / Small Desktop */
@media (min-width: 1025px) and (max-width: 1199px) {
  .gallery-grid {
    grid-template-columns: repeat(4, 1fr) !important;
  }
  
  .gallery-masonry {
    column-count: 4 !important;
  }
}

/* Landscape Mobile */
@media (max-width: 767px) and (orientation: landscape) {
  .hero-section {
    min-height: 70vh;
  }
  
  .navbar {
    min-height: 56px;
  }
  
  .editorial-navbar {
    height: 56px;
  }
  
  .editorial-nav-overlay-content {
    padding: 1rem;
  }
  
  .editorial-nav-link {
    font-size: clamp(1.25rem, 6vw, 2rem);
    min-height: 52px;
    padding: 0.75rem 0;
  }
  
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
  
  .gallery-masonry {
    column-count: 3 !important;
  }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .artwork-card img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
  
  /* Editorial navbar high DPI optimizations */
  .editorial-navbar-toggle-icon span {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  /* Editorial navbar reduced motion */
  .editorial-navbar-toggle-icon span,
  .editorial-nav-link,
  .editorial-nav-overlay {
    transition: none !important;
  }
  
  .editorial-nav-link:hover {
    transform: none !important;
  }
}

/* Dark Mode Mobile Optimizations */
@media (max-width: 767px) and (prefers-color-scheme: dark) {
  .navbar {
    background: rgba(15, 23, 42, 0.95) !important;
    backdrop-filter: blur(10px);
  }
  
  .card {
    background: rgba(30, 41, 59, 0.8);
  }
  
  .modal-content {
    background: #1e293b;
  }
}

