/* =============================================================
   Micropaf — hoja de estilos única
   1 Tokens · 2 Reset · 3 Utilidades · 4 Botones · 5 Cabecera
   6 Hero · 7 Ecosistema · 8 Sobre nosotros · 9 Filosofía
   10 FAQ · 11 Footer · 12 Consentimiento · 13 Responsive · 14 Reduced-motion
   15 Fondo animado · 16 Anuncios · 17 Volver arriba · 18 Revelado
   19 Guias y articulos
   ============================================================= */

/* ===================== 1. TOKENS ===================== */
:root {
  --bg: #0c0b0a;
  --surface: #17140f;
  --surface-2: #1d1911;
  --ink: #f7f3ec;
  --ink-2: #d8d0c2;
  --muted: #96907f;
  --line: #2c2820;
  --line-2: #211e18;
  --accent: #d97706;
  --accent-2: #e8935a;
  --accent-ink: #1a0f04;
  --accent-soft: rgba(217, 119, 6, .16);
  --dest-soft: rgba(217, 119, 6, .1);
  --ok: #34d399;
  --warn: #f5b942;
  --bad: #f2596b;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 8px 24px -8px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .3);
  --shadow-lg: 0 28px 64px -24px rgba(0, 0, 0, .6), 0 6px 20px -8px rgba(0, 0, 0, .35);
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Plus Jakarta Sans", var(--sans);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --gutter: clamp(1rem, 4vw, 2rem);
  --maxw: 1120px;

  /* Fondo animado. Se declaran como tokens porque el tema claro los
     sustituye por versiones mucho mas suaves: sobre blanco, la misma
     intensidad que funciona en oscuro resulta chillona. */
  --orb-1: rgba(217, 119, 6, .62);
  --orb-2: rgba(232, 147, 90, .44);
  --orb-3: rgba(180, 60, 20, .32);
  --net-line: rgba(232, 147, 90, .30);
  --net-node: rgba(245, 176, 106, .85);
  --beam-1: rgba(217, 119, 6, .16);
  --beam-2: rgba(232, 147, 90, .10);
}

/* ---- Tema claro -------------------------------------------------------
   Se activa con data-theme="claro" en <html>, que pone el boton de la
   cabecera y recuerda main.js. Solo se redefinen los tokens: ni una
   regla de layout cambia, que es la ventaja de tenerlo todo en
   variables desde el principio. */
:root[data-theme="claro"] {
  --bg: #faf7f2;
  --surface: #ffffff;
  --surface-2: #f3ede3;
  --ink: #1b1712;
  --ink-2: #453d33;
  --muted: #7a6f61;
  --line: #e2d8c8;
  --line-2: #ece4d7;
  --accent: #b45309;
  --accent-2: #9a4a12;
  --accent-ink: #fffaf3;
  --accent-soft: rgba(180, 83, 9, .12);
  --dest-soft: rgba(180, 83, 9, .07);
  --ok: #0f7a52;
  --warn: #9a6600;
  --bad: #b3243a;
  --shadow-sm: 0 1px 2px rgba(80, 60, 30, .08);
  --shadow: 0 8px 24px -10px rgba(80, 60, 30, .22), 0 1px 3px rgba(80, 60, 30, .08);
  --shadow-lg: 0 28px 64px -28px rgba(80, 60, 30, .3), 0 6px 20px -10px rgba(80, 60, 30, .14);

  --orb-1: rgba(245, 158, 11, .36);
  --orb-2: rgba(232, 147, 90, .26);
  --orb-3: rgba(217, 119, 6, .18);
  --net-line: rgba(154, 74, 18, .22);
  --net-node: rgba(154, 74, 18, .45);
  --beam-1: rgba(245, 158, 11, .12);
  --beam-2: rgba(232, 147, 90, .08);
}

/* ===================== 2. RESET ===================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5rem; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  /* El degradado que habia aqui lo hace ahora la capa .bg, que ademas
     se mueve; dejarlo duplicado solo apagaba el contraste. */
  transition: background-color .3s var(--ease-out), color .3s var(--ease-out);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg, canvas, video { display: block; max-width: 100%; }
img { height: auto; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; line-height: 1.1; letter-spacing: -.01em; font-weight: 700; font-family: var(--display); }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 6px; }
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }

/* ===================== 3. UTILIDADES ===================== */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.container + .container { margin-top: clamp(2rem, 5vw, 3.5rem); }
.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 999;
  padding: .6rem 1rem; background: var(--accent); color: var(--accent-ink);
  border-radius: 8px; font-weight: 600;
}
.skip-link:focus { top: 1rem; }
.section-sub { color: var(--muted); margin-top: .35rem; margin-bottom: 1.5rem; max-width: 62ch; }
.section-tint { background: color-mix(in srgb, var(--surface) 55%, transparent); border-block: 1px solid var(--line-2); }
h2 { font-size: clamp(1.5rem, 3.2vw, 2rem); margin-bottom: .5rem; }

/* ===================== 4. BOTONES ===================== */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .8rem 1.3rem; border-radius: var(--radius-sm);
  font-weight: 700; font-size: .95rem;
  background: var(--accent); color: var(--accent-ink);
  transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-ghost {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .8rem 1.3rem; border-radius: var(--radius-sm);
  font-weight: 600; font-size: .95rem; color: var(--ink-2);
  border: 1px solid var(--line); transition: border-color .2s var(--ease-out), color .2s var(--ease-out);
}
.btn-ghost:hover { border-color: var(--accent-2); color: var(--ink); }

/* ===================== 5. CABECERA ===================== */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 800; letter-spacing: -.01em; }
.brand-mark {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: var(--accent); color: var(--accent-ink);
}
.brand-name { font-size: 1.2rem; font-family: var(--display); letter-spacing: .01em; }
.site-nav { display: none; gap: 1.5rem; font-size: .92rem; font-weight: 500; color: var(--ink-2); }
.site-nav a { padding: .25rem 0; border-bottom: 2px solid transparent; transition: border-color .2s var(--ease-out), color .2s var(--ease-out); }
.site-nav a:hover { color: var(--accent-2); border-bottom-color: var(--accent-2); }
@media (min-width: 720px) { .site-nav { display: flex; } }

/* ===================== 6. HERO ===================== */
.hero { padding-block: clamp(2.5rem, 7vw, 4.5rem) 1.5rem; position: relative; text-align: center; }
.section-kicker {
  display: block; font-family: var(--mono); font-size: .8rem; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 1rem;
}
.hero h1 { font-size: clamp(2.1rem, 5.4vw, 3.4rem); max-width: 22ch; margin-inline: auto; }
.hero h1 .hero-accent { color: var(--accent); }
.hero-sub { margin-top: 1rem; color: var(--ink-2); max-width: 62ch; margin-inline: auto; font-size: 1.1rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; justify-content: center; margin-top: 1.75rem; }
.hero-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(1.5rem, 5vw, 3rem); margin-top: 2.5rem; }
.hero-stat { text-align: center; }
.hero-stat strong { display: block; font-family: var(--display); font-size: clamp(1.6rem, 3.4vw, 2.1rem); color: var(--accent); }
.hero-stat span { color: var(--muted); font-size: .85rem; }
.hero-facts { display: flex; flex-wrap: wrap; gap: 1.5rem; justify-content: center; margin-top: 1.5rem; }
.hero-fact { display: inline-flex; align-items: center; gap: .5rem; font-size: .88rem; font-weight: 600; color: var(--ink-2); }
.hero-fact svg { color: var(--ok); flex-shrink: 0; }

/* ===================== 7. ECOSISTEMA ===================== */
.eco-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.eco-card {
  display: flex; flex-direction: column; gap: .6rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 1.4rem 1.5rem; transition: border-color .2s var(--ease-out), transform .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
.eco-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow); }
.eco-card-top { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.eco-tag {
  font-size: .72rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  color: var(--accent); background: var(--dest-soft); border-radius: 999px; padding: .25rem .6rem;
}
.eco-name { font-weight: 700; font-family: var(--display); font-size: 1.15rem; }
.eco-desc { color: var(--muted); font-size: .92rem; }
.eco-link { margin-top: auto; display: inline-flex; align-items: center; gap: .35rem; color: var(--accent); font-weight: 600; font-size: .88rem; }
.eco-card:hover .eco-link { text-decoration: underline; }

/* ===================== 8. SOBRE NOSOTROS ===================== */
.prose-section { padding-block: clamp(2.5rem, 6vw, 4rem); }
.prose-section h2 { font-size: clamp(1.6rem, 3.4vw, 2.1rem); margin-bottom: 1.1rem; }
.prose-section p { color: var(--ink-2); margin-top: 1rem; max-width: 74ch; font-size: 1.02rem; }
.prose-section p + h3 { margin-top: 1.75rem; }
.prose-section strong { color: var(--ink); }

/* ===================== 9. FILOSOFÍA ===================== */
.values-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.value-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.3rem 1.4rem;
}
.value-icon {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent); margin-bottom: .8rem;
}
.value-title { font-weight: 700; font-family: var(--display); font-size: 1.02rem; margin-bottom: .35rem; }
.value-desc { color: var(--muted); font-size: .9rem; }

/* ===================== 10. FAQ ===================== */
.faq-list { display: grid; gap: .6rem; }
.faq-item {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
}
.faq-item summary {
  font-weight: 600; display: flex; justify-content: space-between; align-items: center; gap: 1rem;
}
.faq-icon { position: relative; width: 18px; height: 18px; flex-shrink: 0; }
.faq-icon::before, .faq-icon::after {
  content: ""; position: absolute; background: var(--accent); border-radius: 2px; transition: transform .2s var(--ease-out), opacity .2s var(--ease-out);
}
.faq-icon::before { top: 50%; left: 0; width: 100%; height: 2px; transform: translateY(-50%); }
.faq-icon::after { left: 50%; top: 0; width: 2px; height: 100%; transform: translateX(-50%); }
.faq-item[open] .faq-icon::after { opacity: 0; transform: translateX(-50%) rotate(90deg); }
.faq-item p { margin-top: .7rem; color: var(--ink-2); }

/* ===================== 11. FOOTER ===================== */
.site-footer { padding-block: 2.5rem; margin-top: clamp(2.5rem, 6vw, 4rem); border-top: 1px solid var(--line); }
.footer-inner { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; }
.footer-brand { color: var(--muted); font-size: .9rem; }
.footer-nav { display: flex; gap: 1.2rem; font-size: .88rem; color: var(--ink-2); flex-wrap: wrap; }
.footer-nav a:hover { color: var(--accent); }

/* ===================== 12. CONSENTIMIENTO ===================== */
.consent-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
  background: var(--surface); color: var(--ink); padding: 1.1rem var(--gutter);
  border-top: 1px solid var(--line); box-shadow: 0 -12px 30px -12px rgba(0,0,0,.5);
}
.consent-banner[hidden] { display: none; }
.consent-inner {
  max-width: var(--maxw); margin-inline: auto; display: flex; flex-wrap: wrap;
  align-items: center; justify-content: space-between; gap: 1rem;
}
.consent-text { font-size: .88rem; color: var(--ink-2); max-width: 62ch; }
.consent-text a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.consent-actions { display: flex; gap: .6rem; flex-shrink: 0; }
.consent-actions .btn, .consent-actions .btn-ghost { padding: .6rem 1.05rem; font-size: .86rem; }

/* ===================== 13. RESPONSIVE ===================== */
@media (max-width: 539px) {
  .hero-actions { flex-direction: column; align-items: stretch; }
  .consent-inner { flex-direction: column; align-items: stretch; }
  .consent-actions { justify-content: stretch; }
  .consent-actions > * { flex: 1; text-align: center; }
}

/* ===================== 14. REDUCED-MOTION ===================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .eco-card, .btn { transition: none; }
  .eco-card:hover, .btn:hover { transform: none; }
  /* El fondo se congela en una composicion fija y sigue siendo el mismo
     fondo, solo que quieto: quien pide menos movimiento no pierde nada. */
  .bg-grid, .bg-orb, .bg-beam { animation: none !important; }
  .to-top { transition: none; }
  .js .reveal { opacity: 1; transform: none; }
}

/* =============================================================
   19. GUIAS Y ARTICULOS
   ============================================================= */

/* ---- Indice de guias ---- */
.guide-grid {
  display: grid; gap: .9rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  padding-bottom: clamp(2rem, 5vw, 3.5rem);
}
.guide-card {
  display: flex; flex-direction: column; gap: .45rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 1.4rem 1.5rem;
  transition: border-color .2s var(--ease-out), transform .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
.guide-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow); }
.guide-kicker {
  font-family: var(--mono); font-size: .72rem; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--accent);
}
.guide-title { font-size: 1.12rem; line-height: 1.25; margin: 0; }
.guide-desc { color: var(--muted); font-size: .89rem; }
.guide-card .eco-link { margin-top: auto; padding-top: .5rem; }

/* ---- Articulo ---- */
.article { max-width: 78ch; padding-block: clamp(1.5rem, 4vw, 2.5rem) clamp(2rem, 5vw, 3.5rem); }
.breadcrumb { font-size: .82rem; color: var(--muted); margin-bottom: 1.1rem; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); text-decoration: underline; }
.breadcrumb span { margin: 0 .35rem; }

.article h1 { font-size: clamp(1.7rem, 4.2vw, 2.5rem); margin-top: .5rem; }
.article-lead {
  margin-top: 1rem; font-size: 1.08rem; line-height: 1.6; color: var(--ink-2);
  max-width: 68ch;
}
.article-meta { margin-top: .9rem; font-size: .8rem; color: var(--muted); }

.article-body { margin-top: 2rem; }
.article-body h2 {
  font-size: clamp(1.25rem, 2.8vw, 1.55rem);
  margin-top: 2.25rem; margin-bottom: .25rem;
}
.article-body h2:first-child { margin-top: 0; }
.article-body p { color: var(--ink-2); margin-top: .9rem; line-height: 1.72; }
.article-body strong { color: var(--ink); }
.article-body em { color: var(--ink-2); }

.article-body ul, .article-body ol {
  margin-top: 1rem; padding-left: 1.35rem; color: var(--ink-2);
  display: grid; gap: .55rem; line-height: 1.65;
}
.article-body li strong { color: var(--ink); }
.article-body li::marker { color: var(--accent); }

.article-body code {
  font-family: var(--mono); font-size: .88em;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 5px; padding: .1em .35em;
}

/* Formula destacada */
.formula {
  font-family: var(--mono); font-size: 1rem; text-align: center;
  background: var(--surface); border: 1px solid var(--line-strong, var(--line));
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); padding: 1rem 1.2rem;
  margin-top: 1.2rem !important; color: var(--ink) !important;
  overflow-x: auto;
}

/* Aviso al pie de un articulo */
.note {
  font-size: .88rem !important; color: var(--muted) !important;
  background: var(--surface); border: 1px dashed var(--line);
  border-radius: var(--radius-sm); padding: .9rem 1.1rem;
  margin-top: 1.75rem !important;
}

/* Tabla de datos */
.table-wrap {
  overflow-x: auto; margin-top: 1.2rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface);
}
.data-table { width: 100%; min-width: 380px; border-collapse: collapse; font-size: .9rem; }
.data-table th, .data-table td { padding: .6rem .85rem; text-align: left; border-bottom: 1px solid var(--line); }
.data-table th {
  font-size: .74rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 700; background: var(--surface-2);
}
.data-table td { color: var(--ink-2); }
.data-table td:first-child { color: var(--ink); font-weight: 600; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--accent-soft); }

/* Llamada a la herramienta relacionada */
.tool-callout {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 1rem; margin-top: 2.5rem; padding: 1.25rem 1.4rem;
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--accent); border-radius: var(--radius);
}
.tool-callout strong { display: block; font-family: var(--display); font-size: 1.05rem; }
.tool-callout span { display: block; color: var(--muted); font-size: .87rem; margin-top: .15rem; }

.article-more { margin-top: 2rem; font-size: .9rem; }
.article-more a { color: var(--accent); }
.article-more a:hover { text-decoration: underline; }

/* =============================================================
   15. FONDO ANIMADO
   La marca de Micropaf es un nodo central rodeado de satelites. El fondo
   lo desarrolla a pantalla completa: una constelacion de nodos unidos por
   enlaces que late y deriva, con orbes de luz calida detras. Es la idea
   de "ecosistema" dibujada, no un degradado decorativo cualquiera.
   Todo va sobre transform/opacity para que lo componga la GPU.
   ============================================================= */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; contain: strict; }

/* --- Orbes de luz ------------------------------------------------------ */
.bg-orb { position: absolute; border-radius: 50%; filter: blur(70px); will-change: transform; }
.bg-orb-1 {
  width: 62vw; height: 62vw; max-width: 840px; max-height: 840px;
  left: -16vw; top: -18vw;
  background: radial-gradient(circle, var(--orb-1), transparent 66%);
  animation: orbFloat 46s ease-in-out infinite;
}
.bg-orb-2 {
  width: 50vw; height: 50vw; max-width: 700px; max-height: 700px;
  right: -14vw; top: 4vh;
  background: radial-gradient(circle, var(--orb-2), transparent 68%);
  animation: orbFloat 61s ease-in-out infinite reverse;
}
.bg-orb-3 {
  width: 66vw; height: 66vw; max-width: 940px; max-height: 940px;
  left: 18vw; top: 46vh;
  background: radial-gradient(circle, var(--orb-3), transparent 70%);
  animation: orbFloat 77s ease-in-out infinite;
}
@keyframes orbFloat {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  33%  { transform: translate3d(9vw, 5vh, 0) scale(1.14); }
  66%  { transform: translate3d(-7vw, 9vh, 0) scale(.88); }
  100% { transform: translate3d(0, 0, 0) scale(1); }
}

/* --- Constelacion ----------------------------------------------------- */
.bg-net {
  position: absolute; left: -6%; top: -6%; width: 112%; height: 112%;
  animation: netDrift 96s ease-in-out infinite;
}
.net-links { stroke: var(--net-line); stroke-width: 1.1; fill: none; }
.net-nodes { fill: var(--net-node); }
/* Cada nodo late con su propio retardo (--d), asi el conjunto no
   parpadea a la vez y parece una red viva en lugar de un patron. */
.net-node {
  transform-box: fill-box; transform-origin: center;
  animation: nodePulse 7s ease-in-out infinite;
  animation-delay: var(--d, 0s);
}
@keyframes nodePulse {
  0%, 100% { opacity: .35; transform: scale(.8); }
  50%      { opacity: 1;   transform: scale(1.45); }
}
@keyframes netDrift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(-3.5%, 2.5%, 0) scale(1.06); }
  100% { transform: translate3d(0, 0, 0) scale(1); }
}

/* --- Haz de luz que barre la parte alta, como un amanecer muy lento --- */
.bg-beam {
  position: absolute; left: 50%; top: -62vh;
  width: 150vmax; height: 150vmax; margin-left: -75vmax;
  background: conic-gradient(from 0deg,
    transparent 0deg, var(--beam-1) 16deg, transparent 44deg,
    transparent 176deg, var(--beam-2) 200deg, transparent 236deg);
  animation: beamSpin 150s linear infinite;
}
@keyframes beamSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* --- Velo inferior ----------------------------------------------------
   Por debajo del hero el fondo se apaga para que el texto de las
   secciones largas conserve todo el contraste. */
.bg-veil {
  position: absolute; inset: 0;
  background: linear-gradient(180deg,
    transparent 0%, transparent 30%,
    color-mix(in srgb, var(--bg) 62%, transparent) 62%,
    color-mix(in srgb, var(--bg) 94%, transparent) 100%);
}

/* ===================== 16. ANUNCIOS ===================== */
/* Hueco reservado con altura minima para que el anuncio no empuje el
   contenido al cargar (evita CLS). Vacio hasta que se pegue el codigo. */
.ad-slot {
  min-height: 90px; display: grid; place-items: center; gap: .2rem;
  border: 1px dashed var(--line); border-radius: var(--radius-sm);
  color: var(--muted); font-size: .78rem; text-align: center; padding: .75rem;
  background: color-mix(in srgb, var(--surface) 40%, transparent);
}
.ad-slot strong { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.ad-slot--infeed { min-height: 250px; }

/* ===================== 17. VOLVER ARRIBA ===================== */
.to-top {
  position: fixed; right: clamp(1rem, 3vw, 2rem); bottom: clamp(1rem, 3vw, 2rem);
  z-index: 70; width: 44px; height: 44px; display: grid; place-items: center;
  border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  box-shadow: var(--shadow);
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: opacity .25s var(--ease-out), transform .25s var(--ease-out), visibility .25s;
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover { transform: translateY(-2px); }
/* Con el banner de cookies abierto el boton se aparta para no taparlo.
   La altura real del banner la mide main.js y la deja en --consent-h,
   porque depende del ancho: en movil el texto ocupa cuatro lineas. */
body.has-consent .to-top { bottom: calc(var(--consent-h, 8rem) + .75rem); }

/* ===================== 18. REVELADO AL HACER SCROLL ===================== */
/* Solo se aplica si JS ha marcado el documento: sin JS todo se ve. */
.js .reveal { opacity: 0; transform: translateY(14px); }
.js .reveal.is-in { opacity: 1; transform: none; transition: opacity .55s var(--ease-out), transform .55s var(--ease-out); }

/* =============================================================
   20. PANTALLA DE CARGA
   Tapa el primer pintado, que en una pagina con fondo animado es
   cuando peor se ve. Se retira sola con una animacion CSS, sin
   depender de JS: si el script fallara, la pagina aparece igual.
   ============================================================= */
.boot {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
  background: var(--bg);
  animation: bootOut .35s var(--ease-out) .15s forwards;
  pointer-events: none;
}
.boot-mark {
  width: 54px; height: 54px; display: grid; place-items: center;
  border-radius: 14px; background: var(--accent); color: var(--accent-ink);
  animation: bootPulse 1.1s ease-in-out infinite;
}
@keyframes bootOut { to { opacity: 0; visibility: hidden; } }
@keyframes bootPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 var(--accent-soft); }
  50%      { transform: scale(1.08); box-shadow: 0 0 0 18px transparent; }
}

/* =============================================================
   21. ENTRADA DEL HERO
   Cada pieza entra escalonada. Se aplica solo con la clase .js para
   que sin JavaScript el hero se vea completo desde el primer pintado.
   ============================================================= */
.js .hero-anim { opacity: 0; animation: heroRise .7s var(--ease-out) forwards; }
.js .hero-anim-1 { animation-delay: .45s; }
.js .hero-anim-2 { animation-delay: .55s; }
.js .hero-anim-3 { animation-delay: .68s; }
.js .hero-anim-4 { animation-delay: .8s; }
.js .hero-anim-5 { animation-delay: .92s; }
@keyframes heroRise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}
.hero-stat strong { font-variant-numeric: tabular-nums; }

/* =============================================================
   22. CABECERA: TEMA Y NAVEGACION MOVIL
   ============================================================= */
.header-tools { display: flex; align-items: center; gap: .4rem; }
.icon-btn {
  display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: 10px; border: 1px solid var(--line); color: var(--ink-2);
  transition: border-color .2s var(--ease-out), color .2s var(--ease-out),
              background-color .2s var(--ease-out);
}
.icon-btn:hover { border-color: var(--accent-2); color: var(--accent); background: var(--accent-soft); }
.icon-btn svg { transition: transform .35s var(--ease-out); }
.icon-btn:hover svg { transform: rotate(18deg); }
.icon-sun { display: none; }
:root[data-theme="claro"] .icon-sun { display: block; }
:root[data-theme="claro"] .icon-moon { display: none; }

.nav-toggle { display: grid; }
@media (min-width: 720px) { .nav-toggle { display: none; } }
.nav-toggle span {
  display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px;
  transition: transform .3s var(--ease-out), opacity .2s var(--ease-out);
}
.nav-toggle span + span { margin-top: 4px; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Panel desplegable en movil. Por debajo de 720 px la cabecera no tenia
   ninguna navegacion: el menu era sencillamente inaccesible. */
.nav-panel {
  position: fixed; left: 0; right: 0; top: 64px; z-index: 55;
  background: var(--bg); border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  display: grid; gap: .15rem; padding: .75rem var(--gutter) 1.1rem;
  transform: translateY(-14px); opacity: 0; visibility: hidden;
  transition: transform .28s var(--ease-out), opacity .28s var(--ease-out), visibility .28s;
}
.nav-panel.is-open { transform: none; opacity: 1; visibility: visible; }
.nav-panel a {
  padding: .8rem .6rem; border-radius: var(--radius-sm); font-weight: 600; color: var(--ink-2);
  border-left: 3px solid transparent;
  transition: background-color .2s var(--ease-out), color .2s var(--ease-out), border-color .2s var(--ease-out);
}
.nav-panel a:hover, .nav-panel a:focus-visible {
  background: var(--dest-soft); color: var(--ink); border-left-color: var(--accent);
}
@media (min-width: 720px) { .nav-panel { display: none; } }

/* =============================================================
   23. MICROINTERACCIONES
   ============================================================= */
.btn { position: relative; overflow: hidden; }
.btn::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .38) 50%, transparent 65%);
  transform: translateX(-120%);
  transition: transform .6s var(--ease-out);
}
.btn:hover::after, .btn:focus-visible::after { transform: translateX(120%); }
.btn:active, .btn-ghost:active { transform: translateY(1px) scale(.985); }

.eco-link { display: inline-flex; align-items: center; gap: .35rem; transition: gap .25s var(--ease-out), color .2s var(--ease-out); }
.eco-card:hover .eco-link, .guide-card:hover .eco-link { gap: .6rem; }

.eco-card, .guide-card, .value-card {
  transition: transform .25s var(--ease-out), border-color .25s var(--ease-out),
              box-shadow .25s var(--ease-out), background-color .25s var(--ease-out);
}
.eco-card:hover, .guide-card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: var(--shadow-lg); }
.value-card:hover { border-color: var(--accent-2); }

/* =============================================================
   24. BANDA DE LLAMADA A LA ACCION
   ============================================================= */
.cta-band {
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface);
  padding: clamp(1.75rem, 5vw, 2.75rem);
  text-align: center; position: relative; overflow: hidden;
}
.cta-band::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent);
}
.cta-band h2 { margin-bottom: .6rem; }
.cta-band p { color: var(--ink-2); max-width: 56ch; margin-inline: auto; }
.cta-actions { display: flex; flex-wrap: wrap; gap: .8rem; justify-content: center; margin-top: 1.5rem; }

/* =============================================================
   25. FORMULARIO DE CONTACTO
   Sin servidor: valida en el navegador y abre el correo ya redactado.
   ============================================================= */
.form-grid { display: grid; gap: 1.1rem; max-width: 62ch; margin-top: 1.5rem; }
.field { display: grid; gap: .4rem; }
.field label { font-weight: 600; font-size: .9rem; }
.field input, .field select, .field textarea {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: .7rem .85rem; width: 100%;
  transition: border-color .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
.field textarea { min-height: 150px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.field-error { color: var(--bad); font-size: .82rem; min-height: 1.1em; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--bad); }
.form-note { color: var(--muted); font-size: .85rem; margin-top: .4rem; }
.form-status { margin-top: 1rem; font-weight: 600; }
.form-status[data-state="ok"] { color: var(--ok); }
.form-status[data-state="error"] { color: var(--bad); }

/* =============================================================
   26. TRANSICIONES ENTRE PAGINAS
   Mejora progresiva: quien no la soporte navega como siempre.
   ============================================================= */
@view-transition { navigation: auto; }

/* =============================================================
   27. REDUCED-MOTION (complemento de la seccion 14)
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  .bg-net, .net-node { animation: none !important; }
  .js .hero-anim { opacity: 1; animation: none; }
  .boot { animation: none; opacity: 0; visibility: hidden; }
  .btn::after { display: none; }
  .eco-card:hover, .guide-card:hover { transform: none; }
  .nav-panel { transition: none; }
}
