/* Homepage print rooms: fit the complete frame before sizing the uncropped photograph.
   Nominal frame/mat sizes follow the approved catalog, rotated with the artwork. */
.atelier-home #shop-grid .shop-card-room{
 --frame-room-height:clamp(280px,31vw,400px);
 --frame-room-padding:28px;
 /* Keep the existing 4px hover lift inside the room, including its 1px border. */
 --frame-room-inner-height:calc(var(--frame-room-height) - 2 * var(--frame-room-padding) - 10px);
 height:var(--frame-room-height)!important;
 padding:var(--frame-room-padding)!important;
 min-height:0!important;
 box-sizing:border-box;
}
.atelier-home #shop-grid .shop-card-sheet.portrait{
 /* 12 × 18 photograph in the 16 × 22 portrait frame. */
 --frame-ratio:.7272727273;
 --mat-x:12.5%;
 --mat-y:9.0909090909%;
}
.atelier-home #shop-grid .shop-card-sheet.landscape{
 /* 18 × 12 photograph in the same frame, rotated to 22 × 16. */
 --frame-ratio:1.375;
 --mat-x:9.0909090909%;
 --mat-y:12.5%;
}
.atelier-home #shop-grid .shop-card-sheet:has(>img[src*="/sunsillhouette-"]){
 /* 5 × 7 photograph in the 8 × 10 portrait frame. */
 --frame-ratio:.8;
 --mat-x:18.75%;
 --mat-y:15%;
}
.atelier-home #shop-grid .shop-card-sheet:has(>img[src*="/sunset-"]){
 /* 16 × 12 photograph in the 20 × 16 landscape frame. */
 --frame-ratio:1.25;
 --mat-x:10%;
 --mat-y:12.5%;
}
.atelier-home #shop-grid .shop-card-sheet:is(.portrait,.landscape){
 /* A max-height clamp on a fixed width broke portrait frames into landscape boxes.
    Instead, limit width using both room dimensions; aspect-ratio supplies height. */
 width:min(100%,calc(var(--frame-room-inner-height) * var(--frame-ratio)))!important;
 height:auto!important;
 aspect-ratio:var(--frame-ratio)!important;
 max-width:none!important;
 max-height:none!important;
 min-width:0;
 min-height:0;
 flex:none;
 box-sizing:border-box;
 padding:0!important;
 border:clamp(4px,.55vw,8px) solid #242124!important;
 background:#f5efe3;
 display:grid!important;
 grid-template-columns:var(--mat-x) minmax(0,1fr) var(--mat-x);
 grid-template-rows:var(--mat-y) minmax(0,1fr) var(--mat-y);
}
.atelier-home #shop-grid .shop-card-sheet:is(.portrait,.landscape)>img{
 grid-column:2;
 grid-row:2;
 display:block;
 width:100%!important;
 height:100%!important;
 max-width:100%!important;
 max-height:100%!important;
 min-width:0;
 min-height:0;
 object-fit:contain!important;
 object-position:center;
 box-shadow:none;
}
@media(max-width:700px){
 .atelier-home #shop-grid .shop-card-room{
  --frame-room-height:clamp(180px,51vw,230px);
  --frame-room-padding:14px;
 }
}
@media(max-width:350px){
 .atelier-home #shop-grid .shop-card-room{--frame-room-padding:11px}
}
