/* ==========================================================================
   Promotion photos (promotions.image1..3). functions_promophotos.php.
   - .bc-pp  mosaic per belt on the profile's promotion history; the tiles are
             .bc-gallery-tile so the shared lightbox (scripts/bc-gallery.js) opens them
   - .bc-pu  photo uploader in the belt sheet (edit profile, promotion history)
   Tokens come from styles/modern.css.
   ========================================================================== */

/* ---------- Profile mosaic ---------- */
.bc-pp {
  display: grid;
  gap: 6px;
  width: 100%;
  max-width: 560px;
  margin: 2px auto 6px;
  text-align: left;
}
.bc-pp .bc-pp-tile { aspect-ratio: auto; border-radius: 12px; min-height: 0; }
.bc-pp--1 { grid-template-columns: minmax(0, 1fr); }
.bc-pp--1 .bc-pp-tile { aspect-ratio: 4 / 3; }
.bc-pp--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.bc-pp--2 .bc-pp-tile { aspect-ratio: 4 / 5; }
/* Three: a large lead photo, two stacked beside it */
.bc-pp--3 {
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  grid-template-rows: repeat(2, minmax(0, 1fr));
  aspect-ratio: 3 / 2;
}
.bc-pp--3 .bc-pp-tile:first-child { grid-row: span 2; }
/* Outer corners a little rounder than the inner ones */
.bc-pp--1 .bc-pp-tile { border-radius: 16px; }
.bc-pp--2 .bc-pp-tile:first-child, .bc-pp--3 .bc-pp-tile:first-child { border-radius: 16px 8px 8px 16px; }
.bc-pp--2 .bc-pp-tile:last-child { border-radius: 8px 16px 16px 8px; }
.bc-pp--3 .bc-pp-tile:nth-child(2) { border-radius: 8px 16px 8px 8px; }
.bc-pp--3 .bc-pp-tile:nth-child(3) { border-radius: 8px 8px 16px 8px; }
.bc-pp .bc-pp-tile img { background: var(--bc-surface-3); }
/* Scale hint on the lead tile for mouse users */
.bc-pp a.bc-pp-tile::after {
  content: "\f065"; /* fa-expand */
  font: var(--fa-font-solid, 900 1em "Font Awesome 6 Free");
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 12px;
  color: #fff;
  background: rgba(11, 11, 16, 0.5);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.2s var(--bc-ease), transform 0.2s var(--bc-ease);
  pointer-events: none;
}
@media (hover: hover) {
  .bc-pp a.bc-pp-tile:hover::after { opacity: 1; transform: none; }
}
.bc-pp a.bc-pp-tile:focus-visible::after { opacity: 1; transform: none; }
@media (max-width: 520px) {
  .bc-pp { gap: 4px; }
  .bc-pp--3 { aspect-ratio: 4 / 3; }
}
@media (prefers-reduced-motion: reduce) {
  .bc-pp .bc-pp-tile img { transition: none; }
}

/* ---------- Uploader in the belt sheet ---------- */
.bc-pu {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  border-radius: 16px;
  transition: box-shadow 0.2s var(--bc-ease), background 0.2s var(--bc-ease);
}
.bc-pu.is-drag { background: color-mix(in srgb, var(--bc-accent) 6%, transparent); box-shadow: 0 0 0 2px var(--bc-accent), 0 0 0 6px color-mix(in srgb, var(--bc-accent) 14%, transparent); }
.bc-pu-slot { position: relative; min-width: 0; aspect-ratio: 1; }
.bc-pu-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}
.bc-pu-add {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  border-radius: 14px;
  border: 1.5px dashed var(--bc-line-strong);
  background: var(--bc-surface-2);
  color: var(--bc-muted);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  padding: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.2s var(--bc-ease), color 0.2s var(--bc-ease), background 0.2s var(--bc-ease);
}
.bc-pu-add i { font-size: 20px; }
.bc-pu-add:hover, .bc-pu-slot.is-over .bc-pu-add { border-color: var(--bc-accent); color: var(--bc-accent); background: color-mix(in srgb, var(--bc-accent) 5%, var(--bc-surface)); }
.bc-pu-slot:focus-within .bc-pu-add { box-shadow: var(--bc-ring); border-color: var(--bc-accent); }
/* Only the first empty slot says "Add photo"; later ones show just the icon */
.bc-pu-slot.is-empty ~ .bc-pu-slot.is-empty .bc-pu-add span { display: none; }
.bc-pu-slot.is-empty ~ .bc-pu-slot.is-empty .bc-pu-add { opacity: 0.7; }

.bc-pu-preview {
  position: absolute;
  inset: 0;
  display: none;
  overflow: hidden;
  border-radius: 14px;
  background: var(--bc-surface-3);
  box-shadow: 0 0 0 1px var(--bc-line) inset;
}
.bc-pu-slot.has-saved .bc-pu-preview, .bc-pu-slot.has-new .bc-pu-preview { display: block; }
.bc-pu-slot.has-saved .bc-pu-add, .bc-pu-slot.has-new .bc-pu-add { display: none; }
.bc-pu-preview img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: bc-pu-in 0.3s var(--bc-ease);
}
@keyframes bc-pu-in { from { opacity: 0; transform: scale(1.04); } to { opacity: 1; transform: none; } }
/* A file the browser cannot preview (HEIC in most browsers) */
.bc-pu-file {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  font-size: 11.5px;
  line-height: 1.25;
  color: var(--bc-muted);
  text-align: center;
  word-break: break-all;
}
.bc-pu-file i { font-size: 22px; }
.bc-pu-view {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: zoom-in;
}
.bc-pu-view:focus-visible { outline: none; box-shadow: var(--bc-ring) inset; border-radius: 14px; }
.bc-pu-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  font-size: 14px;
  color: #fff;
  background: rgba(11, 11, 16, 0.58);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
  cursor: pointer;
  transition: background 0.2s var(--bc-ease), transform 0.2s var(--bc-ease);
}
.bc-pu-remove::before { content: ""; position: absolute; inset: -7px; } /* 44px tap target */
.bc-pu-remove:hover { background: var(--bc-red); }
.bc-pu-remove:focus-visible { outline: 2px solid #fff; outline-offset: 1px; box-shadow: 0 0 0 4px var(--bc-accent); }
.bc-pu-remove[disabled] { opacity: 0.5; cursor: default; }
.bc-pu-badge {
  position: absolute;
  left: 6px;
  bottom: 6px;
  z-index: 2;
  display: none;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #fff;
  background: var(--bc-accent);
  pointer-events: none;
}
.bc-pu-slot.has-new .bc-pu-badge { display: inline-block; }
/* Rotate a saved photo (scripts/bc-rotate.js); a new pick is not saved yet, so no rotate */
.bc-pu-rot { position: absolute; left: 6px; bottom: 6px; z-index: 2; gap: 8px; }
.bc-pu-slot:not(.has-saved) .bc-pu-rot { display: none; }
.bc-pu-slot.is-busy .bc-pu-preview::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  background: rgba(255, 255, 255, 0.55);
}
.bc-pu-hint { margin-top: 8px; }
.bc-pu-hint .bc-pu-hint-drop { display: none; }
@media (hover: hover) and (pointer: fine) {
  .bc-pu-hint .bc-pu-hint-drop { display: inline; }
}

/* Timeline thumbs in the edit page: same lightbox as the profile */
.bc-ph-thumbs .bc-gallery-tile { width: 52px; height: 52px; flex: 0 0 auto; aspect-ratio: 1; border-radius: 10px; cursor: zoom-in; }
.bc-ph-thumbs .bc-gallery-tile img { width: 100%; height: 100%; border-radius: 0; box-shadow: none; transition: transform 0.4s var(--bc-ease); }

.theme-dark .bc-pu-add { background: var(--bc-surface-2); }
