/* ==========================================
   DOWNLOAD CAPTURE COMPONENT
   Email subscription with expand/collapse animation
   ========================================== */

/* Container */
.download-capture {
	position: relative;
	display: inline-flex;
	flex-direction: column;
	align-items: center;
}

/* ==========================================
   PANEL: Expand/Collapse Animation
   ========================================== */

.download-capture-panel {
	max-height: 0;
	opacity: 0;
	overflow: hidden;
	transition: max-height 0.3s ease, opacity 0.3s ease;
	width: 100%;
	max-width: 360px;
}

.download-capture.is-expanded .download-capture-panel {
	max-height: 320px;
	opacity: 1;
	margin-top: 16px;
}

/* ==========================================
   FORM STRUCTURE
   ========================================== */

.download-capture-form {
	display: flex;
	flex-direction: column;
	gap: 16px;
	padding: 24px;
	background: var(--bg);
	border: 1px solid var(--line);
	border-radius: 16px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.download-capture-heading {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	color: var(--ink);
	text-align: center;
}

.download-capture-fields {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

/* ==========================================
   EMAIL INPUT
   Match existing contact form input styles
   ========================================== */

.download-capture-form input[type="email"] {
	width: 100%;
	padding: 12px 16px;
	border: 1px solid var(--line);
	border-radius: 14px;
	font-family: inherit;
	font-size: 15px;
	color: var(--ink);
	background: var(--bg);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	-webkit-appearance: none;
	appearance: none;
}

.download-capture-form input[type="email"]::placeholder {
	color: var(--muted);
}

.download-capture-form input[type="email"]:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px rgba(5, 14, 57, 0.1);
}

/* ==========================================
   CONSENT CHECKBOX
   ========================================== */

.consent-field {
	display: flex;
	flex-direction: row;
	align-items: flex-start;
	gap: 10px;
}

.consent-field input[type="checkbox"] {
	flex-shrink: 0;
	width: 20px;
	height: 20px;
	margin: 2px 0 0 0;
	border: 2px solid var(--line);
	border-radius: 4px;
	background: var(--bg);
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.consent-field input[type="checkbox"]:checked {
	background: var(--accent);
	border-color: var(--accent);
	background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e");
	background-size: 100%;
	background-position: center;
	background-repeat: no-repeat;
}

.consent-field label {
	font-size: 13px;
	line-height: 1.5;
	color: var(--muted);
	cursor: pointer;
}

.consent-field label a {
	color: var(--accent);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.consent-field label a:hover {
	text-decoration: none;
}

/* ==========================================
   ACTIONS: Submit & Skip
   ========================================== */

.download-capture-actions {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
}

.download-capture-submit {
	width: 100%;
}

/* Loading state */
.download-capture-submit:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* Skip link - subtle text link */
.download-capture-skip {
	font-size: 13px;
	color: var(--muted);
	text-decoration: none;
	transition: color 0.15s ease;
}

.download-capture-skip:hover {
	color: var(--ink);
	text-decoration: underline;
}

/* ==========================================
   FEEDBACK STATES
   Match contact form success/error styles
   ========================================== */

.download-capture-feedback {
	display: none;
}

.download-capture-feedback.is-visible {
	display: block;
	padding: 12px 16px;
	border-radius: 14px;
	font-size: 14px;
	line-height: 1.5;
	font-weight: 500;
	text-align: center;
}

.download-capture-feedback.success {
	background: var(--accent-weak);
	color: var(--accent);
	border: 1px solid var(--accent);
}

.download-capture-feedback.error {
	background: #fef2f2;
	color: #dc2626;
	border: 1px solid #fecaca;
}

.download-capture-feedback.info {
	background: #eff6ff;
	color: #1d4ed8;
	border: 1px solid #bfdbfe;
}

/* ==========================================
   FOCUS STATES (WCAG 2.4.13 Compliant)
   ========================================== */

/* Keyboard focus indicator for all interactive elements */
.download-capture-trigger:focus-visible,
.download-capture-form input[type="email"]:focus-visible,
.download-capture-submit:focus-visible,
.download-capture-skip:focus-visible,
.consent-field input[type="checkbox"]:focus-visible,
.consent-field label a:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

/* Remove default focus for mouse users */
.download-capture-trigger:focus:not(:focus-visible),
.download-capture-form input[type="email"]:focus:not(:focus-visible),
.download-capture-submit:focus:not(:focus-visible),
.download-capture-skip:focus:not(:focus-visible),
.consent-field input[type="checkbox"]:focus:not(:focus-visible),
.consent-field label a:focus:not(:focus-visible) {
	outline: none;
}

/* Checkbox focus visible state */
.consent-field input[type="checkbox"]:focus-visible {
	border-color: var(--accent);
	box-shadow: 0 0 0 3px rgba(5, 14, 57, 0.15);
}

/* ==========================================
   RESPONSIVE: MOBILE (<640px)
   ========================================== */

@media (max-width: 640px) {
	.download-capture {
		width: 100%;
	}

	.download-capture-panel {
		max-width: 100%;
	}

	.download-capture.is-expanded .download-capture-panel {
		max-height: 360px; /* Extra height for mobile layout */
	}

	.download-capture-form {
		padding: 20px;
	}

	.download-capture-trigger {
		width: 100%;
	}

	.consent-field input[type="checkbox"] {
		width: 24px;
		height: 24px;
	}
}

/* ==========================================
   ACCESSIBILITY: REDUCED MOTION
   ========================================== */

@media (prefers-reduced-motion: reduce) {
	.download-capture-panel {
		transition: none;
	}

	.download-capture-form input[type="email"],
	.consent-field input[type="checkbox"],
	.download-capture-skip {
		transition: none;
	}
}
