/* YUME DESIGN · original-ratio artwork cards · 2026-10-24.
   The 70–160% preference now changes card WIDTH, not only a fixed-height
   image box. The image pixels and saved R2 metadata are never edited.
   Place after interface-polish and density sheets so these rules win. */

/* At 100%, keep approximately the original 3-column gallery / 2-column
   homepage. At 160%, bigger cards require fewer columns instead of a taller
   empty frame around an image whose width was capped at 100%. */
html:root #gallery-items,
html:root #home-works,
html:root #signature-items{
  grid-template-columns:repeat(auto-fit,minmax(min(100%,clamp(230px,calc(300px * var(--yume-image-zoom,1.6)),520px)),1fr))!important;
  align-items:start!important;
  justify-items:stretch!important;
}
html:root #gallery-items .work-card,
html:root #home-works .work-card,
html:root #signature-items .work-card{
  min-width:0;
  width:100%;
  max-width:660px;
  justify-self:center;
}
/* Native artwork aspect ratio provided as a sanitized, number-only variable.
   A missing dimension uses a square fallback. Extreme horizontal/vertical
   formats limit only the STAGE ratio; object-fit:contain shows every pixel. */
html:root :is(#home-works,#gallery-items,#signature-items) .art-preview,
html:root[data-yume-density] :is(#home-works,#gallery-items,#signature-items) .art-preview{
  box-sizing:border-box!important;
  display:block!important;
  position:relative!important;
  width:100%!important;
  height:auto!important;
  min-height:0!important;
  max-height:none!important;
  aspect-ratio:var(--yume-art-ratio,1)!important;
  padding:0!important;
  overflow:hidden!important;
  background:linear-gradient(145deg,#faf6ff,#f4eafa)!important;
}
/* The image uses the full stage, with a modest safe inset. Neither
   transform:scale() nor object-fit:cover is used, so nothing is cropped. */
html:root :is(#home-works,#gallery-items,#signature-items) .art-preview > img,
html:root[data-yume-density] :is(#home-works,#gallery-items,#signature-items) .art-preview > img{
  position:absolute!important;
  inset:8px!important;
  display:block!important;
  width:calc(100% - 16px)!important;
  height:calc(100% - 16px)!important;
  max-width:none!important;
  max-height:none!important;
  object-fit:contain!important;
  object-position:center center!important;
  transform:none!important;
}
/* Labels must stay readable after the image is positioned. */
html:root :is(#home-works,#gallery-items,#signature-items) .art-preview > .item-number{
  position:absolute!important;
  z-index:2!important;
}
/* No hover-only visual crop either. */
html:root :is(#home-works,#gallery-items,#signature-items) .art-button:hover .art-preview > img{
  transform:none!important;
}
@media(max-width:650px){
 html:root #home-works,
 html:root #gallery-items,
 html:root #signature-items{
   grid-template-columns:minmax(0,1fr)!important;
 }
}
@media(prefers-reduced-motion:reduce){
 html:root :is(#home-works,#gallery-items,#signature-items) .art-preview > img{
   transition:none!important;
 }
}
