/*
 * photos.css - "Photos of your location" (photos.js). Used by Edit adspot and the Create wizard.
 * Built on the shared kit in css/adspot-ui.css (tokens, .ui-btn, .ui-input, .ui-note, .ui-progress, .ui-modal).
 * Class names start with ap-photo and never contain ad / ads / banner / promo / sponsor (ad blockers hide those).
 */
.ap-photos { display: grid; gap: 14px; min-width: 0; }

/* tips */
.ap-photo-tips { padding: 12px 14px; border-radius: var(--ui-radius-sm); background: var(--ui-tint); border: 1px solid var(--ui-line); font-size: 13.5px; line-height: 1.5; color: var(--ui-text); }
.ap-photo-tips strong { display: block; margin-bottom: 4px; color: var(--ui-ink); font-size: 14px; }
.ap-photo-tips ul { margin: 0; padding-left: 18px; }
.ap-photo-tips li { margin: 2px 0; }
.ap-photo-notice { margin: 0; }

/* drop zone */
.ap-photo-zone {
    display: flex; align-items: center; gap: 14px; box-sizing: border-box; padding: 16px 18px;
    border: 2px dashed var(--ui-border); border-radius: var(--ui-radius); background: var(--ui-tint); cursor: pointer;
    transition: border-color var(--ui-ease), background-color var(--ui-ease);
}
.ap-photo-zone:hover, .ap-photo-zone.is-over { border-color: var(--ui-sage); background: var(--ui-sage-soft); }
.ap-photo-zone.is-over { box-shadow: 0 0 0 3px var(--ui-sage-ring); }
.ap-photo-zone.is-full { cursor: default; opacity: .8; background: #f1f2f0; }
.ap-photo-zone.is-full:hover { border-color: var(--ui-border); background: #f1f2f0; }
.has-photos .ap-photo-zone { padding: 12px 16px; }
.ap-photo-zone__icon { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 50%; background: #fff; color: var(--ui-sage-dark); box-shadow: var(--ui-shadow-sm); }
.ap-photo-zone__icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ap-photo-zone__text { display: grid; gap: 2px; flex: 1 1 auto; min-width: 0; }
.ap-photo-zone__text strong { font-size: 14.5px; color: var(--ui-ink); }
.ap-photo-zone__text span { font-size: 12.5px; color: var(--ui-muted); }
.ap-photo-add { flex: none; }

/* count + status */
.ap-photo-bar { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; min-height: 20px; }
.ap-photo-count { font-size: 13.5px; font-weight: 700; color: var(--ui-ink); font-variant-numeric: tabular-nums; }
.ap-photo-count.is-full { color: var(--ui-warn); }
.ap-photo-status { font-size: 13px; color: var(--ui-muted); }
.ap-photo-status.is-ok { color: var(--ui-ok); }
.ap-photo-status.is-bad { color: #a53b38; font-weight: 600; }
.ap-photo-hint { margin: -4px 0 0; font-size: 12.5px; color: var(--ui-muted); line-height: 1.5; }
.ap-photo-loading { padding: 0; }
.ap-photo-loading[hidden], .ap-photo-loaderr[hidden], .ap-photo-notice[hidden], .ap-photo-grid[hidden], .ap-photo-hint[hidden] { display: none; }
.ap-photo-loaderr { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }

/* grid */
.ap-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; }
.ap-photo-tile {
    position: relative; display: flex; flex-direction: column; min-width: 0; overflow: hidden;
    border: 1px solid var(--ui-line); border-radius: var(--ui-radius); background: #fff; box-shadow: var(--ui-shadow-sm);
    transition: border-color var(--ui-ease), box-shadow var(--ui-ease), opacity var(--ui-ease);
}
.ap-photo-tile:hover { border-color: var(--ui-sage-line); }
.ap-photo-tile.is-cover { border-color: var(--ui-sage); box-shadow: 0 0 0 2px var(--ui-sage-ring), var(--ui-shadow-sm); }
.ap-photo-tile.is-dragging { opacity: .4; }
.ap-photo-tile.is-mark-before::before, .ap-photo-tile.is-mark-after::after { content: ""; position: absolute; top: 0; bottom: 0; z-index: 5; width: 4px; background: var(--ui-sage); }
.ap-photo-tile.is-mark-before::before { left: 0; }
.ap-photo-tile.is-mark-after::after { right: 0; }
.ap-photo-tile.is-error { border-color: #e5c2c0; background: #fdf6f5; }

.ap-photo-thumb { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: #e7eae5; cursor: grab; }
.ap-photo-thumb[draggable="false"] { cursor: default; }
.ap-photo-thumb:active[draggable="true"] { cursor: grabbing; }
.ap-photo-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; user-select: none; -webkit-user-drag: none; }
.ap-photo-tile.is-uploading .ap-photo-thumb img, .ap-photo-tile.is-queued .ap-photo-thumb img { opacity: .55; }
.ap-photo-num {
    position: absolute; top: 8px; right: 8px; display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; box-sizing: border-box;
    border-radius: 999px; background: rgba(28, 34, 28, .62); color: #fff; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.ap-photo-badge {
    position: absolute; top: 8px; left: 8px; display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px 3px 7px;
    border-radius: 999px; background: var(--ui-sage); color: #fff; font-size: 12px; font-weight: 700; box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}
.ap-photo-badge[hidden], .ap-photo-num[hidden], .ap-photo-prog[hidden], .ap-photo-err[hidden], .ap-photo-capwrap[hidden], .ap-photo-btn[hidden] { display: none; }
.ap-photo-badge__ico { width: 13px; height: 13px; fill: currentColor; stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; }

.ap-photo-prog { position: absolute; left: 0; right: 0; bottom: 0; display: grid; gap: 4px; padding: 20px 12px 10px; background: linear-gradient(to top, rgba(28, 34, 28, .7), rgba(28, 34, 28, 0)); }
.ap-photo-prog .ui-progress { background: rgba(255, 255, 255, .35); }
.ap-photo-prog .ui-progress__bar { background: #fff; }
.ap-photo-prog__txt { font-size: 12px; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; }

.ap-photo-err { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; padding: 12px; box-sizing: border-box; background: #fdf6f5; overflow: hidden; }
.ap-photo-err__ico { width: 22px; height: 22px; fill: none; stroke: var(--ui-bad); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ap-photo-err__name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; color: var(--ui-ink); }
.ap-photo-err__text { font-size: 12.5px; line-height: 1.4; color: #a53b38; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; }
.ap-photo-tile.is-error .ap-photo-thumb { cursor: default; background: #fdf6f5; }

/* buttons under the photo */
.ap-photo-tools { display: flex; align-items: center; gap: 4px; padding: 8px 8px 4px; }
.ap-photo-tile.is-error .ap-photo-tools { padding-top: 8px; }
.ap-photo-btn {
    appearance: none; display: inline-grid; place-items: center; flex: none; width: 34px; height: 34px; padding: 0;
    border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--ui-text); cursor: pointer;
    transition: background-color var(--ui-ease), color var(--ui-ease), border-color var(--ui-ease);
}
.ap-photo-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ap-photo-btn:hover:not(:disabled) { background: var(--ui-sage-soft); color: var(--ui-ink); }
.ap-photo-btn:focus-visible { outline: 3px solid var(--ui-sage-ring); outline-offset: 1px; }
.ap-photo-btn:disabled { color: #b4bab2; cursor: default; }
.ap-photo-btn[data-act="cover"][aria-pressed="true"] { color: var(--ui-sage-dark); background: var(--ui-sage-soft); }
.ap-photo-btn[data-act="cover"][aria-pressed="true"] svg { fill: currentColor; }
.ap-photo-btn[data-act="retry"] { color: var(--ui-sage-dark); }
.ap-photo-btn--del { margin-left: auto; }
.ap-photo-btn--del:hover:not(:disabled) { background: var(--ui-bad-soft); color: #a53b38; }

/* caption */
.ap-photo-capwrap { display: grid; gap: 2px; padding: 0 8px 10px; }
.ap-photo-cap { min-height: 36px; padding: 6px 10px; font-size: 13px; }
.ap-photo-capnote { min-height: 14px; font-size: 11.5px; color: var(--ui-muted); }
.ap-photo-capnote:empty { display: none; }
.ap-photo-capnote.is-bad { color: #a53b38; }

/* delete question, inline on the photo */
.ap-photo-ask { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 8px; background: var(--ui-bad-soft); border-top: 1px solid #e5c2c0; }
.ap-photo-ask[hidden] { display: none; }
.ap-photo-ask__text { flex: 1 1 100%; font-size: 13px; font-weight: 700; color: #a53b38; }
.ap-photo-ask .ui-btn { flex: 1 1 0; justify-content: center; }
.ap-photo-tools[hidden] { display: none; }
.ap-photo-tile.is-asking { border-color: #e5c2c0; }

/* loading placeholders */
.ap-photo-skel { display: grid; gap: 10px; padding: 0 0 12px; overflow: hidden; border: 1px solid var(--ui-line); border-radius: var(--ui-radius); background: #fff; }
.ap-photo-skel__img { display: block; aspect-ratio: 4 / 3; border-radius: 0; }
.ap-photo-skel__line { display: block; height: 14px; min-height: 0; margin: 0 10px; border-radius: 7px; }

@media (max-width: 600px) {
    .ap-photo-zone { flex-wrap: wrap; padding: 14px; }
    .ap-photo-zone__text { flex: 1 1 calc(100% - 70px); }
    .ap-photo-add { flex: 1 1 100%; }
    .ap-photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .ap-photo-tools { gap: 2px; padding: 6px 6px 2px; }
    .ap-photo-btn { width: 36px; height: 36px; }
    .ap-photo-capwrap { padding: 0 6px 8px; }
    .ap-photo-err { padding: 10px; gap: 3px; }
    .ap-photo-err__text { font-size: 12px; -webkit-line-clamp: 6; }
}
@media (prefers-reduced-motion: reduce) {
    .ap-photo-tile, .ap-photo-zone, .ap-photo-btn { transition: none; }
}
#ap_photos_card[hidden] { display: none; }
