/* =============================================================
   EURIDITION DESIGN SYSTEM
   Tokens, reset, typography and primitive components.
   Academic, calm, minimal — not a social-media clone.
   ============================================================= */

:root {
	/* ---- Colour ------------------------------------------------ */
	--eu-primary: #2f4bd6;
	--eu-primary-hover: #2740b8;
	--eu-primary-soft: #eef1fd;
	--eu-primary-border: #ccd5f8;

	--eu-bg: #f6f7fb;
	--eu-surface: #ffffff;
	--eu-surface-2: #fbfbfd;
	--eu-text: #1b2333;
	--eu-text-soft: #3d4759;
	--eu-muted: #6b7488;
	--eu-muted-light: #98a0b3;
	--eu-border: #e3e6ee;
	--eu-border-strong: #cdd2e0;

	--eu-success: #17794f;
	--eu-success-soft: #e6f5ee;
	--eu-warning: #a8620a;
	--eu-warning-soft: #fdf2e2;
	--eu-danger: #c0332e;
	--eu-danger-soft: #fdecec;

	/* ---- Typography -------------------------------------------- */
	--eu-font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
	--eu-font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

	--eu-text-xs: 0.75rem;
	--eu-text-sm: 0.8125rem;
	--eu-text-base: 0.9375rem;
	--eu-text-md: 1rem;
	--eu-text-lg: 1.125rem;
	--eu-text-xl: 1.375rem;
	--eu-text-2xl: 1.75rem;
	--eu-text-3xl: 2.25rem;

	--eu-leading-tight: 1.25;
	--eu-leading: 1.6;

	/* ---- Spacing ------------------------------------------------ */
	--eu-space-1: 4px;
	--eu-space-2: 8px;
	--eu-space-3: 12px;
	--eu-space-4: 16px;
	--eu-space-5: 20px;
	--eu-space-6: 24px;
	--eu-space-8: 32px;
	--eu-space-10: 40px;
	--eu-space-12: 48px;
	--eu-space-16: 64px;

	/* ---- Radius ------------------------------------------------- */
	--eu-radius-sm: 6px;
	--eu-radius: 10px;
	--eu-radius-lg: 14px;
	--eu-radius-full: 999px;

	/* ---- Shadow ------------------------------------------------- */
	--eu-shadow-sm: 0 1px 2px rgba(19, 26, 43, .06);
	--eu-shadow: 0 2px 8px rgba(19, 26, 43, .07);
	--eu-shadow-lg: 0 12px 32px rgba(19, 26, 43, .14);

	/* ---- Motion ------------------------------------------------- */
	--eu-transition: 160ms cubic-bezier(.4, 0, .2, 1);

	/* ---- Layout ------------------------------------------------- */
	--eu-sidebar-w: 248px;
	--eu-rail-w: 300px;
	--eu-feed-w: 620px;
	--eu-header-h: 56px;
	--eu-mobilenav-h: 60px;
}

/* ---- Breakpoints are used as: 640 / 900 / 1160 / 1400 --------- */

/* =============================================================
   RESET
   ============================================================= */

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

html { -webkit-text-size-adjust: 100%; }

body {
	background: var(--eu-bg);
	color: var(--eu-text);
	font-family: var(--eu-font);
	font-size: var(--eu-text-base);
	line-height: var(--eu-leading);
	margin: 0;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
	color: var(--eu-text);
	line-height: var(--eu-leading-tight);
	margin: 0 0 var(--eu-space-3);
}

h1 { font-size: var(--eu-text-2xl); font-weight: 650; letter-spacing: -.02em; }
h2 { font-size: var(--eu-text-xl); font-weight: 620; letter-spacing: -.01em; }
h3 { font-size: var(--eu-text-lg); font-weight: 600; }
h4 { font-size: var(--eu-text-md); font-weight: 600; }

p { margin: 0 0 var(--eu-space-3); }
p:last-child { margin-bottom: 0; }

a {
	color: var(--eu-primary);
	text-decoration: none;
	transition: color var(--eu-transition);
}
a:hover { color: var(--eu-primary-hover); text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

ul, ol { margin: 0 0 var(--eu-space-3); padding-left: var(--eu-space-5); }

hr { border: 0; border-top: 1px solid var(--eu-border); margin: var(--eu-space-6) 0; }

/* Visible focus everywhere — never removed. */
:focus-visible {
	outline: 2px solid var(--eu-primary);
	outline-offset: 2px;
	border-radius: 3px;
}

.eu-sr-only {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0);
	white-space: nowrap; border: 0;
}

.eu-skip-link {
	background: var(--eu-surface);
	border-radius: var(--eu-radius-sm);
	box-shadow: var(--eu-shadow);
	left: var(--eu-space-3);
	padding: var(--eu-space-2) var(--eu-space-4);
	position: fixed;
	top: -80px;
	transition: top var(--eu-transition);
	z-index: 999;
}
.eu-skip-link:focus { top: var(--eu-space-3); }

.eu-no-scroll { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		animation-duration: .01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .01ms !important;
		scroll-behavior: auto !important;
	}
}

/* =============================================================
   PRIMITIVES
   ============================================================= */

/* ---- Buttons -------------------------------------------------- */
.eu-btn {
	align-items: center;
	background: var(--eu-surface);
	border: 1px solid var(--eu-border-strong);
	border-radius: var(--eu-radius-sm);
	color: var(--eu-text);
	cursor: pointer;
	display: inline-flex;
	font: inherit;
	font-size: var(--eu-text-sm);
	font-weight: 550;
	gap: var(--eu-space-2);
	justify-content: center;
	line-height: 1;
	min-height: 38px;
	padding: 0 var(--eu-space-4);
	text-decoration: none;
	transition: background var(--eu-transition), border-color var(--eu-transition), color var(--eu-transition);
	white-space: nowrap;
}
.eu-btn:hover { background: var(--eu-surface-2); border-color: var(--eu-muted-light); text-decoration: none; }
.eu-btn:disabled, .eu-btn[aria-disabled="true"] { cursor: not-allowed; opacity: .55; }

.eu-btn--primary {
	background: var(--eu-primary);
	border-color: var(--eu-primary);
	color: #fff;
}
.eu-btn--primary:hover { background: var(--eu-primary-hover); border-color: var(--eu-primary-hover); color: #fff; }

.eu-btn--ghost { background: transparent; border-color: transparent; color: var(--eu-text-soft); }
.eu-btn--ghost:hover { background: var(--eu-primary-soft); color: var(--eu-primary); }

.eu-btn--danger { background: var(--eu-danger); border-color: var(--eu-danger); color: #fff; }
.eu-btn--danger:hover { background: #a62b26; border-color: #a62b26; color: #fff; }

.eu-btn--sm { font-size: var(--eu-text-xs); min-height: 32px; padding: 0 var(--eu-space-3); }
.eu-btn--lg { font-size: var(--eu-text-md); min-height: 46px; padding: 0 var(--eu-space-6); }
.eu-btn--block { display: flex; width: 100%; }

/* ---- Forms ---------------------------------------------------- */
.eu-field { margin-bottom: var(--eu-space-4); }

.eu-label {
	color: var(--eu-text-soft);
	display: block;
	font-size: var(--eu-text-sm);
	font-weight: 550;
	margin-bottom: var(--eu-space-2);
}

.eu-input,
.eu-select,
.eu-textarea {
	background: var(--eu-surface);
	border: 1px solid var(--eu-border-strong);
	border-radius: var(--eu-radius-sm);
	color: var(--eu-text);
	font: inherit;
	font-size: var(--eu-text-base);
	padding: 10px var(--eu-space-3);
	transition: border-color var(--eu-transition), box-shadow var(--eu-transition);
	width: 100%;
}
.eu-input:focus,
.eu-select:focus,
.eu-textarea:focus {
	border-color: var(--eu-primary);
	box-shadow: 0 0 0 3px var(--eu-primary-soft);
	outline: none;
}
.eu-textarea { line-height: var(--eu-leading); min-height: 96px; resize: vertical; }

.eu-hint { color: var(--eu-muted); font-size: var(--eu-text-xs); margin-top: var(--eu-space-1); }

.eu-check {
	align-items: flex-start;
	color: var(--eu-text-soft);
	cursor: pointer;
	display: flex;
	font-size: var(--eu-text-sm);
	gap: var(--eu-space-2);
	margin-bottom: var(--eu-space-2);
}
.eu-check input { margin-top: 3px; }

.eu-error {
	background: var(--eu-danger-soft);
	border: 1px solid #f3c9c7;
	border-radius: var(--eu-radius-sm);
	color: #8f2723;
	font-size: var(--eu-text-sm);
	margin-bottom: var(--eu-space-4);
	padding: var(--eu-space-3) var(--eu-space-4);
}

.eu-notice {
	background: var(--eu-primary-soft);
	border: 1px solid var(--eu-primary-border);
	border-radius: var(--eu-radius-sm);
	color: #23336f;
	font-size: var(--eu-text-sm);
	margin-bottom: var(--eu-space-4);
	padding: var(--eu-space-3) var(--eu-space-4);
}

.eu-notice--success { background: var(--eu-success-soft); border-color: #bfe3d2; color: #0f5c3b; }
.eu-notice--warning { background: var(--eu-warning-soft); border-color: #f0d6ab; color: #7d4906; }

/* ---- Card ----------------------------------------------------- */
.eu-card {
	background: var(--eu-surface);
	border: 1px solid var(--eu-border);
	border-radius: var(--eu-radius);
	box-shadow: var(--eu-shadow-sm);
}
.eu-card__body { padding: var(--eu-space-5); }
.eu-card__header {
	border-bottom: 1px solid var(--eu-border);
	padding: var(--eu-space-4) var(--eu-space-5);
}
.eu-card__title { font-size: var(--eu-text-md); font-weight: 600; margin: 0; }

/* ---- Avatar --------------------------------------------------- */
.eu-avatar {
	background: var(--eu-primary-soft);
	border-radius: var(--eu-radius-full);
	flex: none;
	height: 40px;
	object-fit: cover;
	width: 40px;
}
.eu-avatar--sm { height: 32px; width: 32px; }
.eu-avatar--lg { height: 64px; width: 64px; }
.eu-avatar--xl { height: 96px; width: 96px; }

/* ---- Badge ---------------------------------------------------- */
.eu-badge {
	align-items: center;
	border-radius: var(--eu-radius-full);
	display: inline-flex;
	font-size: var(--eu-text-xs);
	font-weight: 550;
	gap: 4px;
	line-height: 1;
	padding: 4px var(--eu-space-2);
}
.eu-badge--verified { background: var(--eu-primary-soft); color: #23336f; }
.eu-badge--educator { background: var(--eu-success-soft); color: var(--eu-success); }
.eu-badge--muted { background: var(--eu-bg); color: var(--eu-muted); }
.eu-badge--warning { background: var(--eu-warning-soft); color: var(--eu-warning); }
.eu-badge--danger { background: var(--eu-danger-soft); color: var(--eu-danger); }

.eu-verified-mark { color: var(--eu-primary); display: inline-flex; vertical-align: middle; }

/* ---- Tabs ----------------------------------------------------- */
.eu-tabs {
	border-bottom: 1px solid var(--eu-border);
	display: flex;
	gap: var(--eu-space-1);
	overflow-x: auto;
	scrollbar-width: none;
}
.eu-tabs::-webkit-scrollbar { display: none; }

.eu-tab {
	background: none;
	border: 0;
	border-bottom: 2px solid transparent;
	color: var(--eu-muted);
	cursor: pointer;
	font: inherit;
	font-size: var(--eu-text-sm);
	font-weight: 550;
	padding: var(--eu-space-3) var(--eu-space-4);
	transition: color var(--eu-transition), border-color var(--eu-transition);
	white-space: nowrap;
}
.eu-tab:hover { color: var(--eu-text); text-decoration: none; }
.eu-tab[aria-selected="true"] { border-bottom-color: var(--eu-primary); color: var(--eu-primary); }

/* ---- Dropdown ------------------------------------------------- */
.eu-dropdown { position: relative; }

.eu-dropdown__menu {
	background: var(--eu-surface);
	border: 1px solid var(--eu-border);
	border-radius: var(--eu-radius);
	box-shadow: var(--eu-shadow-lg);
	display: none;
	min-width: 190px;
	padding: var(--eu-space-1);
	position: absolute;
	right: 0;
	top: calc(100% + 6px);
	z-index: 40;
}
.eu-dropdown__menu.is-open { display: block; }

.eu-dropdown__item {
	background: none;
	border: 0;
	border-radius: var(--eu-radius-sm);
	color: var(--eu-text-soft);
	cursor: pointer;
	display: block;
	font: inherit;
	font-size: var(--eu-text-sm);
	padding: var(--eu-space-2) var(--eu-space-3);
	text-align: left;
	transition: background var(--eu-transition);
	width: 100%;
}
.eu-dropdown__item:hover { background: var(--eu-bg); color: var(--eu-text); text-decoration: none; }
.eu-dropdown__item--danger { color: var(--eu-danger); }
.eu-dropdown__item--danger:hover { background: var(--eu-danger-soft); color: var(--eu-danger); }

/* ---- Modal ---------------------------------------------------- */
.eu-modal-overlay {
	align-items: center;
	background: rgba(17, 22, 36, .48);
	display: flex;
	inset: 0;
	justify-content: center;
	padding: var(--eu-space-4);
	position: fixed;
	z-index: 200;
}

.eu-modal {
	background: var(--eu-surface);
	border-radius: var(--eu-radius-lg);
	box-shadow: var(--eu-shadow-lg);
	max-height: 88vh;
	max-width: 520px;
	overflow: auto;
	width: 100%;
}
.eu-modal__header {
	align-items: center;
	border-bottom: 1px solid var(--eu-border);
	display: flex;
	justify-content: space-between;
	padding: var(--eu-space-4) var(--eu-space-5);
}
.eu-modal__title { font-size: var(--eu-text-md); font-weight: 600; margin: 0; }
.eu-modal__close {
	background: none;
	border: 0;
	border-radius: var(--eu-radius-sm);
	color: var(--eu-muted);
	cursor: pointer;
	font-size: 22px;
	height: 32px;
	line-height: 1;
	width: 32px;
}
.eu-modal__close:hover { background: var(--eu-bg); color: var(--eu-text); }
.eu-modal__body { padding: var(--eu-space-5); }
.eu-modal__footer {
	border-top: 1px solid var(--eu-border);
	display: flex;
	gap: var(--eu-space-2);
	justify-content: flex-end;
	padding: var(--eu-space-4) var(--eu-space-5);
}

/* ---- Toast ---------------------------------------------------- */
.eu-toasts {
	bottom: calc(var(--eu-mobilenav-h) + var(--eu-space-4));
	display: flex;
	flex-direction: column;
	gap: var(--eu-space-2);
	left: 50%;
	position: fixed;
	transform: translateX(-50%);
	z-index: 300;
}
@media (min-width: 900px) {
	.eu-toasts { bottom: var(--eu-space-6); left: auto; right: var(--eu-space-6); transform: none; }
}

.eu-toast {
	background: #1b2333;
	border-radius: var(--eu-radius-sm);
	box-shadow: var(--eu-shadow-lg);
	color: #fff;
	font-size: var(--eu-text-sm);
	max-width: 340px;
	opacity: 0;
	padding: var(--eu-space-3) var(--eu-space-4);
	transform: translateY(8px);
	transition: opacity var(--eu-transition), transform var(--eu-transition);
}
.eu-toast.is-visible { opacity: 1; transform: translateY(0); }
.eu-toast--error { background: var(--eu-danger); }
.eu-toast--success { background: var(--eu-success); }

/* ---- Empty state ---------------------------------------------- */
.eu-empty {
	color: var(--eu-muted);
	padding: var(--eu-space-10) var(--eu-space-5);
	text-align: center;
}
.eu-empty__title { color: var(--eu-text); font-size: var(--eu-text-md); font-weight: 600; margin-bottom: var(--eu-space-1); }
.eu-empty__text { font-size: var(--eu-text-sm); margin: 0 auto; max-width: 340px; }
.eu-empty__action { margin-top: var(--eu-space-4); }

/* ---- Loader / skeleton ---------------------------------------- */
.eu-skeleton {
	animation: eu-pulse 1.4s ease-in-out infinite;
	background: linear-gradient(90deg, #eceef4 25%, #f5f6fa 37%, #eceef4 63%);
	background-size: 400% 100%;
	border-radius: var(--eu-radius-sm);
}
@keyframes eu-pulse {
	0% { background-position: 100% 50%; }
	100% { background-position: 0 50%; }
}

.eu-skeleton-card {
	background: var(--eu-surface);
	border: 1px solid var(--eu-border);
	border-radius: var(--eu-radius);
	margin-bottom: var(--eu-space-4);
	padding: var(--eu-space-5);
}
.eu-skeleton-row { align-items: center; display: flex; gap: var(--eu-space-3); margin-bottom: var(--eu-space-4); }
.eu-skeleton-avatar { border-radius: var(--eu-radius-full); height: 40px; width: 40px; }
.eu-skeleton-line { height: 10px; }
.eu-skeleton-line + .eu-skeleton-line { margin-top: var(--eu-space-2); }

.eu-spinner {
	animation: eu-spin .7s linear infinite;
	border: 2px solid var(--eu-border-strong);
	border-radius: 50%;
	border-top-color: var(--eu-primary);
	display: inline-block;
	height: 18px;
	width: 18px;
}
@keyframes eu-spin { to { transform: rotate(360deg); } }

/* ---- Utility -------------------------------------------------- */
.eu-stack > * + * { margin-top: var(--eu-space-4); }
.eu-row { align-items: center; display: flex; gap: var(--eu-space-3); }
.eu-row--between { justify-content: space-between; }
.eu-row--wrap { flex-wrap: wrap; }
.eu-grow { flex: 1 1 auto; min-width: 0; }
.eu-muted { color: var(--eu-muted); }
.eu-small { font-size: var(--eu-text-sm); }
.eu-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eu-center { text-align: center; }
.eu-hide { display: none !important; }
