/* ============================================================
   PROJECT GALLERY + MODAL — PASTE INTO works.css
   FIX: cursor z-index raised above modal backdrop
   ============================================================ */

/* ---- CURSOR FIX — must be above modal z-index:10000 ---- */
.cursor-dot  { z-index: 99999 !important; }
.cursor-ring { z-index: 99998 !important; }

/* Hide native cursor everywhere including inside modal */
.pmodal-backdrop,
.pmodal-backdrop * { cursor: none !important; }

/* ---- Grid Layout ---- */
#projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}
@media (max-width: 1100px) { #projects-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { #projects-grid { grid-template-columns: 1fr; gap: 20px; } }

/* ---- Hidden state for filter ---- */
.project-item.hidden { display: none; }

/* ---- Fade-in animation on cards ---- */
@keyframes projFadeIn {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.project-item.fade-in {
  animation: projFadeIn 0.55s cubic-bezier(0.23, 1, 0.32, 1) both;
}
.project-item:nth-child(1)  { animation-delay: 0.04s; }
.project-item:nth-child(2)  { animation-delay: 0.08s; }
.project-item:nth-child(3)  { animation-delay: 0.12s; }
.project-item:nth-child(4)  { animation-delay: 0.16s; }
.project-item:nth-child(5)  { animation-delay: 0.20s; }
.project-item:nth-child(6)  { animation-delay: 0.24s; }
.project-item:nth-child(7)  { animation-delay: 0.28s; }
.project-item:nth-child(8)  { animation-delay: 0.32s; }
.project-item:nth-child(9)  { animation-delay: 0.36s; }
.project-item:nth-child(10) { animation-delay: 0.40s; }
.project-item:nth-child(11) { animation-delay: 0.44s; }
.project-item:nth-child(12) { animation-delay: 0.48s; }

/* ---- Number badge on card ---- */
.project-num-badge {
  position: absolute;
  top: 14px; left: 14px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: rgba(255,255,255,0.55);
  background: rgba(10,10,10,0.6);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 10px;
  z-index: 2;
  transition: var(--transition);
}
.project-card:hover .project-num-badge {
  color: var(--accent);
  border-color: rgba(255,92,26,0.5);
}

.project-card  { cursor: none; }
.proj-trigger  { cursor: none; }

/* ============================================================
   PROJECT MODAL
   ============================================================ */

/* Backdrop */
.pmodal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s cubic-bezier(0.23,1,0.32,1),
              visibility 0.45s;
}
.pmodal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

/* Container */
.pmodal-container {
  position: relative;
  background: #111111;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 28px;
  width: 100%;
  max-width: 1060px;
  max-height: 90vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  transform: translateY(50px) scale(0.96);
  transition: transform 0.5s cubic-bezier(0.23,1,0.32,1);
}
.pmodal-backdrop.open .pmodal-container {
  transform: translateY(0) scale(1);
}

/* Close button */
.pmodal-close {
  position: absolute;
  top: 20px; right: 20px;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
  cursor: none;
  z-index: 10;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 6px;
  padding: 12px;
  transition: all 0.3s ease;
}
.pmodal-close:hover {
  background: var(--accent);
  border-color: var(--accent);
  transform: rotate(90deg);
}
.pmodal-close span {
  display: block;
  width: 16px; height: 1.5px;
  background: #fff;
  border-radius: 2px;
}
.pmodal-close span:first-child { transform: translateY(3.75px) rotate(45deg); }
.pmodal-close span:last-child  { transform: translateY(-3.75px) rotate(-45deg); }

/* Image panel */
.pmodal-img-panel {
  position: relative;
  overflow: hidden;
  min-height: 320px;
}
.pmodal-img-wrap {
  position: relative;
  height: 100%;
  min-height: 320px;
}
.pmodal-img-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.8s cubic-bezier(0.23,1,0.32,1);
}
.pmodal-backdrop.open .pmodal-img-wrap img {
  animation: pImgReveal 0.8s 0.15s cubic-bezier(0.23,1,0.32,1) both;
}
@keyframes pImgReveal {
  from { transform: scale(1.12); filter: brightness(0.6); }
  to   { transform: scale(1.04); filter: brightness(1); }
}
.pmodal-img-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 40%, rgba(10,10,10,0.6) 100%);
}
.pmodal-deco-line {
  position: absolute;
  bottom: 0; left: 0;
  width: 100%; height: 3px;
  background: linear-gradient(90deg, var(--accent), transparent);
}

/* Info panel */
.pmodal-info-panel {
  padding: 52px 48px 40px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}
.pmodal-info-panel::-webkit-scrollbar { width: 3px; }
.pmodal-info-panel::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 2px; }

.pmodal-meta-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
.pmodal-cat {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  background: rgba(255,92,26,0.1);
  border: 1px solid rgba(255,92,26,0.3);
  padding: 4px 12px;
  border-radius: 50px;
}
.pmodal-year {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: rgba(255,255,255,0.3);
  letter-spacing: 0.08em;
}
.pmodal-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--white);
  margin-bottom: 0;
}
.pmodal-divider {
  height: 1px;
  background: rgba(255,255,255,0.07);
  margin: 24px 0;
}
.pmodal-desc {
  font-size: 0.93rem;
  color: rgba(255,255,255,0.65);
  line-height: 1.8;
  margin-bottom: 24px;
}
.pmodal-tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 36px;
}
.pmodal-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--gray);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  padding: 5px 14px;
  border-radius: 50px;
  transition: all 0.3s ease;
}
.pmodal-tag:hover {
  color: var(--accent);
  border-color: rgba(255,92,26,0.4);
}
.pmodal-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}
.pmodal-actions .btn-primary-custom,
.pmodal-actions .btn-outline-custom {
  font-size: 0.82rem;
  padding: 11px 24px;
}

/* Modal nav */
.pmodal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.07);
  margin-top: auto;
}
.pmodal-nav-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--gray);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  padding: 8px 18px;
  border-radius: 50px;
  cursor: none;
  display: flex; align-items: center; gap: 8px;
  transition: var(--transition);
}
.pmodal-nav-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.pmodal-nav-count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: rgba(255,255,255,0.25);
  letter-spacing: 0.1em;
}

/* Image-swap transition */
.pmodal-img-wrap.transitioning img {
  animation: imgSwap 0.4s cubic-bezier(0.23,1,0.32,1) both;
}
@keyframes imgSwap {
  0%   { opacity: 0; transform: scale(1.08); }
  100% { opacity: 1; transform: scale(1.04); }
}

/* Content-swap transition */
.pmodal-info-panel.transitioning .pmodal-title,
.pmodal-info-panel.transitioning .pmodal-desc,
.pmodal-info-panel.transitioning .pmodal-meta-row,
.pmodal-info-panel.transitioning .pmodal-tags-wrap {
  animation: contentSlide 0.4s cubic-bezier(0.23,1,0.32,1) both;
}
@keyframes contentSlide {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ============================================================
   RESPONSIVE — MODAL
   ============================================================ */
@media (max-width: 820px) {
  .pmodal-container {
    grid-template-columns: 1fr;
    max-height: 92vh;
    overflow-y: auto;
    border-radius: 20px;
  }
  .pmodal-img-panel  { min-height: 240px; max-height: 260px; }
  .pmodal-info-panel { padding: 32px 28px 28px; overflow-y: visible; }
  .pmodal-close      { top: 14px; right: 14px; }
}
@media (max-width: 480px) {
  .pmodal-backdrop   { padding: 10px; }
  .pmodal-container  { border-radius: 16px; }
  .pmodal-info-panel { padding: 24px 20px 20px; }
  .pmodal-title      { font-size: 1.4rem; }
  .pmodal-actions    { flex-direction: column; }
  .pmodal-actions .btn-primary-custom,
  .pmodal-actions .btn-outline-custom { width: 100%; justify-content: center; }
}