/* APhoto Gallery v3 */

/* ── Grid only (used by Ale theme) ── */
.ap-grid-only { width:100%; }

/* JUSTIFIED */
.ap-layout-justified .ap-row {
  display:flex;
  gap:var(--ap-gap,3px);
  margin-bottom:var(--ap-gap,3px);
  height:var(--ap-row-h,220px);
  width:100%;
}

/* All normal rows: images stretch to fill full width */
.ap-layout-justified .ap-item {
  overflow:hidden;
  cursor:pointer;
  position:relative;
  min-width:0;
  flex-shrink:1;
}
.ap-layout-justified .ap-item img {
  width:100%; height:100%;
  object-fit:cover; display:block;
}

/* Last incomplete row: left-aligned, natural proportions */
.ap-layout-justified .ap-row-last {
  justify-content:flex-start;
  height:var(--ap-row-h,220px);
}
.ap-layout-justified .ap-row-last .ap-item {
  flex-grow:0 !important;
  flex-shrink:0;
  width:calc(var(--ap-row-h,220px) * var(--ar,1.5));
  max-width:none;
}
.ap-spacer {
  display:none; /* hide spacers — last row just left-aligns naturally */
}

/* MASONRY */
.ap-layout-masonry { columns:var(--ap-mcols,4); column-gap:var(--ap-gap,3px); }
.ap-mi { break-inside:avoid; margin-bottom:var(--ap-gap,3px); overflow:hidden; cursor:pointer; position:relative; display:block; }
.ap-mi img { width:100%; height:auto; display:block; }

/* GRID */
.ap-layout-grid { display:grid; grid-template-columns:repeat(var(--ap-cols,6),1fr); gap:var(--ap-gap,3px); }
.ap-gi { aspect-ratio:var(--ap-aspect,3/2); overflow:hidden; cursor:pointer; position:relative; }
.ap-gi img { width:100%; height:100%; object-fit:cover; display:block; }

/* Shared */
.ap-item img,.ap-mi img,.ap-gi img { opacity:.9; transition:opacity .25s; }
.ap-item:hover img,.ap-mi:hover img,.ap-gi:hover img { opacity:1; }

.ap-hover-overlay .ap-item::after,
.ap-hover-overlay .ap-mi::after,
.ap-hover-overlay .ap-gi::after {
  content:''; position:absolute; inset:0;
  background:rgba(0,0,0,0); transition:background .25s; pointer-events:none;
}
.ap-hover-overlay .ap-item:hover::after,
.ap-hover-overlay .ap-mi:hover::after,
.ap-hover-overlay .ap-gi:hover::after { background:rgba(0,0,0,.25); }

.ap-cap { position:absolute; bottom:0; left:0; right:0;
  padding:24px 10px 8px;
  background:linear-gradient(to top,rgba(0,0,0,.55),transparent);
  opacity:0; transform:translateY(4px); transition:opacity .22s,transform .22s; pointer-events:none; }
.ap-hover-overlay .ap-item:hover .ap-cap,
.ap-hover-overlay .ap-mi:hover   .ap-cap,
.ap-hover-overlay .ap-gi:hover   .ap-cap,
.ap-hover-caption .ap-item:hover .ap-cap,
.ap-hover-caption .ap-mi:hover   .ap-cap,
.ap-hover-caption .ap-gi:hover   .ap-cap { opacity:1; transform:none; }
.ap-cap b     { display:block; font-size:10px; font-weight:400; color:#fff; }
.ap-cap small { display:block; font-size:8px; color:rgba(255,255,255,.55); margin-top:2px; letter-spacing:.1em; }

/* ── Standalone wrapper (shortcode) ── */
.ap-standalone { position:relative; width:100%;
  font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif; }

.ap-sv { display:none; width:100%; height:80vh; background:#fff;
  align-items:center; justify-content:center;
  position:relative; cursor:none; }
.ap-sv.open { display:flex; }

.ap-si { max-width:100%; max-height:100%; width:auto; height:auto; object-fit:contain; display:block; }

.ap-bar { display:flex; align-items:center; gap:14px; padding:8px 0 2px; }
.ap-btn { background:none; border:none; cursor:pointer; font-size:11px; color:#999;
  padding:4px 0; font-family:inherit; transition:color .15s; }
.ap-btn:hover,.ap-btn.on { color:#1a1a1a; }
.ap-cnt { font-size:11px; color:#999; margin-left:auto; }

/* Cursor inside standalone */
.ap-cur { position:absolute; pointer-events:none; z-index:10;
  opacity:0; transition:opacity .18s; transform:translate(-50%,-50%); }
.ap-cur.on { opacity:1; }
.ap-cur svg { width:81px; height:81px; display:block; opacity:.75; fill:#1a1a1a; }
