/**
 * My Help Center — prose.css
 *
 * Long-form content rendered from the block editor: articles, lessons, pages.
 * Applied through the `.hc-prose` wrapper. Also loaded in the editor (editor.css imports it).
 *
 * Block styles registered by the theme:
 * - core/list   → is-style-steps
 * - core/group  → is-style-note | is-style-tip | is-style-warning | is-style-danger | is-style-tabs | is-style-faq
 */

.hc-prose {
	min-inline-size: 0; /* allows wide <pre>/<table> to scroll instead of stretching grid parents */
	max-inline-size: var(--prose-width);
	color: var(--color-text);
	font-size: var(--text-md);
	line-height: var(--leading-prose);
	overflow-wrap: break-word;
}

.hc-prose > * {
	margin-block: 0;
}

.hc-prose > * + * {
	margin-block-start: 1.25em;
}

/* Headings ---------------------------------------------------------------- */

.hc-prose :where(h2, h3, h4) {
	scroll-margin-block-start: calc(var(--header-height) + var(--space-6));
	font-weight: var(--weight-semibold);
}

.hc-prose :where(h2) {
	margin-block-start: 2em;
	font-size: var(--text-2xl);
	line-height: var(--leading-heading);
}

.hc-prose :where(h3) {
	margin-block-start: 1.75em;
	font-size: var(--text-xl);
	line-height: var(--leading-snug);
}

.hc-prose :where(h4) {
	margin-block-start: 1.5em;
	font-size: var(--text-lg);
	line-height: var(--leading-snug);
}

.hc-prose :where(h2, h3, h4) + * {
	margin-block-start: 0.6em;
}

.hc-prose > :first-child {
	margin-block-start: 0;
}

/* Inline ------------------------------------------------------------------ */

.hc-prose :where(a:not([class])) {
	color: var(--color-link);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.3em;
}

@media (hover: hover) {
	.hc-prose :where(a:not([class])):hover {
		text-decoration-thickness: 2px;
	}
}

.hc-prose :where(strong, b) {
	font-weight: var(--weight-bold);
}

.hc-prose :where(:not(pre) > code) {
	padding: 0.1em 0.4em;
	border-radius: var(--radius-xs);
	background: var(--color-surface-muted);
	font-size: 0.875em;
}

.hc-prose :where(kbd) {
	display: inline-block;
	padding: 0.05em 0.45em;
	border: 1px solid var(--color-border-strong);
	border-block-end-width: 2px;
	border-radius: var(--radius-xs);
	background: var(--color-surface);
	font-size: 0.8125em;
	line-height: 1.6;
}

/* Lists ------------------------------------------------------------------- */

.hc-prose :where(ul, ol) {
	padding-inline-start: 1.5em;
}

.hc-prose :where(ol):lang(fa) {
	list-style-type: persian;
}

.hc-prose :where(li) + :where(li) {
	margin-block-start: 0.4em;
}

.hc-prose :where(li)::marker {
	color: var(--color-text-muted);
}

.hc-prose :where(li > ul, li > ol) {
	margin-block-start: 0.4em;
}

/* Steps (core/list → is-style-steps) */

.hc-prose ol.is-style-steps {
	padding-inline-start: 0;
	list-style: none;
	counter-reset: hc-step;
}

.hc-prose ol.is-style-steps > li {
	position: relative;
	min-block-size: 28px;
	padding-inline-start: calc(28px + var(--space-4));
	counter-increment: hc-step;
}

.hc-prose ol.is-style-steps > li + li {
	margin-block-start: 1.1em;
}

.hc-prose ol.is-style-steps > li::before {
	content: counter(hc-step);
	position: absolute;
	inset-block-start: 0.25em;
	inset-inline-start: 0;
	display: grid;
	place-items: center;
	inline-size: 28px;
	block-size: 28px;
	border-radius: 50%;
	background: var(--color-primary-light);
	color: var(--color-primary);
	font-size: var(--text-sm);
	font-weight: var(--weight-bold);
	line-height: 1;
}

.hc-prose ol.is-style-steps:lang(fa) > li::before {
	content: counter(hc-step, persian);
}

.hc-prose ol.is-style-steps > li:not(:last-child)::after {
	content: "";
	position: absolute;
	inset-block: calc(0.25em + 32px) calc(-1.35em + 4px);
	inset-inline-start: 13.5px;
	inline-size: 1px;
	background: var(--color-border);
}

/* Media ------------------------------------------------------------------- */

.hc-prose :where(figure) {
	margin-block: 1.75em;
}

.hc-prose :where(figure img, p > img),
.hc-prose > img {
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
}

.hc-prose :where(figcaption) {
	margin-block-start: 0.6em;
	font-size: var(--text-sm);
	line-height: var(--leading-sm);
	color: var(--color-text-muted);
	text-align: center;
}

.hc-prose :where(.aligncenter) {
	margin-inline: auto;
}

.hc-prose :where(video) {
	inline-size: 100%;
	border-radius: var(--radius-md);
}

.hc-prose :where(.wp-block-embed__wrapper) {
	position: relative;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	border-radius: var(--radius-md);
	background: var(--color-surface-muted);
}

.hc-prose :where(.wp-block-embed__wrapper iframe) {
	position: absolute;
	inset: 0;
	inline-size: 100%;
	block-size: 100%;
}

/* Tables ------------------------------------------------------------------ */

.hc-prose :where(.wp-block-table) {
	overflow-x: auto;
}

.hc-prose :where(table) {
	inline-size: 100%;
	font-size: var(--text-sm);
	line-height: var(--leading-sm);
}

.hc-prose :where(th, td) {
	padding: var(--space-3) var(--space-4);
	border: 1px solid var(--color-border);
	text-align: start;
	vertical-align: top;
}

.hc-prose :where(thead th) {
	background: var(--color-surface-muted);
	font-weight: var(--weight-semibold);
}

/* Code -------------------------------------------------------------------- */

.hc-prose :where(pre) {
	padding: var(--space-4) var(--space-5);
	overflow-x: auto;
	border-radius: var(--radius-md);
	background: var(--color-secondary);
	color: var(--color-on-secondary);
	font-size: 0.875rem;
	line-height: 1.75;
	tab-size: 2;
}

.hc-prose :where(pre code) {
	padding: 0;
	background: none;
	color: inherit;
	font-size: inherit;
}

.hc-prose :where(pre):focus-visible {
	outline-color: var(--color-primary);
}

/* Quote & rule ------------------------------------------------------------ */

.hc-prose :where(blockquote) {
	padding-inline-start: var(--space-5);
	border-inline-start: 3px solid var(--color-border-strong);
	color: var(--color-text-muted);
}

.hc-prose :where(blockquote cite) {
	display: block;
	margin-block-start: 0.5em;
	font-size: var(--text-sm);
}

.hc-prose :where(hr) {
	margin-block: 2.5em;
}

/* Callouts (core/group block styles) -------------------------------------- */

.hc-prose :is(.is-style-note, .is-style-tip, .is-style-warning, .is-style-danger) {
	--_bg: var(--color-primary-light);
	--_fg: var(--color-primary);
	--_icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5M12 8h.01'/%3E%3C/svg%3E");

	position: relative;
	padding: var(--space-4) var(--space-5);
	padding-inline-start: calc(var(--space-5) + 20px + var(--space-3));
	border-radius: var(--radius-md);
	background: var(--_bg);
	font-size: var(--text-base);
	line-height: var(--leading-base);
}

.hc-prose :is(.is-style-note, .is-style-tip, .is-style-warning, .is-style-danger)::before {
	content: "";
	position: absolute;
	inset-block-start: calc(var(--space-4) + 0.4em);
	inset-inline-start: var(--space-5);
	inline-size: 20px;
	block-size: 20px;
	background: var(--_fg);
	mask: var(--_icon) center / contain no-repeat;
}

.hc-prose :is(.is-style-note, .is-style-tip, .is-style-warning, .is-style-danger) > * + * {
	margin-block-start: 0.6em;
}

.hc-prose .is-style-tip {
	--_bg: var(--color-accent-light);
	--_fg: var(--color-accent);
	--_icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18h6M10 21h4M12 3a6 6 0 0 0-3.6 10.8c.6.5 1 1.2 1 2v.2h5.2v-.2c0-.8.4-1.5 1-2A6 6 0 0 0 12 3Z'/%3E%3C/svg%3E");
}

.hc-prose .is-style-warning {
	--_bg: var(--color-warning-light);
	--_fg: var(--color-warning);
	--_icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.3 4.2 2.9 17a2 2 0 0 0 1.7 3h14.8a2 2 0 0 0 1.7-3L13.7 4.2a2 2 0 0 0-3.4 0ZM12 9.5v4M12 17h.01'/%3E%3C/svg%3E");
}

.hc-prose .is-style-danger {
	--_bg: var(--color-danger-light);
	--_fg: var(--color-danger);
	--_icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.3 4.2 2.9 17a2 2 0 0 0 1.7 3h14.8a2 2 0 0 0 1.7-3L13.7 4.2a2 2 0 0 0-3.4 0ZM12 9.5v4M12 17h.01'/%3E%3C/svg%3E");
}

/* FAQ group (core/group is-style-faq containing core/details) ------------- */

.hc-prose :where(details) {
	border-block-end: 1px solid var(--color-border);
	interpolate-size: allow-keywords;
}

.hc-prose :where(details) + :where(details) {
	margin-block-start: 0;
}

.hc-prose .is-style-faq {
	border-block-start: 1px solid var(--color-border);
}

.hc-prose .is-style-faq > :is(h2, h3) {
	margin-block: 0;
	padding-block: var(--space-6) var(--space-2);
}

.hc-prose :where(details > summary) {
	position: relative;
	padding-block: var(--space-4);
	padding-inline-end: calc(20px + var(--space-4));
	font-size: var(--text-base);
	font-weight: var(--weight-semibold);
	line-height: var(--leading-snug);
	list-style: none;
}

.hc-prose :where(details > summary)::-webkit-details-marker {
	display: none;
}

.hc-prose :where(details > summary)::after {
	content: "";
	position: absolute;
	inset-block-start: calc(50% - 10px);
	inset-inline-end: 0;
	inline-size: 20px;
	block-size: 20px;
	background: var(--color-text-muted);
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9.5 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
	transition: rotate var(--duration-slow) var(--ease-standard);
}

.hc-prose :where(details[open] > summary)::after {
	rotate: 180deg;
}

.hc-prose :where(details > summary):focus-visible {
	outline-offset: 2px;
	border-radius: var(--radius-xs);
}

.hc-prose :where(details > :not(summary)) {
	margin-block: 0 var(--space-4);
	font-size: var(--text-base);
	line-height: var(--leading-base);
}

@supports selector(::details-content) {
	.hc-prose :where(details)::details-content {
		block-size: 0;
		overflow: hidden;
		transition:
			block-size var(--duration-slow) var(--ease-standard),
			content-visibility var(--duration-slow) allow-discrete;
	}

	.hc-prose :where(details[open])::details-content {
		block-size: auto;
	}
}

/* Tabs (core/group is-style-tabs > core/group panels) ---------------------
   Without JS: panels render one after another, each with its own heading.
   tabs.js adds `.hc-tabs-ready`, a tablist and hides inactive panels. */

.hc-prose .is-style-tabs {
	padding: var(--space-5);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
}

.hc-prose .is-style-tabs > * + * {
	margin-block-start: var(--space-6);
	padding-block-start: var(--space-6);
	border-block-start: 1px dashed var(--color-border);
}

.hc-prose .is-style-tabs > .wp-block-group > * + * {
	margin-block-start: 1em;
}

.hc-prose .is-style-tabs > .wp-block-group > :first-child {
	margin-block-start: 0;
}

.hc-prose .is-style-tabs.hc-tabs-ready > * + * {
	margin-block-start: 0;
	padding-block-start: 0;
	border: 0;
}

.hc-prose .hc-tabs-ready > .wp-block-group > :is(h2, h3, h4):first-child {
	position: absolute;
	inline-size: 1px;
	block-size: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.hc-tabs__list {
	display: flex;
	gap: var(--space-1);
	margin-block-end: var(--space-5);
	overflow-x: auto;
	border-block-end: 1px solid var(--color-border);
	scrollbar-width: none;
}

.hc-prose .hc-tabs__list {
	margin-block-start: 0;
}

.hc-tabs__tab {
	position: relative;
	flex: none;
	min-block-size: 40px;
	padding-inline: var(--space-3);
	color: var(--color-text-muted);
	font-size: var(--text-sm);
	font-weight: var(--weight-semibold);
	transition: color var(--duration-fast) var(--ease-standard);
}

.hc-tabs__tab::after {
	content: "";
	position: absolute;
	inset-inline: var(--space-2);
	inset-block-end: -1px;
	block-size: 2px;
	background: var(--color-primary);
	transform: scaleX(0);
	transition: transform var(--duration-base) var(--ease-out);
}

.hc-tabs__tab[aria-selected="true"] {
	color: var(--color-text);
}

.hc-tabs__tab[aria-selected="true"]::after {
	transform: scaleX(1);
}

.hc-tabs__tab:focus-visible {
	outline-offset: -4px;
	border-radius: var(--radius-sm);
}

/* Buttons block ----------------------------------------------------------- */

.hc-prose :where(.wp-block-buttons) {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-3);
}

.hc-prose :where(.wp-block-button__link) {
	display: inline-flex;
	align-items: center;
	min-block-size: 44px;
	padding-inline: var(--space-5);
	border-radius: var(--radius-pill);
	background: var(--color-button);
	color: var(--color-on-primary);
	font-size: var(--text-base);
	font-weight: var(--weight-semibold);
	text-decoration: none;
}

@media (hover: hover) {
	.hc-prose :where(.wp-block-button__link):hover {
		background: var(--color-button-hover);
	}
}
