/* Custom CSS to complement Tailwind CSS */
/* This file contains styles that work alongside Tailwind classes */

/* Preloader styles */
#preloader {
  transition: opacity 0.5s ease-in-out;
}

/* ========================================
   CAROUSEL & HERO SECTION STYLES
   ======================================== */

/* Carousel container with responsive heights */
.carousel-container {
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* Desktop - Full screen height */
@media (min-width: 1025px) {
    .carousel-container {
        height: 100vh;
        min-height: 600px;
    }
}

/* Tablet - Reduced height */
@media (min-width: 769px) and (max-width: 1024px) {
    .carousel-container {
        height: 80vh;
        min-height: 500px;
        max-height: 700px;
    }
}

/* Mobile Portrait - Dynamic height based on image aspect ratio */
@media (max-width: 768px) and (orientation: portrait) {
    .carousel-container {
        height: auto;
        min-height: 300px;
        max-height: 50vh;
    }
    
    /* For your tbanner image (1600x906) */
    .carousel-container.tbanner-ratio {
        height: 56.6vw; /* 906/1600 * 100vw */
        min-height: 300px;
        max-height: 50vh;
    }
    
    .background-image {
        background-size: cover !important;
        background-position: center center;
    }
    
    /* Disable Ken Burns on mobile */
    .kenburns .owl-item.active .background-image {
        animation: none !important;
        transform: none !important;
    }
}

/* Mobile Landscape - Reduced height to allow scrolling */
@media (max-width: 768px) and (orientation: landscape) {
    .carousel-container {
        height: 40vh !important;
        min-height: 250px;
        max-height: 40vh;
    }
    
    .carousel-container.tbanner-ratio {
        height: 40vh !important;
        min-height: 250px;
        max-height: 40vh;
    }
    
    .background-image {
        background-size: cover !important;
        background-position: center center;
    }
    
    /* Disable Ken Burns on mobile landscape */
    .kenburns .owl-item.active .background-image {
        animation: none !important;
        transform: none !important;
    }
}

/* General mobile touch handling */
@media (max-width: 768px) {
    /* Allow page scrolling through carousel */
    .carousel-container {
        touch-action: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Allow scrolling through carousel elements */
    .owl-carousel {
        touch-action: auto !important;
        pointer-events: none; /* Make carousel transparent to touch */
    }
    
    /* Re-enable touch only for navigation dots/arrows if present */
    .owl-nav,
    .owl-dots {
        pointer-events: auto;
        touch-action: manipulation;
    }
    
    /* Allow normal scrolling through slides */
    .owl-carousel .owl-stage-outer {
        touch-action: auto !important;
        pointer-events: none;
    }
    
    /* Make slides allow scroll-through */
    .owl-slide {
        touch-action: auto !important;
        pointer-events: none;
    }
    
    /* Allow interaction with overlay content only */
    .owl-slide .absolute {
        pointer-events: auto;
        touch-action: auto;
    }
}

/* Background image for hero section */
.background-image {
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center center;
  transition: transform 0.5s ease;
  width: 100%;
  height: 100%;
  display: block;
}

/* Ken Burns animation for hero images */
.kenburns .owl-item.active .background-image {
  animation: kenburns 15s linear infinite;
}

/* Tablet Ken Burns animation */
@media (min-width: 769px) and (max-width: 1024px) {
    .kenburns .owl-item.active .background-image {
        animation: tabletKenburns 10s linear infinite;
    }
}

/* Ken Burns animations */
@keyframes kenburns {
  0% {
    transform: scale(1.1);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1.1);
  }
}

@keyframes tabletKenburns {
    0% { transform: scale(1.05); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1.05); }
}

/* Prevent vertical sliding on carousel */
.owl-carousel {
    touch-action: pan-x !important;
}

.owl-stage-outer {
    overflow: hidden !important;
}

/* ========================================
   GALLERY STYLES
   ======================================== */

/* Gallery Grid Styling */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (min-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
  }
}

@media (min-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.gallery-item {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  border-radius: 1rem;
  background-color: #f3f4f6;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.gallery-item:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: contain !important;
  /* Changed from cover to contain */
  object-position: center;
  background-color: #f9fafb;
  /* Light background for letterboxing */
  transition: transform 0.3s ease;
}

.gallery-item:hover img {
  transform: scale(1.05);
}

/* Alternative gallery style - if you prefer full coverage without cropping */
.gallery-item.full-fit img {
  object-fit: cover;
  object-position: center top;
  /* Show top portion for portraits */
}

/* Gallery overlay */
.gallery-item .gallery-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  color: white;
  padding: 1.5rem;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-overlay {
  transform: translateY(0);
}

/* Gallery navigation buttons */
.gallery-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  margin: 0.25rem;
  background-color: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
}

.gallery-nav:hover {
  background-color: #9a2827;
  color: white;
  border-color: #9a2827;
  transform: translateY(-1px);
}

.gallery-nav.active {
  background-color: #9a2827;
  color: white;
  border-color: #9a2827;
}

/* Pagination wrapper */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2rem;
}

/* ========================================
   OWL CAROUSEL CUSTOM STYLES
   ======================================== */

.owl-carousel {
  display: block;
  width: 100%;
  position: relative;
  z-index: 1;
  height: 100%;
}

.owl-carousel .owl-stage-outer {
  height: 100%;
}

.owl-carousel .owl-stage {
  height: 100%;
}

.owl-carousel .owl-item {
  height: 100%;
}

.owl-slide {
  width: 100%;
  height: 100%;
  position: relative;
}

/* Owl navigation */
.owl-nav {
  position: absolute;
  top: 50%;
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 2rem;
  pointer-events: none;
  z-index: 10;
}

.owl-nav button {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  color: #374151;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.owl-nav button:hover {
  background: #9a2827;
  color: white;
  transform: scale(1.1);
}

/* Owl dots */
.owl-dots {
  text-align: center;
  margin-top: 2rem;
}

.owl-dots .owl-dot {
  display: inline-block;
  margin: 0 0.5rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: all 0.3s ease;
}

.owl-dots .owl-dot.active,
.owl-dots .owl-dot:hover {
  background: #9a2827;
  transform: scale(1.3);
}

/* ========================================
   UTILITY STYLES
   ======================================== */

/* Smooth scrolling behavior */
html {
  scroll-behavior: smooth;
}

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: #9a2827;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #7c1d1c;
}

/* Fade in animation for sections */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fadeInUp 0.6s ease-out;
}

/* ========================================
   CONTACT FORM STYLES
   ======================================== */

/* Contact form enhancements */
.contact-form-field {
  position: relative;
  margin-bottom: 1.5rem;
}

.contact-form-field input,
.contact-form-field textarea {
  width: 100%;
  padding: 1rem;
  border: 2px solid #e5e7eb;
  border-radius: 0.5rem;
  font-size: 1rem;
  transition: all 0.3s ease;
  background: white;
}

.contact-form-field input:focus,
.contact-form-field textarea:focus {
  outline: none;
  border-color: #9a2827;
  box-shadow: 0 0 0 3px rgba(154, 40, 39, 0.1);
}

.contact-form-field label {
  position: absolute;
  top: 1rem;
  left: 1rem;
  color: #6b7280;
  pointer-events: none;
  transition: all 0.3s ease;
}

.contact-form-field input:focus + label,
.contact-form-field input:not(:placeholder-shown) + label,
.contact-form-field textarea:focus + label,
.contact-form-field textarea:not(:placeholder-shown) + label {
  top: -0.5rem;
  left: 0.75rem;
  font-size: 0.875rem;
  color: #9a2827;
  background: white;
  padding: 0 0.5rem;
}

/* ========================================
   BUTTON STYLES
   ======================================== */

/* Button hover effects */
.btn-brand {
  background-color: #9a2827;
  color: white;
  padding: 0.75rem 2rem;
  border-radius: 0.5rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
}

.btn-brand:hover {
  background-color: #7c1d1c;
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(154, 40, 39, 0.2);
}

/* ========================================
   MAP STYLES
   ======================================== */

/* Map container styling */
.map-container {
  position: relative;
  overflow: hidden;
  border-radius: 1rem;
}

.map-container iframe {
  filter: grayscale(20%);
  transition: filter 0.3s ease;
}

.map-container:hover iframe {
  filter: grayscale(0%);
}

/* ========================================
   LOADING STATES
   ======================================== */

/* Loading states */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #9a2827;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ========================================
   RESPONSIVE UTILITIES
   ======================================== */

/* Responsive utilities */
@media (max-width: 640px) {
  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .owl-nav {
    padding: 0 1rem;
  }
  
  .owl-nav button {
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
  }
}

/* ========================================
   ACCESSIBILITY & PRINT STYLES
   ======================================== */

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
  /* Add dark mode styles if needed */
}

/* Print styles */
@media print {
  .owl-nav,
  .owl-dots,
  .gallery-nav,
  #mobile-menu-toggle,
  #mobile-menu {
    display: none !important;
  }
}

/* ========================================
   ADDITIONAL MOBILE FIXES
   ======================================== */

/* Additional mobile carousel fixes */
@media (max-width: 768px) {
    /* Make carousel transparent to touch events */
    .owl-carousel .owl-stage-outer {
        overflow: hidden;
        touch-action: auto !important;
        pointer-events: none;
    }
    
    /* Allow page scrolling through carousel */
    .carousel-container * {
        touch-action: auto !important;
    }
    
    /* Make slides non-interactive for touch */
    .owl-slide {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        touch-action: auto !important;
        pointer-events: none;
    }
    
    /* Allow interaction only with overlay content */
    .carousel-overlay {
        padding: 1rem;
        touch-action: auto;
        pointer-events: auto;
    }
    
    .carousel-overlay .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Allow scrolling through carousel overlay */
    .owl-slide .absolute {
        touch-action: auto !important;
        pointer-events: auto;
    }
    
    /* Make text content interactive */
    .owl-slide .absolute .container {
        pointer-events: auto;
    }
    
    /* Disable carousel touch completely on mobile */
    .owl-carousel.owl-drag {
        touch-action: auto !important;
    }
    
    /* Override owl carousel touch settings */
    .owl-carousel .owl-stage {
        touch-action: auto !important;
        pointer-events: none;
    }
}

/* Force disable owl carousel touch on mobile */
@media (max-width: 768px) {
    .owl-carousel {
        -webkit-touch-callout: none !important;
        -webkit-user-select: none !important;
        -khtml-user-select: none !important;
        -moz-user-select: none !important;
        -ms-user-select: none !important;
        user-select: none !important;
        pointer-events: none !important;
        touch-action: auto !important;
    }
}

/* Landscape specific adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    /* Reduce heights further in landscape to ensure content visibility */
    .carousel-container,
    .carousel-container.tbanner-ratio {
        height: 35vh !important;
        min-height: 200px;
        max-height: 35vh;
    }
}

/* Fix for iOS Safari viewport height issues */
@supports (-webkit-touch-callout: none) {
    @media (max-width: 768px) and (orientation: portrait) {
        .carousel-container {
            min-height: -webkit-fill-available;
            max-height: 50vh;
        }
    }
    
    @media (max-width: 768px) and (orientation: landscape) {
        .carousel-container,
        .carousel-container.tbanner-ratio {
            height: 35vh !important;
            max-height: 35vh;
        }
    }
}