@import url('https://fonts.googleapis.com/css2?family=Unbounded:wght@400;500;600&display=swap');

/* Album Grid Page Styles */
body {
  margin: 0;
  font-family: 'Unbounded', sans-serif;
  background: #161616;
  color: #fff;
}

/* Album Grid Container */
.album-grid-container {
  min-height: 100vh;
  padding: 0;
}

/* Album Header */
.album-header {
  position: sticky;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 30px;
  background: #181818;
  border-bottom: 2px solid #222;
  top: 0;
  z-index: 10;
}

.back-btn {
  position: absolute;
  left: 30px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 1px solid #444;
  color: #fff;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.3s;
}

.back-btn:hover {
  background: #333;
  border-color: #666;
}

#album-title {
  padding-left: 0;
  font-size: 1.8rem;
  font-weight: 300;
  margin: 0;
  text-align: center;
  font-family: 'Unbounded', sans-serif;
  letter-spacing: 0.02em;
}

h1 {
  text-align: left;
  padding-left: 15rem;
  margin-bottom: 1.2rem;
  margin-left: 0.5rem; /* Fixed typo */
  font-family: 'Unbounded', sans-serif;
  font-size: 2.5rem;
  font-weight: 530;
  letter-spacing: 0.01em;
}

@media (max-width: 900px) {
  h1 {
    padding-left: 4rem; /* Reduce padding for tablets */
    margin-left: 0.5rem;
    font-size: 2rem;
  }
}

@media (max-width: 600px) {
  h1 {
    padding-left: 0.7rem; /* Minimal padding for mobile */
    margin-left: 0;
    font-size: 2rem;
  }
}

/* Album Grid - Masonry Style */
.album-grid {
  column-count: 4;
  column-gap: 20px;
  padding: 30px;
  max-width: 1400px;
  margin: 0 auto;
}

.album-grid img {
  width: 90%; /* Reduced from 100% to 90% */
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  margin: 0 auto 20px auto; /* Center the image within its column */
  break-inside: avoid;
  display: block;
}

.album-grid img:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* Responsive column count */
@media (max-width: 1200px) {
  .album-grid {
    column-count: 3;
  }
}

@media (max-width: 900px) {
  .album-grid {
    column-count: 2;
    column-gap: 15px;
    padding: 20px;
  }
  
  .album-grid img {
    margin-bottom: 15px;
  }
}

@media (max-width: 600px) {
  .album-grid {
    column-count: 2;
    column-gap: 12px;
    padding: 15px;
  }
  
  .album-grid img {
    margin-bottom: 12px;
  }
}

/* Photo Viewer Styles */
.viewer-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #000;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.viewer-image-block {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}

.viewer-image-block img,
#viewer-image {
  max-width: 95vw;
  max-height: 95vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s ease;
  cursor: pointer;
}

#viewer-image:hover {
  transform: scale(1.02);
}

/* Close Button */
.close-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.14);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s, transform 0.2s;
}

.close-btn-label {
  display: none;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

/* Navigation buttons */
.nav-button {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  width: 60px;
  height: 80px;
  font-size: 1.8rem;
  cursor: pointer;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s, opacity 0.3s;
  opacity: 0.7;
}

.nav-button:hover {
  background: rgba(0, 0, 0, 0.8);
  opacity: 1;
}

#prev-btn {
  left: 20px;
  border-radius: 0 8px 8px 0;
}

#next-btn {
  right: 20px;
  border-radius: 8px 0 0 8px;
}

/* Image counter */
.image-counter {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  z-index: 100;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .album-header {
    padding: 15px 20px;
  }

  .back-btn {
    left: 20px;
  }
  
  #album-title {
    font-size: 1.4rem;
  }
  
  /* Mobile styles are now handled above */
  
  .close-btn {
    top: calc(72px + env(safe-area-inset-top, 0px));
    right: calc(12px + env(safe-area-inset-right, 0px));
    width: auto;
    min-width: 44px;
    height: 44px;
    padding: 0 0.95rem;
    border-radius: 999px;
    gap: 0.45rem;
    font-size: 1.1rem;
    background: rgba(0, 0, 0, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.16);
    z-index: 1200;
  }

  .close-btn-label {
    display: inline;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    line-height: 1;
  }
  
  .nav-button {
    width: 50px;
    height: 70px;
    font-size: 1.5rem;
  }
  
  #prev-btn {
    left: 10px;
  }
  
  #next-btn {
    right: 10px;
  }
  
  .viewer-image-block img,
  #viewer-image {
    max-width: 98vw;
    max-height: 90vh;
  }

  /* Touch-friendly navigation areas */
  .touch-nav {
    position: absolute;
    top: 0;
    width: 30%;
    height: 100%;
    z-index: 25;
    cursor: pointer;
  }
  
  .touch-nav.prev {
    left: 0;
  }
  
  .touch-nav.next {
    right: 0;
  }
}

/* Loading state */
.album-grid.loading {
  column-count: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 400px;
}

.album-grid.loading::after {
  content: 'Loading photos...';
  color: #999;
  font-size: 1.1rem;
}

/* Album Card */
.photo-card {
  background: #181818;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  text-align: center;
  padding: 8px;
  transition: transform 0.2s;
}

.photo-card:hover {
  transform: scale(1.02);
}

.photo-card img {
  width: 100%;
  height: auto;
  aspect-ratio: 1/1;
  object-fit: cover;
  border-radius: 4px;
  display: block;
  margin: 0 auto;
}

.album-card {
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  text-align: left; /* Align content inside the card to the left */
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start; /* Align content inside the card to the left */
  max-width: 100%;
  margin-bottom: 2rem; /* Add spacing below the card */
  position: relative; /* Make title positioning relative to this */
}

.album-card:hover {
  transform: scale(1.025);
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
}
.album-card img {
  width: 100%;
  max-width: 900px;
  aspect-ratio: auto 3902 / 3177;
  height: auto;
  display: block;
  margin-left: 0;   /* Remove auto margin */
  margin-right: 0;  /* Remove auto margin */
  border-radius: 10px;
  object-fit: contain;
  background: transparent;
  box-shadow: 0 2px 12px rgba(0,0,0,0.10);
}

/* Album Title */
.title, .album-title {
  margin-top: 2rem;   /* Space between image and title */
  margin-left: 0;       /* Align with image edge */
  font-size: 1.3rem;
  color: rgb(255, 255, 255);
  font-weight: 525;
  font-family: 'Unbounded', sans-serif;
  line-height: 1.4;
  letter-spacing: 0.01em;
  text-shadow: none;
  background: none;
  text-align: left;
  position: static;
  width: 100%;
  max-width: 532px;     /* Match image width */
}

/* Viewer Layout */
.viewer-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background-color: #000;
}

.viewer-image-block {
  position: relative;
  max-width: 90%;
  max-height: 90vh;
  overflow: hidden;
}

.viewer-image-block img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
}

.overlay-title {
  position: absolute;
  bottom: 10%;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-size: 2rem;
  text-align: center;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.7);
}

@media (max-width: 600px) {
  .album-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .photo-card {
    padding: 4px;
  }
  .photo-card img {
    aspect-ratio: 1/1;
    height: auto;
    min-width: 0;
    min-height: 0;
  }
  .title {
    font-size: 2rem;
    padding: 0.3em 0;
  }
}

/* Photographer Portfolio (Joel / Javi) */
.portfolio-page {
  --portfolio-border: rgba(255, 255, 255, 0.12);
  --portfolio-panel: #1a1a1a;
  --portfolio-panel-soft: #111111;
  --portfolio-text-soft: rgba(255, 255, 255, 0.7);
  width: min(1480px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 32px 0 72px;
}

.portfolio-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2.75rem;
  min-height: 52px;
}

.portfolio-page h1 {
  padding: 0;
  margin: 0;
  font-family: 'Unbounded', sans-serif;
  font-size: clamp(2.35rem, 4vw, 3.7rem);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.portfolio-menu-wrap {
  position: fixed;
  right: 24px;
  top: 24px;
  transform: none;
  z-index: 2000;
  pointer-events: auto;
}

.portfolio-menu-btn {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 1px solid var(--portfolio-border);
  background: var(--portfolio-panel);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  position: relative;
  z-index: 2001;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.portfolio-menu-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.3);
  background: #242424;
}

.portfolio-menu-btn.is-active {
  background: #f0f0f0;
  border-color: rgba(255, 255, 255, 0.6);
}

.portfolio-menu-btn.is-active span {
  background: #121212;
}

.portfolio-menu-btn span {
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: #fff;
  display: block;
}

.portfolio-menu-panel {
  position: fixed;
  top: 88px;
  right: 24px;
  width: min(260px, calc(100vw - 32px));
  padding: 12px;
  border: 1px solid var(--portfolio-border);
  border-radius: 22px;
  background: rgba(17, 17, 17, 0.98);
  box-shadow: 0 24px 44px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(14px);
  display: grid;
  align-content: start;
  gap: 8px;
  z-index: 30;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-8px) scale(0.98);
  transform-origin: top right;
  transition: transform 0.22s ease, opacity 0.18s ease, visibility 0.18s ease;
}

.portfolio-menu-link[hidden] {
  display: none !important;
}

.portfolio-menu-panel.is-open {
  transform: translateY(0) scale(1);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.portfolio-menu-link {
  width: 100%;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0.8rem 0.95rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: #fff;
  text-decoration: none;
  font-family: 'Unbounded', sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.portfolio-menu-link:hover {
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.09);
  transform: translateY(-1px);
}

.portfolio-menu-socials {
  display: grid;
  gap: 8px;
}

.portfolio-home-link {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  color: #e7e7e7;
  text-decoration: none;
  border: 1px solid var(--portfolio-border);
  border-radius: 999px;
  padding: 0.65rem 1.05rem;
  font-size: 0.95rem;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.portfolio-home-link:hover {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.04);
}

.projects-section,
.photo-grid-section {
  margin-bottom: 3rem;
}

.portfolio-about-section {
  margin-top: 1rem;
  padding: 1.4rem 1.35rem 1.5rem;
  border: 1px solid var(--portfolio-border);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
}

.portfolio-socials-section {
  margin-top: 1rem;
  padding: 1.4rem 1.35rem 1.5rem;
  border: 1px solid var(--portfolio-border);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
}

.portfolio-about-card {
  margin-top: 1rem;
  padding: 1.6rem 1.4rem 1.7rem;
  border: 1px solid var(--portfolio-border);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
}

.portfolio-about-copy {
  margin: 0;
  max-width: 72ch;
  color: var(--portfolio-text-soft);
  line-height: 1.8;
  font-size: 0.92rem;
}

.portfolio-about-copy.is-placeholder,
.portfolio-empty-note {
  color: rgba(255, 255, 255, 0.62);
}

.portfolio-socials-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.portfolio-social-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.05rem;
  border-radius: 18px;
  border: 1px solid var(--portfolio-border);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  text-decoration: none;
  font-size: 0.82rem;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.portfolio-social-card:hover {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.15rem;
}

.projects-section h2,
.photo-grid-section h2,
.portfolio-socials-section h2,
.portfolio-about-card h2 {
  margin: 0;
  font-size: clamp(1.35rem, 2vw, 1.85rem);
  font-weight: 600;
  font-family: 'Unbounded', sans-serif;
}

.project-controls {
  display: flex;
  gap: 0.6rem;
}

.project-nav-btn {
  width: 2.9rem;
  height: 2.9rem;
  border-radius: 999px;
  border: 1px solid var(--portfolio-border);
  background: var(--portfolio-panel);
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}

.project-nav-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.3);
  background: #242424;
}

.project-nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.projects-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(250px, 27vw);
  gap: 1rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-behavior: smooth;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  padding: 0.1rem 0 0.8rem;
}

.projects-track::-webkit-scrollbar {
  display: none;
}

.project-card {
  background: var(--portfolio-panel-soft);
  border: 1px solid var(--portfolio-border);
  border-radius: 20px;
  overflow: hidden;
  color: inherit;
  text-align: left;
  cursor: pointer;
  padding: 0;
  min-height: 320px;
  scroll-snap-align: start;
  box-shadow: 0 22px 40px rgba(0, 0, 0, 0.22);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.project-card:hover,
.project-card:focus-visible {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.24);
  box-shadow: 0 28px 52px rgba(0, 0, 0, 0.32);
  outline: none;
}

.project-card-media {
  aspect-ratio: 4 / 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem;
  background: #0c0c0c;
}

.project-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.project-card h3 {
  margin: 0;
  padding: 1rem 1rem 1.25rem;
  font-size: 1rem;
  font-weight: 500;
  font-family: 'Unbounded', sans-serif;
  letter-spacing: 0.015em;
  text-align: center;
}

.portfolio-masonry-grid {
  column-count: 4;
  column-gap: 1rem;
}

.masonry-photo {
  display: block;
  width: 100%;
  margin: 0 0 1rem;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  break-inside: avoid;
  border-radius: 18px;
  overflow: hidden;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.masonry-photo:hover,
.masonry-photo:focus-visible {
  transform: translateY(-2px);
  outline: none;
}

.masonry-photo img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 18px;
  background: #0f0f0f;
}

.section-status {
  color: var(--portfolio-text-soft);
  margin: 0;
  padding: 1.4rem 0;
  font-size: 0.98rem;
}

@media (max-width: 1024px) {
  .portfolio-masonry-grid {
    column-count: 3;
  }

  .projects-track {
    grid-auto-columns: minmax(260px, 46%);
  }
}

@media (max-width: 768px) {
  .portfolio-page {
    width: min(96vw, 760px);
    padding-top: 24px;
  }

  .portfolio-header {
    margin-bottom: 2rem;
    min-height: auto;
    padding-top: 4.35rem;
  }

  .project-controls {
    display: none;
  }

  .portfolio-home-link {
    top: 0;
    left: 0;
    transform: none;
  }

  .portfolio-menu-wrap {
    right: 16px;
    top: 16px;
    transform: none;
  }

  .portfolio-menu-panel {
    top: 76px;
    right: 16px;
  }

  .projects-track {
    grid-auto-columns: minmax(240px, 76vw);
    gap: 0.8rem;
    padding-bottom: 0.35rem;
  }

  .portfolio-masonry-grid {
    column-count: 2;
    column-gap: 0.75rem;
  }

  .masonry-photo {
    margin-bottom: 0.75rem;
  }
}

@media (max-width: 460px) {
  .portfolio-page {
    width: min(100vw, 100%);
    padding: 18px 16px 48px;
  }

  .portfolio-header {
    padding-top: 3rem;
  }

  .projects-track {
    grid-auto-columns: minmax(220px, 84vw);
  }

  .portfolio-masonry-grid {
    column-count: 2;
    column-gap: 0.65rem;
  }

  .project-card {
    min-height: 280px;
  }

  .masonry-photo {
    margin-bottom: 0.65rem;
    border-radius: 14px;
  }

  .masonry-photo img {
    border-radius: 14px;
  }

  .portfolio-menu-btn {
    width: 48px;
    height: 48px;
  }

  .portfolio-about-section {
    border-radius: 20px;
    padding: 1.1rem 1rem 1.2rem;
  }
}
