/* ========================================
   Importación de fuentes
   ======================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Fraunces:wght@600;700;900&family=JetBrains+Mono:wght@400;500&display=swap');

/* ========================================
   Paleta de colores
   ======================================== */
:root {
  --inst-color: #C2185B;
  --inst-dark: #4a1a30;
  --inst-light: #fdf2f8;
  --inst-accent: #F48FB1;
  --banner-color: linear-gradient(
    135deg,
    #6a1b3d 0%,
    #8E244D 25%,
    #C2185B 60%,
    #F48FB1 100%
  );
  --title-color: #ffffff;
  --shadow-soft: 0 4px 20px rgba(142, 36, 77, 0.08);
  --shadow-medium: 0 10px 40px rgba(142, 36, 77, 0.12);
}

/* ========================================
   Tipografía base
   ======================================== */
body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: #2a2a2a;
}

h1, h2, h3, .quarto-title-banner .title {
  font-family: 'Fraunces', Georgia, serif;
  letter-spacing: -0.02em;
  font-weight: 700;
}

h2 {
  border-left: 4px solid var(--inst-color);
  padding-left: 0.8rem;
  margin-top: 3rem;
  color: var(--inst-dark);
}

h3 {
  color: var(--inst-color);
  margin-top: 2rem;
}

/* ========================================
   Banner
   ======================================== */
.quarto-title-block .quarto-title-banner {
  background-image:
    radial-gradient(circle at 20% 50%, rgba(255,255,255,0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(255,255,255,0.08) 0%, transparent 50%),
    var(--banner-color);
  padding-top: 180px;
  padding-bottom: 80px;
  color: var(--title-color);
  box-shadow: 0 4px 20px rgba(142, 36, 77, 0.15);
}

.quarto-title-banner .title {
  font-size: 3.5rem;
  font-weight: 700;
}

/* Logo a la derecha */
.logo-position {
  position: absolute;
  margin: 0;
  top: 3%;
  right: 4%;
  text-align: right;
  font-size: 16px;
}

/* ========================================
   Hipervínculos
   ======================================== */
a {
  color: var(--inst-color);
  text-decoration: underline;
  text-decoration-color: rgba(194, 24, 91, 0.3);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s;
}

a:hover {
  text-decoration-color: var(--inst-color);
}

/* ========================================
   Tabla de contenidos (TOC)
   ======================================== */
#toc-title {
  font-weight: bold;
}

.sidebar nav[role="doc-toc"] ul > li > a {
  border-left: 2px solid transparent;
  padding-left: 0.6rem;
  transition: all 0.2s ease;
  font-size: 0.92em;
}

.sidebar nav[role="doc-toc"] ul > li > a.active,
.sidebar nav[role="doc-toc"] ul > li > a:hover,
.sidebar nav[role="doc-toc"] ul > li > ul > li > a.active,
.sidebar nav[role="doc-toc"] ul > li > ul > li > a:hover {
  color: var(--inst-color) !important;
  border-left-color: var(--inst-color);
  font-weight: 600;
}

/* ========================================
   Bloques de código premium
   ======================================== */
div.sourceCode {
  border-radius: 12px;
  border: 1px solid #f0d4e0;
  background-color: #fdf7fa;
  box-shadow: var(--shadow-soft);
  margin: 1.8rem 0;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

div.sourceCode:hover {
  box-shadow: var(--shadow-medium);
  transform: translateY(-2px);
}

/* Barra superior tipo "ventana de editor" */
div.sourceCode::before {
  content: "● ● ●";
  display: block;
  background: linear-gradient(90deg, #f9e0ec, #fdf2f8);
  color: var(--inst-accent);
  padding: 0.4rem 1rem;
  font-size: 0.7em;
  letter-spacing: 0.3em;
  border-bottom: 1px solid #f0d4e0;
}

pre code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.88em;
  line-height: 1.6;
}

code:not(pre code) {
  background-color: #fce4ec;
  color: var(--inst-color);
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 0.88em;
  font-weight: 500;
  border: 1px solid #f9c8d8;
}

/* ========================================
   Outputs de R con identidad
   ======================================== */
.cell-output {
  border-left: 3px solid var(--inst-accent);
  background: #fafafa;
  padding: 0.8rem 1rem;
  border-radius: 0 8px 8px 0;
  margin: 0.5rem 0 1.5rem 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
}

/* ========================================
   Citas (blockquotes)
   ======================================== */
blockquote {
  border-left: 4px solid var(--inst-color);
  background: var(--inst-light);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: #555;
}

/* ========================================
   Tablas
   ======================================== */
table {
  border-collapse: collapse;
  margin: 1.5rem 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  border-radius: 8px;
  overflow: hidden;
}

table thead {
  background: var(--inst-color);
  color: white;
}

table th,
table td {
  padding: 0.75rem 1rem;
}

table tbody tr:nth-child(even) {
  background-color: #fdf7fa;
}

/* ========================================
   Imágenes
   ======================================== */
.quarto-figure img,
p img {
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* ========================================
   Ancho de lectura
   ======================================== */
main.content {
  max-width: 820px;
  font-size: 1.02rem;
}
div.sourceCode pre,
div.sourceCode code {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
}