/*
 * In-portal web Help (inc/help-web.php). Built only from the portal tokens
 * (tokens.css) and alongside the existing .ap-doc / .ap-dochead / .ap-field
 * components; no colours or sizes of its own.
 */

/* Search */
.ap-help-search { display: flex; flex-direction: column; gap: var(--space-2); max-inline-size: var(--measure); }
.ap-help-search__row { display: flex; gap: var(--space-2); }
.ap-help-search__row .ap-input { flex: 1 1 auto; min-inline-size: 0; }

/* Lists of articles */
.ap-help-list { list-style: none; margin: 0; padding: 0; }
.ap-help-list__row { display: flex; flex-direction: column; gap: var(--space-1); padding-block: var(--space-3); border-block-end: var(--border-subtle); }
.ap-help-list__row:last-child { border-block-end: 0; }
.ap-help-list__title { font-weight: var(--fw-semibold); color: var(--color-link); text-decoration: none; }
.ap-help-list__title:hover { text-decoration: underline; }
.ap-help-list__summary { max-inline-size: var(--measure); font-size: var(--fs-small); line-height: var(--lh-body); color: var(--color-text-soft); }

/* Parts on the hub */
.ap-help-part { border-block-start: var(--border-subtle); scroll-margin-block-start: var(--space-8); }
.ap-help-part:first-of-type { border-block-start: 0; }
.ap-help-part__title { display: flex; align-items: center; gap: var(--space-2); min-block-size: var(--tap-target); cursor: pointer; font-size: var(--fs-subsection); font-weight: var(--fw-bold); color: var(--color-text); }
.ap-help-part__title { list-style: none; }
.ap-help-part__title::-webkit-details-marker { display: none; }
.ap-help-part__title::before { content: ""; inline-size: 0.5em; block-size: 0.5em; border-inline-end: 2px solid currentColor; border-block-end: 2px solid currentColor; transform: rotate(-45deg); transition: transform 0.15s; flex: none; margin-inline-end: var(--space-1); }
.ap-help-part[open] > .ap-help-part__title::before { transform: rotate(45deg); }
@media (prefers-reduced-motion: reduce) { .ap-help-part__title::before { transition: none; } }
.ap-help-part__count { padding: 0 var(--space-2); border-radius: var(--radius-sm); background: var(--color-sunken); font-size: var(--fs-caption); font-weight: var(--fw-medium); color: var(--color-text-soft); }
.ap-help-part > .ap-help-list { padding-inline-start: var(--space-4); padding-block-end: var(--space-3); }

/* Breadcrumb */
.ap-help-crumbs ol { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-2); margin: 0; padding: 0; list-style: none; font-size: var(--fs-small); color: var(--color-text-soft); }
.ap-help-crumbs li + li::before { content: "\203A"; margin-inline-end: var(--space-2); color: var(--color-text-mute); }
.ap-help-crumbs a { color: var(--color-link); font-weight: var(--fw-semibold); text-decoration: none; }
.ap-help-crumbs a:hover { text-decoration: underline; }

/* "Help for this page" in the workspace page header */
.ap-pagehead:has(.ap-help-pagelink) { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-4); }
.ap-help-pagelink { font-size: var(--fs-small); font-weight: var(--fw-semibold); color: var(--color-link); }

/* Skip link: hidden until focused */
.ap-help-skip { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ap-help-skip:focus { position: static; inline-size: auto; block-size: auto; clip-path: none; align-self: flex-start; padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); background: var(--color-surface); box-shadow: var(--focus-ring); }

/* Article */
.ap-help-article { display: flex; flex-direction: column; gap: var(--space-5); min-inline-size: 0; }
.ap-help-body { display: flex; flex-direction: column; gap: var(--space-4); max-inline-size: 60rem; font-size: var(--fs-body); line-height: var(--lh-body); color: var(--color-text); }
.ap-help-body:focus { outline: none; }
.ap-help-body > *, .ap-help-body p { margin: 0; }
.ap-help-body h2 { margin: var(--space-3) 0 0; font-size: var(--fs-section); font-weight: var(--fw-bold); line-height: var(--lh-snug); scroll-margin-block-start: var(--space-8); }
.ap-help-body ul { margin: 0; padding-inline-start: var(--space-5); display: flex; flex-direction: column; gap: var(--space-2); max-inline-size: var(--measure); }
.ap-help-body p { max-inline-size: var(--measure); }
.ap-help-body a { color: var(--color-link); }
.ap-help-label { display: inline-block; padding: 0 var(--space-1); border: var(--border-default); border-radius: var(--radius-sm); background: var(--color-canvas); font-weight: var(--fw-semibold); white-space: nowrap; }

/* Numbered steps */
.ap-help-steps { counter-reset: step; list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-5); }
.ap-help-steps > li { counter-increment: step; display: grid; grid-template-columns: 2rem minmax(0, 1fr); gap: var(--space-2) var(--space-3); }
.ap-help-steps > li::before { content: counter(step); display: grid; place-items: center; inline-size: 2rem; block-size: 2rem; border-radius: 50%; background: var(--color-primary); color: var(--color-on-primary); font-weight: var(--fw-bold); font-size: var(--fs-small); }
.ap-help-step { align-self: center; max-inline-size: var(--measure); }
.ap-help-shot { grid-column: 2; margin: 0; }
.ap-help-shot img { display: block; max-inline-size: 100%; block-size: auto; border: var(--border-subtle); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.ap-help-shot--phone img { max-inline-size: min(100%, 22rem); }
.ap-help-shot--missing { padding: var(--space-4); border: 2px dashed var(--color-border); border-radius: var(--radius-md); color: var(--color-text-soft); font-size: var(--fs-small); }

/* "Common problems and fixes" callout */
.ap-help-callout { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-inline-start: 4px solid var(--color-primary); border-radius: var(--radius-md); background: var(--color-primary-tint); }
.ap-help-callout h2 { margin: 0; font-size: var(--fs-subsection); }

/* Related and previous/next */
.ap-help-related { display: flex; flex-direction: column; gap: var(--space-2); padding-block-start: var(--space-4); border-block-start: var(--border-subtle); }
.ap-help-related h2 { margin: 0; font-size: var(--fs-subsection); font-weight: var(--fw-bold); }
.ap-help-pager { display: grid; grid-template-columns: 1fr auto 1fr; gap: var(--space-3); align-items: center; padding-block-start: var(--space-4); border-block-start: var(--border-subtle); }
.ap-help-pager a { display: flex; flex-direction: column; justify-content: center; min-block-size: var(--tap-target); color: var(--color-link); font-weight: var(--fw-semibold); text-decoration: none; }
.ap-help-pager a:hover { text-decoration: underline; }
.ap-help-pager__label { font-size: var(--fs-caption); font-weight: var(--fw-medium); color: var(--color-text-soft); }
.ap-help-pager__prev { grid-column: 1; }
.ap-help-pager__back { grid-column: 2; text-align: center; }
.ap-help-pager__next { grid-column: 3; text-align: end; }
@media (max-width: 640px) {
	.ap-help-pager { grid-template-columns: 1fr; }
	.ap-help-pager a { grid-column: 1; text-align: start; }
	.ap-help-search__row { flex-direction: column; }
	.ap-help-steps > li { grid-template-columns: 1.75rem minmax(0, 1fr); }
	.ap-help-shot { grid-column: 1 / -1; }
}

/* Focus is always visible */
.ap-help-article a:focus-visible, .ap-help-hub a:focus-visible, .ap-help-part__title:focus-visible, .ap-help-list__title:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }

@media print {
	.ap-side, .ap-topbar, .ap-banner, .ap-help-noprint, .ap-help-skip, .ap-help-pagelink { display: none !important; }
	.ap-help-article, .ap-help-body { max-inline-size: none; gap: 12pt; }
	.ap-help-body { font-size: 11pt; }
	.ap-help-steps > li { break-inside: avoid; }
	.ap-help-shot img { max-block-size: 9cm; inline-size: auto; box-shadow: none; }
	.ap-help-callout { break-inside: avoid; background: none; border: 1px solid #000; }
	.ap-help-body a { color: inherit; text-decoration: underline; }
	.ap-help-part { display: block; }
}
