/**
 * Portfolio Page - Cinematic, conversion-optimized showcase
 * Mom Made Food
 */

/* ========== Cinematic Hero ========== */
.portfolio-hero-cinematic {
  position: relative;
  min-height: 85vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.portfolio-hero-bg {
  position: absolute;
  inset: 0;
}

.portfolio-hero-bg .portfolio-hero-video,
.portfolio-hero-bg .portfolio-hero-fallback {
  position: absolute;
  inset: 0;
}

.portfolio-hero-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.portfolio-hero-fallback {
  width: 100%;
  height: 100%;
}

.portfolio-hero-fallback img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Fallback always visible; video overlays when present */

.portfolio-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.3) 0%, var(--color-surface-base) 100%);
  pointer-events: none;
}

.portfolio-hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 4rem 1.5rem;
}

.portfolio-hero-label {
  color: var(--color-brand-gold);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 1rem;
}

.portfolio-hero-title {
  font-family: var(--font-heading);
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: 1rem;
  line-height: 1.15;
}

.portfolio-hero-subtitle {
  font-size: clamp(16px, 1.5vw, 18px);
  color: var(--color-text-secondary);
  margin-bottom: 2rem;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.portfolio-hero-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-tertiary);
  margin-bottom: 3rem;
}

.portfolio-hero-stats .stat-sep {
  color: var(--color-brand-gold);
  margin: 0 0.25rem;
}

.portfolio-hero-scroll {
  animation: scrollBounce 2s ease-in-out infinite;
}

.scroll-mouse {
  display: inline-block;
  width: 24px;
  height: 40px;
  border: 2px solid var(--color-border-emphasis);
  border-radius: 12px;
  position: relative;
}

.scroll-wheel {
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
  width: 4px;
  height: 8px;
  background: var(--color-text-secondary);
  border-radius: 2px;
  animation: scrollWheel 2s ease-in-out infinite;
}

@keyframes scrollBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(8px); }
}

@keyframes scrollWheel {
  0%, 100% { opacity: 1; transform: translateX(-50%) translateY(0); }
  50% { opacity: 0.3; transform: translateX(-50%) translateY(12px); }
}

/* ========== Filter Tabs ========== */
.portfolio-filter-section {
  padding: 4rem 0 6rem;
  background: var(--color-surface-base);
}

.filter-tabs-wrap {
  margin-bottom: 3rem;
}

.filter-tabs {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.filter-tabs::-webkit-scrollbar {
  display: none;
}

.filter-btn {
  padding: 0.75rem 1.5rem;
  background: transparent;
  border: 1px solid rgba(212, 175, 55, 0.3);
  color: var(--color-text-secondary);
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 0.95rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.filter-btn:hover {
  border-color: var(--color-brand-gold);
  color: var(--color-brand-gold);
}

.filter-btn.active {
  background: var(--color-brand-gold);
  border-color: var(--color-brand-gold);
  color: var(--color-text-on-accent);
  font-weight: 500;
}

.project-count {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-top: 1rem;
}

/* ========== Masonry Grid ========== */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 300px;
  gap: 20px;
  padding: 0 0 2rem;
}

.portfolio-item {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  background: var(--color-surface-secondary);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.portfolio-item.hidden {
  display: none !important;
}

.portfolio-item:nth-child(4n+1) {
  grid-row: span 2;
}

.portfolio-item:nth-child(3n+2):not(:nth-child(4n+1)) {
  grid-row: span 1;
}

.image-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.placeholder-blur {
  position: absolute;
  inset: 0;
  background: var(--color-surface-elevated);
  filter: blur(20px);
  opacity: 1;
  transition: opacity 0.3s;
}

.image-wrapper img.loaded + .placeholder-blur {
  opacity: 0;
}

.portfolio-item:hover .image-wrapper img {
  transform: scale(1.1);
}

.portfolio-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.3) 50%, transparent 100%);
  opacity: 0;
  transition: opacity 0.4s ease;
  display: flex;
  align-items: flex-end;
  padding: 2rem;
}

.portfolio-item:hover .portfolio-overlay {
  opacity: 1;
}

.overlay-content {
  transform: translateY(20px);
  transition: transform 0.4s ease;
}

.portfolio-item:hover .overlay-content {
  transform: translateY(0);
}

.category-badge {
  display: inline-block;
  background: var(--color-brand-gold);
  color: var(--color-text-on-accent);
  padding: 0.4rem 1rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.75rem;
}

.overlay-content h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #fff;
}

.overlay-content .meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.7);
  margin-bottom: 1rem;
}

.btn-view {
  background: transparent;
  border: 1px solid var(--color-brand-gold);
  color: var(--color-brand-gold);
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 14px;
}

.btn-view:hover {
  background: var(--color-brand-gold);
  color: var(--color-text-on-accent);
}

.quick-actions {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: 0.5rem;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease;
}

.portfolio-item:hover .quick-actions {
  opacity: 1;
  transform: translateY(0);
}

.action-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-input-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--color-border-emphasis);
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
}

.action-btn:hover {
  background: var(--color-brand-gold);
  border-color: var(--color-brand-gold);
  color: var(--color-text-on-accent);
}

.action-btn.favorite.active {
  background: var(--color-status-error);
  border-color: var(--color-status-error);
}

.portfolio-load-more-wrap {
  text-align: center;
  margin-top: 2rem;
}

.btn-outline-gold {
  background: transparent;
  border: 1px solid var(--color-brand-gold);
  color: var(--color-brand-gold);
  padding: 0.875rem 2rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-outline-gold:hover {
  background: var(--color-brand-gold);
  color: var(--color-text-on-accent);
}

/* ========== Lightbox ========== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.lightbox.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.lightbox-content {
  position: relative;
  width: 90%;
  max-width: 1200px;
  max-height: 90vh;
  background: var(--color-surface-base);
  border-radius: 24px;
  overflow: hidden;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.lightbox.active .lightbox-content {
  transform: scale(1);
}

.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-input-bg);
  border: 1px solid var(--color-border-emphasis);
  color: var(--color-text-primary);
  cursor: pointer;
  z-index: 10;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-close:hover {
  background: var(--color-brand-gold);
  border-color: var(--color-brand-gold);
  color: var(--color-text-on-accent);
}

.lightbox-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  height: 90vh;
}

.lightbox-media {
  background: var(--color-surface-base);
  position: relative;
}

.image-carousel {
  height: 100%;
  position: relative;
}

.image-carousel img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--color-input-bg);
  border: 1px solid var(--color-border-emphasis);
  color: var(--color-text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-nav:hover {
  background: var(--color-brand-gold);
  border-color: var(--color-brand-gold);
  color: var(--color-text-on-accent);
}

.carousel-nav.prev { left: 1rem; }
.carousel-nav.next { right: 1rem; }

.lightbox-details {
  padding: 3rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.detail-category {
  display: inline-block;
  background: rgba(212, 175, 55, 0.1);
  color: var(--color-brand-gold);
  padding: 0.5rem 1rem;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 500;
  width: fit-content;
}

.lightbox-details h2 {
  font-size: 2rem;
  font-weight: 600;
  margin: 0;
}

.detail-meta {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem;
  background: var(--color-input-bg);
  border-radius: 12px;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--color-text-tertiary);
}

.meta-item svg {
  color: var(--color-brand-gold);
  flex-shrink: 0;
}

.detail-services h4 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--color-text-muted);
}

.service-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.service-tags span {
  background: var(--color-input-bg);
  border: 1px solid var(--color-input-border);
  padding: 0.5rem 1rem;
  border-radius: 50px;
  font-size: 0.85rem;
  color: var(--color-text-tertiary);
}

.client-quote {
  border-left: 3px solid var(--color-brand-gold);
  padding-left: 1.5rem;
  font-style: italic;
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin: 0;
}

.client-quote cite {
  display: block;
  margin-top: 1rem;
  font-style: normal;
  color: var(--color-brand-gold);
  font-weight: 500;
}

.lightbox-cta {
  display: flex;
  gap: 1rem;
  margin-top: auto;
}

.btn-gold {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.875rem 1.5rem;
  background: var(--color-brand-gold);
  color: var(--color-text-on-accent);
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s;
}

.btn-gold:hover {
  background: var(--color-brand-gold);
  filter: brightness(1.1);
  color: var(--color-text-on-accent);
}

.lightbox-cta .btn-outline {
  background: transparent;
  border: 1px solid var(--color-border-emphasis);
  color: var(--color-text-primary);
  padding: 0.875rem 1.5rem;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
}

.lightbox-cta .btn-outline:hover {
  border-color: var(--color-brand-gold);
  color: var(--color-brand-gold);
}

/* ========== Featured Case Study ========== */
.portfolio-featured {
  padding: 6rem 0;
  background: var(--gradient-section);
}

.featured-grid {
  display: grid;
  grid-template-columns: 60% 40%;
  gap: 4rem;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
}

.featured-media {
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}

.featured-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.featured-label {
  color: var(--color-brand-gold);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 0.75rem;
}

.featured-title {
  font-family: var(--font-heading);
  font-size: clamp(28px, 3vw, 36px);
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: 1rem;
}

.featured-desc {
  color: var(--color-text-tertiary);
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.featured-story h4 {
  font-size: 1rem;
  color: var(--color-brand-gold);
  margin: 1rem 0 0.5rem;
}

.featured-story p {
  color: var(--color-text-secondary);
  font-size: 0.95rem;
  margin: 0;
}

.featured-quote {
  margin: 2rem 0;
  padding-left: 1.5rem;
  border-left: 3px solid var(--color-brand-gold);
  font-style: italic;
  color: var(--color-text-secondary);
}

.featured-quote cite {
  display: block;
  margin-top: 0.75rem;
  font-style: normal;
  color: var(--color-brand-gold);
}

/* ========== Video Testimonials ========== */
.portfolio-video-testimonials {
  padding: 4rem 0;
  background: var(--color-surface-base);
}

.portfolio-video-testimonials .section-title {
  text-align: center;
  font-size: clamp(28px, 3vw, 36px);
  margin-bottom: 2rem;
}

.video-testimonials-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.video-thumb {
  aspect-ratio: 16/9;
  border-radius: 12px;
  overflow: hidden;
  background: var(--color-surface-elevated);
  cursor: pointer;
  position: relative;
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.video-thumb:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}

.video-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: var(--color-surface-elevated);
}

.play-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(212,175,55,0.2);
  border: 2px solid var(--color-brand-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-brand-gold);
  font-size: 20px;
  padding-left: 4px;
}

.video-label {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
}

/* ========== Instagram ========== */
.portfolio-instagram {
  padding: 5rem 0;
  background: var(--gradient-section);
  position: relative;
  overflow: hidden;
}

.portfolio-instagram::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 50% at 50% 50%, rgba(212,175,55,0.03) 0%, transparent 70%);
  pointer-events: none;
}

.instagram-header {
  text-align: center;
  margin-bottom: 2.5rem;
  position: relative;
}

.instagram-divider {
  display: block;
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--color-brand-gold), transparent);
  margin: 0 auto 1.5rem;
  border-radius: 2px;
}

.portfolio-instagram .section-title {
  font-size: clamp(28px, 3vw, 36px);
  margin-bottom: 0.5rem;
}

.instagram-subtitle {
  color: var(--color-text-muted);
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.instagram-handle {
  display: inline-block;
  color: var(--color-brand-gold);
  font-weight: 600;
  font-size: 1.1rem;
  text-decoration: none;
  letter-spacing: 0.5px;
  transition: color 0.3s, text-shadow 0.3s;
}

.instagram-handle:hover {
  color: var(--color-brand-gold);
  filter: brightness(1.2);
  text-shadow: 0 0 20px rgba(212,175,55,0.4);
}

.instagram-feed {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.instagram-embed-wrap {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border-subtle);
  transition: all 0.3s ease;
}

.instagram-embed-wrap:hover {
  border-color: rgba(212,175,55,0.25);
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}

.instagram-embed {
  width: 100%;
  min-height: 360px;
  border: 0;
  display: block;
}

.instagram-cta-wrap {
  text-align: center;
  width: 100%;
}

.instagram-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0 auto;
  padding: 1rem 2rem;
  background: var(--gradient-gold);
  color: var(--color-text-on-accent);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  border-radius: 50px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(212,175,55,0.3);
}

.instagram-cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(212,175,55,0.45);
  color: var(--color-text-on-accent);
}

/* ========== CTA Section ========== */
.portfolio-cta-section {
  padding: 6rem 0;
  background: var(--gradient-section);
  text-align: center;
}

.cta-title {
  font-family: var(--font-heading);
  font-size: clamp(28px, 3.5vw, 40px);
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: 2rem;
}

.cta-steps {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 3rem;
}

.cta-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.step-num {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(212,175,55,0.2);
  border: 2px solid var(--color-brand-gold);
  color: var(--color-brand-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.25rem;
}

.step-text {
  font-size: 0.95rem;
  color: var(--color-text-tertiary);
}

.portfolio-cta-form {
  max-width: 560px;
  margin: 0 auto;
}

.portfolio-cta-form .form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.portfolio-cta-form input,
.portfolio-cta-form select {
  flex: 1;
  min-width: 140px;
  padding: 1rem 1.25rem;
  background: var(--color-input-bg);
  border: 1px solid var(--color-input-border);
  border-radius: 8px;
  color: var(--color-text-primary);
  font-size: 1rem;
}

.portfolio-cta-form input::placeholder {
  color: var(--color-input-placeholder);
}

.portfolio-cta-form select {
  cursor: pointer;
}

/* Custom select (dark dropdown) - keeps options readable on portfolio CTA */
.portfolio-cta-form .custom-select-wrap {
  flex: 1;
  min-width: 140px;
}
.portfolio-cta-form .custom-select-trigger {
  background: var(--color-input-bg);
  border-color: var(--color-input-border);
  padding: 1rem 1.25rem;
  padding-right: 2.75rem;
}
.portfolio-cta-form .custom-select-wrap.open .custom-select-trigger {
  border-color: rgba(212,175,55,0.6);
  box-shadow: 0 0 0 3px rgba(212,175,55,0.15);
}

.portfolio-cta-form .btn-cta {
  width: 100%;
  padding: 1rem 2rem;
  margin-bottom: 1rem;
}

.cta-trust {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* ========== Responsive ========== */
@media (max-width: 1024px) {
  .portfolio-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .portfolio-item:nth-child(n) {
    grid-row: span 1;
  }

  .featured-grid {
    grid-template-columns: 1fr;
  }

  .featured-media {
    order: -1;
  }

  .lightbox-grid {
    grid-template-columns: 1fr;
    grid-template-rows: 50vh auto;
  }

  .video-testimonials-grid {
    grid-template-columns: 1fr;
  }

  .instagram-feed {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .instagram-embed {
    min-height: 320px;
  }
}

@media (max-width: 640px) {
  .portfolio-hero-cinematic {
    min-height: 70vh;
  }

  .portfolio-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: 320px;
    gap: 16px;
  }

  .portfolio-item:nth-child(n) {
    grid-row: span 1;
  }

  .filter-tabs {
    justify-content: flex-start;
    padding-bottom: 0.5rem;
  }

  .lightbox-details {
    padding: 2rem;
  }

  .lightbox-details h2 {
    font-size: 1.5rem;
  }

  .cta-steps {
    flex-direction: column;
  }

  .instagram-feed {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .instagram-embed {
    min-height: 400px;
  }

  .portfolio-instagram {
    padding: 3rem 0;
  }
}
