/* Shared document controls; the text and navigation remain ordinary HTML. */
.document-page { min-height: 100svh; }
.document-page main { overflow-wrap: anywhere; }
.document-page header { align-items: center; }
.document-page header > a { min-width: 0; }
.document-switch {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  padding: 8px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.document-switch svg { display: block; width: 27px; height: 31px; fill: none; stroke: currentColor; stroke-width: 1.2; stroke-linejoin: round; }
.document-switch:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }
.document-ascii, .document-command, .document-end, .document-terminal-output, .document-terminal-bar { display: none; }
.document-page nav a { padding-block: 8px; }
.document-page a:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }
.document-page footer .credit { margin-bottom: 1.5rem; }

/* Shorter legal copy stays beside its full Plain text reference. The atlas
   and newspaper clone these same paragraphs, including both versions. */
.document-immersive-copy { display: none; }
html:is([data-view="sky"], [data-view="front-page"], [data-view="receipt"], [data-view="solar-system"]) .document-full-copy { display: none; }
html:is([data-view="sky"], [data-view="front-page"], [data-view="receipt"], [data-view="solar-system"]) .document-immersive-copy { display: inline; }

/* Plain text, including the document's no-script fallback. */
:is(html:not([data-view]), html[data-view="plain"]) .document-page main {
  display: flex;
  flex-direction: column;
  max-width: 56rem;
  min-height: 100svh;
  padding: 8px 12px 0;
  font-size: 13px;
  line-height: 1.4;
  letter-spacing: -0.015em;
}
:is(html:not([data-view]), html[data-view="plain"]) .document-page main > * { flex-shrink: 0; }
:is(html:not([data-view]), html[data-view="plain"]) .document-page header { align-items: flex-start; margin-bottom: 2rem; }
:is(html:not([data-view]), html[data-view="plain"]) .document-page .document-switch { width: 32px; height: 32px; padding: 0; }
:is(html:not([data-view]), html[data-view="plain"]) .document-page h1 {
  margin-bottom: 0.5rem;
  font-size: 13px;
  line-height: 1.25;
}
:is(html:not([data-view]), html[data-view="plain"]) .document-page h2 {
  margin: 2rem 0 0.5rem;
  font-family: inherit;
  font-size: 13px;
  font-weight: bold;
  letter-spacing: inherit;
  line-height: 1.4;
  text-transform: none;
}
:is(html:not([data-view]), html[data-view="plain"]) .document-page :is(main, .document-plain-content) > p,
:is(html:not([data-view]), html[data-view="plain"]) .document-page :is(main, .document-plain-content) > ul { max-width: 88ch; margin-bottom: 0.5rem; }
:is(html:not([data-view]), html[data-view="plain"]) .document-page main > .note { margin-bottom: 2rem; font-size: 11px; }
:is(html:not([data-view]), html[data-view="plain"]) .document-page li + li { margin-top: 2px; }
:is(html:not([data-view]), html[data-view="plain"]) .document-page :is(main, .document-plain-content) > p a,
:is(html:not([data-view]), html[data-view="plain"]) .document-page :is(main, .document-plain-content) > ul a { text-underline-offset: 0.18em; }
:is(html:not([data-view]), html[data-view="plain"]) .document-page footer {
  --surface: #000;
  --ink: #fff;
  --ink-secondary: #d6d6d6;
  --ink-tertiary: #bfbfbf;
  --rule: #545454;
  margin: auto -12px 0;
  padding: 1.5rem 12px;
  border: 0;
  background: #000;
  color: #fff;
}
:is(html:not([data-view]), html[data-view="plain"]) .document-page footer nav { align-items: center; gap: 4px 1rem; }
:is(html:not([data-view]), html[data-view="plain"]) .document-page footer .credit { margin-bottom: 0.75rem; font-size: 11px; line-height: 1.3; }
:is(html:not([data-view]), html[data-view="plain"]) .document-page header > a,
:is(html:not([data-view]), html[data-view="plain"]) .document-page footer nav > a,
:is(html:not([data-view]), html[data-view="plain"]) .document-page footer nav > .view-picker {
  font-size: 11px;
  line-height: 1.1;
  letter-spacing: 0.1em;
}
:is(html:not([data-view]), html[data-view="plain"]) .document-page footer nav > a,
:is(html:not([data-view]), html[data-view="plain"]) .document-page .view-toggle { min-height: 0; padding-block: 0; }
:is(html:not([data-view]), html[data-view="plain"]) .document-page footer nav > .view-picker { padding: 0; }
:is(html:not([data-view]), html[data-view="plain"]) .document-plain-content { padding-bottom: 1.5rem; }
:is(html:not([data-view]), html[data-view="plain"]) .document-plain-content > :first-child { margin-top: 0; }
:is(html:not([data-view]), html[data-view="plain"]) .document-plain-content:focus-visible { outline: 1px solid var(--rule); outline-offset: -1px; }

@media screen and (min-width: 960px), screen and (hover: hover) and (pointer: fine) {
  :is(html:not([data-view]), html[data-view="plain"]) .document-page main.has-plain-document {
    height: 100dvh;
    min-height: 0;
  }
  :is(html:not([data-view]), html[data-view="plain"]) .has-plain-document > .document-plain-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }
  :is(html:not([data-view]), html[data-view="plain"]) .has-plain-document > footer { margin-top: 0; }
}

@media screen and (min-width: 960px) {
  :is(html:not([data-view]), html[data-view="plain"]) .document-page main { padding-inline: 32px; }
  :is(html:not([data-view]), html[data-view="plain"]) .document-page footer { margin-inline: -32px; padding-inline: 32px; }
}

@media print {
  html:not([data-view]) .document-page,
  html[data-view="plain"] .document-page {
    --surface: #fff;
    --ink: #000;
    --ink-secondary: #545454;
    --ink-tertiary: #737373;
    --rule: #a8a8a8;
    background: #fff;
    color: #000;
  }
  html:not([data-view]) .document-page main,
  html[data-view="plain"] .document-page main {
    display: block;
    min-height: 0;
    max-width: none;
    padding: 0;
  }
  html:not([data-view]) .document-page footer,
  html[data-view="plain"] .document-page footer {
    --surface: #fff;
    --ink: #000;
    --ink-secondary: #545454;
    --ink-tertiary: #737373;
    margin-inline: 0;
    padding-inline: 0;
    background: #fff;
    color: #000;
  }
  :is(html:not([data-view]), html[data-view="plain"]) .document-page h1,
  :is(html:not([data-view]), html[data-view="plain"]) .document-page h2 { break-after: avoid; }
  :is(html:not([data-view]), html[data-view="plain"]) .document-page .document-switch,
  :is(html:not([data-view]), html[data-view="plain"]) .document-page .view-picker { display: none; }
}
