* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  background: #fff;
  color: #111;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  position: relative;
  overflow-x: hidden;
}

/* Ensure smooth scrolling and proper viewport handling */
html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  min-height: 100dvh; /* Dynamic viewport height for mobile browsers */
}

/* ASCII Background Layer */
#ascii-bg {
  position: fixed;
  inset: 0;
  margin: 0;
  padding: 0;
  white-space: pre;
  line-height: 6px;
  font-size: 6px;
  user-select: none;
  pointer-events: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  color: #111;
  opacity: 0.55;
  filter: contrast(1.25);
  z-index: 0;
  overflow: hidden;
}

/* Main Photos Page */
.photos-page {
  width: 100%;
  /* Use viewport units with fallback - scales better across resolutions */
  padding: max(80px, 6vh) 20px max(70px, 8vh) 20px;
  /* Account for footer height to fit everything in viewport */
  min-height: calc(100vh - 80px); /* Account for footer */
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.0);
}

/* For very tall displays (like 2880x1920), add extra padding */
@media (min-height: 1800px) {
  .photos-page {
    padding-bottom: max(100px, 10vh);
  }
}

.photos-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  padding: 24px 20px;
  margin-bottom: 0;
  text-align: center;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  z-index: 10;
}

.photos-title {
  margin: 0;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.0);
}

.photos-header .back-button {
  position: absolute;
  left: 1%;
  top: 45%;
  background: rgba(255, 255, 255, 0.0);
}



/* Regenerate Background Button */
.regen-button {
  position: absolute;
  right: 1%;
  top: 35%; 
  border: 1px solid rgba(0, 0, 0, 0.6);
  background: rgba(0, 0, 0, 0.6);
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  color: #fff;
}

.regen-button:hover {
  background: rgba(0, 0, 0, 1);
  border-color: rgba(0, 0, 0, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.regen-button:active {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

/* Albums Grid - 3 columns */
.albums-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 40px;
  padding-top: 2em;
}

.album-card {
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  background: rgba(255, 255, 255, 0.8);
}

.album-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.album-thumbnail {
  width: 100%;
  height: 250px;
  object-fit: cover;
  display: block;
}

.album-title {
  margin: 0;
  padding: 16px;
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  text-transform: capitalize;
  background: rgba(0, 0, 0, 0.02);
}

.photos-footer {
  text-align: center;
  padding-top: 40px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

/* Album Modal (Level 1) - Shows grid of photos */
.album-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  z-index: 100;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 40px 20px;
}

.album-modal.active {
  display: flex;
}

.album-modal-content {
  position: relative;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 0px;
  padding: 40px;
  max-width: 1000px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.album-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(0, 0, 0, 0.5);
  color: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(0, 0, 0, 0.5);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.6;
  transition: all 0.2s;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.album-modal-close:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.1);
}

.album-modal-title {
  margin: 0 0 24px;
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  text-transform: capitalize;
}

/* Album Photos Grid - 3 columns */
.album-photos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.album-photo {
  cursor: pointer;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 2px;
  aspect-ratio: 1;
  transition: transform 0.2s, opacity 0.2s;
}

.album-photo:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

.album-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Photo Modal (Level 2) - Shows single full-size photo */
.photo-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.photo-modal.active {
  display: flex;
}

.photo-modal-content {
  position: relative;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 0px;
  padding: 40px;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  animation: modalSlideIn 0.3s ease-out;
}

.photo-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(0, 0, 0, 0.5);
  color: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(0, 0, 0, 0.5);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.6;
  transition: all 0.2s;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-modal-close:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.1);
}

.photo-viewer {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.photo-viewer-img {
  max-width: 100%;
  max-height: 70vh;
  height: auto;
  width: auto;
  display: block;
}

.photo-description {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  opacity: 0.85;
  max-width: 500px;
}

/* Footer Styles */
.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  border-top: 1px solid rgba(0, 0, 0, 0.10);
  padding: 18px 16px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  z-index: 10;
}

.footer__inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  opacity: 0.85;
}

.footer__links a {
  color: inherit;
  text-decoration: none;
  margin-left: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.25);
}

.footer__links a:hover {
  border-bottom-color: rgba(0, 0, 0, 0.6);
}

.footer__description {
  text-align: center;
  font-size: 12px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .photos-page {
    padding-bottom: 30vh;
  }

  .photos-header {
    padding: 16px;
  }

  .photos-header .back-button {
    position: static;
    transform: none;
    display: block;
    margin-bottom: 12px;
  }

  .regen-button {
    position: static;
    transform: none;
    display: block;
    width: 100%;
    margin-bottom: 12px;
  }

  .photos-title {
    font-size: 24px;
  }

  /* Stack albums on mobile */
  .albums-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .album-thumbnail {
    height: 200px;
  }

  /* Album modal adjustments */
  .album-modal {
    padding: 20px 10px;
  }

  .album-modal-content {
    padding: 30px 20px;
    max-height: 95vh;
  }

  /* 2 columns for photos on mobile */
  .album-photos-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  /* Photo modal adjustments */
  .photo-modal {
    padding: 20px 10px;
  }

  .photo-modal-content {
    padding: 30px 20px;
    max-height: 95vh;
  }

  .photo-viewer-img {
    max-height: 60vh;
  }

  .photo-description {
    font-size: 13px;
  }

  /* Footer adjustments for mobile 
  .footer__inner {
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }

  .footer__links {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .footer__links a {
    margin-left: 0;

  }
  */
}

/* Scale down for large/high-resolution displays (2K, 4K, Retina, etc.)
   This prevents footer cutoff and improves overall proportions on big screens */
@media (min-width: 2048px) {
  html {
    zoom: 0.9;
  }
}
