/* Base */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-weight: 300;
  font-size: 16px;
  line-height: 1.6;
  margin: 0;
  padding: 0 1rem;
  max-width: 720px;
  margin: 80px auto;
  color: #c9d1d9;
  background-color: #1c1c1e;
}

/* Links */
a {
  color: #3b82f6;
  text-decoration: none;
  transition: color 0.15s ease;
}

a:visited {
  color: #3b82f6;
}

a:hover,
a:focus {
  color: #60a5fa;
}

/* Text emphasis */
strong,
b {
  font-weight: 500;
  color: #e6edf3;
}

::selection {
  background-color: #58a6ff;
  color: #fff;
}

sup {
  line-height: 0;
}

/* Images */
main img {
  max-width: 100%;
  border-radius: 4px;
  opacity: 0.95;
}

.center {
  display: block;
  margin: 1.5rem auto;
  text-align: center;
  font-size: 11px;
  color: #8b949e;
}

/* Blockquotes */
blockquote {
  border-left: 2px solid #484f58;
  padding: 0.5rem 1rem;
  margin: 1.5rem 0;
  color: #8b949e;
  font-style: italic;
  background-color: #262626;
}

/* Post meta */
.post-date {
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
  color: #8b949e;
  font-size: 18px;
  letter-spacing: -0.01em;
  font-weight: 400;
}

.post-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #373737;
}

/* Blog links */
.blog-links {
  margin: 2rem 0;
  padding: 1.5rem;
  background: linear-gradient(135deg, #262626 0%, #2d2d2d 100%);
  border: 1px solid #3b82f6;
  border-radius: 8px;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.blog-links a {
  padding: 0.5rem 1rem;
  background-color: #3b82f6;
  color: #fff;
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.blog-links a:hover {
  background-color: #60a5fa;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Details / summary */
details {
  margin-bottom: 1.5rem;
}

summary {
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  background-color: #262626;
  border: 1px solid #373737;
  border-radius: 4px;
  font-weight: 400;
  color: #c9d1d9;
}

details[open] summary {
  background-color: #2d2d2d;
}

details[open] {
  padding-bottom: 0.5rem;
}

/* Progress */
progress {
  width: 100%;
  height: 4px;
  border: none;
  border-radius: 999px;
  background-color: #373737;
  overflow: hidden;
}

progress::-webkit-progress-bar {
  background-color: #373737;
}

progress::-webkit-progress-value {
  background-color: #58a6ff;
}

progress::-moz-progress-bar {
  background-color: #58a6ff;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background-color: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content {
  max-width: 90%;
  max-height: 90%;
  border-radius: 4px;
}

/* Code */
code {
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
  font-size: 0.9em;
  background-color: #262626;
  padding: 0.2em 0.4em;
  border-radius: 3px;
  color: #ff7b72;
}

pre {
  background-color: #262626;
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  border: 1px solid #373737;
}

pre code {
  background: none;
  padding: 0;
}

/* Headings */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: #e6edf3;
  font-weight: 500;
  line-height: 1.2;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

h1 {
  font-size: 2em;
}

h2 {
  font-size: 1.5em;
}

h3 {
  font-size: 1.25em;
}

/* Lists */
ul,
ol {
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.5rem;
}

/* Archive header */
.archive-header {
  margin-bottom: 3rem;
  border-bottom: 1px solid #373737;
  padding-bottom: 1.5rem;
}

.archive-header h1 {
  margin-bottom: 1.5rem;
  font-weight: 400;
}

/* Blog statistics */
.blog-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.stat-card {
  text-align: center;
  padding: 1rem 0.5rem;
}

.stat-number {
  font-size: 2rem;
  font-weight: 400;
  color: #8b949e;
  line-height: 1.2;
  margin-bottom: 0.25rem;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
}

.stat-label {
  font-size: 0.8rem;
  color: #6e7681;
  letter-spacing: 0.02em;
}

/* Timeline */
.timeline {
  margin-top: 2rem;
}

.year-marker {
  margin: 2.5rem 0 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #373737;
}

.year-label {
  font-size: 1.2rem;
  font-weight: 400;
  color: #8b949e;
  margin: 0;
}

/* Post entries */
.post-entry {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.5rem 0;
}

.separator {
  color: #484f58;
  font-weight: 300;
}

.post-info {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.75rem;
  flex: 1;
}

.post-link {
  font-weight: 300;
  color: #c9d1d9;
}

.post-link:hover {
  color: #3b82f6;
}

/* Word count */
.word-count {
  font-size: 0.75rem;
  color: #6e7681;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
}

/* Responsive */
@media (max-width: 640px) {
  .blog-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .stat-number {
    font-size: 1.75rem;
  }

  .post-entry {
    flex-wrap: wrap;
  }

  .post-date {
    font-size: 16px;
  }
}

.home-separator {
  display: block;
  max-width: 200px;
  margin: 3rem auto;
  opacity: 0.8;
}

.table-of-contents {
  background: transparent;
  padding: 2rem 0;
  margin: 2.5rem 0;
  border-top: 1px solid #373737;
  border-bottom: 1px solid #373737;
}

.table-of-contents::before {
  content: "Índice";
  display: block;
  font-size: 1.7rem;
  color: #e6edf3;
  margin-bottom: 1.25rem;
  font-weight: 400;
}

.table-of-contents ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
  counter-reset: toc-counter;
}

.table-of-contents ul ul {
  margin-top: 0.5rem;
  padding-left: 2rem;
}

.table-of-contents>ul>li {
  counter-increment: toc-counter;
  margin: 0.75rem 0;
  padding-left: 0;
}

.table-of-contents>ul>li::before {
  content: counter(toc-counter) ".";
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
  color: #3b82f6;
  font-size: 0.9em;
  margin-right: 0.75rem;
  font-weight: 400;
}

.table-of-contents a {
  color: #c9d1d9;
  font-weight: 300;
  transition: color 0.15s ease;
}

.table-of-contents a:hover {
  color: #3b82f6;
}

/* Estilos para subniveles */
.table-of-contents ul ul li {
  counter-increment: none;
  margin: 0.5rem 0;
}

.table-of-contents ul ul li::before {
  content: "—";
  color: #484f58;
  margin-right: 0.75rem;
}

.table-of-contents ul ul li a {
  font-size: 0.95em;
  color: #8b949e;
}

.table-of-contents ul ul ul li::before {
  content: "·";
  color: #484f58;
}

.table-of-contents ul ul ul li a {
  font-size: 0.9em;
  color: #6e7681;
}

.image-grid {
  margin: 2rem auto;
  max-width: 100%;
}

.image-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.grid-image {
  width: calc(50% - 0.5rem);
  height: auto;
  object-fit: cover;
}

figcaption.center {
  text-align: center;
  margin-top: 0.5rem;
  font-style: italic;
  color: #666;
}

/* Responsive: una imagen por fila en móviles */
@media (max-width: 768px) {
  .grid-image {
    width: 100%;
  }
}

/* MathJax v3: ecuaciones en modo display */
mjx-container[display="true"] {
  display: block;
  max-width: 100% !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  -webkit-overflow-scrolling: touch;
}

/* Evita que el contenido “rompa” el layout al medir */
mjx-container[display="true"] mjx-math {
  white-space: nowrap;
}

/* Opcional: scrollbar más fina */
mjx-container[display="true"]::-webkit-scrollbar {
  height: 6px;
}