/* Globalne nadpisania hover dla kart portfolio — bez skakania i skalowania */

/* Całkowicie wyłącz transformacje oraz animacje na hover, aby karty nie przeskakiwały */
.portfolio-item:hover {
  transform: none !important;
  animation: none !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1) !important;
  border-color: rgba(255, 107, 157, 0.1) !important;
}

/* Uspokój przejścia: tylko cień ma się zmieniać */
.portfolio-item {
  transition: box-shadow 0.2s ease !important;
}

/* Utrzymaj widoczną nakładkę z informacjami */
.portfolio-item:hover::before {
  opacity: 1 !important;
}
.portfolio-item:hover .portfolio-overlay {
  opacity: 1 !important;
}

/* Nie pozwalaj overlayowi przechwytywać kliknięć — klik trafia w kartę */
.portfolio-item .portfolio-overlay {
  pointer-events: none !important;
}
/* Pozostawiamy animacje treści w overlay (h4, p, tagi) jak w style.css */

/* Więcej przestrzeni pod gridem, aby CTA nie nachodziło przy hover */
.portfolio-grid {
  margin-bottom: 7rem !important;
}

/* Dodatkowy margines nad CTA dla bezpieczeństwa wizualnego */
.portfolio-cta {
  margin-top: 5rem !important;
}

/* Odrocz renderowanie ciężkich sekcji do chwili zbliżenia do viewportu */
.about-section,
.services-section,
.process-section,
.portfolio-section,
.testimonials-section,
.contact-section {
  content-visibility: auto;
  /* Szacunkowy rozmiar sekcji; zapobiega skokom layoutu zanim sekcja się wyrenderuje */
  contain-intrinsic-size: 800px;
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.mobile-menu-overlay {
  opacity: 1;
  visibility: visible;
}

/* Hamburger Active State */
.hamburger.active .bar:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}

.hamburger.active .bar:nth-child(2) {
  opacity: 0;
}

.hamburger.active .bar:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

/* Ensure hamburger has proper z-index */
.hamburger {
  z-index: 1001;
  position: relative;
}

/* Mobile menu should be above overlay */
.nav-menu.active {
  z-index: 1000;
}

/* Mobile Gallery Fixes */
@media (max-width: 768px) {
  /* Force images to load properly on mobile */
  .portfolio-img {
    loading: eager !important;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }
  
  /* Ensure images are visible */
  .portfolio-image {
    position: relative;
    overflow: hidden;
    min-height: 200px;
    background: #f5f5f5;
  }
  
  /* Fix for images not loading on mobile */
  .portfolio-img[src^="https://"] {
    opacity: 1 !important;
    visibility: visible !important;
  }
  
  /* Fallback for broken images */
  .portfolio-img::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, #ff6b9d, #ffa726, #4ecdc4);
    opacity: 0.1;
    z-index: -1;
  }
  
  /* Ensure placeholder is visible */
  .portfolio-placeholder {
    background: linear-gradient(45deg, #ff6b9d, #ffa726, #4ecdc4);
    opacity: 0.1;
    min-height: 200px;
  }
  
  /* Touch-friendly gallery items */
  .portfolio-item {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  
  /* Improve touch targets */
  .portfolio-item:focus,
  .portfolio-item:active {
    outline: none;
    -webkit-tap-highlight-color: transparent;
  }

  /* Stats grid touch support */
  .stats-grid {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  
  .stats-grid:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }
}

/* Mobile Navigation Fixes - Make navbar sticky/fixed properly */

/* Mobile Team Modal Fixes */
@media (max-width: 768px) {
  /* Team modal specific fixes */
  .logo-modal.modal {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    padding: 20px 10px !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
  }
  
  .logo-modal .modal-content {
    width: 96vw !important;
    max-width: 640px !important;
    height: auto !important;
    max-height: calc(100vh - 40px) !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 16px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
  }
  
  .logo-modal .modal-header {
    padding: 15px 15px 10px !important;
    position: relative !important;
    z-index: 10 !important;
    flex-shrink: 0 !important;
  }
  
  .logo-modal .modal-header h2 {
    font-size: 1.5rem !important;
    margin: 0 !important;
  }
  
  .logo-modal .modal-body {
    padding: 0 15px 20px !important;
    overflow-y: auto !important;
    max-height: none !important;
    -webkit-overflow-scrolling: touch !important;
    flex: 1 1 auto !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
  }

  .logo-modal .modal-body {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 107, 157, 0.35) transparent;
  }

  .logo-modal .modal-body::-webkit-scrollbar {
    width: 8px;
  }

  .logo-modal .modal-body::-webkit-scrollbar-track {
    background: transparent;
  }

  .logo-modal .modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 107, 157, 0.35);
    border-radius: 8px;
  }
  
  .logo-modal .owners-container {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
    padding: 10px 0 !important;
    flex-shrink: 0 !important;
  }
  
  .logo-modal .owner-card {
    padding: 20px 15px !important;
    margin: 0 !important;
    border-radius: 12px !important;
    min-height: auto !important;
  }
  
  .logo-modal .owner-avatar {
    width: 80px !important;
    height: 80px !important;
    margin: 0 auto 15px !important;
  }
  
  .logo-modal .owner-photo {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }
  
  .logo-modal .owner-card h3 {
    font-size: 1.2rem !important;
    margin: 10px 0 5px !important;
  }
  
  .logo-modal .owner-card p {
    font-size: 0.9rem !important;
    margin: 0 0 10px !important;
  }
  
  .logo-modal .owner-description p {
    font-size: 0.85rem !important;
    line-height: 1.4 !important;
  }
  
  .logo-modal .modal-footer {
    padding: 15px 10px 20px !important;
    margin-top: 10px !important;
    overflow: hidden !important;
    width: 100% !important;
    box-sizing: border-box !important;
    max-height: 35vh !important;
    overflow-y: auto !important;
    flex-shrink: 0 !important;
  }
  
  .logo-modal .modal-tagline {
    font-size: 0.8rem !important;
    line-height: 1.3 !important;
    padding: 0 10px !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  
  .logo-modal .close {
    top: 18px !important;
    right: 10px !important;
    width: 35px !important;
    height: 35px !important;
    font-size: 20px !important;
    z-index: 100 !important;
  }
  
  /* Prevent body scroll when modal is open */
  body.modal-open {
    overflow: hidden !important;
  }
}

/* Extra small devices (iPhone SE, Galaxy S5) */
@media (max-width: 375px) {
  .logo-modal .modal-content {
    width: 98vw !important;
    height: 95vh !important;
    max-height: 95vh !important;
    border-radius: 12px !important;
  }
  
  .logo-modal .modal-header h2 {
    font-size: 1.3rem !important;
  }
  
  .logo-modal .modal-body {
    max-height: calc(95vh - 80px) !important;
    padding: 0 10px 15px !important;
  }
  
  .logo-modal .owner-avatar {
    width: 70px !important;
    height: 70px !important;
  }
  
  .logo-modal .owner-card {
    padding: 15px 10px !important;
  }
  
  .logo-modal .owner-card h3 {
    font-size: 1.1rem !important;
  }
  
  .logo-modal .modal-tagline {
    font-size: 0.75rem !important;
    padding: 0 5px !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    line-height: 1.4 !important;
  }
}

/* Landscape mode for mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .logo-modal .modal-content {
    height: 98vh !important;
    max-height: 98vh !important;
    width: 95vw !important;
    overflow: hidden !important;
    position: fixed !important;
    top: 1vh !important;
    left: 2.5vw !important;
    right: 2.5vw !important;
    bottom: 1vh !important;
  }
  
  .logo-modal .modal-body {
    max-height: calc(98vh - 70px) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  
  .logo-modal .modal-footer {
    max-height: 40vh !important;
    overflow-y: auto !important;
  }
  
  .logo-modal .modal-tagline {
    font-size: 0.75rem !important;
    line-height: 1.3 !important;
  }
  
  .logo-modal .owners-container {
    flex-direction: row !important;
    gap: 15px !important;
    padding: 5px 0 !important;
  }
  
  .logo-modal .owner-card {
    flex: 1 !important;
    padding: 15px 10px !important;
  }
  
  .logo-modal .owner-avatar {
    width: 60px !important;
    height: 60px !important;
  }
  
  .logo-modal .modal-footer {
    margin-top: auto !important;
    padding-top: 10px !important;
  }
}

/* Improved Scroll-to-Top Button */
.scroll-to-top {
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  backdrop-filter: blur(10px);
  background: rgba(255, 107, 157, 0.9) !important;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 20px rgba(255, 107, 157, 0.3);
}

.scroll-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-to-top:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 25px rgba(255, 107, 157, 0.4);
}

.scroll-to-top:active {
  transform: translateY(-1px) scale(0.98);
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .scroll-to-top {
    bottom: 25px !important;
    right: 25px !important;
    width: 48px !important;
    height: 48px !important;
    backdrop-filter: blur(15px);
    background: rgba(255, 107, 157, 0.95) !important;
  }
  
  .scroll-to-top svg {
    width: 22px !important;
    height: 22px !important;
  }
}