body.album {
  min-height: 100vh;
}

.album-header {
  padding: 48px 20px 36px;
  text-align: center;
  background: #f0e9df;
}

.album-header h1 {
  font-size: clamp(2rem, 7vw, 3.4rem);
  margin-bottom: 8px;
}

.album-header p {
  margin: 8px 0;
}

.album-header .album-kicker {
  color: var(--muted);
  font-size: .9rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.album main {
  max-width: 1280px;
}

.album main h2 {
  text-align: left;
}

.upload-panel {
  max-width: 680px;
  margin: 0 auto;
  padding: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.admin-photo-panel {
  max-width: 1080px;
}

.admin-photo-panel > div[hidden] {
  display: none;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 12px;
}

.admin-photo-panel .admin-filters label {
  margin-top: 0;
}

.admin-filters + .upload-hint {
  margin-top: 8px;
}

.admin-delete {
  background: #a12622;
}

.admin-photo-select {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 14px;
  cursor: pointer;
}

.upload-panel .admin-photo-select {
  display: flex;
  margin: 0;
}

.admin-photo-select input {
  width: 18px;
  height: 18px;
  accent-color: #a12622;
}

.upload-panel label {
  display: block;
  margin: 16px 0 6px;
  font-weight: 600;
}

.upload-panel label span,
.upload-hint {
  color: var(--muted);
  font-size: .9rem;
}

.upload-panel input[type="text"],
.upload-panel input[type="file"],
.upload-panel select,
.upload-panel textarea {
  display: block;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.upload-panel select {
  min-height: 44px;
}

.upload-panel [hidden] {
  display: none;
}

.upload-panel .status-error {
  color: #a12622;
}

.upload-panel textarea {
  resize: vertical;
}

.upload-hint {
  margin: 6px 0 18px;
}

#uploadAlbumStatus:empty {
  display: none;
}

.filter-label {
  display: block;
  font-weight: 600;
}

.album-filter {
  width: 100%;
  max-width: 360px;
  min-height: 44px;
  margin-top: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.upload-panel button:disabled,
.secondary-button:disabled {
  cursor: wait;
  opacity: .65;
}

.status-message {
  min-height: 1.5em;
}

.status-error {
  color: #a12622;
  font-weight: 600;
}

.gallery-section {
  padding-top: 48px;
}

.gallery-section > h2 {
  margin-bottom: 20px;
}

.gallery-section .status-message:empty {
  display: none;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 18px;
}

.photo-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 2px 8px rgb(43 43 43 / 5%);
  transition: transform .18s ease, box-shadow .18s ease;
}

.photo-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgb(43 43 43 / 12%);
}

.photo-preview-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.photo-preview-button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}

.photo-card img,
.photo-unavailable {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #eee8df;
  object-fit: cover;
}

.photo-unavailable {
  display: grid;
  place-items: center;
  padding: 16px;
  color: var(--muted);
  text-align: center;
}

.photo-card-copy {
  padding: 12px 14px;
}

.photo-card-copy p {
  margin: 4px 0;
  overflow-wrap: anywhere;
}

.photo-card-copy .photo-date {
  color: var(--muted);
  font-size: .8rem;
}

.gallery-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.gallery-filter {
  flex: 1 1 220px;
  max-width: 360px;
}

.gallery-filter .album-filter {
  max-width: none;
  margin-top: 4px;
}

.photo-caption {
  min-width: 0;
  flex: 1;
  margin: 0;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.download-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.download-button,
.photo-download {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.photo-preview {
  max-width: min(94vw, 1100px);
  max-height: 94vh;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
}

.photo-preview::backdrop {
  background: rgb(0 0 0 / 80%);
}

.download-choice {
  width: min(420px, 90vw);
  max-height: 90vh;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
}

.download-choice::backdrop {
  background: rgb(0 0 0 / 65%);
}

.download-choice h2 {
  font-size: 1.4rem;
}

.download-choice p {
  color: var(--muted);
}

.download-choice-actions {
  display: grid;
  gap: 10px;
}

.download-choice-actions .btn {
  min-height: 44px;
}

.preview-content {
  position: relative;
  padding: 48px 16px 12px;
  text-align: center;
}

.preview-content img {
  display: block;
  max-width: 100%;
  max-height: calc(94vh - 190px);
  width: auto;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
}

.preview-content img[hidden] {
  display: none;
}

.preview-content p {
  margin: 8px 0 0;
}

.preview-details {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
}

.preview-details > div {
  min-width: 0;
  overflow-wrap: anywhere;
}

.preview-content .preview-uploader {
  margin-top: 2px;
  color: var(--muted);
  font-size: .85rem;
}

.preview-content .preview-download-status {
  margin: 0;
  font-size: .85rem;
  text-align: left;
}

.preview-download-status:empty {
  display: none;
}

.preview-close {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

.download-button:not(:disabled):hover,
.photo-download:not(:disabled):hover {
  border-color: var(--accent);
  color: #80613a;
}

.download-button:disabled,
.photo-download:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.download-hint {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: .85rem;
  line-height: 1.5;
}

.photo-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 52px;
  padding: 4px 6px 4px 12px;
}

.photo-select {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  cursor: pointer;
}

.photo-select input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #278044;
}

.photo-download {
  display: grid;
  flex: 0 0 44px;
  place-items: center;
  width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.photo-download:not(:disabled):hover {
  background: #f0e9df;
}

.photo-download svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.photo-reference {
  font-size: .8rem;
  color: var(--muted);
}

.secondary-button {
  display: block;
  margin: 24px auto 0;
  background: #fff;
  border: 1px solid var(--accent);
  color: var(--accent);
}

.secondary-button[hidden] {
  display: none;
}

@media (max-width: 520px) {
  .upload-panel {
    padding: 18px;
  }

  .gallery-toolbar {
    align-items: stretch;
    flex-direction: column;
    padding: 12px;
  }

  .gallery-filter {
    flex: none;
    max-width: none;
  }

  .download-controls {
    justify-content: stretch;
  }

  .download-button {
    flex: 1 1 100%;
  }

  .photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}

@media (max-width: 280px) {
  .photo-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .photo-card {
    transition: none;
  }
}
