#workspace {
  display: grid; grid-template-columns: clamp(175px,16vw,230px) minmax(0,1fr) minmax(0,min(var(--size,52%),calc(100% - clamp(175px,16vw,230px) - 225px)));
  align-items: start; background: var(--paper);
}
.contents,.writing,.reader { min-width: 0; }
.contents {
  position: sticky; top: 0; max-height: 100dvh; overflow: auto;
  padding: 22px clamp(12px,1.35vw,22px);
}
.contents > details > summary,.rail-title,.rule-heading { font: 600 .88rem/1.5 "Work Sans", sans-serif; color: var(--ink); }
.contents > details > summary { margin: 0 0 10px; }
#toc details { border-top: 1px solid var(--rule); }
#toc summary, #toc a, #sections a {
  display: grid; grid-template-columns: 2.25em 1fr; align-items: baseline;
  padding: 9px 6px; line-height: 1.35; font-size: .89rem; text-decoration: none;
}
#toc summary { grid-template-columns: 1.5em 1fr 10px; font-weight: 550; list-style: none; }
#toc summary::-webkit-details-marker { display:none; }
#toc summary::before,#toc a::before { color: var(--quiet); font: .78rem/1.5 var(--mono); }
#toc summary::before { content: attr(data-index); }
#toc summary::after { content: '+'; color: var(--quiet); }
#toc details[open] summary::after { content: '−'; }
#toc a { margin-left: 6px; padding: 5px 8px; }
#toc a::before { content: attr(data-code); }
#toc a[aria-current],#toc a:hover { background: var(--active); color: var(--pine); }
#toc a[aria-current] { box-shadow: inset 2px 0 var(--pine); }
#toc details[open] { padding-bottom: 6px; }
.writing { border-inline: 1px solid var(--rule); padding: 24px clamp(16px,2vw,34px); min-height: calc(100vh - 70px); }
#heading { font: 500 1.34rem/1.28 var(--serif); margin: 9px 0 18px; letter-spacing: -.016em; }
.reader {
  position: relative; padding: 20px clamp(12px,1.5vw,25px) 24px;
  background: var(--desk); align-self: stretch;
}
.reader > .rail-title { padding-bottom: 10px; }
.tools,.panehead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#panes {
  display: flex; flex-direction: column; height: max(500px,calc(100dvh - 142px));
  border: 1px solid var(--strong-rule); background: var(--paper);
}
.pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--paper); }
.pane:first-child { flex: var(--top-weight,60) 1 0; }
.pane:last-child { flex: var(--bottom-weight,40) 1 0; }
.pane.folded { flex: 0 0 auto; }
.panehead,.tools { flex-shrink: 0; }
.divider { position: relative; z-index: 1; touch-action: none; user-select: none; }
.divider::before,.divider::after { content: ""; position: absolute; background: var(--strong-rule); }
.divider::after { background: var(--pine); border-radius: 2px; }
.divider:hover::before,.divider:focus-visible::before,.divider.resizing::before { background: var(--pine); }
.divider.horizontal { flex: 0 0 13px; cursor: row-resize; background: var(--paper); }
.divider.horizontal::before { inset: 50% 0 auto; height: 1px; }
.divider.horizontal::after { left: calc(50% - 20px); top: calc(50% - 1px); width: 40px; height: 3px; }
.divider.vertical { position: absolute; inset: 0 auto 0 -7px; width: 13px; cursor: col-resize; }
.divider.vertical::before { inset: 0 auto 0 50%; width: 1px; }
.divider.vertical::after { top: min(44vh,50%); left: calc(50% - 1px); width: 3px; height: 40px; }
.divider[aria-disabled=true] { flex-basis: 1px; cursor: default; }
.divider[aria-disabled=true]::after { display: none; }
.panehead { padding: 8px 11px; flex-wrap: nowrap; }
.panehead h2 { flex: 1; font-size: .97rem; line-height: 1.3; font-weight: 600; }
.panehead button { font-size: .79rem; background: transparent; border-color: transparent; }
.panehead button:hover,.panehead button:focus-visible { border-color: var(--strong-rule); }
.panehead .move { font-size: 18px; line-height: 1.25; cursor: grab; touch-action: none; padding: 0 4px; color: var(--quiet); }
.dragging { outline: 2px dashed var(--pine); outline-offset: -2px; }
.tools { padding: 3px 12px 8px; font-size: .8rem; color: var(--quiet); }
.tools a { margin-right: auto; font-family: var(--mono); }
.tools select { border: 1px solid var(--rule); background: var(--paper); }
.tools input { accent-color: var(--pine); }
#frame { background: #d2d7ce; padding: 10px; overflow: auto; min-height: 0; flex: 1; scrollbar-gutter: stable; overscroll-behavior: none; }
#paper { position: relative; background: white; box-shadow: 0 1px 3px #202c3026; }
#frame.zoomed #paper { cursor: grab; user-select: none; }
#frame.panning #paper { cursor: grabbing; }
canvas { display: block; width: 100%; height: auto; }
#marks { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: multiply; }
#marks i { position: absolute; background: #f5d55288; border-bottom: 1px solid #956a1988; }
#text { min-height: 0; flex: 1; overflow: auto; padding: 0 15px 10px; overscroll-behavior: contain; }
#status { margin: 4px 11px; font-size: .86rem; }
#status:empty { display: none; }
.pane.folded > :not(.panehead) { display: none; }
.rule-heading { margin-top: 24px; padding-bottom: 7px; border-bottom: 1px solid var(--strong-rule); }
#list button { display: grid; width: 100%; grid-template-columns: minmax(0,1fr) auto; padding: 9px 8px; gap: 2px 8px; text-align: left; border: 0; border-bottom: 1px solid var(--rule); border-radius: 0; background: transparent; font-size: .94rem; line-height: 1.4; }
#list button::after { content: attr(data-folio); grid-area: 1 / 2; text-align: right; font: .8rem/1.5 var(--mono); }
#list span { grid-area: 2 / 1; font: .77rem/1.4 var(--mono); color: var(--quiet); }
#list button[aria-current=true] { background: var(--active); box-shadow: inset 2px 0 var(--pine); }
#list button:hover { background: var(--index); }
#note dl { margin: 8px 0; }
#note dt { margin-top: 10px; font-weight: 550; }
#note dd { margin: 3px 0; }
#note { margin-top: 12px; font-size: .9rem; color: var(--quiet); }
footer { border-top: 1px solid var(--strong-rule); padding: 20px clamp(16px,3vw,44px); background: var(--index); display: flex; justify-content: space-between; gap: 22px; }
footer h2 { font: 500 1.2rem var(--serif); }
footer ol { padding-left: 1.35em; margin: 8px 0; font-size: .91rem; max-width: 90ch; }
footer nav { display: grid; align-content: start; gap: 6px; flex-shrink: 0; font-size: .9rem; }
@media(min-width:901px) { #workspace.no-evidence { grid-template-columns: clamp(175px,16vw,230px) minmax(0,800px); } }
@media(max-width:900px) {
  #workspace { display: block; }
  .contents { position: static; max-height: 44vh; padding: 9px 16px; border-bottom: 1px solid var(--rule); }
  .contents .report-source { display: none; }
  .contents > details > summary { margin: 0; }
  .writing { min-height: 0; border: 0; }
  .divider.vertical { display: none; }
  #panes { height: max(480px,82dvh); }
  footer { display: block; }
}
