/* =========================================================
   Sistema de Gestión Escolar — CEO
   Tokens de tema (claro por defecto, oscuro por media query,
   data-theme del usuario gana en ambas direcciones)
   ========================================================= */

:root {
	--brand: #16265c;
	--accent-uo: #2f6fc4;
	--accent-global: #2e8ac9;

	--bg: #f2f4fa;
	--surface: #ffffff;
	--plate: #ffffff;
	--text: #1b2342;
	--muted: #5c6689;
	--border: #e2e6f1;
	--shadow: 0 1px 2px rgba(22, 38, 92, .05), 0 10px 30px -12px rgba(22, 38, 92, .14);
	--shadow-lift: 0 2px 4px rgba(22, 38, 92, .06), 0 22px 44px -14px rgba(22, 38, 92, .24);
	--halo-a: rgba(47, 111, 196, .16);
	--halo-b: rgba(22, 38, 92, .10);

	--font-display: "Bricolage Grotesque", "Trebuchet MS", system-ui, sans-serif;
	--font-body: "Public Sans", "Segoe UI", system-ui, sans-serif;
	--font-mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #0b1020;
		--surface: #141b33;
		--plate: #f4f6fc;
		--text: #e9edf9;
		--muted: #98a2c4;
		--border: #232d52;
		--accent-uo: #6fa4e8;
		--accent-global: #66b5ec;
		--shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -12px rgba(0, 0, 0, .5);
		--shadow-lift: 0 2px 4px rgba(0, 0, 0, .35), 0 22px 44px -14px rgba(0, 0, 0, .65);
		--halo-a: rgba(60, 110, 200, .22);
		--halo-b: rgba(120, 70, 170, .12);
	}
}

:root[data-theme="light"] {
	--bg: #f2f4fa;
	--surface: #ffffff;
	--plate: #ffffff;
	--text: #1b2342;
	--muted: #5c6689;
	--border: #e2e6f1;
	--accent-uo: #2f6fc4;
	--accent-global: #2e8ac9;
	--shadow: 0 1px 2px rgba(22, 38, 92, .05), 0 10px 30px -12px rgba(22, 38, 92, .14);
	--shadow-lift: 0 2px 4px rgba(22, 38, 92, .06), 0 22px 44px -14px rgba(22, 38, 92, .24);
	--halo-a: rgba(47, 111, 196, .16);
	--halo-b: rgba(22, 38, 92, .10);
}

:root[data-theme="dark"] {
	--bg: #0b1020;
	--surface: #141b33;
	--plate: #f4f6fc;
	--text: #e9edf9;
	--muted: #98a2c4;
	--border: #232d52;
	--accent-uo: #6fa4e8;
	--accent-global: #66b5ec;
	--shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -12px rgba(0, 0, 0, .5);
	--shadow-lift: 0 2px 4px rgba(0, 0, 0, .35), 0 22px 44px -14px rgba(0, 0, 0, .65);
	--halo-a: rgba(60, 110, 200, .22);
	--halo-b: rgba(120, 70, 170, .12);
}

/* ============================ base ============================ */

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

html { scroll-behavior: smooth; }

body {
	margin: 0;
	font-family: var(--font-body);
	font-size: 1rem;
	line-height: 1.6;
	color: var(--text);
	background: var(--bg);
	-webkit-font-smoothing: antialiased;
	transition: background-color .35s ease, color .35s ease;
}

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

a { color: inherit; }

:focus-visible {
	outline: 3px solid var(--accent-uo);
	outline-offset: 3px;
	border-radius: 4px;
}

/* Imágenes por tema */
.only-dark { display: none; }
:root[data-theme="dark"] .only-light { display: none; }
:root[data-theme="dark"] .only-dark { display: block; }
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .only-light { display: none; }
	:root:not([data-theme="light"]) .only-dark { display: block; }
}

/* ======================== fondo ambiental ===================== */

#ambient {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	z-index: 0;
	pointer-events: none;
}

.page {
	position: relative;
	z-index: 1;
	max-width: 74rem;
	margin: 0 auto;
	padding: 0 clamp(1.25rem, 4vw, 3rem);
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
}

/* =========================== topbar =========================== */

.topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: clamp(1.1rem, 3vw, 1.8rem) 0;
}

.topbar__brand img {
	width: clamp(8.5rem, 16vw, 11rem);
	height: auto;
}

.theme-toggle {
	display: grid;
	place-items: center;
	width: 2.6rem;
	height: 2.6rem;
	border-radius: 50%;
	border: 1px solid var(--border);
	background: var(--surface);
	color: var(--muted);
	cursor: pointer;
	box-shadow: var(--shadow);
	transition: color .2s ease, transform .2s ease, background-color .35s ease;
}

.theme-toggle:hover { color: var(--accent-uo); transform: rotate(15deg); }

.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .icon-sun { display: none; }
	:root:not([data-theme="light"]) .icon-moon { display: block; }
}

/* ============================ hero ============================ */

.hero {
	padding: clamp(1.5rem, 5vh, 4rem) 0 clamp(2rem, 5vh, 3.5rem);
	max-width: 46rem;
}

.hero__title {
	margin: 0;
	font-family: var(--font-display);
	font-size: clamp(2.2rem, 5.5vw, 3.6rem);
	font-weight: 750;
	line-height: 1.08;
	letter-spacing: -.02em;
	text-wrap: balance;
}

.hero__title-accent {
	background: linear-gradient(100deg, var(--accent-uo), var(--accent-global));
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

.hero__lede {
	margin: 1.3rem 0 0;
	font-size: clamp(1rem, 2.2vw, 1.15rem);
	font-weight: 300;
	color: var(--muted);
	max-width: 34rem;
}

/* Entrada del hero */
.anim-rise {
	opacity: 0;
	transform: translateY(18px);
	animation: rise .7s cubic-bezier(.2, .7, .2, 1) forwards;
	animation-delay: calc(var(--d) * 120ms + 80ms);
}

@keyframes rise {
	to { opacity: 1; transform: translateY(0); }
}

/* ============================ grid ============================ */

.campuses { padding-bottom: clamp(2rem, 6vh, 4rem); }

.grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(19rem, 100%), 1fr));
	gap: clamp(.9rem, 2vw, 1.4rem);
}

.card {
	--accent: var(--accent-uo);
	opacity: 0;
	transform: translateY(26px);
}

.card.is-global { --accent: var(--accent-global); }

.card.in {
	opacity: 1;
	transform: translateY(0);
	transition: opacity .6s cubic-bezier(.2, .7, .2, 1), transform .6s cubic-bezier(.2, .7, .2, 1);
	transition-delay: var(--stagger, 0ms);
}

.card__link {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	height: 100%;
	padding: 1.1rem;
	border-radius: 18px;
	border: 1px solid var(--border);
	background: var(--surface);
	box-shadow: var(--shadow);
	text-decoration: none;
	transition: transform .28s cubic-bezier(.2, .7, .2, 1), box-shadow .28s ease, border-color .28s ease, background-color .35s ease;
}

.card__link:hover,
.card__link:focus-visible {
	transform: translateY(-5px);
	box-shadow: var(--shadow-lift);
	border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
}

.card__plate {
	display: grid;
	place-items: center;
	border-radius: 12px;
	background: var(--plate);
	border: 1px solid var(--border);
	padding: 1.4rem 1.2rem;
	min-height: 7.2rem;
	transition: background-color .35s ease;
}

:root[data-theme="dark"] .card__plate { border-color: transparent; }
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .card__plate { border-color: transparent; }
}

.card__plate img {
	max-height: 4.4rem;
	width: auto;
	max-width: 100%;
	object-fit: contain;
	transition: transform .28s cubic-bezier(.2, .7, .2, 1);
}

.card__link:hover .card__plate img { transform: scale(1.045); }

.card__body {
	display: flex;
	flex-direction: column;
	gap: .15rem;
	padding: 0 .25rem;
}

.card__name {
	font-family: var(--font-display);
	font-size: 1.28rem;
	font-weight: 650;
	letter-spacing: -.01em;
	line-height: 1.2;
	display: flex;
	align-items: center;
	gap: .5rem;
	flex-wrap: wrap;
}

.card__tag {
	font-family: var(--font-body);
	font-size: .66rem;
	font-weight: 600;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--accent);
	border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
	border-radius: 99px;
	padding: .12rem .55rem;
}

.card__cta {
	margin-top: auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: .1rem .25rem 0;
	font-weight: 600;
	font-size: .95rem;
	color: var(--accent);
}

.card__arrow {
	display: grid;
	place-items: center;
	width: 2.1rem;
	height: 2.1rem;
	border-radius: 50%;
	border: 1.5px solid color-mix(in srgb, var(--accent) 55%, transparent);
	font-size: 1.05rem;
	line-height: 1;
	transition: transform .28s cubic-bezier(.2, .7, .2, 1), background-color .2s ease, color .2s ease, border-color .2s ease;
}

.card__link:hover .card__arrow,
.card__link:focus-visible .card__arrow {
	background: var(--accent);
	border-color: var(--accent);
	color: #fff;
	transform: translateX(4px);
}

/* =========================== footer =========================== */

.footer {
	margin-top: auto;
	padding: 1.4rem 0 2rem;
	border-top: 1px solid var(--border);
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: .75rem;
	flex-wrap: wrap;
}

.footer p {
	margin: 0;
	font-size: .82rem;
	color: var(--muted);
}

.footer__note { letter-spacing: .04em; }

/* ======================= reduced motion ======================= */

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	.anim-rise { animation: none; opacity: 1; transform: none; }
	.card, .card.in { opacity: 1; transform: none; transition: none; }
	.card__link, .card__plate img, .card__arrow, .theme-toggle { transition: none; }
	.card__link:hover { transform: none; }
}
