/* ==========================================================================
   Portfolio Page — Dedicated Showcase Styles
   ========================================================================== */

/* ==========================================================================
   Canvas Background
   ========================================================================== */
#portfolioCanvas {
  position: fixed;
  /* Inset the canvas to the layout viewport without hard-coded dimensions. */
  inset: 0;
  z-index: 0;
  pointer-events: none;
  display: block;
  background: transparent;
}

/* ==========================================================================
   Thumbnail Page Canvas — fixed background layer
   ========================================================================== */
#thumbnailCanvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  display: block;
  background: transparent;
}

/* ==========================================================================
   Main Content
   ========================================================================== */
.portfolio-main {
  position: relative;
  z-index: 1;
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(110px, 11vw, 140px) var(--section-pad-x) var(--section-pad-y);
}

/* ==========================================================================
   Intro (Centered with Shimmer Title & Sub-Heading)
   ========================================================================== */
.portfolio-intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 48px;
  padding-top: 10px;
}

.portfolio-intro .portfolio-main-heading {
  text-align: center;
  max-width: 860px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 12px;
}

.portfolio-sub-heading-text,
.thumbnail-sub-heading {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2.4vw, 2.1rem);
  font-weight: 600;
  color: var(--white);
  letter-spacing: -0.02em;
  line-height: 1.25;
  max-width: 780px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 14px;
  text-align: center;
}

.portfolio-sub {
  text-align: center;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
  font-size: 1.02rem;
  font-weight: 400;
  line-height: 1.65;
  letter-spacing: -0.01em;
  color: var(--grey-dim);
}

/* ==========================================================================
   Filters
   ========================================================================== */
.portfolio-filters {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 40px;
  padding-bottom: 4px;
}

.filter-btn {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 550;
  letter-spacing: 0.01em;
  padding: 8px 20px;
  border: 1px solid var(--line);
  border-radius: 100px;
  color: var(--grey-dim);
  background: transparent;
  transition: color 0.25s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.25s cubic-bezier(0.16, 1, 0.3, 1),
    background 0.25s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.filter-btn:hover {
  color: var(--white);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.filter-btn.active {
  color: var(--white);
  border-color: rgba(255, 13, 37, 0.4);
  background: rgba(255, 13, 37, 0.08);
}

/* ==========================================================================
   Grid
   ========================================================================== */
.portfolio-grid {
  margin-bottom: 40px;
}

/* Long-form cards wrap independently, so an orphan is centered on its row. */
.long-form-wrapper {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 28px;
}

.long-form-wrapper .project-card {
  flex: 0 1 calc((100% - 28px) / 2);
}

/* Preserve the existing short-form grid exactly as its own collection. */
.short-form-wrapper {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
}

.portfolio-video-divider {
  width: 95%;
  margin: 60px auto;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

/* Grid item animation */
.project-card {
  opacity: 0;
  transform: translateY(20px);
  animation: cardIn 600ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: calc(var(--card-index, 0) * 45ms);
}

.project-card.filtered-out {
  animation: cardOut 350ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cardIn {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cardOut {
  0% {
    opacity: 1;
    transform: translateY(0);
  }

  100% {
    opacity: 0;
    transform: translateY(12px);
  }
}

/* ==========================================================================
   Project Card
   ========================================================================== */
.project-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(255, 13, 37, 0.06);
  background: rgba(10, 10, 10, 0.4);
  backdrop-filter: blur(4px);
  transition: border-color 0.35s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.35s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.project-card:hover {
  border-color: rgba(255, 13, 37, 0.2);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4), 0 0 30px rgba(255, 13, 37, 0.04);
  transform: translateY(-4px);
}

.project-card .video-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
}

.project-card.short-form-card .video-wrapper {
  aspect-ratio: 9 / 16;
}

.project-card .video-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.project-card:hover .video-wrapper video {
  transform: scale(1.02);
}

/* Card Preview Play Button Overlay */
.project-card .video-wrapper .play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 2;
}

.project-card.is-playing .video-wrapper .play-overlay {
  opacity: 0;
}

.project-card .video-wrapper .play-btn-circle {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  /* Half see-through dark background with lower exposure backdrop blur */
  background: rgba(10, 10, 14, 0.55);
  backdrop-filter: blur(10px) brightness(0.6);
  -webkit-backdrop-filter: blur(10px) brightness(0.6);
  /* Orange accent border ring */
  border: 1px solid rgba(255, 13, 37, 0.38);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35), inset 0 0 12px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    background 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.project-card:hover .video-wrapper .play-btn-circle {
  transform: scale(1.08);
  background: rgba(255, 13, 37, 0.2);
  border-color: rgba(255, 13, 37, 0.8);
  box-shadow: 0 0 24px rgba(255, 13, 37, 0.28), inset 0 0 10px rgba(0, 0, 0, 0.25);
}

.project-card .video-wrapper .play-btn-circle svg,
.project-card .video-wrapper .play-btn-circle img {
  width: 22px;
  height: 22px;
  fill: #ffffff;
  color: #ffffff;
  margin-left: 2px;
  /* optical centering */
  filter: brightness(0) invert(1);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.project-card:hover .video-wrapper .play-btn-circle svg,
.project-card:hover .video-wrapper .play-btn-circle img {
  transform: scale(1.05);
}

.project-card .project-info {
  padding: 16px 20px 18px;
}

.project-card .project-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--white);
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.project-card .project-meta {
  font-size: 0.84rem;
  font-weight: 450;
  letter-spacing: -0.005em;
  color: var(--grey-dim);
  display: flex;
  align-items: center;
  gap: 8px;
}

.project-card .project-meta .dot {
  display: inline-block;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--grey-dim);
}

.project-card .project-meta .client {
  color: var(--accent-strong);
}

/* ==========================================================================
   Load More
   ========================================================================== */
.portfolio-load-more {
  display: flex;
  justify-content: center;
  padding: 8px 0 20px;
}

.load-more-btn {
  min-width: 180px;
}

.load-more-btn.hidden {
  display: none;
}

/* ==========================================================================
   Thumbnail Full Page (thumbnail.html)
   ========================================================================== */
.thumbnail-main .thumbnail-grid-full {
  --thumbnail-card-width: min(50vw, 940px);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0;
  width: 100vw;
  max-width: none;
  margin: 0 auto;
  padding: clamp(92px, 11vh, 156px) 0 clamp(116px, 15vh, 196px);
  overflow-x: auto;
  overflow-y: visible;
  overscroll-behavior-x: contain;
  scroll-snap-type: none;
  scroll-behavior: auto;
  scrollbar-width: none;
  perspective: 1400px;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
  user-select: none;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 20%, #000 80%, transparent 100%);
  mask-image: linear-gradient(to right, transparent 0%, #000 20%, #000 80%, transparent 100%);
}

.thumbnail-main .thumbnail-grid-full::-webkit-scrollbar {
  display: none;
}

.thumbnail-main .thumbnail-grid-full.is-pointer-down {
  cursor: grabbing;
}

.thumbnail-main .thumbnail-grid-full.is-pointer-dragging {
  scroll-behavior: auto;
}

.thumbnail-main .thumbnail-grid-full::before,
.thumbnail-main .thumbnail-grid-full::after {
  content: "";
  flex: 0 0 max(25vw, calc((100vw - 940px) / 2));
  pointer-events: none;
}

.thumbnail-gallery {
  position: relative;
  width: 100vw;
  margin: 0 0 0 calc(50% - 50vw);
}

.thumbnail-full-item {
  position: relative;
  flex: 0 0 var(--thumbnail-card-width);
  aspect-ratio: 16 / 9;
  border-radius: clamp(16px, 2vw, 24px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #090b0f;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.35);
  transform-origin: center center;
  transform-style: preserve-3d;
  will-change: transform, opacity, filter;
  transition: transform 520ms cubic-bezier(0.2, 0.75, 0.25, 1), opacity 520ms ease, filter 520ms ease, box-shadow 520ms ease, border-color 520ms ease;
}

.thumbnail-full-item + .thumbnail-full-item {
  margin-left: clamp(-90px, -4vw, -32px);
}

.thumbnail-full-item.reveal-up {
  opacity: 1;
}

.thumbnail-full-item.reveal-up.in-view {
  opacity: 1;
}

.thumbnail-full-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.thumbnail-full-item.is-focused {
  border-color: rgba(255, 255, 255, 0.34);
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.48), 0 0 38px rgba(255, 13, 37, 0.08);
}

.thumbnail-full-item:hover {
  border-color: rgba(255, 255, 255, 0.34) !important;
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.48), 0 0 38px rgba(255, 13, 37, 0.08) !important;
}

@media (max-width: 700px) {
  .thumbnail-main .thumbnail-grid-full {
    --thumbnail-card-width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 24px;
    padding: 18px 2px 40px;
    overflow: visible;
    perspective: 1000px;
    scroll-snap-type: none;
    -webkit-mask-image: none;
    mask-image: none;
    cursor: auto;
    user-select: auto;
  }

  .thumbnail-gallery {
    width: 100%;
    margin: 0 auto;
  }

  .thumbnail-full-item {
    width: 100%;
    flex: 0 0 auto;
    border-radius: 16px;
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.28);
  }

  .thumbnail-full-item + .thumbnail-full-item {
    margin-left: 0;
  }

  .thumbnail-main .thumbnail-grid-full::before,
  .thumbnail-main .thumbnail-grid-full::after {
    display: none;
  }

  .thumbnail-full-item.is-focused {
    box-shadow: 0 22px 48px rgba(0, 0, 0, 0.34), 0 0 28px rgba(255, 13, 37, 0.06);
  }
}

@media (prefers-reduced-motion: reduce) {
  .thumbnail-main .thumbnail-grid-full {
    scroll-behavior: auto;
  }

  .thumbnail-full-item {
    transition: none;
  }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 960px) {

  .long-form-wrapper,
  .short-form-wrapper {
    gap: 20px;
  }

  .long-form-wrapper .project-card {
    flex-basis: calc((100% - 20px) / 2);
  }

  .portfolio-main {
    padding: 115px 24px 40px;
  }

}

@media (max-width: 620px) {

  .long-form-wrapper,
  .short-form-wrapper {
    gap: 16px;
  }

  .long-form-wrapper .project-card {
    flex-basis: 100%;
  }

  .short-form-wrapper {
    grid-template-columns: 1fr;
  }

  .portfolio-video-divider {
    margin: 40px auto;
  }

  .portfolio-main {
    padding: 105px 16px 32px;
  }

  .portfolio-intro {
    margin-bottom: 32px;
  }

  .portfolio-heading {
    font-size: clamp(1.4rem, 5vw, 1.8rem);
  }

  .portfolio-filters {
    gap: 6px;
    margin-bottom: 28px;
  }

  .filter-btn {
    font-size: 0.7rem;
    padding: 6px 14px;
  }

}

@media (max-width: 380px) {
  .portfolio-main {
    padding: 96px 12px 24px;
  }

  .filter-btn {
    font-size: 0.65rem;
    padding: 4px 10px;
  }

  .project-card .project-info {
    padding: 12px 14px 14px;
  }

  .project-card .project-title {
    font-size: 0.9rem;
  }

  .project-card .project-meta {
    font-size: 0.75rem;
  }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .project-card {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }

  .project-card.filtered-out {
    animation: none !important;
    opacity: 0 !important;
  }
}

/* ==========================================================================
   Unselectable & Protection for Logos, Thumbnails, Videos & Portfolio Items
   ========================================================================== */
img,
video,
.vlb__video,
.thumbnail-full-item img,
.project-card img,
.project-card video,
.video-wrapper img,
.video-wrapper video,
.portfolio-logo-image,
.footer-logo-image {
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
  -webkit-user-drag: none !important;
  -khtml-user-drag: none !important;
  -moz-user-drag: none !important;
  -o-user-drag: none !important;
  user-drag: none !important;
}

.project-card video,
.video-wrapper video,
.thumbnail-full-item img,
.project-card img,
.portfolio-logo-image,
.footer-logo-image {
  pointer-events: none !important;
}
