/*-- scss:defaults --*/
// Estética alineada con estelablanco.cl (Colibri / tonos institucionales sobrios)
$primary: #0073aa;
$link-color: #005177;
$body-bg: #fafafa;
$body-color: #111111;

$font-family-sans-serif: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif !default;
$headings-font-family: "Source Serif 4", Georgia, "Times New Roman", serif !default;

$table-bg: transparent;
$table-hover-bg: rgba($primary, 0.045);

@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:ital,wght@0,400;0,600;0,700;1,400&family=Source+Serif+4:opsz,wght@8..60,400;8..60,600;8..60,700&display=swap');

/*-- scss:rules --*/
:root {
  --ebl-accent: #{$primary};
  --ebl-ink: #{$body-color};
}

body {
  letter-spacing: 0;
}

.sidebar-title-main,
.sidebar-title {
  letter-spacing: 0.015em;
  font-family: $headings-font-family;
}

#quarto-sidebar .sidebar-navigation .chapter-number {
  display: none !important;
}

#TOC .toc-section-number,
.toc-actions .numbered {
  display: none !important;
}

.navbar {
  border-bottom: 1px solid #e6e6e6;
  box-shadow: none;
  background-color: #ffffff !important;
}

.navbar .navbar-brand,
.navbar-title {
  font-family: $headings-font-family;
  font-weight: 640;
}

.navbar-brand img.navbar-logo {
  max-height: 40px;
  width: auto;
}

.text-muted {
  color: #767676 !important;
}

.sidebar-link {
  color: #383838 !important;

  &.active {
    color: #{$link-color} !important;
    background: rgba($primary, 0.08);
  }

  &:hover {
    color: #{$primary} !important;
  }
}

a {
  font-weight: 500;
}

/* Barra lateral del índice del libro + cuerpo central más anchos */
@media (min-width: 992px) {
  #quarto-content.page-columns {
    align-items: flex-start;
  }

  body.nav-sidebar.docked #quarto-sidebar.sidebar {
    flex: 0 0 19.5rem !important;
    width: 19.5rem !important;
    min-width: 19.5rem !important;
    max-width: 19.5rem !important;
  }

  main#quarto-document-content.content {
    flex: 1 1 auto !important;
    max-width: 58rem !important;
    width: 100%;
    min-width: 0;
  }

  #quarto-margin-sidebar.sidebar {
    flex: 0 0 13.5rem !important;
    width: 13.5rem !important;
    min-width: 11rem !important;
    max-width: 14rem !important;
  }
}

h1.title,
.sidebar-title-main {
  color: var(--ebl-ink);
}

/* Title block metadata: AUTOR(es) junto al DOI (Zenodo · estilo libro de referencia), URL completa legible */
header.quarto-title-block .quarto-title-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 2.75rem;

  /* Orden DOM: autor → fecha → DOI · mostrar autor | DOI | fecha */
  & > div:nth-child(1) {
    order: 1;
  }

  & > div:nth-child(2) {
    order: 3;
  }

  & > div:nth-child(3) {
    order: 2;
  }
}

.quarto-title-meta-heading {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.72rem !important;
  font-weight: 600;
  margin-bottom: 0.35rem !important;
  color: #9a9a9a !important;
}

.quarto-title-meta-contents p.date,
.quarto-title-meta-contents {
  margin-bottom: 0;
}

/* Enlace DOI resolver: muestra la URL https://doi.org/... como texto visible (véase intro-programacion) */
header.quarto-title-block p.doi a {
  color: #{$body-color} !important;
  font-weight: 400 !important;
  word-break: break-word;
  font-size: 0 !important;
  line-height: 0 !important;
}

header.quarto-title-block p.doi a::before {
  content: attr(href);
  font-size: 1rem !important;
  line-height: 1.45 !important;
  font-family: $font-family-sans-serif;
}

.book .page-navigation {
  border-top-color: #e2e2e2;
}

div.callout {
  border-radius: 0.25rem;
}

div.callout-important {
  border-left-width: 0.35rem;
  border-left-color: #111111;
}

div.callout-note {
  border-left-color: #{$primary};
}

.page-footer.footer {
  border-top: 1px solid #eaeaea;
  padding-top: 0.85rem;

  div {
    color: #767676;
    font-size: 0.88rem;

    strong {
      color: #222;
    }

    p {
      margin-bottom: 0.25rem;
    }
  }
}

[data-bs-theme="dark"] body {
  --ebl-ink: #f5f7f9;
}

[data-bs-theme="dark"] .quarto-title-meta-heading {
  color: #8a97a3 !important;
}

/* Tema oscuro: enlaces en azul (evita el verde por defecto de darkly) */
[data-bs-theme="dark"] a,
[data-bs-theme="dark"] a.quarto-title-author-email,
[data-bs-theme="dark"] a.quarto-title-author-orcid {
  color: #5eb3ff !important;
}

[data-bs-theme="dark"] a:hover,
[data-bs-theme="dark"] a.quarto-title-author-email:hover,
[data-bs-theme="dark"] a.quarto-title-author-orcid:hover {
  color: #9fd1ff !important;
}

[data-bs-theme="dark"] .sidebar-link {
  color: #d0d5dd !important;
}

[data-bs-theme="dark"] .sidebar-link.active {
  color: #5eb3ff !important;
  background: rgba(94, 179, 255, 0.12) !important;
}

[data-bs-theme="dark"] .sidebar-link:hover {
  color: #9fd1ff !important;
}

[data-bs-theme="dark"] header.quarto-title-block p.doi a::before {
  color: #5eb3ff !important;
}

[data-bs-theme="dark"] .navbar {
  border-bottom-color: #3a4450;
}

[data-bs-theme="dark"] .page-footer.footer {
  border-top-color: #3a4450;

  div {
    color: #c8d3db;

    strong {
      color: #fff;
    }
  }
}
