/* ============================================
   ALBUM HEADER
   ============================================ */
.album-header {
  position: relative;
  background: var(--color-cream);
  padding: clamp(2rem, 6vw, 3.5rem) 1.5rem 2rem;
  text-align: center;
}

.album-back {
  display: inline-block;
  font-family: var(--font-avenir);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--color-rust);
  text-decoration: none;
  margin-bottom: 1.75rem;
  transition: opacity 0.3s ease;
}

.album-back:hover {
  opacity: 0.7;
}

.album-eyebrow {
  display: block;
  font-family: var(--font-avenir);
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--color-rust);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.album-title {
  font-family: var(--font-nordic);
  font-weight: 400;
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  color: var(--color-dark);
  margin-bottom: 0.75rem;
  letter-spacing: 0.02em;
}

.album-description {
  font-family: var(--font-avenir);
  font-size: 0.95rem;
  line-height: 1.6;
  color: rgba(22, 33, 29, 0.55);
  max-width: 560px;
  margin: 0.9rem auto 0;
}

/* ============================================
   PHOTOS
   ============================================
   Landscape and portrait shots are split into two separate grids instead
   of interleaving into one masonry column — mixing a wide short frame
   with a tall narrow one in the same row/column reads as an accident, not
   a layout. Each grid still lets its photos keep their natural aspect
   ratio (no forced crop). */
#photo-sections {
  background: var(--color-cream);
  padding: 0 1.5rem clamp(5rem, 10vw, 8rem);
}

.photo-section + .photo-section {
  margin-top: clamp(2.5rem, 6vw, 4rem);
}

.photo-section-label {
  display: block;
  font-family: var(--font-avenir);
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-weight: 600;
  color: rgba(22, 33, 29, 0.4);
  margin-bottom: 1.25rem;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.photo-section.is-visible .photo-section-label {
  opacity: 1;
  transform: translateY(0);
}

.photo-grid {
  display: grid;
  gap: 1.5rem;
}

.photo-grid-landscape {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 900px) {
  .photo-grid-landscape {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .photo-grid-landscape {
    grid-template-columns: 1fr;
  }
}

.photo-grid-portrait {
  grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr));
  gap: 1.25rem;
}

.photo-grid-landscape .photo-item {
  aspect-ratio: 3 / 2;
}

.photo-grid-portrait .photo-item {
  aspect-ratio: 3 / 4;
}

.photo-item {
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(22, 33, 29, 0.18);
  opacity: 0;
  transform: translateY(28px) scale(0.97);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.photo-item.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.photo-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.photo-item:hover img {
  transform: scale(1.03);
}

.photo-item {
  cursor: zoom-in;
}

/* ============================================
   PHOTO LIGHTBOX
   ============================================
   Two layouts, toggled by the JS-applied .has-description class on
   .photo-lightbox-content:
   - With a description: split layout — photo fills the left column at
     full viewport height, description sits in a beige panel on the right
     (see photo-text.jpg reference).
   - Without one: the photo alone, centered in the viewport. */
.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--color-dark);
  animation: photo-lightbox-fade 0.25s ease;
}

@keyframes photo-lightbox-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.photo-lightbox[hidden] {
  display: none;
}

.photo-lightbox-content {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.photo-lightbox-image {
  display: block;
  max-width: 100vw;
  max-height: 100vh;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* Split layout: photo left (full column height, aspect ratio always
   preserved — no cropping), description panel right. */
.photo-lightbox-content.has-description {
  justify-content: flex-start;
  align-items: stretch;
}

.photo-lightbox-content.has-description .photo-lightbox-image {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 68%;
  height: calc(100% - 20px);
  max-height: calc(100% - 20px);
  margin: 10px;
  /* contain (not cover) so no part of the photo is ever cropped — a photo
     whose aspect ratio doesn't match this column just leaves dark space
     around it rather than losing content off the edges. */
  object-fit: contain;
}

.photo-lightbox-description {
  flex: 0 0 auto;
  width: min(32%, 480px);
  height: 100%;
  display: flex;
  align-items: center;
  font-family: var(--font-avenir);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--color-cream);
  text-align: left;
  background: var(--color-dark);
  padding: clamp(2rem, 5vw, 4rem);
}

.photo-lightbox-description[hidden] {
  display: none;
}

@media (max-width: 800px) {
  .photo-lightbox-content.has-description {
    flex-direction: column;
    /* Image + text stack to their natural combined height below, which can
       exceed the viewport (e.g. a tall portrait photo plus a long
       description) — let the whole stack scroll rather than clipping or
       forcing the image into an arbitrary fixed height. */
    height: auto;
    max-height: 100%;
    overflow-y: auto;
  }

  .photo-lightbox-content.has-description .photo-lightbox-image {
    /* margin: 10px is inherited from the base rule — width must subtract
       it (20px total) or the box overflows past the right edge, clipping
       that margin off-screen instead of showing it. */
    max-width: calc(100% - 20px);
    width: calc(100% - 20px);
    /* Collapse to the photo's own aspect ratio instead of an arbitrary
       58% — the text should sit directly under the image, not wherever
       58% of the viewport happens to land. */
    height: auto;
    max-height: 60vh;
    flex: 0 0 auto;
  }

  .photo-lightbox-description {
    width: 100%;
    height: auto;
    flex: 0 0 auto;
    text-align: center;
    justify-content: center;
  }
}

.photo-lightbox-close {
  position: fixed;
  top: clamp(1rem, 3vw, 1.75rem);
  right: clamp(1rem, 3vw, 1.75rem);
  z-index: 3;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: var(--color-cream);
  color: var(--color-dark);
  font-size: 1.5rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.photo-lightbox-close:hover {
  background: var(--color-rust);
  color: var(--color-cream);
  transform: scale(1.05);
}

body.photo-lightbox-open {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
  overflow: hidden;
}

.photo-empty {
  text-align: center;
  font-family: var(--font-avenir);
  color: rgba(22, 33, 29, 0.6);
  padding: 4rem 1rem;
}

.photo-empty a {
  color: var(--color-rust);
}

@media (prefers-reduced-motion: reduce) {
  .photo-section-label,
  .photo-item {
    transition: opacity 0.3s ease;
    transform: none;
    opacity: 1;
  }
  .photo-item:hover img {
    transform: none;
  }
}
