/* Плавная анимация для всех изменяемых свойств */
.faq__item {
transition: background-color 0.3s ease, border-color 0.3s ease;
}
/* Скрываем стандартный треугольник у тега summary */
.faq__question {
list-style: none;
cursor: pointer;
position: relative; /* Нужно для позиционирования полосы слева */
transition: color 0.3s ease, background-color 0.3s ease;
}
.faq__question::-webkit-details-marker {
display: none; /* Для Safari и Chrome */
}
/* Стилизация иконки "+" / "x" */
.faq__icon {
display: inline-block;
width: 20px;
height: 20px;
position: relative;
transition: transform 0.3s ease;
}
/* Рисуем плюс с помощью псевдоэлементов */
.faq__icon::before,
.faq__icon::after {
content: '';
position: absolute;
background-color: currentColor; /* Наследует цвет текста */
transition: transform 0.3s ease, background-color 0.3s ease;
}
/* Горизонтальная линия плюса */
.faq__icon::before {
top: 50%;
left: 0;
width: 100%;
height: 2px;
transform: translateY(-50%);
}
/* Вертикальная линия плюса */
.faq__icon::after {
left: 50%;
top: 0;
width: 2px;
height: 100%;
transform: translateX(-50%);
}
/* Плавное раскрытие ответа */
.faq__answer-clip {
display: grid;
grid-template-rows: 0fr;
transition: grid-template-rows 0.3s ease;
}
.faq__answer-inner {
overflow: hidden;
}
/* Стили для ОТКРЫТОГО состояния (когда у details есть атрибут open) */
.faq__item[open] .faq__question {
color: var(--faq-active-color);
background-color: var(--faq-active-background);
/* Добавляем полосу слева */
box-shadow: inset var(--faq-active-stripe-width) 0 0 0 var(--faq-active-stripe-color);
}
/* Превращаем "+" в "x" (поворачиваем вертикальную линию на 90 градусов) */
.faq__item[open] .faq__icon::after {
transform: translateX(-50%) rotate(90deg);
}
/* Раскрываем контент */
.faq__item[open] .faq__answer-clip {
grid-template-rows: 1fr;
}