/* ============================================
   codeandIA — estilos globales
   ============================================ */

:root {
  /* Color */
  --bg: #0d0d0f;
  --bg-raised: #151519;
  --bg-alt: #111113;
  --border: rgba(255, 255, 255, 0.09);
  --text: #f2f2f5;
  --text-muted: #98989f;
  --accent: #7b61ff;
  --accent-soft: rgba(123, 97, 255, 0.14);
  --accent-text: #d9d1ff;

  /* Tipografía */
  --font-body: 'Space Grotesk', -apple-system, sans-serif;
  --font-mono: 'Space Mono', ui-monospace, monospace;

  /* Layout */
  --container-width: 1080px;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    transition: none !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

main {
  padding-top: 72px; /* deja espacio para el nav fijo */
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 24px;
}

.container-narrow {
  max-width: 640px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ============ Logo ============ */

.logo {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}

.logo-code {
  color: var(--text);
}

.logo-ia {
  color: var(--accent);
}

.logo-small {
  font-size: 1.1rem;
}

/* ============ Nav ============ */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(13, 13, 15, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-links {
  display: flex;
  gap: 28px;
}

.nav-links a {
  font-size: 0.95rem;
  color: var(--text-muted);
  transition: color 0.15s ease;
}

.nav-links a:hover {
  color: var(--text);
}

/* ============ Botones ============ */

.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.btn-accent {
  background: var(--accent);
  color: #ffffff;
}

.btn-accent:hover {
  opacity: 0.88;
}

/* ============ Pills ============ */

.pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent-text);
  background: var(--accent-soft);
  border: 1px solid rgba(123, 97, 255, 0.3);
  padding: 4px 10px;
  border-radius: 100px;
}

/* ============ Hero ============ */

.hero {
  padding: 120px 0 88px;
  border-bottom: 1px solid var(--border);
}

.hero-title {
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 24px;
  max-width: 16ch;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 56ch;
  margin: 0 0 32px;
}

/* ============ Secciones ============ */

.section {
  padding: 88px 0;
  border-bottom: 1px solid var(--border);
}

.section-alt {
  background: var(--bg-alt);
}

.section-title {
  font-size: 1.6rem;
  letter-spacing: -0.01em;
  margin: 0 0 40px;
}

.about-text {
  color: var(--text-muted);
  font-size: 1.05rem;
}

.empty-state {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

/* ============ Grid de artículos ============ */

.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.article-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 24px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s ease;
}

.article-card:hover {
  border-color: var(--accent);
}

.article-card-title {
  font-size: 1.15rem;
  margin: 0;
  line-height: 1.35;
}

.article-card-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

.article-card-date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: auto;
}

/* ============ Grid de herramientas ============ */

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.tool-card {
  display: block;
  padding: 22px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s ease;
}

.tool-card:hover {
  border-color: var(--accent);
}

.tool-card h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.tool-card p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ============ Artículo individual ============ */

.article {
  max-width: 720px;
  margin: 0 auto;
  padding: 72px 24px 96px;
}

.article-header {
  margin-bottom: 40px;
}

.article-title {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 16px 0 12px;
}

.article-meta {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.meta-dot {
  margin: 0 8px;
}

.article-content {
  font-size: 1.05rem;
  line-height: 1.75;
}

.article-content h2 {
  font-size: 1.5rem;
  margin: 44px 0 16px;
  letter-spacing: -0.01em;
}

.article-content h3 {
  font-size: 1.2rem;
  margin: 32px 0 14px;
}

.article-content p {
  margin: 0 0 20px;
  color: #dcdce1;
}

.article-content strong {
  color: var(--text);
}

.article-content ul,
.article-content ol {
  margin: 0 0 20px;
  padding-left: 22px;
  color: #dcdce1;
}

.article-content li {
  margin-bottom: 8px;
}

.article-content a {
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.back-link {
  display: inline-block;
  margin-top: 48px;
  font-size: 0.9rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 2px;
}

.back-link:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

/* ============ Bloque de afiliado ============ */

.affiliate-box {
  margin-top: 48px;
  padding: 28px;
  background: var(--accent-soft);
  border: 1px solid rgba(123, 97, 255, 0.3);
  border-radius: var(--radius);
}

.affiliate-box p {
  margin: 0 0 16px;
  color: var(--text);
  font-size: 0.98rem;
}

/* ============ Footer ============ */

.footer {
  padding: 48px 0;
}

.footer-inner {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}

.footer-note {
  color: var(--text-muted);
  font-size: 0.85rem;
  max-width: 60ch;
  margin: 0;
}

.footer-links {
  display: flex;
  gap: 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-links a:hover {
  color: var(--text);
}

/* ============ Responsive ============ */

@media (max-width: 640px) {
  .nav-links {
    gap: 16px;
  }

  .nav-links a {
    font-size: 0.85rem;
  }

  .hero {
    padding: 100px 0 64px;
  }

  .section {
    padding: 64px 0;
  }

  .article {
    padding: 56px 20px 72px;
  }
}
