/**
 * A1 Tools — Gallery (frontend).
 *
 * Structural CSS only; colors/typography/width/spacing come from the widget's
 * Elementor `selectors` controls. Interactive elements are scoped under
 * `.a1tools-gallery` with resets + `font: inherit` so the site's font shows and
 * the theme's global-kit button/input styling can't bleed in.
 *
 * @since 3.2.1
 */
.a1tools-gallery{width:100%;box-sizing:border-box}
.a1tools-gallery *,.a1tools-gallery *::before,.a1tools-gallery *::after{box-sizing:border-box}

/* Toolbar: search left, filter right; wraps + stacks full-width on narrow widths */
.a1tools-gallery-bar{display:flex;flex-wrap:wrap;align-items:center;gap:12px;margin-bottom:20px}
.a1tools-gallery .a1tools-gallery-search,
.a1tools-gallery .a1tools-gallery-filter{margin:0;font:inherit;font-size:15px;line-height:1.4;padding:9px 14px;color:inherit;background:#fff;border:1px solid rgba(0,0,0,.18);border-radius:6px;-webkit-appearance:none;appearance:none;outline:none;min-width:0}
.a1tools-gallery .a1tools-gallery-search{flex:0 0 auto}
.a1tools-gallery .a1tools-gallery-filter{flex:0 0 auto;margin-left:auto;padding-right:34px;cursor:pointer;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23666' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 12px center}
.a1tools-gallery .a1tools-gallery-search:focus,
.a1tools-gallery .a1tools-gallery-filter:focus{border-color:rgba(0,0,0,.45)}

/* Grid — columns + gap come from controls; these are fallbacks */
.a1tools-gallery-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}

/* Item */
.a1tools-gallery-item{position:relative;display:block;overflow:hidden;border-radius:8px;background:#f2f2f2;aspect-ratio:var(--a1g-rw,4)/var(--a1g-rh,3);transition:box-shadow .2s ease}
.a1tools-gallery-ratio-original .a1tools-gallery-item{aspect-ratio:auto}
.a1tools-gallery .a1tools-gallery-img{display:block;width:100%;height:100%;max-width:none;object-fit:cover;margin:0;transition:transform .45s ease,filter .3s ease}
.a1tools-gallery-ratio-original .a1tools-gallery-img{height:auto}
.a1tools-gallery-has-lightbox .a1tools-gallery-item{cursor:zoom-in}

/* Hover effects */
.a1tools-gallery-hover-zoom .a1tools-gallery-item:hover .a1tools-gallery-img,
.a1tools-gallery-hover-overlay .a1tools-gallery-item:hover .a1tools-gallery-img{transform:scale(1.08)}
.a1tools-gallery-hover-overlay .a1tools-gallery-item:hover .a1tools-gallery-img{filter:brightness(.72)}

/* Category highlight (JS toggles .a1g-hl; color from control) */
.a1tools-gallery-item.a1g-hl{box-shadow:0 0 0 3px #F49321;z-index:2}

/* Zoom (lightbox) icon */
.a1tools-gallery-zoom{position:absolute;top:8px;right:8px;z-index:3;display:flex;align-items:center;justify-content:center;width:30px;height:30px;font-size:16px;border-radius:50%;color:#fff;background:rgba(0,0,0,.5);opacity:0;transform:scale(.85);transition:opacity .2s ease,transform .2s ease;pointer-events:none}
.a1tools-gallery-item:hover .a1tools-gallery-zoom{opacity:1;transform:scale(1)}
.a1tools-gallery-zoom svg{width:1em;height:1em;fill:currentColor;display:block}

/* Before / After split */
.a1tools-gallery-item.a1tools-gallery-ba{display:flex}
.a1tools-gallery-ba-side{position:relative;flex:1 1 50%;min-width:0;overflow:hidden}
.a1tools-gallery-ba-side+.a1tools-gallery-ba-side{border-left:2px solid #fff}
.a1tools-gallery-ratio-original .a1tools-gallery-ba-side .a1tools-gallery-img{height:100%}
.a1tools-gallery-ba-label{position:absolute;left:8px;bottom:8px;z-index:2;padding:2px 9px;font-size:12px;line-height:1.4;border-radius:4px;color:#fff;background:rgba(0,0,0,.6);pointer-events:none}
.a1tools-gallery-ba-after .a1tools-gallery-ba-label{left:auto;right:8px}

/* Category tag */
.a1tools-gallery-badge{position:absolute;top:8px;left:8px;z-index:2;padding:3px 10px;font-size:12px;line-height:1.4;border-radius:4px;color:#fff;background:rgba(0,0,0,.6);pointer-events:none}

/* Empty state */
.a1tools-gallery-empty{margin:24px 0;text-align:center;color:inherit;opacity:.7;font-style:italic}

/* Pagination */
.a1tools-gallery-pagination{display:flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:6px;margin-top:24px}
.a1tools-gallery .a1tools-gallery-page{margin:0;font:inherit;font-size:14px;line-height:1;min-width:36px;height:36px;padding:0 10px;display:inline-flex;align-items:center;justify-content:center;color:inherit;background:transparent;border:1px solid rgba(0,0,0,.2);border-radius:6px;cursor:pointer;-webkit-appearance:none;appearance:none;transition:all .2s ease;text-transform:none;letter-spacing:normal}
.a1tools-gallery .a1tools-gallery-page:hover{background:rgba(0,0,0,.06)}
.a1tools-gallery .a1tools-gallery-page.is-active{color:#fff;background:#F49321;border-color:#F49321}
.a1tools-gallery .a1tools-gallery-page.is-disabled{opacity:.4;cursor:default}
.a1tools-gallery .a1tools-gallery-page.is-disabled:hover{background:transparent}

/* Lightbox */
.a1tools-gallery-lightbox{position:fixed;inset:0;z-index:99999;display:none;align-items:center;justify-content:center;padding:24px;box-sizing:border-box;background:rgba(0,0,0,.88)}
.a1tools-gallery-lightbox.is-open{display:flex}
.a1tools-gallery-lb-inner{display:flex;gap:10px;max-width:94vw;max-height:90vh}
.a1tools-gallery-lb-inner img{display:block;max-width:100%;max-height:90vh;width:auto;height:auto;object-fit:contain;border-radius:4px}
.a1tools-gallery-lb-inner.is-pair img{max-width:47vw}
.a1tools-gallery-lb-close{position:absolute;top:16px;right:20px;width:40px;height:40px;display:flex;align-items:center;justify-content:center;border:none;border-radius:50%;background:rgba(255,255,255,.15);color:#fff;font-size:22px;line-height:1;cursor:pointer}
.a1tools-gallery-lb-close:hover{background:rgba(255,255,255,.28)}
