.photos-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  padding: var(--space-4);
}

.polaroid-tile {
  cursor: pointer;
  transition: transform var(--transition-quick);
}
.polaroid-tile:active { transform: scale(0.97); }

.polaroid-tile__frame {
  background: #f1ece1;
  padding: 8px 8px 18px;
  border-radius: 4px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  transform: rotate(-1deg);
}
.polaroid-tile:nth-child(even) .polaroid-tile__frame {
  transform: rotate(1deg);
}

.polaroid-tile__photo {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--bg-card);
  margin-bottom: 6px;
  overflow: hidden;
  border-radius: 2px;
}
.polaroid-tile__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.polaroid-tile__placeholder {
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: #888;
  background: #2a2a2a;
}

.polaroid-tile__caption {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 11px;
  color: #2a2a2a;
  line-height: 1.2;
  text-align: center;
  padding: 0 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Photo viewer */
.photo-viewer {
  position: absolute;
  inset: 0;
  background: #000;
  display: flex;
  flex-direction: column;
  padding-top: var(--status-bar-height);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.photo-viewer::-webkit-scrollbar {
  display: none;
}

.photo-viewer__top {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  padding: var(--space-2) var(--space-4);
}

.photo-viewer__close {
  background: none;
  border: none;
  color: var(--accent-cyan);
  font-size: 28px;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-viewer__counter {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  text-align: center;
}

.photo-viewer__stage {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3);
  min-height: 320px;
}

.photo-viewer__photo-wrap {
  position: relative;
  max-width: 90%;
  max-height: 100%;
}

.photo-viewer__photo {
  max-width: 100%;
  max-height: 60dvh;
  display: block;
}

.photo-viewer__placeholder {
  width: 280px;
  height: 280px;
  background: var(--bg-card);
  border: 1px dashed var(--border);
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  border-radius: 8px;
}

.photo-viewer__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.04);
  border: none;
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  border-radius: 18px;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-viewer__nav--prev { left: 8px; }
.photo-viewer__nav--next { right: 8px; }

.photo-viewer__caption {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
  padding: var(--space-3) var(--space-5);
}

.photo-viewer__tells {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: 0 var(--space-5);
  /* Clear the floating Casebook button (~88px including home indicator + 16px gap)
     and the Vibe Jam badge (~50px) so the last clue stays fully visible. */
  padding-bottom: calc(var(--home-indicator-height) + env(safe-area-inset-bottom, 0px) + 200px);
}

.app-header__meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
}
