/* ============================================================
   ESPACIO ROJO — Base compartida
   Tokens, reset, nav, footer, back-to-top, reveal.
   Antes esto vivía duplicado dentro de cada .html.
   ============================================================ */

:root {
  --red: #e63946;
  --red-deep: #b01d2a;
  --red-glow: rgba(230, 57, 70, 0.12);
  --ink: #0d0d0d;
  --ink-soft: #1a1a1a;
  --cream: #faf8f5;
  --white: #ffffff;
  --muted: #6b6b6b;
  --muted-light: #999;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.14);
  --nav-h: 68px;
  --ease: 0.32s cubic-bezier(0.25, 0.8, 0.25, 1);
  --ease-out: 0.22s ease-out;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
/* El [hidden] del navegador viene del user-agent y pierde contra
   cualquier display: grid/flex del autor. Sin esto, ocultar una
   tarjeta con el atributo hidden no hace nada. */
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 1rem); }
body {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  background: var(--cream);
  color: var(--ink);
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }

/* Accesibilidad: salto al contenido para lectores de pantalla y teclado */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 1000;
  background: var(--red); color: #fff; padding: 0.75rem 1.25rem;
  border-radius: 0 0 8px 0; font-size: 0.9rem;
}
.skip-link:focus { left: 0; }

:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; border-radius: 4px; }

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

/* ---------- NAV ---------- */
/* Va por clase, no por etiqueta: la página usa <nav> también para
   las migas, el índice del artículo y la paginación. */
.site-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 900; height: var(--nav-h);
  background: rgba(13, 13, 13, 0.96); backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex; align-items: center; justify-content: space-between; padding: 0 2.5rem;
}
.site-nav.scrolled { border-bottom-color: rgba(255, 255, 255, 0.12); box-shadow: 0 4px 32px rgba(0, 0, 0, 0.28); }
.nav-logo { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 1.25rem; color: #fff; letter-spacing: -0.02em; }
.nav-logo span { color: var(--red); }
.nav-links { display: flex; align-items: center; gap: 0.25rem; }
.nav-link {
  color: rgba(255, 255, 255, 0.6); font-size: 0.9rem; padding: 0.5rem 0.9rem; border-radius: 8px;
  transition: color var(--ease-out), background var(--ease-out);
}
.nav-link:hover, .nav-link.active { color: #fff; background: rgba(255, 255, 255, 0.06); }
.nav-cta {
  background: var(--red); color: #fff; font-size: 0.88rem; font-weight: 500;
  padding: 0.55rem 1.3rem; border-radius: 100px; margin-left: 0.5rem;
  transition: background var(--ease-out);
}
.nav-cta:hover { background: var(--red-deep); }
.nav-burger { display: none; background: none; border: none; color: #fff; font-size: 1.3rem; cursor: pointer; padding: 0.5rem; }

.mobile-nav {
  display: none; position: fixed; top: var(--nav-h); left: 0; right: 0; bottom: 0;
  background: var(--ink); z-index: 800; flex-direction: column; padding: 2rem; gap: 0.5rem;
}
.mobile-nav.open { display: flex; }
.mobile-nav a {
  color: rgba(255, 255, 255, 0.7); font-size: 1.1rem; padding: 0.85rem 1rem;
  border-radius: 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.mobile-nav .nav-cta { color: #fff; border-bottom: none; background: var(--red); text-align: center; margin-top: 1rem; }

/* ---------- HERO DE PÁGINA ---------- */
.page-hero {
  padding-top: var(--nav-h); min-height: 46vh; background: var(--ink);
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end;
  padding-left: clamp(1.5rem, 6vw, 6rem); padding-right: clamp(1.5rem, 6vw, 6rem); padding-bottom: 4.5rem;
}
.page-hero-glow {
  position: absolute; top: -100px; right: -100px; width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(230, 57, 70, 0.2) 0%, transparent 65%); pointer-events: none;
}
.page-hero-grid {
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 64px 64px;
}
.page-hero-inner { position: relative; z-index: 2; }
.page-hero h1 {
  font-family: 'Syne', sans-serif; font-weight: 800; font-size: clamp(2rem, 5vw, 3.8rem);
  letter-spacing: -0.035em; color: #fff; line-height: 1.05; margin-bottom: 0.9rem;
}
.page-hero h1 span { color: var(--red); }
.page-hero p { color: rgba(255, 255, 255, 0.5); font-size: 1rem; font-weight: 300; line-height: 1.75; max-width: 520px; }

.breadcrumb {
  display: flex; align-items: center; gap: 0.5rem; color: rgba(255, 255, 255, 0.35);
  font-size: 0.8rem; margin-bottom: 1.5rem; flex-wrap: wrap; list-style: none;
}
.breadcrumb li { display: flex; align-items: center; gap: 0.5rem; }
.breadcrumb a { color: rgba(255, 255, 255, 0.45); transition: color var(--ease-out); }
.breadcrumb a:hover { color: #fff; }
.breadcrumb i { font-size: 0.55rem; }

/* ---------- BACK TO TOP ---------- */
.back-to-top {
  position: fixed; bottom: 2rem; right: 2rem; z-index: 800; width: 44px; height: 44px;
  border-radius: 50%; background: var(--red); color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 0.9rem;
  box-shadow: 0 4px 20px rgba(230, 57, 70, 0.4);
  opacity: 0; transform: translateY(10px); pointer-events: none;
  transition: opacity 0.28s, transform 0.28s, background 0.2s;
}
.back-to-top.visible { opacity: 1; transform: translateY(0); pointer-events: all; }
.back-to-top:hover { background: var(--red-deep); transform: translateY(-2px); }

/* ---------- TOAST (reemplaza los alert()) ---------- */
.toast {
  position: fixed; bottom: 2rem; left: 50%; transform: translate(-50%, 20px);
  z-index: 1000; background: var(--ink); color: #fff; font-size: 0.9rem;
  padding: 0.8rem 1.4rem; border-radius: 100px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s;
  display: flex; align-items: center; gap: 0.55rem; max-width: calc(100vw - 2rem);
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.toast i { color: #4ade80; }
.toast.error i { color: var(--red); }

/* ---------- FOOTER ---------- */
footer { background: var(--ink); color: rgba(255, 255, 255, 0.45); padding: 4rem clamp(1.5rem, 6vw, 6rem) 0; }
.footer-inner {
  display: grid; grid-template-columns: 1.6fr 1fr 1fr 1.1fr; gap: 2.5rem;
  padding-bottom: 3rem; border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.footer-brand-name { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 1.2rem; color: #fff; margin-bottom: 0.65rem; }
.footer-brand-name span { color: var(--red); }
.footer-tagline { font-size: 0.85rem; color: rgba(255, 255, 255, 0.38); line-height: 1.72; margin-bottom: 1.25rem; max-width: 210px; }
.footer-social { display: flex; gap: 0.55rem; }
.footer-social-btn {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255, 255, 255, 0.45); font-size: 0.85rem; transition: all var(--ease-out);
}
.footer-social-btn:hover { border-color: var(--red); color: var(--red); background: var(--red-glow); }
.footer-col-title {
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.28); margin-bottom: 1.1rem;
}
.footer-col-links { display: flex; flex-direction: column; gap: 0.7rem; }
.footer-col-links a { font-size: 0.875rem; color: rgba(255, 255, 255, 0.5); transition: color var(--ease-out); }
.footer-col-links a:hover { color: #fff; }
.footer-contact-item {
  display: flex; align-items: center; gap: 0.6rem; font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.5); margin-bottom: 0.7rem;
}
.footer-contact-item i { color: var(--red); font-size: 0.78rem; width: 14px; text-align: center; }
.footer-contact-item a { color: rgba(255, 255, 255, 0.5); transition: color var(--ease-out); }
.footer-contact-item a:hover { color: #fff; }
.footer-bottom {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 0; flex-wrap: wrap; gap: 0.75rem; font-size: 0.78rem;
}
.footer-badge { display: inline-flex; align-items: center; gap: 0.4rem; color: rgba(255, 255, 255, 0.28); }
.footer-badge i { color: var(--red); font-size: 0.65rem; }

/* ---------- REVEAL ---------- */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.55s ease, transform 0.55s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important; scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}

@media (max-width: 780px) {
  .site-nav { padding: 0 1.25rem; }
  .nav-links { display: none; }
  .nav-burger { display: block; }
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 2rem; }
}
@media (max-width: 480px) {
  .footer-inner { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}
