/* Photos (S06): O-09 with the design system's PhotoTile, photo toolbar and UploadRow (bundle.css §22), its toast,
   and G-02's viewer (Gallery README) */
.bh-photos-page { display: grid; gap: var(--space-4); min-width: 0; }
.bh-photos-count { display: grid; gap: var(--space-2); }
.bh-photos-count-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 var(--space-2); }
.bh-photos-count-row > p { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2); }
.bh-photos-count-row .bh-save-slot { flex: none; }
.bh-photos-add { display: grid; gap: var(--space-2); }
.bh-photos-add.is-empty { justify-items: center; gap: var(--space-3); padding: var(--space-6) var(--space-4); text-align: center; background: var(--card); border: 2px dashed var(--border-input); border-radius: var(--radius-card); }
.bh-photos-medal { display: grid; place-items: center; width: 56px; height: 56px; border-radius: var(--radius-pill); background: var(--primary-soft); color: var(--primary); }
.bh-photos-uploads { display: grid; gap: var(--space-4); }
.bh-photos-uploads:empty { display: none; }
.bh-photos-tips { display: grid; gap: var(--space-3); }
.bh-photos-tips ul { display: grid; gap: var(--space-2); margin: 0; padding-left: var(--space-5); font-size: var(--text-small); line-height: var(--leading-small); }
.bh-photos-refused { display: flex; align-items: center; gap: var(--space-2); color: var(--danger-ink); }
.bh-photos-dismiss { display: flex; justify-content: flex-end; padding-top: var(--space-1); border-top: 1px solid var(--line); }
.bh-photos-caption { display: grid; gap: var(--space-2); justify-items: start; }
.bh-photos-caption > .bh-input { width: 100%; }
.bh-progress.is-paused::-webkit-progress-value { background: var(--ink-3); }
.bh-progress.is-paused::-moz-progress-bar { background: var(--ink-3); }

/* The photo toolbar takes the tab bar's place on phones while a photo is selected (PhotoTile README). */
.bh-shell:has(.bh-photo-toolbar) .bh-tabbar { display: none; }
.bh-shell:has(.bh-photo-toolbar) .bh-main { padding-bottom: 0; }

.bh-photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
@media (min-width: 1024px) { .bh-photo-grid { grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: var(--space-4); } }
.bh-photo-tile {
  -webkit-appearance: none; appearance: none;
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-1);
  width: 100%; aspect-ratio: 1; min-height: var(--target-min); margin: 0; padding: 0;
  border: 0; border-radius: var(--radius-control); background: var(--sunken); color: var(--ink-3);
  font-family: inherit; overflow: hidden; cursor: pointer;
}
.bh-photo-tile > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.bh-photo-num { position: absolute; left: var(--space-2); top: var(--space-2); z-index: 1; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-1); min-width: 24px; height: 24px; padding: 0 var(--space-2); border-radius: var(--radius-pill); background: var(--surface-inverse); color: var(--on-inverse); font-size: var(--text-label); line-height: var(--leading-label); font-weight: var(--weight-bold); font-variant-numeric: tabular-nums; }
.bh-photo-num--cover { top: auto; left: 0; right: 0; bottom: 0; height: 28px; border-radius: 0 0 var(--radius-control) var(--radius-control); }
.bh-photo-tick { position: absolute; right: var(--space-2); top: var(--space-2); z-index: 1; display: none; place-items: center; width: 24px; height: 24px; border-radius: var(--radius-pill); background: var(--primary); color: var(--on-primary); box-shadow: 0 0 0 2px var(--card); }
.bh-photo-tile[aria-pressed="true"]::after { content: ""; position: absolute; inset: 0; z-index: 1; border: 4px solid var(--primary); border-radius: inherit; pointer-events: none; }
.bh-photo-tile[aria-pressed="true"] .bh-photo-tick { display: grid; }
.bh-photo-tile.is-processing { padding-top: var(--space-4); border: 1px dashed var(--border-input); color: var(--ink-2); font-size: var(--text-label); line-height: var(--leading-label); font-weight: var(--weight-bold); }
.bh-photo-tile.is-processing:has(.bh-photo-num--cover) { padding: 0 0 28px; } /* clear of the cover strip */

.bh-photo-toolbar { position: sticky; bottom: 0; z-index: 3; display: grid; gap: var(--space-2); margin: 0 calc(var(--page-pad) * -1); padding: var(--space-2) var(--page-pad) calc(var(--space-3) + env(safe-area-inset-bottom, 0px)); background: var(--card); border-top: 1px solid var(--line); }
.bh-photo-toolbar-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); font-size: var(--text-small); line-height: var(--leading-small); }
/* 2 × 2: four in a row clip Georgian (გარეკანად დაყენება) at 360 px */
.bh-photo-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
.bh-photo-action {
  -webkit-appearance: none; appearance: none;
  display: flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-width: 0; min-height: 48px; margin: 0; padding: var(--space-2);
  border: 1px solid var(--border-input); border-radius: var(--radius-control); background: var(--card); color: var(--ink-1);
  font-family: inherit; font-size: var(--text-small); line-height: var(--leading-small); font-weight: var(--weight-bold); text-align: center; overflow-wrap: break-word; cursor: pointer;
}
.bh-photo-action:hover { background: var(--sunken); }
.bh-photo-action--delete { border-color: var(--danger-ink); color: var(--danger-ink); }
.bh-photo-action[aria-disabled="true"] { border-color: var(--disabled-bg); background: var(--disabled-bg); color: var(--disabled-ink); cursor: not-allowed; }
@media (min-width: 1024px) {
  .bh-photo-toolbar { position: static; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0; padding: var(--space-3) var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-card); }
  .bh-photo-toolbar-head { display: contents; }
  .bh-photo-toolbar-head > p { flex: 1 1 200px; min-width: 0; }
  .bh-photo-toolbar-head > .bh-btn { order: 2; }
  .bh-photo-actions { order: 1; display: flex; flex-wrap: wrap; gap: var(--space-2); }
  .bh-photo-action { min-height: var(--target-min); padding: var(--space-2) var(--space-4); }
  .bh-photo-toolbar > .bh-reason { order: 3; flex-basis: 100%; }
}

.bh-uploads { display: grid; margin: 0; padding: 0; list-style: none; }
.bh-upload { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) 0; border-top: 1px solid var(--line); }
.bh-upload.is-refused { align-items: flex-start; }
.bh-upload-thumb { display: grid; place-items: center; flex: none; width: 48px; height: 48px; border-radius: var(--radius-control); background: var(--sunken); color: var(--ink-3); overflow: hidden; }
.bh-upload-body { flex: 1 1 auto; min-width: 0; display: grid; gap: var(--space-1); }
.bh-upload-head { display: flex; align-items: center; gap: var(--space-1); min-height: var(--target-min); }
.bh-upload-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-small); line-height: var(--leading-small); font-weight: var(--weight-bold); }
.bh-upload-status { color: var(--ink-2); font-size: var(--text-small); line-height: var(--leading-small); font-variant-numeric: tabular-nums; }
.bh-upload.is-done .bh-upload-status { color: var(--success-ink); font-weight: var(--weight-bold); }
.bh-upload.is-failed .bh-upload-status { color: var(--danger-ink); font-weight: var(--weight-bold); }
.bh-upload-meta { color: var(--ink-3); font-size: var(--text-small); line-height: var(--leading-small); font-variant-numeric: tabular-nums; }
.bh-upload-why { color: var(--danger-ink); font-size: var(--text-small); line-height: var(--leading-small); font-weight: var(--weight-bold); }
.bh-upload-fix { color: var(--ink-2); font-size: var(--text-small); line-height: var(--leading-small); }
.bh-upload-card { display: grid; gap: var(--space-2); padding: var(--space-4) var(--space-4) var(--space-1); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-card); }
.bh-upload-card.is-refused { border: 2px solid var(--danger-ink); padding: calc(var(--space-4) - 1px) calc(var(--space-4) - 1px) var(--space-1); }

/* The toast with Undo, above the tab bar */
.bh-toast-region { position: fixed; left: var(--page-pad); right: var(--page-pad); bottom: calc(var(--shell-tabbar-h) + var(--space-2) + env(safe-area-inset-bottom, 0px)); z-index: 20; display: grid; justify-items: center; pointer-events: none; }
.bh-toast { display: flex; align-items: center; gap: var(--space-3); width: fit-content; max-width: 480px; padding: var(--space-1) var(--space-1) var(--space-1) var(--space-4); border-radius: var(--radius-card); background: var(--surface-inverse); color: var(--on-inverse); box-shadow: var(--shadow-overlay); pointer-events: auto; }
.bh-toast-action { background: transparent; border-color: var(--on-inverse); color: var(--on-inverse); }
.bh-toast-action:hover { background: var(--ink-2); color: var(--on-inverse); }
.bh-toast-action:focus-visible { box-shadow: var(--focus-ring-inverse); }
@media (min-width: 1024px) { .bh-toast-region { bottom: var(--space-6); } }

/* G-02's viewer: a full-screen dialog over the list, with Previous and Next in words (Gallery README) */
.bh-photos-list a { display: block; }
.bh-viewer { width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: var(--space-2) var(--space-2) var(--space-4); border: 0; background: var(--surface-inverse); color: var(--on-inverse); }
.bh-viewer[open] { display: grid; grid-template-rows: auto 1fr auto; gap: var(--space-3); }
.bh-viewer::backdrop { background: var(--surface-inverse); }
.bh-viewer-head { display: flex; align-items: center; justify-content: space-between; padding-left: var(--space-2); font-variant-numeric: tabular-nums; }
.bh-viewer-head .bh-icon-btn { color: var(--on-inverse); }
.bh-viewer-stage { display: grid; place-items: center; min-height: 0; }
.bh-viewer-stage > img { max-width: 100%; max-height: 100%; object-fit: contain; }
.bh-viewer-foot { display: flex; justify-content: space-between; gap: var(--space-2); padding: 0 var(--space-2); }
.bh-viewer-foot > .bh-btn { background: transparent; border-color: var(--on-inverse); color: var(--on-inverse); }
.bh-viewer-foot > .bh-btn[aria-disabled="true"] { border-color: var(--ink-2); color: var(--disabled-bg); }
.bh-viewer :focus-visible { box-shadow: var(--focus-ring-inverse); }
