/* public/styles/photos.css — owned by views/photos.js. Shared styles live in base.css (do not edit base.css from a view).
   Every selector is prefixed .photos- so it can't collide with other views. Mobile-first; desktop tweaks at the bottom. */

/* ---------- header ---------- */
.photos-back { display: inline-flex; align-items: center; gap: 6px; min-height: var(--touch); color: var(--muted); font-size: 0.92rem; }
.photos-back:hover { color: var(--accent); text-decoration: none; }
.photos-title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 14px; }
.photos-title-text { min-width: 0; }
.photos-title { margin-top: 2px; overflow-wrap: anywhere; }
.photos-summary { margin-top: 4px; }
.photos-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.photos-hint { font-size: 0.78rem; color: var(--muted); line-height: 1.35; }

/* ---------- poster slot (legacy squares) ---------- */
.photos-poster-slot {
  display: flex; align-items: center; gap: 14px 18px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.photos-poster-head { flex: 1 1 220px; min-width: 0; }
.photos-poster-note { font-size: 0.8rem; color: var(--muted); margin-top: 2px; max-width: 420px; }
.photos-poster-tiles { display: flex; gap: 10px; flex-wrap: wrap; }
.photos-poster-tiles .photo-tile-label { font-size: 0.72rem; color: var(--muted); }

/* ---------- year sections + grid ---------- */
.photos-year { margin-top: 18px; }
.photos-year-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.photos-year-head h2 { font-size: 1.2rem; }
.photos-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; align-items: start; }
.photos-cell { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.photos-cell .photo-tile-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photos-star { color: #f2c14e; font-size: 1rem; line-height: 1; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55); }

/* "+N" badge: visible pill ~30px, but the ::after pseudo-element gives it a ≥40px tap area */
.photos-extra-badge {
  position: absolute; top: 6px; right: 6px; z-index: 1;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 30px; padding: 0 9px; border-radius: var(--radius-pill);
  background: rgba(31, 42, 34, 0.82); color: #fff; font-size: 0.8rem; font-weight: 700; line-height: 1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.photos-extra-badge::after { content: ''; position: absolute; inset: -6px; }
.photos-extra-badge:hover, .photos-cell.is-expanded .photos-extra-badge { background: var(--accent); }
.photos-extras {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px;
  padding: 6px; background: var(--accent-soft); border-radius: var(--radius-sm);
}
.photos-extra-thumb { position: relative; aspect-ratio: 1 / 1; overflow: hidden; border-radius: 6px; background: var(--cell-nophoto); min-width: 0; }
.photos-extra-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photos-extra-thumb:hover { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---------- single view ---------- */
.photos-single { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
.photos-stage-col { min-width: 0; }
.photos-stage {
  position: relative; display: flex; align-items: center; justify-content: center;
  min-height: 200px; overflow: hidden;
  background: #ebe8df; border: 1px solid var(--line); border-radius: var(--radius);
  touch-action: pan-y pinch-zoom; -webkit-user-select: none; user-select: none;
}
.photos-stage-img { display: block; max-width: 100%; max-height: 68vh; width: auto; height: auto; object-fit: contain; -webkit-user-drag: none; }
.photos-stage-missing { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 40px; }
.photos-stage-missing .leaf-placeholder { width: 80px; height: 80px; border-radius: 50%; }
.photos-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 46px; height: 46px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.9); color: var(--ink); box-shadow: var(--shadow);
  transition: background 0.12s ease, opacity 0.12s ease;
}
.photos-arrow:hover { background: #fff; }
.photos-arrow:disabled { opacity: 0.28; }
.photos-arrow-prev { left: 8px; }
.photos-arrow-next { right: 8px; }
.photos-counter {
  position: absolute; top: 8px; left: 10px; padding: 3px 9px; border-radius: var(--radius-pill);
  background: rgba(31, 42, 34, 0.72); color: #fff; font-size: 0.75rem; font-weight: 600; line-height: 1.2;
}
.photos-strip { display: flex; gap: 6px; overflow-x: auto; padding: 8px 2px 4px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.photos-strip-thumb {
  flex: 0 0 auto; width: 56px; height: 56px; border-radius: var(--radius-sm); overflow: hidden;
  border: 2px solid transparent; opacity: 0.7; background: var(--cell-nophoto); transition: opacity 0.12s ease;
}
.photos-strip-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photos-strip-thumb:hover { opacity: 1; }
.photos-strip-thumb.is-active { border-color: var(--accent); opacity: 1; }

.photos-panel { display: flex; flex-direction: column; gap: 12px; }
.photos-date { font-family: var(--font-serif); font-size: 1.75rem; font-weight: 600; line-height: 1.15; }
.photos-date.is-undated { color: var(--warn); }
.photos-flags:empty { display: none; }
.photos-caption .field { font-size: 1rem; line-height: 1.4; }
.photos-caption .field-multiline { display: block; width: 100%; margin: 0; padding: 6px 6px; }
.photos-caption .field-textarea { width: 100%; }
.photos-actions { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--line); padding-top: 10px; }
.photos-action-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: var(--touch); }
.photos-action-row > .label { min-width: 52px; }
.photos-action-date { align-items: flex-start; }
.photos-action-date > .label { padding-top: 10px; }
.photos-date-editor { display: flex; flex-direction: column; gap: 8px; flex: 1 1 200px; min-width: 0; }
.photos-danger { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 4px; }

/* ---------- add-photos modal ---------- */
.photos-drop {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 104px; padding: 20px 14px; text-align: center; cursor: pointer;
  border: 2px dashed var(--line); border-radius: var(--radius); background: var(--bg); color: var(--accent-ink);
  transition: border-color 0.12s ease, background 0.12s ease;
}
.photos-drop:hover, .photos-drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.photos-drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.photos-files { display: flex; flex-wrap: wrap; gap: 10px 12px; margin-top: 12px; }
.photos-file { position: relative; width: 64px; display: flex; flex-direction: column; gap: 3px; }
.photos-file-img { width: 64px; height: 64px; border-radius: var(--radius-sm); object-fit: cover; background: var(--cell-nophoto); border: 1px solid var(--line); }
.photos-file-name { font-size: 0.65rem; color: var(--muted); text-align: center; }
.photos-file-remove {
  position: absolute; top: -7px; right: -7px; width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ink); color: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.photos-file-remove::after { content: ''; position: absolute; inset: -7px; }
.photos-form { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.photos-progress { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.photos-progress-bar { height: 100%; background: var(--accent); transition: width 0.2s ease; }

/* ---------- larger screens ---------- */
@media (min-width: 641px) {
  .photos-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
  .photos-extras { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .photos-stage { min-height: 280px; }
  .photos-stage-img { max-height: calc(100vh - var(--nav-h) - 170px); }
}
@media (min-width: 901px) {
  .photos-single { grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; }
  .photos-panel { position: sticky; top: calc(var(--nav-h) + 12px); }
}
@media (hover: none) {
  .photos-arrow:hover { background: rgba(255, 255, 255, 0.9); }
}
