/* =========================================================
   RESET GLOBAL Y CONFIGURACIÓN BASE
   ========================================================= */

/* Reset general y normalización */
* {
	margin: 0;                 /* Elimina márgenes por defecto */
	padding: 0;                /* Elimina padding por defecto */
	text-decoration: none;     /* Quita subrayados por defecto */
	box-sizing: border-box;    /* Incluye padding y borde en width/height */
	color: #000;               /* Color de texto por defecto */
}

/* Fondo general del documento */
html {
	background-image: url(../media/icon/halftone.gif);
	background-repeat: repeat;
	background-attachment: fixed;
}

/* Estilos base del cuerpo */
body {
	background: #fff;
	font-family: serif;
	font-size: 16px;
	min-height: calc(100vh - 15px);
}


/* =========================================================
   ESTILO BASE DE HIPERVÍNCULOS
   ========================================================= */

a,
a:link,
a:visited {
	color: inherit;
	text-decoration-line: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}


/* =========================================================
   NAVEGACIÓN: SIN SUBRAYADO POR DEFECTO
   ========================================================= */

nav a,
nav a:link,
nav a:visited {
	text-decoration: none;
}


/* =========================================================
   ESPACIADO VERTICAL GLOBAL
   ========================================================= */

body > *,
body main > *,
main figure > div > *,
main p,
main q,
main cite,
main pre {
	margin-bottom: 30px;
}

body .right {
	float: right;
}

body a.self,
body a.parent {
	font-style: italic;
}


/* =========================================================
   ENLACES Y EFECTOS HOVER
   ========================================================= */

main a:hover,
main a:hover > *,
nav a:hover,
nav a:hover > * {
	background-color: #000;
	color: #fff;
	text-decoration: none;
}


/* =========================================================
   TABLAS
   ========================================================= */

table td,
table th {
	vertical-align: top;
	padding: 2.5px 5px;
	text-align: left;
}

table td > pre,
table th > pre {
	background: none;
	padding: 0;
	margin: 0;
}

table tr img {
	margin-bottom: 0;
	display: block;
}


/* =========================================================
   ELEMENTOS GENERALES
   ========================================================= */

hr {
	clear: both;
	border: 0;
	margin: 0;
}

pre {
	tab-size: 2;
}


/* =========================================================
   HEADER
   ========================================================= */

header {
	float: left;
	margin: 50px 30px;
	margin-right: 60px;
}

header img {
	display: block;
}


/* =========================================================
   NAVEGACIÓN (UNIFICADA)
   ========================================================= */

nav {
	display: inline-block;   /* Permite varios nav en línea */
	vertical-align: top;
	padding: 45px 30px;
	margin: 0;
}

nav ul {
	padding: 0;
	margin: 0 0px 0 0;
	display: inline-block;
	vertical-align: top;
}

nav ul li {
	list-style-type: none;
	white-space: pre;
}

nav ul li a {
	padding: 0 4px;
}

/* Enlace activo / jerárquico (SE MANTIENE SUBRAYADO) */
nav ul li a.parent,
nav ul li a.self {
	text-decoration: underline;
}


/* =========================================================
   MAIN (CONTENIDO PRINCIPAL)
   ========================================================= */

main {
	margin-left: 30px;
	max-width: 624px;
	clear: both;
	position: relative;
}

main a {
	text-decoration: underline;
}

main a[target="_blank"] {
	text-decoration-style: dotted;
}

main article {
	border-left: 1px dotted #000;
	padding-left: 25px;
	clear: both;
}

main cite {
	display: block;
	clear: both;
}

main cite:before {
	content: "— ";
}

main iframe {
	width: 100%;
}

main h1,
main h2,
main h3,
main h4,
main h5 {
	max-width: 400px;
}


/* =========================================================
   LISTAS
   ========================================================= */

main ul,
main ol {
	margin: 0 0 30px 30px;
}

main ul ul {
	margin-bottom: 0;
}

main ul li,
main ol li {
	line-height: 25px;
	padding: 0 5px;
}


/* =========================================================
   TEXTO, IMÁGENES Y CÓDIGO
   ========================================================= */

main p {
	line-height: 160%;
}

main sup {
	line-height: 12px;
}

main ::selection {
	background-color: #72dec2;
	color: #000;
	text-decoration: none;
}

main q {
	font-family: serif;
	font-size: 18px;
	font-style: italic;
	display: block;
	max-width: 400px;
}

main img,
main svg {
	max-width: 100%;
	display: inline-block;
	margin: 0 0 25px;
}

main pre {
	overflow: auto;
	background: #efefef;
	padding: 10px;
	font-size: 80%;
}

main pre code,
main pre i {
	color: #888;
}

main code {
	white-space: pre;
}

main kbd {
	font-size: 12px;
	display: inline-block;
	padding: 0 5px;
	font-weight: bold;
	border-radius: 4px;
	line-height: 20px;
	border: 2px solid #222;
}


/* =========================================================
   FOOTER
   ========================================================= */

footer {
	padding: 30px 0;
	clear: both;
	margin: 30px 30px 15px;
	border-top: 1px dotted black;
}

footer * {
	height: 25px;
	display: inline;
	vertical-align: middle;
}

footer a {
	margin-right: 3px;
}

footer a:hover {
	text-decoration: underline;
}

footer img {
	margin-right: 5px;
}

footer div.right img {
	margin-left: 5px;
	margin-right: 0;
}


/* =========================================================
   CODEVIEW
   ========================================================= */

div.codeview {
	background: #eee;
	border-radius: 4px;
	overflow: hidden;
}

div.codeview iframe {
	height: 405px;
	border: 0;
	margin: 0;
	display: block;
}

div.codeview pre {
	margin: 0;
	background: #000;
	color: #fff;
}

div.codeview pre.src {
	background: #efefef;
	color: #000;
}

div.codeview pre a {
	float: right;
	color: #72dec2;
	text-decoration: none;
	font-weight: bold;
}


/* =========================================================
   MODO OSCURO
   ========================================================= */

@media (prefers-color-scheme: dark) {

	* {
		color: #fff;
	}

	body {
		background: #000;
	}

	main a:hover,
	main a:hover > *,
	nav a:hover,
	nav a:hover > * {
		background-color: #fff;
		color: #000;
	}

	input {
		color: #000;
	}

	img[src*="svg"],
	img[src*="png"] {
		filter: invert(1) hue-rotate(180deg);
	}

	main pre {
		background: #111;
	}

	main table {
		border-style: solid;
	}

	main th,
	main td {
		border-style: dotted;
	}

	main article {
		border-left-color: white;
	}

	.nodark {
		filter: invert(0) hue-rotate(0deg) !important;
		background: transparent !important;
	}

	footer {
		border-top-color: white;
	}

	footer * {
		color: white;
	}
}
