/* beforeword shared navigation and colophon. Editorial content stays in place. */
html.bw-book {
  --bw-paper:var(--bw-book-paper,#f7f5ee);
  --bw-ink:var(--bw-book-ink,#242421);
  --bw-muted:var(--bw-book-muted,#64645b);
  --bw-line:var(--bw-book-rule,#d8d5ca);
  --bw-panel:var(--bw-book-panel,#efede5);
}
html.bw-book .bw-site-header,
html.bw-book .bw-site-footer,
html.bw-book .bw-work-nav {
  box-sizing:border-box;position:relative;isolation:isolate;
  width:calc(100% - 64px);max-width:1200px;margin-inline:auto;
  color:var(--bw-ink);background:var(--bw-paper);
  font-family:var(--bw-book-sans,-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif);
  font-size:14px;line-height:1.5;letter-spacing:normal;text-transform:none;
  text-align:left;transform:none;filter:none;
}
html.bw-book .bw-site-header *,html.bw-book .bw-site-footer * {box-sizing:border-box}
html.bw-book .bw-site-header {
  display:flex;align-items:center;justify-content:space-between;gap:32px;
  min-height:88px;height:auto;padding:20px 0;border:0;border-bottom:1px solid var(--bw-line);
  border-radius:0;box-shadow:none;z-index:60;top:auto;left:auto;right:auto;bottom:auto;
}
html.bw-book .bw-site-header a,html.bw-book .bw-site-footer a,html.bw-book .bw-work-nav a {
  color:inherit;text-decoration:none;text-shadow:none;opacity:1;
}
html.bw-book .bw-site-header a:hover,html.bw-book .bw-site-footer a:hover,html.bw-book .bw-work-nav a:hover {
  text-decoration:underline;text-underline-offset:.25em;text-decoration-thickness:1px;
}
html.bw-book .bw-site-brand {
  flex:none;display:inline-flex;align-items:center;justify-content:flex-start;gap:13px;
  min-height:44px;padding:0;border:0;font-family:var(--bw-book-serif,Georgia,"Times New Roman",serif);
  font-size:25px;font-weight:400;line-height:1;letter-spacing:-.8px;text-transform:none;
}
html.bw-book .bw-site-brand img {
  display:block;flex:none;width:38px;height:32px;max-width:none;object-fit:contain;
  border:0;border-radius:0;box-shadow:none;mix-blend-mode:normal;opacity:1;
}
html.bw-book[data-theme="dark"] .bw-site-brand img {filter:invert(1)}
html.bw-book .bw-site-brand:hover {text-decoration:none;opacity:.75}
html.bw-book .bw-site-quick {
  display:flex;align-items:center;justify-content:flex-start;flex:1;gap:24px;
  margin:0;padding:0;border:0;background:transparent;font-size:13px;
}
html.bw-book .bw-site-quick a {display:inline-flex;align-items:center;min-height:44px;white-space:nowrap}
html.bw-book .bw-site-tools {display:flex;align-items:center;justify-content:flex-end;gap:8px;margin-left:auto}
html.bw-book .bw-site-language-wide {display:inline-flex}
html.bw-book .bw-site-language {
  display:inline-flex;align-items:center;justify-content:center;min-width:44px;min-height:44px;
  padding:8px;font:500 12px/1.2 var(--bw-book-sans,-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif);
  letter-spacing:.06em;border:0;background:transparent;
}
html.bw-book .bw-site-control,
html.bw-book .bw-site-menu > summary {
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  min-width:44px;min-height:44px;margin:0;padding:10px 12px;
  border:1px solid transparent;border-radius:4px;box-shadow:none;outline-offset:4px;
  color:var(--bw-ink);background:transparent;cursor:pointer;
  font:500 13px/1.25 var(--bw-book-sans,-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif);
  letter-spacing:0;text-transform:none;white-space:nowrap;appearance:none;
}
html.bw-book .bw-site-control[hidden] {display:none!important}
html.bw-book .bw-site-control:hover,html.bw-book .bw-site-menu > summary:hover {background:var(--bw-panel)}
html.bw-book .bw-site-control:active,html.bw-book .bw-site-menu > summary:active {background:var(--bw-line)}
html.bw-book .bw-site-control svg,html.bw-book .bw-site-menu > summary svg {
  display:block;flex:none;width:20px;height:20px;fill:none;stroke:currentColor;
  stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;
}
html.bw-book .bw-site-theme {padding:11px}
html.bw-book .bw-site-theme .bw-theme-sun {display:none}
html.bw-book[data-theme="dark"] .bw-site-theme .bw-theme-moon {display:none}
html.bw-book[data-theme="dark"] .bw-site-theme .bw-theme-sun {display:block}
html.bw-book .bw-site-menu {position:static;display:block;margin:0;padding:0;border:0;background:none}
html.bw-book .bw-site-menu > summary {list-style:none;user-select:none}
html.bw-book .bw-site-menu > summary::marker {content:""}
html.bw-book .bw-site-menu > summary::-webkit-details-marker {display:none}
html.bw-book .bw-site-menu > summary::before,html.bw-book .bw-site-menu > summary::after {content:none}
html.bw-book .bw-site-menu[open] > summary {background:var(--bw-panel);border-color:var(--bw-line)}
html.bw-book .bw-site-contents {
  display:block;position:absolute;top:calc(100% + 8px);right:0;left:auto;
  width:min(760px,100%);height:auto;max-height:calc(100dvh - 116px);overflow:auto;
  margin:0;padding:30px 32px 18px;border:1px solid var(--bw-line);border-radius:6px;
  background:var(--bw-paper);color:var(--bw-ink);box-shadow:0 18px 50px #00000015;
  overscroll-behavior:contain;z-index:65;
}
html.bw-book .bw-site-menu:not([open]) > .bw-site-contents {display:none}
html.bw-book .bw-site-nav-grid,html.bw-book .bw-site-footer-nav {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:28px}
html.bw-book .bw-site-nav-group {display:flex;flex-direction:column;align-items:stretch;min-width:0}
html.bw-book .bw-site-nav-label {
  margin:0 0 14px;padding:0;color:var(--bw-muted);font-size:11px;font-weight:500;
  letter-spacing:.06em;line-height:1.5;text-transform:uppercase;
}
html.bw-book .bw-site-nav-group a {
  display:flex;align-items:center;min-height:44px;padding:7px 0;border:0;
  font-family:inherit;font-size:14px;font-weight:400;line-height:1.4;
}
html.bw-book .bw-site-header a[aria-current="page"],html.bw-book .bw-site-footer a[aria-current="page"] {
  text-decoration:underline;text-underline-offset:.3em;text-decoration-thickness:1px;
}
html.bw-book .bw-site-menu-end {
  display:flex;align-items:center;justify-content:space-between;gap:16px;
  margin-top:24px;padding-top:12px;border-top:1px solid var(--bw-line);color:var(--bw-muted);
}
html.bw-book .bw-site-menu-end > a {display:inline-flex;align-items:center;min-height:44px;font-size:13px}
html.bw-book .bw-site-header :focus-visible,html.bw-book .bw-site-footer :focus-visible,html.bw-book .bw-work-nav :focus-visible {outline:2px solid currentColor;outline-offset:4px}
html.bw-book .bw-site-footer {
  display:grid;grid-template-columns:minmax(160px,1fr) minmax(0,2.7fr);gap:40px 64px;
  margin-top:clamp(64px,10vw,128px);padding:40px 0 calc(88px + env(safe-area-inset-bottom,0px));
  border:0;border-top:1px solid var(--bw-line);border-radius:0;box-shadow:none;
  min-height:0;max-height:none;z-index:1;
}
html.bw-book .bw-site-colophon {display:block;min-width:0}
html.bw-book .bw-site-colophon .bw-site-brand {font-size:24px}
html.bw-book .bw-site-colophon .bw-site-brand img {width:30px;height:26px}
html.bw-book .bw-site-colophon p {margin:20px 0 12px;color:var(--bw-muted);font:13px/1.7 var(--bw-book-sans,-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif)}
html.bw-book .bw-site-colophon p a {color:var(--bw-ink)}
html.bw-book .bw-site-contact {display:inline-flex;align-items:center;min-height:44px;font-size:12px;overflow-wrap:anywhere}
html.bw-book .bw-site-footer-nav {margin:0;padding:0;border:0;background:none}
html.bw-book .bw-site-footer-end {
  grid-column:1/-1;display:flex;align-items:center;justify-content:space-between;gap:16px;
  margin:0;padding-top:16px;border-top:1px solid var(--bw-line);color:var(--bw-muted);font-size:12px;
}
html.bw-book .bw-site-footer-end a {display:inline-flex;align-items:center;gap:10px;min-height:44px}
/* Legacy controls remain in the original document, but have one shared replacement. */
html.bw-book .plain-toolbar,html.bw-book .bws-theme {display:none!important}
html.bw-book .bw-work-nav {padding-block:16px}
html.bw-book .bw-work-nav nav {display:flex;align-items:center;flex-wrap:wrap;gap:8px 24px}
html.bw-book .bw-work-nav a {display:inline-flex;align-items:center;min-height:44px;font-size:13px}
html.bw-book .bw-work-nav [data-ma-language] {display:none}
@media(max-width:1180px) {
  html.bw-book .bw-site-quick {display:none}
  html.bw-book .bw-site-header {gap:16px}
}
@media(max-width:760px) {
  html.bw-book .bw-site-header,html.bw-book .bw-site-footer,html.bw-book .bw-work-nav {width:calc(100% - 40px)}
  html.bw-book .bw-site-header {min-height:76px;padding:15px 0;gap:12px}
  html.bw-book .bw-site-footer {grid-template-columns:1fr;gap:28px;padding-top:28px;margin-top:64px}
  html.bw-book .bw-site-colophon {display:grid;grid-template-columns:1fr auto;gap:0 20px;align-items:center}
  html.bw-book .bw-site-colophon p {margin:0;font-size:12px;text-align:right}
  html.bw-book .bw-site-contact {grid-column:1/-1}
  html.bw-book .bw-site-footer-nav {gap:20px}
  html.bw-book .bw-site-nav-group a {font-size:13px}
  html.bw-book .bw-site-nav-label {font-size:10px;letter-spacing:.04em}
  html.bw-book .bw-site-contents {max-height:calc(100dvh - 100px);padding:24px 20px 12px}
  html.bw-book .bw-site-nav-grid {gap:20px}
}
@media(max-width:640px) {
  html.bw-book .bw-site-header {gap:4px}
  html.bw-book .bw-site-header .bw-site-brand {min-width:44px;min-height:44px}
  html.bw-book .bw-site-header .bw-site-brand img {width:34px;height:30px}
  html.bw-book .bw-site-header .bw-site-brand > span {display:none}
  html.bw-book .bw-site-tools {gap:4px}
  html.bw-book .bw-site-menu > summary {font-size:12px;gap:7px;padding-inline:10px}
  html.bw-book .bw-site-menu > summary svg {width:17px;height:17px}
  html.bw-book .bw-site-nav-grid {grid-template-columns:1fr 1fr;gap:24px}
  html.bw-book .bw-site-nav-grid .bw-site-nav-group:last-child {grid-column:1/-1;display:grid;grid-template-columns:1fr 1fr;gap:0 24px}
  html.bw-book .bw-site-nav-grid .bw-site-nav-group:last-child .bw-site-nav-label {grid-column:1/-1}
  html.bw-book .bw-site-footer-nav {grid-template-columns:1fr 1fr;gap:24px}
  html.bw-book .bw-site-footer-nav .bw-site-nav-group:last-child {grid-column:1/-1;display:grid;grid-template-columns:1fr 1fr;gap:0 24px}
  html.bw-book .bw-site-footer-nav .bw-site-nav-group:last-child .bw-site-nav-label {grid-column:1/-1}
}
@media(max-width:360px) {
  html.bw-book .bw-site-header,html.bw-book .bw-site-footer,html.bw-book .bw-work-nav {width:calc(100% - 32px)}
  html.bw-book .bw-site-menu > summary {gap:5px;padding-inline:7px}
  html.bw-book .bw-site-colophon {grid-template-columns:1fr}
  html.bw-book .bw-site-colophon p {margin-top:12px;text-align:left}
}
@media(prefers-reduced-motion:no-preference) {
  html.bw-book .bw-site-control,html.bw-book .bw-site-menu > summary {transition:background-color .12s ease,border-color .12s ease}
}
@media(forced-colors:active) {
  html.bw-book .bw-site-menu[open] > summary,html.bw-book .bw-site-contents {border-color:ButtonText}
  html.bw-book .bw-site-brand img {filter:none;background:white;forced-color-adjust:none}
}
@media print {
  html.bw-book .bw-site-header,html.bw-book .bw-site-footer,html.bw-book .bw-work-nav {display:none!important}
  html.bw-book .bw-site-footer {padding-bottom:0!important}
}
/* Side analysis reserves real layout space. No transforms: fixed reader controls
   retain their viewport coordinates, and source selection stays in the document. */
@media screen and (min-width:900px) {
  html.bw-book[data-beforeword-panel="side"] body {
    width:calc(100% - var(--bw-reader-reserved,480px))!important;
    min-width:0!important;max-width:none!important;margin-inline:0!important;
  }
  html.bw-book[data-beforeword-panel="side"] body > main {
    max-width:100%!important;overflow-x:auto;
  }
  /* Page layouts written before the shared shell use viewport media queries.
     Their outer reading columns therefore need the available column width. */
  html.bw-book[data-beforeword-panel="side"][data-bw-reader-compact] {--bw-book-gutter:22px}
  html.bw-book[data-beforeword-panel="side"][data-bw-reader-compact] .bw-site-header,
  html.bw-book[data-beforeword-panel="side"][data-bw-reader-compact] .bw-site-footer,
  html.bw-book[data-beforeword-panel="side"][data-bw-reader-compact] .bw-work-nav {width:calc(100% - 40px)}
  html.bw-book[data-beforeword-panel="side"][data-bw-reader-compact] .bw-site-header {min-height:76px;padding:15px 0;gap:4px}
  html.bw-book[data-beforeword-panel="side"][data-bw-reader-compact] .bw-site-header .bw-site-brand {min-width:44px;min-height:44px}
  html.bw-book[data-beforeword-panel="side"][data-bw-reader-compact] .bw-site-header .bw-site-brand img {width:34px;height:30px}
  html.bw-book[data-beforeword-panel="side"][data-bw-reader-compact] .bw-site-quick,
  html.bw-book[data-beforeword-panel="side"][data-bw-reader-compact] .bw-site-header .bw-site-brand > span {display:none}
  html.bw-book[data-beforeword-panel="side"][data-bw-reader-compact] .bw-site-tools {gap:4px}
  html.bw-book[data-beforeword-panel="side"][data-bw-reader-compact] .bw-site-menu > summary {font-size:12px;gap:7px;padding-inline:10px}
  html.bw-book[data-beforeword-panel="side"][data-bw-reader-compact] .bw-site-contents {width:100%;padding:24px 20px 12px;max-height:calc(100dvh - 100px)}
  html.bw-book[data-beforeword-panel="side"][data-bw-reader-compact] .bw-site-footer {grid-template-columns:1fr;gap:28px;padding-top:28px;margin-top:64px}
  html.bw-book[data-beforeword-panel="side"][data-bw-reader-compact] :is(.bw-site-nav-grid,.bw-site-footer-nav) {grid-template-columns:1fr 1fr;gap:24px}
  html.bw-book[data-beforeword-panel="side"][data-bw-reader-compact] :is(.bw-site-nav-grid,.bw-site-footer-nav) .bw-site-nav-group:last-child {grid-column:1/-1;display:grid;grid-template-columns:1fr 1fr;gap:0 24px}
  html.bw-book[data-beforeword-panel="side"][data-bw-reader-compact] :is(.bw-site-nav-grid,.bw-site-footer-nav) .bw-site-nav-group:last-child .bw-site-nav-label {grid-column:1/-1}
  html.bw-book[data-beforeword-panel="side"][data-bw-reader-compact] .bw-site-nav-group a {font-size:13px}
  html.bw-book[data-beforeword-panel="side"][data-bw-reader-compact] body main :is(
    .bwa-opening,.bwa-purpose-grid,.about-method-list,.about-study-list,.about-route-grid,
    .bwh-hero,.hq-teaching,.hq-question,.hq-letter-demo,.reader-hero-grid,.human-entry,
    .human-step-grid,.bwd-document-grid,.bwl-layout,.bwl-delivery,.bwr-letter-layout,
    .bwr-intro-grid,.bwr-featured,.bwr-row,.bws-content,.reading-section,.note-card,
    .note-section,.rc-human,.rc-grid,.rc-procedure,.rc-example-records,.support-payment,
    .latest,.release-grid,.opening__statement,.check-layout,.paper-row) {
    grid-template-columns:minmax(0,1fr)!important;gap:24px!important;
  }
  html.bw-book[data-beforeword-panel="side"][data-bw-reader-compact] body main :is(.bwd-toc,.bwl-side,.bwr-aside,.bws-toc) {position:static!important;max-width:100%}
  html.bw-book[data-beforeword-panel="side"][data-bw-reader-compact] body main h1:not(#life-title):not(.written-letter) {font-size:2.5rem!important;line-height:1.14!important}
  html.bw-book[data-beforeword-panel="side"][data-bw-reader-compact] body main :is(.bwl-cards,.bwl-requests,.bwl-embed-links,.bwl-why-grid,.bwl-statement-notes,.bwh-cases,.bwh-swaps,.bwh-questions,.bwr-toolbar,.bwr-screen-list) {grid-template-columns:minmax(0,1fr)!important}
  html.bw-book[data-beforeword-panel="side"][data-bw-reader-compact] body main .bwr-toolbar > * {grid-column:auto!important;grid-row:auto!important}
}
@media print {
  html.bw-book[data-beforeword-panel] body {width:100%!important;min-width:0!important;max-width:none!important;margin-inline:0!important}
}
