/* ============================================================
   CARTERASINESTRES.COM — HEADER, FOOTER Y BANNER DE COOKIES
   Fuente única del diseño compartido, tomada del index.
   Las variables se declaran aquí para no depender de cada página.
   ============================================================ */
header, footer, #cookie-banner {
  --verde: #1a7f5a;
  --verde-claro: #22a870;
  --dorado: #f5a623;
  --blanco: #ffffff;
  --gris-claro: #f1f5f3;
  --gris-borde: #e2e8f0;
  --gris-oscuro: #2d3748;
  --negro: #1a202c;
  --sombra: 0 4px 20px rgba(0,0,0,0.08);
  --sombra-hover: 0 8px 30px rgba(0,0,0,0.15);
  --radio: 12px;
  --transicion: all 0.3s ease;
  font-family: 'Inter', sans-serif;
  line-height: 1.6;
}
:where(header, footer, #cookie-banner) *, :where(header, footer, #cookie-banner) *::before, :where(header, footer, #cookie-banner) *::after { box-sizing: border-box; margin: 0; padding: 0; }
:where(header, footer) a { text-decoration: none; color: inherit; }
:where(header, footer) img { max-width: 100%; display: block; }
header .contenedor, footer .contenedor { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* Las dimensiones en HTML reservan el hueco de la imagen sin deformarla */
:where(img[width][height]) { height: auto; }

.saltar-contenido {
  position: absolute; left: 16px; top: -60px; z-index: 10000;
  background: #1a7f5a; color: #fff; padding: 10px 16px; border-radius: 8px;
  font-family: 'Inter', sans-serif; font-weight: 600;
}
.saltar-contenido:focus { top: 16px; }

/* ============ COOKIE BANNER ============ */
#cookie-banner {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--negro);
  color: #fff;
  padding: 16px 24px;
  z-index: 9999;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
}
.cookie-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
#cookie-banner p { flex: 1; font-size: 0.85rem; color: #cbd5e0; min-width: 280px; }
#cookie-banner a { color: var(--verde-claro); text-decoration: underline; }
.btn-cookie-aceptar {
  background: var(--verde); color: #fff; border: none;
  padding: 10px 22px; border-radius: 8px; cursor: pointer; font-weight: 600;
}
.btn-cookie-rechazar {
  background: transparent; color: #cbd5e0;
  border: 1px solid #4a5568;
  padding: 10px 22px; border-radius: 8px; cursor: pointer; font-weight: 600;
}

/* ============ HEADER ============ */
header {
  background: var(--blanco);
  box-shadow: var(--sombra);
  position: sticky; top: 0;
  z-index: 100;
}
header nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 0;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  font-size: 1.4rem; font-weight: 800; color: var(--verde);
}
.logo-icono {
  width: 40px; height: 40px;
  border-radius: 50%;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo-icono img { width: 100%; height: 100%; object-fit: cover; }
.logo-verde { color: var(--verde-claro); }
.logo-oscuro { color: var(--negro); }
footer .logo-oscuro { color: var(--blanco); }

.nav-links {
  display: flex; align-items: center; gap: 32px;
  list-style: none;
}
.nav-links a {
  color: var(--gris-oscuro); font-weight: 500; font-size: 0.95rem;
  transition: var(--transicion); position: relative;
}
.nav-links a::after {
  content: ''; position: absolute; bottom: -4px; left: 0; right: 0;
  height: 2px; background: var(--verde);
  transform: scaleX(0); transition: transform 0.3s ease;
}
.nav-links a:hover { color: var(--verde); }
.nav-links a:hover::after { transform: scaleX(1); }

/* ============ MENÚ DESPLEGABLE (Temas / Herramientas) ============ */
.nav-dropdown { position: relative; }
.nav-dropdown > a { cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 4px; }
.flecha-desplegable { font-size: 0.7rem; transition: transform 0.2s ease; }

/* Escritorio: menú flotante que aparece con el ratón */
.nav-dropdown-menu {
  position: absolute; top: 100%; left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--blanco); border-radius: var(--radio);
  box-shadow: var(--sombra-hover); padding: 10px 0;
  min-width: 240px; list-style: none; margin-top: 10px;
  border: 1px solid var(--gris-borde);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  z-index: 999;
}
.nav-dropdown-menu::before {
  content: '';
  position: absolute;
  top: -10px; left: 0; right: 0;
  height: 10px;
  background: transparent;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu,
.nav-dropdown.abierto .nav-dropdown-menu {
  opacity: 1; visibility: visible; pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.nav-dropdown-menu li a { display: block; padding: 10px 20px; font-size: 0.9rem; }
.nav-dropdown-menu li a:hover { background: var(--gris-claro); color: var(--verde); }
.nav-dropdown-menu li a::after { display: none; }

/* Móvil: acordeón que se pliega a altura CERO de verdad, sin dejar hueco */
@media (max-width: 768px) {
  .nav-dropdown { width: 100%; }
  .nav-dropdown-menu {
    position: static; transform: none; box-shadow: none; border: none;
    opacity: 1; visibility: visible; pointer-events: auto;
    margin: 0; padding: 0; min-width: auto;
    max-height: 0; overflow: hidden;
    transition: max-height 0.25s ease;
  }
  .nav-dropdown.abierto .nav-dropdown-menu {
    max-height: 400px; padding: 6px 0 6px 18px;
    transform: none;
  }
}
.hamburger {
  display: none; flex-direction: column; gap: 5px;
  cursor: pointer; background: none; border: none; padding: 4px;
}
.hamburger span {
  display: block; width: 25px; height: 2px;
  background: var(--negro); border-radius: 2px;
}

/* ============ FOOTER ============ */
footer { background: var(--negro); color: #a0aec0; padding: 60px 0 0; }
.disclaimer-footer {
  background: rgba(255,255,255,0.05);
  border-left: 3px solid var(--verde);
  padding: 16px 20px; margin-bottom: 32px;
  border-radius: 0 8px 8px 0;
  font-size: 0.8rem; line-height: 1.6; font-style: italic;
}
.footer-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px; padding-bottom: 40px;
}
.footer-brand .logo { color: var(--blanco); margin-bottom: 12px; }
.footer-brand p { font-size: 0.88rem; line-height: 1.7; margin-bottom: 16px; }
.footer-col .footer-titulo { color: var(--blanco); font-size: 0.95rem; font-weight: 700; margin-bottom: 16px; }
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 10px; }
.footer-col ul li a { font-size: 0.88rem; color: #a0aec0; cursor: pointer; }
.footer-col ul li a:hover { color: var(--verde-claro); }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 20px 0;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}
.footer-bottom p { font-size: 0.82rem; }
.footer-legal { display: flex; gap: 20px; }
.footer-legal a { font-size: 0.82rem; color: #a0aec0; cursor: pointer; }
.footer-legal a:hover { color: var(--blanco); }
.footer-legal { flex-wrap: wrap; }
.footer-cookies { background: none; border: 0; font: inherit; font-size: 0.82rem; color: #a0aec0; cursor: pointer; }
.footer-cookies:hover { color: var(--blanco); }
.autor-enlace { color: inherit; text-decoration: underline; }

/* ============ PIEZAS COMPARTIDAS DE LOS ARTÍCULOS ============ */
.articulo-cuerpo .h-menor { font-size: 1rem; font-weight: 700; color: var(--negro, #1a202c); margin: 0; }
button.compartir-btn { border: none; cursor: pointer; font: inherit; }
.articulo-layout > * { min-width: 0; }
.compartir { flex-wrap: wrap; }
.articulo-cuerpo { overflow-wrap: break-word; }

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .nav-links { display: none; }
  .hamburger { display: flex; }
  .nav-links.abierto {
    display: flex; flex-direction: column;
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--blanco); padding: 20px 24px;
    gap: 16px; box-shadow: var(--sombra);
  }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; text-align: center; }
  /* Las tablas anchas se desplazan dentro de su caja, no mueven la página */
  .articulo-cuerpo table { display: block; width: 100% !important; overflow-x: auto; }
}
