/* ═══════════════════════════════════════════════════════════════
   PORTFOLIO MODAL — Rayan Alawi Website  v8
═══════════════════════════════════════════════════════════════ */

.pl { cursor: none; }

/* ── Overlay ── */
.pf-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 3vw, 40px);
  background: rgba(10, 5, 28, 0.92);
  backdrop-filter: blur(32px) saturate(1.9);
  -webkit-backdrop-filter: blur(32px) saturate(1.9);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(.2,.8,.2,1);
}
.pf-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* ── Panel ── */
.pf-panel {
  width: 100%;
  max-width: 1100px;
  max-height: min(92vh, 860px);
  background: linear-gradient(150deg,
    rgba(55, 42, 110, 0.94) 0%,
    rgba(22, 14, 52, 0.97) 100%);
  border: 1px solid rgba(229, 149, 208, 0.22);
  border-radius: 28px;
  box-shadow:
    0 0 0 1px rgba(229,149,208,0.06) inset,
    0 40px 120px rgba(0,0,0,0.7),
    0 0 140px rgba(200,79,170,0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.88) translateY(32px);
  transition: transform 0.44s cubic-bezier(.2,.8,.2,1);
}
.pf-overlay.open .pf-panel {
  transform: scale(1) translateY(0);
}

/* ── Header ── */
.pf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 32px 20px;
  border-bottom: 1px solid rgba(229,149,208,0.11);
  flex-shrink: 0;
  position: relative;
}
.pf-header-accent {
  position: absolute;
  bottom: -1px;
  left: 32px;
  height: 2px;
  width: 64px;
  border-radius: 2px;
  transition: background 0.3s, box-shadow 0.3s;
}
.pf-header-left { display: flex; align-items: center; gap: 18px; }
.pf-cat-icon {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}
.pf-eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.28em;
  color: rgba(229,149,208,0.5);
  margin-bottom: 4px;
  text-transform: uppercase;
}
.pf-cat-title {
  font-size: clamp(24px, 3.5vw, 40px);
  font-weight: 800;
  letter-spacing: 0.07em;
  color: #fff;
  line-height: 1;
}
.pf-file-count {
  font-size: 11px;
  color: rgba(229,149,208,0.4);
  margin-top: 5px;
  letter-spacing: 0.05em;
}
.pf-close-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(229,149,208,0.22);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: none;
  transition: all 0.25s cubic-bezier(.2,.8,.2,1);
  flex-shrink: 0;
}
.pf-close-btn:hover {
  background: rgba(200,79,170,0.22);
  border-color: rgba(200,79,170,0.52);
  color: #fff;
  box-shadow: 0 0 22px rgba(200,79,170,0.3);
  transform: rotate(90deg);
}
.pf-close-btn svg { width: 20px; height: 20px; }

/* ── Grid ── */
.pf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  padding: 24px 32px 28px;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: rgba(200,79,170,0.3) transparent;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.pf-grid::-webkit-scrollbar { width: 4px; }
.pf-grid::-webkit-scrollbar-track { background: transparent; }
.pf-grid::-webkit-scrollbar-thumb {
  background: rgba(200,79,170,0.35);
  border-radius: 2px;
}

/* ── Cards ── */
@keyframes pf-card-rise {
  from { opacity: 0; transform: translateY(18px) scale(0.93); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.pf-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(229,149,208,0.13);
  border-radius: 16px;
  /* Use flex column so the thumb-wrap takes its natural square height
     and the label always sits beneath it, with a guaranteed min-height
     so the card never collapses into a pill — works in every browser. */
  display: flex;
  flex-direction: column;
  min-height: 220px;
  cursor: none;
  transition: transform 0.22s cubic-bezier(.2,.8,.2,1),
              border-color 0.22s, background 0.22s, box-shadow 0.22s;
  position: relative;
  overflow: hidden;
  animation: pf-card-rise 0.28s cubic-bezier(.2,.8,.2,1) both;
  will-change: transform;
}
.pf-card:hover {
  transform: translateY(-5px) scale(1.025);
  border-color: rgba(200,79,170,0.4);
  background: rgba(255,255,255,0.055);
  box-shadow: 0 14px 48px rgba(200,79,170,0.18), 0 0 0 1px rgba(200,79,170,0.12) inset;
}

/* ── Thumbnail — perfect square, three independent guarantees ── */
.pf-card-thumb-wrap {
  width: 100%;
  position: relative;
  overflow: hidden;
  border-radius: 16px 16px 0 0;
  background: rgba(255,255,255,0.06);
  /* Guarantee 1: modern browsers honour aspect-ratio */
  aspect-ratio: 1 / 1;
  /* Guarantee 2: hard min-height so the card can never collapse even if
     aspect-ratio and ::before both fail */
  min-height: 160px;
  /* Guarantee 3: don't shrink under flex squeeze */
  flex: 0 0 auto;
}
/* Guarantee 4: legacy ::before padding trick as a fallback for very old
   engines that ignore aspect-ratio. Modern browsers ignore this because
   aspect-ratio already locked the height. */
.pf-card-thumb-wrap::before {
  content: '';
  display: block;
  padding-top: 100%;
}

/* Real image preview */
.pf-card-thumb {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s cubic-bezier(.2,.8,.2,1);
}
.pf-card:hover .pf-card-thumb {
  transform: scale(1.08);
}

/* PDF / video / doc placeholder — centred emoji */
.pf-card-no-thumb {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  gap: 8px;
}
/* Coloured gradient backgrounds per type */
.pf-t-pdf  .pf-card-thumb-wrap { background: linear-gradient(145deg, rgba(255,60,60,0.22), rgba(180,30,30,0.32)); }
.pf-t-img  .pf-card-thumb-wrap { background: linear-gradient(145deg, rgba(40,160,255,0.22), rgba(20,90,200,0.32)); }
.pf-t-vid  .pf-card-thumb-wrap { background: linear-gradient(145deg, rgba(50,220,120,0.22), rgba(20,120,70,0.32)); }
.pf-t-doc  .pf-card-thumb-wrap { background: linear-gradient(145deg, rgba(160,100,255,0.22), rgba(90,50,180,0.32)); }

/* Type badge — sits top-right corner of thumbnail */
.pf-type-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.18em;
  padding: 3px 9px;
  border-radius: 999px;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2;
}
.pf-t-pdf .pf-type-badge { background: rgba(255,80,80,0.75);   color: #fff; }
.pf-t-img .pf-type-badge { background: rgba(50,160,255,0.75);  color: #fff; }
.pf-t-vid .pf-type-badge { background: rgba(50,220,120,0.75);  color: #fff; }
.pf-t-doc .pf-type-badge { background: rgba(160,100,255,0.75); color: #fff; }

/* Video play overlay */
.pf-card-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.28);
  opacity: 0;
  transition: opacity 0.28s;
  font-size: 38px;
}
.pf-card:hover .pf-card-play { opacity: 1; }

/* ── Card label (bottom strip) ── */
.pf-card-label {
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,0.75);
  line-height: 1.4;
  /* Make sure the label always has room to render, even if the card
     content is squeezed by an over-eager flex/grid parent. */
  flex: 0 0 auto;
  min-height: 38px;
  display: -webkit-box;
  display: flex;
  align-items: flex-start;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  text-overflow: ellipsis;
  word-break: break-word;
}

/* ── Empty state ── */
.pf-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 70px 20px;
  text-align: center;
  gap: 14px;
}
.pf-empty-orb {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(200,79,170,0.2), rgba(200,79,170,0.03));
  border: 1px solid rgba(200,79,170,0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  box-shadow: 0 0 40px rgba(200,79,170,0.1);
}
.pf-empty-title {
  font-size: 18px;
  font-weight: 700;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.05em;
}
.pf-empty-sub {
  font-size: 13px;
  color: rgba(255,255,255,0.25);
  max-width: 260px;
  line-height: 1.65;
}

/* ═══════════════════════
   FILE VIEWER
═══════════════════════ */
.pf-viewer {
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: rgba(6, 3, 18, 0.98);
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(.2,.8,.2,1);
}
.pf-viewer.open {
  opacity: 1;
  pointer-events: all;
}

/* Viewer top bar */
.pf-viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(40, 28, 84, 0.96);
  border-bottom: 1px solid rgba(229,149,208,0.11);
  flex-shrink: 0;
  gap: 10px;
}
.pf-viewer-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(229,149,208,0.2);
  color: #fff;
  padding: 7px 18px;
  border-radius: 999px;
  cursor: none;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  transition: all 0.22s cubic-bezier(.2,.8,.2,1);
  white-space: nowrap;
  font-family: inherit;
  flex-shrink: 0;
}
.pf-viewer-btn:hover {
  background: rgba(200,79,170,0.25);
  border-color: rgba(200,79,170,0.55);
  box-shadow: 0 0 18px rgba(200,79,170,0.25);
}
.pf-viewer-btn:disabled {
  opacity: 0.25;
  cursor: default;
  pointer-events: none;
}

/* Nav arrows */
.pf-nav-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(229,149,208,0.18);
  color: rgba(255,255,255,0.7);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: none;
  transition: all 0.22s cubic-bezier(.2,.8,.2,1);
  flex-shrink: 0;
  font-family: inherit;
  line-height: 1;
}
.pf-nav-btn:hover:not(:disabled) {
  background: rgba(200,79,170,0.28);
  border-color: rgba(200,79,170,0.6);
  color: #fff;
  box-shadow: 0 0 20px rgba(200,79,170,0.3);
}
.pf-nav-btn:disabled {
  opacity: 0.18;
  cursor: default;
}

.pf-viewer-center {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  justify-content: center;
  min-width: 0;
}
.pf-viewer-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  max-width: 320px;
}
.pf-viewer-filename {
  font-size: 13px;
  font-weight: 600;
  color: rgba(229,149,208,0.7);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.04em;
}
.pf-viewer-counter {
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.05em;
}

.pf-viewer-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 20px;
  position: relative;
}
.pf-viewer-body iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 10px;
  background: #fff;
}
.pf-viewer-body img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 0 80px rgba(0,0,0,0.6);
}
.pf-viewer-body video {
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px;
  box-shadow: 0 0 80px rgba(0,0,0,0.6);
}
.pf-viewer-download {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  color: rgba(255,255,255,0.5);
}
.pf-viewer-download a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, rgba(200,79,170,0.25), rgba(155,107,255,0.25));
  border: 1px solid rgba(200,79,170,0.4);
  color: #fff;
  padding: 14px 28px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.05em;
  transition: all 0.25s;
  box-shadow: 0 0 30px rgba(200,79,170,0.15);
}
.pf-viewer-download a:hover {
  background: linear-gradient(135deg, rgba(200,79,170,0.45), rgba(155,107,255,0.45));
  box-shadow: 0 0 40px rgba(200,79,170,0.3);
  transform: translateY(-2px);
}

/* Side swipe arrows (full-height, floating) */
.pf-side-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(40,28,84,0.85);
  border: 1px solid rgba(229,149,208,0.22);
  color: rgba(255,255,255,0.8);
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: none;
  transition: all 0.25s cubic-bezier(.2,.8,.2,1);
  z-index: 10;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-family: inherit;
  line-height: 1;
}
.pf-side-arrow:hover:not(:disabled) {
  background: rgba(200,79,170,0.38);
  border-color: rgba(200,79,170,0.7);
  box-shadow: 0 0 32px rgba(200,79,170,0.4);
  color: #fff;
  transform: translateY(-50%) scale(1.08);
}
.pf-side-arrow:disabled { opacity: 0.12; cursor: default; }
.pf-side-arrow.left  { left: 16px; }
.pf-side-arrow.right { right: 16px; }

/* ── Responsive ── */
@media (max-width: 640px) {
  .pf-header { padding: 18px 18px 16px; }
  .pf-grid { padding: 16px; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .pf-cat-icon { width: 44px; height: 44px; font-size: 20px; }
  .pf-viewer-bar { flex-wrap: wrap; padding: 8px 12px; }
  .pf-side-arrow { width: 40px; height: 40px; font-size: 18px; }
  .pf-side-arrow.left  { left: 8px; }
  .pf-side-arrow.right { right: 8px; }
}
