/* =========================================================
   BRAINVESTO — BASE.CSS
   =========================================================
   Reset + estilos globales + sistema de botones + sistema
   de cards. Depende de tokens.css (debe cargarse después).

   Este archivo es la base que Header, Footer, artículos,
   categorías, herramientas y comentarios heredarán. No debe
   contener estilos específicos de un solo componente:
   eso vive en fases futuras (components.css, layout.css).
========================================================= */

/* ---------------------------------------------------
   1. RESET
--------------------------------------------------- */
*, *::before, *::after{
  box-sizing: border-box;
}

html{
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
}

body{
  margin: 0;
  font-family: var(--font-base);
  font-weight: var(--fw-regular);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text);
  background-color: var(--background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img{
  max-width: 100%;
  display: block;
}

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

h1, h2, h3, h4, h5, h6{
  color: var(--heading);
  font-weight: var(--fw-bold);
  line-height: var(--leading-tight);
  margin: 0;
}

p{
  margin: 0 0 var(--space-4) 0;
}

ul, ol{
  margin: 0;
  padding: 0;
}

button{
  font-family: inherit;
  cursor: pointer;
}

input, textarea, select{
  font-family: inherit;
  font-size: var(--text-base);
}

table{
  border-collapse: collapse;
  width: 100%;
}

/* ---------------------------------------------------
   2. ACCESIBILIDAD — foco visible global
--------------------------------------------------- */
:focus-visible{
  outline: 3px solid var(--secondary);
  outline-offset: 3px;
  border-radius: 4px;
}

.visually-hidden{
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
  padding: 0;
  margin: -1px;
}

/* ---------------------------------------------------
   3. CONTENEDORES
--------------------------------------------------- */
.container{
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-5);
}

/* Columna de ancho óptimo de lectura — usada por el
   contenido principal de artículos (Fase 5) */
.content-column{
  max-width: var(--content-max);
  margin: 0 auto;
}

/* ---------------------------------------------------
   4. TIPOGRAFÍA — jerarquía global
   Aplica igual en Home, artículo, herramientas y
   comentarios (regla #9: una sola tipografía coherente)
--------------------------------------------------- */
h1{
  font-size: var(--text-2xl);
}

h1.is-hero-title{
  font-size: var(--text-3xl);
  letter-spacing: -0.02em;
}

h2{
  font-size: var(--text-xl);
}

h3{
  font-size: var(--text-lg);
}

h4{
  font-size: var(--text-md);
  font-weight: var(--fw-semibold);
}

.text-secondary{
  font-weight: var(--fw-medium);
  color: var(--text);
}

.text-muted{
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* Párrafo de cuerpo de artículo — interlineado relajado,
   exclusivo del contenido largo (Fase 5) */
.article-body p,
.article-body li{
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
}

/* ---------------------------------------------------
   5. SISTEMA DE BOTONES
   Un único componente base + 3 variantes + 2 tamaños.
   Ninguna plantilla futura debe crear un botón fuera
   de esta matriz.
--------------------------------------------------- */
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 15px 30px;
  border-radius: var(--radius-full);
  font-family: var(--font-base);
  font-weight: var(--fw-semibold);
  font-size: var(--text-sm);
  line-height: 1;
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    background var(--transition-fast),
    color var(--transition-fast),
    border-color var(--transition-fast);
}

/* Primario — única acción principal por sección/hero */
.btn--primary{
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn--primary:hover{
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Secundario — acción alternativa, mismo grupo que un primario */
.btn--secondary{
  background: var(--background);
  color: var(--heading);
  border-color: var(--border);
}
.btn--secondary:hover{
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
}

/* Ghost — enlaces de baja prioridad (nav, dentro de cards) */
.btn--ghost{
  background: transparent;
  color: var(--heading);
  padding: var(--space-2) var(--space-1);
}
.btn--ghost:hover{
  color: var(--primary);
}

/* Tamaño reducido — nav, tags de acción dentro de cards */
.btn--sm{
  padding: 10px 20px;
  font-size: var(--text-xs);
}

/* Ancho completo — formularios en móvil */
.btn--block{
  width: 100%;
}

/* Estado deshabilitado / "Próximamente".
   Brainvesto AI y herramientas no lanzadas usan esta clase
   sobre .btn--secondary, NUNCA sobre .btn--primary, para no
   sugerir que la acción está disponible. */
.btn[aria-disabled="true"]{
  cursor: not-allowed;
  opacity: 0.6;
  pointer-events: none;
}

/* ---------------------------------------------------
   6. SISTEMA DE CARDS
   Una sola card base; las variantes de artículo,
   categoría y herramienta (fases futuras) añaden solo
   lo que las diferencia, nunca redefinen padding,
   radius o sombra.
--------------------------------------------------- */
.card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-card-padding);
  transition:
    transform var(--transition-base),
    box-shadow var(--transition-base);
}

.card:hover{
  transform: translateY(-6px);
  box-shadow: var(--shadow-md);
}

/* Card sobre una sección que ya usa --surface como fondo:
   usa --background para mantener contraste (regla de ritmo
   visual sin depender del color) */
.card--on-surface{
  background: var(--background);
}

/* Icono contenedor — cards de categoría/herramienta */
.card__icon{
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  background: var(--background);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: var(--space-5);
}

.card__title{
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  color: var(--heading);
  margin-bottom: var(--space-2);
}

.card__text{
  font-size: var(--text-sm);
  color: var(--text);
  line-height: var(--leading-normal);
  margin-bottom: 0;
}

/* Badge dentro de una card (ej. categoría, "Próximamente") */
.card__badge{
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  margin-bottom: var(--space-3);
  background: var(--primary-soft);
  color: var(--primary);
}

.card__badge--accent{
  background: var(--accent-soft);
  color: #B45309;
}

/* Estado "Próximamente" — usado por herramientas sin
   construir y por la sección de Brainvesto AI (Fase 16/22).
   Reduce énfasis visual sin ocultar el contenido: Brainvesto
   no finge que la función existe, pero tampoco la esconde. */
.card--soon{
  opacity: 0.75;
}
.card--soon:hover{
  transform: none;
  box-shadow: none;
}

/* ---------------------------------------------------
   7. UTILIDADES DE ESPACIADO
   Para no repetir valores de espaciado sueltos en
   plantillas futuras.
--------------------------------------------------- */
.section{
  padding: var(--space-section) 0;
}

@media (max-width: 720px){
  .section{
    padding: var(--space-7) 0;
  }
}

.section--surface{
  background: var(--surface);
}

.stack-sm > * + *{ margin-top: var(--space-3); }
.stack-md > * + *{ margin-top: var(--space-5); }
.stack-lg > * + *{ margin-top: var(--space-7); }

/* ---------------------------------------------------
   8. BREADCRUMB
   Componente global — usado por la plantilla de artículo
   (single.php, Fase 4) y por la plantilla de categorías
   (archive.php, Fase 5). Vive aquí, y no en article.css,
   precisamente porque no es exclusivo de un solo tipo de
   plantilla: cualquier plantilla futura (búsqueda, 404)
   puede reutilizarlo sin depender de article.css.
--------------------------------------------------- */
.breadcrumb{
  margin-top: var(--space-5);
}

.breadcrumb__list{
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.breadcrumb__item{
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.breadcrumb__item:not(:last-child)::after{
  content: "/";
  color: var(--border);
}

.breadcrumb__item a{
  color: var(--text-muted);
  transition: color var(--transition-fast);
}
.breadcrumb__item a:hover{
  color: var(--primary);
}
.breadcrumb__item a:focus-visible{
  color: var(--primary);
}

.breadcrumb__item--current{
  color: var(--heading);
  font-weight: var(--fw-medium);
}
