/* ═══════════════════════════════════════════════════════
   FAQ PAGE — faq.css
   LiquidPixels · liquidpixels.com/faq/
   ═══════════════════════════════════════════════════════ */

/* ── Scoped reset ── */
.faq-section *,
.faq-ask-card *,
.page-hero * {
	box-sizing: border-box;
}

/* Prevent horizontal overflow — note: do NOT put overflow on .faq-section
   as that kills position:sticky on .faq-nav */
.faq-layout,
.faq-content,
.faq-ask-card {
	max-width: 100%;
}

/* Minimum 44px tap targets on all interactive elements */
.faq-question {
	min-height: 44px;
}
.faq-nav-link {
	min-height: 44px;
	display: flex;
	align-items: center;
}

/* ── section-tag — defined here because it lives in home.css, not global.css ── */
.section-tag {
	font-family: var(--f-mono);
	font-size: 9px;
	font-weight: 500;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--amber);
	display: block;
	margin-bottom: 10px;
}

/* ── Buttons — defined here because btn-primary/secondary live in home.css,
   not global.css, and this page does not load home.css ── */
.btn-primary {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-family: var(--f-sans);
	font-size: 13.5px;
	font-weight: 500;
	letter-spacing: -0.01em;
	padding: 11px 28px;
	border-radius: var(--r-sm);
	background: var(--navy);
	color: #fff;
	border: none;
	box-shadow:
		0 1px 2px rgba(12, 31, 61, 0.2),
		0 4px 16px rgba(12, 31, 61, 0.16);
	transition:
		background 0.2s,
		transform 0.1s,
		box-shadow 0.2s;
	cursor: pointer;
	text-decoration: none;
	white-space: nowrap;
	min-height: 44px;
	--amber: #f59e0b;
}
.btn-primary:hover {
	background: var(--navy-mid);
	box-shadow:
		0 2px 4px rgba(12, 31, 61, 0.2),
		0 8px 24px rgba(12, 31, 61, 0.18);
	--amber: #f59e0b;
}
.btn-primary:active {
	transform: scale(0.98);
}

.btn-secondary {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-family: var(--f-sans);
	font-size: 13.5px;
	font-weight: 400;
	letter-spacing: -0.01em;
	padding: 11px 28px;
	border-radius: var(--r-sm);
	background: transparent;
	color: var(--ink-600);
	border: 1px solid var(--warm-300);
	transition:
		color 0.18s,
		border-color 0.18s,
		background 0.18s;
	cursor: pointer;
	text-decoration: none;
	white-space: nowrap;
	min-height: 44px;
}
.btn-secondary:hover {
	color: var(--ink-900);
	border-color: var(--warm-400);
	background: var(--warm-50);
}

/* ── FAQ section shell ── */
.faq-section {
	padding: 80px 0 104px;
	background: var(--off-white);
}

/* ── Sticky fix ──
   global.css sets overflow-x: hidden on BOTH html and body.
   This promotes them to scroll containers, silently breaking
   position: sticky on all descendants.
   overflow: clip achieves the same visual result (no horizontal
   scroll) without creating a scroll container. */
html,
body {
	overflow-x: clip !important;
}

/* ── Two-column layout: sticky nav + content ── */
.faq-layout {
	display: grid;
	grid-template-columns: 200px 1fr;
	gap: 72px;
	align-items: start;
}

/* ── Sticky sidebar nav ── */
.faq-nav {
	position: sticky;
	top: 84px; /* 60px fixed nav + 24px breathing room */
	max-height: calc(100vh - 108px);
	overflow-y: auto;
	/* Hide scrollbar visually but keep it functional */
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.faq-nav::-webkit-scrollbar {
	display: none;
}

.faq-nav ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.faq-nav-link {
	display: block;
	font-size: 13px;
	font-weight: 400;
	line-height: 1.4;
	color: var(--ink-500);
	text-decoration: none;
	padding: 6px 12px;
	border-radius: var(--r-sm);
	border-left: 2px solid transparent;
	transition:
		color 0.2s,
		border-color 0.2s,
		background 0.2s;
}

.faq-nav-link:hover {
	color: var(--ink-900);
	background: var(--warm-100);
}

.faq-nav-link.active {
	color: var(--ink-900);
	font-weight: 500;
	border-left-color: var(--amber);
	background: var(--warm-100);
}

/* ── FAQ groups ── */
.faq-group {
	margin-bottom: 64px;
}

.faq-group:last-child {
	margin-bottom: 0;
}

.faq-group-header {
	margin-bottom: 24px;
	padding-bottom: 20px;
	border-bottom: 1px solid var(--warm-200);
}

.faq-group-header h2 {
	font-family: var(--f-serif) !important;
	font-weight: 400 !important; /* Instrument Serif — 400 only */
	font-size: clamp(20px, 2.2vw, 28px);
	line-height: 1.15;
	color: var(--ink-900);
	margin: 0;
}

/* ── FAQ accordion items (native <details>) ── */
.faq-item {
	border-bottom: 1px solid var(--warm-200);
}

.faq-item:first-of-type {
	border-top: none; /* group header border handles the top */
}

/* ── Summary / question row ── */
.faq-question {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 20px 0;
	cursor: pointer;
	list-style: none;
	user-select: none;
}

/* Remove default marker in all browsers */
.faq-question::-webkit-details-marker {
	display: none;
}
.faq-question::marker {
	display: none;
}

.faq-question span {
	font-size: 15px;
	font-weight: 500;
	line-height: 1.4;
	color: var(--ink-900);
	flex: 1;
	transition: color 0.2s;
}

.faq-item:hover .faq-question span {
	color: var(--ink-700);
}

.faq-item[open] .faq-question span {
	color: var(--ink-900);
}

/* ── Chevron icon ── */
.faq-chevron {
	width: 18px;
	height: 18px;
	color: var(--ink-400);
	flex-shrink: 0;
	transition:
		transform 0.25s ease,
		color 0.2s;
}

.faq-item[open] .faq-chevron {
	transform: rotate(180deg);
	color: var(--amber);
}

/* ── Answer body ── */
.faq-answer {
	padding: 0 0 24px;
	max-width: 680px;
}

.faq-answer p {
	font-size: 14px;
	font-weight: 300;
	line-height: 1.7;
	color: var(--ink-600);
	margin: 0 0 14px;
}

.faq-answer p:last-child {
	margin-bottom: 0;
}

/* ── Closing section rules live in closing-section.css — do not duplicate here ── */

/* ── Reveal animations ── */
.rv {
	opacity: 0;
	transform: translateY(16px);
	transition:
		opacity 0.5s,
		transform 0.5s;
}
.rv.v {
	opacity: 1;
	transform: none;
}
.rv.d1 {
	transition-delay: 0.1s;
}
.rv.d2 {
	transition-delay: 0.2s;
}
.rv.d3 {
	transition-delay: 0.3s;
}

/* ══════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════ */

@media (max-width: 1024px) {
	.faq-layout {
		grid-template-columns: 160px 1fr;
		gap: 48px;
	}
}

@media (max-width: 768px) {
	.page-hero {
		padding: calc(88px + env(safe-area-inset-top, 0px)) 0 56px;
	}

	.faq-section {
		padding: 64px 0 80px;
	}

	.faq-layout {
		grid-template-columns: 1fr;
		gap: 0;
	}

	/* Sidebar nav becomes horizontal scrolling bar on mobile */
	.faq-nav {
		position: static;
		margin-bottom: 40px;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}

	.faq-nav ul {
		flex-direction: row;
		gap: 4px;
		padding-bottom: 2px;
		white-space: nowrap;
	}

	.faq-nav-link {
		padding: 6px 14px;
		border-left: none;
		border-bottom: 2px solid transparent;
		border-radius: var(--r-md);
	}

	.faq-nav-link.active {
		border-left-color: transparent;
		border-bottom-color: var(--amber);
	}
}

@media (max-width: 480px) {
	.faq-section {
		padding: 52px 0 64px;
	}
	.faq-ask-card {
		padding: 20px 16px;
	}
	.faq-ask-input {
		font-size: 16px;
	} /* prevent iOS zoom on focus */
	.faq-group {
		margin-bottom: 48px;
	}
	.faq-question span {
		font-size: 14px;
	}
}

/* ═══════════════════════════════════════════════════════
   ASK INTERFACE
   ═══════════════════════════════════════════════════════ */

.faq-ask-card {
	background: var(--white);
	border: 1px solid var(--warm-200);
	border-radius: var(--r-xl);
	box-shadow: var(--shadow-md);
	padding: 32px;
	margin-bottom: 56px;
}

.faq-ask-header {
	margin-bottom: 20px;
}

.faq-ask-intro {
	font-size: 13.5px;
	font-weight: 300;
	line-height: 1.6;
	color: var(--ink-500);
	margin: 0;
	max-width: 560px;
}

/* ── Input row ── */
.faq-ask-input-row {
	display: flex;
	gap: 10px;
	align-items: stretch;
}

.faq-ask-input {
	flex: 1;
	font-family: var(--f-sans);
	font-size: 14px;
	font-weight: 300;
	line-height: 1.5;
	color: var(--ink-900);
	background: var(--off-white);
	border: 1px solid var(--warm-200);
	border-radius: var(--r-md);
	padding: 10px 16px;
	outline: none;
	transition:
		border-color 0.2s,
		box-shadow 0.2s;
	min-width: 0;
}

.faq-ask-input::placeholder {
	color: var(--ink-400);
	font-weight: 300;
}

.faq-ask-input:focus {
	border-color: var(--ink-700);
	box-shadow: 0 0 0 3px rgba(14, 14, 12, 0.06);
	background: var(--white);
}

.faq-ask-input:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* ── Ask button — inherits btn-primary defined above ── */
.faq-ask-btn {
	flex-shrink: 0;
	white-space: nowrap;
	min-width: 80px;
}

.faq-ask-btn:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

/* ── Copy button ── */
.faq-answer-actions {
	display: flex;
	justify-content: flex-end;
	margin-top: 16px;
	margin-bottom: 4px;
}

.faq-copy-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-family: var(--f-sans);
	font-size: 12px;
	font-weight: 500;
	color: var(--ink-500);
	background: transparent;
	border: 1px solid var(--warm-200);
	border-radius: var(--r-sm);
	padding: 5px 12px;
	cursor: pointer;
	transition:
		color 0.2s,
		border-color 0.2s,
		background 0.2s;
	min-height: 32px;
}

.faq-copy-btn svg {
	width: 14px;
	height: 14px;
	flex-shrink: 0;
}

.faq-copy-btn:hover {
	color: var(--ink-900);
	border-color: var(--warm-300);
	background: var(--warm-50);
}

.faq-copy-btn.copied {
	color: var(--green, #15803d);
	border-color: rgba(21, 128, 61, 0.25);
	background: rgba(21, 128, 61, 0.05);
}

body.hc .faq-copy-btn {
	border-color: var(--warm-300);
}

/* ── Meta row ── */
.faq-ask-meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-top: 8px;
}

.faq-char-count {
	font-family: var(--f-mono);
	font-size: 10px;
	font-weight: 500;
	color: var(--ink-400);
	letter-spacing: 0.04em;
	transition: color 0.2s;
	flex-shrink: 0;
}

.faq-ask-hint {
	font-size: 11.5px;
	font-weight: 300;
	color: var(--ink-400);
	text-align: right;
}

/* ── Answer panel ── */
.faq-answer-panel {
	overflow: hidden;
	opacity: 0;
	max-height: 0;
	transform: translateY(8px);
	transition:
		opacity 0.35s ease,
		transform 0.35s ease,
		max-height 0.35s ease;
	pointer-events: none;
}

.faq-answer-panel.visible {
	opacity: 1;
	max-height: 2000px;
	transform: none;
	pointer-events: auto;
}

.faq-answer-divider {
	height: 1px;
	background: var(--warm-200);
	margin: 24px 0;
}

.faq-answer-body p {
	font-size: 14px;
	font-weight: 300;
	line-height: 1.75;
	color: var(--ink-700);
	margin: 0 0 14px;
}

.faq-answer-body p:last-child {
	margin-bottom: 0;
}

.faq-answer-error {
	color: var(--ink-500) !important;
	font-style: italic;
}

/* ── CTA within answer ── */
.faq-answer-cta {
	display: flex;
	align-items: center;
	gap: 20px;
	margin-top: 20px;
	padding-top: 20px;
	border-top: 1px solid var(--warm-100);
	flex-wrap: wrap;
}

.faq-answer-cta-text {
	font-size: 13.5px;
	font-weight: 300;
	line-height: 1.5;
	color: var(--ink-500);
	margin: 0;
	flex: 1;
	min-width: 200px;
}

/* ── HC overrides ── */
body.hc .faq-ask-card {
	border-color: var(--warm-300);
	box-shadow: none;
}

body.hc .faq-ask-input {
	border-color: var(--warm-300);
	background: var(--warm-50);
}

body.hc .faq-ask-input:focus {
	border-color: var(--ink-700);
}

/* ── Responsive ── */
@media (max-width: 768px) {
	.faq-ask-card {
		padding: 24px;
		margin-bottom: 40px;
	}

	.faq-ask-input-row {
		flex-direction: column;
	}

	.faq-ask-btn {
		width: 100%;
	}

	.faq-ask-meta {
		flex-direction: column;
		align-items: flex-start;
		gap: 4px;
	}

	.faq-ask-hint {
		text-align: left;
	}

	.faq-answer-cta {
		flex-direction: column;
		align-items: flex-start;
		gap: 12px;
	}
}

/* ── Streaming cursor ── */
.faq-stream-cursor {
	display: inline-block;
	width: 2px;
	height: 1em;
	background: var(--amber);
	margin-left: 2px;
	vertical-align: text-bottom;
	animation: faq-blink 0.7s step-end infinite;
}

@keyframes faq-blink {
	0%,
	100% {
		opacity: 1;
	}
	50% {
		opacity: 0;
	}
}

/* ── Back to top ── */
.back-to-top {
	position: fixed;
	bottom: 32px;
	right: 32px;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: var(--ink-900);
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	pointer-events: none;
	transform: translateY(8px);
	transition:
		opacity 0.25s,
		transform 0.25s;
	z-index: 200;
	box-shadow: var(--shadow-md);
	--amber: #f59e0b;
}

.back-to-top svg {
	width: 18px;
	height: 18px;
	color: var(--off-white);
}

.back-to-top.visible {
	opacity: 1;
	pointer-events: auto;
	transform: none;
}

.back-to-top:hover {
	background: var(--ink-700);
}

body.hc .back-to-top {
	background: #000;
	border: 1px solid var(--warm-300);
	--amber: #f59e0b;
}

@media (max-width: 768px) {
	.back-to-top {
		bottom: 20px;
		right: 20px;
	}
}

/* ═══════════════════════════════════════════════════════
   SAVE CHECKBOX — per answer
   ═══════════════════════════════════════════════════════ */

.faq-save-row {
	margin-top: 16px;
	padding-top: 14px;
	border-top: 1px solid var(--warm-100);
}

.faq-save-label {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	font-family: var(--f-sans);
	font-size: 12px;
	font-weight: 400;
	color: var(--ink-400);
	cursor: pointer;
	user-select: none;
	transition: color 0.2s;
}

.faq-save-label:hover {
	color: var(--ink-700);
}

.faq-save-check {
	appearance: none;
	-webkit-appearance: none;
	width: 16px;
	height: 16px;
	border: 1.5px solid var(--warm-300);
	border-radius: 3px;
	background: var(--white);
	cursor: pointer;
	flex-shrink: 0;
	transition:
		border-color 0.15s,
		background 0.15s;
	position: relative;
}

.faq-save-check:checked {
	background: var(--navy);
	border-color: var(--navy);
	--amber: #f59e0b;
}

/* Checkmark via sibling SVG — show only when checked */
.faq-save-label svg {
	width: 14px;
	height: 14px;
	color: var(--ink-400);
	flex-shrink: 0;
	opacity: 0;
	transform: scale(0.7);
	transition:
		opacity 0.15s,
		transform 0.15s,
		color 0.15s;
	margin-left: -21px; /* overlap the checkbox */
	pointer-events: none;
}

.faq-save-check:checked ~ svg {
	opacity: 1;
	transform: scale(1);
	color: var(--white);
}

.faq-save-check:checked ~ span {
	color: var(--ink-900);
	font-weight: 500;
}

/* When item is saved, highlight the answer border */
.faq-item.is-saved {
	border-left: 2px solid var(--amber);
	padding-left: 12px;
	margin-left: -14px;
}

/* ═══════════════════════════════════════════════════════
   EXPORT BAR — floating bottom
   ═══════════════════════════════════════════════════════ */

.faq-export-bar {
	position: fixed;
	bottom: 32px;
	left: 50%;
	transform: translateX(-50%) translateY(24px);
	opacity: 0;
	pointer-events: none;
	transition:
		opacity 0.3s ease,
		transform 0.3s ease;
	z-index: 500;
	width: max-content;
	max-width: calc(100vw - 48px);
}

.faq-export-bar.visible {
	opacity: 1;
	pointer-events: auto;
	transform: translateX(-50%) translateY(0);
}

.faq-export-inner {
	display: flex;
	align-items: center;
	gap: 20px;
	background: var(--navy);
	border-radius: var(--r-lg);
	padding: 12px 16px 12px 20px;
	box-shadow:
		0 4px 24px rgba(12, 31, 61, 0.28),
		0 1px 4px rgba(12, 31, 61, 0.2);
	--amber: #f59e0b;
}

.faq-export-count {
	font-family: var(--f-mono);
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.04em;
	color: rgba(255, 255, 255, 0.7);
	white-space: nowrap;
}

.faq-export-actions {
	display: flex;
	align-items: center;
	gap: 8px;
}

.faq-export-clear {
	font-family: var(--f-sans);
	font-size: 12.5px;
	font-weight: 400;
	color: rgba(255, 255, 255, 0.55);
	background: transparent;
	border: none;
	cursor: pointer;
	padding: 6px 4px;
	transition: color 0.2s;
	white-space: nowrap;
}

.faq-export-clear:hover {
	color: rgba(255, 255, 255, 0.9);
}

.faq-export-btn {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	font-size: 13px;
	padding: 9px 18px;
	background: var(--white);
	color: var(--navy);
	border: none;
	min-height: 38px;
}

.faq-export-btn:hover {
	background: var(--warm-50);
}

.faq-export-btn svg {
	width: 15px;
	height: 15px;
	flex-shrink: 0;
}

@media (max-width: 768px) {
	.faq-export-bar {
		bottom: 20px;
	}
	.faq-export-inner {
		gap: 12px;
		padding: 10px 12px 10px 16px;
	}
}

@media (max-width: 480px) {
	.faq-export-bar {
		max-width: calc(100vw - 32px);
	}
	.faq-export-inner {
		flex-direction: column;
		align-items: stretch;
		gap: 10px;
	}
	.faq-export-actions {
		justify-content: flex-end;
	}
}

/* ═══════════════════════════════════════════════════════
   FOUNDATION BLOCK
   ═══════════════════════════════════════════════════════ */

.faq-foundation {
	background: var(--white);
	border: 1.5px solid var(--warm-200);
	border-radius: var(--r-xl);
	padding: 32px 32px 24px;
	margin-bottom: 64px;
	box-shadow: var(--shadow-md);
	position: relative;
}

/* Amber left accent */
.faq-foundation::before {
	content: "";
	position: absolute;
	left: 0;
	top: 24px;
	bottom: 24px;
	width: 3px;
	background: var(--amber);
	border-radius: 0 2px 2px 0;
}

.faq-foundation-header {
	margin-bottom: 20px;
	padding-bottom: 20px;
	border-bottom: 1px solid var(--warm-100);
}

.faq-foundation-header h2 {
	font-family: var(--f-serif) !important;
	font-weight: 400 !important;
	font-size: clamp(18px, 2vw, 24px);
	line-height: 1.15;
	color: var(--ink-900);
	margin: 8px 0 6px;
}

.faq-foundation-sub {
	font-family: var(--f-sans);
	font-size: 13.5px;
	font-weight: 300;
	line-height: 1.6;
	color: var(--ink-500);
	margin: 0;
}

/* Foundation items — tighter styling inside the card */
.faq-foundation-item {
	border-bottom: 1px solid var(--warm-100);
}

.faq-foundation-item:last-of-type {
	border-bottom: none;
}

/* "Browse all" footer */
.faq-foundation-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: 20px;
	padding-top: 16px;
	border-top: 1px solid var(--warm-100);
}

.faq-foundation-footer span {
	font-size: 12.5px;
	font-weight: 300;
	color: var(--ink-400);
}

.faq-foundation-browse {
	font-family: var(--f-sans);
	font-size: 12.5px;
	font-weight: 500;
	color: var(--ink-900);
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	gap: 5px;
	transition: color 0.2s;
}

.faq-foundation-browse::after {
	content: "↓";
	font-size: 11px;
	transition: transform 0.2s;
}

.faq-foundation-browse:hover {
	color: var(--amber);
}

.faq-foundation-browse:hover::after {
	transform: translateY(2px);
}

/* ── HC overrides ── */
body.hc .faq-foundation {
	border-color: var(--warm-300);
	box-shadow: none;
}

/* ── Responsive ── */
@media (max-width: 768px) {
	.faq-foundation {
		padding: 24px 20px 16px;
		margin-bottom: 40px;
		border-radius: var(--r-lg);
	}
}

@media (max-width: 480px) {
	.faq-foundation {
		padding: 20px 16px 14px;
	}
	.faq-foundation-footer {
		flex-direction: column;
		align-items: flex-start;
		gap: 8px;
	}
}

/* ── Inline contextual links within answers ── */
.faq-inline-link {
	color: var(--navy-accent);
	text-decoration: underline;
	text-decoration-color: var(--warm-300);
	text-underline-offset: 4px;
	font-weight: 400;
	transition:
		color 0.2s,
		text-decoration-color 0.2s;
}

.faq-inline-link:hover {
	color: var(--navy);
	text-decoration-color: var(--amber);
}

/* ── Section divider between foundation and main FAQ ── */
.faq-section-divider {
	display: flex;
	align-items: center;
	gap: 16px;
	margin-bottom: 40px;
}

.faq-section-divider::before,
.faq-section-divider::after {
	content: "";
	flex: 1;
	height: 1px;
	background: var(--warm-200);
}

.faq-section-divider span {
	font-family: var(--f-mono);
	font-size: 9px;
	font-weight: 500;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--ink-400);
	white-space: nowrap;
}
