/* =============================================================================
   PORTFOLIO.CSS — CR8TIF Portfolio / Work Page
   Filter bar, masonry grid, hover overlays, lightbox
   ============================================================================= */

/* ---------------------------------------------------------------------------
   Filter Bar — Sticky, Copper Active State
   --------------------------------------------------------------------------- */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.25rem var(--side-pad);
  position: sticky;
  /* Header is fixed: ~74px default, ~59px when scrolled.
     Use 60px to align with the scrolled header height. */
  top: 60px;
  z-index: 30;
  background: var(--bg-light);
  border-bottom: 1px solid var(--border-dark);
  margin-bottom: clamp(2.5rem, 4vw, 4rem);
}

/* Blur fade at edges for horizontal scroll on mobile */
.filter-bar::before,
.filter-bar::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2rem;
  pointer-events: none;
  z-index: 1;
}

.filter-bar::before {
  left: 0;
  background: linear-gradient(to right, var(--bg-light), transparent);
}

.filter-bar::after {
  right: 0;
  background: linear-gradient(to left, var(--bg-light), transparent);
}

.filter-bar__inner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Filter buttons — matches HTML class .filter-btn */
.filter-btn {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dark-muted);
  background: none;
  border: none;
  padding: 0.6rem 1.25rem;
  cursor: pointer;
  position: relative;
  transition: color 0.3s ease;
}

.filter-btn::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 1px;
  background: var(--gold);
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1), left 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.filter-btn:hover {
  color: var(--text-dark);
}

.filter-btn:hover::after {
  width: 60%;
  left: 20%;
}

/* Active filter */
.filter-btn.is-active {
  color: var(--gold);
}

.filter-btn.is-active::after {
  width: 100%;
  left: 0;
}

/* ---------------------------------------------------------------------------
   Portfolio Section
   --------------------------------------------------------------------------- */
.portfolio {
  padding: var(--section-pad) 0;
}

/* ---------------------------------------------------------------------------
   Portfolio Grid — Masonry with CSS Grid
   --------------------------------------------------------------------------- */
.portfolio__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(0.75rem, 1.2vw, 1.25rem);
  max-width: var(--max-w);
  margin: 0 auto;
}

/* Wide items span 2 columns */
.portfolio-item--wide {
  grid-column: span 2;
}

/* ---------------------------------------------------------------------------
   Portfolio Item — Image + Hover Overlay
   --------------------------------------------------------------------------- */
.portfolio-item {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  border-radius: 8px;
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease, border-color 0.4s ease;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.06);
  border: 1px solid transparent;
}

.portfolio-item:hover {
  box-shadow: 0 16px 60px rgba(0, 0, 0, 0.1);
  transform: translateY(-4px);
  border-color: var(--gold-dim);
}

.portfolio-item__image {
  width: 100%;
  position: relative;
}

.portfolio-item__image img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.portfolio-item:hover .portfolio-item__image img {
  transform: scale(1.05);
}

/* Gradient overlay — always visible at bottom for text */
.portfolio-item__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(44, 40, 36, 0.75) 0%,
    rgba(44, 40, 36, 0.2) 35%,
    transparent 60%
  );
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: clamp(1.25rem, 2.5vw, 2rem);
  opacity: 1;
  transition: background 0.4s ease;
}

.portfolio-item:hover .portfolio-item__overlay {
  background: linear-gradient(
    to top,
    rgba(44, 40, 36, 0.85) 0%,
    rgba(44, 40, 36, 0.4) 40%,
    rgba(44, 40, 36, 0.15) 70%
  );
}

/* Collection name — always visible, force white on any bg */
.portfolio-item .portfolio-item__category {
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.4rem;
}

.portfolio-item .portfolio-item__title {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 1.6vw, 1.5rem);
  font-weight: 500;
  color: #fff;
  line-height: 1.2;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

.portfolio-item__cta {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--gold);
  margin-top: 0.75rem;
  transform: translateY(10px);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.2s,
              opacity 0.4s ease 0.2s;
}

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

/* Gold accent line at bottom of item */
.portfolio-item::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gold);
  transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 2;
}

.portfolio-item:hover::after {
  width: 100%;
}

/* ---------------------------------------------------------------------------
   Filter Transitions — Smooth show/hide
   --------------------------------------------------------------------------- */
.portfolio-item.is-hidden {
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
  position: absolute;
  visibility: hidden;
}

.portfolio-item.is-visible {
  opacity: 1;
  transform: scale(1);
}

/* ---------------------------------------------------------------------------
   Flexibility CTA Section
   --------------------------------------------------------------------------- */
.flexibility {
  padding: var(--section-pad) 0;
}

.flexibility__inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(4rem, 8vw, 8rem);
  align-items: center;
}

.flexibility__content {
  /* Content wrapper within flexibility section */
}

.flexibility__title {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 3.2vw, 3rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.1;
  color: var(--text-dark);
  margin-bottom: 1.75rem;
}

.flexibility__text {
  font-size: 0.95rem;
  line-height: 1.85;
  color: var(--text-dark-muted);
  margin-bottom: 2rem;
}

.flexibility__image {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.06);
  border-radius: 4px;
}

.flexibility__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.flexibility__image:hover img {
  transform: scale(1.03);
}

/* ---------------------------------------------------------------------------
   Lightbox — Fullscreen Image Overlay
   --------------------------------------------------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(44, 40, 36, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

/* Lightbox content container */
.lightbox__content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(0.95);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.lightbox.is-open .lightbox__content {
  transform: scale(1);
}

.lightbox__image {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.4);
}

/* Close button */
.lightbox__close {
  position: absolute;
  top: 2rem;
  right: 2rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border-light);
  color: var(--text);
  cursor: pointer;
  transition: background 0.3s ease, border-color 0.3s ease;
  z-index: 201;
}

.lightbox__close:hover {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--bg-dark);
}

.lightbox__close svg {
  width: 20px;
  height: 20px;
}

/* Navigation arrows */
.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border-light);
  color: var(--text);
  cursor: pointer;
  transition: background 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

.lightbox__nav:hover {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--bg-dark);
}

.lightbox__nav svg {
  width: 20px;
  height: 20px;
}

.lightbox__nav--prev {
  left: 2rem;
}

.lightbox__nav--prev:hover {
  transform: translateY(-50%) translateX(-3px);
}

.lightbox__nav--next {
  right: 2rem;
}

.lightbox__nav--next:hover {
  transform: translateY(-50%) translateX(3px);
}

/* Lightbox caption */
.lightbox__caption {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

.lightbox__caption-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.lightbox__caption-category {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold);
}

/* Lightbox counter */
.lightbox__counter {
  position: absolute;
  top: 2rem;
  left: 2rem;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  z-index: 201;
}

.lightbox__counter-current {
  color: var(--text);
}

/* ---------------------------------------------------------------------------
   Empty State — No results for filter
   --------------------------------------------------------------------------- */
.portfolio__empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: clamp(4rem, 8vh, 6rem) 2rem;
}

.portfolio__empty p {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-dark-muted);
  margin-bottom: 1.5rem;
}

.portfolio__empty-btn {
  font-size: 0.78rem;
  color: var(--gold);
  cursor: pointer;
  background: none;
  border: none;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.3s ease;
}

.portfolio__empty-btn:hover {
  color: #D4B275;
}

/* ---------------------------------------------------------------------------
   Responsive Overrides for Portfolio
   --------------------------------------------------------------------------- */
@media (max-width: 1200px) {
  .portfolio__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .portfolio-item--wide {
    grid-column: span 1;
  }

  .flexibility__inner {
    grid-template-columns: 1fr;
    gap: 3rem;
  }
}

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

  .portfolio-item--wide,
  .portfolio-item--tall {
    grid-column: span 1;
    grid-row: span 1;
  }

  .filter-bar {
    top: 50px;
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 1rem var(--side-pad);
  }

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

  .filter-btn {
    flex-shrink: 0;
    white-space: nowrap;
  }

  /* Show overlay by default on mobile (no hover) */
  .portfolio-item__overlay {
    opacity: 1;
    background: linear-gradient(
      to top,
      rgba(44, 40, 36, 0.8) 0%,
      transparent 50%
    );
  }

  .portfolio-item__category,
  .portfolio-item__title,
  .portfolio-item__cta {
    transform: translateY(0);
    opacity: 1;
  }

  .lightbox__nav {
    display: none;
  }

  .lightbox__close {
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
  }

  .lightbox__content {
    width: 95vw;
  }
}

@media (max-width: 480px) {
  .portfolio__grid {
    gap: 0.5rem;
  }

  .filter-btn {
    font-size: 0.65rem;
    padding: 0.5rem 1rem;
  }
}
