:root {
  --bg: #17161a;
  --text: #ece7dd;
  --text-muted: #9b968d;
  --arrow-bg: rgba(0, 0, 0, 0.32);
  --arrow-bg-hover: rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Helvetica Neue", Arial, sans-serif;
}

.photo-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.photo-frame {
  position: relative;
  width: 100%;
  max-width: 900px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-block {
  display: inline-block; /* shrinks to the rendered image's own width */
  max-width: 100%;
}

.photo {
  display: block;
  width: 100%;
  height: auto;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 2px;
}

.photo-counter {
  margin: 0.15rem 0 0;
  padding: 0;
  font-size: 0.82rem;
  font-style: italic;
  color: rgba(155, 150, 141, 0.85); /* same family as --text-muted, slightly lighter */
  text-align: right; /* flush with photo-block's right edge = image's right edge */
}

.photo-missing {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--arrow-bg);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background 0.15s ease;
}

.nav-arrow:hover,
.nav-arrow:focus-visible {
  background: var(--arrow-bg-hover);
}

.nav-arrow:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.nav-prev {
  left: 10px;
}

.nav-next {
  right: 10px;
}

.caption {
  max-width: 640px;
  margin: 0.5rem auto 0;
  padding: 0 0.5rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-muted);
  white-space: pre-wrap;   /* preserve double-spaces and pipes as typed in IPTC */
  text-align: left;
}

.caption-copyright {
  max-width: 640px;
  margin: 0.35rem auto 0;
  padding: 0 0.5rem;
  font-size: 0.78rem;
  line-height: 1.5;
  color: rgba(155, 150, 141, 0.6);
  text-align: center;
}

@media (max-width: 480px) {
  .nav-arrow {
    width: 40px;
    height: 40px;
  }
  .caption {
    font-size: 0.85rem;
  }
}
