/* global.css — Estilos compartidos del hub de Bai */
:root {
  --bg: #f6f7fb;
  --bg-card: #ffffff;
  --text: #1b1f2b;
  --text-soft: #5b6270;
  --brand: #5b6cff;
  --brand-2: #ff5e62;
  --border: #e5e8f0;
  --shadow: 0 1px 2px rgba(16, 20, 34, .05), 0 8px 24px -12px rgba(16, 20, 34, .14);
  --radius: 16px;
  --max: 1080px;
  --chip-bg: #eceef6;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10131c;
    --bg-card: #1a1f2e;
    --text: #eef0f7;
    --text-soft: #9aa1b3;
    --border: #2a3042;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .5);
    --chip-bg: #232a3d;
  }
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}

/* --- Topbar --- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--max);
  margin: 0 auto;
  padding: 1rem 1.25rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
}
.brand svg { color: var(--brand); }
.topbar-count {
  font-size: .85rem;
  color: var(--text-soft);
  background: var(--chip-bg);
  padding: .35rem .8rem;
  border-radius: 999px;
}
.topbar-nav {
  display: flex;
  align-items: center;
  gap: .25rem;
  margin-left: auto;
}
.topbar-nav a {
  color: var(--text-soft);
  text-decoration: none;
  font-size: .92rem;
  font-weight: 600;
  padding: .5rem .75rem;
  border-radius: 10px;
  transition: color .15s, background .15s;
}
.topbar-nav a:hover { color: var(--text); background: var(--chip-bg); }
@media (max-width: 640px) {
  .topbar-nav a { font-size: .85rem; padding: .4rem .55rem; }
  .topbar-nav a.nav-count { display: none; }
}

/* --- Hero --- */
.hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2.5rem 1.25rem 1rem;
  text-align: center;
}
.hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -.02em;
}
.hero-sub {
  margin: .8rem auto 0;
  max-width: 56ch;
  color: var(--text-soft);
  font-size: 1.05rem;
}

/* --- Búsqueda --- */
.search-box {
  display: flex;
  align-items: center;
  gap: .6rem;
  max-width: 520px;
  margin: 1.6rem auto 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .2rem .2rem .2rem 1rem;
  box-shadow: var(--shadow);
}
.search-box svg { color: var(--text-soft); flex-shrink: 0; }
.search-box input {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
  padding: .7rem 0;
  outline: none;
  min-width: 0;
}
.search-box input::placeholder { color: var(--text-soft); }
.search-box input::-webkit-search-cancel-button { display: none; }

/* --- Filtros --- */
.filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .5rem;
  margin-top: 1.1rem;
}
.filters .chip {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-soft);
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  padding: .45rem .95rem;
  border-radius: 999px;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s, transform .1s;
}
.filters .chip:hover { border-color: var(--brand); color: var(--text); }
.filters .chip:active { transform: scale(.96); }
.filters .chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

/* --- Grid de herramientas --- */
.tools { max-width: var(--max); margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 1rem;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  overflow: hidden;
}
.card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--brand) 45%, var(--border));
  box-shadow: 0 2px 4px rgba(16, 20, 34, .06), 0 16px 32px -16px rgba(16, 20, 34, .22);
}
.card-link {
  display: flex;
  gap: .9rem;
  padding: 1.1rem 1.15rem;
  text-decoration: none;
  color: inherit;
  height: 100%;
}
.card-icon {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 13px;
  overflow: hidden;
  background: var(--chip-bg);
  display: grid;
  place-items: center;
}
.card-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-body { min-width: 0; }
.card-cat {
  display: inline-block;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  padding: .15rem .5rem;
  border-radius: 999px;
  margin-bottom: .35rem;
}
.card-title {
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.25;
}
.card-desc {
  margin-top: .3rem;
  font-size: .88rem;
  color: var(--text-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- Estado vacío --- */
.empty {
  text-align: center;
  color: var(--text-soft);
  padding: 3rem 0;
  font-size: 1.05rem;
}

/* --- Footer --- */
.footer {
  border-top: 1px solid var(--border);
  padding: 1.75rem 1.25rem;
  text-align: center;
  color: var(--text-soft);
  font-size: .9rem;
}
.footer nav { margin-top: .5rem; }
.footer a { color: var(--brand); text-decoration: none; }
.footer a:hover { text-decoration: underline; }

/* --- Animación de entrada --- */
.reveal { opacity: 0; transform: translateY(10px); animation: rise .5s ease forwards; }
@keyframes rise { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; animation: none; }
  html { scroll-behavior: auto; }
}

/* --- Responsive --- */
@media (max-width: 560px) {
  .card-link { flex-direction: column; }
  .hero { padding-top: 2rem; }
}

/* --- Secciones editoriales del hub --- */
.section {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1rem 1.25rem 2.5rem;
}
.section-tight { padding-top: 0; }
.section h2 {
  font-size: clamp(1.3rem, 3vw, 1.7rem);
  letter-spacing: -.01em;
  margin-bottom: .75rem;
}
.section > p { color: var(--text-soft); max-width: 70ch; }
.section p + p { margin-top: .8rem; }
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}
.cat-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.2rem 1.25rem;
}
.cat-block h3 { font-size: 1.05rem; margin-bottom: .4rem; }
.cat-block p { font-size: .9rem; color: var(--text-soft); }
.faq details {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .9rem 1.1rem;
  margin-top: .6rem;
  box-shadow: var(--shadow);
}
.faq summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.faq summary::after {
  content: "+";
  font-size: 1.2rem;
  color: var(--brand);
  flex-shrink: 0;
}
.faq details[open] summary::after { content: "−"; }
.faq details p { margin-top: .6rem; color: var(--text-soft); font-size: .95rem; }

/* --- Páginas de contenido (acerca de, legal, contacto) --- */
.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3.5rem;
}
.page-header h1 { font-size: clamp(1.7rem, 4vw, 2.2rem); letter-spacing: -.02em; }
.page-header .updated {
  margin-top: .4rem;
  color: var(--text-soft);
  font-size: .85rem;
}
.prose { margin-top: 1.5rem; }
.prose h2 {
  font-size: 1.2rem;
  margin: 1.6rem 0 .6rem;
  padding-bottom: .3rem;
  border-bottom: 1px solid var(--border);
}
.prose p { color: var(--text-soft); margin-bottom: .8rem; }
.prose ul, .prose ol { color: var(--text-soft); margin: 0 0 .9rem 1.3rem; }
.prose li { margin-bottom: .35rem; }
.prose a { color: var(--brand); }
.prose strong { color: var(--text); }

/* --- Contacto --- */
.contact-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.4rem;
  margin-top: 1.2rem;
}
.contact-card p { color: var(--text-soft); }
.contact-card a { color: var(--brand); font-weight: 600; }

/* --- Banner de cookies --- */
.cookie-banner {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  z-index: 1000;
  max-width: 560px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 40px -12px rgba(0, 0, 0, .35);
  padding: 1.1rem 1.25rem;
  font-size: .9rem;
  color: var(--text);
  display: none;
}
.cookie-banner.show { display: block; animation: rise .3s ease forwards; }
.cookie-banner p { color: var(--text-soft); margin-bottom: .8rem; }
.cookie-banner p a { color: var(--brand); }
.cookie-btns { display: flex; gap: .5rem; flex-wrap: wrap; }
.cookie-btn {
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  padding: .55rem 1.1rem;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
}
.cookie-btn:active { transform: scale(.97); }
.cookie-btn.aceptar { background: var(--brand); color: #fff; }
.cookie-btn.rechazar { background: var(--chip-bg); color: var(--text); }
.cookie-btn:hover { opacity: .9; }
