/* ============================================
   PORTFOLIO FILTER SYSTEM
   ============================================ */

/* Filter Container */
.filter-container {
  position: sticky;
  top: 72px;
  z-index: 40;
  padding: 1.5rem 0 2rem;
  margin-bottom: 1rem;
}

.filter-wrapper {
  max-width: 80rem;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 640px) {
  .filter-wrapper {
    padding: 0 1.5rem;
  }
}

@media (min-width: 1024px) {
  .filter-wrapper {
    padding: 0 2rem;
  }
}

.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  justify-content: center;
  align-items: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding: 0.25rem 0.5rem;
}

.filter-buttons::-webkit-scrollbar {
  height: 4px;
}

.filter-buttons::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 2px;
}

.filter-buttons::-webkit-scrollbar-thumb {
  background: rgba(255, 107, 53, 0.3);
  border-radius: 2px;
}

.filter-buttons::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 107, 53, 0.5);
}

/* Filter Buttons */
.filter-btn {
  padding: 0.375rem 0.75rem;
  background: #ffffff;
  border: 2px solid rgba(255, 107, 53, 0.25);
  border-radius: 0.375rem;
  color: #1f2937;
  font-size: 0.75rem;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  text-transform: none;
  letter-spacing: 0.025em;
  white-space: nowrap;
  flex-shrink: 0;
}

.filter-btn:hover {
  border-color: #ff6b35;
  background: rgba(255, 107, 53, 0.05);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.2);
  color: #ff6b35;
}

.filter-btn.active {
  background: #ff6b35;
  border-color: #ff6b35;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

/* Count Badge */
.filter-btn .count {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0.125rem 0.375rem;
  background: rgba(255, 107, 53, 0.1);
  border-radius: 0.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: #64748b;
}

.filter-btn.active .count {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* Results Counter */
.results-counter {
  text-align: center;
  margin: 1rem 0 1.5rem;
  font-size: 1rem;
  color: #4b5563;
  font-family: inherit;
  letter-spacing: 0.025em;
}

.results-counter strong {
  color: #ff6b35;
  font-weight: 600;
}

/* Portfolio Item Filtering */
.portfolio-item.filter-hidden {
  display: none;
}

.portfolio-item:not(.filter-hidden) {
  animation: fadeInUp 0.5s ease backwards;
}

/* ============================================
   UNIFORM GRID LAYOUT
   ============================================ */

#portfolioGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  padding: 0 1rem;
}

@media (min-width: 640px) {
  #portfolioGrid {
    padding: 0 1.5rem;
  }
}

@media (min-width: 1024px) {
  #portfolioGrid {
    padding: 0 2rem;
  }
}

#portfolioGrid > .grid {
  display: contents;
}

#portfolioGrid .portfolio-item {
  grid-column: auto;
  height: 350px;
  width: 100%;
  margin: 0;
}

#portfolioGrid .portfolio-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

#portfolioGrid .gallery-container {
  position: relative;
  overflow: hidden;
  border-radius: 1.5rem;
  cursor: pointer;
}

/* Responsive uniform grid */
@media (max-width: 768px) {
  #portfolioGrid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
  #portfolioGrid .portfolio-item {
    height: 220px;
  }
  .filter-container {
    position: relative;
    top: 0;
    padding: 1rem 0 1.5rem;
  }
  .filter-buttons {
    flex-wrap: wrap;
    gap: 0.5rem;
    overflow-x: visible;
  }
  .filter-btn {
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
  }
  .filter-btn .count {
    font-size: 0.6875rem;
    padding: 0.125rem 0.375rem;
    margin-left: 0.25rem;
  }
  .results-counter {
    font-size: 0.875rem;
    margin: 0.75rem 0 1rem;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  #portfolioGrid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }
  #portfolioGrid .portfolio-item {
    height: 300px;
  }
}

@media (min-width: 1025px) and (max-width: 1439px) {
  #portfolioGrid {
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
  }
  #portfolioGrid .portfolio-item {
    height: 350px;
  }
}

@media (min-width: 1440px) {
  #portfolioGrid {
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
  }
  #portfolioGrid .portfolio-item {
    height: 380px;
  }
}

/* ============================================
   VIDEO SECTIONS
   ============================================ */

#video-showcase {
  display: none;
}

@media (max-width: 768px) {
  #video-showcase .grid {
    grid-template-columns: 1fr;
  }
}

.video-card {
  background: white;
  border-radius: 1.5rem;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.video-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.video-wrapper {
  position: relative;
  padding: 56.25% 0 0 0;
  background: #000;
}

.video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.video-info {
  padding: 1.5rem;
}

.video-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 0.5rem;
}

.video-description {
  font-size: 0.875rem;
  color: #6b7280;
  line-height: 1.5;
}

.video-container {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 500px;
  cursor: default !important;
}

.video-container > div {
  padding: 0 !important;
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 177.78%;
  height: 100%;
}

.video-container iframe {
  border-radius: 1.5rem;
  width: 100%;
  height: 100%;
  object-fit: cover;
  min-width: 100%;
  min-height: 100%;
}

#portfolioGrid .video-container {
  grid-column: 1 / -1;
  height: auto;
  width: 100%;
  cursor: default;
}

#portfolioGrid .video-container > div {
  padding: 56.25% 0 0 0;
  position: relative;
}

#portfolioGrid .video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 1.5rem;
}

/* ============================================
   IMAGE TITLE OVERLAYS
   ============================================ */

.image-title {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.6) 50%, transparent 100%);
  color: white;
  padding: 2rem 1.5rem 1.5rem;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.gallery-container:hover .image-title {
  opacity: 1;
}

.image-title-text {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  line-height: 1.4;
}

.image-title-subtitle {
  font-size: 0.875rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.9);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

@media (max-width: 768px) {
  .image-title {
    opacity: 1;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.7) 60%, transparent 100%);
  }
  .image-title-text {
    font-size: 0.875rem;
  }
  .image-title-subtitle {
    font-size: 0.75rem;
  }
}

/* ============================================
   HOMEPAGE SPECIFIC STYLES
   ============================================ */

.dots-gray {
  background-color: #111827;
  background-image: radial-gradient(circle, #374151 1px, transparent 1px);
  background-size: 20px 20px;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#services article {
  opacity: 0;
  animation: fadeInUp 0.6s ease-out forwards;
}

#services article:nth-child(1) {
  animation-delay: 0.1s;
}
#services article:nth-child(2) {
  animation-delay: 0.2s;
}
#services article:nth-child(3) {
  animation-delay: 0.3s;
}
#services article:nth-child(4) {
  animation-delay: 0.4s;
}

@keyframes scroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

.animate-scroll {
  display: flex;
  animation: scroll 20s linear infinite;
}

.animate-scroll:hover {
  animation-play-state: paused;
}

.portfolio-scroll-container {
  display: flex;
  gap: 2rem;
  will-change: transform;
}

#galleryWrapper {
  cursor: pointer;
  overflow: hidden;
  width: 100%;
  padding-left: 2rem;
  padding-right: 2rem;
}

#scrollContainer {
  transition: none;
}

#scrollContainer .grid-item .grid {
  grid-template-columns: repeat(4, 280px);
  gap: 1.5rem;
}

@media (min-width: 1024px) {
  #scrollContainer .grid-item {
    padding-left: 0;
    padding-right: 0;
    margin-right: 0;
  }
  #scrollContainer .grid-item:nth-child(2) .grid,
  #scrollContainer .grid-item:nth-child(3) .grid {
    padding-left: 0;
    padding-right: 0;
  }
  #scrollContainer .grid-item .grid {
    gap: 1.5rem;
  }
}

#hero video {
  object-fit: cover;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: -20;
}

#hero {
  position: relative;
}

/* ============================================
   TAILWIND OVERRIDES & NAVIGATION
   ============================================ */

@media (min-width: 1024px) {
  header nav ul.hidden.lg\:flex.lg\:gap-x-12,
  header nav ul.hidden[class*="lg:flex"],
  header nav ul.hidden,
  header nav ul {
    display: flex !important;
    gap: 3rem !important;
  }
  #mobile-menu {
    display: none !important;
  }
  #galleryWrapper.hidden.lg\:block,
  #galleryWrapper.hidden[class*="lg:block"],
  #galleryWrapper.hidden,
  #galleryWrapper {
    display: block !important;
  }
}

@media (min-width: 640px) {
  div.hidden.sm\:mb-8.sm\:flex.sm\:justify-center,
  div.hidden[class*="sm:flex"],
  #hero > div > div.hidden {
    display: flex !important;
    justify-content: center !important;
    margin-bottom: 2rem !important;
  }
}

@media (max-width: 1023px) {
  #galleryWrapper {
    display: none !important;
  }
  header nav ul.hidden {
    display: none !important;
  }
  #mobile-menu {
    display: none;
  }
  #mobile-menu.hidden {
    display: none !important;
  }
  #mobile-menu:not(.hidden) {
    display: block !important;
    position: fixed !important;
    inset: 0 !important;
    z-index: 50 !important;
  }
  .portfolio-item figure,
  .portfolio-item figure img {
    border-radius: 0.375rem 0.375rem 0 0 !important;
  }
  .portfolio-item article {
    border-radius: 0 0 0.375rem 0.375rem !important;
  }
}

@media (max-width: 639px) {
  #hero > div > div.hidden {
    display: none !important;
  }
}

#imageModal.hidden {
  display: none !important;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

@media (prefers-reduced-motion: reduce) {
  .filter-btn,
  .portfolio-item {
    transition-duration: 0.01ms;
  }
  .portfolio-item:not(.filter-hidden) {
    animation: none;
  }
}
