:root {
	--color-bg: #0a0e27;
	--color-surface: #0f1433;
	--color-surface-soft: #151b45;
	--color-primary: #00d4aa;
	--color-primary-soft: #1a3f45;
	--color-rosa: #ff6b9d;
	--color-naranja: #ff9f43;
	--color-border: #1a1f45;
	--color-text: #e0e0e0;
	--color-muted: #7a7f9a;
	--shadow-soft: 0 0.25rem 1rem rgba(0, 212, 170, 0.08);
}

* {
	box-sizing: border-box;
}

html {
	font-size: 16px;
}

body {
	margin: 0;
	font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
	line-height: 1.6;
	color: var(--color-text);
	background-color: var(--color-bg);
	background-image:
		linear-gradient(rgba(0, 212, 170, 0.1) 1px, transparent 1px),
		linear-gradient(90deg, rgba(0, 212, 170, 0.1) 1px, transparent 1px);
	background-size: 40px 40px;
}

header {
	padding: 2rem 1rem;
	background: linear-gradient(135deg, #0f1433, #0a0e27);
	border-bottom: 1px solid var(--color-border);
}

h1,
h2,
h3,
h4 {
	line-height: 1.25;
	color: var(--color-primary);
}

h1 {
	max-width: 72rem;
	margin: 0 auto;
	font-size: clamp(1.7rem, 4vw, 2.6rem);
	color: var(--color-rosa);
}

h2 {
	margin-top: 0;
	font-size: clamp(1.45rem, 3vw, 2rem);
	border-bottom: 2px solid var(--color-primary-soft);
	padding-bottom: 0.4rem;
	color: var(--color-naranja);
}

h3 {
	font-size: clamp(1.25rem, 2.5vw, 1.6rem);
	margin-top: 0;
}

h4 {
	font-size: 1.05rem;
	margin-bottom: 0.35rem;
}

a {
	color: var(--color-primary);
	text-decoration: none;
	transition: color 0.2s ease, text-shadow 0.2s ease;
}

a:hover {
	color: #4ecdc4;
	text-shadow: 0 0 8px rgba(78, 205, 196, 0.4);
}

main {
	width: min(100% - 2rem, 72rem);
	margin: 0 auto;
	padding: 2rem 0 3rem;
}

section article,
.resumen,
.objetivo {
	margin-bottom: 1.5rem;
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: 1rem;
	padding: clamp(1rem, 2.5vw, 1.5rem);
	box-shadow: var(--shadow-soft);
}

article {
	border-left: 0.45rem solid var(--color-primary-soft);
}

.resumen {
	background: var(--color-surface-soft);
}

p {
	margin: 0 0 1rem;
}

p:last-child,
ul:last-child {
	margin-bottom: 0;
}

ul {
	margin-top: 0.35rem;
	padding-left: 1.25rem;
}

li {
	margin-bottom: 0.35rem;
}

strong {
	color: var(--color-primary);
}

.flujo {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	margin: 1rem 0;
	padding: 0.9rem 1rem;
	background: var(--color-surface-soft);
	border: 1px solid var(--color-border);
	border-radius: 0.8rem;
	font-weight: 700;
	color: var(--color-primary);
}

.flujo span {
	color: var(--color-muted);
}

.nota {
	margin: 1rem 0;
	padding: 1rem;
	background: var(--color-surface-soft);
	border-left: 0.3rem solid var(--color-primary);
	border-radius: 0.7rem;
}

div.tabla {
	overflow-x: auto;
	margin-top: 1rem;
	border: 1px solid var(--color-border);
	border-radius: 0.8rem;
	background: var(--color-surface);
}

table {
	width: 100%;
	border-collapse: collapse;
	min-width: 42rem;
}

th,
td {
	padding: 0.8rem;
	text-align: left;
	vertical-align: top;
	border-bottom: 1px solid var(--color-border);
}

th {
	background: var(--color-surface-soft);
	color: var(--color-primary);
}

tr:last-child td {
	border-bottom: 0;
}

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

/* --- Tema claro --- */
html[data-theme=light] {
	--color-bg: #f4f8fc;
	--color-surface: #ffffff;
	--color-surface-soft: #eaf3fb;
	--color-primary: #2d5f8b;
	--color-primary-soft: #d9e9f7;
	--color-border: #c9ddec;
	--color-text: #22313f;
	--color-muted: #5a6d7d;
	--shadow-soft: 0 0.25rem 1rem rgba(45, 95, 139, 0.08);
	--color-rosa: #2d5f8b;
	--color-naranja: #2d5f8b;
}

html[data-theme=light] body {
	font-family: Arial, Helvetica, sans-serif;
	background-image: none;
}

html[data-theme=light] header {
	background: linear-gradient(135deg, #d9e9f7, #f4f8fc);
}

html[data-theme=light] a:hover {
	text-shadow: none;
}

html[data-theme=light] strong {
	color: #1f4f78;
}

html[data-theme=light] .flujo {
	color: #244d71;
}

html[data-theme=light] .nota {
	background: #eef6fc;
}

html[data-theme=light] th {
	color: #1f4f78;
}

/* --- Botón de cambio de tema --- */
.tema-toggle {
	position: fixed;
	top: 1rem;
	right: 1rem;
	z-index: 100;
	width: 2.2rem;
	height: 2.2rem;
	border: 1px solid var(--color-border);
	border-radius: 50%;
	background: var(--color-surface);
	color: var(--color-primary);
	font-size: 1.1rem;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
	padding: 0;
	line-height: 1;
}

.tema-toggle:hover {
	transform: scale(1.1);
	background: var(--color-primary);
	color: var(--color-bg);
}

@media (max-width: 42rem) {
	main {
		width: min(100% - 1rem, 72rem);
		padding-top: 1rem;
	}

	header {
		padding: 1.5rem 0.75rem;
	}

	.objetivo,
	section,
	article,
	.resumen {
		border-radius: 0.75rem;
	}
}
