/* Free Resources Members Only - Frontend Styles */

:root {
	--frm-bg: #f8fbff;
	--frm-surface: #ffffff;
	--frm-surface-alt: #fbfcfe;
	--frm-text: #0f172a;
	--frm-muted: #475569;
	--frm-border: #dbe3ef;
	--frm-border-strong: #c8d8ea;
	--frm-brand: #0f62fe;
	--frm-brand-dark: #0b57d0;
	--frm-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
	--frm-shadow-hover: 0 18px 42px rgba(15, 23, 42, 0.12);
	--frm-radius-lg: 18px;
	--frm-radius-md: 14px;
	--frm-radius-sm: 10px;
}

/* Archive Shell */
main.frm-archive,
body .frm-archive {
	background:
		radial-gradient(circle at top left, rgba(15, 98, 254, 0.08), transparent 32%),
		linear-gradient(180deg, var(--frm-bg) 0%, #ffffff 42%) !important;
	color: var(--frm-text) !important;
}

.frm-archive *,
.frm-modal *,
.frm-resource-card *,
.frm-form *,
.frm-alert * {
	box-sizing: border-box;
}

.frm-archive__hero {
	padding: 56px 0 28px;
}

.frm-archive__content {
	padding: 0 0 72px;
}

.frm-archive__inner {
	width: min(1180px, calc(100% - 48px));
	margin: 0 auto;
}

.frm-archive__eyebrow {
	margin: 0 0 10px;
	color: var(--frm-brand);
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.frm-archive__title {
	margin: 0;
	color: var(--frm-text);
	font-size: clamp(32px, 4vw, 54px);
	line-height: 1.04;
	letter-spacing: -0.04em;
}

.frm-archive__description {
	margin-top: 14px;
	max-width: 68ch;
	color: var(--frm-muted);
	font-size: 16px;
	line-height: 1.7;
}

.frm-archive__empty {
	padding: 48px 0;
	color: var(--frm-muted);
}

.frm-archive__pagination {
	margin-top: 36px;
}

.frm-archive__pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 40px;
	margin: 0 4px;
	padding: 0 12px;
	border-radius: 999px;
	background: var(--frm-surface);
	border: 1px solid var(--frm-border);
	color: var(--frm-text);
	text-decoration: none;
	box-shadow: 0 6px 16px rgba(15, 23, 42, 0.04);
}

.frm-archive__pagination .page-numbers.current {
	background: var(--frm-brand);
	border-color: var(--frm-brand);
	color: #fff;
}

/* Resource Grid */
main .frm-resource-grid,
body .frm-resource-grid {
	display: grid !important;
	grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
	gap: 28px !important;
}

.frm-resource-card {
	margin: 0;
}

.frm-resource-card__link {
	display: flex;
	flex-direction: column;
	height: 100%;
	position: relative;
	background: linear-gradient(180deg, var(--frm-surface) 0%, var(--frm-surface-alt) 100%);
	border: 1px solid #e6eaf0;
	border-radius: var(--frm-radius-lg);
	overflow: hidden;
	color: inherit !important;
	text-decoration: none !important;
	box-shadow: var(--frm-shadow);
	transition:
		transform 0.24s ease,
		box-shadow 0.24s ease,
		border-color 0.24s ease,
		background-color 0.24s ease;
}

.frm-resource-card__link:hover,
.frm-resource-card__link:focus {
	transform: translateY(-4px);
	border-color: var(--frm-border-strong);
	box-shadow: var(--frm-shadow-hover);
	text-decoration: none !important;
	outline: none;
}

.frm-resource-card__link:hover .frm-resource-card__thumb img,
.frm-resource-card__link:focus .frm-resource-card__thumb img {
	transform: scale(1.03);
}

.frm-resource-card__link:hover .frm-resource-card__action,
.frm-resource-card__link:focus .frm-resource-card__action {
	background: var(--frm-brand-dark);
	transform: translateY(-1px);
}

.frm-resource-card__link--disabled,
.frm-resource-card__link--disabled:hover,
.frm-resource-card__link--disabled:focus {
	transform: none;
	box-shadow: var(--frm-shadow);
	border-color: #e6eaf0;
	cursor: default;
}

.frm-resource-card__thumb {
	overflow: hidden;
	aspect-ratio: 16 / 9;
	background: #eef2f7;
	flex: 0 0 auto;
}

.frm-resource-card__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.28s ease;
}

.frm-resource-card__body {
	display: flex;
	flex-direction: column;
	gap: 12px;
	flex: 1;
	padding: 22px 20px 20px;
	color: var(--frm-text);
}

.frm-resource-card__title {
	margin: 0;
	color: var(--frm-text);
	font-size: 19px;
	line-height: 1.3;
	letter-spacing: -0.02em;
}

.frm-resource-card__excerpt {
	flex: 1;
	color: var(--frm-muted);
	font-size: 14px;
	line-height: 1.6;
}

.frm-resource-card__action {
	display: inline-flex;
	align-self: flex-start;
	padding: 10px 16px;
	border-radius: 999px;
	background: var(--frm-brand);
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.01em;
	text-transform: uppercase;
	box-shadow: 0 10px 18px rgba(15, 98, 254, 0.18);
	transition: transform 0.24s ease, background-color 0.24s ease, box-shadow 0.24s ease;
}

.frm-resource-card__action--disabled {
	background: #d1d5db;
	color: #4b5563;
	box-shadow: none;
}

.frm-archive .frm-resource-card__link,
.frm-archive .frm-resource-card__link:visited,
.frm-archive .frm-resource-card__link:hover,
.frm-archive .frm-resource-card__link:focus {
	color: inherit !important;
}

.frm-archive .frm-resource-card__link .frm-resource-card__title,
.frm-archive .frm-resource-card__link .frm-resource-card__excerpt {
	color: inherit;
}

.frm-archive .frm-resource-card__link .frm-resource-card__action {
	color: #fff;
}

.frm-archive .frm-resource-card__link .frm-resource-card__thumb {
	border-bottom: 1px solid rgba(15, 23, 42, 0.04);
}

/* Modal Styles */
body .frm-modal {
	position: fixed;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 99999;
}

.frm-modal-overlay {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.55);
	cursor: pointer;
	backdrop-filter: blur(4px);
}

.frm-modal-content {
	position: relative;
	width: min(560px, calc(100% - 24px));
	max-height: calc(100vh - 24px);
	overflow: hidden;
	background: var(--frm-surface);
	border-radius: var(--frm-radius-md);
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
	animation: frmSlideUp 0.3s ease-out;
	display: flex;
	flex-direction: column;
}

@keyframes frmSlideUp {
	from {
		opacity: 0;
		transform: translateY(20px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.frm-modal-header {
	padding: 24px;
	border-bottom: 1px solid #e5e7eb;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}

.frm-modal-header h2 {
	margin: 0;
	min-width: 0;
	color: var(--frm-text);
	font-size: 20px;
	font-weight: 600;
	line-height: 1.2;
}

.frm-close-modal {
	flex: 0 0 36px;
	width: 36px;
	height: 36px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: #64748b;
	font-size: 22px;
	font-weight: 400;
	line-height: 1;
	cursor: pointer;
	flex-shrink: 0;
	overflow: visible;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.frm-close-modal:hover {
	background: #f1f5f9;
	color: #0f172a;
}

.frm-modal-body {
	padding: 24px;
	display: flex;
	flex-direction: column;
	gap: 16px;
	overflow-y: auto;
	min-height: 0;
}

.frm-tab-pane {
	display: none;
	width: 100%;
}

.frm-tab-pane.frm-active {
	display: block;
	animation: frmFadeIn 0.3s ease;
}

@keyframes frmFadeIn {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

/* Form Styles */
.frm-form {
	display: flex;
	flex-direction: column;
	gap: 16px;
	width: 100%;
}

.frm-form-group {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.frm-form-group label {
	color: #334155;
	font-size: 14px;
	font-weight: 500;
}

.frm-form-control {
	padding: 10px 12px;
	border: 1px solid #d8dde6;
	border-radius: 8px;
	background: #fff;
	color: var(--frm-text);
	font-size: 14px;
	font-family: inherit;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.frm-form-control:focus {
	outline: none;
	border-color: var(--frm-brand);
	box-shadow: 0 0 0 3px rgba(15, 98, 254, 0.12);
}

.frm-form-control::placeholder {
	color: #94a3b8;
}

.frm-help-text {
	margin-top: 4px;
	color: #64748b;
	font-size: 12px;
}

/* Buttons */
.frm-btn {
	padding: 12px 16px;
	border: 0;
	border-radius: 8px;
	font-family: inherit;
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.frm-btn:disabled {
	opacity: 0.65;
	cursor: not-allowed;
}

.frm-btn-primary {
	background: var(--frm-brand);
	color: #fff;
}

.frm-btn-primary:hover:not(:disabled) {
	background: var(--frm-brand-dark);
	box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

.frm-btn-secondary {
	background: #f1f5f9;
	color: #334155;
	border: 1px solid #e2e8f0;
}

.frm-btn-secondary:hover:not(:disabled) {
	background: #e8eef6;
	border-color: #cbd5e1;
}

.frm-btn-block {
	width: 100%;
}

.frm-download-btn,
.frm-download-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 12px 24px;
	border-radius: 8px;
	background: var(--frm-brand);
	color: #fff;
	font-size: 14px;
	font-weight: 500;
	text-decoration: none;
	box-shadow: 0 4px 12px rgba(0, 102, 204, 0.16);
	transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.frm-download-btn:hover,
.frm-download-link:hover {
	background: var(--frm-brand-dark);
	box-shadow: 0 8px 18px rgba(0, 102, 204, 0.24);
	text-decoration: none;
}

.frm-download-link--disabled,
.frm-download-btn.frm-download-link--disabled {
	background: #d1d5db;
	color: #4b5563;
	box-shadow: none;
	cursor: default;
}

.frm-download-link--disabled:hover,
.frm-download-btn.frm-download-link--disabled:hover {
	background: #d1d5db;
	box-shadow: none;
}

.frm-download-cta {
	margin-top: 24px;
}

/* Divider */
.frm-form-divider {
	position: relative;
	display: block;
	z-index: 2;
	margin: 8px 0;
	padding: 0 8px;
	background: var(--frm-surface);
	color: #94a3b8;
	font-size: 12px;
	text-align: center;
}

.frm-form-divider::before {
	content: '';
	position: absolute;
	left: 0;
	top: 50%;
	width: 100%;
	height: 1px;
	background: #e2e8f0;
	z-index: 1;
}

/* Alerts */
.frm-alert {
	padding: 12px 16px;
	margin: 0;
	border-radius: 8px;
	font-size: 14px;
	width: 100%;
}

.frm-alert-error {
	background: #fef2f2;
	color: #b91c1c;
	border: 1px solid #fecaca;
}

.frm-alert-success {
	background: #f0fdf4;
	color: #166534;
	border: 1px solid #bbf7d0;
}

.frm-alert-limit {
	background: #fff7e6;
	color: #8a5b00;
	border: 1px solid #f5d48b;
}

/* Loading state */
.frm-btn.frm-loading {
	position: relative;
	color: transparent;
}

.frm-btn.frm-loading::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 16px;
	height: 16px;
	margin-top: -8px;
	margin-left: -8px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top-color: #fff;
	border-radius: 50%;
	animation: frmSpin 0.6s linear infinite;
}

@keyframes frmSpin {
	to {
		transform: rotate(360deg);
	}
}

/* Validation */
.frm-form-control.error {
	border-color: #dc2626;
	background: #fef2f2;
}

.frm-form-group .frm-error {
	margin-top: 4px;
	color: #dc2626;
	font-size: 12px;
}

/* Accessibility */
.frm-btn:focus {
	outline: 2px solid var(--frm-brand);
	outline-offset: 2px;
}

.frm-form-control:focus {
	outline: none;
}

/* Responsive */
@media (max-width: 1024px) {
	.frm-resource-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
		gap: 22px !important;
	}
}

@media (max-width: 768px) {
	.frm-archive__hero {
		padding: 44px 0 20px;
	}

	.frm-archive__content {
		padding-bottom: 56px;
	}

	.frm-archive__inner {
		width: min(100%, calc(100% - 32px));
	}

	.frm-archive__description {
		font-size: 15px;
	}

	.frm-resource-card__body {
		padding: 18px 16px 16px;
	}

	.frm-resource-card__title {
		font-size: 17px;
	}

	.frm-resource-card__excerpt {
		font-size: 13px;
		line-height: 1.55;
	}

	.frm-modal-content {
		width: calc(100% - 16px);
		max-height: 94vh;
		border-radius: 14px;
	}

	.frm-modal-header {
		padding: 20px;
	}

	.frm-modal-body {
		padding: 20px;
	}
}

@media (max-width: 640px) {
	.frm-resource-grid {
		grid-template-columns: 1fr !important;
		gap: 18px !important;
	}

	.frm-archive__hero {
		padding-top: 36px;
	}

	.frm-archive__title {
		font-size: clamp(28px, 8vw, 40px);
	}

	.frm-resource-card__action {
		padding: 9px 14px;
		font-size: 12px;
		letter-spacing: 0.04em;
	}
}

@media (prefers-reduced-motion: reduce) {
	.frm-modal-content,
	.frm-tab-pane.frm-active,
	.frm-btn:hover,
	.frm-download-btn:hover,
	.frm-download-link:hover,
	.frm-resource-card__link,
	.frm-resource-card__thumb img,
	.frm-resource-card__action,
	.frm-btn.frm-loading::after {
		animation: none;
		transition: none;
	}
}
