/*
 * ══════════════════════════════════════════════════════
 *  apuntes.css — Hoja de estilos para guías de estudio
 * ══════════════════════════════════════════════════════
 *
 *  Cómo vincularla en tu HTML:
 *
 *    <!-- 1. Primero carga las fuentes de Google -->
 *    <link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,400;0,600;1,400&family=Lora:ital,wght@0,400;0,700;1,400&family=Outfit:wght@300;400;600;700;800&display=swap" rel="stylesheet">
 *
 *    <!-- 2. Luego vincula este archivo (ajusta la ruta si es necesario) -->
 *    <link rel="stylesheet" href="apuntes.css">
 *
 * ══════════════════════════════════════════════════════
 */


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   VARIABLES — Cambia los colores aquí
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
:root {
  /* Colores principales */
  --bg:           #faf8f4;      /* Fondo de la página */
  --paper:        #ffffff;      /* Fondo de las secciones */
  --ink:          #1a1a2e;      /* Color de texto principal */
  --border:       #e0dbd0;      /* Color de bordes */

  /* Colores de acento (para subsecciones y anotaciones) */
  --azul:         #2980b9;
  --rojo:         #c0392b;
  --verde:        #27ae60;
  --morado:       #8e44ad;
  --amarillo:     #f9ca24;
  --naranja:      #d35400;

  /* Código */
  --code-bg:      #1e1e2e;      /* Fondo de bloques de código */
  --code-fg:      #cdd6f4;      /* Texto de código */

  /* Notas especiales */
  --nota-bg:      #fff9e6;
  --nota-borde:   #f39c12;
  --tip-bg:       #eafaf1;
  --tip-borde:    #27ae60;
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   BASE
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  font-family: 'Outfit', sans-serif;
  color: var(--ink);
  line-height: 1.7;
  padding: 0 20px 80px;
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   PORTADA
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.portada {
  background: var(--ink);
  color: white;
  text-align: center;
  padding: 60px 40px 50px;
  margin: 0 -20px 50px;
  position: relative;
  overflow: hidden;
}
.portada::before {
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    45deg, transparent, transparent 30px,
    rgba(255,255,255,0.03) 30px, rgba(255,255,255,0.03) 31px
  );
}
.portada h1 {
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: -1px;
  position: relative;
}
.portada .subtitulo {
  font-size: 1.1rem;
  opacity: 0.7;
  margin-top: 10px;
  font-weight: 300;
  font-family: 'Lora', serif;
  font-style: italic;
  position: relative;
}
.portada .badges {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
  flex-wrap: wrap;
  position: relative;
}
.badge {
  padding: 6px 18px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  background: rgba(255,255,255,0.15);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   ÍNDICE
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.indice {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 36px;
  margin: 0 auto 36px;
  max-width: 900px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.indice h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 10px;
}
.indice ol { padding-left: 22px; }
.indice li { margin-bottom: 6px; font-size: 0.95rem; }
.indice a { color: var(--azul); text-decoration: none; }
.indice a:hover { text-decoration: underline; }


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   CONTENIDO PRINCIPAL
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.contenido {
  max-width: 900px;
  margin: 0 auto;
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   SECCIÓN
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.seccion {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 36px 40px;
  margin-bottom: 36px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.seccion-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border);
}
.seccion-numero {
  width: 42px; height: 42px;
  background: var(--ink);
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  flex-shrink: 0;
}
.seccion-titulo {
  font-size: 1.6rem;
  font-weight: 800;
}
.seccion-subtitulo {
  font-size: 0.9rem;
  color: #888;
  font-style: italic;
  font-family: 'Lora', serif;
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   SUBSECCIÓN
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.subseccion { margin-bottom: 32px; }

.subseccion h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--azul);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.subseccion h3::before {
  content: '';
  display: inline-block;
  width: 4px; height: 18px;
  background: var(--azul);
  border-radius: 2px;
  flex-shrink: 0;
}

/* Variantes de color para h3 */
.subseccion h3.rojo    { color: var(--rojo);    }
.subseccion h3.rojo::before    { background: var(--rojo);    }
.subseccion h3.verde   { color: var(--verde);   }
.subseccion h3.verde::before   { background: var(--verde);   }
.subseccion h3.morado  { color: var(--morado);  }
.subseccion h3.morado::before  { background: var(--morado);  }
.subseccion h3.naranja { color: var(--naranja); }
.subseccion h3.naranja::before { background: var(--naranja); }

p { margin-bottom: 12px; font-size: 0.97rem; }


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   CÓDIGO
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
pre {
  background: var(--code-bg);
  color: var(--code-fg);
  border-radius: 10px;
  padding: 22px 24px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  line-height: 1.8;
  overflow-x: auto;
  margin: 14px 0 20px;
  position: relative;
}

/* Etiqueta del lenguaje en la esquina superior derecha */
pre .label {
  position: absolute;
  top: 8px; right: 12px;
  font-size: 0.7rem;
  color: #585b70;
  font-family: 'Outfit', sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Código inline dentro de párrafos */
code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.84em;
  background: #f0ede8;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--rojo);
}

/*
 * Clases de coloreado de sintaxis — úsalas con <span> dentro de <pre>:
 *
 *   .k   morado   keywords:  if, for, function, const, return...
 *   .t   azul     tags HTML: <div>, <p>, <table>...
 *   .a   verde    atributos HTML: class, id, href...
 *   .v   naranja  valores de atributo / valores CSS
 *   .s   verde    strings entre comillas
 *   .c   gris     comentarios  // /* <!-- ...
 *   .n   amarillo números
 *   .p   cian     propiedades CSS / accesos .prop en JS
 *   .fn  azul     nombres de función
 *   .cm  blanco   texto común / nombres de variable
 */
.k  { color: #cba6f7; }
.t  { color: #89b4fa; }
.a  { color: #a6e3a1; }
.v  { color: #fab387; }
.s  { color: #a6e3a1; }
.c  { color: #6c7086; font-style: italic; }
.n  { color: #f9e2af; }
.p  { color: #89dceb; }
.fn { color: #89b4fa; }
.cm { color: #cdd6f4; }


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   ANOTACIONES (banners laterales de color)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.anotacion {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: #f8f7f4;
  border-left: 3px solid var(--azul);
  border-radius: 0 8px 8px 0;
  padding: 12px 16px;
  margin: 10px 0;
  font-size: 0.9rem;
}
.anotacion .ico { font-size: 1.1rem; flex-shrink: 0; }

.anotacion.roja     { border-color: var(--rojo);                              }
.anotacion.verde    { border-color: var(--verde);                             }
.anotacion.amarilla { border-color: var(--naranja); background: var(--nota-bg); }
.anotacion.morada   { border-color: var(--morado);                            }


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   NOTA y TIP (cajas destacadas)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.nota {
  background: var(--nota-bg);
  border: 1px solid var(--nota-borde);
  border-radius: 8px;
  padding: 14px 18px;
  font-size: 0.9rem;
  margin: 14px 0;
}
.nota strong { color: var(--naranja); }

.tip {
  background: var(--tip-bg);
  border: 1px solid var(--tip-borde);
  border-radius: 8px;
  padding: 14px 18px;
  font-size: 0.9rem;
  margin: 14px 0;
}
.tip strong { color: var(--verde); }


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   TABLA COMPARATIVA
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
table.comp {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin: 14px 0;
}
table.comp th {
  background: var(--ink);
  color: white;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
}
table.comp td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
}
table.comp tr:nth-child(even) td { background: #f8f7f4; }
table.comp td code { background: transparent; border: none; padding: 0; }


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   GRID DE DOS COLUMNAS
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 16px 0;
}
@media (max-width: 700px) {
  .grid2 { grid-template-columns: 1fr; }
}

.card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  font-size: 0.9rem;
}
.card h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--azul);
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   PASOS NUMERADOS
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.pasos { counter-reset: paso; }

.paso {
  counter-increment: paso;
  display: flex;
  gap: 14px;
  margin-bottom: 18px;
  align-items: flex-start;
}
.paso::before {
  content: counter(paso);
  min-width: 28px; height: 28px;
  background: var(--azul);
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   DIAGRAMA DE ESTRUCTURA (árbol)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.estructura {
  background: #f8f7f4;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 24px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.83rem;
  line-height: 2;
  margin: 14px 0;
}
.estructura .nivel0 { color: var(--rojo);   font-weight: 700; }
.estructura .nivel1 { color: var(--azul);   margin-left: 20px; }
.estructura .nivel2 { color: var(--verde);  margin-left: 40px; }
.estructura .nivel3 { color: var(--morado); margin-left: 60px; }


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   SEPARADOR
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
hr.sep {
  border: none;
  border-top: 2px dashed var(--border);
  margin: 28px 0;
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   PIE DE PÁGINA
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.pie {
  text-align: center;
  padding: 30px 0;
  color: #aaa;
  font-size: 0.85rem;
  font-family: 'Lora', serif;
  font-style: italic;
}
