/**
 * E-Potion FAQ Module
 *
 * Structure:
 *   .ep-faq                  — outer section
 *     .ep-faq-header         — title + subtitle
 *       .ep-faq-title        — h2 section title (centered)
 *       .ep-faq-subtitle     — optional intro line
 *     .ep-faq-list           — container for items
 *       .ep-faq-item         — <details> element
 *         .ep-faq-summary    — <summary> with H3 question + chevron
 *           .ep-faq-question — h3
 *           .ep-faq-chevron  — rotates on open
 *         .ep-faq-answer     — answer container (hidden until open)
 *
 * Native <details>/<summary> — zero JS, full keyboard/a11y support.
 * Smooth open/close animation where supported (Chrome 117+, modern browsers).
 *
 * @package Shoptimizer_Child
 */

/* ==========================================================================
   1. Container
   ========================================================================== */

.ep-faq {
	position: relative;
	width: 100%;
	margin: 0;
	padding: 48px 0;
	box-sizing: border-box;
	font-family: inherit;
	color: var(--ep-text-primary, #0e1116);
}

.ep-faq *,
.ep-faq *::before,
.ep-faq *::after {
	box-sizing: border-box;
}

/* ==========================================================================
   2. Header
   ========================================================================== */

.ep-faq-header {
	text-align: center;
	margin: 0 auto 36px;
	padding: 0 16px;
	max-width: 720px;
}

.ep-faq-title {
	font-size: 28px;
	font-weight: 800;
	line-height: 1.2;
	color: var(--ep-text-primary, #0e1116);
	margin: 0;
	letter-spacing: -0.015em;
}

.ep-faq-subtitle {
	font-size: 15px;
	line-height: 1.6;
	color: var(--ep-text-secondary, #525a64);
	margin: 12px 0 0;
}

/* ==========================================================================
   3. Item list
   ========================================================================== */

.ep-faq-list {
	max-width: 820px;
	margin: 0 auto;
	padding: 0 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

/* ==========================================================================
   4. Single item — <details>
   ========================================================================== */

.ep-faq-item {
	background: #ffffff;
	border: 1px solid var(--ep-border-default, #e1e3e6);
	border-radius: 12px;
	overflow: hidden;
	transition: border-color 200ms ease, box-shadow 200ms ease;
}

.ep-faq-item:hover {
	border-color: rgba(14, 17, 22, 0.18);
}

.ep-faq-item[open] {
	border-color: var(--ep-accent, #ff6b1a);
	box-shadow: 0 4px 16px rgba(255, 107, 26, 0.08);
}

/* Remove default arrow on <summary> across browsers */
.ep-faq-summary {
	cursor: pointer;
	list-style: none;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 18px 20px;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
	transition: background-color 200ms ease;
}

.ep-faq-summary::-webkit-details-marker {
	display: none;
}
.ep-faq-summary::marker {
	display: none;
	content: '';
}

.ep-faq-summary:hover {
	background-color: rgba(255, 107, 26, 0.03);
}

.ep-faq-summary:focus-visible {
	outline: 2px solid var(--ep-accent, #ff6b1a);
	outline-offset: -2px;
}

/* Question — h3 inside summary */
.ep-faq-question {
	font-size: 16px;
	font-weight: 600;
	line-height: 1.4;
	color: var(--ep-text-primary, #0e1116);
	margin: 0;
	flex: 1;
	letter-spacing: -0.005em;
}

/* Chevron */
.ep-faq-chevron {
	flex-shrink: 0;
	color: var(--ep-text-secondary, #525a64);
	transition: transform 250ms ease, color 200ms ease;
}

.ep-faq-item[open] .ep-faq-chevron {
	transform: rotate(180deg);
	color: var(--ep-accent, #ff6b1a);
}

.ep-faq-summary:hover .ep-faq-chevron {
	color: var(--ep-accent, #ff6b1a);
}

/* Answer */
.ep-faq-answer {
	padding: 0 20px 20px;
	font-size: 14.5px;
	line-height: 1.65;
	color: var(--ep-text-primary, #0e1116);
	border-top: 1px solid rgba(225, 227, 230, 0.6);
	margin-top: -1px;
}

.ep-faq-answer p {
	margin: 16px 0 0;
}
.ep-faq-answer p:first-child {
	margin-top: 16px;
}
.ep-faq-answer p:last-child {
	margin-bottom: 0;
}

.ep-faq-answer ul,
.ep-faq-answer ol {
	margin: 16px 0 0;
	padding-left: 24px;
}

.ep-faq-answer li {
	margin-bottom: 6px;
}

.ep-faq-answer a {
	color: var(--ep-accent, #ff6b1a);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 2px;
}

.ep-faq-answer a:hover {
	text-decoration-thickness: 2px;
}

.ep-faq-answer strong {
	font-weight: 700;
	color: var(--ep-text-primary, #0e1116);
}

/* ==========================================================================
   5. Smooth open/close animation
   (only where supported; falls back to instant snap on older browsers)
   ========================================================================== */

@supports (interpolate-size: allow-keywords) {
	.ep-faq-item {
		interpolate-size: allow-keywords;
	}
	.ep-faq-item::details-content {
		opacity: 0;
		block-size: 0;
		overflow: clip;
		transition:
			content-visibility 300ms allow-discrete,
			opacity 300ms ease,
			block-size 300ms ease;
	}
	.ep-faq-item[open]::details-content {
		opacity: 1;
		block-size: auto;
	}
}

/* ==========================================================================
   6. Responsive
   ========================================================================== */

@media (max-width: 720px) {
	.ep-faq {
		padding: 36px 0;
	}
	.ep-faq-header {
		margin-bottom: 24px;
	}
	.ep-faq-title {
		font-size: 22px;
	}
	.ep-faq-subtitle {
		font-size: 14px;
	}
	.ep-faq-summary {
		padding: 16px 16px;
		gap: 12px;
	}
	.ep-faq-question {
		font-size: 15px;
	}
	.ep-faq-answer {
		padding: 0 16px 16px;
		font-size: 14px;
	}
}

/* ==========================================================================
   7. Reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
	.ep-faq-item,
	.ep-faq-chevron,
	.ep-faq-summary {
		transition: none;
	}
	.ep-faq-item[open] .ep-faq-chevron {
		transition: none;
	}
	@supports (interpolate-size: allow-keywords) {
		.ep-faq-item::details-content {
			transition: none;
		}
	}
}
