/* ============================================
   PORTFOLIO — unified component
   Used on: index.html, service LP pages
   ============================================ */

/* --- SECTION --- */
.pf {
  padding: 100px 0;
  background: var(--c-white);
}

.pf--gray {
  background: var(--c-gray-100);
}

/* --- FILTERS --- */
.pf__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 32px;
  margin-bottom: 40px;
}

.pf__filter {
  padding: 8px 20px;
  background: transparent;
  border: 1px solid rgba(15, 23, 42, 0.15);
  border-radius: 100px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--c-dark);
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.pf__filter:hover {
  border-color: var(--c-primary);
  color: var(--c-primary);
}

.pf__filter.is-active {
  background: var(--c-primary);
  border-color: var(--c-primary);
  color: var(--c-white);
}

/* --- GRID --- */
.pf__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 32px;
}

/* --- CARD --- */
.pf__card {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: var(--c-gray-100);
  transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.3s ease;
  cursor: pointer;
}

.pf--gray .pf__card {
  background: var(--c-white);
}

.pf__card[hidden] {
  display: none;
}

/* --- MOCKUP VARIANT --- card with transparent PNG protruding above box */
.pf__card--mockup {
  overflow: visible;
  background: transparent;
  border-radius: 0;
}

.pf__card--mockup::before {
  content: '';
  position: absolute;
  top: 40%;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--c-gray-100);
  border-radius: 16px;
  z-index: 0;
  transition: box-shadow 0.25s ease;
}

.pf--gray .pf__card--mockup {
  background: transparent;
}

.pf--gray .pf__card--mockup::before {
  background: var(--c-white);
}

/* Dot → line indicator */
.pf__card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 3px;
  background: var(--c-primary);
  border-radius: 2px;
  transition: width 0.3s ease;
  z-index: 1;
}

.pf__card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
}

/* Mockup: shadow on ::before instead of card */
.pf__card--mockup:hover {
  box-shadow: none;
}

.pf__card--mockup:hover::before {
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
}

.pf__card:hover::after {
  width: 60px;
}

/* Image wrapper — default (inside box) */
.pf__img-wrap {
  position: relative;
  z-index: 1;
  overflow: hidden;
  border-radius: 12px 12px 0 0;
  height: 240px;
}

.pf__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

/* Image wrapper — mockup (protruding above box) */
.pf__card--mockup .pf__img-wrap {
  overflow: visible;
  border-radius: 0;
  margin: 0 24px;
  height: 300px;
}

.pf__card--mockup .pf__img {
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 8px 24px rgba(15, 23, 42, 0.12));
}

.pf__card:hover .pf__img {
  transform: scale(1.05);
}

/* Card info */
.pf__info {
  position: relative;
  z-index: 1;
  padding: 20px 24px 24px;
}

.pf__tag {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--c-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
  display: block;
}

.pf__name {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--c-dark);
  margin-bottom: 6px;
}

.pf__desc {
  font-size: 0.85rem;
  color: var(--c-gray-500);
  line-height: 1.5;
}

/* --- MODAL --- */
.pf-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--ease-out), visibility 0.3s;
  overflow-y: auto;
}

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

.pf-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 48px;
  height: 48px;
  background: var(--c-dark);
  color: var(--c-white);
  font-size: 1.8rem;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.3s;
  border: none;
  cursor: pointer;
}

.pf-modal__close:hover {
  background: var(--c-primary);
}

.pf-modal__body {
  position: relative;
  height: 80vh;
  aspect-ratio: 16/9;
  max-width: 95vw;
  overflow: hidden;
  background: var(--c-gray-100);
}

.pf-modal__right {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
}

.pf-modal__right img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: right center;
}

.pf-modal__left {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 60px 64px;
  width: 45%;
  height: 100%;
  gap: 20px;
}

.pf-modal__tag {
  display: inline-block;
  padding: 6px 16px;
  background: rgba(0, 0, 0, 0.6);
  color: var(--c-white);
  backdrop-filter: blur(8px);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  align-self: flex-start;
}

.pf-modal__title {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  color: var(--c-dark);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.pf-modal__desc {
  color: var(--c-dark);
  font-size: 1.05rem;
  line-height: 1.8;
  max-width: 520px;
}

/* --- FOCUS / A11Y --- */
.pf__card:focus-visible {
  outline: 2px solid var(--c-primary);
  outline-offset: 4px;
  border-radius: 16px;
}

.pf__card:focus-visible::before {
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
}

.pf-modal__close:focus-visible {
  outline: 2px solid var(--c-primary);
  outline-offset: 2px;
}

/* --- HIGH CONTRAST --- */
body.a11y-high-contrast .pf__desc {
  color: var(--c-dark);
}

body.a11y-high-contrast .pf__card::before {
  border: 1px solid var(--c-dark);
}

body.a11y-high-contrast .pf-modal__close {
  border: 1px solid var(--c-white);
}

/* --- REDUCED MOTION --- */
@media (prefers-reduced-motion: reduce) {
  .pf__card,
  .pf__card::before,
  .pf__card::after,
  .pf__img,
  .pf-modal,
  .pf-modal__body {
    transition: none !important;
  }

  .pf__card:hover .pf__img {
    transform: none;
  }
}

/* --- RESPONSIVE --- */
@media (max-width: 1024px) {
  .pf__grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
  }
}

@media (max-width: 768px) {
  .pf {
    padding: 64px 0;
  }

  .pf__grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .pf__filters {
    gap: 6px;
    margin-top: 24px;
    margin-bottom: 28px;
  }

  .pf__filter {
    padding: 6px 14px;
    font-size: 0.72rem;
  }

  .pf-modal__body {
    width: 95vw;
    height: 75vh;
    aspect-ratio: auto;
    display: flex;
    flex-direction: column;
  }

  .pf-modal__right {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    width: 100%;
    flex: 1;
    min-height: 0;
    order: 2;
  }

  .pf-modal__right img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: right bottom;
  }

  .pf-modal__left {
    position: relative;
    width: 100%;
    height: auto;
    padding: 24px 20px 16px;
    flex-shrink: 0;
    order: 1;
    justify-content: flex-start;
  }

  .pf-modal__title {
    font-size: 1.4rem;
  }

  .pf-modal__desc {
    font-size: 0.9rem;
    line-height: 1.6;
  }

  .pf-modal__close {
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
  }
}
