/* Reading controls only. Theme colors continue to come from study.css. */

/* The sidebar replaces authored contents on screen; paper copies need a map. */
@media screen {
  .study-content .print-contents { display: none; }
}

/* Main sections: one title per row, with room between entries. */
#contents-nav .section-contents {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

#contents-nav .section-contents a {
  display: block;
  padding: 7px 8px;
  line-height: 1.5;
  text-decoration: none;
  overflow-wrap: anywhere;
  border-left: 2px solid transparent;
}

#contents-nav .section-contents a[aria-current="location"] {
  border-left-color: currentColor;
  font-weight: 700;
}

/* Scope, page key, instructions, and workbook lookups. */
.reader-aids {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  margin: 18px 0;
}

.reader-aids > .reader-disclosure {
  margin: 0;
  min-width: 0;
}

.reader-aids > .reader-disclosure[open] {
  flex-basis: 100%;
}

.reader-disclosure {
  margin: 14px 0;
  scroll-margin-top: 100px;
}

.reader-disclosure > summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: .9em;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  list-style: none;
  scroll-margin-top: 100px;
}

.reader-disclosure > summary::-webkit-details-marker {
  display: none;
}

.reader-disclosure > summary::before {
  content: '+';
  width: .8em;
  text-align: center;
}

.reader-disclosure[open] > summary::before {
  content: '−';
}

.study-content .reader-disclosure > summary > :is(h2, h3) {
  margin: 0;
  padding: 0;
  border: 0;
  font: inherit;
  color: inherit;
}

.reader-disclosure-body {
  padding: 1px 12px;
  overflow-wrap: anywhere;
}

/* One source button reveals the whole trailing citation group. */
.study-content .reader-source-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75em;
  height: 1.75em;
  padding: .3em;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: inherit;
  background: transparent;
  vertical-align: -.35em;
  cursor: pointer;
}

.reader-source-button svg,
.reader-source-example svg {
  display: block;
  width: 100%;
  height: 100%;
}

.reader-source-example {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -.1em;
}

.reader-citation-text {
  margin-inline-start: .35em;
  color: var(--muted);
  font-size: .9em;
  overflow-wrap: anywhere;
  scroll-margin-top: 100px;
}

.reader-disclosure > summary:focus-visible,
.reader-source-button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

/* Print opens the native disclosures; references always print in full. */
@media print {
  .contents-toggle, .contents-backdrop { display: none !important; }
  .study-content .print-contents { display: block; }
  .reader-aids { display: block; }
  .reader-disclosure > summary {
    display: block;
    padding: 0;
    border: 0;
    font-size: inherit;
    break-after: avoid;
  }
  .reader-disclosure > summary::before,
  .reader-disclosure[open] > summary::before { content: none; }
  .reader-disclosure-body { padding: 0; }
  .reader-disclosure::details-content { content-visibility: visible; }
  .study-content .reader-source-button,
  .reader-source-legend { display: none !important; }
  .study-content .reader-citation-text {
    display: inline !important;
    margin: 0;
    color: inherit;
    font-size: inherit;
  }
}
