.reader { min-width: 0; overflow: clip; }
.reader-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 16px;
  padding: clamp(14px, 2.4vw, 25px);
}
#doc-kind {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: var(--text-small);
  font-weight: 650;
}
.reader-heading h2 {
  font: 750 clamp(1.55rem, 3vw, 2.25rem)/1.15 var(--body-face);
}
.summary { margin-top: 5px; color: var(--muted); }
#download {
  border-color: var(--action);
  background: var(--action);
  color: white;
}
#download:hover {
  border-color: var(--action-hover);
  background: var(--action-hover);
}
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 9px 14px;
  padding: 9px clamp(12px, 2.4vw, 25px);
  border-block: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: var(--text-base);
  font-weight: 600;
}
.version-picker, .page-tools, #page-jump { display: flex; align-items: center; gap: 7px; }
.version-picker { position: relative; min-width: 0; max-width: 100%; }
.version-picker::after {
  position: absolute;
  top: calc(50% - 5px);
  right: .7rem;
  width: .45rem;
  height: .45rem;
  transform: rotate(45deg);
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  pointer-events: none;
  content: "";
}
#version {
  width: min(100%, 19rem);
  min-width: 0;
  padding-right: 1.8rem;
  appearance: none;
  text-overflow: ellipsis;
}
#page-number {
  width: 3.5rem;
  margin: 0;
  padding-inline: .25rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  appearance: textfield;
}
#page-number::-webkit-inner-spin-button,
#page-number::-webkit-outer-spin-button { appearance: none; }
#page-count { white-space: nowrap; font-variant-numeric: tabular-nums; }
#page-fit { max-width: 100%; }
.page-link-status:not(:empty) { padding: 0 14px .55rem; color: var(--accent); font-size: var(--text-base); }
.page-link-status input { width: min(100%, 32rem); }
.paper-wrap {
  height: clamp(350px, 74svh, 900px);
  overflow: auto;
  overflow-anchor: none;
  padding: clamp(10px, 2vw, 23px);
  background: var(--reader-gutter);
}
.paper-wrap:focus-visible { outline-offset: -3px; }
#reader-status:not(:empty) { padding: 10px; color: var(--muted); text-align: center; }
.page-slot {
  width: var(--page-width);
  aspect-ratio: var(--page-ratio);
  margin: 0 auto 14px;
  color-scheme: light;
  background: white;
  color: #252932;
  outline: 1px solid var(--line);
}
.page-slot:last-child { margin-bottom: 0; }
.page-slot canvas { display: block; width: 100%; height: auto; }
.page-slot p { padding: 1rem; }
@media (max-width: 520px) {
  #version { width: min(100%, 17.5rem); }
  .paper-wrap { height: clamp(330px, 72svh, 680px); }
}

.reader-actions, .document-tools, #find-form, #bookmark-form { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.document-tools [aria-expanded="true"] { color: var(--accent); background: var(--accent-soft); }
.document-panel {
  max-height: min(16rem, 32dvh);
  overflow: auto;
  padding: 10px clamp(12px, 2.4vw, 25px);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  font-size: var(--text-base);
}
.document-panel [role="status"]:empty { display: none; }
.document-panel [role="status"] { color: var(--muted); }
#find-status:not(:empty) { margin-top: .45rem; }
#find-query, #contents-filter { width: min(16rem, 100%); cursor: text; }
#contents-filter { margin-bottom: .45rem; }
.contents-list, .contents-list ul, .search-results { list-style: none; padding: 0; margin: 0; }
.contents-list ul { margin-left: .85rem; padding-left: .35rem; border-left: 1px solid var(--line); }
.contents-row { display: flex; align-items: center; gap: .2rem; }
.contents-row button, .search-results button, .search-results a {
  padding: .4rem .55rem;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.contents-row button:last-child {
  display: flex;
  justify-content: space-between;
  flex: 1;
  min-width: 0;
  gap: .65rem;
}
.contents-row button:last-child span:last-child { white-space: nowrap; color: var(--muted); }
.contents-disclosure { flex: 0 0 44px; min-height: 44px; }
.contents-row button:last-child, .search-results :is(a, button) { min-height: 44px; }
.contents-disclosure::before {
  display: block;
  width: .42rem;
  height: .42rem;
  margin: auto;
  transform: rotate(-45deg);
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  content: "";
}
.contents-disclosure[aria-expanded="true"]::before { transform: rotate(45deg); }
.contents-row button:hover, .search-results :is(a, button):hover { background: var(--list-hover); }
.contents-row [aria-current], .search-results [aria-current] { background: var(--accent-soft); color: var(--accent); }
.search-results:not(:empty) { margin-top: .65rem; }
.search-results button, .search-results a { display: block; width: 100%; text-decoration: none; }
.search-results strong, .search-results span { display: block; }
.search-results span { color: var(--muted); overflow-wrap: anywhere; }
.search-results mark { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.page-slot { position: relative; }
.pdf-match {
  position: absolute;
  pointer-events: none;
  border-radius: 2px;
  background: #ffc32885;
  outline: 1px solid #a55a0a;
}
body.reader-expanded { overflow: hidden; }
.reader:is(:fullscreen, [data-expanded]) {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  border: 0;
  border-radius: 0;
}
.reader[data-expanded] { position: fixed; inset: 0; z-index: 10; }
.reader:is(:fullscreen, [data-expanded]) .reader-heading { padding-block: .65rem; }
.reader:is(:fullscreen, [data-expanded]) .paper-wrap { flex: 1; min-height: 0; height: auto; }
@media (max-width: 520px) {
  .reader:is(:fullscreen, [data-expanded]) .summary { display: none; }
  .page-tools { flex-wrap: wrap; }
}

.edition-tools, .reader-extra-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem; }
.reader-options { position: relative; }
.reader-options summary, .text-control {
  min-height: 44px;
  padding: .45rem .55rem;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.reader-options summary { align-content: center; }
.reader-options summary:hover, .text-control:hover:not(:disabled) {
  background: var(--control-hover);
  text-decoration: underline;
  text-underline-offset: .14em;
}
.reader-options-panel {
  position: absolute;
  z-index: 3;
  inset: calc(100% + .25rem) 0 auto auto;
  width: min(30rem, calc(100vw - 3rem));
  padding: .7rem;
  border: 1px solid var(--control-line);
  background: var(--surface);
}
.reader-extra-actions { margin-top: .55rem; border-top: 1px solid var(--line); }
.reader-options [aria-expanded="true"] { background: var(--selection); }
.reader-navigation { position: sticky; top: 0; z-index: 2; flex: none; }
.reader-toolbar { border-top: 1px solid var(--line); }
.reader-toolbar [aria-expanded="true"], #changes-toggle[aria-expanded="true"] {
  color: var(--accent);
  background: var(--accent-soft);
}
#bookmark-name { width: min(16rem, 100%); }
.bookmark-list, .changes-list { margin: .55rem 0 0; padding: 0; list-style: none; }
.bookmark-list li, .changes-list li {
  padding: .45rem 0;
  border-top: 1px solid var(--line);
}
.bookmark-list li { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.bookmark-list li > :first-child { text-align: left; overflow-wrap: anywhere; }
.bookmark-list li > :last-child { flex: none; }
.bookmark-list small { display: block; color: var(--muted); }
.changes-list a { color: var(--accent); }
.changes-list p { color: var(--muted); }
.changes-list .change-pages { margin-bottom: .25rem; }
#bookmark-status:not(:empty) { margin-top: .45rem; }
@media (max-width: 520px) {
  .reader-toolbar { gap: 6px 9px; padding-block: 6px; }
  .reader-toolbar .control { padding: .35rem .5rem; }
  .find-label-detail { display: none; }
  .reader-options { position: static; }
  .reader-options-panel { inset: 100% .35rem auto auto; width: min(25rem, calc(100% - .7rem)); }
  .reader-toolbar .document-tools { gap: 5px; }
}


.release-notes { max-height: min(34rem, 56dvh); padding-block: .9rem 1.15rem; }
.release-notes h3 {
  margin: 0;
  font: 750 clamp(1.5rem, 3.2vw, 2rem)/1.15 var(--body-face);
}
.release-pair {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) max-content minmax(0, 1fr);
  align-items: center;
  gap: .45rem .65rem;
  max-width: 40rem;
  margin-top: .65rem;
}
.release-pair select { width: 100%; min-width: 0; text-overflow: ellipsis; }
@media (max-width: 520px) {
  .release-pair { grid-template-columns: max-content minmax(0, 1fr); }
}
.release-comparison { margin: .25rem 0 .8rem; color: var(--muted); }
.release-comparison:empty { display: none; }
.release-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 23rem), 1fr));
  align-items: start;
  gap: .85rem 1.5rem;
}
.release-group h4 {
  margin: .25rem 0 .4rem;
  padding-bottom: .23rem;
  border-bottom: 1px solid var(--line);
  font: 700 1.125rem/1.25 var(--body-face);
}
.release-group ul { margin: 0; padding-left: 1.1rem; }
.release-group li { margin: .35rem 0; }
.release-kind { color: var(--accent); font-weight: 700; }
.release-citations { display: inline; margin-left: .4rem; color: var(--muted); font-size: var(--text-small); }
.release-notes a { text-underline-offset: .14em; }
.release-notes a:hover { text-decoration-thickness: 2px; }
.release-citations a { white-space: nowrap; }
.release-notes details { margin-top: .8rem; padding-top: .55rem; border-top: 1px solid var(--line); }
.release-notes summary { min-height: 44px; padding-block: .5rem; cursor: pointer; font-weight: 700; }
.release-notes summary:hover { text-decoration: underline; }
.release-notes details p { margin-top: .4rem; color: var(--muted); }

#page-jump-status:not(:empty) { margin: 0; padding: .35rem 1rem; background: var(--surface); color: var(--accent); }
#page-number[aria-invalid="true"] { border-color: var(--accent); }

#retry-pdf { display: block; margin: .5rem auto 1rem; }

@media (max-width: 520px) {
  .reader-heading .summary, #doc-kind { display: none; }
  .reader-heading h2 { font-size: 1.35rem; }
  .reader-heading { padding: .55rem .65rem; }
  .reader-heading { gap: .55rem; }
  .reader-actions .control, #download { padding-inline: .45rem; }
  .edition-tools { gap: .45rem; }
  .edition-tools .version-picker { flex-basis: 100%; }
}
