/* Learning access (tách từ footer.php) */
/*
 * Cung Hoc Toan lesson-access proposal, 2026-10-30.
 * New components inherit each lesson's type and palette. No math layout,
 * lesson-heading, diagram, menu state, or tab-order changes are made here.
 */

.cht-learning-access {
  min-width: 0;
  max-width: 100%;
}

.cht-learning-access .cht-access-toc,
.cht-learning-access .cht-access-help,
.cht-learning-access .cht-access-feedback,
.cht-learning-access .cht-access-feedback-body,
.cht-learning-access .cht-access-scroll {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
}

#content .cht-learning-access .cht-access-toc,
#content .cht-learning-access .cht-access-help,
#content .cht-learning-access .cht-access-feedback {
  font-family: inherit;
  font-size: inherit;
  line-height: 1.6;
  color: inherit;
  overflow-wrap: anywhere;
  white-space: normal;
}

#content .cht-learning-access .cht-access-toc {
  margin: 1.25em 0;
  padding: 1em;
  border: 1px solid currentColor;
  border-radius: 0.5em;
  background: transparent;
}

#content .cht-learning-access .cht-access-toc > h2 {
  margin: 0 0 0.5em;
  padding: 0;
  font-family: inherit;
  font-size: 1.05em;
  font-weight: 700;
  line-height: 1.4;
  color: inherit;
  overflow-wrap: anywhere;
}

#content .cht-learning-access .cht-access-toc > ul {
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding-inline-start: 1.35em;
  list-style: disc outside;
}

#content .cht-learning-access .cht-access-toc > ul > li {
  min-width: 0;
  max-width: 100%;
  margin: 0.25em 0;
  padding: 0;
}

#content .cht-learning-access .cht-access-toc a,
#content .cht-learning-access .cht-access-feedback-body a {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  font: inherit;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  overflow-wrap: anywhere;
  white-space: normal;
}

#content .cht-learning-access .cht-access-toc a {
  display: block;
  min-height: 44px;
  padding: 0.35em 0.25em;
}

#content .cht-learning-access .cht-access-existing-toc a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  max-width: 100%;
  white-space: normal;
}

#content .cht-learning-access details > summary {
  min-height: 44px;
  box-sizing: border-box;
}

#content .cht-learning-access .cht-access-help {
  margin: 1em 0;
  padding: 0;
}

#content .cht-learning-access details.cht-access-feedback {
  margin: 1.5em 0 0;
  padding: 0.25em 0;
  border: 0;
  border-top: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  border-radius: 0;
  background: transparent;
}

#content .cht-learning-access details.cht-access-feedback > summary {
  box-sizing: border-box;
  display: list-item;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 0.65em 0.25em;
  font-family: inherit;
  font-size: inherit;
  font-weight: 700;
  line-height: 1.5;
  color: inherit;
  background: transparent;
  list-style: disclosure-closed inside;
  overflow-wrap: anywhere;
  white-space: normal;
  cursor: pointer;
}

#content .cht-learning-access details.cht-access-feedback[open] > summary {
  list-style-type: disclosure-open;
}

#content .cht-learning-access .cht-access-feedback-body {
  margin: 0;
  padding: 0.25em 0.25em 1em;
  font: inherit;
  color: inherit;
  overflow-wrap: anywhere;
}

#content .cht-learning-access .cht-access-feedback-body > p {
  margin: 0.75em 0;
  font: inherit;
  color: inherit;
}

#content .cht-learning-access .cht-access-feedback-body > :first-child {
  margin-top: 0;
}

#content .cht-learning-access .cht-access-feedback-body > :last-child {
  margin-bottom: 0;
}

#content a.cht-access-pdf-link[data-cht-access-pdf-format]::after {
  content: attr(data-cht-access-pdf-format);
  box-sizing: border-box;
  display: inline;
  max-width: 100%;
  margin-inline-start: 0.35em;
  padding: 0.08em 0.3em;
  border: 1px solid currentColor;
  border-radius: 0.25em;
  font-family: inherit;
  font-size: 0.875em;
  font-weight: 700;
  line-height: inherit;
  color: inherit;
  background: transparent;
  vertical-align: baseline;
  white-space: normal;
  overflow-wrap: anywhere;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* The enhancer adds a tab stop only when this region actually overflows. */
.cht-learning-access .cht-access-scroll {
  display: block;
  margin: 1em 0;
  padding: 4px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

/*
 * Two rings keep keyboard focus visible on light and dark lesson palettes.
 * Only focus decoration overrides theme rules; no descendant math selectors.
 */
#content :focus-visible,
#masthead.cht-shell-header :focus-visible,
a#cht-skip-link:focus-visible {
  outline: 3px solid #111 !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 3px #fff !important;
}

@media (max-width: 360px) {
  #content .cht-learning-access .cht-access-toc {
    padding: 0.75em;
  }
}

/* System colors remain authoritative when forced colors suppress shadows. */
@media (forced-colors: active) {
  #content :focus-visible,
  #masthead.cht-shell-header :focus-visible,
  a#cht-skip-link:focus-visible {
    outline-color: Highlight !important;
  }
}
