/* Responsive Styles */
@media (max-width: 1200px) {
  .main-content {
    padding: 40px;
  }
  
  .about-layout {
    gap: 30px;
  }
  
  .carousel-content {
    grid-template-columns: 3fr 1fr;
  }
}

@media (max-width: 992px) {
  .sidebar {
    width: 220px;
  }
  
  .main-content {
    margin-left: 220px;
    max-width: calc(100% - 220px);
    padding: 30px;
  }
  
  .about-layout {
    grid-template-columns: 1fr;
    gap: 30px;
  }
  
  .about-image {
    max-width: 350px;
    margin: 0 auto;
  }
  
  .carousel-content {
    grid-template-columns: 1fr;
  }
  
  .gallery-item {
    width: 240px;
    height: 135px;
  }
}

@media (max-width: 768px) {
  body {
    flex-direction: column;
  }
  
  /* Mobile menu toggle display */
  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Sidebar changes for mobile */
  .sidebar {
    position: fixed;
    width: 280px;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 100;
  }
  
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
    max-width: 100%;
    padding: 20px;
  }
  
  .gallery-item {
    width: 220px;
    height: 124px;
  }
  
  .carousel-button {
    width: 38px;
    height: 38px;
  }
  
  .image-counter.bottom-right {
    bottom: 10px;
    right: 10px;
    font-size: 12px;
    padding: 4px 8px;
  }
  
  .project-navigation {
    flex-direction: column;
    gap: 10px;
  }
  
  .project-nav-button {
    width: 100%;
    text-align: center;
  }
  
  /* Mobile overlay for sidebar */
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 90;
  }
  
  .sidebar-overlay.active {
    display: block;
  }
}

@media (max-width: 576px) {
  .gallery-header h2 {
    font-size: 2rem;
  }
  
  .gallery-intro {
    font-size: 1rem;
  }
  
  .section {
    margin-bottom: 60px;
    padding-top: 30px;
  }
  
  .gallery-item {
    width: 200px;
    height: 113px;
  }
  
  .carousel-nav {
    padding: 0 8px;
  }
  
  .carousel-indicators {
    bottom: 8px;
  }
  
  .image-counter.bottom-right {
    bottom: 8px;
    right: 8px;
    font-size: 12px;
    padding: 4px 8px;
  }
  
  .fullscreen-toggle,
  .carousel-close {
    width: 28px;
    height: 28px;
    font-size: 16px;
    top: 10px;
  }
  
  .fullscreen-toggle {
    right: 45px;
  }
  
  .scroll-top {
    bottom: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 0;
}

body {
  font-family: var(--font-secondary);
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--background-color);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  display: flex;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 600;
  margin-top: 0;
  line-height: 1.2;
  letter-spacing: -0.5px;
}

h1 {
  font-size: 2.8rem;
}

h2 {
  font-size: 2.2rem;
  text-transform: uppercase;
  margin-bottom: 1rem;
  position: relative;
}

.section-divider {
  width: 60px;
  height: 3px;
  background: var(--primary-color);
  margin-bottom: 30px;
}

h3 {
  font-size: 1.8rem;
  margin-bottom: 15px;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-light);
}

p {
  margin-bottom: 1.5rem;
}

/* Layout Structure */
.sidebar {
    position: fixed;
    width: 250px;
    height: 100vh;
    background-color: #323232;
    box-shadow: 2px 0 10px var(--shadow-color);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.sidebar.scrolled {
  box-shadow: 2px 0 15px rgba(0, 0, 0, 0.15);
}

.main-content {
  flex: 1;
  margin-left: 250px;
  padding: 50px;
  max-width: calc(100% - 250px);
}

/* Desktop: let project thumbnail rows bleed to the true right edge of the
   viewport instead of stopping at main-content's padding. Everything else
   (headers, the carousel itself, about/contact, footer) keeps the original
   right-side padding by having it re-applied directly. */
@media (min-width: 993px) {
  .main-content {
    padding-right: 0;
  }

  .gallery-header,
  .category-header,
  .carousel-placeholder,
  .section,
  .site-footer {
    padding-right: 50px;
  }
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background-color: var(--primary-color);
  border: none;
  border-radius: 5px;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 200;
  transition: all 0.2s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.mobile-menu-toggle:hover {
  background-color: var(--primary-light);
}

/* Mobile menu open state */
.sidebar.mobile-open {
  transform: translateX(0);
}

/* Sidebar Styling */
.sidebar-logo {
  margin-bottom: 40px;
  text-align: left;
}

.fullname {
  font-size: 2.8rem;
  font-weight: 700;
  margin-bottom: 5px;
  letter-spacing: -0.5px;
  text-align: left;
  color: white;
  text-transform: uppercase;
}

.tagline {
  color: var(--text-light);
  font-size: 1rem;
  font-style: italic;
}

/* Enhanced Navigation and Submenu Styling */

/* Base Navigation Menu */
.nav-menu {
  list-style: none;
  margin-bottom: auto;
  margin-top: 20px;
}

.nav-menu li {
  margin-bottom: 15px;
}

.nav-menu a {
  display: block;
  padding: 10px 12px;
  color: white;
  font-size: 1.1rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  position: relative;
  font-family: 'Barlow Condensed', sans-serif;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.nav-menu a:hover {
  color: var(--primary-color);
  transform: translateX(5px);
}

/* Active state styling */
.nav-menu li.active > a {
  color: var(--primary-color);
  font-weight: 600;
}

/* Enhanced Submenu styling */
.has-submenu > a {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Add dropdown indicator */
.has-submenu > a::after {
  content: '▼';
  font-size: 0.7rem;
  margin-left: 5px;
  transition: transform 0.3s ease;
}

.has-submenu.active > a::after {
  transform: rotate(180deg);
}

/* Submenu animation and styling */
.submenu {
  list-style: none;
  margin-top: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  padding-left: 15px;
  margin-left: 10px;
  border-left: 2px solid #eee;
}

.has-submenu.active .submenu {
  max-height: 300px; /* Increased height for additional menu items */
}

.submenu li {
  margin-bottom: 5px;
  transform: translateX(-10px);
  opacity: 0;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  transition-delay: calc(0.05s * var(--item-index, 0));
}

.has-submenu.active .submenu li {
  transform: translateX(0);
  opacity: 1;
}

/* Apply sequence delays to submenu items */
.submenu li:nth-child(1) { --item-index: 1; }
.submenu li:nth-child(2) { --item-index: 2; }
.submenu li:nth-child(3) { --item-index: 3; }
.submenu li:nth-child(4) { --item-index: 4; }
.submenu li:nth-child(5) { --item-index: 5; }
.submenu li:nth-child(6) { --item-index: 6; }

.submenu a {
  font-size: 0.95rem;
  padding: 5px 12px 5px 10px;
  opacity: 0.8;
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--font-secondary);
  color: rgb(245, 245, 245);
}

.submenu a:hover {
  opacity: 1;
  color: var(--primary-color);
}

.submenu a.active {
  color: var(--primary-color);
  font-weight: 600;
  opacity: 1;
}

/* Highlight active section in navigation */
.section-active-indicator {
  position: absolute;
  left: 0;
  top: 10px;
  width: 4px;
  height: calc(100% - 20px);
  background-color: var(--primary-color);
  border-radius: 0 2px 2px 0;
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.3s ease;
}

.nav-menu li.active .section-active-indicator {
  transform: scaleY(1);
}

/* Social Links */
.social-links {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 30px;
}

.social-link {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #333;
  border-radius: 50%;
  color: white;
  transition: all var(--transition-fast);
}

.social-link:hover {
  background-color: var(--primary-color);
  color: white;
  transform: translateY(-3px);
}

/* Main Content Sections */
.gallery-header {
  margin-bottom: 40px;
}

.gallery-header h2 {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.gallery-intro {
  font-size: 1.1rem;
  color: var(--text-light);
  max-width: 800px;
}

.section {
  margin-bottom: 80px;
  padding-top: 40px;
}

/* Category Sections & Anchors */
.category-section {
  position: relative;
  /* margin-bottom: 60px; */
}

.category-anchor {
    position: absolute;
    top: 0;
    left: 0;
    visibility: hidden;
}

.category-header {
  margin-bottom: 30px;
}

.category-header h2 {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 1.2rem;
    margin-bottom: 10px;
}

/* Gallery and Project Grid */
.gallery-grid {
  display: flex;
  flex-direction: column;
  gap: 60px;
}

/* Enhanced Horizontal Scroll Container */
.horizontal-scroll-container {
  width: 100%;
  position: relative;
  padding: 5px 0 15px 0;
  margin: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-color) #f1f1f1;
}

.horizontal-scroll-container::-webkit-scrollbar {
  height: 8px;
  display: block;
}

.horizontal-scroll-container::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.horizontal-scroll-container::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 10px;
}

.horizontal-scroll-container::-webkit-scrollbar-thumb:hover {
  background: var(--primary-light);
}

/* Fixed carousel placeholder */
.carousel-placeholder {
  width: 100%;
  height: auto;
  overflow: visible;
  transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  margin-bottom: 20px;
  box-sizing: border-box;
}

.carousel-placeholder.active {
  height: auto;
}

/* Project row styling */
.project-row {
  display: flex;
  gap: 25px;
  padding: 10px 0;
  margin-right: 10px;
  position: relative;
  z-index: 1;
}



/* Enhanced Gallery Items and Thumbnails */
.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  width: 280px;
  height: 158px; /* 16:9 aspect ratio */
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: transform var(--transition-medium), opacity var(--transition-medium), box-shadow var(--transition-medium);
  background-color: #ffffff;
  flex-shrink: 0;
  margin-bottom: 15px;
}

.gallery-item.active-project {
  box-shadow: 0 6px 25px rgba(209, 32, 38, 0.25);
  transform: translateY(-5px);
}

.gallery-item:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.gallery-item::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(to right, var(--primary-color), var(--primary-light));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-medium);
}

.gallery-item:hover::after,
.gallery-item.active-project::after {
  transform: scaleX(1);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--transition-slow);
}

.gallery-item:hover img {
  transform: scale(1.08);
}

.thumbnail-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  padding: 20px 15px 15px;
  opacity: 0;
  transform: translateY(20px);
  transition: transform var(--transition-medium), opacity var(--transition-medium), box-shadow var(--transition-medium);
  pointer-events: none;
}

.gallery-item:hover .thumbnail-overlay {
  opacity: 1;
  transform: translateY(0);
}

.thumbnail-title {
  color: white;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.thumbnail-category {
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  margin-top: 4px;
  font-style: italic;
}

/* Fade-in animation for gallery items */
.gallery-item {
  opacity: 0;
  animation: fadeIn 0.6s ease-out forwards;
}

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

/* Staggered animations for thumbnails */
.gallery-item:nth-child(2) { animation-delay: 0.1s; }
.gallery-item:nth-child(3) { animation-delay: 0.15s; }
.gallery-item:nth-child(4) { animation-delay: 0.2s; }
.gallery-item:nth-child(5) { animation-delay: 0.25s; }
.gallery-item:nth-child(6) { animation-delay: 0.3s; }
.gallery-item:nth-child(7) { animation-delay: 0.35s; }
.gallery-item:nth-child(8) { animation-delay: 0.4s; }

/* Enhanced Carousel Styling */
.carousel-row {
  width: 100%;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.4s ease;
  opacity: 0;
}

.carousel-row.active {
  max-height: none;
  opacity: 1;
}

.carousel-row.closing {
  max-height: 0;
  opacity: 0;
}

.carousel-container {
  width: 100%;
  background-color: #f8f8f8;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 30px;
  max-height: none;
}

/* CRITICAL: Isolate carousel transitions */
.carousel-content-wrapper {
  position: relative;
  overflow: visible;
  width: 100%;
  isolation: isolate;
  transform: translateZ(0);
}

.carousel-content {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 1fr);
  align-items: stretch;
  gap: 20px;
  width: 100%;
}

/* Main carousel container */
.carousel {
  position: relative;
  width: 100%;
  height: auto;
  overflow: hidden;
  border-radius: 6px;
  background-color: #f8f8f8;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  min-height: 300px;
  max-height: 60vh;
}

/* Carousel track for slides */
.carousel-track {
  display: flex;
  transition: transform 0.4s ease;
  height: 100%;
}

/* Improved carousel slide and image styling */
.carousel-slide {
  min-width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.3s ease;
  background-color: #f0f0f0;
  overflow: hidden;
}

.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.3s ease;
}

/* Loading state for slides */
.carousel-slide.loading::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30px;
  height: 30px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  transform: translate(-50%, -50%);
}

@keyframes spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Loaded state for images */
.carousel-slide img.loaded {
  opacity: 1;
}

.carousel-slide.loaded {
  background-color: transparent;
}

/* Image caption */
.image-caption {
  position: absolute;
  bottom: 10px;
  left: 15px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  background-color: rgba(0, 0, 0, 0.5);
  padding: 4px 10px;
  border-radius: 3px;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.carousel-slide:hover .image-caption {
  opacity: 1;
}

/* Long emails / web layouts: scroll within the slide instead of being
   cropped by the default object-fit: cover treatment. Detected at runtime
   from the image's natural aspect ratio (see components.js). */
.carousel-slide.tall-scroll {
  align-items: flex-start;
  overflow-y: auto;
  overflow-x: hidden;
  cursor: default;
  -webkit-overflow-scrolling: touch;
}

.carousel-slide.tall-scroll img {
  width: 100%;
  height: auto;
  object-fit: unset;
  flex-shrink: 0;
}

.carousel-slide.tall-scroll::-webkit-scrollbar {
  width: 6px;
}

.carousel-slide.tall-scroll::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.carousel-slide.tall-scroll::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 10px;
}

/* Zoom functionality */
.carousel-slide.zoomed {
  cursor: zoom-out;
}

.carousel-slide:not(.zoomed) {
  cursor: zoom-in;
}

/* Updated carousel buttons */
.carousel-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 4px;
  background-color: rgba(255, 255, 255, 0.9);
  border: none;
  cursor: pointer;
  color: #333;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  pointer-events: auto;
  z-index: 30;
}

.carousel-button:hover {
  background-color: white;
  transform: scale(1.05);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
  color: var(--primary-color);
}

.carousel-button:active {
  transform: scale(0.95);
}

/* Position the navigation buttons */
.carousel-nav {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  padding: 0 15px;
  pointer-events: none;
  z-index: 20;
}

.carousel-nav .carousel-button {
  pointer-events: auto;
}

/* Repositioned image counter */
.image-counter.bottom-right {
  position: absolute;
  bottom: 15px;
  right: 15px;
  background-color: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  z-index: 20;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  letter-spacing: 0.5px;
}

/* Updated fullscreen toggle and close buttons */
.fullscreen-toggle,
.carousel-close {
  position: absolute;
  top: 15px;
  background-color: rgba(255, 255, 255, 0.8);
  border: none;
  border-radius: 4px;
  width: 32px;
  height: 32px;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fullscreen-toggle {
  right: 55px;
}

.carousel-close {
  right: 15px;
}

.fullscreen-toggle:hover,
.carousel-close:hover {
  background-color: #fff;
  transform: scale(1.05);
}

.carousel-close::before,
.carousel-close::after {
  content: "";
  position: absolute;
  width: 15px;
  height: 2px;
  background: #333;
  transform: rotate(45deg);
}

.carousel-close::after {
  transform: rotate(-45deg);
}

/* Carousel indicators */
.carousel-indicators {
  position: absolute;
  bottom: 15px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  z-index: 10;
}

.indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.indicator.active {
  background-color: white;
  transform: scale(1.2);
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
}

/* FIXED Fullscreen Mode Styling */
.carousel.fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  border-radius: 0;
  background-color: #000;
  max-height: none;
}

/* Critical fix: ensure carousel has proper z-index in fullscreen mode */
body.fullscreen-active .carousel.fullscreen {
  z-index: 9999;
}

.carousel.fullscreen .carousel-track {
  height: 100vh;
}

.carousel.fullscreen .carousel-slide {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background-color: #000;
}

.carousel.fullscreen .carousel-slide img {
  max-width: 90vw;
  max-height: 80vh;
  width: auto;
  height: auto;
  object-fit: contain;
}

.carousel.fullscreen .carousel-button {
  width: 52px;
  height: 52px;
  opacity: 0.9;
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
}

.carousel.fullscreen .carousel-button:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

.carousel.fullscreen .fullscreen-toggle {
  top: 20px;
  right: 65px;
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
}

.carousel.fullscreen .carousel-close {
  top: 20px;
  right: 20px;
  background-color: rgba(255, 255, 255, 0.2);
}

.carousel.fullscreen .carousel-close::before,
.carousel.fullscreen .carousel-close::after {
  background-color: white;
}

.carousel.fullscreen .image-counter.bottom-right {
  bottom: 25px;
  right: 25px;
  padding: 8px 15px;
  font-size: 16px;
  background-color: rgba(0, 0, 0, 0.7);
}

.carousel.fullscreen .carousel-indicators {
  bottom: 25px;
}

/* Fixed Carousel Image Styling */

/* Main carousel container */
.carousel {
  position: relative;
  /* width: 100%; */
  /* height: 100%; */
  /* overflow: hidden; */
  border-radius: 6px;
  background-color: #f8f8f8;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  min-height: 300px;
  max-height: 60vh;
}

/* Improved carousel slide and image styling */
.carousel-slide {
  min-width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.3s ease;
  background-color: #f0f0f0;
  overflow: hidden;
}

/* FIXED: Make images properly fill the container while preserving aspect ratio */
.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Changed from 'contain' to 'cover' */
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.3s ease;
}

/* Loaded state for images */
.carousel-slide img.loaded {
  opacity: 1;
}

/* FIXED: Fullscreen mode image handling to make images properly visible */
.carousel.fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  border-radius: 0;
  background-color: #000;
  max-height: none;
}

.carousel.fullscreen .carousel-track {
  height: 100vh;
}

.carousel.fullscreen .carousel-slide {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background-color: #000;
}

/* FIXED: Better handling of images in fullscreen mode */
.carousel.fullscreen .carousel-slide img {
  max-width: 90vw;
  max-height: 80vh;
  width: auto;
  height: auto;
  object-fit: contain; /* Changed to 'contain' for fullscreen to show whole image */
}

/* Make fullscreen controls more visible */
.carousel.fullscreen .carousel-button {
  width: 52px;
  height: 52px;
  opacity: 0.9;
  background-color: rgba(255, 255, 255, 0.3); /* More visible */
  color: white;
  z-index: 10001; /* Ensure buttons are clickable */
}

.carousel.fullscreen .carousel-button:hover {
  background-color: rgba(255, 255, 255, 0.5);
  transform: scale(1.05);
}

/* FIXED: Ensure fullscreen toggle and close buttons are clickable */
.carousel.fullscreen .fullscreen-toggle,
.carousel.fullscreen .carousel-close {
  top: 20px;
  background-color: rgba(255, 255, 255, 0.3);
  color: white;
  z-index: 10001;
}

.carousel.fullscreen .fullscreen-toggle {
  right: 65px;
}

.carousel.fullscreen .carousel-close {
  right: 20px;
}

.carousel.fullscreen .carousel-close::before,
.carousel.fullscreen .carousel-close::after {
  background-color: white;
}

/* FIXED: Ensure carousel indicators work in fullscreen */
.carousel.fullscreen .carousel-indicators {
  bottom: 25px;
  z-index: 10001;
}

/* Ensure the body doesn't scroll when in fullscreen mode */
body.fullscreen-active {
  overflow: hidden !important;
}

/* Add overlay for fullscreen background with higher z-index */
.fullscreen-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 9998;
}

.fullscreen-overlay.active {
  display: block;
}

/* Ensure the body doesn't scroll when in fullscreen mode */
body.fullscreen-active {
  overflow: hidden;
}

/* Add overlay for fullscreen background */
.fullscreen-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 9998;
}

.fullscreen-overlay.active {
  display: block;
}

/* Project Info (Right Side) */
.project-info {
  padding: 20px;
  background-color: #f8f8f8;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  overflow: visible;
  height: auto;
}

.project-info h3 {
  margin-top: 0;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 24px;
  color: #333;
}

.project-info p {
  color: #555;
  line-height: 1.6;
  margin-bottom: 20px;
}

/* Mobile Menu Styling */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  background-color: var(--primary-color);
  border: none;
  border-radius: 5px;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 200;
  transition: all 0.2s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  align-items: center;
  justify-content: center;
}

.mobile-menu-toggle:hover {
  background-color: var(--primary-light);
}

/* Hamburger icon animation */
.mobile-menu-toggle .hamburger {
  width: 20px;
  height: 16px;
  position: relative;
  transform: rotate(0deg);
  transition: .5s ease-in-out;
}

.mobile-menu-toggle .hamburger span {
  display: block;
  position: absolute;
  height: 2px;
  width: 100%;
  background: white;
  border-radius: 2px;
  opacity: 1;
  left: 0;
  transform: rotate(0deg);
  transition: .25s ease-in-out;
}

.mobile-menu-toggle .hamburger span:nth-child(1) {
  top: 0px;
}

.mobile-menu-toggle .hamburger span:nth-child(2),
.mobile-menu-toggle .hamburger span:nth-child(3) {
  top: 7px;
}

.mobile-menu-toggle .hamburger span:nth-child(4) {
  top: 14px;
}

/* X animation when menu is open */
.mobile-menu-toggle.active .hamburger span:nth-child(1) {
  top: 7px;
  width: 0%;
  left: 50%;
}

.mobile-menu-toggle.active .hamburger span:nth-child(2) {
  transform: rotate(45deg);
}

.mobile-menu-toggle.active .hamburger span:nth-child(3) {
  transform: rotate(-45deg);
}

.mobile-menu-toggle.active .hamburger span:nth-child(4) {
  top: 7px;
  width: 0%;
  left: 50%;
}

/* Mobile sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 90;
  transition: opacity 0.3s ease;
  opacity: 0;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* Mobile responsive styles */
@media (max-width: 992px) {
  .sidebar {
    width: 280px; /* Slightly wider for better mobile viewing */
  }
  
  .main-content {
    margin-left: 280px;
    max-width: calc(100% - 280px);
    padding: 30px;
  }
}

@media (max-width: 768px) {
  /* Show the mobile menu toggle */
  .mobile-menu-toggle {
    display: flex;
  }
  
  /* Hide the sidebar by default on mobile */
  .sidebar {
    position: fixed;
    width: 280px;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 100;
  }
  
  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.2);
  }
  
  .main-content {
    margin-left: 0;
    max-width: 100%;
    padding: 30px 20px;
  }
  
  /* Add a mobile header with logo for the main content */
  .mobile-header {
    display: flex;
    align-items: center;
    padding: 15px 0;
    margin-bottom: 20px;
  }
  
  .mobile-header .mobile-logo {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 1.8rem;
    color: var(--text-color);
    letter-spacing: -0.5px;
    text-transform: uppercase;
  }
  
  /* Adjust spacing in mobile view */
  .gallery-header {
    margin-top: 40px;
  }
  
  .gallery-header h2 {
    font-size: 2rem;
  }
  
  /* Improve gallery item layout on mobile */
  .gallery-item {
    width: 240px;
    height: 135px;
  }
  
  /* Ensure proper scrolling on mobile */
  .horizontal-scroll-container {
    -webkit-overflow-scrolling: touch;
    padding-bottom: 25px;
  }
}

@media (max-width: 576px) {
  /* Further adjustments for very small screens */
  .main-content {
    padding: 20px 15px;
  }
  
  .gallery-header h2 {
    font-size: 1.8rem;
  }
  
  .gallery-item {
    width: 200px;
    height: 112px;
  }
}

/* Mobile Layout Improvements for Carousel and Thumbnails */

/* 1. Fix carousel layout to 1:1 aspect ratio with centered content */
.carousel {
  /* aspect-ratio: 1/1; */
  /* min-height: auto; */
  /* max-height: none; */
}

.carousel-slide img {
  object-position: center;
}

/* 2. Mobile stacking of carousel and project info */
@media (max-width: 992px) {
  /* Stack image and project info vertically on all tablets and smaller */
  .carousel-content {
    grid-template-columns: 1fr !important;
    gap: 15px;
  }
  
  /* Maintain aspect ratio on all devices */
  .carousel {
    aspect-ratio: 1/1;
    width: 100%;
  }
  
  /* Ensure carousel maintains height on mobile */
  .carousel-container {
    max-height: none;
  }
  
  /* Adjust project info for mobile */
  .project-info {
    padding: 15px;
  }
}

/* 3. Larger thumbnails on mobile */
@media (max-width: 768px) {
  /* Larger thumbnails specifically for mobile */
  .gallery-item {
    width: 280px; /* Increase width */
    height: 158px; /* Maintain aspect ratio */
  }
  
  /* Ensure horizontal scrolling works smoothly */
  .horizontal-scroll-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 20px;
    margin-bottom: 30px;
  }
  
  /* Show more visible scrollbar on mobile */
  .horizontal-scroll-container::-webkit-scrollbar {
    height: 6px;
    display: block;
  }
  
 
}

/* 4. Small screen optimizations */
@media (max-width: 576px) {
  /* Maintain larger thumbnails even on small phones */
  .gallery-item {
    width: 260px;
    height: 146px;
  }
  
  /* Adjust spacing for better mobile layout */
  .category-section {
    margin-bottom: 40px;
  }
  
  .category-header {
    margin-bottom: 20px;
  }
  
  /* Ensure carousel navigation is easily tappable */
  .carousel-button {
    width: 40px;
    height: 40px;
  }
}

/* Remove project navigation buttons and keyboard instructions on mobile */
@media (max-width: 992px) {
  /* Hide project navigation buttons on tablet and mobile */
  .project-navigation {
    display: none;
  }
  
  /* Hide keyboard instructions on tablet and mobile */
  .keyboard-help {
    display: none;
  }
  
  /* Add more spacing where buttons were */
  .project-info {
    /* Remove auto margin that was pushing navigation buttons to bottom */
    margin-top: auto;
    
    /* Add more padding at the bottom since no buttons */
    padding-bottom: 20px;
  }
  
}

/* Mobile typography */
@media (max-width: 768px) {
  
  
  /* Make sure description text is readable */
  .project-info p {
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 15px;
  }
  
  /* Make project title appropriately sized */
  .project-info h3 {
    font-size: 20px;
    margin-bottom: 10px;
  }
}
/* Keep the image frame and description panel stable when projects change. */
.carousel-placeholder { overflow-anchor: none; transition: none; }
.carousel-content > * { min-width: 0; min-height: 0; }
@media (min-width: 993px) {
  .carousel-content { grid-template-rows: minmax(0, auto); }
  .project-info { height: 0; min-height: 100%; overflow-y: auto; }
}
@media (max-width: 992px) {
  .project-info { margin-top: 0; height: 240px; overflow-y: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .carousel-row, .carousel-track { transition: none; }
}

/* Reserve image space before loading, keeping project switches in place. */
.carousel:not(.fullscreen) { aspect-ratio: 16 / 9; min-height: 0; max-height: none; transition: none; }
.carousel:not(.fullscreen) .carousel-track { position: absolute; inset: 0; }
.carousel-slide img { object-fit: contain; }
.carousel.fullscreen { position: fixed; inset: 0; width: 100%; height: 100dvh; min-height: 0; max-height: none; aspect-ratio: auto; z-index: 9999; transition: none; }
.carousel.fullscreen .carousel-track { height: 100%; }
.carousel.fullscreen .carousel-slide { height: 100%; }
.carousel.fullscreen .carousel-slide img { max-height: 100%; width: 100%; height: 100%; object-fit: contain; }
.carousel.fullscreen .carousel-slide.tall-scroll { align-items: flex-start; overflow-y: auto; }
.carousel.fullscreen .carousel-slide.tall-scroll img { height: auto; max-height: none; }
.gallery-item { border: 0; padding: 0; text-align: left; font: inherit; }
.indicator { padding: 0; border: 0; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 4px; }
@media (max-width: 992px) {
  .carousel:not(.fullscreen) { aspect-ratio: 1; }
  .project-navigation { display: flex; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

.carousel-button { font-size: 32px; line-height: 1; }
.fullscreen-toggle { font-size: 25px; }
.carousel-slide img { -webkit-user-drag: none; }
