/* Pages for reading: docs, decisions, benchmarks, status. The same
   paper, fields and Anybody as the landing pages, standing still.

   Contrast: the band is a field. On sky it carries only the large
   title (white on sky 3.9, large type only); small text never sits on
   it. Links on paper use --sky-text (5.4). Chips are ink on leaf, sun,
   bone and coral, all at least 4.5. */

.reading {
  --band: var(--sky);
  --band-ink: var(--paper);
  --accent: var(--sky);
  --link: var(--sky-text);
  --side-w: 14.5rem;
  --toc-w: 13.5rem;
}

/* ---------------------------------------------------------- band */

.band {
  background: var(--band);
  color: var(--band-ink);
}
.field-sky {
  --band: var(--sky);
  --band-ink: var(--paper);
  --accent: var(--sky);
}
.field-sky-deep {
  --band: var(--sky-deep);
  --band-ink: var(--paper);
  --accent: var(--sky-deep);
}
.field-sun {
  --band: var(--sun);
  --band-ink: var(--ink);
  --accent: var(--sun);
}
.field-leaf {
  --band: var(--leaf);
  --band-ink: var(--ink);
  --accent: var(--leaf);
}
.field-tangerine {
  --band: var(--tangerine);
  --band-ink: var(--ink);
  --accent: var(--tangerine);
}

.band-in {
  max-width: var(--wide);
  margin-inline: auto;
  padding: clamp(2.25rem, 6vw, 4.75rem) var(--gutter-r)
    clamp(2rem, 5vw, 4rem) var(--gutter);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 1.5rem;
}
.band h1 {
  font-size: clamp(2rem, 1.3rem + 3.6vw, 4.5rem);
  font-weight: 800;
  font-stretch: 112%;
  line-height: 1;
  letter-spacing: -0.01em;
  max-width: 19em;
  overflow-wrap: break-word;
  hyphens: manual;
}
.band h1 code {
  font-family: inherit;
  font-size: inherit;
}
.adr-num {
  display: block;
  margin-bottom: 0.35em;
  /* bold and at least 18.66px: large text, so white on sky passes */
  font-size: max(0.5em, 1.25rem);
  font-stretch: 125%;
  font-weight: 900;
}
.band-mark {
  display: block;
  width: clamp(4.25rem, 3rem + 6vw, 9.5rem);
  height: auto;
  padding: clamp(0.45rem, 0.2rem + 1vw, 1rem);
  background: var(--paper);
  align-self: start;
}

/* ---------------------------------------------------------- layout */

.read {
  max-width: var(--wide);
  margin-inline: auto;
  padding: 0 var(--gutter-r) 0 var(--gutter);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  column-gap: clamp(2rem, 4vw, 4.5rem);
  align-items: start;
}
.doc {
  min-width: 0;
  max-width: 68ch;
  font-size: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  padding-top: clamp(1.5rem, 3vw, 2.75rem);
}
.no-side .doc { margin-inline: auto; width: 100%; }

.side-wide, .toc-wide { display: none; }

@media (min-width: 64rem) {
  .has-side { grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .has-side .side-wide { display: block; }
  .has-side .side-narrow { display: none; }
}
@media (min-width: 88rem) {
  .has-side.has-toc {
    grid-template-columns: var(--side-w) minmax(0, 68ch) var(--toc-w);
    justify-content: space-between;
  }
  .no-side.has-toc {
    grid-template-columns: minmax(0, 68ch) var(--toc-w);
    justify-content: center;
  }
  .has-toc .toc-wide { display: block; }
  .has-toc .toc-narrow { display: none; }
}

/* ---------------------------------------------------------- side and toc */

.side-wide, .toc-wide {
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow-y: auto;
  padding: clamp(1.5rem, 3vw, 2.75rem) 0.25rem 2rem;
  font-size: 0.95rem;
  line-height: 1.35;
}
.side-group, .toc-h {
  margin: 1.75rem 0 0.5rem;
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 112%;
  font-size: 1.05rem;
}
.side-group:first-child, .toc-h:first-child { margin-top: 0; }
.side ul, .toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.side a, .toc a {
  display: block;
  padding: 0.3rem 0.6rem;
  border-left: 4px solid transparent;
  text-decoration: none;
}
.side a:hover, .toc a:hover { text-decoration: underline; }
.side a[aria-current] {
  border-left-color: var(--accent);
  background: var(--tint);
  font-weight: 700;
}
.toc ul ul a { padding-left: 1.4rem; font-size: 0.93em; }
.toc-wide { font-size: 0.9rem; }

.side-narrow, .toc-narrow {
  margin-top: 1.25rem;
  background: var(--tint);
  font-size: 1rem;
}
.side-narrow summary, .toc-narrow summary {
  padding: 0.75rem 1rem;
  font-weight: 700;
  cursor: pointer;
}
.side-narrow nav, .toc-narrow nav { padding: 0 0.5rem 1rem; }
.side-narrow .side-group { margin-left: 0.6rem; }
.toc-narrow { margin-top: 1rem; }
.side-narrow + .doc .toc-narrow { margin-top: 0.75rem; }

/* ---------------------------------------------------------- meta */

.from {
  margin: 0 0 0.5rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
}
.from a { color: var(--ink-soft); }
.from code { font-size: 0.95em; }

.status {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.6rem;
  margin: 0.75rem 0 0;
  padding: 0.9rem 1rem;
  border-left: 6px solid var(--ink);
  background: var(--tint);
}
.status-k { font-weight: 700; }
.status a { color: var(--link); }

.chip {
  display: inline-block;
  padding: 0.12em 0.55em;
  color: var(--ink);
  font-weight: 700;
  font-size: 0.92em;
  line-height: 1.45;
  white-space: nowrap;
}
.chip-in-force { background: var(--leaf); }
.chip-part { background: var(--sun); }
.chip-amended { background: var(--bone); }
.chip-reversed { background: var(--coral); }
.chip-stated { background: var(--bone); }

/* ---------------------------------------------------------- prose */

.prose { line-height: 1.65; }
.prose > * + * { margin-top: 1.1em; }
.prose > :first-child { margin-top: 1.5rem; }

.prose h2, .prose h3, .prose h4 {
  font-weight: 800;
  line-height: 1.12;
}
.prose h2 {
  margin-top: 2.6em;
  font-size: clamp(1.5rem, 1.2rem + 1vw, 1.95rem);
  font-stretch: 110%;
}
.prose h2::before {
  content: "";
  display: block;
  width: 2.75rem;
  height: 6px;
  margin-bottom: 0.7rem;
  background: var(--accent);
}
.prose h3 {
  margin-top: 2em;
  font-size: 1.3rem;
  font-stretch: 106%;
}
.prose h2 + *, .prose h3 + * { margin-top: 0.75em; }
.prose a.self {
  color: inherit;
  text-decoration: none;
}
.prose a.self:hover { text-decoration: underline; }

.prose a:not(.self) {
  color: var(--link);
  text-decoration-thickness: 1px;
}
.prose a:not(.self):hover { text-decoration-thickness: 2px; }
.prose a code { color: inherit; }

.prose strong { font-weight: 700; }

.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: 0.4em; }
.prose li > ul, .prose li > ol { margin-top: 0.4em; }
.prose li > p + p { margin-top: 0.8em; }
.prose li::marker { color: var(--ink-soft); }

.prose :not(pre) > code {
  padding: 0.08em 0.3em;
  background: var(--tint);
  font-size: 0.86em;
  overflow-wrap: anywhere;
}
.prose code.nw { white-space: nowrap; }

.prose pre {
  padding: 1rem 1.15rem;
  overflow-x: auto;
  background: var(--tint);
  border-left: 4px solid var(--accent);
  font-size: 0.84em;
  line-height: 1.55;
  tab-size: 4;
}
.prose pre code { font-size: inherit; }

.prose blockquote {
  padding-left: 1.1rem;
  border-left: 4px solid var(--rule);
  color: var(--ink-soft);
}
.prose blockquote > * + * { margin-top: 0.8em; }

.prose hr {
  border: 0;
  height: 6px;
  width: 2.75rem;
  background: var(--rule);
  margin-block: 2.5em;
}

.prose .table {
  overflow-x: auto;
  font-size: 0.88em;
  line-height: 1.45;
}
.prose table {
  border-collapse: collapse;
  min-width: 100%;
}
.prose th, .prose td {
  padding: 0.55rem 0.7rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--rule);
}
.prose th:first-child, .prose td:first-child { padding-left: 0; }
.prose thead th {
  border-bottom: 2px solid var(--ink);
  font-weight: 700;
  vertical-align: bottom;
}
.prose tbody th { font-weight: 700; }
.prose .ar { text-align: right; }
.prose .ac { text-align: center; }

/* ---------------------------------------------------------- decisions */

.adr-list {
  list-style: none;
  padding: 0 !important;
  margin-top: 2rem !important;
  border-top: 2px solid var(--ink);
}
.adr-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
  margin: 0 !important;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--rule);
}
.adr-list a {
  display: flex;
  gap: 0.9rem;
  flex: 1 1 22rem;
  color: var(--ink) !important;
  text-decoration: none;
}
.adr-list a:hover .adr-t { text-decoration: underline; }
.adr-n {
  flex: none;
  width: 5.2rem;
  white-space: nowrap;
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 110%;
}
.adr-list .chip { font-size: 0.8em; }

/* ---------------------------------------------------------- pager */

.pager {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 1rem;
  margin-top: 4.5rem;
}
.pager a {
  display: block;
  padding: 0.9rem 1rem 1rem;
  border-top: 6px solid var(--ink);
  background: var(--tint);
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 108%;
  font-size: 1.15rem;
  line-height: 1.2;
  text-decoration: none;
}
.pager a:hover { border-top-color: var(--accent); }
.pager span {
  display: block;
  margin-bottom: 0.3rem;
  font-family: var(--body);
  font-weight: 400;
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.pager .next { text-align: right; grid-column: -2; }

/* ---------------------------------------------------------- print */

@media print {
  .masthead nav, .side, .toc, .pager, .colophon, .skip, .band-mark {
    display: none !important;
  }
  body { font-size: 11pt; }
  .band { background: none; color: var(--ink); }
  .band-in { padding: 0 0 1rem; display: block; }
  .band h1 { font-size: 26pt; }
  .read { display: block; padding: 0; }
  .doc { max-width: none; padding-top: 0; font-size: 11pt; }
  .prose a:not(.self) { color: var(--ink); }
  .prose a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    overflow-wrap: anywhere;
  }
  .prose pre { white-space: pre-wrap; border-left-color: var(--ink); }
  .prose .table { overflow: visible; }
  .prose h2::before { background: var(--ink); }
  .prose h2, .prose h3 { break-after: avoid; }
  .prose pre, .prose tr, .status { break-inside: avoid; }
  .chip { border: 1px solid var(--ink); }
}
