/* album.css */
:root {
  --text-dark: #3a3a3a;
  --bg-color: #faf9f6;
  --primary-color: #8c7356;
  --primary-hover: #725d45;
  --error-color: #d9534f;
  --font-serif: "Playfair Display", "Hina Mincho", serif;
  --font-sans: "Source Sans 3", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  color: var(--text-dark);
  line-height: 1.6;
}

.album-header {
  padding: 2rem 5%;
  text-align: center;
  position: relative;
}

.back-link {
  position: absolute;
  left: 5%;
  top: 2rem;
  color: var(--primary-color);
  text-decoration: none;
  font-size: 0.9rem;
  letter-spacing: 1px;
  transition: opacity 0.3s;
}
.back-link:hover {
  opacity: 0.7;
}

.lang-toggle {
  position: absolute;
  right: 5%;
  top: 1.5rem;
  border: 1px solid rgba(140, 115, 86, 0.4);
  background: rgba(255, 255, 255, 0.86);
  color: var(--primary-color);
  border-radius: 999px;
  padding: 0.55rem 1rem;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.lang-toggle:hover {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}

.album-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 2.5rem;
  letter-spacing: 2px;
  color: var(--primary-color);
}

.album-main {
  min-height: 80vh;
  padding: 2rem 5%;
}

/* Auth Section */
.auth-section {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
}
.auth-card {
  background: #fff;
  padding: 3rem 2.5rem;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.05);
  text-align: center;
  max-width: 400px;
  width: 100%;
}
.auth-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}
.auth-heading {
  font-family: var(--font-serif);
  font-weight: 500;
  margin-bottom: 0.5rem;
}
.auth-desc {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 2rem;
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.auth-form input {
  padding: 0.8rem 1rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
  text-align: center;
  transition: border-color 0.3s;
}
.auth-form input:focus {
  outline: none;
  border-color: var(--primary-color);
}
.submit-btn {
  padding: 0.8rem 1rem;
  background-color: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.3s;
}
.submit-btn:hover {
  background-color: var(--primary-hover);
}
.error-msg {
  color: var(--error-color);
  font-size: 0.85rem;
  margin-top: 1rem;
  min-height: 1.2em;
}

.hidden {
  display: none !important;
}

/* Gallery Section */
.loading {
  text-align: center;
  margin: 3rem 0;
  color: #666;
}
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(140, 115, 86, 0.2);
  border-left-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

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

.photo-item {
  position: relative;
  overflow: hidden;
  border: none;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
  background: #eee;
  aspect-ratio: 3 / 4;
  cursor: pointer;
  padding: 0;
  appearance: none;
  text-align: inherit;
}

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

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

/* Group Headers */
.photo-group {
  margin-bottom: 4rem;
}

.group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e0e0e0;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.group-title {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  color: var(--primary-color);
  text-transform: capitalize;
}

.group-actions {
  display: none;
}

.photo-item::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 3px solid transparent;
  transition: border-color 0.2s;
  pointer-events: none;
  border-radius: 8px;
}

.photo-item:hover::after {
  border-color: rgba(140, 115, 86, 0.35);
}

.photo-item:focus-visible::after {
  border-color: var(--primary-color);
}

.lightbox {
  position: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  inset: 0;
  padding: 2rem;
  background: rgba(21, 17, 13, 0.92);
  z-index: 2000;
}

.lightbox-stage {
  max-width: min(1100px, calc(100vw - 10rem));
  max-height: calc(100vh - 4rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.lightbox-image {
  max-width: 100%;
  max-height: calc(100vh - 8rem);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.35);
  background: rgba(255,255,255,0.06);
}

.lightbox-caption {
  color: rgba(255,255,255,0.82);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-align: center;
  word-break: break-word;
}

.lightbox-close,
.lightbox-nav {
  border: none;
  color: #fff;
  background: rgba(255,255,255,0.12);
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.lightbox-close:hover,
.lightbox-nav:hover {
  background: rgba(255,255,255,0.22);
  transform: translateY(-1px);
}

.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  font-size: 2rem;
  line-height: 1;
}

.lightbox-nav {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 999px;
  font-size: 2.25rem;
  flex-shrink: 0;
}

.lightbox-nav:disabled {
  opacity: 0.35;
  cursor: default;
  transform: none;
}

@media (max-width: 900px) {
  .group-header {
    align-items: flex-start;
  }

  .lightbox {
    padding: 1rem;
    gap: 0.75rem;
  }

  .lightbox-stage {
    max-width: calc(100vw - 6rem);
  }
}

@media (max-width: 640px) {
  .album-header {
    padding-top: 4.5rem;
  }

  .back-link {
    top: 1.25rem;
  }

  .lang-toggle {
    top: 1rem;
    right: 5%;
    padding: 0.45rem 0.85rem;
  }

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

  .group-title {
    font-size: 1.5rem;
  }

  .lightbox {
    display: grid;
    grid-template-columns: 3rem 1fr 3rem;
    align-items: center;
    padding: 1rem 0.5rem 1.5rem;
  }

  .lightbox-stage {
    max-width: calc(100vw - 7rem);
    max-height: calc(100vh - 7rem);
  }

  .lightbox-image {
    max-height: calc(100vh - 10rem);
  }

  .lightbox-close {
    top: 0.75rem;
    right: 0.75rem;
    width: 2.75rem;
    height: 2.75rem;
    font-size: 1.75rem;
  }

  .lightbox-nav {
    width: 3rem;
    height: 3rem;
    font-size: 2rem;
  }
}
