.plan-drawing {
  --pd-paper: #f6f3e8;
  --pd-rule: #213f38;
  --pd-body: #d8e3d6;
  --pd-swing: #408170;
  --pd-warm: #a24e2d;
  position: relative;
  isolation: isolate;
  container-type: inline-size;
  width: 100%;
  aspect-ratio: 1.67;
  overflow: hidden;
  background-color: var(--pd-paper);
  background-image:
    linear-gradient(90deg, rgba(71, 89, 66, .13) 1px, transparent 1px),
    linear-gradient(rgba(71, 89, 66, .13) 1px, transparent 1px),
    linear-gradient(90deg, rgba(71, 89, 66, .055) 1px, transparent 1px),
    linear-gradient(rgba(71, 89, 66, .055) 1px, transparent 1px);
  background-size: 80px 80px, 80px 80px, 16px 16px, 16px 16px;
  background-position: center;
}

.plan-drawing .pd-sheet {
  position: absolute;
  inset: 0;
  font: 650 clamp(11px, 2.8cqw, 13px)/1 var(--sans, sans-serif);
  letter-spacing: .005em;
  color: var(--pd-rule);
}

.pd-sheet > span { position: absolute; box-sizing: border-box; }

.pd-body {
  left: 12%;
  top: 11%;
  width: 53%;
  height: 34.5%;
  background: var(--pd-body);
  border: 2px solid var(--pd-rule);
  border-radius: 3px 3px 1px 1px;
  box-shadow: inset 0 0 0 3px rgba(251, 252, 246, .55);
}

.pd-body::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(34, 65, 56, .28);
  border-radius: 1px;
}

.pd-body-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  white-space: nowrap;
}

.pd-closed-door {
  top: 45.2%;
  height: 4.4%;
  border: 1.5px solid var(--pd-rule);
  border-radius: 1px 1px 3px 3px;
}

.pd-left-door {
  left: 12%;
  width: 26.4%;
  background: #aec6b6;
}

.pd-left-door::before {
  content: "";
  position: absolute;
  top: calc(100% + 1px);
  right: 6%;
  width: 42%;
  height: 2px;
  background: var(--pd-rule);
  border-radius: 0 0 2px 2px;
}

.pd-right-door {
  left: 38.8%;
  width: 26.2%;
  background: rgba(222, 235, 221, .7);
  border-color: #6c8b75;
  border-style: dashed;
}

.pd-sweep {
  right: 35%;
  top: 48.6%;
  width: 26.4%;
  aspect-ratio: 1;
  border-left: 1.5px dashed var(--pd-swing);
  border-bottom: 1.5px dashed var(--pd-swing);
  border-bottom-left-radius: 100%;
  background: rgba(94, 156, 135, .10);
}

.pd-open-door {
  top: 48.6%;
  left: 64.1%;
  width: 2.35%;
  height: 44%;
  border: 1.5px solid var(--pd-rule);
  border-radius: 1px 2px 3px 2px;
  background: #aec6b6;
}

.pd-open-door i {
  position: absolute;
  left: 100%;
  top: 48%;
  width: clamp(5px, 1.5cqw, 7px);
  height: 42%;
  border: 1.5px solid var(--pd-rule);
  border-left: 0;
  border-radius: 0 2px 2px 0;
  background: var(--pd-paper);
}

.pd-hinge {
  top: 48.6%;
  left: 65%;
  width: clamp(7px, 2.25cqw, 11px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 2px solid var(--pd-rule);
  border-radius: 50%;
  background: var(--pd-paper);
}

.pd-hinge-leader {
  top: 49.8%;
  right: 35.7%;
  width: 6.4%;
  border-top: 1px solid var(--pd-rule);
  transform-origin: right center;
  transform: rotate(-30deg);
}

.pd-hinge-label {
  top: 54.2%;
  right: 42.1%;
  font-size: 1em;
}

.pd-side-wall {
  top: 7.5%;
  bottom: 7.5%;
  left: 77.7%;
  width: 5.7%;
  border: 1px solid var(--pd-warm);
  border-left-width: 2px;
  background-color: #f0d8bb;
  background-image: repeating-linear-gradient(135deg, transparent 0 4px, rgba(162,78,45,.68) 4px 5px);
}

[data-wall="short"] .pd-side-wall { bottom: 53.5%; }
[data-wall="partial"] .pd-side-wall { bottom: 31.5%; }
[data-wall="partial"] .pd-side-wall::after {
  content: "";
  display: block;
  position: absolute;
  top: 101%;
  left: -2px;
  width: calc(100% + 3px);
  height: 4.3cqw;
  border-left: 2px dashed var(--pd-warm);
  border-right: 1px dashed var(--pd-warm);
  opacity: .5;
  box-sizing: border-box;
}

.pd-wall-label {
  left: 85.3%;
  top: 9%;
  color: #863c24;
  writing-mode: vertical-rl;
  white-space: nowrap;
  font-size: 1em;
}

.pd-dimension {
  top: 25%;
  left: 65.1%;
  width: 12.6%;
  border-top: 1.5px solid var(--pd-warm);
  color: #813a24;
}

.pd-dimension::before, .pd-dimension::after {
  content: "";
  position: absolute;
  top: 0;
  width: 1px;
  height: clamp(6px, 1.8cqw, 9px);
  transform: translateY(-60%) rotate(28deg);
  background: var(--pd-warm);
}

.pd-dimension::before { left: 1px; }
.pd-dimension::after { right: 1px; }
.pd-dimension i {
  position: absolute;
  bottom: 5px;
  left: 50%;
  padding-inline: 2px;
  transform: translateX(-50%);
  background: var(--pd-paper);
  font-size: 1em;
  font-style: normal;
  letter-spacing: 0;
}

/* The pivot reference stays fixed while the right wall end changes. */
.pd-hinge-plane {
  top: 48.6%;
  left: 65%;
  width: 23%;
  border-top: 1px dashed #6c8277;
}
.pd-angle-label {
  top: 71%;
  left: 46%;
  color: #285347;
  font-variant-numeric: tabular-nums;
}
.pd-handle-leader {
  top: 87.2%;
  left: 43.8%;
  width: 24%;
  border-top: 1px solid var(--pd-rule);
  transform-origin: left center;
  transform: rotate(-5deg);
}
.pd-handle-label {
  top: 87.2%;
  right: 56.9%;
  transform: translateY(-42%);
}
@media (forced-colors: active) {
  .pd-dimension,.pd-hinge-plane,.pd-angle-label,.pd-wall-label { color: CanvasText; }
  .pd-side-wall { border: 2px double CanvasText; }
  .pd-sweep,.pd-hinge-plane { border-color: GrayText; }
}
