/* ═══════════════════════════════════════════════════════════════════════════
   S3 Gfx — Professional Portfolio Modal
   Design: Dark glass, cinematic split-panel
   ─────────────────────────────────────────────────────────────────────────
   Variables, base reset, grid, media, details, gallery, lightbox
═══════════════════════════════════════════════════════════════════════════ */

/* ── CSS Variables ───────────────────────────────────────────────────────── */
:root {
  --pf-purple:   #8b5cf6;
  --pf-cyan:     #06b6d4;
  --pf-pink:     #ec4899;
  --pf-glass:    rgba(15, 15, 26, 0.96);
  --pf-glass-lt: rgba(255, 255, 255, 0.06);
  --pf-border:   rgba(255, 255, 255, 0.10);
  --pf-radius:   1.25rem;
  --pf-speed:    0.35s;
}

/* ── Body lock ───────────────────────────────────────────────────────────── */
.pf-no-scroll { overflow: hidden; }

/* ══════════════════════════════
   CARD ENHANCEMENTS
══════════════════════════════ */
.pf-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #fff;
}
.pf-badge--red    { background: rgba(239,68,68,.85); }
.pf-badge--blue   { background: rgba(59,130,246,.85); }
.pf-badge--purple { background: rgba(139,92,246,.80); }

.pf-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.35);
  transition: background var(--pf-speed);
}
.portfolio-card:hover .pf-play-overlay {
  background: rgba(0,0,0,.50);
}
.pf-play-btn {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: rgba(239,68,68,.9);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.1rem;
  padding-left: 4px;
  transition: transform .3s ease, box-shadow .3s;
  box-shadow: 0 0 0 8px rgba(239,68,68,.25);
}
.pf-play-btn--blue { background: rgba(59,130,246,.9); box-shadow: 0 0 0 8px rgba(59,130,246,.25); }
.portfolio-card:hover .pf-play-btn { transform: scale(1.12); box-shadow: 0 0 0 14px rgba(239,68,68,.2); }

.pf-card-hover-info {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 1.25rem;
  background: linear-gradient(to top, rgba(0,0,0,.92) 0%, rgba(0,0,0,.5) 60%, transparent 100%);
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(.25,.46,.45,.94);
}
.portfolio-card:hover .pf-card-hover-info { transform: translateY(0); }

.pf-view-btn {
  display: inline-flex;
  align-items: center;
  margin-top: .5rem;
  font-size: .75rem;
  font-weight: 600;
  color: var(--pf-purple);
  letter-spacing: .05em;
  text-transform: uppercase;
}

/* ══════════════════════════════
   MODAL OVERLAY
══════════════════════════════ */
.pf-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  pointer-events: none;
  visibility: hidden;
}

.pf-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  transition: opacity var(--pf-speed) ease;
}

.pf-modal--open {
  pointer-events: all;
  visibility: visible;
}
.pf-modal--open .pf-backdrop {
  opacity: 1;
}

/* ══════════════════════════════
   MODAL PANEL
══════════════════════════════ */
.pf-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1080px;
  max-height: 92vh;
  background: var(--pf-glass);
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius);
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(139,92,246,.15),
    0 40px 80px rgba(0,0,0,.7),
    0 0 120px rgba(139,92,246,.06);

  /* Entrance animation */
  transform: scale(.94) translateY(16px);
  opacity: 0;
  transition:
    transform var(--pf-speed) cubic-bezier(.25,.46,.45,.94),
    opacity   var(--pf-speed) ease;
}

.pf-modal--open .pf-panel {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* ── Close Button ──────────────────────────────────────────────────────── */
.pf-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 20;
  width: 2.25rem; height: 2.25rem;
  border-radius: 50%;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.15);
  color: rgba(255,255,255,.85);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: .95rem;
  transition: background .2s, transform .2s, color .2s;
  backdrop-filter: blur(8px);
}
.pf-close:hover {
  background: rgba(239,68,68,.8);
  border-color: transparent;
  color: #fff;
  transform: rotate(90deg);
}
.pf-close:focus-visible {
  outline: 2px solid var(--pf-purple);
  outline-offset: 3px;
}

/* ══════════════════════════════
   LEFT COLUMN — MEDIA
══════════════════════════════ */
.pf-media-col {
  position: relative;
  background: #000;
  overflow: hidden;
  min-height: 320px;
}

/* Subtle accent glow at edge */
.pf-media-col::after {
  content: '';
  position: absolute;
  inset-y: 0; right: 0;
  width: 1px;
  background: linear-gradient(180deg,
    transparent,
    rgba(139,92,246,.4) 30%,
    rgba(6,182,212,.4) 70%,
    transparent
  );
}

.pf-media-wrap { width: 100%; height: 100%; }

/* Placeholder / Spinner */
.pf-media-placeholder {
  width: 100%; height: 100%;
  min-height: 380px;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(139,92,246,.08), transparent 70%);
}

.pf-spinner {
  width: 3rem; height: 3rem;
  border: 3px solid rgba(139,92,246,.2);
  border-top-color: var(--pf-purple);
  border-radius: 50%;
  animation: pfSpin .9s linear infinite;
}
@keyframes pfSpin { to { transform: rotate(360deg); } }

/* Image */
.pf-img-wrap {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  background: #000;
}
.pf-main-img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
  transition: transform 6s ease;
}
.pf-modal--open .pf-main-img { transform: scale(1.02); }

/* Video */
.pf-video-wrap {
  position: relative;
  width: 100%; height: 100%;
  min-height: 380px;
}
.pf-video-wrap iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: none;
}

/* ══════════════════════════════
   RIGHT COLUMN — DETAILS
══════════════════════════════ */
.pf-detail-col {
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(139,92,246,.3) transparent;
  max-height: 92vh;
}
.pf-detail-col::-webkit-scrollbar { width: 4px; }
.pf-detail-col::-webkit-scrollbar-track { background: transparent; }
.pf-detail-col::-webkit-scrollbar-thumb { background: rgba(139,92,246,.3); border-radius: 2px; }
.pf-detail-col::-webkit-scrollbar-thumb:hover { background: rgba(139,92,246,.6); }

/* ── Skeleton ─────────────────────────────────────────────────────────── */
.pf-skeleton-wrap { padding: 2rem 1.75rem; }
.pf-skeleton-bar {
  background: linear-gradient(90deg,
    rgba(255,255,255,.05) 0%,
    rgba(255,255,255,.10) 50%,
    rgba(255,255,255,.05) 100%
  );
  background-size: 200% 100%;
  animation: pfShimmer 1.4s infinite;
  border-radius: 6px;
}
@keyframes pfShimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ── Details Content ──────────────────────────────────────────────────── */
.pf-details { padding: 2rem 1.75rem 2.5rem; animation: pfFadeUp .4s ease; }
@keyframes pfFadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.hidden { display: none !important; }

/* Header */
.pf-detail-header { margin-bottom: 1.5rem; }
.pf-badges { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }

.pf-type-badge {
  display: inline-flex; align-items: center;
  padding: .3rem .9rem;
  border-radius: 999px;
  font-size: .7rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
}
.pf-type-badge--red    { background: rgba(239,68,68,.15); color: #f87171; border: 1px solid rgba(239,68,68,.3); }
.pf-type-badge--blue   { background: rgba(59,130,246,.15); color: #60a5fa; border: 1px solid rgba(59,130,246,.3); }
.pf-type-badge--purple { background: rgba(139,92,246,.15); color: #a78bfa; border: 1px solid rgba(139,92,246,.3); }

.pf-cat-badge {
  display: inline-flex; align-items: center;
  padding: .3rem .9rem;
  border-radius: 999px;
  font-size: .7rem; font-weight: 600;
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.7);
  border: 1px solid rgba(255,255,255,.12);
}

.pf-title {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.25;
  color: #fff;
  margin-bottom: 1.25rem;
  letter-spacing: -.02em;
}

/* External link button */
.pf-external-btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .6rem 1.25rem;
  background: rgba(59,130,246,.12);
  border: 1px solid rgba(59,130,246,.3);
  border-radius: .75rem;
  color: #60a5fa;
  font-size: .85rem; font-weight: 600;
  text-decoration: none;
  transition: background .2s, transform .2s;
  margin-bottom: 1.25rem;
}
.pf-external-btn:hover {
  background: rgba(59,130,246,.22);
  transform: translateY(-2px);
}
.pf-external-btn__arrow { transition: transform .2s; }
.pf-external-btn:hover .pf-external-btn__arrow { transform: translateX(4px); }

/* ── Sections ─────────────────────────────────────────────────────────── */
.pf-section {
  margin-bottom: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--pf-border);
}
.pf-section:first-of-type { border-top: none; padding-top: 0; }

.pf-section-title {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.45);
  margin-bottom: 1rem;
  display: flex; align-items: center; justify-content: space-between;
}

/* Meta grid */
.pf-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .75rem;
}
.pf-meta-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem 1rem;
  background: var(--pf-glass-lt);
  border: 1px solid var(--pf-border);
  border-radius: .75rem;
}
.pf-meta-icon {
  width: 2rem; height: 2rem; flex-shrink: 0;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem;
}
.pf-meta-icon--accent-purple { background: rgba(139,92,246,.15); color: var(--pf-purple); }
.pf-meta-icon--accent-cyan   { background: rgba(6,182,212,.15);  color: var(--pf-cyan); }
.pf-meta-icon--accent-pink   { background: rgba(236,72,153,.15); color: var(--pf-pink); }
.pf-meta-label { font-size: .62rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,.4); margin: 0; }
.pf-meta-value { font-size: .82rem; font-weight: 600; color: rgba(255,255,255,.9); margin: .15rem 0 0; }

/* Description */
.pf-desc {
  font-size: .9rem;
  line-height: 1.75;
  color: rgba(255,255,255,.7);
}

/* Tags */
.pf-tags { display: flex; flex-wrap: wrap; gap: .5rem; }
.pf-tag {
  padding: .3rem .85rem;
  background: var(--pf-glass-lt);
  border: 1px solid var(--pf-border);
  border-radius: 999px;
  font-size: .75rem; font-weight: 500;
  color: rgba(255,255,255,.65);
  transition: background .2s, color .2s;
}
.pf-tag:hover { background: rgba(139,92,246,.15); color: #c4b5fd; border-color: rgba(139,92,246,.3); }

/* Gallery strip */
.pf-gallery-count {
  font-size: .65rem;
  background: rgba(6,182,212,.12);
  border: 1px solid rgba(6,182,212,.25);
  color: var(--pf-cyan);
  padding: .15rem .6rem;
  border-radius: 999px;
  letter-spacing: .04em;
}
.pf-gallery-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: .5rem;
}
.pf-gallery-thumb {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: .6rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: border-color .2s, transform .2s;
  background: none;
  padding: 0;
}
.pf-gallery-thumb:hover { border-color: var(--pf-purple); transform: scale(1.04); }
.pf-gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pf-gallery-thumb__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: .85rem;
  opacity: 0; transition: opacity .2s;
}
.pf-gallery-thumb:hover .pf-gallery-thumb__overlay { opacity: 1; }
.pf-gallery-thumb:focus-visible { outline: 2px solid var(--pf-purple); }

/* CTA */
.pf-cta {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--pf-border);
}
.pf-cta-btn {
  display: inline-flex; align-items: center;
  padding: .75rem 1.5rem;
  background: linear-gradient(135deg, var(--pf-purple), var(--pf-cyan));
  border: none;
  border-radius: .75rem;
  color: #fff; font-size: .9rem; font-weight: 700;
  text-decoration: none; cursor: pointer;
  box-shadow: 0 0 24px rgba(139,92,246,.35);
  transition: opacity .2s, transform .2s, box-shadow .2s;
  letter-spacing: .01em;
}
.pf-cta-btn:hover { opacity: .9; transform: translateY(-2px); box-shadow: 0 0 36px rgba(139,92,246,.5); }

/* Error state */
.pf-error {
  padding: 3rem 2rem;
  text-align: center;
  color: rgba(255,255,255,.6);
}
.pf-error i { display: block; font-size: 2.5rem; color: #f87171; margin-bottom: 1rem; }
.pf-error p { margin-bottom: 1.5rem; }

/* ══════════════════════════════
   GALLERY LIGHTBOX
══════════════════════════════ */
.pf-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; visibility: hidden;
  transition: opacity .3s ease;
}
.pf-lightbox--active {
  opacity: 1; pointer-events: all; visibility: visible;
}

.pf-lb-close {
  position: absolute;
  top: 1rem; right: 1rem;
  width: 2.5rem; height: 2.5rem;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .2s, transform .2s;
}
.pf-lb-close:hover { background: rgba(239,68,68,.7); transform: rotate(90deg); }

.pf-lb-nav {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  width: 3rem; height: 3rem;
  border-radius: 50%;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.18);
  color: #fff; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .2s, transform .2s;
  z-index: 2;
}
.pf-lb-nav:hover { background: rgba(139,92,246,.5); }
.pf-lb-nav--prev { left: 1.25rem; }
.pf-lb-nav--next { right: 1.25rem; }

.pf-lb-img-wrap {
  max-width: calc(100vw - 8rem);
  max-height: 90vh;
  display: flex; align-items: center; justify-content: center;
}
.pf-lb-img-wrap img {
  max-width: 100%; max-height: 90vh;
  object-fit: contain;
  border-radius: .75rem;
  box-shadow: 0 0 80px rgba(0,0,0,.8);
}

.pf-lb-counter {
  position: absolute;
  bottom: 1.25rem; left: 50%; transform: translateX(-50%);
  font-size: .75rem; font-weight: 600;
  color: rgba(255,255,255,.6);
  background: rgba(0,0,0,.5);
  padding: .3rem .9rem; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.1);
}

/* ══════════════════════════════
   RESPONSIVE — MOBILE FIRST
══════════════════════════════ */

/* Mobile: stacked layout */
@media (max-width: 767px) {
  .pf-modal { padding: 0; align-items: flex-end; }
  .pf-panel {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    max-height: 96vh;
    border-radius: 1.25rem 1.25rem 0 0;
    transform: scale(1) translateY(100%);
  }
  .pf-modal--open .pf-panel { transform: scale(1) translateY(0); }
  .pf-media-col { min-height: 260px; max-height: 50vw; }
  .pf-media-col::after { display: none; }
  .pf-detail-col { max-height: 56vh; }
  .pf-video-wrap { min-height: 260px; }
  .pf-close { top: .75rem; right: .75rem; }
  .pf-title { font-size: 1.25rem; }
  .pf-lb-nav--prev { left: .5rem; }
  .pf-lb-nav--next { right: .5rem; }
  .pf-lb-img-wrap { max-width: 100vw; padding: 0 3.5rem; }
}

/* Tablet */
@media (min-width: 768px) and (max-width: 1023px) {
  .pf-panel { grid-template-columns: 45% 55%; }
}

/* Desktop */
@media (min-width: 1024px) {
  .pf-media-col { min-height: 560px; }
  .pf-title { font-size: 1.75rem; }
}

/* ══════════════════════════════════════════════════════════════════════
   PORTFOLIO MASONRY LAYOUT
   Pure CSS columns approach — no JS library needed
══════════════════════════════════════════════════════════════════════ */

/* ── Masonry Container ─────────────────────────────────────────────── */
.portfolio-masonry {
  column-count: 1;
  column-gap: 1.25rem;
  orphans: 1;
  widows: 1;
}

/* Responsive breakpoints */
@media (min-width: 480px) {
  .portfolio-masonry { column-count: 2; }
}
@media (min-width: 768px) {
  .portfolio-masonry { column-count: 3; }
}
@media (min-width: 1280px) {
  .portfolio-masonry { column-count: 4; }
}
@media (min-width: 1600px) {
  .portfolio-masonry { column-count: 5; }
}

/* ── Masonry Item ──────────────────────────────────────────────────── */
.portfolio-masonry .portfolio-card {
  break-inside: avoid;
  page-break-inside: avoid;
  -webkit-column-break-inside: avoid;
  display: inline-block;   /* Critical: makes columns work correctly */
  width: 100%;
  margin-bottom: 1.25rem;
  /* Smooth entry animation */
  opacity: 0;
  animation: masonryFadeIn 0.5s ease forwards;
}

/* Staggered animation delays for waterfall effect */
.portfolio-masonry .portfolio-card:nth-child(1)  { animation-delay: 0.05s; }
.portfolio-masonry .portfolio-card:nth-child(2)  { animation-delay: 0.10s; }
.portfolio-masonry .portfolio-card:nth-child(3)  { animation-delay: 0.15s; }
.portfolio-masonry .portfolio-card:nth-child(4)  { animation-delay: 0.20s; }
.portfolio-masonry .portfolio-card:nth-child(5)  { animation-delay: 0.25s; }
.portfolio-masonry .portfolio-card:nth-child(6)  { animation-delay: 0.30s; }
.portfolio-masonry .portfolio-card:nth-child(7)  { animation-delay: 0.35s; }
.portfolio-masonry .portfolio-card:nth-child(8)  { animation-delay: 0.40s; }
.portfolio-masonry .portfolio-card:nth-child(9)  { animation-delay: 0.45s; }
.portfolio-masonry .portfolio-card:nth-child(10) { animation-delay: 0.50s; }
.portfolio-masonry .portfolio-card:nth-child(11) { animation-delay: 0.55s; }
.portfolio-masonry .portfolio-card:nth-child(12) { animation-delay: 0.60s; }

@keyframes masonryFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ── Card Image ────────────────────────────────────────────────────── */
.portfolio-masonry .portfolio-card img {
  display: block;
  width: 100%;
  height: auto;      /* Natural height = true masonry */
  min-height: 120px;
  border-radius: 0.875rem;
}

/* ── Card Hover Ring ───────────────────────────────────────────────── */
.portfolio-masonry .portfolio-card > div {
  border-radius: 0.875rem;
  box-shadow:
    0 2px 12px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.06);
  transition:
    box-shadow 0.35s ease,
    transform  0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform, box-shadow;
}

.portfolio-masonry .portfolio-card:hover > div {
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.55),
    0 0 0 2px rgba(139, 92, 246, 0.55),
    0 0 28px rgba(139, 92, 246, 0.20);
  transform: translateY(-4px);
}

/* ── Loading State Skeleton ────────────────────────────────────────── */
.portfolio-masonry-skeleton {
  column-count: 2;
  column-gap: 1.25rem;
}
@media (min-width: 768px) { .portfolio-masonry-skeleton { column-count: 3; } }
@media (min-width: 1280px) { .portfolio-masonry-skeleton { column-count: 4; } }

.portfolio-masonry-skeleton .skeleton-card {
  break-inside: avoid;
  display: inline-block;
  width: 100%;
  margin-bottom: 1.25rem;
  border-radius: 0.875rem;
  overflow: hidden;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
}

.skeleton-shimmer {
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0.04) 25%,
    rgba(255,255,255,0.10) 50%,
    rgba(255,255,255,0.04) 75%
  );
  background-size: 400% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
}

@keyframes shimmer {
  0%   { background-position: 100% 50%; }
  100% { background-position: 0%   50%; }
}

/* ── Hover Info Panel ──────────────────────────────────────────────── */
.portfolio-masonry .pf-card-hover-info {
  border-bottom-left-radius:  0.875rem;
  border-bottom-right-radius: 0.875rem;
}