/* Issue 40: shared site-owned shell. The rail is outside the centered content. */
:root {
  --dp-content-max: 1300px;
  --dp-reading-max: 1000px;
  --dp-nav-width: 224px;
  --dp-tree-step: 10px;
}
.p-body { min-width: 0; }
html .p-body > .p-body-inner,
html.dp-no-rail .p-body > .p-body-inner {
  box-sizing: border-box;
  width: calc(100% - 2 * var(--dp-page-gutter, 20px));
  max-width: var(--dp-content-max);
  min-width: 0;
  flex: 0 1 var(--dp-content-max);
  margin-inline: auto;
  padding-inline: 0;
}
/* Only gallery indexes opt out; individual media/comments keep the shared shell. */
html:is([data-template="xfmg_media_index"], [data-template="xfmg_category_view"], [data-template="xfmg_album_list"], [data-template="xfmg_album_view"]) .p-body > .p-body-inner {
  max-width: none;
  flex: 1 1 0%;
  width: auto;
  margin-inline: var(--dp-page-gutter, 20px);
}
.p-body-content, .p-body-pageContent, .resourceBody-main { min-width: 0; }
.p-body-content .message .message-body .bbWrapper,
.p-body-content .resourceBody-main .bbWrapper {
  box-sizing: border-box;
  max-width: var(--dp-reading-max);
  margin-inline: auto;
  overflow-wrap: anywhere;
}
.p-body-content .message-body .attachmentList { max-width: var(--dp-reading-max); margin-inline: auto; }
.p-body-content .message .message-attachments { box-sizing: border-box; max-width: var(--dp-reading-max); margin-inline: auto; }
/* Context and lesson controls share one bounded workspace, with no far-right text. */
.ctWorkspace.ctLessonLayout { grid-template-columns: 260px minmax(0, 1fr); gap: 24px; }
.ctWorkspace .ctLesson { max-width: var(--dp-reading-max); }
.ctWorkspace .ctActions > * { max-width: 100%; white-space: normal; }
.ctWorkspace .ctOutline summary { overflow-wrap: anywhere; }
@media (max-width: 900px) { .ctWorkspace.ctLessonLayout { display: block; } .ctLessonLayout > aside { margin-bottom: 20px; } }
/* Featured resources follow available content width, including right widget columns. */
.p-body-content { container-type: inline-size; container-name: dp-content; }
.dp-promotion-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
@container dp-content (max-width: 1050px) { .dp-promotion-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@container dp-content (max-width: 540px) { .dp-promotion-grid { grid-template-columns: minmax(0,1fr); } }
@media (max-width: 1100px) {
  html .p-body > .p-body-inner { flex-basis: calc(100% - 2 * var(--dp-page-gutter,16px)); }
}
