/* Help is a manual: contents on the left, one article on the right. All colors inherit the world. */
.help-modal[open] { display: flex; flex-direction: column; max-height: calc(100dvh - 24px); overflow: hidden; }
.help-modal > .modal-header, .help-modal > .help-search, .help-modal > .modal-footer { flex: 0 0 auto; }
.help-modal .help-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; flex: 1 1 auto; }
.help-subject-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 20px; }
.help-subject-tabs button, .help-back { min-height: 36px; padding: 7px 11px; border: 1px solid var(--n84); border-radius: 7px; background: var(--paper); color: var(--ink); font: inherit; font-size: 13px; cursor: pointer; }
.help-subject-tabs button[aria-selected="true"] { background: var(--pen); border-color: var(--pen); color: var(--on-pen); }
.help-back { margin: 0 0 14px; }
.help-tool-directory, .glossary-index { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 20px; list-style: none; padding: 0 !important; margin: 0 !important; }
.help-tool-directory a, .glossary-index a { display: block; padding: 9px 2px; color: var(--pen); text-underline-offset: 3px; text-decoration-thickness: 1px; overflow-wrap: anywhere; line-height: 1.45; }
.help-tool-directory a:hover, .glossary-index a:hover { text-decoration-thickness: 2px; }
.glossary-link { color: inherit; text-decoration-line: underline; text-decoration-style: dotted; text-decoration-color: var(--pen); text-underline-offset: 3px; cursor: help; }
.glossary-link:hover { color: var(--pen); text-decoration-style: solid; }
.glossary-link:focus-visible, .help-subject-tabs button:focus-visible, .help-back:focus-visible, .help-tool-directory a:focus-visible, .glossary-index a:focus-visible { outline: 2px solid var(--pen); outline-offset: 3px; border-radius: 3px; }
.glossary-controls { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.glossary-controls input { flex: 1 1 220px; min-width: 0; }
.glossary-controls input, .glossary-controls select { padding: 9px 10px; min-height: 40px; border: 1px solid var(--n84); border-radius: 7px; background: var(--paper); color: var(--ink); font: inherit; font-size: 14px; }
.glossary-navigation, .glossary-pagination { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.glossary-pagination { margin-top: 18px; }
.glossary-subject { color: var(--pen) !important; font-size: 12px !important; }
.help-tool-content h3:focus, #help-panel-glossary h3:focus { outline: none; }
@media (max-width: 600px) {
  .help-modal { width: calc(100vw - 16px); }
  .help-modal .modal-header { padding: 12px 16px; }
  .help-modal .help-search { padding: 8px 16px 0; }
  .help-tool-directory, .glossary-index { grid-template-columns: 1fr; }
  .help-subject-tabs button, .help-back, .help-tool-directory a, .glossary-index a { min-height: 44px; }
}
@media (max-height: 500px) {
  .help-modal .modal-header { padding-block: 8px; }
  .help-modal .help-search { padding-top: 4px; }
  .help-modal .modal-footer { padding-block: 6px; }
}

/* Glossary second layer: why a term matters, its conventions and limits. */
.glossary-more { margin: 10px 0; }
.glossary-more > summary { cursor: pointer; font-weight: 600; }
.glossary-more > p { margin: 6px 0 0; }
.glossary-formula { margin-inline-end: 8px; }

/* The manual: contents, article, chapter cards and search results. */
.help-modal { width: min(1040px, calc(100vw - 32px)); }
.help-subtitle { margin: 2px 0 0; color: var(--muted); font-size: var(--t-control); }
.help-modal .help-body { display: grid; grid-template-columns: minmax(200px, 250px) minmax(0, 1fr); padding: 0; max-height: none; height: min(70vh, 640px); overflow: hidden; scrollbar-gutter: auto; }
.help-toc, .help-article { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.help-toc { padding: 16px 10px 24px 18px; border-right: 1px solid var(--n90); font-size: 13px; }
.help-article { padding: 24px 34px 32px; }
.help-toc-toggle { display: none; }
.help-toc-home, .help-toc summary, .help-toc a { display: block; width: 100%; padding: 6px 8px; border-radius: 6px; color: var(--ink); text-align: left; text-decoration: none; line-height: 1.35; }
.help-toc-home { margin-bottom: 6px; border: 0; background: transparent; font: inherit; font-weight: 600; cursor: pointer; }
.help-toc summary { font-weight: 600; cursor: pointer; }
.help-toc ul { margin: 0 0 6px; padding: 0 0 0 10px; list-style: none; }
.help-toc a { color: var(--muted); }
.help-toc-home:hover, .help-toc summary:hover, .help-toc a:hover { background: var(--n96); color: var(--ink); }
.help-toc [aria-current='page'] { background: color-mix(in oklab, var(--pen) 14%, transparent); color: var(--ink); font-weight: 600; }
.help-toc :is(a, button, summary):focus-visible { outline: 2px solid var(--pen); outline-offset: 1px; }
.help-kicker { margin: 0 0 4px !important; color: var(--pen) !important; font-size: 12px !important; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.help-article h3 { margin-top: 0; font-size: 20px !important; }
.help-article h3:focus { outline: none; }
.help-article h4 { margin: 20px 0 8px; color: var(--n21); font-size: 14px; }
.help-article ol { margin: 0 0 14px; padding-left: 22px; color: var(--n39); font-size: 13.8px; line-height: 1.7; }
.help-article li + li { margin-top: 3px; }
.help-article kbd { display: inline-block; min-width: 1.6em; padding: 0 5px; border: 1px solid var(--n84); border-bottom-width: 2px; border-radius: 4px; background: var(--paper); color: var(--ink); font: 12px/1.6 'DM Mono', monospace; text-align: center; }
.help-tip { padding: 10px 14px; border-left: 3px solid var(--pen); border-radius: 0 6px 6px 0; background: color-mix(in oklab, var(--pen) 8%, transparent); }
.help-see { margin-top: 20px !important; font-size: 13px !important; }
.help-see a, .help-pager a { color: var(--pen); text-underline-offset: 3px; }
.help-pager { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--n90); font-size: 13px; }
.help-pager a:only-child:last-child { margin-left: auto; }
.help-action { margin: 4px 0 14px; }
.help-chapter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin-top: 6px; }
.help-chapter-card { display: grid; gap: 4px; padding: 12px 14px; border: 1px solid var(--n84); border-radius: var(--r-soft, 8px); background: var(--paper); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.help-chapter-card strong { font-size: 14px; }
.help-chapter-card span { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.help-chapter-card:hover { border-color: var(--pen); }
.help-chapter-card:focus-visible { outline: 2px solid var(--pen); outline-offset: 2px; }
.help-search-results { max-height: min(360px, 55vh); }
.help-search-results .help-result-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; overflow: visible; white-space: normal; }
.help-search-results .help-result-top small { flex: none; color: var(--muted); font-size: 11px; }
.help-search-results .help-result-excerpt { display: block; white-space: normal; line-height: 1.45; }
.help-search-results mark { background: color-mix(in oklab, var(--pen) 22%, transparent); color: inherit; border-radius: 2px; }
.help-result-group { margin: 6px 9px 2px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.help-result-empty { margin: 8px 9px; color: var(--muted); font-size: 13px; }
@media (max-width: 760px) {
  .help-modal[open] { height: calc(100dvh - 24px); }
  .help-modal .help-body { display: flex; flex-direction: column; height: auto; flex: 1 1 auto; }
  .help-toc-toggle { display: inline-flex; flex: none; align-self: flex-start; align-items: center; min-height: 40px; margin: 10px 16px 0; }
  .help-toc { display: none; border-right: 0; padding: 8px 16px 20px; }
  .help-modal .help-body[data-toc='open'] .help-toc { display: block; flex: 1 1 auto; }
  .help-modal .help-body[data-toc='open'] .help-article { display: none; }
  .help-article { flex: 1 1 auto; padding: 14px 16px 24px; }
  .help-toc-home, .help-toc summary, .help-toc a { min-height: 44px; padding-block: 11px; }
  .help-chapter-grid { grid-template-columns: 1fr; }
}
