:root {
  --card-outline: rgba(0,0,0,0.06);
  --card-shadow: rgba(0,0,0,0.2);
}

[data-theme="dark"] {
  --card-outline: rgba(255,255,255,0.05);
  --card-shadow: rgba(0,0,0,0.4);
}

.portfolio-card {
  box-shadow:
    0 0 0 1px var(--card-outline),
    0 12px 30px var(--card-shadow);
}

/* Container styling for the gallery */
.container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px; /* Adds consistent spacing between images */
    padding: 10px;
}

.portfolioGallery {
    background-color: #292929;
}

/* Emotional Section */
.emotion-section {
  max-width: 800px;
  margin: 80px auto;
  text-align: center;
}

/* Media queries for responsiveness */
@media (max-width: 768px) {
  .lightbox img {
    max-width: 100%;
    max-height: 86vh;
  }
}

    .container {
        gap: 5px; /* Reduces gap between images */
        padding: 5px;
    }

@media (max-width: 480px) {
    .landscapephoto, .portraitphoto, .squarephoto, .panophoto, .vertpano {
        width: 100%;
        height: auto;
        margin: 2px;
    }
    
    .portfolio-card {
      background: var(--surface-1);
      border-radius: 10px;
      overflow: hidden;
      cursor: pointer;
    
      /* Subtle separation */
      box-shadow:
        0 0 0 1px rgba(255,255,255,0.04),
        0 12px 30px rgba(0,0,0,0.25);
    
      transition:
        transform 0.35s ease,
        box-shadow 0.35s ease;
    }

    .portfolio-card:hover {
      transform: translateY(-4px);
    }
}

/* Portfolio Grid */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-flow: dense;
  gap: 10px;
  max-width: 1400px;
  margin: 40px auto;
  padding: 0 20px;
}

/* Card defines the uniform size */
.portfolio-card {
  background: #1f1f1f;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
}

/* Image adapts INSIDE the card */
.portfolio-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;     /* ✔ intentional crop */
  display: block;
  transition: transform 0.5s ease, opacity 0.4s ease;
  transform: scale(1.03);
  opacity: 0.95;
}

.portfolio-card:hover img {
  transform: scale(1.04);
  opacity: 0.9;
}

/* Portrait = tall */
.portfolio-card.portrait {
  grid-column: span 1;
  grid-row: span 2;
}

/* Landscape = wide */
.portfolio-card.landscape {
  grid-column: span 2;
  grid-row: span 2;
}

@media (max-width: 600px) {

  .portfolio-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .portfolio-card {
    height: auto;
  }

  .portfolio-card img {
    height: auto;        /* 👈 KEY FIX */
    width: 100%;
    object-fit: contain; /* 👈 prevents crop on mobile */
  }
}

@media (max-width: 600px) {
  .portfolio-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }

  .portfolio-card {
    grid-column: span 2 !important;
    grid-row: span 2 !important;
  }
}

@media (max-width: 600px) {
  .portfolio-card {
    box-shadow:
      0 0 0 1px rgba(255,255,255,0.04),
      0 6px 18px rgba(0,0,0,0.25);
  }

  .portfolio-card:hover {
    transform: none;
  }
}
  
  /* Lightbox */
  
  .lightbox img {
    max-width: 100%;
    max-height: 78vh;
    width: auto;
    height: auto;
    object-fit: contain;
  
    opacity: 0;
    transform: scale(1.04);
  
    transition: opacity 0.45s ease, transform 1.6s ease;
  }
  
  .lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
  
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 0;
  
    background: rgba(0,0,0,0.92);
    backdrop-filter: blur(6px);
  
    z-index: 99999;
  
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease;
  }
  
  .lightbox.show {
    opacity: 1;
    visibility: visible;
  }

  .lightbox figure {
    margin: 0;
    max-width: 95vw;
  
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
  
    width: 100%;
  }
  
  #lightboxImage {
    max-width: 95vw;
    max-height: calc(100dvh - 110px);
    object-fit: contain;
    flex: 1;
  }


  .lightbox-close {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    margin-left: 8px;
  
    display: flex;
    align-items: center;
    justify-content: center;
  
    font-size: 16px;
    line-height: 1;
  
    background: rgba(255,255,255,0.08);
    color: #f2e6b6;
  
    transition: transform 0.2s ease, background 0.3s ease;
  }
  
  .lightbox-close:hover {
    background: rgba(0,0,0,0.6);
    transform: scale(1.05);
  }

  body.lightbox-open {
    overflow: hidden;
    touch-action: none;
  }

  .lightbox.slideshow-active .lightbox-timer {
    opacity: 1;
  }

  .lightbox-inner {
    position: relative;
    width: 100%;
    height: 100%;
  
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 6vh;
    align-items: center;
  
    gap: 20px;
  
    padding-bottom: 40px; /* prevents controls hitting screen edge */
  }
  
  /* Light mode glow */
.lightbox.slideshow-active .lightbox-timer-bar {
  box-shadow: 0 0 10px rgba(110, 127, 95, 0.35);
}

/* Dark mode glow */
[data-theme="dark"] .lightbox.slideshow-active .lightbox-timer-bar {
  box-shadow: 0 0 10px rgba(200, 123, 60, 0.35);
}

/* ---------------------------------
   Lightbox animation polish
---------------------------------- */

/* When lightbox is visible */
.lightbox.show img {
  opacity: 1;
  transform: scale(1);
}

/* CTA at bottom of portfolio */

.final-cta {
  padding: 60px 20px;
  text-align: center;
  background: rgba(255,255,255,0.03);
  margin-top: 80px;
}

/* ---------------------------------
   Lightbox Counter + Timer
---------------------------------- */

.lightbox-counter {
  font-size: 14px;
  color: #f2e6b6;
  opacity: 0.85;
  min-width: 60px;
  text-align: center;
}

/* Timer container (shorter, elegant) */
.lightbox-timer {
  width: 160px;
  height: 5px;
  border-radius: 100px;
  background: rgba(255,255,255,0.15);
  overflow: hidden;
  position: relative;
}

/* Animated fill bar */
.lightbox-timer-bar {
  width: 0%;
  height: 100%;
  border-radius: 100px;

  background: linear-gradient(
    90deg,
    #c87b3c,   /* Woodland Amber */
    #e7cda2
  );

  transition: width linear;
}

/* Dark mode gradient */
[data-theme="dark"] .lightbox-timer-bar {
  background: linear-gradient(
    90deg,
    #6e7f5f,   /* Moss */
    #d8c7a1    /* Warm Sand */
  );
}

/* ---------------------------------
   Reduced motion support
---------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .lightbox img {
    transition: none;
    transform: none;
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .lightbox {
    backdrop-filter: blur(10px);
  }
}

.lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 40px;
  background: none;
  border: none;
  color: #f2e6b6;
  cursor: pointer;
  padding: 10px;
  z-index: 1000;
  opacity: 0.75;
  transition: opacity 0.2s ease;
}

.lightbox-arrow:hover {
  opacity: 1;
}

.lightbox-arrow.left {
  left: 20px;
}

.lightbox-arrow.right {
  right: 20px;
}

.lightbox-arrow.hidden {
  opacity: 0;
  pointer-events: none;
}

.lightbox-play:hover {
  background: rgba(0,0,0,0.6);
  transform: scale(1.05);
}



#lightboxImage.fade-out {
  opacity: 0;
  transform: scale(1.03);
}

#lightboxImage.fade-out {
  opacity: 0;
}

/* Default = Light Mode (Moss → Warm Sand) */
.lightbox-timer-bar {
  width: 0%;
  height: 100%;
  border-radius: 100px;
  background: linear-gradient(
    90deg,
    #6e7f5f,
    #d8c7a1
  );
  transition: box-shadow 0.3s ease;
}

/* Dark Mode = Woodland Amber */
[data-theme="dark"] .lightbox-timer-bar {
  background: linear-gradient(
    90deg,
    #c87b3c,
    #e7cda2
  );
}

@media (max-width: 768px) {
  .lightbox-timer {
    width: 140px;
  }
}

/* ---------------------------------
   Lightbox Controls (Centered System)
---------------------------------- */

/* Shared button style */
.lightbox-controls button,
.lightbox-controls select {
  background: transparent;
  border: none;
  color: #f2e6b6;
  font-size: 16px;
  cursor: pointer;
}

/* ---------------------------------
   Lightbox Controls – Locked Bottom Center
---------------------------------- */

.lightbox-controls {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);

  bottom: calc(env(safe-area-inset-bottom) + 20px);

  display: flex;
  align-items: center;
  gap: 16px;
  padding: 6px 14px;
  border-radius: 40px;
  transition: opacity 0.35s ease, transform 0.35s ease;

  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);

  box-shadow: 0 20px 40px rgba(0,0,0,0.45);
  z-index: 10000;
}

.lightbox-controls.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
  pointer-events: none;
}

.lightbox-caption {

  font-size: 13px;
  color: #f2e6b6;
  opacity: 0.9;

  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
max-width: 320px;
line-height: 1.3;

  margin-right: 6px;
  transition: opacity 0.3s ease;
}

.lightbox.cursor-hidden {
  cursor: none;
}

/* Circular buttons */
.lightbox-mute,
.lightbox-play {
  width: 34px;
  height: 34px;
  border-radius: 50%;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 15px;
  line-height: 1;

  background: rgba(255,255,255,0.08);
  transition: transform 0.2s ease, background 0.3s ease;

  padding: 0;
}

/* Speed selector refinement */
.lightbox-speed {
  font-size: 12px;
  padding: 2px 5px;
  border-radius: 12px;
  background: rgba(255,255,255,0.08);
}

.lightbox-mute:hover {
  background: rgba(0,0,0,0.6);
  transform: scale(1.05);
}

@keyframes slideTimer {
  from { width: 0%; }
  to { width: 100%; }
}

.lightbox-mute:active,
.lightbox-play:active {
  transform: scale(0.95);
}


/* Hide arrows on small screens */
@media (max-width: 768px) {
  .lightbox-arrow {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

.portfolio-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
}

.portfolio-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;

  transition: transform 0.6s ease, filter 0.4s ease;
}

.portfolio-card:hover img {
  transform: scale(1.06);
  filter: brightness(1.08) contrast(1.05);
}

.portfolio-card:hover::after {
  background: rgba(239, 96, 36, 0.12);
}

.portfolio-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(239, 96, 36, 0.0); /* your burnt orange */
  transition: background 0.5s ease;
  pointer-events: none;
  opacity: 50%;
}

.portfolio-card {
  transform: translateZ(0);
}

/* 🔒 Lock portfolio cards in place */
.portfolio-card {
  transform: none !important;
}

.portfolio-card:hover {
  transform: none !important;
}

.lightbox-speed:focus {
  outline: none;
  box-shadow: none;
}

.lightbox-speed {
  -webkit-tap-highlight-color: transparent;
}

.lightbox-speed:focus-visible {
  outline: none;
  box-shadow: none;
}

.lightbox::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, transparent 55%, rgba(0,0,0,0.45));
  pointer-events: none;

  animation: vignetteBreath 18s ease-in-out infinite;
}

.lightbox.slideshow-active::after {
  animation: vignetteBreath 18s ease-in-out infinite;
}

@keyframes vignetteBreath {
  0%,100% { opacity: 0.85; }
  50% { opacity: 1; }
}

@media (max-width: 768px) {

  .lightbox-caption {
    display: none !important;
  }

  .lightbox-controls {
    flex-wrap: nowrap;
    justify-content: center;
    gap: 8px;

    padding: 6px 12px;
    border-radius: 999px;

    width: auto;
    max-width: 90vw;
  }

}

@media (min-width: 900px) {
  #lightboxImage {
    max-height: calc(100dvh - 70px);
    max-width: 96vw;
  }
}


.lightbox-download {
  width: 34px;
  height: 34px;
  border-radius: 50%;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 15px;
  background: rgba(255,255,255,0.08);
  color: #f2e6b6;

  transition: transform 0.2s ease, background 0.3s ease;
}

.lightbox-download:hover {
  background: rgba(0,0,0,0.6);
  transform: scale(1.05);
}

.download-toggle-wrap {
  text-align: center;
  margin-top: 20px;
}


.download-all-wrapper {
  text-align: center;
  margin: 40px 0;
}