/**
 * Projects Styles for Matilde Saunders Plugin
 * Clean, modern, and responsive design
 */

/* ==========================================================================
   Single Project Page - New Design
   ========================================================================== */

.matilde-project-page {
  max-width: 1440px;
  margin: 0 auto;
}

.ms-project-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  border-left: 2px solid #e60002;
  border-right: 2px solid #e60002;
}

/* Top Section - Dark Grey Background */
.ms-project-top-section {
  background-color: #2f3b4b;
  color: #ffffff;
  flex: 2;
  display: flex;
  align-items: center;
}

.ms-project-page-container-header {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 20px;
}

/* Main project page container */
.ms-project-page-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
}

/* Project details section container */
.ms-project-details-container {
  background-color: #e6e6e6;
  width: 100%;
}

/* Category Tag */
.ms-project-category-tag {
  font-family: "Inter", Sans-serif !important;
  background-color: #e60002;
  color: #ffffff;
  padding: 2px 22px;
  border-radius: 2px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
  display: inline-block;
  margin-bottom: 0;
}

/* Main Title */
.ms-project-main-title {
  font-family: "Lexend Giga", Sans-serif;
  font-size: 2.5rem;
  color: #ffffff;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  margin: 0;
  padding: 0;
}

.ms-project-client-location {
  font-family: "Inter", Sans-serif;
  font-size: 16px;
  color: #ffffff;
  font-weight: 400;
  line-height: 1.5;
  margin: 0;
  padding: 0;
}

/* Project Details */
.ms-project-details {
  display: flex;
  flex-direction: column;
  background-color: #e6e6e6;
  gap: 2rem;
}

.ms-project-detail-section {
  font-family: "Inter", Sans-serif !important;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ms-project-detail-heading {
  font-family: "Inter", Sans-serif !important;
  font-size: 16px;
  font-weight: 700;
  color: #2f3b4b;
  margin: 0;
}

.ms-project-detail-text {
  font-family: "Inter", Sans-serif !important;
  font-size: 16px;
  line-height: 1.6;
  color: #2f3b4b;
  margin: 0;
}

.ms-project-detail-text h2 {
  font-family: "Lexend Giga", Sans-serif !important;
  letter-spacing: -2px;
  font-weight: 700;
  text-transform: uppercase;
  margin: 20px 0;
  line-height: 1.2em;
}
.ms-project-detail-text a {
  color: var(--e-global-color-accent);
}

.ms-project-detail-text p,
.ms-project-detail-text ul {
  margin-bottom: 25px;
}

@media (max-width: 767px) {
  .ms-project-detail-text h2 {
    font-size: 24px;
  }

  .ms-project-detail-text h3 {
    font-size: 22px;
    line-height: 1.2em;
  }
}

.ms-project-detail-text br {
  display: block;
  content: "";
  margin-top: 0.5em;
}

.ms-project-detail-text p {
  margin: 0 0 1em 0;
}

.ms-project-detail-text p:last-child {
  margin-bottom: 0;
}

.ms-project-detail-text ul,
.ms-project-detail-text ol {
  margin: 1em 0;
  padding-left: 2em;
}

.ms-project-detail-text li {
  margin: 0.5em 0;
}

.ms-project-solution-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ms-project-solution-list li {
  position: relative;
  padding-left: 1.5rem;
  font-size: 1rem;
  line-height: 1.6;
  color: #e2e8f0;
}

.ms-project-solution-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: #e60002;
  font-weight: bold;
  font-size: 1.2rem;
}

/* Bottom Section - Red Background */
.ms-project-bottom-section {
  background-color: #e60002;
  color: #ffffff;
  flex: 1;
  display: flex;
  align-items: center;
}

.ms-project-numbers-title {
  font-family: "Inter", Sans-serif !important;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  color: #ffffff;
  margin: 0;
}

/* Metrics Grid */
.ms-project-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  max-width: 800px;
  margin: 0 auto;
}

/* Center the 4th element when there are exactly 4 metrics */
.ms-project-metric:nth-child(4):last-child {
  grid-column: 2;
}

.ms-project-metric {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ms-project-metric-value {
  font-family: "Lexend Giga", Sans-serif;
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ms-project-metric-label {
  font-size: 16px;
  font-weight: 700;
}

.ms-project-metric-description {
  font-family: "Inter", Sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: white;
  margin-top: 0.25rem;
  line-height: 1.4;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
  .ms-project-details {
    gap: 1.5rem;
  }

  .ms-project-metrics {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }

  .ms-project-metric-value {
    font-size: 25px;
  }
}

@media (max-width: 480px) {
  .ms-project-main-title {
    font-size: 1.75rem;
  }

  .ms-project-client-location {
    font-size: 1rem;
    margin: 0.75rem 0 0 0;
  }

  .ms-project-metrics {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .ms-project-metric-value {
    font-size: 25px;
  }
}

/* ==========================================================================
   Project Gallery Carousel
   ========================================================================== */

.ms-project-carousel {
  border-top: 2px solid #e60002;
  background-color: #e6e6e6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.ms-project-carousel-container {
  position: relative;
  width: 100%;
  margin: 0 auto;
  padding: 0 3rem;
}

.ms-carousel-container {
  overflow: hidden;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.ms-carousel-track {
  display: flex;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
  backface-visibility: hidden;
  perspective: 1000px;
}

.ms-carousel-slide {
  flex: 0 0 33.333%;
  min-width: 0;
  padding: 0 0.5rem;
  transform: translateZ(0);
  backface-visibility: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

/* Center slide - larger and more prominent */
.ms-carousel-slide.ms-slide-center {
  transform: scaleY(1.15) translateZ(0);
  z-index: 2;
  opacity: 1;
}

/* Side slides - smaller and slightly faded */
.ms-carousel-slide.ms-slide-left,
.ms-carousel-slide.ms-slide-right {
  transform: scaleY(0.85) translateZ(0);
  z-index: 1;
}

.ms-carousel-image {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid transparent;
}

.ms-carousel-image img {
  width: 100%;
  height: 100%;
  border-radius: 2px;
  object-fit: cover;
  transition: transform 0.3s ease;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Carousel Arrows */
.ms-carousel-arrow {
  position: absolute;
  padding: 0;
  top: 50%;
  transform: translateY(-50%);
  background: transparent !important;
  border: none;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: none !important;
  z-index: 10;
}

.ms-carousel-arrow:hover,
.ms-carousel-arrow:focus {
  background: transparent;
}

.ms-carousel-arrow:active {
  transform: translateY(-50%) scale(0.95);
}

.ms-carousel-arrow:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: translateY(-50%);
}

.ms-carousel-arrow:disabled:hover {
  background: rgba(255, 255, 255, 0.9);
  color: inherit;
  transform: translateY(-50%);
}

.ms-carousel-prev {
  left: 0;
}

.ms-carousel-next {
  right: 0;
}

.ms-carousel-arrow svg {
  width: 26px;
  height: 43px;
  transition: all 0.3s ease;
}

/* Carousel Dots Navigation */
.ms-carousel-dots {
  display: none;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 0;
  margin-top: 10px;
}

.ms-carousel-dot {
  width: 10px;
  height: 10px;
  border-radius: 50% !important;
  border: none;
  background-color: #d9d9d9 !important;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0 !important;
  box-shadow: none !important;
  outline: none;
}

.ms-carousel-dot:hover {
  background-color: #2f3b4b !important;
  transform: scale(1.1);
}

.ms-carousel-dot.active {
  background-color: #2f3b4b !important;
  transform: scale(1.2);
}

.ms-carousel-dot:focus {
  outline: 2px solid #e60002 !important;
  outline-offset: 2px;
}

/* Responsive Carousel */
@media (max-width: 1199px) {
  .ms-carousel-slide {
    flex: 0 0 50%; /* 2 slides on tablet */
  }

  .ms-project-carousel-container {
    padding: 0 2rem;
  }
}

@media (max-width: 767px) {
  .ms-carousel-slide {
    flex: 0 0 100%; /* 1 slide on mobile */
    padding: 0;
  }

  .ms-project-carousel-container {
    padding: 0 1rem;
  }

  .ms-carousel-arrow {
    display: none; /* Hide arrows on mobile */
  }

  .ms-carousel-dots {
    display: flex; /* Show dots on mobile */
  }
}

@media (max-width: 480px) {
  .ms-project-carousel-container {
    padding: 0;
  }

  .ms-carousel-arrow {
    width: 44px;
    height: 44px;
  }

  .ms-carousel-arrow svg {
    width: 18px;
    height: 30px;
  }
}

/* ==========================================================================
   Project Gallery Static
   ========================================================================== */

.ms-project-gallery-static {
  border-top: 2px solid #e60002;
  border-bottom: 2px solid #e60002;
  background-color: #e6e6e6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.ms-project-gallery-container {
  position: relative;
  width: 100%;
  margin: 0 auto;
  padding: 0 3rem;
}

.ms-gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  width: 100%;
  justify-items: center;
}

/* Center images when there are fewer than 3 images */
.ms-gallery-grid:has(.ms-gallery-item:nth-child(1):last-child) {
  grid-template-columns: 1fr;
  max-width: 400px;
  margin: 0 auto;
}

.ms-gallery-grid:has(.ms-gallery-item:nth-child(2):last-child) {
  grid-template-columns: repeat(2, 1fr);
  max-width: 800px;
  margin: 0 auto;
}

.ms-gallery-item {
  position: relative;
  transform: translateZ(0);
  backface-visibility: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.ms-gallery-image {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid transparent;
  cursor: pointer;
}

.ms-gallery-image img {
  width: 100%;
  height: 100%;
  border-radius: 2px;
  object-fit: cover;
  transition: transform 0.3s ease;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.ms-gallery-image:hover {
  transform: scale(1.02);
}

/* Responsive Gallery Static */
@media (max-width: 1199px) {
  .ms-gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .ms-project-gallery-container {
    padding: 0 2rem;
  }

  /* Adjust centering for tablet */
  .ms-gallery-grid:has(.ms-gallery-item:nth-child(1):last-child) {
    grid-template-columns: 1fr;
    max-width: 300px;
  }

  .ms-gallery-grid:has(.ms-gallery-item:nth-child(2):last-child) {
    grid-template-columns: repeat(2, 1fr);
    max-width: 600px;
  }
}

@media (max-width: 767px) {
  .ms-gallery-grid {
    grid-template-columns: 1fr;
  }

  .ms-project-gallery-container {
    padding: 0 1rem;
  }

  /* Adjust centering for mobile */
  .ms-gallery-grid:has(.ms-gallery-item:nth-child(1):last-child) {
    grid-template-columns: 1fr;
    max-width: 280px;
  }

  .ms-gallery-grid:has(.ms-gallery-item:nth-child(2):last-child) {
    grid-template-columns: 1fr;
    max-width: 280px;
  }
}

@media (max-width: 480px) {
  .ms-project-gallery-container {
    padding: 0 0.5rem;
  }
}

/* ==========================================================================
   Related Projects Static - MOVED TO ms-projects.css
   ========================================================================== */

/* ==========================================================================
   Related Projects Carousel - MOVED TO ms-projects.css
   ========================================================================== */

/* ==========================================================================
   Pagination Styles - MOVED TO ms-projects.css
   ========================================================================== */

/* ==========================================================================
   Legacy Styles (for backward compatibility) - MOVED TO ms-projects.css
   ========================================================================== */

/* ==========================================================================
   Lightbox Styles
   ========================================================================== */

.ms-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.ms-lightbox[style*="display: flex"] {
  opacity: 1;
}

.ms-lightbox-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.ms-lightbox-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.ms-lightbox-image-container {
  position: relative;
  max-width: 100%;
  max-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ms-lightbox-image-container img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* Close button - Fixed safe area in top-right corner */
.ms-lightbox-close {
  position: fixed; /* Fixed to viewport for consistent position */
  top: 40px;
  right: 40px;
  background: rgba(255, 255, 255, 0.9) !important;
  border: none !important;
  border-radius: 50% !important;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 10001;
  padding: 0;
}

.ms-lightbox-close:hover {
  background: rgba(255, 255, 255, 1) !important;
  transform: scale(1.1);
}

.ms-lightbox-close svg {
  width: 28px;
  height: 28px;
  color: #333;
}

/* ==========================================================================
   Navigation Buttons - Fixed Safe Area
   ========================================================================== 
   
   These buttons use position: fixed to stay at consistent positions
   on the screen, regardless of image size. This creates a "safe area"
   where navigation buttons are always predictable and accessible.
   
   Benefits:
   - Buttons never move when switching between different image sizes
   - Better UX with consistent click targets
   - Works on all screen sizes with responsive adjustments
   ========================================================================== */

.ms-lightbox-prev,
.ms-lightbox-next {
  position: fixed; /* Fixed to viewport, not to image container */
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.9) !important;
  border: none !important;
  border-radius: 50% !important;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 10001;
  padding: 0;
}

.ms-lightbox-prev:hover,
.ms-lightbox-next:hover,
.ms-lightbox-prev:focus,
.ms-lightbox-next:focus {
  background: rgba(255, 255, 255, 1) !important;
  transform: translateY(-50%) scale(1.1) !important;
}

/* Safe area: buttons always stay at these positions */
.ms-lightbox-prev {
  left: 40px; /* Fixed distance from left edge */
}

.ms-lightbox-next {
  right: 40px; /* Fixed distance from right edge */
}

.ms-lightbox-prev svg,
.ms-lightbox-next svg {
  width: 24px;
  height: 24px;
  color: #333;
}

.ms-lightbox-counter {
  position: absolute;
  bottom: -50px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
}

/* Make carousel images clickable */
.ms-carousel-image {
  cursor: pointer;
  transition: transform 0.3s ease;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .ms-lightbox-content {
    max-width: 95%;
    max-height: 95%;
  }

  .ms-lightbox-image-container {
    max-height: 70vh;
  }

  .ms-lightbox-image-container img {
    max-height: 70vh;
  }

  /* Close button safe area for tablets */
  .ms-lightbox-close {
    top: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
  }

  .ms-lightbox-close svg {
    width: 24px;
    height: 24px;
  }

  .ms-lightbox-prev,
  .ms-lightbox-next {
    width: 40px;
    height: 40px;
  }

  /* Safe area for tablets */
  .ms-lightbox-prev {
    left: 20px;
  }

  .ms-lightbox-next {
    right: 20px;
  }

  .ms-lightbox-prev svg,
  .ms-lightbox-next svg {
    width: 20px;
    height: 20px;
  }

  .ms-lightbox-counter {
    bottom: -40px;
    font-size: 12px;
    padding: 6px 12px;
  }
}

@media (max-width: 480px) {
  /* Safe area for mobile - smaller but still fixed */
  .ms-lightbox-prev {
    left: 12px;
    width: 36px;
    height: 36px;
  }

  .ms-lightbox-next {
    right: 12px;
    width: 36px;
    height: 36px;
  }

  .ms-lightbox-prev svg,
  .ms-lightbox-next svg {
    width: 18px;
    height: 18px;
  }

  /* Close button safe area for mobile */
  .ms-lightbox-close {
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
  }

  .ms-lightbox-close svg {
    width: 22px;
    height: 22px;
  }
}
