@media(min-width:901px) {
  form.controls {
    grid-template-columns:minmax(0,1fr) auto;
    grid-template-areas:
      "kind ."
      "colour ."
      "size mat"
      "actions actions";
  }
  .controls .frame-types {grid-area:kind}
  .controls .frame-colors {grid-area:colour}
  .controls .print-sizes {grid-area:size}
  .controls #mat-toggle {grid-area:mat;justify-self:end}
  .controls .actions {grid-area:actions}
}

.frame-profile {display:none}

.wall.has-profile:not(.aquarium) .frame {
  --profile-unit:var(--print-unit,var(--cm));
  --profile-rim:calc(var(--border) * var(--profile-unit));
  --profile-width:calc((var(--width) + var(--border) * 2) * var(--profile-unit));
  --profile-height:calc((var(--height) + var(--border) * 2) * var(--profile-unit));
  --profile-pitch:calc((var(--width) + var(--profile-gap)) * var(--cm));
  --profile-finish:color-mix(in srgb,var(--frame) 83%,var(--mat-cast));
  border-width:0;
  padding:var(--profile-rim);
}
.wall.has-profile.lounge .frame {position:relative}
.wall.has-profile[data-frame-color="#d1d0cb"] .frame {
  --profile-finish:color-mix(in srgb,var(--frame) 61%,var(--mat-cast));
}
.wall.has-profile:not(.aquarium) .frame::before {display:none}

.wall.has-profile.hotel .frame {left:calc(50% + var(--slot) * var(--profile-pitch))}
.wall.has-profile.attic .frame {left:calc(49% + var(--slot) * var(--profile-pitch))}
.wall.has-profile.prairie .frame {left:calc(29% + var(--slot) * var(--profile-pitch))}
.wall.has-profile.cutter .frame {left:calc(67.5% + var(--slot) * var(--profile-pitch))}
.wall.has-profile.letter .frame {left:calc(54.2% + var(--slot) * var(--profile-pitch))}
.wall.has-profile.laundry .frame {left:calc(44% + var(--slot) * var(--profile-pitch))}
.wall.has-profile.lift .frame {left:calc(32.7% + var(--slot) * var(--profile-pitch))}
.wall.has-profile.cellar .frame {left:calc(var(--cellar-center-x,49.3%) + var(--slot) * var(--profile-pitch))}
.wall.has-profile.catpov .frame {left:calc(50% + var(--slot) * var(--profile-pitch))}
.wall.has-profile.catpov .frame:not(.is-zoomed) {transform-origin:calc(50% + 6cqw - var(--slot) * var(--profile-pitch)) 50%}

.wall.has-profile:not(.aquarium) .frame-profile {
  display:block;
  position:absolute;
  inset:0;
  pointer-events:none;
}
.frame-rail {
  position:absolute;
  top:0;
  left:0;
  width:var(--profile-width);
  height:var(--profile-rim);
  transform-origin:0 0;
  clip-path:polygon(0 0,100% 0,calc(100% - var(--profile-rim)) 100%,var(--profile-rim) 100%);
  background-color:var(--profile-finish);
  background-image:
    linear-gradient(to bottom,#f0ddbc2b,transparent 18%,#20172826 85%,#17101655),
    var(--profile-texture,url('/rama-relief.webp'));
  background-position:0 0,50% 0;
  background-size:100% 100%,calc(var(--profile-rim) * var(--profile-repeat,2.83)) 100%;
  background-repeat:no-repeat,repeat-x;
  background-blend-mode:soft-light,var(--profile-blend,overlay);
  --profile-side-light:calc(1 + (var(--profile-side,1) - 1) * var(--profile-light-response,1));
  filter:brightness(calc(var(--profile-exposure,1) * var(--profile-side-light)));
}
/* The plain wood face has an oiled matte finish with restrained contrast. */
:is(.wall.is-wood,.banner-profile.is-wood) .frame-rail {
  --profile-texture:url('/rama-drewno.webp');
  --profile-repeat:7.77;
  --profile-blend:soft-light;
  --profile-light-response:.80;
  background-image:
    linear-gradient(to bottom,#fff2da14,transparent 19%,#35272117 92%,#261b1430),
    var(--profile-texture);
}

.frame-rail.top {--profile-side:var(--profile-top,1.08)}
.frame-rail.right {
  --profile-side:var(--profile-right,.78);
  left:100%;
  width:var(--profile-height);
  transform:rotate(90deg);
}
.frame-rail.bottom {
  --profile-side:var(--profile-bottom,.76);
  top:100%;
  left:100%;
  transform:rotate(180deg);
}
.frame-rail.left {
  --profile-side:var(--profile-left,1.04);
  top:100%;
  width:var(--profile-height);
  transform:rotate(-90deg);
}

/* Local lighting direction. The scene overlays still pass over the whole frame. */
.wall:is(.bedroom,.hallway,.hotel,.attic,.prairie,.yacht) {
  --profile-right:1.06;
  --profile-left:.76;
  --profile-top:1.03;
}
.wall.veranda {
  --profile-top:.75;
  --profile-bottom:1.10;
  --profile-exposure:.85;
}
.wall:is(.orbit,.laundry,.brooklyn,.stairhall,.lift) {
  --profile-top:1.17;
  --profile-bottom:.69;
}
.wall:is(.night,.desert,.orbit,.motel,.railway,.brooklyn) {--profile-exposure:.71}
.wall:is(.bathroom,.dock,.letter,.train,.cellar) {--profile-exposure:.83}
.wall.night {--profile-exposure:.54}
.wall.laundry .frame {--profile-exposure:calc(.24 + var(--tube-strength,.74))}
.wall.brooklyn .frame {--profile-exposure:calc(.20 + var(--scene-print-brightness,.57))}
.wall.cutter .frame {--profile-exposure:calc(.10 + .88 * var(--beam,0))}
.wall.stairhall .frame {--profile-exposure:calc(.64 + .27 * var(--stair-power,1))}
.wall .frame.is-zoomed .frame-rail {filter:brightness(var(--profile-side-light))}

/* Match the neutral mat in close-up while keeping the bevel visible. */
.wall[data-frame-color="#d1d0cb"] {
  --white-frame-closeup:#eeece6;
  --white-closeup-bevel:#f0eee9 #e5e3de #dbd8d1 #e7e4de;
}
.wall[data-frame-color="#d1d0cb"]:not(.is-taped,.aquarium) .frame.is-zoomed {
  --frame:var(--white-frame-closeup);
  --profile-finish:var(--white-frame-closeup);
  --profile-top:.99;
  --profile-right:.96;
  --profile-bottom:.92;
  --profile-left:.97;
  background:var(--white-frame-closeup);
}
.wall[data-frame-color="#d1d0cb"]:not(.is-taped,.has-profile,.aquarium) .frame.is-zoomed,
.wall[data-frame-color="#d1d0cb"]:not(.is-taped,.has-profile,.aquarium) .frame.is-zoomed::before {
  border-color:var(--white-closeup-bevel);
}

.wall.brooklyn .frame:nth-child(3) .frame-rail.right {
  clip-path:polygon(0 0,91% 0,94% 25%,91% 75%,93% 100%,var(--profile-rim) 100%);
}
.wall.brooklyn .frame:nth-child(3) .frame-rail.bottom {
  clip-path:polygon(16% 0,100% 0,calc(100% - var(--profile-rim)) 100%,12% 100%,13% 61%);
}

.controls #mat-toggle:disabled,
.controls .frame-colors:disabled .option > span {
  background:#dedbd3;
  border-color:#a7a39b;
  color:#625f58;
  cursor:default;
}
.controls .frame-colors:disabled .swatch {opacity:.45}

.poster-adhesive {display:none}
.wall.is-taped:not(.aquarium) .frame {
  --tape-unit:var(--print-unit,var(--cm));
  border-width:0;
  padding:0;
  background:transparent;
  box-shadow:.065cqw .12cqw .19cqw #100c095a;
}
.wall.is-taped.lounge .frame {position:relative}
.wall.is-taped .frame::before,
.wall.is-taped.brooklyn .frame:nth-child(3) .brooklyn-splinter {display:none}
.wall.is-taped:not(.aquarium) .poster-adhesive {
  display:block;
  position:absolute;
  inset:0;
  z-index:2;
  pointer-events:none;
}
.poster-tape {
  position:absolute;
  left:calc(var(--tape-x) + var(--tape-unit) * var(--tape-dx));
  top:calc(var(--tape-y) + var(--tape-unit) * var(--tape-dy));
  width:calc(var(--tape-unit) * var(--tape-length));
  height:calc(var(--tape-unit) * var(--tape-breadth));
  transform:translate(-50%,-50%) rotate(var(--tape-angle));
  filter:drop-shadow(.045cqw .06cqw .055cqw #120e0b75);
}
.poster-tape::before {
  content:"";
  position:absolute;
  inset:0;
  clip-path:var(--tape-outline);
  background:
    linear-gradient(174deg,#fff2bd30,transparent 30%,#5c451123 79%,#392b1646),
    repeating-linear-gradient(101deg,#f7e2ad13 0 .15px,#9a713d13 .3px .8px,transparent 1px 1.6px),
    var(--tape-surface,var(--tape-ambient,#bda061));
  opacity:.96;
}
.wall.cutter .frame {
  --tape-surface:color-mix(in srgb,var(--tape-ambient) calc(8% + 92% * var(--beam,0)),#111217);
}
.wall.stairhall .frame {
  --tape-surface:color-mix(in srgb,var(--tape-ambient) calc(70% + 27% * var(--stair-power,1)),#282d3b);
}
.wall.orbit .frame {
  --tape-surface:color-mix(in srgb,var(--tape-ambient) calc(73% + 22% * var(--orbital-led-power,0)),#263b52);
}
.wall.is-taped .frame.is-zoomed .poster-tape {--tape-surface:#d7b366}
