/* Photo attachments: journal day photos and kept-moment photos.
   Surfaces use theme tokens; night overrides below keep contrast on dark. */

.photo-section__copy {
  margin: 0 0 16px;
  color: var(--text-secondary);
  font-size: 14px;
}

.photo-add-button {
  margin: 0 0 16px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
}

.photo-empty {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
  font-style: italic;
}

.photo-thumb {
  position: relative;
  margin: 0;
  padding: 0;
}

.photo-thumb__view {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-muted);
  cursor: pointer;
  overflow: hidden;
}

.photo-thumb__view img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.photo-thumb__view:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.photo-thumb__delete {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgb(20 22 20 / 0.72);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.photo-thumb__delete:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.photo-view {
  margin: 0 0 8px;
}

.photo-view img {
  display: block;
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 10px;
  background: var(--surface-muted);
}

.photo-confirm-thumb {
  display: block;
  width: 120px;
  height: 120px;
  margin-top: 12px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
}

/* Night theme: keep thumbnails legible and the delete scrim visible on dark. */
:root[data-theme="night"] .photo-thumb__view {
  background: var(--surface);
  border-color: var(--border);
}

:root[data-theme="night"] .photo-thumb__delete {
  background: rgb(0 0 0 / 0.78);
}

:root[data-theme="night"] .photo-view img {
  background: var(--surface);
}

:root[data-theme="night"] .photo-section__copy,
:root[data-theme="night"] .photo-empty {
  color: var(--text-secondary);
}

/* System theme follows the OS; honor reduced motion for any transitions. */
@media (prefers-reduced-motion: reduce) {
  .photo-thumb__view,
  .photo-thumb__delete,
  .photo-add-button {
    transition: none;
  }
}
