:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #059669;
  --accent-light: #d1fae5;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -2px rgba(0,0,0,.04);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ─── Navigation ─── */
nav {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 60;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 64px;
  max-width: 1200px;
  margin: 0 auto;
}

nav .logo {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--primary);
  text-decoration: none;
}

nav .logo svg { width: 28px; height: 28px; }

nav .nav-links { display: flex; gap: .25rem; align-items: center; }

nav .nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  padding: .5rem .85rem;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 500;
  transition: all .2s;
}

nav .nav-links a:hover,
nav .nav-links a.active {
  color: var(--primary);
  background: #eff6ff;
}

/* ─── Hero ─── */
.hero {
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 50%, #059669 100%);
  color: white;
  padding: 5rem 1.5rem 4rem;
  text-align: center;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.2;
  margin-bottom: .75rem;
}

.hero p {
  font-size: 1.15rem;
  opacity: .9;
  max-width: 640px;
  margin: 0 auto 1.5rem;
  line-height: 1.6;
}

.hero .tags {
  display: flex;
  gap: .5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.hero .tags a {
  text-decoration: none;
  color: white;
  transition: all .2s;
}

.hero .tags a:visited {
  color: white;
}

.hero .tags a:hover {
  transform: translateY(-1px);
}

.hero .tags span {
  background: rgba(255,255,255,.2);
  backdrop-filter: blur(4px);
  padding: .35rem 1rem;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 600;
  color: white;
  display: inline-block;
  transition: all .2s;
  border: 1px solid rgba(255,255,255,.3);
}

.hero .tags a:hover span {
  background: rgba(255,255,255,.35);
  border-color: rgba(255,255,255,.6);
}

/* ─── Container ─── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }

/* ─── Blog Grid ─── */
.blog-section { padding: 3rem 0; }

.blog-section h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--text);
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
}

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all .25s;
}

/* ─── Table of Contents ─── */
.toc {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 2rem;
}

.toc h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: .75rem;
  color: var(--text);
}

.toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc li {
  margin-bottom: .4rem;
  padding: 0;
}

.toc a {
  color: var(--primary);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
  line-height: 1.5;
  display: inline-block;
  padding: .15rem 0;
  transition: color .2s;
  border-bottom: 1px solid transparent;
}

.toc a:hover {
  color: var(--primary-dark);
  border-bottom-color: var(--primary);
}
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.post-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.post-card-link:hover .post-card {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

/* ─── Utility classes (replaces inline styles) ─── */
.nav-link-directorio {
  color: var(--primary) !important;
  font-weight: 600 !important;
}

.footer-link {
  display: inline !important;
  color: #60a5fa !important;
}

.card-img-bg {
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  font-size: 0;
}

.post-tags-inline {
  margin-top: 1rem;
  border: none;
  padding: 0;
}

.post-tags-bottom {
  margin-top: 2rem;
}

.category-desc {
  max-width: 720px;
  margin: 0 auto 3rem;
  color: var(--text-muted);
  line-height: 1.8;
  font-size: 1.05rem;
}

.mt-lg {
  margin-top: 2rem;
}

.about-subtitle {
  margin-top: 2rem;
  font-size: 1.3rem;
}

.post-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

/* ─── Card styles v2 ─── */
.post-card .card-img {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, #dbeafe, #d1fae5);
  overflow: hidden;
  position: relative;
}

.card-img-hero {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.post-card .card-body {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.post-card .card-meta {
  display: flex;
  gap: .75rem;
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: .5rem;
}

.post-card .card-category {
  display: inline-block;
  background: #eff6ff;
  color: var(--primary);
  font-size: .75rem;
  font-weight: 600;
  padding: .2rem .7rem;
  border-radius: 999px;
  margin-bottom: .75rem;
  align-self: flex-start;
}

.post-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: .5rem;
  color: var(--text);
}

.post-card h3 a {
  color: inherit;
  text-decoration: none;
}

.post-card h3 a:hover { color: var(--primary); }

.post-card .card-excerpt {
  color: var(--text-muted);
  font-size: .9rem;
  line-height: 1.6;
  flex: 1;
  margin-bottom: 1rem;
  text-decoration: none;
}

.post-card .card-footer {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.post-card .card-footer .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: .85rem;
}

.post-card .card-footer .author-info {
  font-size: .85rem;
}

.post-card .card-footer .author-info strong {
  display: block;
  font-weight: 600;
  color: var(--text);
}

.post-card .card-footer .author-info span {
  color: var(--text-muted);
  font-size: .8rem;
}

/* ─── Full Post ─── */
.post-full { padding: 3rem 1.5rem; max-width: 720px; margin: 0 auto; }

.post-full .back-link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: .9rem;
  margin-bottom: 2rem;
}

.post-full .back-link:hover { color: var(--primary); }

.post-full header { margin-bottom: 2rem; }

.post-full header .post-meta {
  display: flex;
  gap: 1rem;
  color: var(--text-muted);
  font-size: .9rem;
  margin-bottom: .75rem;
}

.post-full h1 {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -.02em;
  margin-bottom: 1rem;
}

.post-full .post-img {
  width: 100%;
  height: 360px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 2rem;
  background: linear-gradient(135deg, #dbeafe, #d1fae5);
}

.post-full .post-content {
  font-size: 1.05rem;
  line-height: 1.8;
}

.post-full .post-content p { margin-bottom: 1.25rem; }

.post-full .post-content h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 2rem 0 .75rem;
}

.post-full .post-content h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 1.5rem 0 .5rem;
}

.post-full .post-content ul,
.post-full .post-content ol {
  margin: .5rem 0 1.25rem 1.5rem;
}

.post-full .post-content li { margin-bottom: .35rem; }

.post-full .post-content blockquote {
  border-left: 4px solid var(--primary);
  background: #f1f5f9;
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: var(--text-muted);
}

.post-full .post-tags {
  display: flex;
  gap: .5rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.post-full .post-tags span {
  background: #f1f5f9;
  padding: .3rem .85rem;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* ─── Newsletter ─── */
.newsletter {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  margin: 3rem 0;
  text-align: center;
  box-shadow: var(--shadow);
}

.newsletter h3 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: .5rem;
}

.newsletter p {
  color: var(--text-muted);
  font-size: .95rem;
  margin-bottom: 1.25rem;
}

.newsletter form {
  display: flex;
  gap: .5rem;
  max-width: 420px;
  margin: 0 auto;
}

.newsletter input {
  flex: 1;
  padding: .7rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .9rem;
  outline: none;
  transition: border-color .2s;
}

.newsletter input:focus { border-color: var(--primary); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--primary);
  color: white;
  border: none;
  padding: .7rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover { background: var(--primary-dark); transform: translateY(-1px); }

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}

.btn-outline:hover { background: #eff6ff; }

/* ─── Footer ─── */
footer {
  background: var(--text);
  color: #94a3b8;
  padding: 3rem 1.5rem 2rem;
  margin-top: 4rem;
}

footer .container {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

footer h4 {
  color: white;
  font-weight: 600;
  font-size: .95rem;
  margin-bottom: .75rem;
}

footer p { font-size: .85rem; line-height: 1.6; }

footer a {
  display: block;
  color: #94a3b8;
  text-decoration: none;
  font-size: .85rem;
  margin-bottom: .35rem;
  transition: color .2s;
}

footer a:hover { color: white; }

footer .copyright {
  grid-column: 1 / -1;
  border-top: 1px solid #334155;
  padding-top: 1.5rem;
  margin-top: 1.5rem;
  font-size: .8rem;
  text-align: center;
}

/* ─── About ─── */
.about-page { padding: 3rem 1.5rem; max-width: 720px; margin: 0 auto; }
.about-page h1 { font-size: 2rem; font-weight: 800; margin-bottom: 1.5rem; }
.about-page p { margin-bottom: 1rem; color: var(--text-muted); line-height: 1.7; }

/* ─── Responsive ─── */
@media (max-width: 768px) {
  nav .nav-links a { padding: .4rem .6rem; font-size: .82rem; }
  .blog-grid { grid-template-columns: 1fr; }
  .hero { padding: 3rem 1rem 2.5rem; }
  .newsletter form { flex-direction: column; }
  footer .container { grid-template-columns: 1fr; }
  .post-full .post-img { height: 220px; }
}

@media (max-width: 480px) {
  nav .container { padding: 0 1rem; }
}

/* ─── Mobile Nav Toggle ─── */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: .4rem;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text);
  z-index: 60;
  transition: transform .25s ease;
  user-select: none;
}

.nav-toggle.open {
  transform: rotate(90deg);
}

body.nav-open {
  overflow: hidden;
}

@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  nav .nav-links {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    width: min(300px, 80vw);
    height: 100vh;
    height: 100dvh;
    background: var(--bg-card);
    flex-direction: column;
    align-items: stretch;
    padding: 5rem 1.5rem 2rem;
    gap: .25rem;
    box-shadow: -4px 0 24px rgba(0,0,0,.12);
    z-index: 55;
    overflow-y: auto;
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
    transition: transform .35s cubic-bezier(.4,0,.2,1), opacity .25s ease;
  }

  nav .nav-links.open {
    display: flex;
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }

  /* Overlay backdrop */
  body.nav-open::after {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 49;
    animation: fadeIn .3s ease;
  }

  @keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  nav .nav-links a {
    font-size: 1rem;
    padding: .75rem 1rem;
    border-radius: 10px;
    border-bottom: 1px solid var(--border);
  }

  nav .nav-links a:last-child {
    border-bottom: none;
  }

  nav .nav-links a.active {
    background: #eff6ff;
  }
}

/* ─── Related Posts ─── */
.related-posts {
  margin-top: 2.5rem;
  padding: 1.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.related-posts h3 {
  font-size: 1.15rem;
  margin-bottom: 1rem;
  color: var(--text);
}

.related-posts ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}

.related-posts li {
  margin: 0;
}

.related-posts a {
  display: inline-block;
  background: var(--bg-card);
  color: var(--primary);
  padding: .5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 500;
  text-decoration: none;
  transition: all .2s ease;
}

.related-posts a:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
