

/* CSS Variables for theme */
:root {
  --primary-bg: #f8f9fa;
  --primary-fg: #222;
  --accent: #ba7e2e;
  --accent-light: #fcf9f5;
  --border-radius: 0.75rem;
  --card-shadow: 0 2px 8px rgba(0,0,0,0.08);
  --focus-outline: 2px solid var(--accent);
}

html, body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}
body {
  font-family: system-ui, sans-serif;
  background: var(--primary-bg);
  color: var(--primary-fg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  background: var(--accent);
  color: var(--accent-light);
  padding: 1.5rem 1rem 1rem 1rem;
  text-align: center;
  /* border-radius removed for a cleaner look */
  box-shadow: var(--card-shadow);
}

.site-header h1 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: 0.05em;
}

main {
  flex: 1 1 auto;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding-top: 1rem;
  padding-bottom: 1rem;
}


.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1.2rem;
  margin: 0 auto;
  padding-left: 1rem;
  padding-right: 1rem;
  width: 100%;
  box-sizing: border-box;
}

/* Add more space between album title and description */
.site-header h1 + .album-description {
  display: block;
  margin-top: 1.2em;
  margin-bottom: 0.5em;
  font-size: 1.1em;
}
/* Central play button overlay for modal video */
.modal-video-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(34, 34, 34, 0.7);
  border: none;
  border-radius: 50%;
  width: 4.5rem;
  height: 4.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  cursor: pointer;
  outline: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  transition: background 0.15s;
}
.modal-video-play-btn:focus {
  background: var(--accent);
  outline: var(--focus-outline);
}
.modal-video-play-icon {
  color: #fff;
  font-size: 2.5rem;
  pointer-events: none;
  margin-left: 0.15em;
}
/* Video thumbnail in gallery grid */
.gallery-video-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1/1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #222;
  border-radius: var(--border-radius);
  overflow: hidden;
}
.gallery-video-thumb .gallery-video-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--border-radius);
  display: block;
  background: #222;
}
.gallery-video-icon {
  position: absolute;
  bottom: 0.5em;
  right: 0.5em;
  background: rgba(25, 25, 25, 0.7);
  color: #fff;
  font-size: 1.7em;
  border-radius: 0.4em;
  padding: 0.1em 0.25em 0.1em 0.3em;
  pointer-events: none;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
/* Fallback icon for video thumbnail */
.gallery-video-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 3.5em;
  color: #1976d2;
  background: #e0e0e0;
  border-radius: var(--border-radius);
  opacity: 0.85;
  pointer-events: none;
  user-select: none;
}
/* Mobile detail view: fullscreen, black background, image centered, no scroll */
body.detail-body, .mobile-detail-view {
  background: #000 !important;
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.mobile-detail-view {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 99999;
  touch-action: none;
}
.mobile-detail-view img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  background: #000;
  display: block;
  margin: 0 auto;
  user-select: none;
  -webkit-user-drag: none;
}
/* Center and size video in mobile detail view like images */
.mobile-detail-view > video,
.mobile-detail-view > * > video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  background: #000;
  display: block;
  margin: 0 auto;
  user-select: none;
}
@media (max-width: 700px) {
  .photo-modal {
    align-items: stretch;
    justify-content: stretch;
    background: transparent !important;
    padding: 0;
  }
  .modal-image-container {
    max-width: 100vw;
    max-height: 100vh;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    background: transparent !important;
    justify-content: center;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 9999;
  }
  .modal-image-container img {
    max-width: 100vw;
    max-height: 100vh;
    width: 100vw;
    height: 100vh;
    object-fit: contain;
    border-radius: 0;
    box-shadow: none;
    background: #000;
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    margin: 0 auto;
    z-index: 10000;
  }
  .modal-caption,
  .modal-close,
  .modal-prev,
  .modal-next {
    display: none !important;
  }
}
/* Fullscreen Modal Styles */
.photo-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(34, 34, 34);
  transition: opacity 0.25s cubic-bezier(.4,0,.2,1);
  opacity: 1;
}
.photo-modal[hidden] {
  display: none !important;
  opacity: 0;
}
.modal-image-container {
  position: relative;
  max-width: 95vw;
  max-height: 95vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:rgba(34, 34, 34);
  border-radius: var(--border-radius);
  
}
.modal-image-container img {
  max-width: 95vw;
  max-height: 95vh;
  border-radius: var(--border-radius);
 
  background:rgba(34, 34, 34);
  display: block;
}
.modal-caption {
  display: none;
  margin-top: 0.75rem;
  color: var(--primary-fg);
  font-size: 1.1rem;
  text-align: center;
  word-break: break-word;
}
.modal-close {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  background: none;
  border: none;
  color: var(--accent-light);
  font-size: 2.2rem;
  cursor: pointer;
  z-index: 10;
  transition: color 0.15s;
}
.modal-close:hover,
.modal-close:focus {
  color: var(--accent);
  outline: var(--focus-outline);
}
.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(25, 118, 210, 0.12);
  border: none;
  color: var(--accent-light);
  font-size: 2.2rem;
  border-radius: 50%;
  width: 2.8rem;
  height: 2.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: background 0.15s, color 0.15s;
}
.modal-nav:focus,
.modal-nav:hover {
  background: var(--accent);
  color: var(--accent-light);
  outline: var(--focus-outline);
}
.modal-prev {
  left: 1.2rem;
}
.modal-next {
  right: 1.2rem;
}
@media (max-width: 700px) {
  .modal-image-container {
    max-width: 98vw;
    padding: 0.5rem 0.5rem 0.5rem 0.5rem;
  }
  .modal-image-container img {
    max-width: 96vw;
    max-height: 48vh;
  }
  .modal-close, .modal-prev, .modal-next {
    font-size: 1.5rem;
    width: 2.2rem;
    height: 2.2rem;
  }
}
.gallery-thumb:focus {
  outline: var(--focus-outline);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px var(--card-shadow);
  z-index: 2;
}
.gallery-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1/1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-light);
  border-radius: var(--border-radius);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.gallery-thumb .gallery-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--border-radius);
  display: block;
}

.gallery-img-error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.92);
  color: #b71c1c;
  font-size: 1rem;
  gap: 0.25em;
  padding: 0.5em;
  border-radius: var(--border-radius);
  z-index: 2;
  text-align: center;
}

.gallery-img-error-icon {
  font-size: 1.6em;
  margin-bottom: 0.1em;
  display: block;
}

.gallery-img-error-name {
  font-size: 0.95em;
  color: #b71c1c;
  margin-bottom: 0.2em;
  word-break: break-all;
}

.gallery-img-reload {
  font-size: 0.9em;
  padding: 0.15em 0.5em;
  border-radius: 0.5em;
  border: none;
  background: var(--accent-light);
  color: var(--accent);
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 0.1em;
}
.gallery-img-reload:hover,
.gallery-img-reload:focus {
  background: var(--accent);
  color: #fff;
  outline: var(--focus-outline);
}


@media (max-width: 900px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.9rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
}

@media (max-width: 700px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.7rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
}

@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.4rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
}

.gallery-loading {
  position: fixed;
  left: 50%;
  bottom: 4rem;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: var(--accent);
  font-size: 1.2rem;
  width: 100%;
  z-index: 2;
}

.gallery-img {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
  border-radius: var(--border-radius);
  box-shadow: var(--card-shadow);
  background: #e0e0e0;
  transition: transform 0.18s cubic-bezier(.4,0,.2,1), box-shadow 0.18s cubic-bezier(.4,0,.2,1);
  cursor: pointer;
  display: block;
}

.gallery-img:hover,
.gallery-img:focus {
  transform: scale(1.04) translateY(-2px);
  box-shadow: 0 4px 16px rgba(25, 118, 210, 0.18);
  outline: var(--focus-outline);
  outline-offset: 2px;
  z-index: 1;
}

.gallery-grid:focus {
  outline-offset: 2px;
}

.gallery-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: var(--accent);
  font-size: 1.2rem;
}

.gallery-spinner {
  width: 48px;
  height: 48px;
  border: 5px solid #e3f2fd;
  border-top: 5px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.site-footer {
  background: var(--accent-light);
  color: var(--primary-fg);
  text-align: center;
  padding: 1rem 0.5rem;
  border-top-left-radius: var(--border-radius);
  border-top-right-radius: var(--border-radius);
  box-shadow: var(--card-shadow);
  font-size: 1rem;
}

@media (max-width: 600px) {
  .site-header h1 {
    font-size: 1.3rem;
  }
  .site-footer {
    font-size: 0.95rem;
  }
}
