/* css styles */
.navbar {
  background-color: #1e293b;
}

.navbar a, .navbar .nav-link, .navbar .navbar-brand {
  color: #FFA166 !important;
}

a {
  color: #1a1a1a !important;
}

.quarto-title-meta-contents a {
  color: #2563eb !important;
}

body {
  line-height: 1.8;
  color: #1a1a1a;
}

.justify {
  text-align: justify !important;
}

p {
  margin-bottom: 1.2em;
}

li {
  margin-bottom: 0.5em;
}

h2 {
  margin-top: 2em;
  margin-bottom: 0.8em;
}

h3 {
  margin-top: 1.5em;
  margin-bottom: 0.6em;
}

hr {
  margin-top: 2em;
  margin-bottom: 2em;
}

.columns {
  column-gap: 3em;
}

.column {
  padding-left: 1em;
  padding-right: 1em;
}

/* Home layout — foto chica a la izquierda, más espacio al contenido */
.quarto-about-solana .about-entity {
  max-width: 100% !important;
}

.quarto-about-solana .about-contents {
  max-width: 100% !important;
}

.quarto-about-solana .about-image {
  max-width: 180px !important;
}

.quarto-about-solana .about-image img {
  border-radius: 50% !important;
}

/* Certification badges with official images */
.cert-row {
  display: flex;
  gap: 1.5em;
  flex-wrap: wrap;
  margin-top: 0.5em;
}

.cert-card {
  display: flex;
  align-items: center;
  gap: 0.8em;
  padding: 0.5em 0;
}

.cert-card img {
  width: 60px;
  height: 60px;
  object-fit: contain;
}

.cert-card .cert-info {
  line-height: 1.3;
}

.cert-card .cert-name {
  font-weight: 600;
  font-size: 0.9em;
}

.cert-card .cert-issuer {
  font-size: 0.8em;
  color: gray;
}

/* Mermaid diagrams: centered, responsive */
.cell[data-engine="mermaid"] {
  display: flex;
  justify-content: center;
}

.cell[data-engine="mermaid"] .cell-output-display {
  display: flex;
  justify-content: center;
  width: 100%;
}

.cell[data-engine="mermaid"] .cell-output-display svg {
  max-width: 100%;
  height: auto;
}

div.mermaid-js {
  display: flex;
  justify-content: center;
}

/* Ocultar title block del tema Pulse (banner violeta) */
.quarto-title-banner {
  display: none !important;
}

/* ========== BLOG LISTING — estilo SunnyData ========== */

/* Cards del listing */
.quarto-grid-item {
  border: 1px solid #e5e7eb !important;
  border-radius: 10px !important;
  overflow: hidden;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.quarto-grid-item:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

/* Imagen de portada en cards */
.quarto-grid-item .card-img-top {
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.quarto-grid-item .card-body {
  padding: 1.2em 1.4em !important;
}

/* Título con underline animado */
.quarto-grid-item .card-title {
  font-size: 1.05em;
  font-weight: 600;
  line-height: 1.4;
  display: inline;
  background-image: linear-gradient(#FFA166, #FFA166);
  background-size: 0% 2px;
  background-position: left bottom;
  background-repeat: no-repeat;
  transition: background-size 0.4s ease;
  padding-bottom: 2px;
}

.quarto-grid-item:hover .card-title {
  background-size: 100% 2px;
}

.quarto-grid-item .card-text {
  font-size: 0.88em;
  color: #64748b;
  line-height: 1.6;
}

/* Fecha más visible en cards */
.quarto-grid-item .listing-date {
  font-size: 0.82em !important;
  color: #1e293b !important;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* Botón Leer más */
.quarto-grid-item .card-body::after {
  content: "Leer más →";
  display: block;
  margin-top: 1em;
  font-size: 0.82em;
  font-weight: 600;
  color: #FFA166;
  transition: color 0.2s ease, letter-spacing 0.2s ease;
}

.quarto-grid-item:hover .card-body::after {
  color: #e8854a;
  letter-spacing: 0.03em;
}

/* Category pills */
.quarto-grid-item .listing-categories .listing-category {
  background-color: #f3f0ff !important;
  color: #593196 !important;
  border: 1px solid #d4c5f9 !important;
  border-radius: 20px !important;
  padding: 0.15em 0.7em !important;
  font-size: 0.75em !important;
  font-weight: 500;
}

/* ========== GISCUS COMMENTS ========== */

.page-columns .giscus {
  grid-column: 1 / -1 !important;
  max-width: 780px;
  width: 100%;
  margin: 3rem auto 1rem;
  padding: 2rem 1rem 0;
  border-top: 1px solid #e2e0ea;
}

.giscus iframe.giscus-frame {
  border: none !important;
  width: 100% !important;
}

/* ========== BLOG POST — layout más ancho ========== */

/* Ocultar sidebar TOC */
#quarto-margin-sidebar.sidebar.margin-sidebar {
  display: none !important;
}

/* Redefinir grid: centrar contenido sin sidebar */
@media (min-width: 992px) {
  .page-layout-article.page-columns {
    grid-template-columns: 1fr minmax(0, 950px) 1fr !important;
  }

  .page-layout-article .content {
    grid-column: 2 !important;
    max-width: 950px !important;
  }

  .page-layout-article .quarto-title-meta {
    grid-column: 2 !important;
  }
}

/* ========== TOC colapsable (panel flotante) ========== */

/* Panel TOC oculto */
#toc-floating-panel {
  position: fixed;
  top: 60px;
  right: -320px;
  z-index: 1000;
  width: 300px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  background: white;
  border-left: 1px solid #e2e8f0;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.06);
  padding: 1.5em 1.2em;
  border-radius: 8px 0 0 8px;
  transition: right 0.3s ease;
}

#toc-floating-panel.toc-visible {
  right: 0;
}

#toc-floating-panel .panel-title {
  font-weight: 600;
  font-size: 0.85em;
  color: #1e293b;
  margin-bottom: 0.8em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#toc-floating-panel ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

#toc-floating-panel li {
  margin-bottom: 0.3em;
}

#toc-floating-panel a {
  font-size: 0.85em;
  color: #64748b !important;
  text-decoration: none;
  transition: color 0.2s ease;
  display: block;
  padding: 0.2em 0;
}

#toc-floating-panel a:hover {
  color: #FFA166 !important;
}

#toc-floating-panel ul ul {
  padding-left: 1em;
}

/* Botón toggle TOC */
#toc-toggle-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1001;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid #e2e8f0;
  background: #1e293b;
  color: #FFA166;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: background 0.2s ease, transform 0.2s ease;
}

#toc-toggle-btn:hover {
  background: #334155;
  transform: scale(1.08);
}

/* ========== BLOG POST — espaciado y callouts ========== */

/* Más aire entre secciones en posts */
article h2 {
  margin-top: 3em;
  margin-bottom: 1em;
  padding-bottom: 0.3em;
  border-bottom: 2px solid #f1f5f9;
}

article h3 {
  margin-top: 2em;
  margin-bottom: 0.8em;
}

/* Callouts más limpios */
.callout {
  border-radius: 8px !important;
  border-left-width: 4px !important;
  margin-top: 1.5em;
  margin-bottom: 1.5em;
}

/* Code blocks */
pre.sourceCode {
  border-radius: 8px !important;
  border: 1px solid #e5e7eb;
  margin-top: 1.2em;
  margin-bottom: 1.2em;
  overflow-x: auto;
}

/* Tablas: siempre scrolleable si se pasa del ancho */
article div:has(> table) {
  overflow-x: auto;
}

/* Tablas en posts — más limpias */
article table {
  margin-top: 1.5em;
  margin-bottom: 1.5em;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
}

article table thead th {
  background-color: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
  color: #1e293b;
  font-weight: 600;
  font-size: 0.9em;
  padding: 0.7em 1em;
}

article table tbody td {
  padding: 0.6em 1em;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.9em;
}

article table tbody tr:last-child td {
  border-bottom: none;
}

article table tbody tr:hover {
  background-color: #fafafa;
}

/* Diagrams ggplot2 — más espacio */
.cell-output-display {
  margin-top: 1.5em;
  margin-bottom: 1.5em;
}

/* ========== SCROLL SUAVE Y ANIMACIONES ========== */

html {
  scroll-behavior: smooth;
}

/* Fade-in on scroll */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Imágenes: zoom suave en hover */
.quarto-figure img,
.cell-output-display img {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: zoom-in;
  border-radius: 6px;
}

.quarto-figure img:hover,
.cell-output-display img:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* ========== MOBILE — max 768px ========== */

@media (max-width: 768px) {

  /* Tipografía más compacta */
  body {
    font-size: 15px;
    line-height: 1.7;
  }

  p {
    margin-bottom: 1em;
  }

  h2 {
    font-size: 1.35em;
    margin-top: 1.5em;
  }

  article h2 {
    margin-top: 2em;
    font-size: 1.3em;
  }

  h3 {
    font-size: 1.15em;
    margin-top: 1.2em;
  }

  /* Navbar: texto más chico */
  .navbar .navbar-brand {
    font-size: 0.95em;
  }

  /* Home: foto y bio en columna */
  .quarto-about-solana .about-entity {
    flex-direction: column !important;
    text-align: center;
  }

  .quarto-about-solana .about-image {
    max-width: 130px !important;
    margin: 0 auto 1em !important;
  }

  /* Home: columnas apiladas */
  .columns {
    column-gap: 0;
    display: block !important;
  }

  .column {
    width: 100% !important;
    padding-left: 0;
    padding-right: 0;
    margin-bottom: 1.5em;
  }

  /* Blog listing: 1 columna */
  .quarto-listing-cols-3 {
    grid-template-columns: 1fr !important;
  }

  .list.quarto-listing-default {
    gap: 1em;
  }

  /* Cards más compactas */
  .quarto-grid-item .card-body {
    padding: 1em !important;
  }

  .quarto-grid-item .card-title {
    font-size: 1em;
  }

  .quarto-grid-item .card-text {
    font-size: 0.85em;
  }

  /* Category pills más chicas */
  .quarto-grid-item .listing-categories .listing-category {
    padding: 0.1em 0.5em !important;
    font-size: 0.7em !important;
  }

  /* Post content: padding lateral */
  .page-layout-article .content,
  main.content {
    padding-left: 1em !important;
    padding-right: 1em !important;
    max-width: 100% !important;
  }

  /* Tablas: wrapper scrolleable */
  article table {
    display: table;
    width: max-content;
    min-width: 100%;
  }

  /* Quarto wraps tables in a div — target that */
  article .table,
  article .table-responsive,
  article div:has(> table) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: calc(100vw - 2em);
    margin-left: 0;
    margin-right: 0;
  }

  article table thead th,
  article table tbody td {
    padding: 0.5em 0.6em;
    font-size: 0.78em;
    white-space: nowrap;
  }

  /* Code blocks: contenido scrolleable */
  pre.sourceCode {
    font-size: 0.78em;
    padding: 0.8em !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: calc(100vw - 2em);
  }

  pre.sourceCode code {
    white-space: pre;
    word-break: normal;
    overflow-wrap: normal;
  }

  /* Inline code: wrappea normalmente */
  :not(pre) > code {
    word-break: break-word;
    font-size: 0.85em;
  }

  /* Callouts más compactos */
  .callout {
    margin-top: 1em;
    margin-bottom: 1em;
    padding: 0.8em !important;
  }

  .callout .callout-title-container {
    font-size: 0.9em;
  }

  /* Diagramas ggplot2: full width */
  .cell-output-display {
    margin-left: -1em;
    margin-right: -1em;
  }

  .cell-output-display img {
    width: 100%;
    height: auto;
    border-radius: 0;
  }

  /* TOC panel: full width en mobile */
  #toc-floating-panel {
    width: 85vw;
    right: -90vw;
    top: 56px;
    max-height: calc(100vh - 60px);
    padding: 1.2em 1em;
  }

  #toc-floating-panel.toc-visible {
    right: 0;
  }

  #toc-floating-panel a {
    font-size: 0.9em;
    padding: 0.35em 0;
  }

  /* Botón TOC: más grande para touch */
  #toc-toggle-btn {
    width: 48px;
    height: 48px;
    font-size: 20px;
    bottom: 16px;
    right: 16px;
  }

  /* Certificaciones: badges más chicos */
  .cert-card img {
    width: 45px;
    height: 45px;
  }

  .cert-card .cert-name {
    font-size: 0.82em;
  }

  .cert-card .cert-issuer {
    font-size: 0.72em;
  }

  /* HR más compacto */
  hr {
    margin-top: 1.5em;
    margin-bottom: 1.5em;
  }

  /* No hover effects en touch */
  .quarto-grid-item:hover {
    transform: none;
  }

  .quarto-figure img:hover,
  .cell-output-display img:hover {
    transform: none;
    box-shadow: none;
  }

  /* Fade-in más sutil */
  .fade-in {
    transform: translateY(10px);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
  }

  /* No justify en mobile (mejor lectura) */
  .justify {
    text-align: left !important;
  }
}

/* ========== TABLET — 769px a 991px ========== */

@media (min-width: 769px) and (max-width: 991px) {

  /* Blog listing: 2 columnas */
  .quarto-listing-cols-3 {
    grid-template-columns: 1fr 1fr !important;
  }

  .page-layout-article .content,
  main.content {
    max-width: 720px !important;
    padding-left: 1.5em !important;
    padding-right: 1.5em !important;
  }

  /* TOC panel */
  #toc-floating-panel {
    width: 300px;
  }

  /* Botón TOC */
  #toc-toggle-btn {
    width: 46px;
    height: 46px;
  }
}
