/* Presentation only for the 48 explicitly marked legacy documents.
   Load after their original CSS. Shared header/footer, Reader frames, source
   text, table layout, DOM order, dialogs and event handlers remain independent.
   Golos and Beforeword Ballpoint are provided by the shared shell stylesheet. */

@media screen {
body[data-bw-unified="6"][data-bw-legacy-page="true"].bw-unified.bw-document {
  --bw-ui-bg:#f6f1e5;
  --bw-ui-surface:#f6f1e5;
  --bw-ui-soft:#eee9dd;
  --bw-ui-ink:#282a2b;
  --bw-ui-muted:#575b56;
  --bw-ui-line:#bfc1b5;
  --bw-ui-control:#777e70;
  --bw-ui-accent:#286344;
  --bw-ui-on-accent:#f6f1e5;
  --bw-ui-focus:#233e85;
  --bw-legacy-blue:#233e85;
  --bw-legacy-green:#286344;
  --bw-legacy-red:#a13239;
  --beta-paper:var(--bw-ui-bg);
  --beta-ink:var(--bw-ui-ink);
  --beta-muted:var(--bw-ui-muted);
  --beta-line:var(--bw-ui-line);
  --beta-panel:var(--bw-ui-surface);
  --shadow:none;
  font-family:Golos,Arial,sans-serif;
  font-size:var(--reading-size,18px);
  line-height:1.7;
  background:var(--bw-ui-bg)!important;
  color:var(--bw-ui-ink)!important;
}

html:is([data-theme="dark"],[data-appearance="dark"]) body[data-bw-unified="6"][data-bw-legacy-page="true"].bw-unified.bw-document {
  --bw-ui-bg:#242520;
  --bw-ui-surface:#242520;
  --bw-ui-soft:#30332b;
  --bw-ui-ink:#e3e0d4;
  --bw-ui-muted:#c4c3b8;
  --bw-ui-line:#626559;
  --bw-ui-control:#909783;
  --bw-ui-accent:#9ed5b2;
  --bw-ui-on-accent:#242520;
  --bw-ui-focus:#aec3fa;
  --bw-legacy-blue:#aec3fa;
  --bw-legacy-green:#9ed5b2;
  --bw-legacy-red:#f2a6a8;
}

/* Keep each document's reading width, grids, source quotations and tables. */
body[data-bw-unified="6"][data-bw-legacy-page="true"].bw-unified.bw-document main {
  font-family:Golos,Arial,sans-serif;
  color:var(--bw-ui-ink);
  background:transparent;
}
body[data-bw-unified="6"][data-bw-legacy-page="true"].bw-unified.bw-document main :is(h1,h2,h3,h4) {
  font-family:Golos,Arial,sans-serif;
  color:var(--bw-ui-ink);
  letter-spacing:-.025em;
  line-height:1.22;
}
body[data-bw-unified="6"][data-bw-legacy-page="true"].bw-unified.bw-document main h1 {
  font-size:clamp(2.05em,3.9vw,3em);
  font-weight:500;
  line-height:1.12;
  letter-spacing:-.045em;
  max-width:26ch;
  text-wrap:balance;
}
body[data-bw-unified="6"][data-bw-legacy-page="true"].bw-unified.bw-document main h2 {
  font-size:clamp(1.35em,2.5vw,1.8em);
  font-weight:500;
}
body[data-bw-unified="6"][data-bw-legacy-page="true"].bw-unified.bw-document main h3 {
  font-size:1.15em;
  font-weight:600;
}
body[data-bw-unified="6"][data-bw-legacy-page="true"].bw-unified.bw-document main :is(.wi-prose,.report-prose,.privacy-content,.beta-example-text) {
  font-family:Golos,Arial,sans-serif;
}

/* Paper controls use the same role colours as the shared navigation.
   Ordinary article links retain their text face and underlining. */
body[data-bw-unified="6"][data-bw-legacy-page="true"].bw-unified.bw-document main :is(button,.button,.wi-button,.beta-button,.beta-example-action,.ext-download,.text-link) {
  font-family:'Beforeword Ballpoint',Golos,Arial,sans-serif;
  font-size:max(1em,18px);
  font-weight:400;
  line-height:1.45;
  letter-spacing:0;
  color:var(--bw-legacy-green);
  background:transparent;
  border-color:var(--bw-ui-control);
  border-radius:0;
  box-shadow:none;
  min-height:44px;
}
body[data-bw-unified="6"][data-bw-legacy-page="true"].bw-unified.bw-document main :is(.wi-button,.beta-button,.ext-download):hover {
  color:var(--bw-legacy-green);
  background:var(--bw-ui-soft);
  border-color:var(--bw-legacy-green);
}
body[data-bw-unified="6"][data-bw-legacy-page="true"].bw-unified.bw-document main :is(.wi-eyebrow,.wi-label,.beta-kicker,.beta-example-kind,.ext-kicker,.ext-field-label,.ext-step-number,.report-kicker,.report-eyebrow) {
  font-family:'Beforeword Ballpoint',Golos,Arial,sans-serif;
  font-size:max(.85em,15px);
  font-weight:400;
  letter-spacing:0;
  line-height:1.5;
  color:var(--bw-legacy-blue);
  text-transform:none;
}
body[data-bw-unified="6"][data-bw-legacy-page="true"].bw-unified.bw-document main :is(.wi-inline,.wi-top,.beta-more-examples>summary,.beta-explainer>summary,.beta-reader-heading>a,.beta-feedback a,.wi-toc summary,.bw-page-outline>summary) {
  font-family:'Beforeword Ballpoint',Golos,Arial,sans-serif;
  font-size:max(.95em,17px);
  line-height:1.5;
  color:var(--bw-legacy-green);
  min-height:44px;
}
body[data-bw-unified="6"][data-bw-legacy-page="true"].bw-unified.bw-document main :is(.wi-toc a[aria-current="location"],.bw-document-toc a[aria-current="location"]) {
  color:var(--bw-legacy-red);
  border-color:var(--bw-legacy-red);
  text-decoration:underline;
}

/* Remove obsolete card/chrome treatments without altering their structure. */
body[data-bw-unified="6"][data-bw-legacy-page="true"].bw-unified.bw-document main :is(.card,.wi-annex-heading,.wi-archive-note,.wi-context,.wi-prose details,.bw-page-outline,.beta-reading-example,.beta-guide,.beta-reader-wrap,.ext-source,.ext-added,.ext-data,.ext-privacy,.release-status) {
  border-radius:0;
  box-shadow:none;
  border-color:var(--bw-ui-line);
  background:transparent;
  color:var(--bw-ui-ink);
}
body[data-bw-unified="6"][data-bw-legacy-page="true"].bw-unified.bw-document main :is(textarea,select,input:not([type="radio"]):not([type="checkbox"]):not([type="range"])) {
  font-family:Golos,Arial,sans-serif;
  color:var(--bw-ui-ink);
  background:var(--bw-ui-surface);
  border-color:var(--bw-ui-control);
  border-radius:0;
  box-shadow:none;
}
body[data-bw-unified="6"][data-bw-legacy-page="true"].bw-unified.bw-document main :is(a,button,input,textarea,select,summary):focus-visible {
  outline:2px solid var(--bw-legacy-blue);
  outline-offset:4px;
}

/* Existing native dialogs retain all IDs, radio values and close handlers. */
body[data-bw-unified="6"][data-bw-legacy-page="true"].bw-unified.bw-document dialog[data-bw-shell] {
  font-family:Golos,Arial,sans-serif;
  font-size:16px;
  line-height:1.55;
  background:var(--bw-ui-bg);
  color:var(--bw-ui-ink);
  border:1px solid var(--bw-ui-control);
  border-radius:0;
  box-shadow:none;
  width:min(480px,calc(100% - 32px));
  max-height:calc(100dvh - 32px);
  padding:24px;
  overflow:auto;
  overscroll-behavior:contain;
}
body[data-bw-unified="6"][data-bw-legacy-page="true"].bw-unified.bw-document dialog[data-bw-shell]::backdrop {
  background:#17191477;
  backdrop-filter:none;
}
body[data-bw-unified="6"][data-bw-legacy-page="true"].bw-unified.bw-document dialog[data-bw-shell] :is(.dialog-head h2,legend,.theme-option>span,.size-choices label>span,.dialog-done) {
  font-family:'Beforeword Ballpoint',Golos,Arial,sans-serif;
  font-weight:400;
  letter-spacing:0;
}
body[data-bw-unified="6"][data-bw-legacy-page="true"].bw-unified.bw-document dialog[data-bw-shell] .dialog-head h2 {
  color:var(--bw-legacy-blue);
  font-size:26px;
  line-height:1.3;
  margin:0;
}
body[data-bw-unified="6"][data-bw-legacy-page="true"].bw-unified.bw-document dialog[data-bw-shell] legend {
  color:var(--bw-legacy-blue);
  font-size:21px;
  line-height:1.35;
}
body[data-bw-unified="6"][data-bw-legacy-page="true"].bw-unified.bw-document dialog[data-bw-shell] .choice-group {
  background:transparent;
  border-radius:0;
  padding:0;
  gap:8px;
}
body[data-bw-unified="6"][data-bw-legacy-page="true"].bw-unified.bw-document dialog[data-bw-shell] .choice-group label>span {
  border:1px solid var(--bw-ui-control);
  border-radius:0;
  box-shadow:none;
  background:transparent;
  color:var(--bw-legacy-green);
  min-height:48px;
  font-size:20px;
}
body[data-bw-unified="6"][data-bw-legacy-page="true"].bw-unified.bw-document dialog[data-bw-shell] .theme-option>span {
  font-size:19px;
  white-space:normal;
}
body[data-bw-unified="6"][data-bw-legacy-page="true"].bw-unified.bw-document dialog[data-bw-shell] .choice-group input:checked+span {
  color:var(--bw-legacy-red);
  border-color:var(--bw-legacy-red);
  background:transparent;
  box-shadow:none;
  text-decoration:underline;
  text-underline-offset:.2em;
  outline:1px solid var(--bw-legacy-red);
  outline-offset:-3px;
}
body[data-bw-unified="6"][data-bw-legacy-page="true"].bw-unified.bw-document dialog[data-bw-shell] .choice-group input:focus-visible+span {
  outline:2px solid var(--bw-legacy-blue);
  outline-offset:4px;
}
body[data-bw-unified="6"][data-bw-legacy-page="true"].bw-unified.bw-document dialog[data-bw-shell] :is(button,.button) {
  color:var(--bw-legacy-green);
  background:transparent;
  border-color:var(--bw-ui-control);
  border-radius:0;
  box-shadow:none;
  min-height:44px;
}
body[data-bw-unified="6"][data-bw-legacy-page="true"].bw-unified.bw-document dialog[data-bw-shell] .dialog-done {
  font-size:22px;
  min-height:48px;
}
body[data-bw-unified="6"][data-bw-legacy-page="true"].bw-unified.bw-document dialog[data-bw-shell] .settings-sample {
  font-family:Golos,Arial,sans-serif;
  font-size:var(--reading-size,18px);
  line-height:1.7;
  background:transparent;
  border:1px solid var(--bw-ui-line);
  border-radius:0;
  padding:18px;
}
body[data-bw-unified="6"][data-bw-legacy-page="true"].bw-unified.bw-document dialog[data-bw-shell] .caption {
  color:var(--bw-ui-muted);
}
body[data-bw-unified="6"][data-bw-legacy-page="true"].bw-unified.bw-document dialog[data-bw-shell] :is(button,a):focus-visible {
  outline:2px solid var(--bw-legacy-blue);
  outline-offset:4px;
}
}

@media screen and (max-width:600px) {
  body[data-bw-unified="6"][data-bw-legacy-page="true"].bw-unified.bw-document main h1 {
    font-size:2em;
  }
  body[data-bw-unified="6"][data-bw-legacy-page="true"].bw-unified.bw-document dialog[data-bw-shell] {
    padding:20px;
  }
}

@media screen and (forced-colors:active) {
  body[data-bw-unified="6"][data-bw-legacy-page="true"].bw-unified.bw-document {
    --bw-ui-bg:Canvas;
    --bw-ui-surface:Canvas;
    --bw-ui-soft:Canvas;
    --bw-ui-ink:CanvasText;
    --bw-ui-muted:CanvasText;
    --bw-ui-line:CanvasText;
    --bw-ui-control:ButtonText;
    --bw-ui-accent:LinkText;
    --bw-ui-focus:Highlight;
    --bw-legacy-blue:LinkText;
    --bw-legacy-green:LinkText;
    --bw-legacy-red:Highlight;
  }
}
