/* TBHP image experience: preserve intrinsic ratios and existing layout ownership. */
.hp-home .hp-legal-doc img{height:auto;width:100%;max-height:none;object-fit:contain}
.hp-home .hp-legal-docs{max-width:none;gap:12px}
@media(max-width:540px){.hp-home .hp-legal-docs{grid-template-columns:minmax(0,1fr)}}
.tbhp-contact-visual{grid-template-columns:minmax(0,1.15fr) minmax(0,.85fr);grid-template-rows:auto auto;min-height:0;align-items:start;max-width:none}
.tbhp-contact-visual .tbhp-contact-photo img{width:100%;height:auto;object-fit:contain}
@media(max-width:540px){.tbhp-contact-visual{grid-template-columns:minmax(0,1fr);grid-template-rows:auto}.tbhp-contact-photo--main{grid-row:auto}}
body .tbhp-consumables .tbhp-c-shop-card img{object-fit:contain;aspect-ratio:1/1;max-width:100%}
body .tbshp-setup .tbhp-real-product-card img,body .tbhp-repair .tbhp-real-product-card img{height:auto;aspect-ratio:4/5;max-width:100%;padding:4px;object-fit:contain}
/* Product links must still navigate. Gallery slider and magnifier are left alone. */
body.tbhp-ui-v8 :is(.woocommerce ul.products,ul.products) li.product :is(a.woocommerce-LoopProduct-link,a.woocommerce-loop-product__link)>img:not(.tbhp-no-zoom){display:block;box-sizing:border-box;width:100%!important;max-width:100%;height:auto!important;aspect-ratio:4/5;object-fit:contain!important;padding:4px;background:#f7fafb}
body.tbhp-ui-v8 .tbhp-shop-cat{grid-template-columns:84px minmax(0,1fr) auto;min-height:104px}
body.tbhp-ui-v8 .tbhp-shop-cat__media,body.tbhp-ui-v8 .tbhp-shop-cat__placeholder{width:84px;height:84px}

@media(min-width:481px) and (max-width:768px){body.tbhp-ui-v8 .tbhp-shop-cat{grid-template-columns:84px minmax(0,1fr)}}
@media(max-width:480px){body.tbhp-ui-v8 .tbhp-shop-cat{grid-template-columns:80px minmax(0,1fr) auto;min-height:100px}body.tbhp-ui-v8 .tbhp-shop-cat__media,body.tbhp-ui-v8 .tbhp-shop-cat__placeholder{width:80px;height:80px}}
/* Only bounded media slots may enlarge; keep text and badges in their own tracks. */
body .tbshp-setup :is(.tbshp-hero-stack,.tbshp-card-art),body .tbhp-repair .tbhp-r-visual{min-width:0;max-width:100%;background:#e8f0f3}
body .tbshp-setup :is(.tbshp-hero-stack,.tbshp-card-art)>img,body .tbhp-repair .tbhp-r-visual>img.tbhp-r-visual-photo{max-width:100%;object-fit:contain!important;object-position:center!important}
body .tbshp-setup .tbshp-card-art>img{transform:none}
body .tbhp-repair :is(.tbhp-r-media-card,.tbhp-r-gallery-card),body .tbshp-setup :is(.tbshp-source-card,.tbshp-footer-shot){min-width:0;max-width:100%}
/* Do not zoom uncontained inline images: they may overlap surrounding text. */
/* Large article images retain original dimensions; no stretching of logos/icons. */
.entry-content :is(.wp-block-image,.wp-caption) img{max-width:100%;height:auto}
:where(.tbhp-photo-host){position:relative}
img.tbhp-photo-preview{cursor:zoom-in}
.tbhp-photo-open{position:absolute;top:8px;right:8px;z-index:3;display:grid;place-items:center;box-sizing:border-box;width:44px;height:44px;min-width:44px;min-height:44px;padding:0;border:1px solid #fff;border-radius:50%;background:#103d5a;color:#fff;box-shadow:0 2px 8px #0003;cursor:zoom-in;line-height:1}
.tbhp-photo-open:hover,.tbhp-photo-open:focus-visible{color:#fff;background:#0f766e}
.tbhp-photo-open svg{width:22px;height:22px;pointer-events:none}
.tbhp-photo-open:focus-visible,img.tbhp-photo-preview:focus-visible{outline:3px solid #155f9e;outline-offset:-3px;box-shadow:0 0 0 2px #fff}
@media(hover:hover) and (pointer:fine) and (prefers-reduced-motion:no-preference){
 :is(.tbhp-c-card-media,.tbhp-contact-photo,.tbshp-hero-stack,.tbhp-r-visual,.tbshp-card-art,.tbhp-shop-cat__media) > img{transition:scale 180ms cubic-bezier(.2,.7,.3,1)}
 :is(.tbhp-c-card-media,.tbhp-contact-photo,.tbshp-hero-stack,.tbhp-r-visual,.tbshp-card-art,.tbhp-shop-cat__media):hover > img{scale:1.02}
 /* Slight zoom within the original painted boundary; do not cover captions or prices. */
 :is(.hp-home .hp-hero-photo,.hp-home .hp-media-gallery figure,.hp-home .hp-legal-doc,body.tbhp-ui-v8 ul.products li.product :is(a.woocommerce-LoopProduct-link,a.woocommerce-loop-product__link)) > img{transition:scale 180ms cubic-bezier(.2,.7,.3,1),clip-path 180ms ease;clip-path:inset(0 round 10px)}
 :is(.hp-home .hp-hero-photo,.hp-home .hp-media-gallery figure,.hp-home .hp-legal-doc,body.tbhp-ui-v8 ul.products li.product :is(a.woocommerce-LoopProduct-link,a.woocommerce-loop-product__link)):hover > img{scale:1.02;clip-path:inset(1% round 10px)}
}
@media(prefers-reduced-motion:reduce){img.tbhp-photo-preview,.hp-home .hp-legal-doc img,.tbhp-shop-cat__media img{transition:none!important;scale:1!important}}
/* Single native dialog, created at first interaction, outside theme wrappers. */
html.tbhp-photo-lock{overflow:hidden;overscroll-behavior:none}
dialog.tbhp-photo-dialog{box-sizing:border-box;position:fixed;inset:0;margin:auto;border:1px solid #354b58;border-radius:14px;background:#0b2331;color:#fff;padding:0;width:min(96vw,1280px);height:min(94vh,1050px);height:min(94dvh,1050px);max-width:96vw;max-height:94dvh;overflow:hidden}
dialog.tbhp-photo-dialog[open]{display:flex;flex-direction:column}
.tbhp-photo-dialog::backdrop{background:rgba(4,16,24,.88)}
.tbhp-photo-dialog .tbhp-photo-bar{display:flex;align-items:center;gap:8px;padding:10px;flex:0 0 auto;background:#103d5a}
.tbhp-photo-dialog .tbhp-photo-title{color:#fff;font-size:clamp(14px,2vw,17px);font-weight:600;line-height:1.4;margin:0;flex:1;min-width:0;overflow-wrap:anywhere;max-height:4.2em;overflow:auto}
.tbhp-photo-dialog button{box-sizing:border-box;min-height:44px;min-width:44px;padding:8px 12px;border:1px solid #a2c0cf;border-radius:8px;background:#17475e;color:#fff;font:inherit;font-size:14px;line-height:1.2;cursor:pointer}
.tbhp-photo-dialog button:hover,.tbhp-photo-dialog button:focus-visible{background:#0f766e;color:#fff;outline:2px solid #fff;outline-offset:1px}
.tbhp-photo-dialog .tbhp-photo-stage{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;touch-action:pan-x pan-y;display:flex;align-items:stretch;justify-content:stretch}
.tbhp-photo-dialog .tbhp-photo-canvas{min-width:100%;min-height:100%;width:max-content;display:flex;flex:none;align-items:center;justify-content:center;padding:8px;box-sizing:border-box}
.tbhp-photo-dialog .tbhp-photo-canvas img{display:block;width:auto;height:auto;max-width:calc(min(96vw,1280px) - 18px);max-height:100%;object-fit:contain;margin:auto;border-radius:0;box-shadow:none;flex:none}
.tbhp-photo-dialog .tbhp-photo-status{padding:0 12px 8px;margin:0;color:#dbeaf0;font-size:13px;line-height:1.4;text-align:center}
.tbhp-photo-dialog .tbhp-photo-status:empty{display:none}
@media(max-width:540px){dialog.tbhp-photo-dialog{width:100vw;max-width:100vw;height:100vh;height:100dvh;max-height:100dvh;border:0;border-radius:0}.tbhp-photo-dialog .tbhp-photo-bar{padding:8px}.tbhp-photo-dialog .tbhp-photo-canvas img{max-width:calc(100vw - 16px)}}
@media(prefers-reduced-motion:no-preference){dialog.tbhp-photo-dialog[open]{animation:tbhp-photo-in 150ms ease-out}@keyframes tbhp-photo-in{from{opacity:0}to{opacity:1}}}

/* Reserve a conservative slot only for legacy images lacking dimensions. */
body :is(.tbshp-source-card,.tbshp-footer-shot,.tbhp-r-media-card,.tbhp-r-upgrade-grid) img:not([width][height]){aspect-ratio:auto 3/4}
