/* Plugin-owned photo mosaic only; surrounding typography/layout remains theme-owned. */
.ha-photo-gallery{position:relative;container-type:inline-size}
.ha-photo-gallery [hidden],.ha-photo-dialog [hidden]{display:none!important}
.ha-photo-gallery .ha-photo-mosaic{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));gap:8px;aspect-ratio:8/3;border-radius:12px;overflow:hidden}
.ha-photo-gallery .ha-photo-tile{display:block;min-width:0;min-height:0;overflow:hidden;background:#eee}
.ha-photo-gallery .ha-photo-tile:first-child{grid-column:span 2;grid-row:span 2}
.ha-photo-gallery .ha-photo-tile img{display:block;width:100%;height:100%;object-fit:cover;transition:filter .15s}
.ha-photo-gallery .ha-photo-tile:hover img{filter:brightness(.9)}
.ha-photo-gallery .ha-photo-show-all{position:absolute;right:24px;bottom:24px;display:flex;align-items:center;gap:8px;background:#fff;color:#222;border:1px solid #222;border-radius:8px;padding:8px 16px;min-height:44px;font:inherit;font-size:14px;line-height:1.4;text-transform:none;cursor:pointer;box-shadow:0 1px 4px #0002}
.ha-photo-gallery .ha-photo-mosaic[data-count="1"]{grid-template-columns:1fr;grid-template-rows:1fr}
.ha-photo-gallery .ha-photo-mosaic[data-count="1"] .ha-photo-tile,.ha-photo-gallery .ha-photo-mosaic[data-count="2"] .ha-photo-tile{grid-column:auto;grid-row:auto}
.ha-photo-gallery .ha-photo-mosaic[data-count="2"]{grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:1fr}
.ha-photo-gallery .ha-photo-mosaic[data-count="3"]{grid-template-columns:repeat(2,minmax(0,1fr))}
.ha-photo-gallery .ha-photo-mosaic[data-count="3"] .ha-photo-tile:first-child{grid-column:1}
.ha-photo-gallery .ha-photo-mosaic[data-count="4"] .ha-photo-tile:last-child{grid-column:span 2}
.ha-photo-dialog{box-sizing:border-box;position:fixed;inset:0;width:100%;height:100%;max-width:100%;max-height:100%;margin:0;padding:0;border:0;background:#fff;color:#222;overflow:auto;overscroll-behavior:contain}
.ha-photo-dialog:not([open]){display:none}
.ha-photo-dialog[open]{display:flex;flex-direction:column}
.ha-photo-dialog.ha-photo-viewing .ha-photo-toolbar h2{position:absolute;clip-path:inset(50%);width:1px;height:1px;overflow:hidden}
.ha-photo-dialog::backdrop{background:#0009}
.ha-photo-dialog .ha-photo-toolbar{position:sticky;top:0;z-index:1;flex-shrink:0;display:flex;align-items:center;flex-wrap:wrap;gap:16px;padding:20px 32px;background:#fff;color:#222;border-bottom:1px solid #eee}
.ha-photo-dialog .ha-photo-toolbar h2{margin:0 auto;font-size:1.25rem;color:inherit}
.ha-photo-dialog .ha-photo-toolbar button{color:inherit;min-height:44px}
.ha-photo-dialog .ha-photo-toolbar .ha-photo-back{display:inline-flex;align-items:center;gap:10px;padding:8px 16px;border:1px solid #ddd;border-radius:8px;background:#fff;line-height:1.5;text-transform:none;white-space:nowrap}
.ha-photo-dialog .ha-photo-toolbar .ha-photo-back:hover{background:#f5f5f5}
.ha-photo-dialog .ha-photo-toolbar .ha-photo-back:focus-visible{outline:2px solid currentColor;outline-offset:3px}
.ha-photo-dialog .ha-photo-overview{max-width:1120px;width:100%;box-sizing:border-box;flex-shrink:0;margin:32px auto;padding:0 24px 32px;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:24px}
.ha-photo-dialog .ha-photo-overview figure{margin:0;min-width:0}
.ha-photo-dialog .ha-photo-overview figure:first-child{grid-column:1/-1}
.ha-photo-dialog .ha-photo-overview a{display:block}
.ha-photo-dialog .ha-photo-overview img{display:block;width:100%;height:auto;aspect-ratio:3/2;object-fit:cover}
.ha-photo-dialog figcaption{padding-block:8px;font-size:.9rem}
.ha-photo-dialog .ha-photo-viewer{display:grid;grid-template-columns:60px minmax(0,1fr) 60px;align-items:center;flex:1;min-height:0;background:#151515;color:#fff;padding:12px;gap:12px;box-sizing:border-box;touch-action:pan-y pinch-zoom}
.ha-photo-dialog .ha-photo-viewer figure{margin:0;text-align:center;min-width:0}
.ha-photo-dialog .ha-photo-viewer img{max-width:100%;max-height:calc(100dvh - 180px);object-fit:contain}
.ha-photo-dialog .ha-photo-arrow{border:1px solid #777;border-radius:50%;width:44px;height:44px;justify-self:center;background:transparent;color:#fff;font-size:32px;cursor:pointer}
.ha-photo-dialog .ha-photo-arrow:disabled{opacity:.3;cursor:default}
.ha-photo-gallery :is(a,button):focus-visible,.ha-photo-dialog :is(a,button):focus-visible{outline:3px solid currentColor;outline-offset:-4px}
html:has(.ha-photo-dialog[open]){overflow:hidden}
@container(max-width:639px){.ha-photo-gallery .ha-photo-mosaic{display:block;aspect-ratio:4/3}.ha-photo-gallery .ha-photo-tile{height:100%}.ha-photo-gallery .ha-photo-tile:not(:first-child){display:none}.ha-photo-gallery .ha-photo-show-all{right:12px;bottom:12px;padding:8px 12px}}
@media(max-width:639px){.ha-photo-dialog .ha-photo-toolbar{padding:8px 16px;gap:8px}.ha-photo-dialog .ha-photo-toolbar h2{font-size:1rem}.ha-photo-dialog .ha-photo-overview{grid-template-columns:1fr;padding:0 16px;margin-top:16px;gap:16px}.ha-photo-dialog .ha-photo-viewer{position:relative;grid-template-columns:minmax(0,1fr);padding:8px 0;gap:0}.ha-photo-dialog .ha-photo-arrow{position:absolute;top:50%;background:#151515b3}.ha-photo-dialog [data-ha-previous]{left:8px}.ha-photo-dialog [data-ha-next]{right:8px}}
@media(prefers-reduced-motion:reduce){.ha-photo-gallery .ha-photo-tile img{transition:none}}
