/* ============================================
   PORTFOLIO ENHANCEMENTS - Modern Case Studies
   ============================================ */

/* Filter Pills */
.filter-controls {
  margin-top: clamp(40px, 6vw, 64px);
  margin-bottom: clamp(32px, 4vw, 48px);
}

.filter-pill {
  padding: 12px 24px;
  border-radius: 9999px;
  border: 1px solid var(--color-primaryGray200);
  background: var(--color-white50);
  color: var(--color-black200);
  font-weight: 600;
  font-size: clamp(14px, calc(14px + (2 * ((100vw - 1200px) / (1920 - 1200)))), 16px);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
  outline: none;
  box-shadow: none;
}

.filter-pill:hover:not(.active) {
  border-color: var(--color-primaryBrand);
  background: var(--color-primaryLight50);
  transform: translateY(-2px);
}

.filter-pill.active {
  background: var(--color-primaryBrand);
  color: var(--color-white50);
  border-color: var(--color-primaryBrand);
  box-shadow: 0 4px 12px rgba(22, 155, 170, 0.25);
}

.filter-pill:focus-visible {
  outline: 2px solid var(--color-primaryBrand);
  outline-offset: 2px;
}

/* Pure CSS Grid - Equal column widths and consistent gaps */
#portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(24px, 4vw, 48px);
  row-gap: clamp(32px, 5vw, 56px);
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

.grid-item {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Ensure all children respect grid-item width and do not overflow */
.grid-item > * {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

/* Responsive - Standard Pattern */
@media (max-width: 1024px) {
  #portfolio-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(20px, 3vw, 32px);
    row-gap: clamp(28px, 4vw, 44px);
  }
}

@media (max-width: 767px) {
  #portfolio-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(16px, 3vw, 28px);
    row-gap: clamp(24px, 4vw, 36px);
  }
}

/* Index page portfolio – 2-column layout, equal widths and consistent gaps (no masonry) */
#index-portfolio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(24px, 4vw, 40px);
  row-gap: clamp(32px, 5vw, 48px);
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

#index-portfolio-grid .index-portfolio-grid__left,
#index-portfolio-grid .index-portfolio-grid__right {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

#index-portfolio-grid .index-portfolio-grid__right {
  display: flex;
  flex-direction: column;
  gap: clamp(32px, 5vw, 48px);
}

#index-portfolio-grid .index-portfolio-grid__right-card {
  margin-top: 0;
}

@media (min-width: 1024px) {
  #index-portfolio-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(24px, 4vw, 48px);
    row-gap: clamp(32px, 5vw, 56px);
  }

  #index-portfolio-grid .index-portfolio-grid__left {
    grid-column: 1;
    grid-row: 1 / -1;
  }

  #index-portfolio-grid .index-portfolio-grid__right {
    grid-column: 2;
    grid-row: 1 / -1;
  }
}

/* Index portfolio: consistent image container height, no white space */
#index-portfolio-grid .image-section {
  overflow: hidden;
}

#index-portfolio-grid .inverted-radius {
  height: 280px;
  min-height: 280px;
  aspect-ratio: unset;
  display: flex;
  align-items: center;
  justify-content: center;
}

#index-portfolio-grid .inverted-radius img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

@media (min-width: 1024px) {
  #index-portfolio-grid .index-portfolio-grid__left .inverted-radius {
    height: 100%;
    min-height: 380px;
  }

  #index-portfolio-grid .index-portfolio-grid__right .inverted-radius {
    height: 280px;
    min-height: 280px;
  }
}

@media (max-width: 1023px) {
  #index-portfolio-grid .inverted-radius {
    height: 260px;
    min-height: 260px;
  }
}

@media (max-width: 767px) {
  #index-portfolio-grid .inverted-radius {
    height: 240px;
    min-height: 240px;
  }
}

/* Portfolio Card Enhancements */
.portfolio-card {
  position: relative;
  cursor: pointer;
  transition: transform 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
  opacity: 0;
  transform: translateY(40px);
  width: 100%;
  max-width: 100%;
}

.portfolio-card.aos-animate {
  animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.portfolio-card:hover {
  transform: translateY(-8px);
}

.portfolio-card .image-section {
  overflow: visible;
}

/* Ensure card children don't exceed card width */
.portfolio-card .image-section,
.portfolio-card .inverted-radius,
.portfolio-card p,
.portfolio-card .card-actions {
  max-width: 100%;
}


/* Consistent image block height for equal card widths (overrides page-level variants) */
.portfolio-card .inverted-radius,
.portfolio-card .inverted-radius.top-right.portfolio-2,
.portfolio-card .inverted-radius.top-right.portfolio-3,
.portfolio-card .inverted-radius.top-right.portfolio-4 {
  height: 400px !important;
  min-height: 400px;
  aspect-ratio: unset;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.portfolio-card .inverted-radius img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Fill container while maintaining aspect ratio */
  object-position: center;
}

/* Responsive image heights */
@media (max-width: 1024px) {
  .portfolio-card .inverted-radius {
    height: 350px;
  }
}

@media (max-width: 767px) {
  .portfolio-card .inverted-radius {
    height: 300px;
  }
}


/* Tech Stack Tags */
.tech-tags {
  position: absolute;
  bottom: 20px;
  left: 20px;
  right: 20px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  z-index: 10;
  pointer-events: none;
}

.tech-tag {
  padding: 8px 14px;
  background: rgba(22, 155, 170, 0.95);
  color: white;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Card Actions (Dual CTAs) */
.card-actions {
  margin-top: 20px;
}

.card-actions .btnCommon {
  font-size: 14px;
  padding: 10px 20px;
  white-space: nowrap;
}

@media (max-width: 575px) {
  .card-actions {
    flex-direction: column;
  }

  .card-actions .btnCommon {
    width: 100%;
  }
}

/* Modal/Lightbox Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-container {
  background: white;
  border-radius: 25px;
  max-width: 920px;
  width: 92%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 0;
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-overlay.active .modal-container {
  transform: scale(1);
}

/* Modal Close Button */
.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 10;
}

.modal-close:hover {
  background: var(--color-primaryBrand);
  transform: rotate(90deg);
}

.modal-close svg {
  width: 24px;
  height: 24px;
  stroke: white;
  stroke-width: 2;
}

/* Modal Content */
.modal-content {
  padding: 40px;
}

@media (max-width: 767px) {
  .modal-content {
    padding: 24px;
  }
}

.modal-header {
  margin-bottom: 32px;
}

.modal-header h2 {
  color: var(--color-black100);
  margin-bottom: 16px;
  font-weight: 600 !important;
}

.tech-tags-full {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.tech-tags-full .tech-tag {
  background: var(--color-primaryLight100);
  color: var(--color-primaryBrand);
  padding: 10px 16px;
  font-size: 13px;
}

.modal-hero-image {
  width: 100%;
  border-radius: 16px;
  margin-bottom: 32px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.case-study-sections section {
  margin-bottom: 32px;
}

.case-study-sections h3 {
  color: var(--color-primaryBrand);
  font-size: clamp(20px, calc(20px + (4 * ((100vw - 1200px) / (1920 - 1200)))), 24px);
  margin-bottom: 16px;
  font-weight: 600 !important;
}

.case-study-sections p {
  color: var(--color-black200);
  line-height: 1.8;
  font-size: clamp(15px, calc(15px + (2 * ((100vw - 1200px) / (1920 - 1200)))), 17px);
}

/* Smooth Scrollbar for Modal */
.modal-container::-webkit-scrollbar {
  width: 8px;
}

.modal-container::-webkit-scrollbar-track {
  background: var(--color-primaryGray50);
  border-radius: 0 25px 25px 0;
}

.modal-container::-webkit-scrollbar-thumb {
  background: var(--color-primaryBrand);
  border-radius: 4px;
}

.modal-container::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary300);
}

/* Accessibility: Reduced Motion */
@media (prefers-reduced-motion: reduce) {

  .filter-pill,
  .portfolio-card,
  .modal-overlay,
  .modal-container,
  .modal-close {
    transition: none !important;
    animation: none !important;
  }

  .portfolio-card {
    opacity: 1;
    transform: none;
  }

  .portfolio-card.aos-animate {
    animation: none;
  }
}

/* Hide filtered items smoothly */
.portfolio-card.filtered-out {
  display: none !important;
}

/* Loading State (optional) */
.portfolio-card.loading {
  opacity: 0.5;
  pointer-events: none;
}