/*
 * WCCM Portfolio Archive, archive-wccm_portfolio.php
 * Premium portfolio gallery with client-side category filtering.
 * All classes prefixed with pf- (portfolio)
 * ─────────────────────────────────────────────────────────────────────────────
 */

/* ══════════════════════════════════════════════════════════════════════════
   HERO
══════════════════════════════════════════════════════════════════════════ */

.pf-hero {
  position: relative;
  min-height: clamp(480px, 60vh, 680px);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

/* Background photo (when available from first portfolio item) */
.pf-hero__photo {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 35%;
  background-color: var(--color-navy-dark);
}

/* Overlay, dark gradient for legibility */
.pf-hero__overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg,
      rgba(6, 21, 36, 0.92) 0%,
      rgba(6, 21, 36, 0.70) 45%,
      rgba(6, 21, 36, 0.25) 80%,
      rgba(6, 21, 36, 0.10) 100%
    ),
    linear-gradient(to top,
      rgba(6, 21, 36, 0.65) 0%,
      transparent 55%
    );
}

/* Fallback when no photo: rich CSS gradient */
.pf-hero:not(:has(.pf-hero__photo)) .pf-hero__overlay {
  background:
    radial-gradient(ellipse at 15% 50%, rgba(26, 122, 114, 0.35) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 20%, rgba(232, 98, 42, 0.15) 0%, transparent 50%),
    linear-gradient(160deg, var(--color-navy) 0%, var(--color-navy-dark) 100%);
}

/* Content */
.pf-hero__body {
  position: relative;
  z-index: 1;
  padding-bottom: clamp(var(--space-12), 8vw, var(--space-20));
  padding-top: var(--space-20);
  max-width: 700px;
}

.pf-hero__eyebrow {
  color: var(--color-teal-light);
  margin-bottom: var(--space-4);
}

.pf-hero__heading {
  font-family: var(--font-heading);
  font-size: clamp(var(--text-4xl), 6vw, var(--text-6xl));
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-white);
  margin: 0 0 var(--space-5);
}

.pf-hero__sub {
  font-size: clamp(var(--text-base), 2vw, var(--text-lg));
  line-height: var(--leading-relaxed);
  color: rgba(255, 255, 255, 0.80);
  max-width: 52ch;
  margin: 0 0 var(--space-8);
}

.pf-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* Outline light button (shared with landing page, declared here for self-containment) */
.pf-page .btn--outline-light {
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.55);
  color: var(--color-white);
}
.pf-page .btn--outline-light:hover,
.pf-page .btn--outline-light:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.85);
  color: var(--color-white);
}

/* ══════════════════════════════════════════════════════════════════════════
   PORTFOLIO ARCHIVE SECTION
══════════════════════════════════════════════════════════════════════════ */

.pf-archive {
  background-color: var(--color-white);
}

/* ── Filter bar ──────────────────────────────────────────────────────────── */
.pf-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-10);
  padding-bottom: var(--space-8);
  border-bottom: 1px solid var(--color-border);
}

.pf-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-full);
  border: 1.5px solid var(--color-border);
  background: var(--color-white);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-gray-600);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  white-space: nowrap;
  line-height: 1;
}

.pf-filter-btn:hover {
  border-color: var(--color-teal);
  color: var(--color-teal);
  background: rgba(26, 122, 114, 0.05);
}

.pf-filter-btn.is-active {
  background: var(--color-navy);
  border-color: var(--color-navy);
  color: var(--color-white);
}

.pf-filter-btn.is-active .pf-filter-btn__count {
  background: rgba(255, 255, 255, 0.20);
  color: rgba(255, 255, 255, 0.85);
}

.pf-filter-btn__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: var(--radius-full);
  background: var(--color-gray-100);
  font-size: 10px;
  font-weight: var(--weight-semibold);
  color: var(--color-gray-500);
  transition: background var(--duration-fast), color var(--duration-fast);
}

/* ── Portfolio grid ──────────────────────────────────────────────────────── */
.pf-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-8);
}

/* Centred pair layout for exactly 2 items */
.pf-grid--pair {
  grid-template-columns: repeat(2, minmax(0, 560px));
  justify-content: center;
  gap: var(--space-8);
}

/* ── Portfolio card ──────────────────────────────────────────────────────── */
.pf-card {
  background: var(--color-white);
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform var(--duration-base) var(--ease-out),
              box-shadow var(--duration-base) var(--ease-out),
              opacity 0.3s ease,
              scale 0.3s ease;
}

.pf-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-xl);
}

/* Hidden state, set by JS filter */
.pf-card--hidden {
  display: none;
}

/* Entry animation when cards become visible */
.pf-card {
  animation: pf-card-in 0.3s ease both;
}

@keyframes pf-card-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Card image link */
.pf-card__img-link {
  display: block;
  text-decoration: none;
  flex-shrink: 0;
}

/* Card thumbnail */
.pf-card__thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  background-size: cover;
  background-position: center;
  background-color: var(--color-navy-light);
  overflow: hidden;
  transition: transform var(--duration-slow) var(--ease-out);
}

.pf-card:hover .pf-card__thumb {
  transform: scale(1.04);
}

/* Empty placeholder background */
.pf-card__thumb--empty {
  background-image:
    radial-gradient(ellipse at 30% 40%, rgba(26, 122, 114, 0.35) 0%, transparent 60%),
    linear-gradient(160deg, var(--color-navy-light) 0%, var(--color-navy-dark) 100%);
}

/* Dark gradient overlay */
.pf-card__thumb-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 45%,
    rgba(6, 15, 26, 0.35) 100%
  );
  transition: opacity var(--duration-base);
}
.pf-card:hover .pf-card__thumb-overlay {
  opacity: 0.6;
}

/* Category badge overlaid on image */
.pf-card__thumb-cat {
  position: absolute;
  top: var(--space-4);
  left: var(--space-4);
  display: inline-block;
  padding: 3px var(--space-3);
  border-radius: var(--radius-full);
  background: rgba(6, 15, 26, 0.65);
  backdrop-filter: blur(4px);
  font-size: 10px;
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--color-white);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Card body */
.pf-card__body {
  padding: var(--space-5) var(--space-6) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  flex: 1;
}

/* Title */
.pf-card__title {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
  color: var(--color-navy);
  margin: 0;
}

.pf-card__title a {
  color: inherit;
  text-decoration: none;
  transition: color var(--duration-fast);
}
.pf-card__title a:hover {
  color: var(--color-teal);
}

/* Location */
.pf-card__location {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  color: var(--color-gray-500);
  margin: 0;
}

.pf-card__location::before {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23adb5bd' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z'/%3E%3Ccircle cx='12' cy='10' r='3'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  flex-shrink: 0;
}

/* Service tags */
.pf-card__services {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: auto;
  padding-top: var(--space-1);
}

.pf-card__service-tag {
  display: inline-block;
  padding: 3px var(--space-3);
  border-radius: var(--radius-full);
  background: var(--color-gray-100);
  border: 1px solid var(--color-border);
  font-size: 11px;
  font-weight: var(--weight-medium);
  color: var(--color-gray-700);
  white-space: nowrap;
}

/* View Project CTA */
.pf-card__cta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-teal);
  text-decoration: none;
  margin-top: var(--space-2);
  transition: gap var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out);
}
.pf-card__cta:hover {
  color: var(--color-teal-dark);
  gap: var(--space-3);
}

/* ── Empty state ─────────────────────────────────────────────────────────── */
.pf-empty {
  text-align: center;
  padding: var(--space-16) var(--space-8);
  color: var(--color-gray-500);
}

.pf-empty p {
  font-size: var(--text-base);
  margin-bottom: var(--space-6);
}

/* ══════════════════════════════════════════════════════════════════════════
   FINAL CTA
══════════════════════════════════════════════════════════════════════════ */

.pf-cta {
  position: relative;
  overflow: hidden;
  padding-block: clamp(var(--space-16), 10vw, var(--space-24));
}

.pf-cta__bg {
  position: absolute;
  inset: 0;
}

.pf-cta__overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(26, 122, 114, 0.45) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 30%, rgba(232, 98, 42, 0.20) 0%, transparent 50%),
    linear-gradient(160deg, var(--color-navy) 0%, var(--color-navy-dark) 100%);
}

.pf-cta__body {
  position: relative;
  z-index: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
}

.pf-cta__eyebrow {
  color: var(--color-teal-light);
}

.pf-cta__heading {
  font-family: var(--font-heading);
  font-size: clamp(var(--text-3xl), 5vw, var(--text-5xl));
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-white);
  margin: 0;
  max-width: 22ch;
}

.pf-cta__sub {
  font-size: var(--text-lg);
  color: rgba(255, 255, 255, 0.75);
  max-width: 50ch;
  margin: 0;
  line-height: var(--leading-relaxed);
}

.pf-cta__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: center;
  margin-top: var(--space-2);
}

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 1100px) {
  .pf-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 960px) {
  .pf-grid--pair {
    grid-template-columns: repeat(2, 1fr);
    max-width: none;
    justify-content: stretch;
  }
}

@media (max-width: 720px) {
  .pf-hero__heading {
    font-size: clamp(var(--text-3xl), 8vw, var(--text-4xl));
  }

  .pf-filters {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: var(--space-3);
    scrollbar-width: none;
    -ms-overflow-style: none;
    gap: var(--space-2);
  }

  .pf-filters::-webkit-scrollbar { display: none; }

  .pf-grid,
  .pf-grid--pair {
    grid-template-columns: 1fr;
    max-width: 520px;
    margin-inline: auto;
  }
}

@media (max-width: 480px) {
  .pf-hero__actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .pf-cta__actions {
    flex-direction: column;
    align-items: center;
    width: 100%;
  }

  .pf-cta__actions .btn {
    width: 100%;
    justify-content: center;
  }
}
