/* --- Base Page Setup (Light Theme) --- */
:root {
  --bg-color: #f8fafc;
  --surface-color: #ffffff;
  --primary-color: #2563eb;
  --border-color: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --border-radius: 8px;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* --- Header & Navigation --- */
.album-header, .site-header {
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
}

.back-link {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 1rem;
  transition: color 0.15s ease;
}

.back-link:hover {
  color: #1d4ed8;
  text-decoration: underline;
}

.album-description {
  color: var(--text-muted);
  max-width: 800px;
  font-size: 1.05rem;
}

/* --- Subcategory Grouping & Photo Grid --- */
.subcategory-group {
  margin-bottom: 3rem;
}

.subcategory-group h2 {
  font-size: 1.4rem;
  color: var(--text-main);
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 0.4rem;
  margin-bottom: 1.25rem;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

/* --- Photo Card --- */
.photo-card {
  background-color: var(--surface-color);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%; /* Stretches card to fill grid cell */
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.photo-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.photo-wrapper {
  position: relative; /* ADDED */
  aspect-ratio: 16 / 9;
  overflow: hidden;
  cursor: pointer;
  background-color: #f1f5f9;
}


.photo-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.photo-wrapper:hover img {
  transform: scale(1.04);
}

.photo-meta {
  padding: 1rem;
  font-size: 0.925rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1; /* Fills remaining card height */
}

.photo-card-date {
  align-self: flex-end;
  margin-top: 0.75rem; /* Pushes date to the bottom edge */
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background-color: #f1f5f9;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  line-height: 1;
}

.photo-card-date:empty {
  display: none;
}

.photo-description {
  margin: 0;
  color: var(--text-main);
  flex-grow: 1;
}

/* --- Lightbox Modal --- */
.lightbox {
  position: fixed;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.lightbox.active {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-content {
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
}

.lightbox-caption {
  margin-top: 1rem;
  color: var(--text-main);
  text-align: center;
  max-width: 700px;
  font-size: 0.95rem;
}

.lightbox-close {
  position: absolute;
  top: 1.25rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: var(--text-main);
  font-size: 2.25rem;
  cursor: pointer;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.15s ease;
}

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

/* ==========================================================================
   Album Index Cards & Grid Layout
   ========================================================================== */

/* Parent grid container rendered in album-index-page.html */
.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.75rem;
  padding: 1rem 0;
}

/* Individual Card Container */
.index-card {
  background-color: var(--card-bg, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
}

.index-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
}

/* Clickable Link Wrapper */
.index-card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
  text-decoration: none;
}

/* Image Aspect Ratio Wrapper */
.index-card-image-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background-color: #f1f5f9;
  overflow: hidden;
}

.index-card-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.index-card:hover .index-card-image-wrapper img {
  transform: scale(1.05);
}

/* Text Content Area */
.index-card-content {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.index-card-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  color: var(--heading-color, #1a202c);
  line-height: 1.3;
}

/* Multiline Text Body */
.index-card-description {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-muted, #64748b);
  margin: 0;
  
  /* Clamp descriptions to 3 lines to keep cards even */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
