/**
 * FAQ-аккордеон «Памятки» (/reminders/).
 *
 * Разметка — нативные <details>/<summary>: работает без JS, доступно с
 * клавиатуры и скринридеров из коробки, состояние поисковиками читается
 * как обычный текст (закрытый <details> не скрывается от индексации).
 *
 * Специфичность поднята до .dd-prose .memo-faq, т.к. style.css компонента
 * подключается раньше main.css, а контентная колонка задаёт свои стили
 * для p / a / списков внутри .dd-prose.
 */

.dd-prose .memo-faq,
.memo-faq {
	margin: 8px 0 24px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.memo-faq__item {
	background: #fff;
	border: 1px solid var(--dd-border, #e2e8f0);
	border-radius: var(--dd-radius-md, 10px);
	overflow: hidden;
	transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.memo-faq__item:hover {
	border-color: #b9dfc8;
}

.memo-faq__item[open] {
	border-color: #b9dfc8;
	box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
}

/* Вопрос */
.dd-prose .memo-faq__question,
.memo-faq__question {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 14px;
	padding: 16px 18px;
	cursor: pointer;
	list-style: none;
	font-family: Roboto, sans-serif;
	font-size: 16px;
	font-weight: 500;
	line-height: 1.4;
	color: var(--dd-text-main, #0f172a);
	transition: color 0.15s ease;
}

/* Убираем штатный треугольник <summary> во всех движках */
.memo-faq__question::-webkit-details-marker {
	display: none;
}

.memo-faq__question::marker {
	content: "";
}

.memo-faq__item:hover .memo-faq__question {
	color: var(--dd-primary, #30915a);
}

.memo-faq__question:focus-visible {
	outline: 2px solid var(--dd-primary, #30915a);
	outline-offset: -2px;
	border-radius: var(--dd-radius-md, 10px);
}

.memo-faq__text {
	flex: 1 1 auto;
	min-width: 0;
}

/* Плюс/минус справа */
.memo-faq__toggle {
	position: relative;
	flex: 0 0 20px;
	width: 20px;
	height: 20px;
	margin-top: 1px;
	border-radius: 50%;
	background: #eef7f1;
	transition: background-color 0.18s ease;
}

.memo-faq__toggle::before,
.memo-faq__toggle::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 10px;
	height: 2px;
	border-radius: 1px;
	background: var(--dd-primary, #30915a);
	transform: translate(-50%, -50%);
	transition: transform 0.2s ease, opacity 0.2s ease;
}

.memo-faq__toggle::after {
	transform: translate(-50%, -50%) rotate(90deg);
}

/* Раскрыто: вертикальная черта убирается — остаётся «минус» */
.memo-faq__item[open] > .memo-faq__question .memo-faq__toggle {
	background: #dff0e6;
}

.memo-faq__item[open] > .memo-faq__question .memo-faq__toggle::after {
	transform: translate(-50%, -50%) rotate(0deg);
	opacity: 0;
}

/* Ответ */
.memo-faq__answer {
	padding: 0 18px 16px;
	border-top: 1px solid #eef2f6;
	padding-top: 14px;
	font-family: Roboto, sans-serif;
	font-size: 15px;
	line-height: 1.6;
	color: var(--dd-text-muted, #64748b);
}

/* Плавное появление ответа (там, где браузер умеет animate до auto) */
@media (prefers-reduced-motion: no-preference) {
	.memo-faq__item[open] > .memo-faq__answer {
		animation: memo-faq-reveal 0.22s ease-out;
	}
}

@keyframes memo-faq-reveal {
	from {
		opacity: 0;
		transform: translateY(-4px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.dd-prose .memo-faq__content p,
.memo-faq__content p {
	margin: 0 0 12px;
	font-size: inherit;
	line-height: inherit;
	color: inherit;
}

.memo-faq__content > *:last-child {
	margin-bottom: 0;
}

/* Списки и таблицы внутри ответа наследуют типографику */
.memo-faq__content ul,
.memo-faq__content ol {
	margin: 0 0 12px;
	padding-left: 22px;
	font-size: inherit;
	line-height: inherit;
	color: inherit;
}

.memo-faq__content li {
	margin-bottom: 6px;
	color: inherit;
}

.memo-faq__content li:last-child {
	margin-bottom: 0;
}

/* Таблицы внутри памяток (напр. «Подготовка к гастроскопии») */
.memo-faq__content .styled-table {
	margin: 12px 0;
}

.memo-faq__content table {
	width: 100% !important;
	max-width: 100% !important;
	font-size: 14px;
}

.memo-faq__content table td,
.memo-faq__content table th {
	padding: 8px 10px;
	vertical-align: top;
	white-space: normal !important;
	text-align: left !important;
	min-width: 0 !important;
	font-weight: 400;
}

.memo-faq__content img {
	max-width: 100%;
	height: auto;
}

/* Ссылка на детальную страницу */
.dd-prose .memo-faq__more,
.memo-faq__more {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 12px;
	font-family: Roboto, sans-serif;
	font-size: 14px;
	font-weight: 500;
	text-decoration: none;
	color: var(--dd-primary, #30915a);
	transition: color 0.15s ease, gap 0.15s ease;
}

.memo-faq__more:hover {
	color: #1f6b41;
	gap: 10px;
	text-decoration: underline;
}

.memo-faq__more-arrow {
	font-size: 15px;
	line-height: 1;
}

/* Мобильные: компактнее */
@media (max-width: 767px) {
	.dd-prose .memo-faq__question,
	.memo-faq__question {
		padding: 14px 14px;
		font-size: 15px;
		gap: 10px;
	}

	.memo-faq__answer {
		padding: 12px 14px 14px;
		font-size: 14px;
	}

	.memo-faq__content table {
		font-size: 13px;
	}

	.memo-faq__content table td,
	.memo-faq__content table th {
		padding: 6px 8px;
	}
}
