/* Estilos comunes de sebastianmarin.net: nav, footer y base de accesibilidad. */

/* Nav único del sitio (todas las páginas salvo /libro/).
   La posición (fixed, sticky o estática), la altura y el `top` los define cada página. */
nav.snav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0 2rem; background: #160A30; }
nav.snav.snav-static { position: relative; z-index: 100; }
.snav-brand { display: block; flex-shrink: 0; line-height: 0; }
.snav-brand img { height: 36px !important; width: auto !important; display: block; }

.snav-links { display: flex; align-items: center; gap: 2rem; list-style: none; margin: 0 auto 0 2.5rem; padding: 0; }
.snav-links a, .snav-sub-btn { color: rgba(255,255,255,0.8); font-family: inherit; font-size: 0.88rem; font-weight: 500; line-height: 1.2; text-decoration: none; background: none; border: 0; padding: 0.6rem 0; cursor: pointer; transition: color 0.2s; white-space: nowrap; }
.snav-links a:hover, .snav-sub-btn:hover, .snav-has-sub.is-open .snav-sub-btn { color: #fff; }
.snav-sub-btn::after { content: ''; display: inline-block; width: 0.4em; height: 0.4em; margin-left: 0.5em; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-0.2em) rotate(45deg); }
.snav-has-sub { position: relative; }
.snav-sub { display: none; position: absolute; top: 100%; left: -1rem; min-width: 230px; list-style: none; margin: 0; padding: 0.5rem; background: #160A30; border: 1px solid rgba(255,255,255,0.16); border-radius: 12px; box-shadow: 0 16px 40px rgba(0,0,0,0.35); }
.snav-sub a { display: block; padding: 0.7rem 0.75rem; border-radius: 8px; }
.snav-sub a:hover { background: rgba(255,255,255,0.08); }
.snav-has-sub.is-open .snav-sub { display: block; }
.snav-lang-item { display: none; }

.snav-actions { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }
.snav-lang { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 0.8rem; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; color: rgba(255,255,255,0.8); text-decoration: none; border: 1px solid rgba(255,255,255,0.3); border-radius: 100px; transition: color 0.2s, border-color 0.2s; }
.snav-lang:hover { color: #fff; border-color: #fff; }
.snav-cta { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 1.25rem; background: #AAFF47; color: #160A30; font-size: 0.85rem; font-weight: 700; text-decoration: none; border-radius: 100px; white-space: nowrap; transition: opacity 0.2s; }
.snav-cta:hover { opacity: 0.88; }
.snav-cta-short { display: none; }
.snav-toggle { display: none; align-items: center; justify-content: center; width: 44px; height: 44px; margin-right: -0.5rem; background: none; border: 0; color: #fff; cursor: pointer; }
.snav-toggle svg { width: 24px; height: 24px; display: block; }
.snav-toggle .snav-icon-close, nav.snav.is-open .snav-toggle .snav-icon-open { display: none; }
nav.snav.is-open .snav-toggle .snav-icon-close { display: block; }
nav.snav a:focus-visible, nav.snav button:focus-visible { outline: 2px solid #AAFF47; outline-offset: 3px; border-radius: 6px; }

@media (min-width: 861px) and (hover: hover) {
  .snav-has-sub:hover .snav-sub, .snav-has-sub:focus-within .snav-sub { display: block; }
}
@media (max-width: 1040px) {
  .snav-cta-full { display: none; }
  .snav-cta-short { display: inline; }
  .snav-links { gap: 1.5rem; margin-left: 1.5rem; }
}
@media (max-width: 860px) {
  nav.snav { padding: 0 1rem; gap: 0.5rem; }
  .snav-brand img { height: 30px !important; }
  .snav-toggle { display: inline-flex; }
  .snav-links { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0; margin: 0; padding: 0.5rem 1.25rem 1.25rem; background: #160A30; border-top: 1px solid rgba(255,255,255,0.12); box-shadow: 0 24px 40px rgba(0,0,0,0.4); max-height: calc(100vh - 110px); overflow-y: auto; }
  nav.snav.is-open .snav-links { display: flex; }
  .snav-links a { display: flex; align-items: center; min-height: 48px; font-size: 1rem; color: #fff; padding: 0; }
  .snav-links > li + li { border-top: 1px solid rgba(255,255,255,0.1); }
  .snav-sub-btn { pointer-events: none; display: block; padding: 1rem 0 0.25rem; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(255,255,255,0.6); }
  .snav-sub-btn::after { display: none; }
  .snav-sub, .snav-has-sub.is-open .snav-sub { display: block; position: static; min-width: 0; padding: 0 0 0.5rem; border: 0; border-radius: 0; box-shadow: none; background: none; }
  .snav-sub a { padding: 0; border-radius: 0; }
  .snav-cta { padding: 0 1rem; }
}
@media (max-width: 420px) {
  .snav-actions .snav-lang { display: none; }
  .snav-lang-item { display: block; }
  .snav-brand img { height: 28px !important; }
}

/* Las anclas no quedan tapadas por el nav fijo */
section[id], main[id], div[id].section { scroll-margin-top: 72px; }
.announce-bar ~ section[id], .announce-bar ~ main section[id] { scroll-margin-top: 104px; }

/* Footer único del sitio (todas las páginas salvo /libro/) */
footer.sfoot { background: #160A30; padding: 3rem 2rem 2rem; margin: 0; border: 0; text-align: left; font-size: 0.85rem; line-height: 1.5; color: rgba(255,255,255,0.7); }
.sfoot-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 1.5rem 3rem; flex-wrap: wrap; max-width: 1000px; margin: 0 auto; }
.sfoot-brand { display: block; line-height: 0; flex-shrink: 0; }
.sfoot-brand img { height: 32px; width: auto; display: block; }
.sfoot-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0 1.5rem; max-width: 620px; list-style: none; margin: 0; padding: 0; }
.sfoot a { color: rgba(255,255,255,0.78); text-decoration: none; font-size: 0.85rem; font-weight: 500; transition: color 0.2s; }
.sfoot a:hover { color: #fff; }
.sfoot-links a { display: inline-block; padding: 0.5rem 0; }
.sfoot-bottom { display: flex; align-items: center; justify-content: space-between; gap: 1rem 2rem; flex-wrap: wrap; max-width: 1000px; margin: 1.5rem auto 0; padding-top: 1.5rem; border-top: 1px solid rgba(255,255,255,0.12); }
.sfoot-copy { font-size: 0.75rem; color: rgba(255,255,255,0.6); margin: 0; }
.sfoot-social { display: flex; gap: 0.75rem; }
.sfoot-social a { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.2); color: rgba(255,255,255,0.78); transition: color 0.2s, border-color 0.2s; }
.sfoot-social a:hover { color: #AAFF47; border-color: #AAFF47; }
.sfoot-social svg { width: 18px; height: 18px; fill: currentColor; }
@media (max-width: 860px) {
  footer.sfoot { padding: 2.5rem 1.25rem 2rem; }
  .sfoot-row { flex-direction: column; }
  .sfoot-links { justify-content: flex-start; max-width: none; }
  .sfoot-links a { padding: 0.8rem 0; }
  .sfoot-bottom { flex-direction: column-reverse; align-items: flex-start; }
}

/* Base de accesibilidad común a todo el sitio. */

/* Enlace para saltar al contenido: visible solo al recibir foco con teclado */
.skip-link { position: absolute; left: 1rem; top: -120px; z-index: 1000; padding: 0.8rem 1.25rem; background: #AAFF47; color: #160A30; font-weight: 700; font-size: 0.95rem; text-decoration: none; border-radius: 0 0 10px 10px; }
.skip-link:focus { top: 0; }

/* Foco visible con teclado: anillo lima con borde oscuro, se distingue sobre fondos claros y oscuros */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid #AAFF47 !important; outline-offset: 2px; box-shadow: 0 0 0 5px #160A30;
}
main:focus { outline: none; }

/* Preguntas frecuentes como botón */
button.faq-q { width: 100%; background: none; border: 0; font-family: inherit; color: inherit; text-align: left; }

/* Áreas táctiles (footer propio del libro) */
.footer-social a { width: 44px !important; height: 44px !important; }

/* Respeta la preferencia de menos movimiento */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
